uikit_rails 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +301 -0
- data/Rakefile +12 -0
- data/app/controllers/uikit_rails/styleguide_controller.rb +72 -0
- data/app/views/layouts/uikit_rails/application.html.erb +412 -0
- data/app/views/uikit_rails/styleguide/index.html.erb +27 -0
- data/app/views/uikit_rails/styleguide/show.html.erb +56 -0
- data/config/routes.rb +6 -0
- data/lib/uikit_rails/engine.rb +13 -0
- data/lib/uikit_rails/generators/add_generator.rb +110 -0
- data/lib/uikit_rails/generators/install_generator.rb +62 -0
- data/lib/uikit_rails/generators/templates/base_component.rb.tt +32 -0
- data/lib/uikit_rails/generators/templates/uikit_rails.css.tt +69 -0
- data/lib/uikit_rails/templates/components/accordion/USAGE +30 -0
- data/lib/uikit_rails/templates/components/accordion/accordion.css +74 -0
- data/lib/uikit_rails/templates/components/accordion/component.html.erb +13 -0
- data/lib/uikit_rails/templates/components/accordion/component.rb +35 -0
- data/lib/uikit_rails/templates/components/accordion/preview.yml +81 -0
- data/lib/uikit_rails/templates/components/alert/USAGE +25 -0
- data/lib/uikit_rails/templates/components/alert/alert.css +60 -0
- data/lib/uikit_rails/templates/components/alert/component.html.erb +9 -0
- data/lib/uikit_rails/templates/components/alert/component.rb +27 -0
- data/lib/uikit_rails/templates/components/alert/preview.yml +53 -0
- data/lib/uikit_rails/templates/components/alert_dialog/USAGE +38 -0
- data/lib/uikit_rails/templates/components/alert_dialog/alert_dialog.css +108 -0
- data/lib/uikit_rails/templates/components/alert_dialog/component.html.erb +27 -0
- data/lib/uikit_rails/templates/components/alert_dialog/component.rb +23 -0
- data/lib/uikit_rails/templates/components/alert_dialog/preview.yml +94 -0
- data/lib/uikit_rails/templates/components/avatar/USAGE +20 -0
- data/lib/uikit_rails/templates/components/avatar/avatar.css +53 -0
- data/lib/uikit_rails/templates/components/avatar/component.html.erb +7 -0
- data/lib/uikit_rails/templates/components/avatar/component.rb +31 -0
- data/lib/uikit_rails/templates/components/avatar/preview.yml +42 -0
- data/lib/uikit_rails/templates/components/badge/USAGE +13 -0
- data/lib/uikit_rails/templates/components/badge/badge.css +61 -0
- data/lib/uikit_rails/templates/components/badge/component.rb +28 -0
- data/lib/uikit_rails/templates/components/badge/preview.yml +38 -0
- data/lib/uikit_rails/templates/components/breadcrumb/USAGE +23 -0
- data/lib/uikit_rails/templates/components/breadcrumb/breadcrumb.css +55 -0
- data/lib/uikit_rails/templates/components/breadcrumb/component.html.erb +14 -0
- data/lib/uikit_rails/templates/components/breadcrumb/component.rb +40 -0
- data/lib/uikit_rails/templates/components/breadcrumb/preview.yml +42 -0
- data/lib/uikit_rails/templates/components/button/USAGE +21 -0
- data/lib/uikit_rails/templates/components/button/button.css +125 -0
- data/lib/uikit_rails/templates/components/button/component.rb +44 -0
- data/lib/uikit_rails/templates/components/button/preview.yml +106 -0
- data/lib/uikit_rails/templates/components/card/USAGE +33 -0
- data/lib/uikit_rails/templates/components/card/card.css +63 -0
- data/lib/uikit_rails/templates/components/card/component.html.erb +16 -0
- data/lib/uikit_rails/templates/components/card/component.rb +26 -0
- data/lib/uikit_rails/templates/components/card/preview.yml +57 -0
- data/lib/uikit_rails/templates/components/checkbox/USAGE +19 -0
- data/lib/uikit_rails/templates/components/checkbox/checkbox.css +67 -0
- data/lib/uikit_rails/templates/components/checkbox/component.html.erb +6 -0
- data/lib/uikit_rails/templates/components/checkbox/component.rb +26 -0
- data/lib/uikit_rails/templates/components/checkbox/preview.yml +43 -0
- data/lib/uikit_rails/templates/components/collapsible/USAGE +31 -0
- data/lib/uikit_rails/templates/components/collapsible/collapsible.css +55 -0
- data/lib/uikit_rails/templates/components/collapsible/component.html.erb +8 -0
- data/lib/uikit_rails/templates/components/collapsible/component.rb +18 -0
- data/lib/uikit_rails/templates/components/collapsible/preview.yml +65 -0
- data/lib/uikit_rails/templates/components/dialog/USAGE +41 -0
- data/lib/uikit_rails/templates/components/dialog/component.html.erb +23 -0
- data/lib/uikit_rails/templates/components/dialog/component.rb +20 -0
- data/lib/uikit_rails/templates/components/dialog/dialog.css +133 -0
- data/lib/uikit_rails/templates/components/dialog/preview.yml +77 -0
- data/lib/uikit_rails/templates/components/dropdown/USAGE +40 -0
- data/lib/uikit_rails/templates/components/dropdown/component.html.erb +14 -0
- data/lib/uikit_rails/templates/components/dropdown/component.rb +62 -0
- data/lib/uikit_rails/templates/components/dropdown/dropdown.css +104 -0
- data/lib/uikit_rails/templates/components/dropdown/preview.yml +75 -0
- data/lib/uikit_rails/templates/components/form/USAGE +51 -0
- data/lib/uikit_rails/templates/components/form/builder.rb +233 -0
- data/lib/uikit_rails/templates/components/form/form.css +48 -0
- data/lib/uikit_rails/templates/components/form/preview.yml +95 -0
- data/lib/uikit_rails/templates/components/input/USAGE +21 -0
- data/lib/uikit_rails/templates/components/input/component.rb +25 -0
- data/lib/uikit_rails/templates/components/input/input.css +43 -0
- data/lib/uikit_rails/templates/components/input/preview.yml +58 -0
- data/lib/uikit_rails/templates/components/label/USAGE +16 -0
- data/lib/uikit_rails/templates/components/label/component.rb +25 -0
- data/lib/uikit_rails/templates/components/label/label.css +25 -0
- data/lib/uikit_rails/templates/components/label/preview.yml +34 -0
- data/lib/uikit_rails/templates/components/pagination/USAGE +45 -0
- data/lib/uikit_rails/templates/components/pagination/component.html.erb +7 -0
- data/lib/uikit_rails/templates/components/pagination/component.rb +90 -0
- data/lib/uikit_rails/templates/components/pagination/pagination.css +89 -0
- data/lib/uikit_rails/templates/components/pagination/preview.yml +61 -0
- data/lib/uikit_rails/templates/components/popover/USAGE +44 -0
- data/lib/uikit_rails/templates/components/popover/component.html.erb +8 -0
- data/lib/uikit_rails/templates/components/popover/component.rb +19 -0
- data/lib/uikit_rails/templates/components/popover/popover.css +94 -0
- data/lib/uikit_rails/templates/components/popover/preview.yml +102 -0
- data/lib/uikit_rails/templates/components/progress/USAGE +15 -0
- data/lib/uikit_rails/templates/components/progress/component.html.erb +3 -0
- data/lib/uikit_rails/templates/components/progress/component.rb +38 -0
- data/lib/uikit_rails/templates/components/progress/preview.yml +44 -0
- data/lib/uikit_rails/templates/components/progress/progress.css +20 -0
- data/lib/uikit_rails/templates/components/select/USAGE +19 -0
- data/lib/uikit_rails/templates/components/select/component.rb +38 -0
- data/lib/uikit_rails/templates/components/select/preview.yml +61 -0
- data/lib/uikit_rails/templates/components/select/select.css +46 -0
- data/lib/uikit_rails/templates/components/separator/USAGE +15 -0
- data/lib/uikit_rails/templates/components/separator/component.rb +34 -0
- data/lib/uikit_rails/templates/components/separator/preview.yml +32 -0
- data/lib/uikit_rails/templates/components/separator/separator.css +21 -0
- data/lib/uikit_rails/templates/components/sheet/USAGE +44 -0
- data/lib/uikit_rails/templates/components/sheet/component.html.erb +23 -0
- data/lib/uikit_rails/templates/components/sheet/component.rb +23 -0
- data/lib/uikit_rails/templates/components/sheet/preview.yml +105 -0
- data/lib/uikit_rails/templates/components/sheet/sheet.css +193 -0
- data/lib/uikit_rails/templates/components/skeleton/USAGE +19 -0
- data/lib/uikit_rails/templates/components/skeleton/component.rb +38 -0
- data/lib/uikit_rails/templates/components/skeleton/preview.yml +44 -0
- data/lib/uikit_rails/templates/components/skeleton/skeleton.css +25 -0
- data/lib/uikit_rails/templates/components/switch/USAGE +19 -0
- data/lib/uikit_rails/templates/components/switch/component.html.erb +19 -0
- data/lib/uikit_rails/templates/components/switch/component.rb +23 -0
- data/lib/uikit_rails/templates/components/switch/preview.yml +43 -0
- data/lib/uikit_rails/templates/components/switch/switch.css +81 -0
- data/lib/uikit_rails/templates/components/table/USAGE +40 -0
- data/lib/uikit_rails/templates/components/table/component.html.erb +14 -0
- data/lib/uikit_rails/templates/components/table/component.rb +25 -0
- data/lib/uikit_rails/templates/components/table/preview.yml +109 -0
- data/lib/uikit_rails/templates/components/table/table.css +86 -0
- data/lib/uikit_rails/templates/components/tabs/USAGE +24 -0
- data/lib/uikit_rails/templates/components/tabs/component.html.erb +10 -0
- data/lib/uikit_rails/templates/components/tabs/component.rb +35 -0
- data/lib/uikit_rails/templates/components/tabs/preview.yml +60 -0
- data/lib/uikit_rails/templates/components/tabs/tabs.css +72 -0
- data/lib/uikit_rails/templates/components/textarea/USAGE +19 -0
- data/lib/uikit_rails/templates/components/textarea/component.rb +25 -0
- data/lib/uikit_rails/templates/components/textarea/preview.yml +47 -0
- data/lib/uikit_rails/templates/components/textarea/textarea.css +39 -0
- data/lib/uikit_rails/templates/components/toggle/USAGE +25 -0
- data/lib/uikit_rails/templates/components/toggle/component.rb +39 -0
- data/lib/uikit_rails/templates/components/toggle/preview.yml +81 -0
- data/lib/uikit_rails/templates/components/toggle/toggle.css +89 -0
- data/lib/uikit_rails/templates/components/tooltip/USAGE +23 -0
- data/lib/uikit_rails/templates/components/tooltip/component.html.erb +8 -0
- data/lib/uikit_rails/templates/components/tooltip/component.rb +19 -0
- data/lib/uikit_rails/templates/components/tooltip/preview.yml +52 -0
- data/lib/uikit_rails/templates/components/tooltip/tooltip.css +78 -0
- data/lib/uikit_rails/templates/stimulus/accordion_controller.js +19 -0
- data/lib/uikit_rails/templates/stimulus/alert_dialog_controller.js +25 -0
- data/lib/uikit_rails/templates/stimulus/collapsible_controller.js +9 -0
- data/lib/uikit_rails/templates/stimulus/dialog_controller.js +19 -0
- data/lib/uikit_rails/templates/stimulus/dropdown_controller.js +47 -0
- data/lib/uikit_rails/templates/stimulus/popover_controller.js +47 -0
- data/lib/uikit_rails/templates/stimulus/sheet_controller.js +19 -0
- data/lib/uikit_rails/templates/stimulus/tabs_controller.js +24 -0
- data/lib/uikit_rails/templates/stimulus/tooltip_controller.js +13 -0
- data/lib/uikit_rails/version.rb +5 -0
- data/lib/uikit_rails.rb +59 -0
- data/sig/uikit_rails.rbs +4 -0
- data/test_app/.dockerignore +51 -0
- data/test_app/.gitattributes +9 -0
- data/test_app/.github/dependabot.yml +12 -0
- data/test_app/.github/workflows/ci.yml +124 -0
- data/test_app/.gitignore +35 -0
- data/test_app/.kamal/hooks/docker-setup.sample +3 -0
- data/test_app/.kamal/hooks/post-app-boot.sample +3 -0
- data/test_app/.kamal/hooks/post-deploy.sample +14 -0
- data/test_app/.kamal/hooks/post-proxy-reboot.sample +3 -0
- data/test_app/.kamal/hooks/pre-app-boot.sample +3 -0
- data/test_app/.kamal/hooks/pre-build.sample +51 -0
- data/test_app/.kamal/hooks/pre-connect.sample +47 -0
- data/test_app/.kamal/hooks/pre-deploy.sample +122 -0
- data/test_app/.kamal/hooks/pre-proxy-reboot.sample +3 -0
- data/test_app/.kamal/secrets +20 -0
- data/test_app/.rubocop.yml +8 -0
- data/test_app/.ruby-version +1 -0
- data/test_app/Dockerfile +77 -0
- data/test_app/Gemfile +68 -0
- data/test_app/Gemfile.lock +587 -0
- data/test_app/README.md +24 -0
- data/test_app/Rakefile +6 -0
- data/test_app/app/assets/images/.keep +0 -0
- data/test_app/app/assets/stylesheets/application.css +10 -0
- data/test_app/app/assets/stylesheets/ui/accordion.css +74 -0
- data/test_app/app/assets/stylesheets/ui/alert.css +60 -0
- data/test_app/app/assets/stylesheets/ui/alert_dialog.css +108 -0
- data/test_app/app/assets/stylesheets/ui/avatar.css +53 -0
- data/test_app/app/assets/stylesheets/ui/badge.css +61 -0
- data/test_app/app/assets/stylesheets/ui/breadcrumb.css +55 -0
- data/test_app/app/assets/stylesheets/ui/button.css +125 -0
- data/test_app/app/assets/stylesheets/ui/card.css +63 -0
- data/test_app/app/assets/stylesheets/ui/checkbox.css +67 -0
- data/test_app/app/assets/stylesheets/ui/collapsible.css +55 -0
- data/test_app/app/assets/stylesheets/ui/dialog.css +133 -0
- data/test_app/app/assets/stylesheets/ui/dropdown.css +104 -0
- data/test_app/app/assets/stylesheets/ui/form.css +48 -0
- data/test_app/app/assets/stylesheets/ui/input.css +43 -0
- data/test_app/app/assets/stylesheets/ui/label.css +25 -0
- data/test_app/app/assets/stylesheets/ui/pagination.css +89 -0
- data/test_app/app/assets/stylesheets/ui/popover.css +94 -0
- data/test_app/app/assets/stylesheets/ui/progress.css +20 -0
- data/test_app/app/assets/stylesheets/ui/select.css +46 -0
- data/test_app/app/assets/stylesheets/ui/separator.css +21 -0
- data/test_app/app/assets/stylesheets/ui/sheet.css +193 -0
- data/test_app/app/assets/stylesheets/ui/skeleton.css +25 -0
- data/test_app/app/assets/stylesheets/ui/switch.css +81 -0
- data/test_app/app/assets/stylesheets/ui/table.css +86 -0
- data/test_app/app/assets/stylesheets/ui/tabs.css +72 -0
- data/test_app/app/assets/stylesheets/ui/textarea.css +39 -0
- data/test_app/app/assets/stylesheets/ui/toggle.css +89 -0
- data/test_app/app/assets/stylesheets/ui/tooltip.css +78 -0
- data/test_app/app/assets/stylesheets/uikit_rails.css +69 -0
- data/test_app/app/components/ui/accordion/component.html.erb +13 -0
- data/test_app/app/components/ui/accordion/component.rb +35 -0
- data/test_app/app/components/ui/accordion/preview.yml +81 -0
- data/test_app/app/components/ui/alert/component.html.erb +9 -0
- data/test_app/app/components/ui/alert/component.rb +27 -0
- data/test_app/app/components/ui/alert/preview.yml +53 -0
- data/test_app/app/components/ui/alert_dialog/component.html.erb +27 -0
- data/test_app/app/components/ui/alert_dialog/component.rb +23 -0
- data/test_app/app/components/ui/alert_dialog/preview.yml +94 -0
- data/test_app/app/components/ui/avatar/component.html.erb +7 -0
- data/test_app/app/components/ui/avatar/component.rb +31 -0
- data/test_app/app/components/ui/avatar/preview.yml +42 -0
- data/test_app/app/components/ui/badge/component.rb +28 -0
- data/test_app/app/components/ui/badge/preview.yml +38 -0
- data/test_app/app/components/ui/base_component.rb +32 -0
- data/test_app/app/components/ui/breadcrumb/component.html.erb +14 -0
- data/test_app/app/components/ui/breadcrumb/component.rb +40 -0
- data/test_app/app/components/ui/breadcrumb/preview.yml +42 -0
- data/test_app/app/components/ui/button/component.rb +44 -0
- data/test_app/app/components/ui/button/preview.yml +106 -0
- data/test_app/app/components/ui/card/component.html.erb +16 -0
- data/test_app/app/components/ui/card/component.rb +26 -0
- data/test_app/app/components/ui/card/preview.yml +57 -0
- data/test_app/app/components/ui/checkbox/component.html.erb +6 -0
- data/test_app/app/components/ui/checkbox/component.rb +26 -0
- data/test_app/app/components/ui/checkbox/preview.yml +43 -0
- data/test_app/app/components/ui/collapsible/component.html.erb +8 -0
- data/test_app/app/components/ui/collapsible/component.rb +18 -0
- data/test_app/app/components/ui/collapsible/preview.yml +65 -0
- data/test_app/app/components/ui/dialog/component.html.erb +23 -0
- data/test_app/app/components/ui/dialog/component.rb +20 -0
- data/test_app/app/components/ui/dialog/preview.yml +77 -0
- data/test_app/app/components/ui/dropdown/component.html.erb +14 -0
- data/test_app/app/components/ui/dropdown/component.rb +62 -0
- data/test_app/app/components/ui/dropdown/preview.yml +75 -0
- data/test_app/app/components/ui/form/USAGE +51 -0
- data/test_app/app/components/ui/form/builder.rb +233 -0
- data/test_app/app/components/ui/form/component.rb +258 -0
- data/test_app/app/components/ui/form/form.css +48 -0
- data/test_app/app/components/ui/form/preview.yml +95 -0
- data/test_app/app/components/ui/input/component.rb +25 -0
- data/test_app/app/components/ui/input/preview.yml +58 -0
- data/test_app/app/components/ui/label/component.rb +25 -0
- data/test_app/app/components/ui/label/preview.yml +34 -0
- data/test_app/app/components/ui/pagination/component.html.erb +7 -0
- data/test_app/app/components/ui/pagination/component.rb +90 -0
- data/test_app/app/components/ui/pagination/preview.yml +61 -0
- data/test_app/app/components/ui/popover/component.html.erb +8 -0
- data/test_app/app/components/ui/popover/component.rb +19 -0
- data/test_app/app/components/ui/popover/preview.yml +102 -0
- data/test_app/app/components/ui/progress/component.html.erb +3 -0
- data/test_app/app/components/ui/progress/component.rb +38 -0
- data/test_app/app/components/ui/progress/preview.yml +44 -0
- data/test_app/app/components/ui/select/component.rb +38 -0
- data/test_app/app/components/ui/select/preview.yml +61 -0
- data/test_app/app/components/ui/separator/component.rb +34 -0
- data/test_app/app/components/ui/separator/preview.yml +32 -0
- data/test_app/app/components/ui/sheet/component.html.erb +23 -0
- data/test_app/app/components/ui/sheet/component.rb +23 -0
- data/test_app/app/components/ui/sheet/preview.yml +105 -0
- data/test_app/app/components/ui/skeleton/component.rb +38 -0
- data/test_app/app/components/ui/skeleton/preview.yml +44 -0
- data/test_app/app/components/ui/switch/component.html.erb +19 -0
- data/test_app/app/components/ui/switch/component.rb +23 -0
- data/test_app/app/components/ui/switch/preview.yml +43 -0
- data/test_app/app/components/ui/table/component.html.erb +14 -0
- data/test_app/app/components/ui/table/component.rb +25 -0
- data/test_app/app/components/ui/table/preview.yml +109 -0
- data/test_app/app/components/ui/tabs/component.html.erb +10 -0
- data/test_app/app/components/ui/tabs/component.rb +35 -0
- data/test_app/app/components/ui/tabs/preview.yml +60 -0
- data/test_app/app/components/ui/textarea/component.rb +25 -0
- data/test_app/app/components/ui/textarea/preview.yml +47 -0
- data/test_app/app/components/ui/toggle/component.rb +39 -0
- data/test_app/app/components/ui/toggle/preview.yml +81 -0
- data/test_app/app/components/ui/tooltip/component.html.erb +8 -0
- data/test_app/app/components/ui/tooltip/component.rb +19 -0
- data/test_app/app/components/ui/tooltip/preview.yml +52 -0
- data/test_app/app/controllers/application_controller.rb +7 -0
- data/test_app/app/controllers/concerns/.keep +0 -0
- data/test_app/app/helpers/application_helper.rb +2 -0
- data/test_app/app/javascript/application.js +3 -0
- data/test_app/app/javascript/controllers/application.js +9 -0
- data/test_app/app/javascript/controllers/hello_controller.js +7 -0
- data/test_app/app/javascript/controllers/index.js +4 -0
- data/test_app/app/javascript/controllers/ui/accordion_controller.js +19 -0
- data/test_app/app/javascript/controllers/ui/alert_dialog_controller.js +25 -0
- data/test_app/app/javascript/controllers/ui/collapsible_controller.js +9 -0
- data/test_app/app/javascript/controllers/ui/dialog_controller.js +19 -0
- data/test_app/app/javascript/controllers/ui/dropdown_controller.js +47 -0
- data/test_app/app/javascript/controllers/ui/popover_controller.js +47 -0
- data/test_app/app/javascript/controllers/ui/sheet_controller.js +19 -0
- data/test_app/app/javascript/controllers/ui/tabs_controller.js +24 -0
- data/test_app/app/javascript/controllers/ui/tooltip_controller.js +13 -0
- data/test_app/app/jobs/application_job.rb +7 -0
- data/test_app/app/mailers/application_mailer.rb +4 -0
- data/test_app/app/models/application_record.rb +3 -0
- data/test_app/app/models/concerns/.keep +0 -0
- data/test_app/app/views/layouts/application.html.erb +29 -0
- data/test_app/app/views/layouts/mailer.html.erb +13 -0
- data/test_app/app/views/layouts/mailer.text.erb +1 -0
- data/test_app/app/views/pwa/manifest.json.erb +22 -0
- data/test_app/app/views/pwa/service-worker.js +26 -0
- data/test_app/bin/brakeman +7 -0
- data/test_app/bin/bundler-audit +6 -0
- data/test_app/bin/ci +6 -0
- data/test_app/bin/dev +2 -0
- data/test_app/bin/docker-entrypoint +8 -0
- data/test_app/bin/importmap +4 -0
- data/test_app/bin/jobs +6 -0
- data/test_app/bin/kamal +16 -0
- data/test_app/bin/rails +4 -0
- data/test_app/bin/rake +4 -0
- data/test_app/bin/rubocop +8 -0
- data/test_app/bin/setup +35 -0
- data/test_app/bin/thrust +5 -0
- data/test_app/config/application.rb +27 -0
- data/test_app/config/boot.rb +4 -0
- data/test_app/config/bundler-audit.yml +5 -0
- data/test_app/config/cable.yml +17 -0
- data/test_app/config/cache.yml +16 -0
- data/test_app/config/ci.rb +24 -0
- data/test_app/config/credentials.yml.enc +1 -0
- data/test_app/config/database.yml +40 -0
- data/test_app/config/deploy.yml +119 -0
- data/test_app/config/environment.rb +5 -0
- data/test_app/config/environments/development.rb +78 -0
- data/test_app/config/environments/production.rb +90 -0
- data/test_app/config/environments/test.rb +53 -0
- data/test_app/config/importmap.rb +7 -0
- data/test_app/config/initializers/assets.rb +7 -0
- data/test_app/config/initializers/content_security_policy.rb +29 -0
- data/test_app/config/initializers/filter_parameter_logging.rb +8 -0
- data/test_app/config/initializers/inflections.rb +16 -0
- data/test_app/config/locales/en.yml +31 -0
- data/test_app/config/puma.rb +42 -0
- data/test_app/config/queue.yml +18 -0
- data/test_app/config/recurring.yml +15 -0
- data/test_app/config/routes.rb +13 -0
- data/test_app/config/storage.yml +27 -0
- data/test_app/config.ru +6 -0
- data/test_app/db/cable_schema.rb +11 -0
- data/test_app/db/cache_schema.rb +12 -0
- data/test_app/db/queue_schema.rb +129 -0
- data/test_app/db/seeds.rb +9 -0
- data/test_app/lib/tasks/.keep +0 -0
- data/test_app/log/.keep +0 -0
- data/test_app/public/400.html +135 -0
- data/test_app/public/404.html +135 -0
- data/test_app/public/406-unsupported-browser.html +135 -0
- data/test_app/public/422.html +135 -0
- data/test_app/public/500.html +135 -0
- data/test_app/public/icon.png +0 -0
- data/test_app/public/icon.svg +3 -0
- data/test_app/public/robots.txt +1 -0
- data/test_app/script/.keep +0 -0
- data/test_app/storage/.keep +0 -0
- data/test_app/test/controllers/.keep +0 -0
- data/test_app/test/fixtures/files/.keep +0 -0
- data/test_app/test/helpers/.keep +0 -0
- data/test_app/test/integration/.keep +0 -0
- data/test_app/test/mailers/.keep +0 -0
- data/test_app/test/models/.keep +0 -0
- data/test_app/test/test_helper.rb +15 -0
- data/test_app/tmp/.keep +0 -0
- data/test_app/tmp/pids/.keep +0 -0
- data/test_app/tmp/storage/.keep +0 -0
- data/test_app/vendor/.keep +0 -0
- data/test_app/vendor/javascript/.keep +0 -0
- metadata +448 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
description: A styled data table with optional caption, header, body, and footer slots. Supports responsive horizontal scrolling.
|
|
2
|
+
|
|
3
|
+
sections:
|
|
4
|
+
- title: Basic Table
|
|
5
|
+
examples:
|
|
6
|
+
- title: With header and rows
|
|
7
|
+
code: |
|
|
8
|
+
<%= render Ui::Table::Component.new do |table| %>
|
|
9
|
+
<% table.with_header do %>
|
|
10
|
+
<tr>
|
|
11
|
+
<th>Invoice</th>
|
|
12
|
+
<th>Status</th>
|
|
13
|
+
<th>Method</th>
|
|
14
|
+
<th class="text-right">Amount</th>
|
|
15
|
+
</tr>
|
|
16
|
+
<% end %>
|
|
17
|
+
<tr>
|
|
18
|
+
<td>INV-001</td>
|
|
19
|
+
<td>Paid</td>
|
|
20
|
+
<td>Credit Card</td>
|
|
21
|
+
<td class="text-right">$250.00</td>
|
|
22
|
+
</tr>
|
|
23
|
+
<tr>
|
|
24
|
+
<td>INV-002</td>
|
|
25
|
+
<td>Pending</td>
|
|
26
|
+
<td>PayPal</td>
|
|
27
|
+
<td class="text-right">$150.00</td>
|
|
28
|
+
</tr>
|
|
29
|
+
<tr>
|
|
30
|
+
<td>INV-003</td>
|
|
31
|
+
<td>Unpaid</td>
|
|
32
|
+
<td>Bank Transfer</td>
|
|
33
|
+
<td class="text-right">$350.00</td>
|
|
34
|
+
</tr>
|
|
35
|
+
<tr>
|
|
36
|
+
<td>INV-004</td>
|
|
37
|
+
<td>Paid</td>
|
|
38
|
+
<td>Credit Card</td>
|
|
39
|
+
<td class="text-right">$450.00</td>
|
|
40
|
+
</tr>
|
|
41
|
+
<tr>
|
|
42
|
+
<td>INV-005</td>
|
|
43
|
+
<td>Paid</td>
|
|
44
|
+
<td>PayPal</td>
|
|
45
|
+
<td class="text-right">$550.00</td>
|
|
46
|
+
</tr>
|
|
47
|
+
<% end %>
|
|
48
|
+
|
|
49
|
+
- title: With Caption
|
|
50
|
+
examples:
|
|
51
|
+
- title: Table with caption
|
|
52
|
+
code: |
|
|
53
|
+
<%= render Ui::Table::Component.new do |table| %>
|
|
54
|
+
<% table.with_caption do %>
|
|
55
|
+
A list of recent invoices.
|
|
56
|
+
<% end %>
|
|
57
|
+
<% table.with_header do %>
|
|
58
|
+
<tr>
|
|
59
|
+
<th>Invoice</th>
|
|
60
|
+
<th>Status</th>
|
|
61
|
+
<th class="text-right">Amount</th>
|
|
62
|
+
</tr>
|
|
63
|
+
<% end %>
|
|
64
|
+
<tr>
|
|
65
|
+
<td>INV-001</td>
|
|
66
|
+
<td>Paid</td>
|
|
67
|
+
<td class="text-right">$250.00</td>
|
|
68
|
+
</tr>
|
|
69
|
+
<tr>
|
|
70
|
+
<td>INV-002</td>
|
|
71
|
+
<td>Pending</td>
|
|
72
|
+
<td class="text-right">$150.00</td>
|
|
73
|
+
</tr>
|
|
74
|
+
<% end %>
|
|
75
|
+
|
|
76
|
+
- title: With Footer
|
|
77
|
+
examples:
|
|
78
|
+
- title: Table with footer totals
|
|
79
|
+
code: |
|
|
80
|
+
<%= render Ui::Table::Component.new do |table| %>
|
|
81
|
+
<% table.with_header do %>
|
|
82
|
+
<tr>
|
|
83
|
+
<th>Invoice</th>
|
|
84
|
+
<th>Status</th>
|
|
85
|
+
<th class="text-right">Amount</th>
|
|
86
|
+
</tr>
|
|
87
|
+
<% end %>
|
|
88
|
+
<tr>
|
|
89
|
+
<td>INV-001</td>
|
|
90
|
+
<td>Paid</td>
|
|
91
|
+
<td class="text-right">$250.00</td>
|
|
92
|
+
</tr>
|
|
93
|
+
<tr>
|
|
94
|
+
<td>INV-002</td>
|
|
95
|
+
<td>Pending</td>
|
|
96
|
+
<td class="text-right">$150.00</td>
|
|
97
|
+
</tr>
|
|
98
|
+
<tr>
|
|
99
|
+
<td>INV-003</td>
|
|
100
|
+
<td>Unpaid</td>
|
|
101
|
+
<td class="text-right">$350.00</td>
|
|
102
|
+
</tr>
|
|
103
|
+
<% table.with_footer do %>
|
|
104
|
+
<tr>
|
|
105
|
+
<td colspan="2"><strong>Total</strong></td>
|
|
106
|
+
<td class="text-right"><strong>$750.00</strong></td>
|
|
107
|
+
</tr>
|
|
108
|
+
<% end %>
|
|
109
|
+
<% end %>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
* UikitRails — Table
|
|
3
|
+
*
|
|
4
|
+
* Slots: caption, header, body (content), footer
|
|
5
|
+
* ============================================ */
|
|
6
|
+
|
|
7
|
+
.ui-table__wrapper {
|
|
8
|
+
overflow-x: auto;
|
|
9
|
+
width: 100%;
|
|
10
|
+
border: 1px solid var(--ui-border);
|
|
11
|
+
border-radius: var(--ui-radius);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ui-table {
|
|
15
|
+
width: 100%;
|
|
16
|
+
border-collapse: collapse;
|
|
17
|
+
font-family: var(--ui-font-family);
|
|
18
|
+
font-size: var(--ui-font-size-sm);
|
|
19
|
+
color: var(--ui-foreground);
|
|
20
|
+
background-color: var(--ui-background);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ui-table__caption {
|
|
24
|
+
padding: 0.75rem 1rem;
|
|
25
|
+
font-size: var(--ui-font-size-sm);
|
|
26
|
+
color: var(--ui-muted-foreground);
|
|
27
|
+
text-align: left;
|
|
28
|
+
caption-side: bottom;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* --- Head --- */
|
|
32
|
+
|
|
33
|
+
.ui-table__head {
|
|
34
|
+
border-bottom: 1px solid var(--ui-border);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ui-table__head tr {
|
|
38
|
+
border-bottom: 1px solid var(--ui-border);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ui-table__head th {
|
|
42
|
+
padding: 0.75rem 1rem;
|
|
43
|
+
text-align: left;
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
color: var(--ui-muted-foreground);
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* --- Body --- */
|
|
50
|
+
|
|
51
|
+
.ui-table__body tr {
|
|
52
|
+
border-bottom: 1px solid var(--ui-border);
|
|
53
|
+
transition: background-color var(--ui-transition-speed) ease;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ui-table__body tr:last-child {
|
|
57
|
+
border-bottom: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ui-table__body tr:nth-child(even) {
|
|
61
|
+
background-color: color-mix(in srgb, var(--ui-muted) 40%, transparent);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ui-table__body tr:hover {
|
|
65
|
+
background-color: color-mix(in srgb, var(--ui-muted) 60%, transparent);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ui-table__body td {
|
|
69
|
+
padding: 0.75rem 1rem;
|
|
70
|
+
text-align: left;
|
|
71
|
+
vertical-align: middle;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* --- Foot --- */
|
|
75
|
+
|
|
76
|
+
.ui-table__foot {
|
|
77
|
+
border-top: 1px solid var(--ui-border);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ui-table__foot td,
|
|
81
|
+
.ui-table__foot th {
|
|
82
|
+
padding: 0.75rem 1rem;
|
|
83
|
+
text-align: left;
|
|
84
|
+
font-weight: 500;
|
|
85
|
+
color: var(--ui-muted-foreground);
|
|
86
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Basic tabs:
|
|
2
|
+
|
|
3
|
+
<%= render Ui::Tabs::Component.new do |tabs| %>
|
|
4
|
+
<% tabs.with_tab(id: "one", label: "Tab One") do %>
|
|
5
|
+
<p>Content for tab one.</p>
|
|
6
|
+
<% end %>
|
|
7
|
+
<% tabs.with_tab(id: "two", label: "Tab Two") do %>
|
|
8
|
+
<p>Content for tab two.</p>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% end %>
|
|
11
|
+
|
|
12
|
+
With a default active tab:
|
|
13
|
+
|
|
14
|
+
<%= render Ui::Tabs::Component.new(default_tab: "two") do |tabs| %>
|
|
15
|
+
<% tabs.with_tab(id: "one", label: "Tab One") do %>First<% end %>
|
|
16
|
+
<% tabs.with_tab(id: "two", label: "Tab Two") do %>Second (active)<% end %>
|
|
17
|
+
<% end %>
|
|
18
|
+
|
|
19
|
+
With custom attributes:
|
|
20
|
+
|
|
21
|
+
<%= render Ui::Tabs::Component.new(class: "extra", data: { turbo: false }) do |tabs| %>
|
|
22
|
+
<% tabs.with_tab(id: "a", label: "A") do %>Content A<% end %>
|
|
23
|
+
<% tabs.with_tab(id: "b", label: "B") do %>Content B<% end %>
|
|
24
|
+
<% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div data-controller="ui--tabs" data-ui--tabs-default-value="<%= default_tab || tabs.first&.id %>" class="ui-tabs" <%= tag.attributes(html_attrs) %>>
|
|
2
|
+
<div class="ui-tabs__list" role="tablist">
|
|
3
|
+
<% tabs.each do |tab| %>
|
|
4
|
+
<button class="ui-tabs__trigger" role="tab" data-action="click->ui--tabs#select" data-ui--tabs-id-param="<%= tab.id %>" data-ui--tabs-target="trigger" id="tab-<%= tab.id %>" aria-controls="panel-<%= tab.id %>"><%= tab.label %></button>
|
|
5
|
+
<% end %>
|
|
6
|
+
</div>
|
|
7
|
+
<% tabs.each do |tab| %>
|
|
8
|
+
<div class="ui-tabs__panel" role="tabpanel" data-ui--tabs-target="panel" data-tab-id="<%= tab.id %>" id="panel-<%= tab.id %>" aria-labelledby="tab-<%= tab.id %>" hidden><%= tab.to_s %></div>
|
|
9
|
+
<% end %>
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ui
|
|
4
|
+
module Tabs
|
|
5
|
+
# Tabbed content panels.
|
|
6
|
+
class Component < Ui::BaseComponent
|
|
7
|
+
renders_many :tabs, lambda { |id:, label:, **html_attrs|
|
|
8
|
+
Tab.new(id: id, label: label, **html_attrs)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
attr_reader :default_tab, :html_attrs
|
|
12
|
+
|
|
13
|
+
def initialize(default_tab: nil, **html_attrs)
|
|
14
|
+
@default_tab = default_tab
|
|
15
|
+
@html_attrs = html_attrs
|
|
16
|
+
super()
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class Tab < Ui::BaseComponent
|
|
20
|
+
attr_reader :id, :label, :html_attrs
|
|
21
|
+
|
|
22
|
+
def initialize(id:, label:, **html_attrs)
|
|
23
|
+
@id = id
|
|
24
|
+
@label = label
|
|
25
|
+
@html_attrs = html_attrs
|
|
26
|
+
super()
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def call
|
|
30
|
+
content
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
description: Tabbed content panels for organizing related content into switchable views. Supports keyboard navigation and ARIA roles.
|
|
2
|
+
|
|
3
|
+
sections:
|
|
4
|
+
- title: Basic Tabs
|
|
5
|
+
examples:
|
|
6
|
+
- title: Default tabs
|
|
7
|
+
code: |
|
|
8
|
+
<%= render Ui::Tabs::Component.new do |tabs| %>
|
|
9
|
+
<% tabs.with_tab(id: "account", label: "Account") do %>
|
|
10
|
+
<p>Manage your account settings and preferences.</p>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% tabs.with_tab(id: "password", label: "Password") do %>
|
|
13
|
+
<p>Change your password and security settings.</p>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% tabs.with_tab(id: "notifications", label: "Notifications") do %>
|
|
16
|
+
<p>Configure how you receive notifications.</p>
|
|
17
|
+
<% end %>
|
|
18
|
+
<% end %>
|
|
19
|
+
|
|
20
|
+
- title: Default Active Tab
|
|
21
|
+
examples:
|
|
22
|
+
- title: Second tab active by default
|
|
23
|
+
code: |
|
|
24
|
+
<%= render Ui::Tabs::Component.new(default_tab: "password") do |tabs| %>
|
|
25
|
+
<% tabs.with_tab(id: "account", label: "Account") do %>
|
|
26
|
+
<p>Account details go here.</p>
|
|
27
|
+
<% end %>
|
|
28
|
+
<% tabs.with_tab(id: "password", label: "Password") do %>
|
|
29
|
+
<p>Password settings are shown first.</p>
|
|
30
|
+
<% end %>
|
|
31
|
+
<% end %>
|
|
32
|
+
|
|
33
|
+
- title: Rich Content
|
|
34
|
+
examples:
|
|
35
|
+
- title: Tabs with forms and actions
|
|
36
|
+
code: |
|
|
37
|
+
<%= render Ui::Tabs::Component.new do |tabs| %>
|
|
38
|
+
<% tabs.with_tab(id: "profile", label: "Profile") do %>
|
|
39
|
+
<div style="max-width: 24rem;">
|
|
40
|
+
<p style="margin-bottom: 1rem;">Update your profile information.</p>
|
|
41
|
+
<%= render Ui::Button::Component.new(size: :sm) do %>Save Changes<% end %>
|
|
42
|
+
</div>
|
|
43
|
+
<% end %>
|
|
44
|
+
<% tabs.with_tab(id: "billing", label: "Billing") do %>
|
|
45
|
+
<p>View and manage your billing information and invoices.</p>
|
|
46
|
+
<% end %>
|
|
47
|
+
<% end %>
|
|
48
|
+
|
|
49
|
+
- title: Custom Attributes
|
|
50
|
+
examples:
|
|
51
|
+
- title: With custom class
|
|
52
|
+
code: |
|
|
53
|
+
<%= render Ui::Tabs::Component.new(class: "my-custom-tabs", data: { turbo: false }) do |tabs| %>
|
|
54
|
+
<% tabs.with_tab(id: "tab1", label: "First") do %>
|
|
55
|
+
<p>First tab content.</p>
|
|
56
|
+
<% end %>
|
|
57
|
+
<% tabs.with_tab(id: "tab2", label: "Second") do %>
|
|
58
|
+
<p>Second tab content.</p>
|
|
59
|
+
<% end %>
|
|
60
|
+
<% end %>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
* UikitRails — Tabs
|
|
3
|
+
*
|
|
4
|
+
* Tabbed content panels with accessible roles
|
|
5
|
+
* and keyboard-friendly triggers.
|
|
6
|
+
* ============================================ */
|
|
7
|
+
|
|
8
|
+
.ui-tabs {
|
|
9
|
+
font-family: var(--ui-font-family);
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* --- Tab List --- */
|
|
14
|
+
|
|
15
|
+
.ui-tabs__list {
|
|
16
|
+
display: flex;
|
|
17
|
+
border-bottom: 1px solid var(--ui-border);
|
|
18
|
+
gap: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* --- Trigger --- */
|
|
22
|
+
|
|
23
|
+
.ui-tabs__trigger {
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
padding: 0.625rem 1rem;
|
|
28
|
+
font-family: var(--ui-font-family);
|
|
29
|
+
font-size: var(--ui-font-size-sm);
|
|
30
|
+
font-weight: 500;
|
|
31
|
+
color: var(--ui-muted-foreground);
|
|
32
|
+
background: none;
|
|
33
|
+
border: none;
|
|
34
|
+
border-bottom: 2px solid transparent;
|
|
35
|
+
margin-bottom: -1px;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
transition:
|
|
39
|
+
color var(--ui-transition-speed) ease,
|
|
40
|
+
border-color var(--ui-transition-speed) ease;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ui-tabs__trigger:hover {
|
|
44
|
+
color: var(--ui-foreground);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.ui-tabs__trigger:focus-visible {
|
|
48
|
+
outline: 2px solid var(--ui-ring);
|
|
49
|
+
outline-offset: -2px;
|
|
50
|
+
border-radius: 2px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ui-tabs__trigger--active {
|
|
54
|
+
color: var(--ui-foreground);
|
|
55
|
+
border-bottom-color: var(--ui-primary);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* --- Panel --- */
|
|
59
|
+
|
|
60
|
+
.ui-tabs__panel {
|
|
61
|
+
padding-top: 1rem;
|
|
62
|
+
font-size: var(--ui-font-size-sm);
|
|
63
|
+
color: var(--ui-foreground);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ui-tabs__panel[hidden] {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.ui-tabs__panel--active {
|
|
71
|
+
display: block;
|
|
72
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Basic textarea:
|
|
2
|
+
|
|
3
|
+
<%= render Ui::Textarea::Component.new(placeholder: "Type here...") %>
|
|
4
|
+
|
|
5
|
+
With rows:
|
|
6
|
+
|
|
7
|
+
<%= render Ui::Textarea::Component.new(rows: 6, placeholder: "Write something...") %>
|
|
8
|
+
|
|
9
|
+
With pre-filled content:
|
|
10
|
+
|
|
11
|
+
<%= render Ui::Textarea::Component.new(name: "bio") do %>Existing content<% end %>
|
|
12
|
+
|
|
13
|
+
Disabled:
|
|
14
|
+
|
|
15
|
+
<%= render Ui::Textarea::Component.new(placeholder: "Disabled", disabled: true) %>
|
|
16
|
+
|
|
17
|
+
With custom attributes:
|
|
18
|
+
|
|
19
|
+
<%= render Ui::Textarea::Component.new(class: "extra", maxlength: 500) %>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ui
|
|
4
|
+
module Textarea
|
|
5
|
+
# Multi-line text input field.
|
|
6
|
+
class Component < Ui::BaseComponent
|
|
7
|
+
attr_reader :html_attrs
|
|
8
|
+
|
|
9
|
+
def initialize(**html_attrs)
|
|
10
|
+
@html_attrs = html_attrs
|
|
11
|
+
super()
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def call
|
|
15
|
+
content_tag(:textarea, content, **computed_attrs)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def computed_attrs
|
|
21
|
+
merge_attrs({ class: "ui-textarea" }, html_attrs)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
description: A styled multi-line text input. Supports all standard HTML textarea attributes including placeholder, rows, disabled, and name.
|
|
2
|
+
|
|
3
|
+
sections:
|
|
4
|
+
- title: Basic Usage
|
|
5
|
+
examples:
|
|
6
|
+
- title: Default textarea
|
|
7
|
+
code: |
|
|
8
|
+
<%= render Ui::Textarea::Component.new(placeholder: "Type your message here...") %>
|
|
9
|
+
|
|
10
|
+
- title: With rows
|
|
11
|
+
code: |
|
|
12
|
+
<%= render Ui::Textarea::Component.new(placeholder: "Write something...", rows: 6) %>
|
|
13
|
+
|
|
14
|
+
- title: With Content
|
|
15
|
+
examples:
|
|
16
|
+
- title: Pre-filled content
|
|
17
|
+
code: |
|
|
18
|
+
<%= render Ui::Textarea::Component.new(name: "bio") do %>This is pre-filled content.<% end %>
|
|
19
|
+
|
|
20
|
+
- title: With name and placeholder
|
|
21
|
+
code: |
|
|
22
|
+
<%= render Ui::Textarea::Component.new(name: "description", placeholder: "Describe your project...") %>
|
|
23
|
+
|
|
24
|
+
- title: States
|
|
25
|
+
examples:
|
|
26
|
+
- title: Disabled
|
|
27
|
+
code: |
|
|
28
|
+
<%= render Ui::Textarea::Component.new(placeholder: "Disabled textarea", disabled: true) %>
|
|
29
|
+
|
|
30
|
+
- title: Required
|
|
31
|
+
code: |
|
|
32
|
+
<%= render Ui::Textarea::Component.new(placeholder: "Required field", required: true) %>
|
|
33
|
+
|
|
34
|
+
- title: Readonly
|
|
35
|
+
code: |
|
|
36
|
+
<%= render Ui::Textarea::Component.new(readonly: true) do %>This content is read-only.<% end %>
|
|
37
|
+
|
|
38
|
+
- title: With Custom Attributes
|
|
39
|
+
examples:
|
|
40
|
+
- title: Custom class and data attributes
|
|
41
|
+
code: |
|
|
42
|
+
<%= render Ui::Textarea::Component.new(
|
|
43
|
+
placeholder: "Custom",
|
|
44
|
+
class: "my-custom-class",
|
|
45
|
+
data: { controller: "auto-resize" },
|
|
46
|
+
maxlength: 500
|
|
47
|
+
) %>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
* UikitRails — Textarea
|
|
3
|
+
*
|
|
4
|
+
* Multi-line text input field.
|
|
5
|
+
* ============================================ */
|
|
6
|
+
|
|
7
|
+
.ui-textarea {
|
|
8
|
+
display: flex;
|
|
9
|
+
width: 100%;
|
|
10
|
+
min-height: 80px;
|
|
11
|
+
padding: 0.5rem 0.75rem;
|
|
12
|
+
font-family: var(--ui-font-family);
|
|
13
|
+
font-size: var(--ui-font-size-sm);
|
|
14
|
+
line-height: 1.5;
|
|
15
|
+
color: var(--ui-foreground);
|
|
16
|
+
background-color: var(--ui-background);
|
|
17
|
+
border: 1px solid var(--ui-input);
|
|
18
|
+
border-radius: var(--ui-radius);
|
|
19
|
+
resize: vertical;
|
|
20
|
+
transition:
|
|
21
|
+
border-color var(--ui-transition-speed) ease,
|
|
22
|
+
box-shadow var(--ui-transition-speed) ease;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ui-textarea::placeholder {
|
|
26
|
+
color: var(--ui-muted-foreground);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ui-textarea:focus {
|
|
30
|
+
outline: none;
|
|
31
|
+
border-color: var(--ui-ring);
|
|
32
|
+
box-shadow: 0 0 0 1px var(--ui-ring);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ui-textarea:disabled {
|
|
36
|
+
opacity: 0.5;
|
|
37
|
+
cursor: not-allowed;
|
|
38
|
+
background-color: var(--ui-muted);
|
|
39
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Basic toggle:
|
|
2
|
+
|
|
3
|
+
<%= render Ui::Toggle::Component.new do %>Bold<% end %>
|
|
4
|
+
|
|
5
|
+
Pressed:
|
|
6
|
+
|
|
7
|
+
<%= render Ui::Toggle::Component.new(pressed: true) do %>Bold<% end %>
|
|
8
|
+
|
|
9
|
+
Variants (default, outline):
|
|
10
|
+
|
|
11
|
+
<%= render Ui::Toggle::Component.new(variant: :outline) do %>Italic<% end %>
|
|
12
|
+
<%= render Ui::Toggle::Component.new(variant: :outline, pressed: true) do %>Italic<% end %>
|
|
13
|
+
|
|
14
|
+
Sizes (sm, md, lg):
|
|
15
|
+
|
|
16
|
+
<%= render Ui::Toggle::Component.new(size: :sm) do %>S<% end %>
|
|
17
|
+
<%= render Ui::Toggle::Component.new(size: :lg) do %>L<% end %>
|
|
18
|
+
|
|
19
|
+
Disabled:
|
|
20
|
+
|
|
21
|
+
<%= render Ui::Toggle::Component.new(disabled: true) do %>Off<% end %>
|
|
22
|
+
|
|
23
|
+
With custom attributes:
|
|
24
|
+
|
|
25
|
+
<%= render Ui::Toggle::Component.new(data: { action: "click->toolbar#toggle" }) do %>B<% end %>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ui
|
|
4
|
+
module Toggle
|
|
5
|
+
# Pressable toggle button.
|
|
6
|
+
class Component < Ui::BaseComponent
|
|
7
|
+
VARIANTS = %i[default outline].freeze
|
|
8
|
+
SIZES = %i[sm md lg].freeze
|
|
9
|
+
|
|
10
|
+
attr_reader :variant, :size, :pressed, :html_attrs
|
|
11
|
+
|
|
12
|
+
def initialize(variant: :default, size: :md, pressed: false, **html_attrs)
|
|
13
|
+
@variant = variant.to_sym
|
|
14
|
+
@size = size.to_sym
|
|
15
|
+
@pressed = pressed
|
|
16
|
+
@html_attrs = html_attrs
|
|
17
|
+
super()
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def call
|
|
21
|
+
content_tag(:button, content, **computed_attrs)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def computed_attrs
|
|
27
|
+
merge_attrs(
|
|
28
|
+
{
|
|
29
|
+
class: class_names("ui-toggle", "ui-toggle--#{variant}", "ui-toggle--#{size}",
|
|
30
|
+
"ui-toggle--pressed": pressed),
|
|
31
|
+
type: "button",
|
|
32
|
+
"aria-pressed": pressed.to_s
|
|
33
|
+
},
|
|
34
|
+
html_attrs
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
description: A pressable toggle button with variants and sizes. Uses aria-pressed for accessibility. Ideal for toolbar actions or binary state controls.
|
|
2
|
+
|
|
3
|
+
sections:
|
|
4
|
+
- title: Basic Usage
|
|
5
|
+
examples:
|
|
6
|
+
- title: Default (unpressed)
|
|
7
|
+
code: |
|
|
8
|
+
<%= render Ui::Toggle::Component.new do %>
|
|
9
|
+
B
|
|
10
|
+
<% end %>
|
|
11
|
+
|
|
12
|
+
- title: Pressed
|
|
13
|
+
code: |
|
|
14
|
+
<%= render Ui::Toggle::Component.new(pressed: true) do %>
|
|
15
|
+
B
|
|
16
|
+
<% end %>
|
|
17
|
+
|
|
18
|
+
- title: Variants
|
|
19
|
+
examples:
|
|
20
|
+
- title: Default variant
|
|
21
|
+
code: |
|
|
22
|
+
<%= render Ui::Toggle::Component.new do %>
|
|
23
|
+
Italic
|
|
24
|
+
<% end %>
|
|
25
|
+
|
|
26
|
+
- title: Outline variant
|
|
27
|
+
code: |
|
|
28
|
+
<%= render Ui::Toggle::Component.new(variant: :outline) do %>
|
|
29
|
+
Italic
|
|
30
|
+
<% end %>
|
|
31
|
+
|
|
32
|
+
- title: Outline pressed
|
|
33
|
+
code: |
|
|
34
|
+
<%= render Ui::Toggle::Component.new(variant: :outline, pressed: true) do %>
|
|
35
|
+
Italic
|
|
36
|
+
<% end %>
|
|
37
|
+
|
|
38
|
+
- title: Sizes
|
|
39
|
+
examples:
|
|
40
|
+
- title: Small
|
|
41
|
+
code: |
|
|
42
|
+
<%= render Ui::Toggle::Component.new(size: :sm) do %>
|
|
43
|
+
S
|
|
44
|
+
<% end %>
|
|
45
|
+
|
|
46
|
+
- title: Medium (default)
|
|
47
|
+
code: |
|
|
48
|
+
<%= render Ui::Toggle::Component.new(size: :md) do %>
|
|
49
|
+
M
|
|
50
|
+
<% end %>
|
|
51
|
+
|
|
52
|
+
- title: Large
|
|
53
|
+
code: |
|
|
54
|
+
<%= render Ui::Toggle::Component.new(size: :lg) do %>
|
|
55
|
+
L
|
|
56
|
+
<% end %>
|
|
57
|
+
|
|
58
|
+
- title: Disabled State
|
|
59
|
+
examples:
|
|
60
|
+
- title: Disabled
|
|
61
|
+
code: |
|
|
62
|
+
<%= render Ui::Toggle::Component.new(disabled: true) do %>
|
|
63
|
+
Disabled
|
|
64
|
+
<% end %>
|
|
65
|
+
|
|
66
|
+
- title: Disabled pressed
|
|
67
|
+
code: |
|
|
68
|
+
<%= render Ui::Toggle::Component.new(pressed: true, disabled: true) do %>
|
|
69
|
+
Locked
|
|
70
|
+
<% end %>
|
|
71
|
+
|
|
72
|
+
- title: With Custom Attributes
|
|
73
|
+
examples:
|
|
74
|
+
- title: Custom data attributes
|
|
75
|
+
code: |
|
|
76
|
+
<%= render Ui::Toggle::Component.new(
|
|
77
|
+
variant: :outline,
|
|
78
|
+
data: { controller: "toolbar", action: "click->toolbar#toggleBold" }
|
|
79
|
+
) do %>
|
|
80
|
+
B
|
|
81
|
+
<% end %>
|