├── .eslintrc ├── .gitignore ├── .travis.yml ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── README.md ├── Rakefile ├── app ├── assets │ ├── config │ │ └── arara_manifest.js │ ├── images │ │ └── arara │ │ │ └── .keep │ └── stylesheets │ │ └── arara │ │ └── application.css ├── components │ ├── arara.rb │ └── arara │ │ ├── base_component.rb │ │ ├── button_component.html.erb │ │ ├── button_component.rb │ │ ├── card_action_buttons_component.html.erb │ │ ├── card_action_buttons_component.rb │ │ ├── card_action_icons_component.html.erb │ │ ├── card_action_icons_component.rb │ │ ├── card_actions_component.html.erb │ │ ├── card_actions_component.rb │ │ ├── card_component.html.erb │ │ ├── card_component.rb │ │ ├── card_media_component.html.erb │ │ ├── card_media_component.rb │ │ ├── card_media_content_component.html.erb │ │ ├── card_media_content_component.rb │ │ ├── card_primary_content_component.html.erb │ │ ├── card_primary_content_component.rb │ │ ├── checkbox_component.html.erb │ │ ├── checkbox_component.rb │ │ ├── chip_component.html.erb │ │ ├── chip_component.rb │ │ ├── chipset_component.html.erb │ │ ├── chipset_component.rb │ │ ├── data_table_body_cell_component.html.erb │ │ ├── data_table_body_cell_component.rb │ │ ├── data_table_body_checkbox_component.html.erb │ │ ├── data_table_body_checkbox_component.rb │ │ ├── data_table_body_component.html.erb │ │ ├── data_table_body_component.rb │ │ ├── data_table_body_row_component.html.erb │ │ ├── data_table_body_row_component.rb │ │ ├── data_table_component.html.erb │ │ ├── data_table_component.rb │ │ ├── data_table_header_cell_component.html.erb │ │ ├── data_table_header_cell_component.rb │ │ ├── data_table_header_checkbox_component.html.erb │ │ ├── data_table_header_checkbox_component.rb │ │ ├── data_table_header_component.html.erb │ │ ├── data_table_header_component.rb │ │ ├── data_table_header_row_component.html.erb │ │ ├── data_table_header_row_component.rb │ │ ├── dialog_button_component.html.erb │ │ ├── dialog_button_component.rb │ │ ├── dialog_component.html.erb │ │ ├── dialog_component.rb │ │ ├── dialog_content_component.html.erb │ │ ├── dialog_content_component.rb │ │ ├── dialog_footer_component.html.erb │ │ ├── dialog_footer_component.rb │ │ ├── dialog_title_component.html.erb │ │ ├── dialog_title_component.rb │ │ ├── elevation_component.html.erb │ │ ├── elevation_component.rb │ │ ├── fab_component.html.erb │ │ ├── fab_component.rb │ │ ├── fab_icon_component.html.erb │ │ ├── fab_icon_component.rb │ │ ├── form_builder.rb │ │ ├── form_field_component.html.erb │ │ ├── form_field_component.rb │ │ ├── google_calendar │ │ ├── menu_item_component.html.erb │ │ ├── menu_item_component.rb │ │ ├── nav_bar_component.html.erb │ │ └── nav_bar_component.rb │ │ ├── icon_button_component.html.erb │ │ ├── icon_button_component.rb │ │ ├── icon_toggle_component.html.erb │ │ ├── icon_toggle_component.rb │ │ ├── material_icon_component.html.erb │ │ ├── material_icon_component.rb │ │ ├── menu_component.html.erb │ │ ├── menu_component.rb │ │ ├── menu_divider_component.html.erb │ │ ├── menu_divider_component.rb │ │ ├── menu_item_component.html.erb │ │ ├── menu_item_component.rb │ │ ├── nav_bar_component.html.erb │ │ ├── nav_bar_component.rb │ │ ├── radio_button_component.html.erb │ │ ├── radio_button_component.rb │ │ ├── select_component.html.erb │ │ ├── select_component.rb │ │ ├── select_item_component.html.erb │ │ ├── select_item_component.rb │ │ ├── step_component.html.erb │ │ ├── step_component.rb │ │ ├── step_connector_component.html.erb │ │ ├── step_connector_component.rb │ │ ├── stepper_component.html.erb │ │ ├── stepper_component.rb │ │ ├── switch_component.html.erb │ │ ├── switch_component.rb │ │ ├── tags.rb │ │ ├── tags │ │ ├── check_box.rb │ │ ├── chip_choice.rb │ │ ├── chipset.rb │ │ ├── country_select.rb │ │ ├── label.rb │ │ ├── password_field.rb │ │ ├── radio_button.rb │ │ ├── select.rb │ │ ├── text_area.rb │ │ └── text_field.rb │ │ ├── text_field_component.html.erb │ │ ├── text_field_component.rb │ │ ├── typography_component.html.erb │ │ └── typography_component.rb ├── controllers │ └── arara │ │ └── application_controller.rb ├── helpers │ └── arara │ │ └── application_helper.rb ├── javascript │ └── arara │ │ ├── controllers │ │ ├── body_class_toggler_controller.js │ │ ├── counter_controller.js │ │ ├── demo_dialog_controller.js │ │ ├── mdc_chip_set_controller.js │ │ ├── mdc_data_table_controller.js │ │ ├── mdc_form_field_controller.js │ │ ├── mdc_icon_toggle_controller.js │ │ ├── mdc_linear_progress_controller.js │ │ ├── mdc_list_controller.js │ │ ├── mdc_menu_controller.js │ │ ├── mdc_ripple_controller.js │ │ ├── mdc_select_controller.js │ │ ├── mdc_slider_controller.js │ │ ├── mdc_snackbar_controller.js │ │ ├── mdc_switch_controller.js │ │ ├── mdc_tab_bar_controller.js │ │ ├── mdc_text_field_controller.js │ │ ├── mdc_top_app_bar_controller.js │ │ ├── rails_chip_set_choice_controller.js │ │ ├── rails_chip_set_filter_controller.js │ │ └── remote_form_controller.js │ │ ├── index.js │ │ └── scss │ │ ├── _material_design.scss │ │ ├── _tailwind.scss │ │ ├── arara.scss │ │ ├── material_design │ │ └── _custom.scss │ │ └── tailwind │ │ └── _ripple_workaround.scss ├── jobs │ └── arara │ │ └── application_job.rb ├── mailers │ └── arara │ │ └── application_mailer.rb ├── models │ └── arara │ │ └── application_record.rb └── views │ └── layouts │ └── arara │ └── application.html.erb ├── arara.gemspec ├── babel.config.js ├── bin └── rails ├── config └── routes.rb ├── karma.conf.js ├── lib ├── arara.rb ├── arara │ ├── engine.rb │ └── version.rb └── tasks │ └── arara_tasks.rake ├── package.json ├── rollup.config.js ├── rollup.config.test.js ├── scripts └── copy-files.js ├── test ├── arara_test.rb ├── dummy │ ├── .browserslistrc │ ├── .ruby-version │ ├── Rakefile │ ├── app │ │ ├── assets │ │ │ ├── config │ │ │ │ └── manifest.js │ │ │ ├── images │ │ │ │ ├── .keep │ │ │ │ └── arara_logo.png │ │ │ └── stylesheets │ │ │ │ └── application.css │ │ ├── channels │ │ │ └── application_cable │ │ │ │ ├── channel.rb │ │ │ │ └── connection.rb │ │ ├── controllers │ │ │ ├── application_controller.rb │ │ │ ├── concerns │ │ │ │ └── .keep │ │ │ ├── home_controller.rb │ │ │ ├── pages_controller.rb │ │ │ └── posts_controller.rb │ │ ├── helpers │ │ │ └── application_helper.rb │ │ ├── javascript │ │ │ ├── controllers │ │ │ │ └── index.js │ │ │ ├── packs │ │ │ │ └── application.js │ │ │ └── styles │ │ │ │ ├── _demo.scss │ │ │ │ ├── demo │ │ │ │ ├── _button.scss │ │ │ │ ├── _card.scss │ │ │ │ ├── _checkbox.scss │ │ │ │ ├── _chips.scss │ │ │ │ ├── _data_table.scss │ │ │ │ ├── _drawer.scss │ │ │ │ ├── _elevation.scss │ │ │ │ ├── _fab.scss │ │ │ │ ├── _image_list.scss │ │ │ │ ├── _layout_grid.scss │ │ │ │ ├── _linear_progress_indicator.scss │ │ │ │ ├── _list.scss │ │ │ │ ├── _radio.scss │ │ │ │ ├── _ripple.scss │ │ │ │ ├── _select.scss │ │ │ │ ├── _slider.scss │ │ │ │ ├── _snackbar.scss │ │ │ │ ├── _text_field.scss │ │ │ │ └── _top_app_bar.scss │ │ │ │ └── dummy.scss │ │ ├── jobs │ │ │ └── application_job.rb │ │ ├── mailers │ │ │ └── application_mailer.rb │ │ ├── models │ │ │ ├── application_record.rb │ │ │ └── concerns │ │ │ │ └── .keep │ │ └── views │ │ │ ├── home │ │ │ └── show.html.erb │ │ │ ├── layouts │ │ │ ├── application.html.erb │ │ │ ├── login.html.erb │ │ │ ├── mailer.html.erb │ │ │ ├── mailer.text.erb │ │ │ └── top_app_bar.html.erb │ │ │ └── pages │ │ │ ├── button.html.erb │ │ │ ├── card.html.erb │ │ │ ├── checkbox.html.erb │ │ │ ├── chips.html.erb │ │ │ ├── data_table.html.erb │ │ │ ├── dialog.html.erb │ │ │ ├── elevation.html.erb │ │ │ ├── fab.html.erb │ │ │ ├── icon_button.html.erb │ │ │ ├── image_list.html.erb │ │ │ ├── layout_grid.html.erb │ │ │ ├── linear_progress_indicator.html.erb │ │ │ ├── list.html.erb │ │ │ ├── login.html.erb │ │ │ ├── menu.html.erb │ │ │ ├── not_found.html.erb │ │ │ ├── radio_button.html.erb │ │ │ ├── ripple.html.erb │ │ │ ├── select.html.erb │ │ │ ├── slider.html.erb │ │ │ ├── snackbar.html.erb │ │ │ ├── stepper.html.erb │ │ │ ├── switch.html.erb │ │ │ ├── tab_bar.html.erb │ │ │ ├── text_field.html.erb │ │ │ ├── top_app_bar.html.erb │ │ │ ├── top_app_bar_demo_1.html.erb │ │ │ ├── top_app_bar_demo_2.html.erb │ │ │ ├── top_app_bar_demo_3.html.erb │ │ │ ├── top_app_bar_demo_4.html.erb │ │ │ ├── top_app_bar_demo_5.html.erb │ │ │ ├── top_app_bar_demo_6.html.erb │ │ │ └── typography.html.erb │ ├── babel.config.js │ ├── bin │ │ ├── rails │ │ ├── rake │ │ ├── setup │ │ ├── webpack │ │ └── webpack-dev-server │ ├── config.ru │ ├── config │ │ ├── application.rb │ │ ├── boot.rb │ │ ├── cable.yml │ │ ├── database.yml │ │ ├── environment.rb │ │ ├── environments │ │ │ ├── development.rb │ │ │ ├── production.rb │ │ │ └── test.rb │ │ ├── initializers │ │ │ ├── application_controller_renderer.rb │ │ │ ├── assets.rb │ │ │ ├── backtrace_silencers.rb │ │ │ ├── content_security_policy.rb │ │ │ ├── cookies_serializer.rb │ │ │ ├── filter_parameter_logging.rb │ │ │ ├── inflections.rb │ │ │ ├── mime_types.rb │ │ │ └── wrap_parameters.rb │ │ ├── locales │ │ │ └── en.yml │ │ ├── puma.rb │ │ ├── routes.rb │ │ ├── spring.rb │ │ ├── storage.yml │ │ ├── webpack │ │ │ ├── development.js │ │ │ ├── environment.js │ │ │ ├── production.js │ │ │ └── test.js │ │ └── webpacker.yml │ ├── lib │ │ └── assets │ │ │ └── .keep │ ├── log │ │ └── .keep │ ├── package.json │ ├── postcss.config.js │ ├── public │ │ ├── 404.html │ │ ├── 422.html │ │ ├── 500.html │ │ ├── android-icon-144x144.png │ │ ├── android-icon-192x192.png │ │ ├── android-icon-36x36.png │ │ ├── android-icon-48x48.png │ │ ├── android-icon-72x72.png │ │ ├── android-icon-96x96.png │ │ ├── apple-icon-114x114.png │ │ ├── apple-icon-120x120.png │ │ ├── apple-icon-144x144.png │ │ ├── apple-icon-152x152.png │ │ ├── apple-icon-180x180.png │ │ ├── apple-icon-57x57.png │ │ ├── apple-icon-60x60.png │ │ ├── apple-icon-72x72.png │ │ ├── apple-icon-76x76.png │ │ ├── apple-icon-precomposed.png │ │ ├── apple-icon.png │ │ ├── apple-touch-icon-precomposed.png │ │ ├── apple-touch-icon.png │ │ ├── browserconfig.xml │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── favicon-96x96.png │ │ ├── favicon.ico │ │ ├── manifest.json │ │ ├── ms-icon-144x144.png │ │ ├── ms-icon-150x150.png │ │ ├── ms-icon-310x310.png │ │ └── ms-icon-70x70.png │ └── yarn.lock ├── integration │ └── navigation_test.rb ├── javascript │ └── src │ │ ├── controllers │ │ └── counter_controller_test.js │ │ ├── helpers.js │ │ └── index.js └── test_helper.rb └── yarn.lock /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "rules": { 4 | "semi": [ 5 | "error", 6 | "never" 7 | ], 8 | "quotes": [ 9 | "error", 10 | "double" 11 | ], 12 | "no-unused-vars": [ 13 | "error", 14 | { 15 | "vars": "all", 16 | "args": "none" 17 | } 18 | ] 19 | }, 20 | "plugins": [ 21 | "import" 22 | ], 23 | "env": { 24 | "browser": true, 25 | "es6": true 26 | }, 27 | "parser": "babel-eslint", 28 | "parserOptions": { 29 | "ecmaVersion": 6, 30 | "sourceType": "module" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .bundle/ 2 | log/*.log 3 | pkg/ 4 | test/dummy/db/*.sqlite3 5 | test/dummy/db/*.sqlite3-journal 6 | test/dummy/db/*.sqlite3-* 7 | test/dummy/log/*.log 8 | test/dummy/storage/ 9 | test/dummy/tmp/ 10 | test/dummy/public/packs 11 | node_modules 12 | tmp/ 13 | /src 14 | /app/assets/javascripts/arara.js 15 | /test/javascript/compiled/index.js 16 | yarn-error.log 17 | /build 18 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | addons: 3 | chrome: stable 4 | language: ruby 5 | cache: 6 | bundler: true 7 | yarn: true 8 | rvm: 9 | - 2.5.3 10 | node_js: 11 | - "12" 12 | before_install: 13 | - gem install bundler -N -v `tail -n 1 Gemfile.lock |awk -F" " '{print $1}'` 14 | - nvm install 12 15 | - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.17.3 16 | - export PATH=$HOME/.yarn/bin:$PATH 17 | env: 18 | global: 19 | - CHROME_HEADLESS=true 20 | before_script: 21 | - yarn 22 | script: 23 | - yarn test 24 | - bin/rails test 25 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 | 4 | # Declare your gem's dependencies in arara.gemspec. 5 | # Bundler will treat runtime dependencies like base dependencies, and 6 | # development dependencies will be added by default to the :development group. 7 | gemspec 8 | 9 | # Declare any dependencies that are still in development here instead of in 10 | # your gemspec. These might include edge Rails or gems from your path or 11 | # Git. Remember to move these dependencies to your gemspec before releasing 12 | # your gem to rubygems.org. 13 | 14 | # To use a debugger 15 | # gem 'byebug', group: [:development, :test] 16 | 17 | gem 'webpacker' 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 Celso Fernandes 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arara 🦜 2 | 3 | ## Browser Sync 4 | 5 | ```bash 6 | browser-sync start --proxy localhost:3000 --files "app/views, app/concepts" 7 | ``` 8 | 9 | ## Customizing Dynamically 10 | 11 | ```css 12 | :root { 13 | --base-color: #c6538c; 14 | } 15 | 16 | body { 17 | background-color: var(--base-color); 18 | } 19 | ``` 20 | 21 | ```js 22 | var root = document.documentElement; 23 | root.style.setProperty('--base-color', "palevioletred") 24 | ``` 25 | 26 | ## Developing 27 | 28 | All arara related files are inside `app/javascript/arara`, the folder contains: 29 | 30 | - controllers : with all the stimulus controllers 31 | - scss : the basic scss setup 32 | 33 | ### Demo 34 | 35 | TL;DR (quick setup) 36 | 37 | ```bash 38 | yarn 39 | cd test/dummy 40 | yarn 41 | bundle install 42 | rails server 43 | ``` 44 | 45 | On project root run the `yarn` (or `npm`) command to install the dependencies for arara 46 | 47 | To run the demo, go inside `test/dummy` and run the commands: 48 | 49 | - bundle install 50 | - yarn/npm (now is needed to install the demo dependencies) 51 | 52 | and run the commands on two different terminals: 53 | 54 | - ./bin/webpack-dev-server 55 | - rails s 56 | 57 | Access http://localhost:3000 to see it running 58 | 59 | ## NPM Package 60 | 61 | This is my first NPM package, the built system was inspired on [ActionCable](https://github.com/rails/rails/blob/ec69083cf3352c78f840de50fdf20ef30334e0b1/actioncable/package.json#L49) and [Material-UI](https://github.com/mui-org/material-ui/blob/49fb53dd3497e3c825bab92f1f1dde42644dbab4/package.json#L33), if there's a bug (and probably there ARE) or you have any suggestion, please open an issue 62 | 63 | ## Special Thanks ✨ 64 | 65 | Eu gostaria de agradecer aos colegas @nicolasiensen @lpirola @lucastx @igr-santos @vivianedias que gentilmente cederam o nome da gem no rubygems. 66 | 67 | I'd like to say thank you to @nicolasiensen @lpirola @lucastx @igr-santos @vivianedias that gently let me use the gem name on rubygems 68 | 69 | ## License 70 | 71 | The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). 72 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | begin 2 | require 'bundler/setup' 3 | rescue LoadError 4 | puts 'You must `gem install bundler` and `bundle install` to run rake tasks' 5 | end 6 | 7 | require 'rdoc/task' 8 | 9 | RDoc::Task.new(:rdoc) do |rdoc| 10 | rdoc.rdoc_dir = 'rdoc' 11 | rdoc.title = 'Arara' 12 | rdoc.options << '--line-numbers' 13 | rdoc.rdoc_files.include('README.md') 14 | rdoc.rdoc_files.include('lib/**/*.rb') 15 | end 16 | 17 | APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__) 18 | load 'rails/tasks/engine.rake' 19 | 20 | load 'rails/tasks/statistics.rake' 21 | 22 | require 'bundler/gem_tasks' 23 | 24 | require 'rake/testtask' 25 | 26 | Rake::TestTask.new(:test) do |t| 27 | t.libs << 'test' 28 | t.pattern = 'test/**/*_test.rb' 29 | t.verbose = false 30 | end 31 | 32 | task default: :test 33 | -------------------------------------------------------------------------------- /app/assets/config/arara_manifest.js: -------------------------------------------------------------------------------- 1 | //= link_directory ../stylesheets/arara .css 2 | -------------------------------------------------------------------------------- /app/assets/images/arara/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/app/assets/images/arara/.keep -------------------------------------------------------------------------------- /app/assets/stylesheets/arara/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /app/components/arara.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | end 3 | -------------------------------------------------------------------------------- /app/components/arara/base_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | module BaseComponent 3 | class MissingTag < StandardError; end 4 | 5 | def self.included(mod) 6 | attr_reader :user_content, :user_variant, :user_tag, :user_data, :id, :options 7 | 8 | def initialize(tag: nil, content: nil, variant: nil, id: nil, data: nil, **options) 9 | @user_tag = tag.try(:to_s) || default_html_tag 10 | @user_variant = variant.try(:to_s) 11 | @user_content = content 12 | @user_data = data || {} 13 | @html_class = options.fetch(:class, "") 14 | @options = options 15 | @id = id 16 | end 17 | 18 | def html_content 19 | return content if content 20 | user_content 21 | end 22 | 23 | def html_class 24 | classes = default_html_class ? [default_html_class] : [] 25 | classes.push(@html_class) unless @html_class.try(:empty?) 26 | classes.empty? ? [] : classes 27 | end 28 | 29 | def html_tag 30 | raise MissingTag.new('You need to specify a tag') if @user_tag.nil? 31 | @user_tag 32 | end 33 | 34 | def html_options 35 | opts = options.dup 36 | opts[:class] = html_class unless html_class.empty? 37 | opts[:data] = html_data unless html_data.empty? 38 | opts[:id] = id if id 39 | opts 40 | end 41 | 42 | def html_data 43 | data_controller = default_data_controller ? [default_data_controller] : [] 44 | data_controller.push(user_data[:controller]) if user_data.has_key?(:controller) 45 | data_controller = (data_controller.empty? ? nil : data_controller.join(" ")) 46 | 47 | data = user_data.dup 48 | data.merge!({controller: data_controller}) 49 | data 50 | end 51 | 52 | def default_data_controller 53 | end 54 | 55 | def default_html_class 56 | end 57 | 58 | def default_html_tag 59 | end 60 | end 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /app/components/arara/button_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | 3 | <% if has_icon? %> 4 | <%= icon %> 5 | <% end %> 6 | <%= html_content %> 7 | <% end %> 8 | -------------------------------------------------------------------------------- /app/components/arara/button_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class ButtonComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | attr_reader :type, :name, :value 5 | 6 | def initialize(variant: "text", content: "Label", dense: false, icon: nil, type: nil, name: nil, value: nil, tag: "button", **kw) 7 | @dense = dense 8 | @icon = icon 9 | @html_class = html_class 10 | @type = type 11 | @name = name 12 | @value = value 13 | super(tag: tag, variant: variant, content: content, **kw) 14 | end 15 | 16 | # private 17 | attr_reader :icon, :data 18 | 19 | def html_class 20 | klass = ["mdc-button"] 21 | klass.push("mdc-button--dense") if @dense 22 | klass.push("mdc-button--raised") if @user_variant == "raised" 23 | klass.push("mdc-button--unelevated") if @user_variant == "unelevated" 24 | klass.push("mdc-button--outlined") if @user_variant == "outlined" 25 | klass.push("#{@html_class}") if @html_class 26 | klass 27 | end 28 | 29 | def has_icon? 30 | @icon.present? 31 | end 32 | 33 | def default_data_controller 34 | "mdc-ripple" 35 | end 36 | 37 | def html_options 38 | opts = super 39 | opts.merge!( 40 | class: html_class, data: html_data, type: type, name: name, value: value 41 | ) 42 | end 43 | 44 | def html_content 45 | return content if content 46 | return value if value 47 | user_content 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /app/components/arara/card_action_buttons_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/card_action_buttons_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class CardActionButtonsComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | validates :content, presence: true 6 | 7 | def initialize(**kw) 8 | super(tag: "div", **kw) 9 | end 10 | 11 | def default_html_class 12 | "mdc-card__action-buttons" 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/components/arara/card_action_icons_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/card_action_icons_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class CardActionIconsComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | validates :content, presence: true 6 | 7 | def initialize(**kw) 8 | super(tag: "div", **kw) 9 | end 10 | 11 | def default_html_class 12 | "mdc-card__action-icons" 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/components/arara/card_actions_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/card_actions_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class CardActionsComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | validates :content, presence: true 6 | 7 | def initialize(**kw) 8 | super(tag: "div", **kw) 9 | end 10 | 11 | def default_html_class 12 | "mdc-card__actions" 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/components/arara/card_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/card_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class CardComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | validates :content, presence: true 6 | 7 | def initialize(**kw) 8 | super(tag: "div", **kw) 9 | end 10 | 11 | def default_html_class 12 | "mdc-card" 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/components/arara/card_media_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options.merge(style: "background-image: url(#{image_url});")) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/card_media_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class CardMediaComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | def initialize(variant:, image_url:, content_html_class: "", **kw) 6 | super(tag: "div", variant: variant, **kw) 7 | 8 | @image_url = image_url 9 | @content_html_class = content_html_class 10 | end 11 | 12 | attr_reader :image_url, :content_html_class 13 | 14 | def default_html_class 15 | return "mdc-card__media mdc-card__media--16-9" if user_variant == "wide" 16 | return "mdc-card__media mdc-card__media--square" if user_variant == "square" 17 | "mdc-card__media" 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /app/components/arara/card_media_content_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/card_media_content_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class CardMediaContentComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | def initialize(**kw) 6 | super(tag: "div", **kw) 7 | end 8 | 9 | attr_reader :image_url, :content_html_class 10 | 11 | def default_html_class 12 | "mdc-card__media-content" 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/components/arara/card_primary_content_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options.merge(tabindex: tabindex)) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/card_primary_content_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class CardPrimaryContentComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | validates :content, presence: true 6 | 7 | def initialize(tabindex: 0, **kw) 8 | super(tag: "div", **kw) 9 | @tabindex = tabindex 10 | end 11 | 12 | attr_reader :tabindex 13 | 14 | def default_html_class 15 | "mdc-card__primary-action" 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/components/arara/checkbox_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | 9 | checked 10 | <% end %> 11 | /> 12 |
13 | 15 | 18 | 19 |
20 |
21 |
22 | <% end %> 23 | -------------------------------------------------------------------------------- /app/components/arara/checkbox_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class CheckboxComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | attr_reader :id, :name, :value, :checked, :indeterminate 5 | 6 | def initialize(id:, name:, value: 1, checked: false, indeterminate: false, **kw) 7 | super(tag: "div", **kw) 8 | @checked = checked 9 | @indeterminate = indeterminate 10 | @id = id 11 | @name = name 12 | @value = value 13 | end 14 | 15 | def html_data 16 | data = super 17 | data.merge!(checked: checked, indeterminate: indeterminate) 18 | data 19 | end 20 | 21 | def default_html_class 22 | 'mdc-checkbox' 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /app/components/arara/chip_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options, role: "row", id: id) do %> 2 |
3 | <%= leading_icon %> 4 | <% if user_variant == "filter" %> 5 |
6 | 7 | 8 | 9 |
10 | <% end %> 11 | <%= label %> 12 | <%= trailing_icon %> 13 | <% end %> 14 | -------------------------------------------------------------------------------- /app/components/arara/chip_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class ChipComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | with_content_areas :leading_icon, :trailing_icon 6 | 7 | def initialize(id:, label:, variant: "choice", selected: false, should_remove_on_trailing_icon_click: false, **kw) 8 | @id = id 9 | @label = label 10 | @selected = selected 11 | @should_remove_on_trailing_icon_click = should_remove_on_trailing_icon_click 12 | super(tag: "div", variant: variant, **kw) 13 | end 14 | 15 | attr_reader :id, :label, :selected, :user_variant 16 | 17 | def default_html_class 18 | return "mdc-chip mdc-chip--selected" if selected 19 | "mdc-chip" 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/components/arara/chipset_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= options[:include_choice_hidden_field] && tag("input", 3 | html_options.slice(:name, :id, :value).merge!("type" => "hidden", data: { target: 'rails-chip-set-choice.input' }) 4 | ) %> 5 | <%= content %> 6 | <% end %> 7 | -------------------------------------------------------------------------------- /app/components/arara/chipset_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class ChipsetComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | validates :content, presence: true 6 | 7 | def initialize(variant: "", selected_chip_ids: [], **kw) 8 | @variant = variant 9 | @selected_chip_ids = selected_chip_ids 10 | super(tag: "div", variant: variant, **kw) 11 | end 12 | 13 | def default_data_controller 14 | "mdc-chip-set" 15 | end 16 | 17 | def default_html_class 18 | return "mdc-chip-set mdc-chip-set--choice" if user_variant == "choice" 19 | return "mdc-chip-set mdc-chip-set--filter" if user_variant == "filter" 20 | "mdc-chip-set" 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /app/components/arara/data_table_body_cell_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/data_table_body_cell_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DataTableBodyCellComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | attr_reader :numeric 5 | 6 | validates :content, presence: true 7 | 8 | def initialize(numeric: false, **kw) 9 | super(tag: "td", **kw) 10 | @numeric = numeric 11 | end 12 | 13 | def default_html_class 14 | return "mdc-data-table__cell mdc-data-table__cell--numeric" if numeric 15 | "mdc-data-table__cell" 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/components/arara/data_table_body_checkbox_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 |
3 | aria-labelledby="<%= id %>"/> 4 |
5 | 6 | 7 | 8 |
9 |
10 |
11 | <% end %> 12 | -------------------------------------------------------------------------------- /app/components/arara/data_table_body_checkbox_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DataTableBodyCheckboxComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | attr_reader :selected, :id 5 | 6 | def initialize(selected: false, id:, **kw) 7 | super(tag: "td", **kw) 8 | @selected = selected 9 | @id = id 10 | end 11 | 12 | def default_html_class 13 | "mdc-data-table__cell mdc-data-table__cell--checkbox" 14 | end 15 | 16 | def html_options 17 | super.merge!({role: "columnheader", scope: "col"}) 18 | end 19 | 20 | def checkbox_class 21 | return "mdc-checkbox mdc-data-table__row-checkbox mdc-checkbox--selected" if selected 22 | "mdc-checkbox mdc-data-table__row-checkbox" 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /app/components/arara/data_table_body_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/data_table_body_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DataTableBodyComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | validates :content, presence: true 6 | 7 | def initialize(**kw) 8 | super(tag: "tbody", **kw) 9 | end 10 | 11 | def default_html_class 12 | "mdc-data-table__content" 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/components/arara/data_table_body_row_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/data_table_body_row_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DataTableBodyRowComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | attr_reader :selected 5 | 6 | validates :content, presence: true 7 | 8 | def initialize(selected: false, **kw) 9 | super(tag: "tr", **kw) 10 | @selected = selected 11 | end 12 | 13 | def default_html_class 14 | return "mdc-data-table__row mdc-data-table__row--selected" if selected 15 | "mdc-data-table__row" 16 | end 17 | 18 | def html_options 19 | opts = super 20 | if selected 21 | opts[:aria] = {} unless opts.has_key?(:aria) 22 | opts[:aria][:selected] = true 23 | end 24 | opts 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /app/components/arara/data_table_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <% content_tag(table_tag, table_options) do %> 3 | <%= content %> 4 | <% end %> 5 | <% end %> 6 | -------------------------------------------------------------------------------- /app/components/arara/data_table_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DataTableComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | attr_reader :label 5 | 6 | validates :content, presence: true 7 | 8 | def initialize(label: nil, **kw) 9 | super(tag: "div", **kw) 10 | @label = label 11 | end 12 | 13 | def default_html_class 14 | "mdc-data-table" 15 | end 16 | 17 | def default_data_controller 18 | "mdc-data-table" 19 | end 20 | 21 | def table_tag 22 | "table" 23 | end 24 | 25 | def table_options 26 | opts = { 27 | class: "mdc-data-table__table" 28 | } 29 | unless label.empty? 30 | opts[:aria] ||= {} 31 | opts[:aria][:label] = label 32 | end 33 | opts 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /app/components/arara/data_table_header_cell_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/data_table_header_cell_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DataTableHeaderCellComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | attr_reader :numeric 5 | 6 | validates :content, presence: true 7 | 8 | def initialize(numeric: false, **kw) 9 | super(tag: "th", **kw) 10 | @numeric = numeric 11 | end 12 | 13 | def default_html_class 14 | return "mdc-data-table__header-cell mdc-data-table__header-cell--numeric" if numeric 15 | "mdc-data-table__header-cell" 16 | end 17 | 18 | def html_options 19 | opts = super 20 | opts.merge!(role: "columnheader", scope: "col") 21 | opts 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /app/components/arara/data_table_header_checkbox_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 |
3 | 4 |
5 | 6 | 7 | 8 |
9 |
10 |
11 | <% end %> 12 | -------------------------------------------------------------------------------- /app/components/arara/data_table_header_checkbox_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DataTableHeaderCheckboxComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | attr_reader :selected, :label 5 | 6 | def initialize(selected: false, label:, **kw) 7 | super(tag: "th", **kw) 8 | @selected = selected 9 | @label = label 10 | end 11 | 12 | def default_html_class 13 | "mdc-data-table__header-cell mdc-data-table__header-cell--checkbox" 14 | end 15 | 16 | def html_options 17 | super.merge!({role: "columnheader", scope: "col"}) 18 | end 19 | 20 | def checkbox_class 21 | return "mdc-checkbox mdc-data-table__header-row-checkbox mdc-checkbox--selected" if selected 22 | "mdc-checkbox mdc-data-table__header-row-checkbox" 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /app/components/arara/data_table_header_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/data_table_header_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DataTableHeaderComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | validates :content, presence: true 6 | 7 | def initialize(**kw) 8 | super(tag: "thead", **kw) 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/components/arara/data_table_header_row_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/data_table_header_row_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DataTableHeaderRowComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | validates :content, presence: true 6 | 7 | def initialize(**kw) 8 | super(tag: "tr", **kw) 9 | end 10 | 11 | def default_html_class 12 | "mdc-data-table__header-row" 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/components/arara/dialog_button_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 |
3 | <%= content %> 4 | <% end %> 5 | -------------------------------------------------------------------------------- /app/components/arara/dialog_button_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DialogButtonComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | validates :content, presence: true 5 | 6 | attr_reader :dialog_action 7 | 8 | def initialize(dialog_action:, **kw) 9 | super(tag: "button", **kw) 10 | 11 | @dialog_action = dialog_action 12 | end 13 | 14 | 15 | def default_html_class 16 | "mdc-button mdc-dialog__button" 17 | end 18 | 19 | def html_options 20 | opts = super 21 | opts.merge!({type: "button"}) 22 | opts 23 | end 24 | 25 | def html_data 26 | data = super 27 | data.merge!('mdc-dialog-action': dialog_action) 28 | data 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /app/components/arara/dialog_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 |
3 | <%= content_tag("div", surface_options) do %> 4 | <%= content %> 5 | <% end %> 6 |
7 |
8 | <% end %> 9 | -------------------------------------------------------------------------------- /app/components/arara/dialog_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DialogComponent < ActionView::Component::Base 3 | validates :content, presence: true 4 | 5 | include Arara::BaseComponent 6 | 7 | attr_reader :role, :labelledby, :describedby, :surface_class 8 | 9 | def initialize(role: "alertdialog", labelledby:, describedby:, surface_class: nil, **kw) 10 | super(tag: "div", role: role, **kw) 11 | 12 | @role = role 13 | @labelledby = labelledby 14 | @describedby = describedby 15 | @surface_class = surface_class 16 | end 17 | 18 | 19 | def default_html_class 20 | "mdc-dialog" 21 | end 22 | 23 | def surface_options 24 | html_class = ["mdc-dialog__surface"] 25 | html_class << surface_class if surface_class 26 | { 27 | class: html_class.join(" "), 28 | role: role, 29 | aria: { 30 | modal: "true", 31 | labelledby: labelledby, 32 | describedby: describedby 33 | } 34 | } 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /app/components/arara/dialog_content_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/dialog_content_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DialogContentComponent < ActionView::Component::Base 3 | validates :content, presence: true 4 | 5 | include Arara::BaseComponent 6 | 7 | def initialize(id:, **kw) 8 | super(tag: "div", id: id, **kw) 9 | end 10 | 11 | def default_html_class 12 | "mdc-dialog__content" 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/components/arara/dialog_footer_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/dialog_footer_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DialogFooterComponent < ActionView::Component::Base 3 | validates :content, presence: true 4 | 5 | include Arara::BaseComponent 6 | 7 | def initialize(**kw) 8 | super(tag: "footer", id: id, **kw) 9 | end 10 | 11 | def default_html_class 12 | "mdc-dialog__actions" 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/components/arara/dialog_title_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %><%= content %><% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/dialog_title_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class DialogTitleComponent < ActionView::Component::Base 3 | validates :content, presence: true 4 | 5 | include Arara::BaseComponent 6 | 7 | def initialize(id:, **kw) 8 | super(tag: "h2", id: id, **kw) 9 | end 10 | 11 | 12 | def default_html_class 13 | "mdc-dialog__title" 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/components/arara/elevation_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/elevation_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class ElevationComponent < ActionView::Component::Base 3 | validates :content, presence: true 4 | 5 | include Arara::BaseComponent 6 | 7 | attr_reader :depth 8 | 9 | def initialize(depth:, **kw) 10 | super(tag: "div", depth: depth, **kw) 11 | 12 | @depth = depth 13 | end 14 | 15 | def default_html_class 16 | "mdc-elevation--z#{depth}" 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/components/arara/fab_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 |
3 | <% if user_variant == "extended" && label_before %> 4 | <%= extended_label %> 5 | <% end %> 6 | <%= content %> 7 | <% if user_variant == "extended" && !label_before %> 8 | <%= extended_label %> 9 | <% end %> 10 | <% if user_variant == "extended_no_icon" %> 11 | <%= extended_label %> 12 | <% end %> 13 | <% end %> 14 | -------------------------------------------------------------------------------- /app/components/arara/fab_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class FabComponent < ActionView::Component::Base 3 | class InvalidVariant < StandardError; end 4 | 5 | include Arara::BaseComponent 6 | VALID_VARIANTS = %w(default mini extended extended_no_icon) 7 | 8 | attr_reader :label, :extended_label, :label_before 9 | with_options if: -> { user_variant == "extended" } do |extended| 10 | extended.validates :content, presence: true 11 | extended.validates :extended_label, presence: true 12 | end 13 | 14 | def initialize(variant: "default", label:, extended_label: nil, label_before: false, **kw) 15 | raise InvalidVariant.new("`#{variant}' is not a valid variant") unless VALID_VARIANTS.include?(variant.to_s) 16 | super(tag: "button", variant: variant, **kw) 17 | 18 | @variant = variant 19 | @label = label 20 | @extended_label = extended_label 21 | @label_before = label_before 22 | end 23 | 24 | def default_html_class 25 | return "mdc-fab mdc-fab--mini" if user_variant == "mini" 26 | return "mdc-fab mdc-fab--extended" if user_variant == "extended" 27 | return "mdc-fab mdc-fab--extended" if user_variant == "extended_no_icon" 28 | "mdc-fab" 29 | end 30 | 31 | def html_options 32 | opts = super 33 | opts[:aria] = {} unless opts.has_key?(:aria) 34 | opts[:aria][:label] = label 35 | opts 36 | end 37 | 38 | def default_data_controller 39 | "mdc-ripple" 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /app/components/arara/fab_icon_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/fab_icon_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class FabIconComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | validates :content, presence: true 5 | 6 | def initialize(icon:, **kw) 7 | super(tag: "i", **kw) 8 | @icon = icon 9 | end 10 | 11 | def default_html_class 12 | "material-icons" 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/components/arara/form_field_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/form_field_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class FormFieldComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | validates :content, presence: true 6 | 7 | def initialize(**kw) 8 | super(tag: "div", **kw) 9 | end 10 | 11 | def default_html_class 12 | "mdc-form-field" 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/components/arara/google_calendar/menu_item_component.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | <%= icon %> 5 | 6 | 7 | <%= title %> 8 | 9 | <%= count %> 10 |
11 |
12 | -------------------------------------------------------------------------------- /app/components/arara/google_calendar/menu_item_component.rb: -------------------------------------------------------------------------------- 1 | class Arara::GoogleCalendar::MenuItemComponent < ActionView::Component::Base 2 | 3 | def initialize(icon:, title:, count: nil, active: false) 4 | @icon = icon 5 | @title = title 6 | @count = count 7 | @active = active 8 | end 9 | 10 | private 11 | attr_reader :icon, :title, :count, :active 12 | 13 | def background_color 14 | return "#e8f0fe" if active 15 | "inherit" 16 | end 17 | 18 | def icon_color 19 | return "#1a73e8" if active 20 | "#616161" 21 | end 22 | 23 | def text_color 24 | return "#1a73e8" if active 25 | "#202124" 26 | end 27 | 28 | def html_class 29 | klass = "nav_bar__menu_item" 30 | klass << " nav_bar__menu_item--active" if active 31 | klass 32 | end 33 | 34 | end 35 | -------------------------------------------------------------------------------- /app/components/arara/google_calendar/nav_bar_component.rb: -------------------------------------------------------------------------------- 1 | class Arara::GoogleCalendar::NavBarComponent < ActionView::Component::Base 2 | 3 | def initialize(*) 4 | 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/components/arara/icon_button_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/icon_button_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class IconButtonComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | validates :content, presence: true 6 | attr_reader :title, :pressed 7 | 8 | def initialize(title: nil, pressed: nil, **kw) 9 | super(tag: "button", **kw) 10 | @title = title 11 | @pressed = pressed 12 | end 13 | 14 | def default_html_class 15 | klasses = ['mdc-icon-button'] 16 | klasses << ['mdc-icon-button--on'] if pressed 17 | klasses 18 | end 19 | 20 | def aria_data 21 | data = {} 22 | data[:label] = title if title 23 | data[:pressed] = pressed unless pressed.nil? 24 | data 25 | end 26 | 27 | def html_options 28 | opts = super 29 | opts.merge!(title: title) if title 30 | opts.merge!(aria: aria_data) 31 | opts 32 | end 33 | 34 | def html_data 35 | data = super 36 | data.merge!('mdc-ripple-is-unbounded' => "") 37 | data 38 | end 39 | 40 | def default_data_controller 41 | "mdc-ripple" 42 | end 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /app/components/arara/icon_toggle_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(:i, class: html_class) do %> 2 | <%= title %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/icon_toggle_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class IconToggleComponent < ActionView::Component::Base 3 | 4 | def initialize(title:, on: false) 5 | @title = title 6 | @on = on 7 | end 8 | 9 | private 10 | attr_reader :title, :on 11 | 12 | def html_class 13 | classes = ['material-icons', 'mdc-icon-button__icon'] 14 | classes << 'mdc-icon-button__icon--on' if on 15 | classes 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/components/arara/material_icon_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/material_icon_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class MaterialIconComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | def initialize(icon:, **kw) 6 | super(tag: "i", **kw) 7 | @icon = icon 8 | end 9 | 10 | def default_html_class 11 | "material-icons" 12 | end 13 | 14 | def content 15 | @icon 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/components/arara/menu_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | 5 | <% end %> 6 | -------------------------------------------------------------------------------- /app/components/arara/menu_component.rb: -------------------------------------------------------------------------------- 1 | class Arara::MenuComponent < ActionView::Component::Base 2 | include Arara::BaseComponent 3 | 4 | validates :content, presence: true 5 | 6 | def initialize(**kw) 7 | super(tag: "div", **kw) 8 | end 9 | 10 | def default_html_class 11 | "mdc-menu mdc-menu-surface" 12 | end 13 | 14 | def html_options 15 | opts = super 16 | opts[:tabindex] = "-1" 17 | opts 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/components/arara/menu_divider_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= tag(html_tag, html_options) %> 2 | -------------------------------------------------------------------------------- /app/components/arara/menu_divider_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class MenuDividerComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | def initialize(**kw) 6 | super(tag: "hr", **kw) 7 | end 8 | 9 | def default_html_class 10 | "mdc-list-divider" 11 | end 12 | 13 | def html_options 14 | opts = super 15 | opts[:role] = "separator" 16 | opts 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/components/arara/menu_item_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/menu_item_component.rb: -------------------------------------------------------------------------------- 1 | class Arara::MenuItemComponent < ActionView::Component::Base 2 | include Arara::BaseComponent 3 | 4 | def initialize(**kw) 5 | super(tag: "li", **kw) 6 | end 7 | 8 | def default_html_class 9 | "mdc-list-item" 10 | end 11 | 12 | def html_options 13 | opts = super 14 | opts[:role] = "menuitem" 15 | opts[:tabindex] = "-1" 16 | opts 17 | end 18 | 19 | def content 20 | user_content 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/components/arara/nav_bar_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class NavBarComponent < ActionView::Component::Base 3 | 4 | def initialize(*) 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/components/arara/radio_button_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= tag("input", html_input_options) %> 3 |
4 |
5 |
6 |
7 |
8 | <% end %> 9 | -------------------------------------------------------------------------------- /app/components/arara/radio_button_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class RadioButtonComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | 5 | attr_reader :id, :name, :checked, :value, :type 6 | 7 | def initialize(id:, name:, value:, checked: false, type: "radio", **kw) 8 | @id = id 9 | @name = name 10 | @checked = checked 11 | @value = value 12 | @type = type 13 | 14 | super(tag: "div", **kw) 15 | end 16 | 17 | def html_input_options 18 | opts = { 19 | class: "mdc-radio__native-control", 20 | type: type, 21 | id: id, 22 | name: name, 23 | value: value 24 | } 25 | 26 | opts[:checked] = "" if checked 27 | 28 | opts 29 | end 30 | 31 | def default_html_class 32 | "mdc-radio" 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /app/components/arara/select_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= tag(:input, type: :hidden, id: id, name: name, value: selected_value, data: { target: 'mdc-select.input' }) %> 3 |
4 | 5 |
<%= selected_label %>
6 | <% if user_variant == "outlined" %> 7 |
8 |
9 |
10 |
11 |
12 | <% else %> 13 | <%= label %> 14 |
15 | <% end %> 16 |
17 |
18 | 21 |
22 | <% end %> 23 | -------------------------------------------------------------------------------- /app/components/arara/select_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class SelectComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | attr_reader :label, :id, :name, :selected_value, :selected_label 5 | 6 | validates :content, presence: true 7 | 8 | def initialize(variant: "default", id: nil, name: nil, label:, selected_value: nil, selected_label: nil, **kw) 9 | super(tag: "div", variant: variant, **kw) 10 | 11 | @id = id 12 | @name = name 13 | @label = label 14 | @selected_value = selected_value 15 | @selected_label = selected_label 16 | end 17 | 18 | def default_data_controller 19 | "mdc-select" 20 | end 21 | 22 | def default_html_class 23 | return "mdc-select mdc-select--outlined" if user_variant == "outlined" 24 | "mdc-select" 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /app/components/arara/select_item_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= label %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/select_item_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class SelectItemComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | attr_reader :value, :label, :blank, :selected, :disabled 5 | 6 | with_options if: -> { blank == false } do |extended| 7 | extended.validates :value, presence: true 8 | extended.validates :label, presence: true 9 | end 10 | 11 | def initialize(value: nil, label: nil, blank: false, selected: false, disabled: false, **kw) 12 | super(tag: "li", **kw) 13 | 14 | @value = value 15 | @label = label 16 | @blank = blank 17 | @disabled = disabled 18 | @selected = selected 19 | if blank 20 | @value = "" 21 | label = nil 22 | end 23 | end 24 | 25 | def default_html_class 26 | return "mdc-list-item mdc-list-item--selected" if selected 27 | "mdc-list-item" 28 | end 29 | 30 | def html_options 31 | opts = super 32 | 33 | opts[:data] ||= {} 34 | opts[:aria] ||= {} 35 | 36 | opts[:role] = "option" 37 | opts[:aria][:selected] = selected 38 | opts[:tabindex] = "-1" 39 | opts[:data][:value] = value 40 | 41 | opts[:disabled] = "" if disabled 42 | opts 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /app/components/arara/step_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <% if has_connector? %> 3 | <%= content_tag(:div, connector_root_options) do %> 4 | <% content_tag(:span, nil, connector_line_options) %> 5 | <% end %> 6 | <% end %> 7 | <%= content_tag(:span, label_root_options) do %> 8 | <%= content_tag(:span, icon_container_options) do %> 9 | <%= content_tag(:svg, icon_options) do %> 10 | <%= icon_tag %> 11 | <% end %> 12 | <% end %> 13 | 14 | <%= content_tag(:span, step_label_options) do %> 15 | <%= title %> 16 | <% end %> 17 | <% if sub_title %> 18 | <%= sub_title %> 19 | <% end %> 20 | 21 | <% end %> 22 |
23 | <% if has_vertical_content? %> 24 | <%= html_content %> 25 | <% end %> 26 |
27 | <% end %> 28 | -------------------------------------------------------------------------------- /app/components/arara/step_connector_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content_tag(:span, line_options) do %> 3 | <% end %> 4 | <% end %> 5 | -------------------------------------------------------------------------------- /app/components/arara/step_connector_component.rb: -------------------------------------------------------------------------------- 1 | class Arara::StepConnectorComponent < ActionView::Component::Base 2 | include Arara::BaseComponent 3 | attr_reader :orientation, :active, :alternative_label 4 | 5 | def initialize(orientation: 'horizontal', active: false, alternative_label: false, **kw) 6 | @orientation = orientation 7 | @active = active 8 | @alternative_label = alternative_label 9 | 10 | super(tag: 'div', **kw) 11 | end 12 | 13 | def default_html_class 14 | classes = %w(MuiStepConnector-root) 15 | classes.push("MuiStepConnector-horizontal") if orientation == "horizontal" 16 | classes.push("MuiStepConnector-vertical") if orientation == "vertical" 17 | classes.push("MuiStepConnector-active") if active 18 | classes.push("Mui-disabled") unless active 19 | classes.push("MuiStepConnector-alternativeLabel") if alternative_label 20 | classes.join(" ") 21 | end 22 | 23 | def line_options 24 | classes = %w(MuiStepConnector-line) 25 | classes.push("MuiStepConnector-lineHorizontal") if orientation == "horizontal" 26 | classes.push("MuiStepConnector-lineVertical") if orientation == "vertical" 27 | { 28 | class: classes.join(" ") 29 | } 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /app/components/arara/stepper_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 | <%= content %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/components/arara/stepper_component.rb: -------------------------------------------------------------------------------- 1 | class Arara::StepperComponent < ActionView::Component::Base 2 | include Arara::BaseComponent 3 | attr_reader :orientation, :alternative_label 4 | 5 | validates :content, presence: true 6 | 7 | def initialize(orientation: "horizontal", alternative_label: false, **kw) 8 | @orientation = orientation 9 | @alternative_label = alternative_label 10 | super(tag: "div", **kw) 11 | end 12 | 13 | def default_html_class 14 | classes = %w(MuiStepper-root) 15 | classes.push("MuiStepper-horizontal") if orientation == "horizontal" 16 | classes.push("MuiStepper-vertical") if orientation == "vertical" 17 | classes.push("MuiStepper-alternativeLabel") if alternative_label 18 | classes.join(" ") 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /app/components/arara/switch_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, html_options) do %> 2 |
3 |
4 |
5 | <%= tag("input", input_options) %> 6 |
7 |
8 | <% end %> 9 | -------------------------------------------------------------------------------- /app/components/arara/switch_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class SwitchComponent < ActionView::Component::Base 3 | include Arara::BaseComponent 4 | attr_reader :id, :checked 5 | 6 | def initialize(id:, checked: false, **kw) 7 | super(tag: "div", **kw) 8 | @id = id 9 | @checked = checked 10 | end 11 | 12 | def default_html_class 13 | return "mdc-switch mdc-switch--checked" if checked 14 | "mdc-switch" 15 | end 16 | 17 | def default_data_controller 18 | "mdc-switch" 19 | end 20 | 21 | def input_options 22 | opts = { 23 | type: "checkbox", 24 | id: id, 25 | class: "mdc-switch__native-control", 26 | role: "switch", 27 | aria: { 28 | checked: checked 29 | } 30 | } 31 | opts[:checked] = "" if checked 32 | opts 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /app/components/arara/tags.rb: -------------------------------------------------------------------------------- 1 | module Arara::Tags 2 | end 3 | -------------------------------------------------------------------------------- /app/components/arara/tags/check_box.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "action_view/helpers/tags/checkable" 4 | 5 | module Arara 6 | module Tags # :nodoc: 7 | class CheckBox < ActionView::Helpers::Tags::Base # :nodoc: 8 | include ActionView::Helpers::Tags::Checkable 9 | 10 | def initialize(object_name, method_name, template_object, checked_value, unchecked_value, options) 11 | @checked_value = checked_value 12 | @unchecked_value = unchecked_value 13 | super(object_name, method_name, template_object, options) 14 | end 15 | 16 | def render 17 | options = @options.stringify_keys 18 | options["type"] = "checkbox" 19 | options["value"] = @checked_value 20 | options["checked"] = "checked" if input_checked?(options) 21 | 22 | if options["multiple"] 23 | add_default_name_and_id_for_value(@checked_value, options) 24 | options.delete("multiple") 25 | else 26 | add_default_name_and_id(options) 27 | end 28 | 29 | include_hidden = options.delete("include_hidden") { true } 30 | checkbox = @template_object.template.render(Arara::CheckboxComponent, options.symbolize_keys) 31 | 32 | if include_hidden 33 | hidden = hidden_field_for_checkbox(options) 34 | hidden + checkbox 35 | else 36 | checkbox 37 | end 38 | end 39 | 40 | private 41 | def checked?(value) 42 | case value 43 | when TrueClass, FalseClass 44 | value == !!@checked_value 45 | when NilClass 46 | false 47 | when String 48 | value == @checked_value 49 | else 50 | if value.respond_to?(:include?) 51 | value.include?(@checked_value) 52 | else 53 | value.to_i == @checked_value.to_i 54 | end 55 | end 56 | end 57 | 58 | def hidden_field_for_checkbox(options) 59 | @unchecked_value ? tag("input", options.slice("name", "disabled", "form").merge!("type" => "hidden", "value" => @unchecked_value)) : "".html_safe 60 | end 61 | end 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /app/components/arara/tags/chip_choice.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "action_view/helpers/tags/checkable" 4 | 5 | module Arara 6 | module Tags # :nodoc: 7 | class ChipChoice < ActionView::Helpers::Tags::Base # :nodoc: 8 | def initialize(object_name, method_name, template_object, checked_value, unchecked_value, options) 9 | @checked_value = checked_value 10 | @unchecked_value = unchecked_value 11 | super(object_name, method_name, template_object, options) 12 | end 13 | 14 | def render 15 | options = @options.stringify_keys 16 | options["type"] = "checkbox" 17 | options["value"] = @checked_value 18 | options["checked"] = "checked" if input_checked?(options) 19 | options["selected"] = !!options["checked"] 20 | 21 | if options["multiple"] 22 | add_default_name_and_id_for_value(@checked_value, options) 23 | options.delete("multiple") 24 | else 25 | add_default_name_and_id(options) 26 | end 27 | 28 | include_hidden = options.delete("include_hidden") { true } 29 | 30 | options["data"] ||= {} 31 | options["data"]["rails-chip-set-filter-target"] = "rails-chip-set-filter.#{options["id"].camelize(:lower)}" 32 | checkbox = @template_object.template.render(Arara::ChipComponent, options.symbolize_keys) 33 | 34 | if include_hidden 35 | hidden = hidden_field_for_checkbox(options) 36 | hidden + checkbox 37 | else 38 | checkbox 39 | end 40 | end 41 | 42 | private 43 | def input_checked?(options) 44 | if options.has_key?("checked") 45 | checked = options.delete "checked" 46 | checked == true || checked == "checked" 47 | else 48 | checked?(value_before_type_cast) 49 | end 50 | end 51 | 52 | def checked?(value) 53 | case value 54 | when TrueClass, FalseClass 55 | value == !!@checked_value 56 | when NilClass 57 | false 58 | when String 59 | value == @checked_value 60 | else 61 | if value.respond_to?(:include?) 62 | value.include?(@checked_value) 63 | else 64 | value.to_i == @checked_value.to_i 65 | end 66 | end 67 | end 68 | 69 | def hidden_field_for_checkbox(options) 70 | value = options["selected"] ? options["value"] : "0" 71 | tag( 72 | "input", options.slice("name", "disabled", "form"). 73 | merge!( 74 | "type" => "hidden", "value" => value, 75 | "data": { "target": "rails-chip-set-filter.#{options["id"].camelize(:lower)}" 76 | }) 77 | ) 78 | end 79 | end 80 | end 81 | end 82 | -------------------------------------------------------------------------------- /app/components/arara/tags/chipset.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "action_view/helpers/tags/placeholderable" 4 | 5 | module Arara 6 | module Tags # :nodoc: 7 | class Chipset < ActionView::Helpers::Tags::Base # :nodoc: 8 | attr_reader :block 9 | include ActionView::Helpers::Tags::Placeholderable 10 | 11 | def initialize(object_name, method_name, template_object, options = {}, &block) 12 | @block = block 13 | super 14 | end 15 | 16 | def render 17 | options = @options.stringify_keys 18 | options["value"] = options.fetch("value") { value_before_type_cast } unless field_type == "file" 19 | if options["variant"] == :choice 20 | options["include_choice_hidden_field"] = true 21 | end 22 | add_default_name_and_id(options) 23 | 24 | @template_object.template.render(Arara::ChipsetComponent, options.symbolize_keys, &block) 25 | end 26 | 27 | class << self 28 | def field_type 29 | @field_type ||= name.split("::").last.sub("Field", "").downcase 30 | end 31 | end 32 | 33 | private 34 | def field_type 35 | self.class.field_type 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /app/components/arara/tags/label.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Arara 4 | module Tags # :nodoc: 5 | class Label < ActionView::Helpers::Tags::Base # :nodoc: 6 | class LabelBuilder # :nodoc: 7 | attr_reader :object 8 | 9 | def initialize(template_object, object_name, method_name, object, tag_value) 10 | @template_object = template_object 11 | @object_name = object_name 12 | @method_name = method_name 13 | @object = object 14 | @tag_value = tag_value 15 | end 16 | 17 | def translation 18 | method_and_value = @tag_value.present? ? "#{@method_name}.#{@tag_value}" : @method_name 19 | 20 | content ||= Translator 21 | .new(object, @object_name, method_and_value, scope: "helpers.label") 22 | .translate 23 | content ||= @method_name.humanize 24 | 25 | content 26 | end 27 | end 28 | 29 | def initialize(object_name, method_name, template_object, content_or_options = nil, options = nil) 30 | options ||= {} 31 | 32 | content_is_options = content_or_options.is_a?(Hash) 33 | if content_is_options 34 | options.merge! content_or_options 35 | @content = nil 36 | else 37 | @content = content_or_options 38 | end 39 | 40 | super(object_name, method_name, template_object, options) 41 | end 42 | 43 | def render(&block) 44 | options = @options.stringify_keys 45 | tag_value = options.delete("value") 46 | name_and_id = options.dup 47 | 48 | if name_and_id["for"] 49 | name_and_id["id"] = name_and_id["for"] 50 | else 51 | name_and_id.delete("id") 52 | end 53 | 54 | add_default_name_and_id_for_value(tag_value, name_and_id) 55 | options.delete("index") 56 | options.delete("namespace") 57 | options["for"] = name_and_id["id"] unless options.key?("for") 58 | 59 | builder = LabelBuilder.new(@template_object, @object_name, @method_name, @object, tag_value) 60 | 61 | content = if block_given? 62 | @template_object.capture(builder, &block) 63 | elsif @content.present? 64 | @content.to_s 65 | else 66 | render_component(builder) 67 | end 68 | 69 | label_tag(name_and_id["id"], content, options) 70 | end 71 | 72 | private 73 | def render_component(builder) 74 | builder.translation 75 | end 76 | end 77 | end 78 | end 79 | -------------------------------------------------------------------------------- /app/components/arara/tags/password_field.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "action_view/helpers/tags/placeholderable" 4 | 5 | module Arara 6 | module Tags # :nodoc: 7 | class PasswordField < TextField # :nodoc: 8 | include ActionView::Helpers::Tags::Placeholderable 9 | 10 | def render 11 | @options = { value: nil }.merge!(@options) 12 | super 13 | end 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/components/arara/tags/radio_button.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "action_view/helpers/tags/checkable" 4 | 5 | module Arara 6 | module Tags # :nodoc: 7 | class RadioButton < ActionView::Helpers::Tags::Base # :nodoc: 8 | include ActionView::Helpers::Tags::Checkable 9 | 10 | def initialize(object_name, method_name, template_object, tag_value, options) 11 | @tag_value = tag_value 12 | super(object_name, method_name, template_object, options) 13 | end 14 | 15 | def render 16 | options = @options.stringify_keys 17 | options["type"] = "radio" 18 | options["value"] = @tag_value 19 | options["checked"] = "checked" if input_checked?(options) 20 | add_default_name_and_id_for_value(@tag_value, options) 21 | 22 | @template_object.template.render(Arara::RadioButtonComponent, options.symbolize_keys) 23 | end 24 | 25 | private 26 | def checked?(value) 27 | value.to_s == @tag_value.to_s 28 | end 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /app/components/arara/tags/text_area.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "action_view/helpers/tags/placeholderable" 4 | 5 | module Arara 6 | module Tags # :nodoc: 7 | class TextArea < ActionView::Helpers::Tags::Base # :nodoc: 8 | include ActionView::Helpers::Tags::Placeholderable 9 | 10 | def render 11 | options = @options.stringify_keys 12 | add_default_name_and_id(options) 13 | 14 | if size = options.delete("size") 15 | options["cols"], options["rows"] = size.split("x") if size.respond_to?(:split) 16 | end 17 | 18 | options["textarea"] = true 19 | options["value"] = options.delete("value") { value_before_type_cast } 20 | 21 | @template_object.template.render(Arara::TextFieldComponent, options.symbolize_keys) 22 | end 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /app/components/arara/tags/text_field.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "action_view/helpers/tags/placeholderable" 4 | 5 | module Arara 6 | module Tags # :nodoc: 7 | class TextField < ActionView::Helpers::Tags::Base # :nodoc: 8 | include ActionView::Helpers::Tags::Placeholderable 9 | 10 | def render 11 | options = @options.stringify_keys 12 | options["size"] = options["maxlength"] unless options.key?("size") 13 | options["type"] ||= field_type 14 | options["value"] = options.fetch("value") { value_before_type_cast } unless field_type == "file" 15 | add_default_name_and_id(options) 16 | @template_object.template.render(Arara::TextFieldComponent, options.symbolize_keys) 17 | end 18 | 19 | class << self 20 | def field_type 21 | @field_type ||= name.split("::").last.sub("Field", "").downcase 22 | end 23 | end 24 | 25 | private 26 | def field_type 27 | self.class.field_type 28 | end 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /app/components/arara/text_field_component.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= content_tag(html_tag, html_options) do %> 3 | <%= leading_icon %> 4 | <% if textarea %> 5 | <% if max_length && textarea %> 6 |
0 / <%= max_length %>
7 | <% end %> 8 | <%= content_tag(html_input_tag, value, html_input_options) %> 9 | <% else %> 10 | <%= tag(html_input_tag, html_input_options) %> 11 | <% end %> 12 | 13 | <% if user_variant == "outlined" %> 14 |
15 |
16 |
17 | <% if label %> 18 | 19 | <% end %> 20 |
21 |
22 |
23 | <% else %> 24 |
25 | <% if label && !full_width %> 26 | 27 | <% end %> 28 | <% end %> 29 | <%= trailing_icon %> 30 | <% end %> 31 | <% if !helper_text.blank? || (max_length && !textarea) %> 32 |
33 | <% if helper_text %> 34 | 41 | <% end %> 42 | <% if max_length && !textarea %> 43 |
0 / <%= max_length %>
44 | <% end %> 45 |
46 | <% end %> 47 |
48 | -------------------------------------------------------------------------------- /app/components/arara/typography_component.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag(html_tag, class: html_class) do %><%= html_content %><% end %> 2 | -------------------------------------------------------------------------------- /app/components/arara/typography_component.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class TypographyComponent < ActionView::Component::Base 3 | VALID_VARIANTS = %w(h1 h2 h3 h4 h5 h6 sub1 sub2 body1 body2 button caption overline) 4 | class InvalidVariant < StandardError; end 5 | 6 | include Arara::BaseComponent 7 | 8 | def initialize(variant: "body1", **kw) 9 | raise InvalidVariant.new("`#{variant}' is not a valid variant") unless VALID_VARIANTS.include?(variant.to_s) 10 | super(variant: variant, **kw) 11 | end 12 | 13 | private 14 | def default_html_class 15 | return "mdc-typography mdc-typography--headline1" if user_variant == "h1" 16 | return "mdc-typography mdc-typography--headline2" if user_variant == "h2" 17 | return "mdc-typography mdc-typography--headline3" if user_variant == "h3" 18 | return "mdc-typography mdc-typography--headline4" if user_variant == "h4" 19 | return "mdc-typography mdc-typography--headline5" if user_variant == "h5" 20 | return "mdc-typography mdc-typography--headline6" if user_variant == "h6" 21 | return "mdc-typography mdc-typography--subtitle1" if user_variant == "sub1" 22 | return "mdc-typography mdc-typography--subtitle2" if user_variant == "sub2" 23 | return "mdc-typography mdc-typography--body1" if user_variant == "body1" 24 | return "mdc-typography mdc-typography--body2" if user_variant == "body2" 25 | return "mdc-typography mdc-typography--button" if user_variant == "button" 26 | return "mdc-typography mdc-typography--caption" if user_variant == "caption" 27 | return "mdc-typography mdc-typography--overline" if user_variant == "overline" 28 | end 29 | 30 | def html_tag 31 | return user_tag if user_tag 32 | return "h1" if user_variant == "h1" 33 | return "h2" if user_variant == "h2" 34 | return "h3" if user_variant == "h3" 35 | return "h4" if user_variant == "h4" 36 | return "h5" if user_variant == "h5" 37 | return "h6" if user_variant == "h6" 38 | return "h6" if user_variant == "sub1" 39 | return "h6" if user_variant == "sub2" 40 | return "p" if user_variant == "body1" 41 | return "p" if user_variant == "body2" 42 | return "span" if user_variant == "button" 43 | return "span" if user_variant == "caption" 44 | return "span" if user_variant == "overline" 45 | end 46 | 47 | def default_html_tag 48 | html_tag 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /app/controllers/arara/application_controller.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class ApplicationController < ActionController::Base 3 | protect_from_forgery with: :exception 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/helpers/arara/application_helper.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | module ApplicationHelper 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/body_class_toggler_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | 12 | export default class extends Controller { 13 | connect() { 14 | } 15 | 16 | toggle() { 17 | const toggleClass = this.data.get("class") 18 | document.body.classList.toggle(toggleClass) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/counter_controller.js: -------------------------------------------------------------------------------- 1 | import { Controller } from "stimulus" 2 | 3 | export default class extends Controller { 4 | static targets = ["display"] 5 | 6 | initialize() { 7 | this.setCounter(0) 8 | } 9 | 10 | increase() { 11 | this.setCounter(this.counter + 1) 12 | } 13 | 14 | decrease() { 15 | this.setCounter(this.counter - 1) 16 | } 17 | 18 | setCounter(counter) { 19 | this.counter = counter 20 | this.displayTarget.textContent = counter 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/demo_dialog_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCDialog } from "@material/dialog" 12 | 13 | export default class extends Controller { 14 | static targets = ["button", "dialog"] 15 | 16 | connect() { 17 | const dialog = new MDCDialog(this.dialogTarget) 18 | this.dialog = dialog 19 | } 20 | 21 | openDialog() { 22 | this.dialog.open() 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_chip_set_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCChipSet } from "@material/chips" 12 | 13 | export default class extends Controller { 14 | connect() { 15 | const el = new MDCChipSet(this.element) 16 | this.el = el 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_data_table_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCDataTable } from "@material/data-table" 12 | 13 | export default class extends Controller { 14 | connect() { 15 | const el = new MDCDataTable(this.element) 16 | this.el = el 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_form_field_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCFormField } from "@material/form-field" 12 | import { MDCCheckbox } from "@material/checkbox" 13 | import { MDCRadio } from "@material/radio" 14 | 15 | export default class extends Controller { 16 | connect() { 17 | const formField = new MDCFormField(this.element) 18 | 19 | this.checkboxes = [].map.call(this.element.querySelectorAll(".mdc-checkbox"), function (el) { 20 | const checkbox = new MDCCheckbox(el) 21 | if (el.dataset.indeterminate == "true") { 22 | checkbox.indeterminate = true 23 | } 24 | 25 | if (el.dataset.checked == "true") { 26 | checkbox.checked = true 27 | } 28 | formField.input = checkbox 29 | return checkbox 30 | }) 31 | 32 | this.radios = [].map.call(this.element.querySelectorAll(".mdc-radio"), function (el) { 33 | const radio = new MDCRadio(el) 34 | formField.input = radio 35 | return radio 36 | }) 37 | 38 | this.el = formField 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_icon_toggle_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCIconButtonToggle } from "@material/icon-button" 12 | 13 | export default class extends Controller { 14 | connect() { 15 | const el = new MDCIconButtonToggle(this.element) 16 | this.el = el 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_linear_progress_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCLinearProgress } from "@material/linear-progress" 12 | 13 | export default class extends Controller { 14 | connect() { 15 | const el = new MDCLinearProgress(this.element) 16 | this.el = el 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_list_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCRipple } from "@material/ripple" 12 | import { MDCList } from "@material/list" 13 | 14 | export default class extends Controller { 15 | connect() { 16 | const list = new MDCList(this.element) 17 | 18 | const listItemRipples = list.listElements.map((listItemEl) => new MDCRipple(listItemEl)) 19 | 20 | this.listItemRipples = listItemRipples 21 | this.el = list 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_menu_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCMenu } from "@material/menu" 12 | 13 | export default class extends Controller { 14 | static targets = ["button", "menu"] 15 | 16 | connect() { 17 | const menu = new MDCMenu(this.menuTarget) 18 | this.menu = menu 19 | } 20 | 21 | openMenu() { 22 | const isOpen = this.menuTarget.classList.contains("mdc-menu-surface--open") 23 | this.menu.open = !isOpen 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_ripple_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCRipple } from "@material/ripple" 12 | 13 | export default class extends Controller { 14 | connect() { 15 | const el = new MDCRipple(this.element) 16 | this.el = el 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_select_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCSelect } from "@material/select" 12 | 13 | export default class extends Controller { 14 | static targets = ["input"] 15 | 16 | connect() { 17 | const el = new MDCSelect(this.element) 18 | 19 | // initialize with the selected value 20 | this.inputTarget.value = el.value 21 | 22 | el.listen("MDCSelect:change", () => { 23 | this.inputTarget.value = el.value 24 | }) 25 | this.el = el 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_slider_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCSlider } from "@material/slider" 12 | 13 | export default class extends Controller { 14 | connect() { 15 | const el = new MDCSlider(this.element) 16 | el.listen("MDCSlider:change", () => { 17 | alert(`Value changed to ${el.value}`) 18 | }) 19 | this.el = el 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_snackbar_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCSnackbar } from "@material/snackbar" 12 | 13 | export default class extends Controller { 14 | static targets = ["button", "snackbar"] 15 | 16 | connect() { 17 | if (window.snackbarQueue == undefined) { 18 | window.snackbarQueue = [] 19 | } 20 | this.queue = window.snackbarQueue 21 | this.snackbar = new MDCSnackbar(this.snackbarTarget) 22 | this.snackbar.listen("MDCSnackbar:closed", () => this.handleClosed()) 23 | } 24 | 25 | openSnackbar() { 26 | this.queue.push(() => this.snackbar.open()) 27 | if (this.queue.length === 1) { 28 | this.queue[0]() 29 | } 30 | } 31 | 32 | handleClosed() { 33 | this.queue.shift() 34 | if (this.queue.length > 0) { 35 | this.queue[0]() 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_switch_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCSwitch } from "@material/switch" 12 | 13 | export default class extends Controller { 14 | connect() { 15 | const el = new MDCSwitch(this.element) 16 | this.el = el 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_tab_bar_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCTabBar } from "@material/tab-bar" 12 | 13 | export default class extends Controller { 14 | connect() { 15 | const el = new MDCTabBar(this.element) 16 | this.el = el 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_text_field_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCTextField } from "@material/textfield" 12 | 13 | export default class extends Controller { 14 | static targets = ["element", "helperLine"] 15 | 16 | connect() { 17 | const el = new MDCTextField(this.elementTarget) 18 | this.el = el 19 | } 20 | 21 | handleFocus(e) { 22 | this.elementTarget.classList.remove("mdc-text-field--error") 23 | if (this.hasHelperLineTarget) { 24 | if (this.helperLineTarget.classList.contains("mdc-text-field-helper-line--error")) { 25 | this.helperLineTarget.querySelector("p").innerHTML = "" 26 | } 27 | this.helperLineTarget.classList.remove("mdc-text-field-helper-line--error") 28 | } 29 | } 30 | 31 | disconnect() { 32 | this.el.destroy() 33 | this.el = null 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/mdc_top_app_bar_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | import { MDCTopAppBar } from "@material/top-app-bar" 12 | 13 | export default class extends Controller { 14 | connect() { 15 | const el = new MDCTopAppBar(this.element) 16 | this.el = el 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/rails_chip_set_choice_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | 12 | export default class extends Controller { 13 | static targets = ["input"] 14 | 15 | connect() { 16 | const controller = this.application.getControllerForElementAndIdentifier(this.element, "mdc-chip-set") 17 | const chipSet = controller.el 18 | const _this = this 19 | 20 | chipSet.listen("MDCChip:selection", function (event) { 21 | _this.handleSelection(event) 22 | }) 23 | } 24 | 25 | handleSelection(event) { 26 | if (event.detail.selected) { 27 | const value = event.target.attributes.value.value 28 | this.inputTarget.value = value 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/rails_chip_set_filter_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | import { Controller } from "stimulus" 11 | 12 | export default class extends Controller { 13 | connect() { 14 | const controller = this.application.getControllerForElementAndIdentifier(this.element, "mdc-chip-set") 15 | const chipSet = controller.el 16 | const _this = this 17 | 18 | chipSet.listen("MDCChip:selection", function (event) { 19 | _this.handleSelection(event) 20 | }) 21 | } 22 | 23 | handleSelection(event) { 24 | // console.log("event", event) 25 | console.log("target", event.target) 26 | const inputValue = event.target.attributes.value.value 27 | console.log("inputValue", event.target) 28 | console.log("detail", event.detail) 29 | const dataTarget = event.target.dataset.railsChipSetFilterTarget 30 | console.log("dataTarget", dataTarget) 31 | const target = this.element.querySelector(`[data-target="${dataTarget}"]`) 32 | console.log("target", target) 33 | if (event.detail.selected) { 34 | target.value = inputValue 35 | } else { 36 | target.value = 0 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/javascript/arara/controllers/remote_form_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //
7 | //

8 | //
9 | 10 | function scrollTo(element, to = 0, duration = 1000) { 11 | 12 | const start = element.scrollTop 13 | const change = to - start 14 | const increment = 20 15 | let currentTime = 0 16 | 17 | const animateScroll = (() => { 18 | 19 | currentTime += increment 20 | 21 | const val = Math.easeInOutQuad(currentTime, start, change, duration) 22 | 23 | element.scrollTop = val 24 | 25 | if (currentTime < duration) { 26 | setTimeout(animateScroll, increment) 27 | } 28 | }) 29 | 30 | animateScroll() 31 | } 32 | 33 | Math.easeInOutQuad = function (t, b, c, d) { 34 | 35 | t /= d / 2 36 | if (t < 1) return c / 2 * t * t + b 37 | t-- 38 | return -c / 2 * (t * (t - 2) - 1) + b 39 | } 40 | 41 | 42 | import { Controller } from "stimulus" 43 | 44 | export default class extends Controller { 45 | connect() { 46 | const formId = this.element.id 47 | 48 | this.element.addEventListener("ajax:success", function (e, data, status, xhr) { 49 | console.log("ajax:success") 50 | return 51 | }) 52 | 53 | this.element.addEventListener("ajax:error", function (e, xhr, status, error) { 54 | var parser = new DOMParser() 55 | var doc = parser.parseFromString(e.detail[2].responseText, "text/html") 56 | var form = doc.querySelector(`form#${formId}`) 57 | 58 | // sets the new form 59 | const parentNode = e.target.parentNode 60 | parentNode.replaceChild(form, e.target) 61 | 62 | // animate to first element with error 63 | const newForm = parentNode.querySelector(`form#${formId}`) 64 | const elementWithError = newForm.querySelector(".mdc-text-field--error") 65 | 66 | if (elementWithError) { 67 | var content = document.querySelector("#content") 68 | scrollTo(content, (elementWithError.offsetTop - content.offsetTop), 600) 69 | } 70 | e.stopPropagation() 71 | return 72 | }) 73 | 74 | this.element.addEventListener("ajax:complete", function (e, xhr, status, error) { 75 | e.stopPropagation() 76 | return 77 | }) 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/javascript/arara/scss/_material_design.scss: -------------------------------------------------------------------------------- 1 | // Material Design 2 | @import "@material/typography/mdc-typography"; 3 | @import "@material/ripple/mdc-ripple"; 4 | @import "@material/top-app-bar/mdc-top-app-bar"; 5 | 6 | @import "@material/form-field/mdc-form-field"; 7 | @import "@material/button/mdc-button"; 8 | @import "@material/card/mdc-card"; 9 | @import "@material/checkbox/mdc-checkbox"; 10 | @import "@material/icon-button/mdc-icon-button"; 11 | @import "@material/chips/mdc-chips"; 12 | @import "@material/data-table/mdc-data-table"; // needs checkbox 13 | @import "@material/dialog/mdc-dialog"; 14 | @import "@material/elevation/mdc-elevation"; 15 | @import "@material/fab/mdc-fab"; 16 | @import "@material/image-list/mdc-image-list"; 17 | @import "@material/layout-grid/mdc-layout-grid"; 18 | @import "@material/list/mdc-list"; 19 | @import "@material/linear-progress/mdc-linear-progress"; 20 | @import "@material/menu-surface/mdc-menu-surface"; //needs list 21 | @import "@material/menu/mdc-menu"; //needs list 22 | @import "@material/radio/mdc-radio"; // needs form field 23 | @import "@material/select/mdc-select"; // needs list, menu-surface, menu 24 | @import "@material/slider/mdc-slider"; 25 | @import "@material/snackbar/mdc-snackbar"; 26 | @import "@material/switch/mdc-switch"; 27 | 28 | @import "@material/tab-bar/mdc-tab-bar"; 29 | @import "@material/tab-scroller/mdc-tab-scroller"; 30 | @import "@material/tab-indicator/mdc-tab-indicator"; 31 | @import "@material/tab/mdc-tab"; 32 | 33 | @import "@material/textfield/mdc-text-field"; 34 | @import "./material_design/_custom.scss" 35 | -------------------------------------------------------------------------------- /app/javascript/arara/scss/_tailwind.scss: -------------------------------------------------------------------------------- 1 | @import "tailwindcss/base"; 2 | @import "./tailwind/_ripple_workaround"; 3 | @import "tailwindcss/components"; 4 | @import "tailwindcss/utilities"; 5 | -------------------------------------------------------------------------------- /app/javascript/arara/scss/arara.scss: -------------------------------------------------------------------------------- 1 | // Tailwind 2 | @import "./_tailwind"; 3 | 4 | // Material Design 5 | @import "./_material_design.scss"; 6 | -------------------------------------------------------------------------------- /app/javascript/arara/scss/material_design/_custom.scss: -------------------------------------------------------------------------------- 1 | h1 { 2 | margin: 0.67em 0; 3 | } 4 | 5 | h2 { 6 | font-size: 1.5em; 7 | margin-block-start: 0.83em; 8 | margin-block-end: 0.83em; 9 | margin-inline-start: 0px; 10 | margin-inline-end: 0px; 11 | } 12 | 13 | h3 { 14 | margin-block-start: 1em; 15 | margin-block-end: 1em; 16 | margin-inline-start: 0px; 17 | margin-inline-end: 0px; 18 | } 19 | 20 | h4 { 21 | margin-block-start: 1.33em; 22 | margin-block-end: 1.33em; 23 | margin-inline-start: 0px; 24 | margin-inline-end: 0px; 25 | font-weight: bold; 26 | } 27 | 28 | h5 { 29 | margin-block-start: 1.67em; 30 | margin-block-end: 1.67em; 31 | margin-inline-start: 0px; 32 | margin-inline-end: 0px; 33 | font-weight: bold; 34 | } 35 | 36 | h6 { 37 | margin-block-start: 2.33em; 38 | margin-block-end: 2.33em; 39 | margin-inline-start: 0px; 40 | margin-inline-end: 0px; 41 | } 42 | 43 | p { 44 | margin-block-start: 1em; 45 | margin-block-end: 1em; 46 | margin-inline-start: 0px; 47 | margin-inline-end: 0px; 48 | } 49 | 50 | img { 51 | border-style: none; 52 | } 53 | 54 | // what does it do? 55 | .mdc-dialog__content a:focus { 56 | outline: 1px solid currentColor; 57 | } 58 | 59 | .mdc-icon-button { 60 | line-height: normal; 61 | } 62 | -------------------------------------------------------------------------------- /app/javascript/arara/scss/tailwind/_ripple_workaround.scss: -------------------------------------------------------------------------------- 1 | // Workaround to make Ripple work 2 | // https://github.com/tailwindcss/tailwindcss/issues/938#issuecomment-495935593 3 | * { 4 | border-width: 1px; 5 | border-style: none; 6 | 7 | &::before { 8 | border-width: 1px; 9 | border-style: none; 10 | } 11 | 12 | &::after { 13 | border-width: 1px; 14 | border-style: none; 15 | } 16 | } 17 | 18 | .mdc-icon-button, .mdc-button, .mdc-tab { 19 | &:focus { 20 | outline: 0; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/jobs/arara/application_job.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class ApplicationJob < ActiveJob::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/mailers/arara/application_mailer.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class ApplicationMailer < ActionMailer::Base 3 | default from: 'from@example.com' 4 | layout 'mailer' 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/models/arara/application_record.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | class ApplicationRecord < ActiveRecord::Base 3 | self.abstract_class = true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/views/layouts/arara/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Arara 5 | <%= csrf_meta_tags %> 6 | <%= csp_meta_tag %> 7 | 8 | <%= stylesheet_link_tag "arara/application", media: "all" %> 9 | 10 | 11 | 12 | <%= yield %> 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /arara.gemspec: -------------------------------------------------------------------------------- 1 | $:.push File.expand_path("lib", __dir__) 2 | 3 | # Maintain your gem's version: 4 | require "arara/version" 5 | 6 | # Describe your gem and declare its dependencies: 7 | Gem::Specification.new do |spec| 8 | spec.name = "arara" 9 | spec.version = Arara::VERSION 10 | spec.authors = ["Celso Fernandes"] 11 | spec.email = ["celso.fernandes@gmail.com"] 12 | spec.homepage = "https://github.com/fernandes/arara" 13 | spec.summary = "A material design theme for Ruby on Rails" 14 | spec.description = "Material Design based theme for Ruby on Rails, using stimulus for JS and ActionView Components for its components" 15 | spec.license = "MIT" 16 | 17 | spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] 18 | 19 | spec.add_dependency "rails", "~> 6" 20 | spec.add_dependency "actionview-component", "~> 1" 21 | 22 | spec.add_development_dependency "sqlite3" 23 | end 24 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | let defaultPresets; 2 | 3 | if (process.env.BABEL_ENV === 'es') { 4 | defaultPresets = []; 5 | } else { 6 | defaultPresets = [ 7 | [ 8 | '@babel/preset-env', 9 | { 10 | modules: ['esm', 'production-umd', 'test'].includes(process.env.BABEL_ENV) ? false : 'commonjs', 11 | }, 12 | ], 13 | ]; 14 | } 15 | 16 | const productionPlugins = [ 17 | ['@babel/plugin-transform-runtime', { version: '^7.4.4', useESModules: true }] 18 | ]; 19 | 20 | module.exports = { 21 | presets: defaultPresets, 22 | plugins: [ 23 | ['@babel/plugin-proposal-class-properties', { loose: true }], 24 | ['@babel/plugin-proposal-object-rest-spread', { loose: true }], 25 | // for IE 11 support 26 | '@babel/plugin-transform-object-assign', 27 | ], 28 | ignore: [/@babel[\\|/]runtime/], // Fix a Windows issue. 29 | env: { 30 | cjs: { 31 | plugins: productionPlugins, 32 | }, 33 | coverage: { 34 | plugins: [ 35 | 'babel-plugin-istanbul', 36 | ], 37 | }, 38 | development: {}, 39 | esm: { 40 | plugins: [...productionPlugins], 41 | }, 42 | es: { 43 | plugins: [...productionPlugins], 44 | }, 45 | production: { 46 | plugins: [...productionPlugins], 47 | }, 48 | 'production-umd': { 49 | plugins: [...productionPlugins], 50 | }, 51 | test: { 52 | sourceMaps: 'both', 53 | }, 54 | benchmark: { 55 | plugins: [...productionPlugins] 56 | }, 57 | }, 58 | }; 59 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # This command will automatically be run when you run "rails" with Rails gems 3 | # installed from the root of your application. 4 | 5 | ENGINE_ROOT = File.expand_path('..', __dir__) 6 | ENGINE_PATH = File.expand_path('../lib/arara/engine', __dir__) 7 | APP_PATH = File.expand_path('../test/dummy/config/application', __dir__) 8 | 9 | # Set up gems listed in the Gemfile. 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 11 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) 12 | 13 | require 'rails/all' 14 | require 'rails/engine/commands' 15 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Arara::Engine.routes.draw do 2 | end 3 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | browsers: ["ChromeHeadless"], 3 | frameworks: ["qunit"], 4 | files: [ 5 | "test/javascript/compiled/index.js", 6 | ], 7 | 8 | client: { 9 | clearContext: false, 10 | qunit: { 11 | showUI: true 12 | } 13 | }, 14 | 15 | singleRun: true, 16 | autoWatch: false, 17 | 18 | captureTimeout: 180000, 19 | browserDisconnectTimeout: 180000, 20 | browserDisconnectTolerance: 3, 21 | browserNoActivityTimeout: 300000, 22 | } 23 | 24 | // if (process.env.CI) { 25 | // config.customLaunchers = { 26 | // sl_chrome: sauce("chrome", 70), 27 | // sl_ff: sauce("firefox", 63), 28 | // sl_safari: sauce("safari", 12.0, "macOS 10.13"), 29 | // sl_edge: sauce("microsoftedge", 17.17134, "Windows 10"), 30 | // sl_ie_11: sauce("internet explorer", 11, "Windows 8.1"), 31 | // } 32 | 33 | // config.browsers = Object.keys(config.customLaunchers) 34 | // config.reporters = ["dots", "saucelabs"] 35 | 36 | // config.sauceLabs = { 37 | // testName: "Arara JS", 38 | // retryLimit: 3, 39 | // build: buildId(), 40 | // } 41 | 42 | // function sauce(browserName, version, platform) { 43 | // const options = { 44 | // base: "SauceLabs", 45 | // browserName: browserName.toString(), 46 | // version: version.toString(), 47 | // } 48 | // if (platform) { 49 | // options.platform = platform.toString() 50 | // } 51 | // return options 52 | // } 53 | 54 | // function buildId() { 55 | // const { BUILDKITE_JOB_ID } = process.env 56 | // return BUILDKITE_JOB_ID 57 | // ? `Buildkite ${BUILDKITE_JOB_ID}` 58 | // : "" 59 | // } 60 | // } 61 | 62 | module.exports = function (karmaConfig) { 63 | karmaConfig.set(config) 64 | } 65 | -------------------------------------------------------------------------------- /lib/arara.rb: -------------------------------------------------------------------------------- 1 | require "arara/engine" 2 | 3 | module Arara 4 | # Your code goes here... 5 | end 6 | -------------------------------------------------------------------------------- /lib/arara/engine.rb: -------------------------------------------------------------------------------- 1 | require 'action_view/component/railtie' 2 | 3 | module Arara 4 | class Engine < ::Rails::Engine 5 | isolate_namespace Arara 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/arara/version.rb: -------------------------------------------------------------------------------- 1 | module Arara 2 | VERSION = '0.2.1' 3 | end 4 | -------------------------------------------------------------------------------- /lib/tasks/arara_tasks.rake: -------------------------------------------------------------------------------- 1 | # desc "Explaining what the task does" 2 | # task :arara do 3 | # # Task goes here 4 | # end 5 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import babel from "rollup-plugin-babel" 2 | import commonjs from "rollup-plugin-commonjs" 3 | import uglify from "rollup-plugin-uglify" 4 | import resolve from "rollup-plugin-node-resolve" 5 | 6 | const uglifyOptions = { 7 | mangle: false, 8 | compress: false, 9 | output: { 10 | beautify: true, 11 | indent_level: 2 12 | } 13 | } 14 | 15 | const babelOptions = { 16 | exclude: /node_modules/, 17 | // We are using @babel/plugin-transform-runtime 18 | runtimeHelpers: true, 19 | configFile: './babel.config.js', 20 | }; 21 | 22 | export default { 23 | input: "app/javascript/arara/index.js", 24 | output: { 25 | file: "app/assets/javascripts/arara.js", 26 | format: "umd", 27 | name: "Arara", 28 | exports: 'named', 29 | globals: { 30 | '@material/checkbox': 'checkbox', 31 | '@material/chips': 'chips', 32 | '@material/data-table': 'data-table', 33 | '@material/dialog': 'dialog', 34 | '@material/form-field': 'form-field', 35 | '@material/icon-button': 'icon-button', 36 | '@material/linear-progress': 'linear-progress', 37 | '@material/list': 'list', 38 | '@material/menu': 'menu', 39 | '@material/radio': 'radio', 40 | '@material/ripple': 'ripple', 41 | '@material/select': 'select', 42 | '@material/slider': 'slider', 43 | '@material/snackbar': 'snackbar', 44 | '@material/switch': 'switch', 45 | '@material/tab-bar': 'tab-bar', 46 | '@material/textfield': 'textfield', 47 | '@material/top-app-bar': 'top-app-bar', 48 | 'stimulus': 'stimulus', 49 | }, 50 | }, 51 | plugins: [ 52 | resolve(), 53 | babel(babelOptions), 54 | commonjs(), 55 | uglify(uglifyOptions), 56 | ], 57 | external: [ 58 | '@material/checkbox', 59 | '@material/chips', 60 | '@material/data-table', 61 | '@material/dialog', 62 | '@material/form-field', 63 | '@material/icon-button', 64 | '@material/linear-progress', 65 | '@material/list', 66 | '@material/menu', 67 | '@material/radio', 68 | '@material/ripple', 69 | '@material/select', 70 | '@material/slider', 71 | '@material/snackbar', 72 | '@material/switch', 73 | '@material/tab-bar', 74 | '@material/textfield', 75 | '@material/top-app-bar', 76 | 'stimulus', 77 | ], 78 | } 79 | -------------------------------------------------------------------------------- /rollup.config.test.js: -------------------------------------------------------------------------------- 1 | import babel from "rollup-plugin-babel" 2 | import commonjs from "rollup-plugin-commonjs" 3 | import resolve from "rollup-plugin-node-resolve" 4 | 5 | export default { 6 | input: "test/javascript/src/index.js", 7 | 8 | output: { 9 | file: "test/javascript/compiled/index.js", 10 | format: "umd", 11 | globals: { 12 | '@material/checkbox': 'checkbox', 13 | '@material/chips': 'chips', 14 | '@material/data-table': 'data-table', 15 | '@material/dialog': 'dialog', 16 | '@material/form-field': 'form-field', 17 | '@material/icon-button': 'icon-button', 18 | '@material/linear-progress': 'linear-progress', 19 | '@material/list': 'list', 20 | '@material/menu': 'menu', 21 | '@material/radio': 'radio', 22 | '@material/ripple': 'ripple', 23 | '@material/select': 'select', 24 | '@material/slider': 'slider', 25 | '@material/snackbar': 'snackbar', 26 | '@material/switch': 'switch', 27 | '@material/tab-bar': 'tab-bar', 28 | '@material/textfield': 'textfield', 29 | '@material/top-app-bar': 'top-app-bar', 30 | 'stimulus': 'stimulus', 31 | }, 32 | }, 33 | 34 | plugins: [ 35 | resolve(), 36 | babel({ 37 | exclude: "node_modules/**" 38 | }), 39 | commonjs() 40 | ], 41 | 42 | external: [ 43 | '@material/checkbox', 44 | '@material/chips', 45 | '@material/data-table', 46 | '@material/dialog', 47 | '@material/form-field', 48 | '@material/icon-button', 49 | '@material/linear-progress', 50 | '@material/list', 51 | '@material/menu', 52 | '@material/radio', 53 | '@material/ripple', 54 | '@material/select', 55 | '@material/slider', 56 | '@material/snackbar', 57 | '@material/switch', 58 | '@material/tab-bar', 59 | '@material/textfield', 60 | '@material/top-app-bar', 61 | ], 62 | } 63 | -------------------------------------------------------------------------------- /test/arara_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Arara::Test < ActiveSupport::TestCase 4 | test "truth" do 5 | assert_kind_of Module, Arara 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /test/dummy/.browserslistrc: -------------------------------------------------------------------------------- 1 | defaults 2 | -------------------------------------------------------------------------------- /test/dummy/.ruby-version: -------------------------------------------------------------------------------- 1 | 2.5.3 2 | -------------------------------------------------------------------------------- /test/dummy/Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /test/dummy/app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../stylesheets .css 3 | //= link arara_manifest.js 4 | -------------------------------------------------------------------------------- /test/dummy/app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/app/assets/images/.keep -------------------------------------------------------------------------------- /test/dummy/app/assets/images/arara_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/app/assets/images/arara_logo.png -------------------------------------------------------------------------------- /test/dummy/app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /test/dummy/app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /test/dummy/app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /test/dummy/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | end 3 | -------------------------------------------------------------------------------- /test/dummy/app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /test/dummy/app/controllers/home_controller.rb: -------------------------------------------------------------------------------- 1 | class HomeController < ApplicationController 2 | def show 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /test/dummy/app/controllers/pages_controller.rb: -------------------------------------------------------------------------------- 1 | class PagesController < ApplicationController 2 | def show 3 | render params[:id], layout: page_layout 4 | rescue ActionView::MissingTemplate => e 5 | render :not_found, layout: 'blank' 6 | end 7 | 8 | def page_layout 9 | return "top_app_bar" if params[:id].match?("top_app_bar_demo_") 10 | return "login" if params[:id] == "login" 11 | "application" 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /test/dummy/app/controllers/posts_controller.rb: -------------------------------------------------------------------------------- 1 | class PostsController < ApplicationController 2 | before_action :set_post, only: [:show, :edit, :update, :destroy] 3 | 4 | # GET /posts 5 | # GET /posts.json 6 | def index 7 | @posts = Post.all 8 | end 9 | 10 | # GET /posts/1 11 | # GET /posts/1.json 12 | def show 13 | end 14 | 15 | # GET /posts/new 16 | def new 17 | @post = Post.new 18 | end 19 | 20 | # GET /posts/1/edit 21 | def edit 22 | end 23 | 24 | # POST /posts 25 | # POST /posts.json 26 | def create 27 | @post = Post.new(post_params) 28 | 29 | respond_to do |format| 30 | if @post.save 31 | format.html { redirect_to @post, notice: 'Post was successfully created.' } 32 | format.json { render :show, status: :created, location: @post } 33 | format.js { render :show, status: :created, location: @post } 34 | else 35 | format.html { render :new } 36 | format.json { render json: @post.errors, status: :unprocessable_entity } 37 | format.js { render :new, status: :unprocessable_entity, content_type: 'text/html', layout: false } 38 | end 39 | end 40 | end 41 | 42 | # PATCH/PUT /posts/1 43 | # PATCH/PUT /posts/1.json 44 | def update 45 | respond_to do |format| 46 | if @post.update(post_params) 47 | format.html { redirect_to @post, notice: 'Post was successfully updated.' } 48 | format.json { render :show, status: :ok, location: @post } 49 | else 50 | format.html { render :edit } 51 | format.json { render json: @post.errors, status: :unprocessable_entity } 52 | end 53 | end 54 | end 55 | 56 | # DELETE /posts/1 57 | # DELETE /posts/1.json 58 | def destroy 59 | @post.destroy 60 | respond_to do |format| 61 | format.html { redirect_to posts_url, notice: 'Post was successfully destroyed.' } 62 | format.json { head :no_content } 63 | end 64 | end 65 | 66 | private 67 | # Use callbacks to share common setup or constraints between actions. 68 | def set_post 69 | @post = Post.find(params[:id]) 70 | end 71 | 72 | # Never trust parameters from the scary internet, only allow the white list through. 73 | def post_params 74 | params.require(:post).permit(:title, :body, :published, :category, :language, :visibility, tags: []) 75 | end 76 | end 77 | -------------------------------------------------------------------------------- /test/dummy/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/controllers/index.js: -------------------------------------------------------------------------------- 1 | // Load all the controllers within this directory and all subdirectories. 2 | // Controller files must be named *_controller.js. 3 | 4 | import { Application } from "stimulus" 5 | import { body_class_toggler_controller } from 'arara' 6 | import { demo_dialog_controller } from 'arara' 7 | import { mdc_ripple_controller } from 'arara' 8 | import { mdc_chip_set_controller } from 'arara' 9 | import { mdc_data_table_controller } from 'arara' 10 | import { mdc_form_field_controller } from 'arara' 11 | import { mdc_icon_toggle_controller } from 'arara' 12 | import { mdc_linear_progress_controller } from 'arara' 13 | import { mdc_list_controller } from 'arara' 14 | import { mdc_menu_controller } from 'arara' 15 | import { mdc_select_controller } from 'arara' 16 | import { mdc_slider_controller } from 'arara' 17 | import { mdc_snackbar_controller } from 'arara' 18 | import { mdc_switch_controller } from 'arara' 19 | import { mdc_tab_bar_controller } from 'arara' 20 | import { mdc_text_field_controller } from 'arara' 21 | import { mdc_top_app_bar_controller } from 'arara' 22 | import { rails_chip_set_choice_controller } from 'arara' 23 | import { rails_chip_set_filter_controller } from 'arara' 24 | import { remote_form_controller } from 'arara' 25 | 26 | import { definitionsFromContext } from "stimulus/webpack-helpers" 27 | 28 | const application = Application.start() 29 | const context = require.context("controllers", true, /_controller\.js$/) 30 | application.load(definitionsFromContext(context)) 31 | 32 | // Arara Controller 33 | application.register('body-class-toggler', body_class_toggler_controller) 34 | application.register('demo-dialog', demo_dialog_controller) 35 | application.register('mdc-ripple', mdc_ripple_controller) 36 | application.register('mdc-chip-set', mdc_chip_set_controller) 37 | application.register('mdc-data-table', mdc_data_table_controller) 38 | application.register('mdc-form-field', mdc_form_field_controller) 39 | application.register('mdc-icon-toggle', mdc_icon_toggle_controller) 40 | application.register('mdc-linear-progress', mdc_linear_progress_controller) 41 | application.register('mdc-list', mdc_list_controller) 42 | application.register('mdc-menu', mdc_menu_controller) 43 | application.register('mdc-select', mdc_select_controller) 44 | application.register('mdc-slider', mdc_slider_controller) 45 | application.register('mdc-snackbar', mdc_snackbar_controller) 46 | application.register('mdc-switch', mdc_switch_controller) 47 | application.register('mdc-tab-bar', mdc_tab_bar_controller) 48 | application.register('mdc-text-field', mdc_text_field_controller) 49 | application.register('mdc-top-app-bar', mdc_top_app_bar_controller) 50 | application.register('rails-chip-set-filter', rails_chip_set_choice_controller) 51 | application.register('rails-chip-set-choice', rails_chip_set_filter_controller) 52 | application.register('remote-form', remote_form_controller) 53 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/packs/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. JavaScript code in this file should be added after the last require_* statement. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require rails-ujs 14 | //= require activestorage 15 | //= require_tree . 16 | require("@rails/ujs").start(); 17 | require("turbolinks").start(); 18 | 19 | import "controllers" 20 | import '../styles/dummy.scss' 21 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/_demo.scss: -------------------------------------------------------------------------------- 1 | @import "./demo/button"; 2 | @import "./demo/card"; 3 | @import "./demo/checkbox"; 4 | @import "./demo/chips"; 5 | @import "./demo/data_table"; 6 | @import "./demo/drawer"; 7 | @import "./demo/elevation"; 8 | @import "./demo/fab"; 9 | @import "./demo/image_list"; 10 | @import "./demo/layout_grid"; 11 | @import "./demo/linear_progress_indicator"; 12 | @import "./demo/list"; 13 | @import "./demo/radio"; 14 | @import "./demo/ripple"; 15 | @import "./demo/select"; 16 | @import "./demo/slider"; 17 | @import "./demo/snackbar"; 18 | @import "./demo/text_field"; 19 | @import "./demo/top_app_bar"; 20 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_button.scss: -------------------------------------------------------------------------------- 1 | .mdc-button { 2 | height: 36px; 3 | } 4 | 5 | .demo-button { 6 | margin: 8px 16px; 7 | } 8 | 9 | .demo-button-shaped { 10 | border-radius: 18px; 11 | } 12 | .demo-button-shaped .mdc-button__ripple { 13 | border-radius: 18px; 14 | } 15 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_card.scss: -------------------------------------------------------------------------------- 1 | .demo-card { 2 | width: 350px; 3 | margin: 48px 0; 4 | } 5 | 6 | .demo-card__primary { 7 | padding: 1rem; 8 | } 9 | 10 | .demo-card__title { 11 | margin: 0; 12 | } 13 | 14 | .demo-card__subtitle { 15 | color: rgba(0, 0, 0, 0.54); 16 | /* @alternate */ 17 | color: var(--mdc-theme-text-secondary-on-background, rgba(0, 0, 0, 0.54)); 18 | margin: 0; 19 | } 20 | 21 | .demo-card__secondary { 22 | color: rgba(0, 0, 0, 0.54); 23 | /* @alternate */ 24 | color: var(--mdc-theme-text-secondary-on-background, rgba(0, 0, 0, 0.54)); 25 | padding: 0 1rem 8px 1rem; 26 | } 27 | 28 | .demo-card-shaped { 29 | /* @noflip */ 30 | border-radius: 24px 8px; 31 | } 32 | [dir=rtl] .demo-card-shaped, .demo-card-shaped[dir=rtl] { 33 | /* @noflip */ 34 | border-radius: 8px 24px; 35 | } 36 | 37 | .demo-card__media.mdc-card__media--square { 38 | width: 110px; 39 | } 40 | 41 | .demo-basic-with-header .demo-card__secondary, 42 | .demo-basic-with-text-over-media .demo-card__secondary { 43 | padding-top: 1rem; 44 | } 45 | 46 | .demo-basic-with-text-over-media .demo-card__media-content { 47 | display: -ms-flexbox; 48 | display: flex; 49 | -ms-flex-align: end; 50 | align-items: flex-end; 51 | } 52 | .demo-basic-with-text-over-media .demo-card__media-content .demo-card__title, 53 | .demo-basic-with-text-over-media .demo-card__media-content .demo-card__subtitle { 54 | color: white; 55 | } 56 | 57 | .demo-ui-control .demo-card__primary-action { 58 | display: -ms-flexbox; 59 | display: flex; 60 | -ms-flex-direction: row; 61 | flex-direction: row; 62 | } 63 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_checkbox.scss: -------------------------------------------------------------------------------- 1 | .demo-checkbox { 2 | margin: 8px 16px; 3 | } 4 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_chips.scss: -------------------------------------------------------------------------------- 1 | .demo-chip-shaped { 2 | border-radius: 4px; 3 | } 4 | .demo-chip-shaped .mdc-chip__ripple { 5 | border-radius: 4px; 6 | } 7 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_data_table.scss: -------------------------------------------------------------------------------- 1 | .demo-data-table-header { 2 | font-family: Roboto, sans-serif; 3 | -moz-osx-font-smoothing: grayscale; 4 | -webkit-font-smoothing: antialiased; 5 | font-size: 1rem; 6 | line-height: 1.75rem; 7 | font-weight: 400; 8 | letter-spacing: 0.009375em; 9 | text-decoration: inherit; 10 | text-transform: inherit; 11 | margin-top: 32px; 12 | } 13 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_drawer.scss: -------------------------------------------------------------------------------- 1 | .drawer-demos-display { 2 | display: -ms-flexbox; 3 | display: flex; 4 | -ms-flex-wrap: wrap; 5 | flex-wrap: wrap; 6 | min-height: 400px; 7 | } 8 | 9 | .drawer-demo { 10 | display: inline-block; 11 | -ms-flex: 1 1 80%; 12 | flex: 1 1 80%; 13 | -ms-flex-pack: distribute; 14 | justify-content: space-around; 15 | min-height: 400px; 16 | min-width: 400px; 17 | padding: 15px; 18 | } 19 | 20 | .drawer-iframe { 21 | width: 100%; 22 | height: 400px; 23 | } 24 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_elevation.scss: -------------------------------------------------------------------------------- 1 | .elevation-demo-surface { 2 | display: -ms-inline-flexbox; 3 | display: inline-flex; 4 | -ms-flex-pack: distribute; 5 | justify-content: space-around; 6 | min-height: 100px; 7 | min-width: 200px; 8 | margin: 15px; 9 | -ms-flex-align: center; 10 | align-items: center; 11 | } 12 | 13 | .elevation--custom-color-z16 { 14 | -webkit-box-shadow: 0px 8px 10px -5px rgba(1, 135, 134, 0.3), 0px 16px 24px 2px rgba(1, 135, 134, 0.24), 0px 6px 30px 5px rgba(1, 135, 134, 0.22); 15 | box-shadow: 0px 8px 10px -5px rgba(1, 135, 134, 0.3), 0px 16px 24px 2px rgba(1, 135, 134, 0.24), 0px 6px 30px 5px rgba(1, 135, 134, 0.22); 16 | } 17 | 18 | .elevation-hero .elevation-demo-surface { 19 | width: 120px; 20 | height: 48px; 21 | margin: 24px 24px; 22 | background-color: #212121; 23 | color: #f0f0f0; 24 | } 25 | 26 | .elevation-demo-container { 27 | display: -ms-flexbox; 28 | display: flex; 29 | margin: auto; 30 | -ms-flex: 1 1 auto; 31 | flex: 1 1 auto; 32 | -ms-flex-wrap: wrap; 33 | flex-wrap: wrap; 34 | -ms-flex-pack: justify; 35 | justify-content: space-between; 36 | width: 100%; 37 | } 38 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_fab.scss: -------------------------------------------------------------------------------- 1 | .demo-fab-shaped { 2 | display: -ms-flexbox; 3 | display: flex; 4 | } 5 | 6 | .demo-fab-shaped--one { 7 | margin-right: 24px; 8 | } 9 | .demo-fab-shaped--one:not(.mdc-fab--extended) { 10 | /* @noflip */ 11 | border-radius: 50% 0; 12 | } 13 | [dir=rtl] .demo-fab-shaped--one:not(.mdc-fab--extended), .demo-fab-shaped--one:not(.mdc-fab--extended)[dir=rtl] { 14 | /* @noflip */ 15 | border-radius: 0 50%; 16 | } 17 | .demo-fab-shaped--one:not(.mdc-fab--extended) .mdc-fab__ripple { 18 | /* @noflip */ 19 | border-radius: 50% 0; 20 | } 21 | [dir=rtl] .demo-fab-shaped--one:not(.mdc-fab--extended) .mdc-fab__ripple, .demo-fab-shaped--one:not(.mdc-fab--extended) .mdc-fab__ripple[dir=rtl] { 22 | /* @noflip */ 23 | border-radius: 0 50%; 24 | } 25 | 26 | .demo-fab-shaped--two { 27 | margin-right: 24px; 28 | } 29 | .demo-fab-shaped--two:not(.mdc-fab--extended) { 30 | border-radius: 8px; 31 | } 32 | .demo-fab-shaped--two:not(.mdc-fab--extended) .mdc-fab__ripple { 33 | border-radius: 8px; 34 | } 35 | 36 | .demo-fab-shaped--three { 37 | border-radius: 12px; 38 | margin-right: 24px; 39 | } 40 | .demo-fab-shaped--three .mdc-fab__ripple { 41 | border-radius: 12px; 42 | } 43 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_image_list.scss: -------------------------------------------------------------------------------- 1 | .standard-image-list { 2 | max-width: 900px; 3 | } 4 | .standard-image-list .mdc-image-list__image-aspect-container { 5 | padding-bottom: calc(100% / 1.5); 6 | } 7 | .standard-image-list .mdc-image-list__item { 8 | width: calc(100% / 5 - 4.2px); 9 | margin: 2px; 10 | } 11 | .standard-image-list .mdc-image-list__image { 12 | border-radius: 8px; 13 | } 14 | .standard-image-list.mdc-image-list--with-text-protection .mdc-image-list__supporting { 15 | border-radius: 0 0 8px 8px; 16 | } 17 | 18 | .masonry-image-list { 19 | -webkit-column-count: 5; 20 | column-count: 5; 21 | -webkit-column-gap: 16px; 22 | column-gap: 16px; 23 | max-width: 900px; 24 | } 25 | .masonry-image-list .mdc-image-list__item { 26 | margin-bottom: 16px; 27 | } 28 | 29 | @media (max-width: 599px) { 30 | .standard-image-list .mdc-image-list__item { 31 | width: calc(100% / 3 - 4.3333333333px); 32 | margin: 2px; 33 | } 34 | 35 | .masonry-image-list { 36 | -webkit-column-count: 3; 37 | column-count: 3; 38 | -webkit-column-gap: 16px; 39 | column-gap: 16px; 40 | } 41 | .masonry-image-list .mdc-image-list__item { 42 | margin-bottom: 16px; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_layout_grid.scss: -------------------------------------------------------------------------------- 1 | .demo-grid { 2 | background: rgba(0, 0, 0, 0.2); 3 | min-width: 360px; 4 | } 5 | 6 | .demo-grid--alignment { 7 | max-width: 800px; 8 | } 9 | 10 | .demo-grid--cell-alignment { 11 | min-height: 200px; 12 | } 13 | 14 | .demo-inner { 15 | min-height: 200px; 16 | } 17 | 18 | .demo-cell { 19 | background: rgba(0, 0, 0, 0.2); 20 | height: 100px; 21 | } 22 | 23 | .demo-cell--alignment { 24 | max-height: 50px; 25 | } 26 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_linear_progress_indicator.scss: -------------------------------------------------------------------------------- 1 | .demo-linear-progress-indicator { 2 | margin-top: 32px; 3 | } 4 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_list.scss: -------------------------------------------------------------------------------- 1 | .demo-list { 2 | max-width: 600px; 3 | border: 1px solid rgba(0, 0, 0, 0.1); 4 | } 5 | 6 | .mdc-list--avatar-list .mdc-list-item__graphic { 7 | background-color: rgba(0, 0, 0, 0.3); 8 | color: white; 9 | } 10 | 11 | .demo-list-item-shaped .mdc-list-item { 12 | /* @noflip */ 13 | border-radius: 0 32px 32px 0; 14 | } 15 | [dir=rtl] .demo-list-item-shaped .mdc-list-item, .demo-list-item-shaped .mdc-list-item[dir=rtl] { 16 | /* @noflip */ 17 | border-radius: 32px 0 0 32px; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_radio.scss: -------------------------------------------------------------------------------- 1 | .demo-radio { 2 | margin: 0 10px; 3 | } 4 | 5 | .demo-radio-form-field { 6 | margin: 0 10px; 7 | } 8 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_select.scss: -------------------------------------------------------------------------------- 1 | .custom-enhanced-select-width { 2 | width: 240px; 3 | } 4 | 5 | .demo-select-box-shaped .mdc-select__anchor { 6 | border-radius: 17.92px 17.92px 0 0; 7 | } 8 | 9 | .demo-select-outline-shaped .mdc-notched-outline .mdc-notched-outline__leading { 10 | /* @noflip */ 11 | border-radius: 28px 0 0 28px; 12 | width: 28px; 13 | } 14 | [dir=rtl] .demo-select-outline-shaped .mdc-notched-outline .mdc-notched-outline__leading, .demo-select-outline-shaped .mdc-notched-outline .mdc-notched-outline__leading[dir=rtl] { 15 | /* @noflip */ 16 | border-radius: 0 28px 28px 0; 17 | } 18 | .demo-select-outline-shaped .mdc-notched-outline .mdc-notched-outline__notch { 19 | max-width: calc(100% - 28px * 2); 20 | } 21 | .demo-select-outline-shaped .mdc-notched-outline .mdc-notched-outline__trailing { 22 | /* @noflip */ 23 | border-radius: 0 28px 28px 0; 24 | } 25 | [dir=rtl] .demo-select-outline-shaped .mdc-notched-outline .mdc-notched-outline__trailing, .demo-select-outline-shaped .mdc-notched-outline .mdc-notched-outline__trailing[dir=rtl] { 26 | /* @noflip */ 27 | border-radius: 28px 0 0 28px; 28 | } 29 | .demo-select-outline-shaped .mdc-select__selected-text { 30 | border-radius: 28px; 31 | } 32 | .demo-select-outline-shaped .mdc-select__selected-text { 33 | /* @noflip */ 34 | padding-left: 32px; 35 | /* @noflip */ 36 | padding-right: 52px; 37 | } 38 | [dir=rtl] .demo-select-outline-shaped .mdc-select__selected-text, .demo-select-outline-shaped .mdc-select__selected-text[dir=rtl] { 39 | /* @noflip */ 40 | padding-left: 52px; 41 | /* @noflip */ 42 | padding-right: 32px; 43 | } 44 | .demo-select-outline-shaped + .mdc-select-helper-text { 45 | /* @noflip */ 46 | margin-left: 32px; 47 | /* @noflip */ 48 | margin-right: 16px; 49 | } 50 | [dir=rtl] .demo-select-outline-shaped + .mdc-select-helper-text, .demo-select-outline-shaped + .mdc-select-helper-text[dir=rtl] { 51 | /* @noflip */ 52 | margin-left: 16px; 53 | /* @noflip */ 54 | margin-right: 32px; 55 | } 56 | 57 | .select-row { 58 | display: -ms-flexbox; 59 | display: flex; 60 | -ms-flex-align: start; 61 | align-items: flex-start; 62 | -ms-flex-pack: start; 63 | justify-content: flex-start; 64 | -ms-flex-wrap: wrap; 65 | flex-wrap: wrap; 66 | } 67 | .select-row .mdc-select { 68 | margin-right: 5em; 69 | } 70 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_slider.scss: -------------------------------------------------------------------------------- 1 | .demo-slider { 2 | margin-top: 32px; 3 | } 4 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_snackbar.scss: -------------------------------------------------------------------------------- 1 | .snackbar-demo-button { 2 | margin: 8px 16px; 3 | } 4 | -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/demo/_top_app_bar.scss: -------------------------------------------------------------------------------- 1 | .demos-display { 2 | display: -ms-flexbox; 3 | display: flex; 4 | -ms-flex-wrap: wrap; 5 | flex-wrap: wrap; 6 | min-height: 200px; 7 | } 8 | 9 | .demo { 10 | display: inline-block; 11 | -ms-flex: 1 1 45%; 12 | flex: 1 1 45%; 13 | -ms-flex-pack: distribute; 14 | justify-content: space-around; 15 | min-height: 200px; 16 | min-width: 400px; 17 | padding: 15px; 18 | } 19 | 20 | .frame { 21 | width: 100%; 22 | height: 200px; 23 | } 24 | 25 | .top-app-bar__frame { 26 | height: 200vh; 27 | } -------------------------------------------------------------------------------- /test/dummy/app/javascript/styles/dummy.scss: -------------------------------------------------------------------------------- 1 | @import "arara/scss/arara.scss"; 2 | @import "./_demo.scss"; 3 | -------------------------------------------------------------------------------- /test/dummy/app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | # Automatically retry jobs that encountered a deadlock 3 | # retry_on ActiveRecord::Deadlocked 4 | 5 | # Most jobs are safe to ignore if the underlying records are no longer available 6 | # discard_on ActiveJob::DeserializationError 7 | end 8 | -------------------------------------------------------------------------------- /test/dummy/app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /test/dummy/app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /test/dummy/app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/app/models/concerns/.keep -------------------------------------------------------------------------------- /test/dummy/app/views/layouts/login.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Arara 5 | 6 | <%= csrf_meta_tags %> 7 | <%= csp_meta_tag %> 8 | 9 | <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 10 | <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 36 | 37 | 38 |
39 |
40 |
41 |
42 |
43 | <%= yield %> 44 |
45 |
46 |
47 |
48 |
49 | 50 | 51 | -------------------------------------------------------------------------------- /test/dummy/app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/dummy/app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /test/dummy/app/views/layouts/top_app_bar.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Arara 5 | 6 | <%= csrf_meta_tags %> 7 | <%= csp_meta_tag %> 8 | 9 | <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 10 | <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | <%= yield %> 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/button.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | <%= render(Arara::TypographyComponent, tag: "h3", variant: "sub1", content: "Text Button") %> 4 | <%= render(Arara::ButtonComponent, content: "Default") %> 5 | <%= render(Arara::ButtonComponent, content: "Dense", dense: true) %> 6 | <%= render(Arara::ButtonComponent, content: "Icon", icon: "favorite") %> 7 |
8 |
9 | <%= render(Arara::TypographyComponent, tag: "h3", variant: "sub1", content: "Raised Button") %> 10 | <%= render(Arara::ButtonComponent, content: "Default", variant: "raised") %> 11 | <%= render(Arara::ButtonComponent, content: "Dense", variant: "raised", dense: true) %> 12 | <%= render(Arara::ButtonComponent, content: "Icon", variant: "raised", icon: "favorite") %> 13 |
14 |
15 | <%= render(Arara::TypographyComponent, tag: "h3", variant: "sub1", content: "Unelevated Button") %> 16 | <%= render(Arara::ButtonComponent, content: "Default", variant: "unelevated") %> 17 | <%= render(Arara::ButtonComponent, content: "Dense", variant: "unelevated", dense: true) %> 18 | <%= render(Arara::ButtonComponent, content: "Icon", variant: "unelevated", icon: "favorite") %> 19 |
20 |
21 | <%= render(Arara::TypographyComponent, tag: "h3", variant: "sub1", content: "Outlined Button") %> 22 | <%= render(Arara::ButtonComponent, content: "Default", variant: "outlined") %> 23 | <%= render(Arara::ButtonComponent, content: "Dense", variant: "outlined", dense: true) %> 24 | <%= render(Arara::ButtonComponent, content: "Icon", variant: "outlined", icon: "favorite", data: {controller: 'foo', 'info-tag': nil}) %> 25 |
26 |
27 | <%= render(Arara::TypographyComponent, tag: "h3", variant: "sub1", content: "Shaped Button") %> 28 | <%= render(Arara::ButtonComponent, content: "Default", variant: "unelevated", class: "demo-button-shaped") %> 29 | <%= render(Arara::ButtonComponent, content: "Dense", variant: "unelevated", dense: true, class: "demo-button-shaped") %> 30 | <%= render(Arara::ButtonComponent, content: "Icon", variant: "unelevated", icon: "favorite", class: "demo-button-shaped") %> 31 |
32 |
33 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/checkbox.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | <%= render(Arara::CheckboxComponent, id: "checkbox-1", name: "checkbox[1]") %> 4 | 5 |
6 | 7 |
8 | <%= render(Arara::CheckboxComponent, id: "checkbox-2", name: "checkbox[1]", indeterminate: true) %> 9 | 10 |
11 | 12 |
13 | <%= render(Arara::CheckboxComponent, id: "checkbox-3", name: "checkbox[1]", checked: true) %> 14 | 15 |
16 |
17 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/elevation.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <% 0.upto(24) do |n| %> 3 |
4 | <%= render(Arara::ElevationComponent, depth: n) do %> 5 |
<%= n %>dp
6 | <% end %> 7 |
8 | <% end %> 9 |
10 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/fab.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= render(Arara::TypographyComponent, tag: "h3", variant: "sub1", content: "Standard Floating Action Button") %> 3 | <%= render(Arara::FabComponent, label: "Favorite") do %> 4 | <%= render(Arara::MaterialIconComponent, icon: 'favorite_border', class: "mdc-fab__icon") %> 5 | <% end %> 6 | <%= render(Arara::TypographyComponent, tag: "h3", variant: "sub1", content: "Mini Floating Action Button") %> 7 | <%= render(Arara::FabComponent, variant: "mini", label: "Favorite") do %> 8 | <%= render(Arara::MaterialIconComponent, icon: 'favorite_border', class: "mdc-fab__icon") %> 9 | <% end %> 10 | <%= render(Arara::TypographyComponent, tag: "h3", variant: "sub1", content: "Extended FAB") %> 11 | <%= render(Arara::FabComponent, variant: "extended", label: "Create", extended_label: "Create") do %> 12 | <%= render(Arara::MaterialIconComponent, icon: 'add', class: "mdc-fab__icon") %> 13 | <% end %> 14 | <%= render(Arara::TypographyComponent, tag: "h3", variant: "sub1", content: "Extended FAB (Text label followed by icon)") %> 15 | <%= render(Arara::FabComponent, variant: "extended", label: "Create", extended_label: "Create", label_before: true) do %> 16 | <%= render(Arara::MaterialIconComponent, icon: 'add', class: "mdc-fab__icon") %> 17 | <% end %> 18 | <%= render(Arara::TypographyComponent, tag: "h3", variant: "sub1", content: "Extended FAB (without Icon)") %> 19 | <%= render(Arara::FabComponent, variant: "extended_no_icon", label: "Create", extended_label: "Create", no_icon: true) %> 20 | <%= render(Arara::TypographyComponent, tag: "h3", variant: "sub1", content: "FAB (Shaped)") %> 21 |
22 | <%= render(Arara::FabComponent, label: "Favorite", class: "demo-fab-shaped--one") do %> 23 | <%= render(Arara::MaterialIconComponent, icon: 'favorite_border', class: "mdc-fab__icon") %> 24 | <% end %> 25 | <%= render(Arara::FabComponent, variant: "mini", label: "Favorite", class: "demo-fab-shaped--two") do %> 26 | <%= render(Arara::MaterialIconComponent, icon: 'favorite_border', class: "mdc-fab__icon") %> 27 | <% end %> 28 | <%= render(Arara::FabComponent, variant: "extended", label: "Create", extended_label: "Create", class: "demo-fab-shaped--three") do %> 29 | <%= render(Arara::MaterialIconComponent, icon: 'add', class: "mdc-fab__icon") %> 30 | <% end %> 31 |
32 |
33 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/icon_button.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= render(Arara::TypographyComponent, tag: 'h3', variant: "sub1", content: "Icon Button") %> 3 |
4 | <%= render(Arara::IconButtonComponent) do %> 5 | <%= render(Arara::MaterialIconComponent, icon: 'wifi') %> 6 | <% end %> 7 |
8 | <%= render(Arara::TypographyComponent, tag: 'h3', variant: "sub1", content: "Icon Toggle Button") %> 9 |
10 | <%= render(Arara::IconButtonComponent, data: { controller: 'mdc-icon-toggle' }) do %> 11 | <%= render(Arara::IconToggleComponent, title: 'favorite', on: true) %> 12 | <%= render(Arara::IconToggleComponent, title: 'favorite_border') %> 13 | <% end %> 14 |
15 |
16 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/layout_grid.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Columns

3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |

Grid Left Alignment

15 |

This requires a max-width on the top-level grid element.

16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |

Right Alignment

24 |

This requires a max-width on the top-level grid element.

25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |

Cell Alignment

33 |

Cell alignment requires a cell height smaller than the inner height of the grid.

34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/linear_progress_indicator.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Buffered

4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |

Indeterminate

13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |

Reversed

22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |

Reversed Buffered

31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/menu.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Anchored Menu

3 |
4 | <%= render(Arara::ButtonComponent, content: "Open Menu", data: { target: 'mdc-menu.button', action: "click->mdc-menu#openMenu" }) %> 5 |
6 | <%= render(Arara::MenuComponent, data: { target: 'mdc-menu.menu'}) do %> 7 | <%= render(Arara::MenuItemComponent, content: "Passionfruit") %> 8 | <%= render(Arara::MenuItemComponent, content: "Orange") %> 9 | <%= render(Arara::MenuItemComponent, content: "Guava") %> 10 | <%= render(Arara::MenuItemComponent, content: "Pitaya") %> 11 | <%= render(Arara::MenuDividerComponent) %> 12 | <%= render(Arara::MenuItemComponent, content: "Pineapple") %> 13 | <%= render(Arara::MenuItemComponent, content: "Mango") %> 14 | <%= render(Arara::MenuItemComponent, content: "Papaya") %> 15 | <%= render(Arara::MenuItemComponent, content: "Lychee") %> 16 | <% end %> 17 |
18 |
19 |
-------------------------------------------------------------------------------- /test/dummy/app/views/pages/not_found.html.erb: -------------------------------------------------------------------------------- 1 | Not Found :~ -------------------------------------------------------------------------------- /test/dummy/app/views/pages/radio_button.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= render(Arara::TypographyComponent, tag: "h3", variant: "sub1", content: "Radio Buttons") %> 3 | <%= render(Arara::FormFieldComponent, class: "demo-radio-form-field") do %> 4 | <%= render(Arara::RadioButtonComponent, id: "0.3167030987981374", name: "demo-radio-set", value: "1", checked: true) %> 5 | 6 | <% end %> 7 | <%= render(Arara::FormFieldComponent, class: "demo-radio-form-field") do %> 8 | <%= render(Arara::RadioButtonComponent, id: "0.2030608467092465", name: "demo-radio-set", value: "2") %> 9 | 10 | <% end %> 11 |
12 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/ripple.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

Bounded Ripple

6 |
Interact with me!
7 |
8 |
9 |
10 |
11 |
12 |
13 |

Unbounded Ripple

14 |
favorite
15 |
16 |
17 |
18 |
19 |
20 |
21 |

Theme Colors: Primary

22 |
Primary
23 |
24 |
25 |
26 |
27 |
28 |
29 |

Theme Colors: Secondary

30 |
Secondary
31 |
32 |
33 |
34 |
35 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/slider.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Continuous

4 |
5 |
6 |
7 |
8 |
9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 |
17 |

Discrete

18 |
19 |
20 |
21 |
22 |
23 |
24 | 25 | 26 | 27 |
28 |
29 |
30 |
31 |
32 |

Discrete with Tick Marks

33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | 41 | 42 | 43 |
44 |
45 |
46 |
47 |
48 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/snackbar.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | <%= render(Arara::ButtonComponent, variant: "raised", content: "Baseline", data: { target: 'mdc-snackbar.button', action: "click->mdc-snackbar#openSnackbar"}, class: "snackbar-demo-button") %> 4 |
5 |
6 |
Can't send photo. Retry in 5 seconds.
7 |
8 | 12 | 13 |
14 |
15 |
16 |
17 | 18 |
19 | <%= render(Arara::ButtonComponent, variant: "raised", content: "Leading", data: { target: 'mdc-snackbar.button', action: "click->mdc-snackbar#openSnackbar"}, class: "snackbar-demo-button") %> 20 |
21 |
22 |
Your photo has been archived.
23 |
24 | 28 | 29 |
30 |
31 |
32 |
33 | 34 |
35 | <%= render(Arara::ButtonComponent, variant: "raised", content: "Stacked", data: { target: 'mdc-snackbar.button', action: "click->mdc-snackbar#openSnackbar"}, class: "snackbar-demo-button") %> 36 |
37 |
38 |
This item already has the label "travel". You can add a new label.
39 |
40 | 44 | 45 |
46 |
47 |
48 |
49 |
50 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/switch.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Switch

3 |
4 | 5 | <%= render(Arara::SwitchComponent, id: "Switch-switch") %> 6 | 7 |
8 |
9 | <%= render(Arara::SwitchComponent, id: "Switch-switch2", checked: true) %> 10 | 11 |
12 |
13 |
14 |
15 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/top_app_bar.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |

Standard

6 |
7 |
8 |
9 |
10 |
11 |
12 | 13 |

Fixed

14 |
15 |
16 |
17 |
18 |
19 |
20 | 21 |

Dense

22 |
23 |
24 |
25 |
26 |
27 |
28 | 29 |

Prominent

30 |
31 |
32 |
33 |
34 |
35 |
36 | 37 |

Short

38 |
39 |
40 |
41 |
42 |
43 |
44 | 45 |

Short - Always Collapsed

46 |
47 |
48 |
49 |
50 |
51 | -------------------------------------------------------------------------------- /test/dummy/app/views/pages/typography.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= render(Arara::TypographyComponent, variant: "h1", content: "Headline 1") %> 3 | <%= render(Arara::TypographyComponent, variant: "h2", content: "Headline 2") %> 4 | <%= render(Arara::TypographyComponent, variant: "h3", content: "Headline 3") %> 5 | <%= render(Arara::TypographyComponent, variant: "h4", content: "Headline 4") %> 6 | <%= render(Arara::TypographyComponent, variant: "h5", content: "Headline 5") %> 7 | <%= render(Arara::TypographyComponent, variant: "h6", content: "Headline 6") %> 8 | <%= render(Arara::TypographyComponent, variant: "sub1", content: "Subtitle 1") %> 9 | <%= render(Arara::TypographyComponent, variant: "sub2", content: "Subtitle 2") %> 10 | <%= render(Arara::TypographyComponent, variant: "body1", content: "Body 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos blanditiis tenetur unde suscipit, quam beatae rerum inventore consectetur, neque doloribus, cupiditate numquam dignissimos laborum fugiat deleniti? Eum quasi quidem quibusdam.") %> 11 | <%= render(Arara::TypographyComponent, variant: "body2", content: "Body 2. Lorem ipsum dolor sit amet consectetur adipisicing elit. Cupiditate aliquid ad quas sunt voluptatum officia dolorum cumque, possimus nihil molestias sapiente necessitatibus dolor saepe inventore, soluta id accusantium voluptas beatae.") %> 12 | <%= render(Arara::TypographyComponent, variant: "button", content: "Button text") %> 13 | <%= render(Arara::TypographyComponent, variant: "caption", content: "Caption text") %> 14 | <%= render(Arara::TypographyComponent, variant: "overline", content: "Overline text") %> 15 |
16 | -------------------------------------------------------------------------------- /test/dummy/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function(api) { 2 | var validEnv = ['development', 'test', 'production'] 3 | var currentEnv = api.env() 4 | var isDevelopmentEnv = api.env('development') 5 | var isProductionEnv = api.env('production') 6 | var isTestEnv = api.env('test') 7 | 8 | if (!validEnv.includes(currentEnv)) { 9 | throw new Error( 10 | 'Please specify a valid `NODE_ENV` or ' + 11 | '`BABEL_ENV` environment variables. Valid values are "development", ' + 12 | '"test", and "production". Instead, received: ' + 13 | JSON.stringify(currentEnv) + 14 | '.' 15 | ) 16 | } 17 | 18 | return { 19 | presets: [ 20 | isTestEnv && [ 21 | '@babel/preset-env', 22 | { 23 | targets: { 24 | node: 'current' 25 | } 26 | } 27 | ], 28 | (isProductionEnv || isDevelopmentEnv) && [ 29 | '@babel/preset-env', 30 | { 31 | forceAllTransforms: true, 32 | useBuiltIns: 'entry', 33 | corejs: 3, 34 | modules: false, 35 | exclude: ['transform-typeof-symbol'] 36 | } 37 | ] 38 | ].filter(Boolean), 39 | plugins: [ 40 | 'babel-plugin-macros', 41 | '@babel/plugin-syntax-dynamic-import', 42 | isTestEnv && 'babel-plugin-dynamic-import-node', 43 | '@babel/plugin-transform-destructuring', 44 | [ 45 | '@babel/plugin-proposal-class-properties', 46 | { 47 | loose: true 48 | } 49 | ], 50 | [ 51 | '@babel/plugin-proposal-object-rest-spread', 52 | { 53 | useBuiltIns: true 54 | } 55 | ], 56 | [ 57 | '@babel/plugin-transform-runtime', 58 | { 59 | helpers: false, 60 | regenerator: true, 61 | corejs: false 62 | } 63 | ], 64 | [ 65 | '@babel/plugin-transform-regenerator', 66 | { 67 | async: false 68 | } 69 | ] 70 | ].filter(Boolean) 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /test/dummy/bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../config/application', __dir__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /test/dummy/bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /test/dummy/bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'fileutils' 3 | 4 | # path to your application root. 5 | APP_ROOT = File.expand_path('..', __dir__) 6 | 7 | def system!(*args) 8 | system(*args) || abort("\n== Command #{args} failed ==") 9 | end 10 | 11 | FileUtils.chdir APP_ROOT do 12 | # This script is a way to setup or update your development environment automatically. 13 | # This script is idempotent, so that you can run it at anytime and get an expectable outcome. 14 | # Add necessary setup steps to this file. 15 | 16 | puts '== Installing dependencies ==' 17 | system! 'gem install bundler --conservative' 18 | system('bundle check') || system!('bundle install') 19 | 20 | # puts "\n== Copying sample files ==" 21 | # unless File.exist?('config/database.yml') 22 | # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' 23 | # end 24 | 25 | puts "\n== Preparing database ==" 26 | system! 'bin/rails db:prepare' 27 | 28 | puts "\n== Removing old logs and tempfiles ==" 29 | system! 'bin/rails log:clear tmp:clear' 30 | 31 | puts "\n== Restarting application server ==" 32 | system! 'bin/rails restart' 33 | end 34 | -------------------------------------------------------------------------------- /test/dummy/bin/webpack: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "bundler/setup" 11 | 12 | require "webpacker" 13 | require "webpacker/webpack_runner" 14 | 15 | APP_ROOT = File.expand_path("..", __dir__) 16 | Dir.chdir(APP_ROOT) do 17 | Webpacker::WebpackRunner.run(ARGV) 18 | end 19 | -------------------------------------------------------------------------------- /test/dummy/bin/webpack-dev-server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "bundler/setup" 11 | 12 | require "webpacker" 13 | require "webpacker/dev_server_runner" 14 | 15 | APP_ROOT = File.expand_path("..", __dir__) 16 | Dir.chdir(APP_ROOT) do 17 | Webpacker::DevServerRunner.run(ARGV) 18 | end 19 | -------------------------------------------------------------------------------- /test/dummy/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /test/dummy/config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require 'rails/all' 4 | 5 | Bundler.require(*Rails.groups) 6 | require "arara" 7 | 8 | module Dummy 9 | class Application < Rails::Application 10 | # Initialize configuration defaults for originally generated Rails version. 11 | config.load_defaults 6.0 12 | 13 | # Settings in config/environments/* take precedence over those specified here. 14 | # Application configuration can go into files in config/initializers 15 | # -- all .rb files in that directory are automatically loaded after loading 16 | # the framework and any gems in your application. 17 | end 18 | end 19 | 20 | -------------------------------------------------------------------------------- /test/dummy/config/boot.rb: -------------------------------------------------------------------------------- 1 | # Set up gems listed in the Gemfile. 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__) 3 | 4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) 5 | $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__) 6 | -------------------------------------------------------------------------------- /test/dummy/config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: test 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: dummy_production 11 | -------------------------------------------------------------------------------- /test/dummy/config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite. Versions 3.8.0 and up are supported. 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | # 7 | default: &default 8 | adapter: sqlite3 9 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 10 | timeout: 5000 11 | 12 | development: 13 | <<: *default 14 | database: db/development.sqlite3 15 | 16 | # Warning: The database defined as "test" will be erased and 17 | # re-generated from your development database when you run "rake". 18 | # Do not set this db to the same as development or production. 19 | test: 20 | <<: *default 21 | database: db/test.sqlite3 22 | 23 | production: 24 | <<: *default 25 | database: db/production.sqlite3 26 | -------------------------------------------------------------------------------- /test/dummy/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /test/dummy/config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports. 13 | config.consider_all_requests_local = true 14 | 15 | # Enable/disable caching. By default caching is disabled. 16 | # Run rails dev:cache to toggle caching. 17 | if Rails.root.join('tmp', 'caching-dev.txt').exist? 18 | config.action_controller.perform_caching = true 19 | config.action_controller.enable_fragment_cache_logging = true 20 | 21 | config.cache_store = :memory_store 22 | config.public_file_server.headers = { 23 | 'Cache-Control' => "public, max-age=#{2.days.to_i}" 24 | } 25 | else 26 | config.action_controller.perform_caching = false 27 | 28 | config.cache_store = :null_store 29 | end 30 | 31 | # Store uploaded files on the local file system (see config/storage.yml for options). 32 | config.active_storage.service = :local 33 | 34 | # Don't care if the mailer can't send. 35 | config.action_mailer.raise_delivery_errors = false 36 | 37 | config.action_mailer.perform_caching = false 38 | 39 | # Print deprecation notices to the Rails logger. 40 | config.active_support.deprecation = :log 41 | 42 | # Raise an error on page load if there are pending migrations. 43 | config.active_record.migration_error = :page_load 44 | 45 | # Highlight code that triggered database queries in logs. 46 | config.active_record.verbose_query_logs = true 47 | 48 | # Debug mode disables concatenation and preprocessing of assets. 49 | # This option may cause significant delays in view rendering with a large 50 | # number of complex assets. 51 | config.assets.debug = true 52 | 53 | # Suppress logger output for asset requests. 54 | config.assets.quiet = true 55 | 56 | # Raises error for missing translations. 57 | # config.action_view.raise_on_missing_translations = true 58 | 59 | # Use an evented file watcher to asynchronously detect changes in source code, 60 | # routes, locales, etc. This feature depends on the listen gem. 61 | # config.file_watcher = ActiveSupport::EventedFileUpdateChecker 62 | end 63 | -------------------------------------------------------------------------------- /test/dummy/config/environments/test.rb: -------------------------------------------------------------------------------- 1 | # The test environment is used exclusively to run your application's 2 | # test suite. You never need to work with it otherwise. Remember that 3 | # your test database is "scratch space" for the test suite and is wiped 4 | # and recreated between test runs. Don't rely on the data there! 5 | 6 | Rails.application.configure do 7 | # Settings specified here will take precedence over those in config/application.rb. 8 | 9 | config.cache_classes = false 10 | 11 | # Do not eager load code on boot. This avoids loading your whole application 12 | # just for the purpose of running a single test. If you are using a tool that 13 | # preloads Rails for running tests, you may have to set it to true. 14 | config.eager_load = false 15 | 16 | # Configure public file server for tests with Cache-Control for performance. 17 | config.public_file_server.enabled = true 18 | config.public_file_server.headers = { 19 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}" 20 | } 21 | 22 | # Show full error reports and disable caching. 23 | config.consider_all_requests_local = true 24 | config.action_controller.perform_caching = false 25 | config.cache_store = :null_store 26 | 27 | # Raise exceptions instead of rendering exception templates. 28 | config.action_dispatch.show_exceptions = false 29 | 30 | # Disable request forgery protection in test environment. 31 | config.action_controller.allow_forgery_protection = false 32 | 33 | # Store uploaded files on the local file system in a temporary directory. 34 | config.active_storage.service = :test 35 | 36 | config.action_mailer.perform_caching = false 37 | 38 | # Tell Action Mailer not to deliver emails to the real world. 39 | # The :test delivery method accumulates sent emails in the 40 | # ActionMailer::Base.deliveries array. 41 | config.action_mailer.delivery_method = :test 42 | 43 | # Print deprecation notices to the stderr. 44 | config.active_support.deprecation = :stderr 45 | 46 | # Raises error for missing translations. 47 | # config.action_view.raise_on_missing_translations = true 48 | end 49 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ActiveSupport::Reloader.to_prepare do 4 | # ApplicationController.renderer.defaults.merge!( 5 | # http_host: 'example.org', 6 | # https: false 7 | # ) 8 | # end 9 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path. 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in the app/assets 11 | # folder are already added. 12 | # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 13 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Define an application-wide content security policy 4 | # For further information see the following documentation 5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy 6 | 7 | # Rails.application.config.content_security_policy do |policy| 8 | # policy.default_src :self, :https 9 | # policy.font_src :self, :https, :data 10 | # policy.img_src :self, :https, :data 11 | # policy.object_src :none 12 | # policy.script_src :self, :https 13 | # policy.style_src :self, :https 14 | 15 | # # Specify URI for violation reports 16 | # # policy.report_uri "/csp-violation-report-endpoint" 17 | # end 18 | 19 | # If you are using UJS then enable automatic nonce generation 20 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } 21 | 22 | # Set the nonce only to specific directives 23 | # Rails.application.config.content_security_policy_nonce_directives = %w(script-src) 24 | 25 | # Report CSP violations to a specified URI 26 | # For further information see the following documentation: 27 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only 28 | # Rails.application.config.content_security_policy_report_only = true 29 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /test/dummy/config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # The following keys must be escaped otherwise they will not be retrieved by 20 | # the default I18n backend: 21 | # 22 | # true, false, on, off, yes, no 23 | # 24 | # Instead, surround them with single quotes. 25 | # 26 | # en: 27 | # 'true': 'foo' 28 | # 29 | # To learn more, please read the Rails Internationalization guide 30 | # available at https://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /test/dummy/config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers: a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum; this matches the default thread size of Active Record. 6 | # 7 | max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } 8 | min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } 9 | threads min_threads_count, max_threads_count 10 | 11 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 12 | # 13 | port ENV.fetch("PORT") { 3000 } 14 | 15 | # Specifies the `environment` that Puma will run in. 16 | # 17 | environment ENV.fetch("RAILS_ENV") { "development" } 18 | 19 | # Specifies the `pidfile` that Puma will use. 20 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } 21 | 22 | # Specifies the number of `workers` to boot in clustered mode. 23 | # Workers are forked web server processes. If using threads and workers together 24 | # the concurrency of the application would be max `threads` * `workers`. 25 | # Workers do not work on JRuby or Windows (both of which do not support 26 | # processes). 27 | # 28 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 29 | 30 | # Use the `preload_app!` method when specifying a `workers` number. 31 | # This directive tells Puma to first boot the application and load code 32 | # before forking the application. This takes advantage of Copy On Write 33 | # process behavior so workers use less memory. 34 | # 35 | # preload_app! 36 | 37 | # Allow puma to be restarted by `rails restart` command. 38 | plugin :tmp_restart 39 | -------------------------------------------------------------------------------- /test/dummy/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | mount Arara::Engine => "/arara" 3 | 4 | resources :posts 5 | get ':id', to: 'pages#show', as: :pages 6 | 7 | # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html 8 | root to: "home#show" 9 | end 10 | -------------------------------------------------------------------------------- /test/dummy/config/spring.rb: -------------------------------------------------------------------------------- 1 | Spring.watch( 2 | ".ruby-version", 3 | ".rbenv-vars", 4 | "tmp/restart.txt", 5 | "tmp/caching-dev.txt" 6 | ) 7 | -------------------------------------------------------------------------------- /test/dummy/config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | 9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 10 | # amazon: 11 | # service: S3 12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 14 | # region: us-east-1 15 | # bucket: your_own_bucket 16 | 17 | # Remember not to checkin your GCS keyfile to a repository 18 | # google: 19 | # service: GCS 20 | # project: your_project 21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 22 | # bucket: your_own_bucket 23 | 24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 25 | # microsoft: 26 | # service: AzureStorage 27 | # storage_account_name: your_account_name 28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 29 | # container: your_container_name 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | -------------------------------------------------------------------------------- /test/dummy/config/webpack/development.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /test/dummy/config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | 3 | environment.loaders.get('sass').use.find(item => item.loader === 'sass-loader').options.sassOptions.includePaths = ['node_modules'] 4 | 5 | module.exports = environment 6 | -------------------------------------------------------------------------------- /test/dummy/config/webpack/production.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /test/dummy/config/webpack/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /test/dummy/config/webpacker.yml: -------------------------------------------------------------------------------- 1 | # Note: You must restart bin/webpack-dev-server for changes to take effect 2 | 3 | default: &default 4 | source_path: app/javascript 5 | source_entry_path: packs 6 | public_root_path: public 7 | public_output_path: packs 8 | cache_path: tmp/cache/webpacker 9 | check_yarn_integrity: false 10 | webpack_compile_output: true 11 | 12 | # Additional paths webpack should lookup modules 13 | # ['app/assets', 'engine/foo/app/assets'] 14 | resolved_paths: ['../../app/javascript'] 15 | 16 | # Reload manifest.json on all requests so we reload latest compiled packs 17 | cache_manifest: false 18 | 19 | # Extract and emit a css file 20 | extract_css: false 21 | 22 | static_assets_extensions: 23 | - .jpg 24 | - .jpeg 25 | - .png 26 | - .gif 27 | - .tiff 28 | - .ico 29 | - .svg 30 | - .eot 31 | - .otf 32 | - .ttf 33 | - .woff 34 | - .woff2 35 | 36 | extensions: 37 | - .mjs 38 | - .js 39 | - .sass 40 | - .scss 41 | - .css 42 | - .module.sass 43 | - .module.scss 44 | - .module.css 45 | - .png 46 | - .svg 47 | - .gif 48 | - .jpeg 49 | - .jpg 50 | 51 | development: 52 | <<: *default 53 | compile: true 54 | 55 | # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules 56 | check_yarn_integrity: true 57 | 58 | # Reference: https://webpack.js.org/configuration/dev-server/ 59 | dev_server: 60 | https: false 61 | host: localhost 62 | port: 3035 63 | public: localhost:3035 64 | hmr: false 65 | # Inline should be set to true if using HMR 66 | inline: true 67 | overlay: true 68 | compress: true 69 | disable_host_check: true 70 | use_local_ip: false 71 | quiet: false 72 | pretty: false 73 | headers: 74 | 'Access-Control-Allow-Origin': '*' 75 | watch_options: 76 | ignored: '**/node_modules/**' 77 | 78 | 79 | test: 80 | <<: *default 81 | compile: true 82 | 83 | # Compile test packs to a separate directory 84 | public_output_path: packs-test 85 | 86 | production: 87 | <<: *default 88 | 89 | # Production depends on precompilation of packs prior to booting for performance. 90 | compile: false 91 | 92 | # Extract and emit a css file 93 | extract_css: true 94 | 95 | # Cache manifest.json for performance 96 | cache_manifest: true 97 | -------------------------------------------------------------------------------- /test/dummy/lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/lib/assets/.keep -------------------------------------------------------------------------------- /test/dummy/log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/log/.keep -------------------------------------------------------------------------------- /test/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "private": true, 4 | "dependencies": { 5 | "@material/button": "^4.0.0", 6 | "@material/card": "^4.0.0", 7 | "@material/checkbox": "^4.0.0", 8 | "@material/chips": "^4.0.0", 9 | "@material/data-table": "^4.0.0", 10 | "@material/density": "^4.0.0", 11 | "@material/dialog": "^4.0.0", 12 | "@material/elevation": "^4.0.0", 13 | "@material/fab": "^4.0.0", 14 | "@material/form-field": "^4.0.0", 15 | "@material/icon-button": "^4.0.0", 16 | "@material/image-list": "^4.0.0", 17 | "@material/layout-grid": "^4.0.0", 18 | "@material/linear-progress": "^4.0.0", 19 | "@material/menu": "^4.0.0", 20 | "@material/radio": "^4.0.0", 21 | "@material/select": "^4.0.0", 22 | "@material/slider": "^4.0.0", 23 | "@material/snackbar": "^4.0.0", 24 | "@material/switch": "^4.0.0", 25 | "@material/tab-bar": "^4.0.0", 26 | "@material/textfield": "^4.0.0", 27 | "@material/top-app-bar": "^4.0.0", 28 | "@material/typography": "^4.0.0", 29 | "@rails/ujs": "^6.0.0", 30 | "@rails/webpacker": "5.1.1", 31 | "stimulus": "^1.1.1", 32 | "tailwindcss": "^1.1.4", 33 | "turbolinks": "^5.2.0" 34 | }, 35 | "devDependencies": { 36 | "webpack-dev-server": "^3.10.3" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /test/dummy/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('postcss-import'), 4 | require('postcss-flexbugs-fixes'), 5 | require('postcss-preset-env')({ 6 | autoprefixer: { 7 | flexbox: 'no-2009' 8 | }, 9 | stage: 3 10 | }), 11 | require('tailwindcss') 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /test/dummy/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /test/dummy/public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /test/dummy/public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /test/dummy/public/android-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/android-icon-144x144.png -------------------------------------------------------------------------------- /test/dummy/public/android-icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/android-icon-192x192.png -------------------------------------------------------------------------------- /test/dummy/public/android-icon-36x36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/android-icon-36x36.png -------------------------------------------------------------------------------- /test/dummy/public/android-icon-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/android-icon-48x48.png -------------------------------------------------------------------------------- /test/dummy/public/android-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/android-icon-72x72.png -------------------------------------------------------------------------------- /test/dummy/public/android-icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/android-icon-96x96.png -------------------------------------------------------------------------------- /test/dummy/public/apple-icon-114x114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/apple-icon-114x114.png -------------------------------------------------------------------------------- /test/dummy/public/apple-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/apple-icon-120x120.png -------------------------------------------------------------------------------- /test/dummy/public/apple-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/apple-icon-144x144.png -------------------------------------------------------------------------------- /test/dummy/public/apple-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/apple-icon-152x152.png -------------------------------------------------------------------------------- /test/dummy/public/apple-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/apple-icon-180x180.png -------------------------------------------------------------------------------- /test/dummy/public/apple-icon-57x57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/apple-icon-57x57.png -------------------------------------------------------------------------------- /test/dummy/public/apple-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/apple-icon-60x60.png -------------------------------------------------------------------------------- /test/dummy/public/apple-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/apple-icon-72x72.png -------------------------------------------------------------------------------- /test/dummy/public/apple-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/apple-icon-76x76.png -------------------------------------------------------------------------------- /test/dummy/public/apple-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/apple-icon-precomposed.png -------------------------------------------------------------------------------- /test/dummy/public/apple-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/apple-icon.png -------------------------------------------------------------------------------- /test/dummy/public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /test/dummy/public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/apple-touch-icon.png -------------------------------------------------------------------------------- /test/dummy/public/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | #ffffff -------------------------------------------------------------------------------- /test/dummy/public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/favicon-16x16.png -------------------------------------------------------------------------------- /test/dummy/public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/favicon-32x32.png -------------------------------------------------------------------------------- /test/dummy/public/favicon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/favicon-96x96.png -------------------------------------------------------------------------------- /test/dummy/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/favicon.ico -------------------------------------------------------------------------------- /test/dummy/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "App", 3 | "icons": [ 4 | { 5 | "src": "\/android-icon-36x36.png", 6 | "sizes": "36x36", 7 | "type": "image\/png", 8 | "density": "0.75" 9 | }, 10 | { 11 | "src": "\/android-icon-48x48.png", 12 | "sizes": "48x48", 13 | "type": "image\/png", 14 | "density": "1.0" 15 | }, 16 | { 17 | "src": "\/android-icon-72x72.png", 18 | "sizes": "72x72", 19 | "type": "image\/png", 20 | "density": "1.5" 21 | }, 22 | { 23 | "src": "\/android-icon-96x96.png", 24 | "sizes": "96x96", 25 | "type": "image\/png", 26 | "density": "2.0" 27 | }, 28 | { 29 | "src": "\/android-icon-144x144.png", 30 | "sizes": "144x144", 31 | "type": "image\/png", 32 | "density": "3.0" 33 | }, 34 | { 35 | "src": "\/android-icon-192x192.png", 36 | "sizes": "192x192", 37 | "type": "image\/png", 38 | "density": "4.0" 39 | } 40 | ] 41 | } -------------------------------------------------------------------------------- /test/dummy/public/ms-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/ms-icon-144x144.png -------------------------------------------------------------------------------- /test/dummy/public/ms-icon-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/ms-icon-150x150.png -------------------------------------------------------------------------------- /test/dummy/public/ms-icon-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/ms-icon-310x310.png -------------------------------------------------------------------------------- /test/dummy/public/ms-icon-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fernandes/arara/6a69aded264627346203b522d1a6b4f9aa5729aa/test/dummy/public/ms-icon-70x70.png -------------------------------------------------------------------------------- /test/integration/navigation_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class NavigationTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/javascript/src/helpers.js: -------------------------------------------------------------------------------- 1 | function defer(callback) { 2 | setTimeout(callback, 1) 3 | } 4 | 5 | export { defer } 6 | -------------------------------------------------------------------------------- /test/javascript/src/index.js: -------------------------------------------------------------------------------- 1 | import "./controllers/counter_controller_test.js" 2 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | # Configure Rails Environment 2 | ENV["RAILS_ENV"] = "test" 3 | 4 | require_relative "../test/dummy/config/environment" 5 | ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)] 6 | ActiveRecord::Migrator.migrations_paths << File.expand_path('../db/migrate', __dir__) 7 | require "rails/test_help" 8 | 9 | # Filter out the backtrace from minitest while preserving the one from other libraries. 10 | Minitest.backtrace_filter = Minitest::BacktraceFilter.new 11 | 12 | 13 | # Load fixtures from the engine 14 | if ActiveSupport::TestCase.respond_to?(:fixture_path=) 15 | ActiveSupport::TestCase.fixture_path = File.expand_path("fixtures", __dir__) 16 | ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path 17 | ActiveSupport::TestCase.file_fixture_path = ActiveSupport::TestCase.fixture_path + "/files" 18 | ActiveSupport::TestCase.fixtures :all 19 | end 20 | --------------------------------------------------------------------------------