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,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ui
|
|
4
|
+
module AlertDialog
|
|
5
|
+
# Confirmation dialog that requires an explicit action to dismiss.
|
|
6
|
+
# Unlike Dialog, there is no close button — the user must choose
|
|
7
|
+
# cancel or confirm.
|
|
8
|
+
class Component < Ui::BaseComponent
|
|
9
|
+
renders_one :trigger
|
|
10
|
+
renders_one :title
|
|
11
|
+
renders_one :description
|
|
12
|
+
renders_one :cancel
|
|
13
|
+
renders_one :action
|
|
14
|
+
|
|
15
|
+
attr_reader :html_attrs
|
|
16
|
+
|
|
17
|
+
def initialize(**html_attrs)
|
|
18
|
+
@html_attrs = html_attrs
|
|
19
|
+
super()
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
description: A confirmation dialog that interrupts the user and requires an explicit response. Unlike Dialog, there is no close button or backdrop dismiss — the user must choose cancel or confirm.
|
|
2
|
+
|
|
3
|
+
sections:
|
|
4
|
+
- title: Basic Alert Dialog
|
|
5
|
+
examples:
|
|
6
|
+
- title: Delete confirmation
|
|
7
|
+
code: |
|
|
8
|
+
<%= render Ui::AlertDialog::Component.new do |alert| %>
|
|
9
|
+
<% alert.with_trigger do %>
|
|
10
|
+
<%= render Ui::Button::Component.new(variant: :destructive) do %>Delete Account<% end %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% alert.with_title do %>Are you absolutely sure?<% end %>
|
|
13
|
+
<% alert.with_description do %>This action cannot be undone. This will permanently delete your account and remove your data from our servers.<% end %>
|
|
14
|
+
<% alert.with_cancel do %>
|
|
15
|
+
<%= render Ui::Button::Component.new(variant: :outline) do %>Cancel<% end %>
|
|
16
|
+
<% end %>
|
|
17
|
+
<% alert.with_action do %>
|
|
18
|
+
<%= render Ui::Button::Component.new(variant: :destructive) do %>Yes, delete account<% end %>
|
|
19
|
+
<% end %>
|
|
20
|
+
<% end %>
|
|
21
|
+
|
|
22
|
+
- title: Various Confirmations
|
|
23
|
+
examples:
|
|
24
|
+
- title: Discard changes
|
|
25
|
+
code: |
|
|
26
|
+
<%= render Ui::AlertDialog::Component.new do |alert| %>
|
|
27
|
+
<% alert.with_trigger do %>
|
|
28
|
+
<%= render Ui::Button::Component.new(variant: :outline) do %>Discard<% end %>
|
|
29
|
+
<% end %>
|
|
30
|
+
<% alert.with_title do %>Discard changes?<% end %>
|
|
31
|
+
<% alert.with_description do %>You have unsaved changes. Are you sure you want to discard them? This cannot be undone.<% end %>
|
|
32
|
+
<% alert.with_cancel do %>
|
|
33
|
+
<%= render Ui::Button::Component.new(variant: :outline) do %>Keep editing<% end %>
|
|
34
|
+
<% end %>
|
|
35
|
+
<% alert.with_action do %>
|
|
36
|
+
<%= render Ui::Button::Component.new(variant: :destructive) do %>Discard<% end %>
|
|
37
|
+
<% end %>
|
|
38
|
+
<% end %>
|
|
39
|
+
|
|
40
|
+
- title: Publish confirmation
|
|
41
|
+
code: |
|
|
42
|
+
<%= render Ui::AlertDialog::Component.new do |alert| %>
|
|
43
|
+
<% alert.with_trigger do %>
|
|
44
|
+
<%= render Ui::Button::Component.new do %>Publish<% end %>
|
|
45
|
+
<% end %>
|
|
46
|
+
<% alert.with_title do %>Publish this article?<% end %>
|
|
47
|
+
<% alert.with_description do %>Once published, this article will be visible to all users. You can unpublish it later from the dashboard.<% end %>
|
|
48
|
+
<% alert.with_cancel do %>
|
|
49
|
+
<%= render Ui::Button::Component.new(variant: :outline) do %>Not yet<% end %>
|
|
50
|
+
<% end %>
|
|
51
|
+
<% alert.with_action do %>
|
|
52
|
+
<%= render Ui::Button::Component.new do %>Yes, publish<% end %>
|
|
53
|
+
<% end %>
|
|
54
|
+
<% end %>
|
|
55
|
+
|
|
56
|
+
- title: With Body Content
|
|
57
|
+
examples:
|
|
58
|
+
- title: Alert with additional details
|
|
59
|
+
code: |
|
|
60
|
+
<%= render Ui::AlertDialog::Component.new do |alert| %>
|
|
61
|
+
<% alert.with_trigger do %>
|
|
62
|
+
<%= render Ui::Button::Component.new(variant: :outline) do %>Remove Members<% end %>
|
|
63
|
+
<% end %>
|
|
64
|
+
<% alert.with_title do %>Remove team members?<% end %>
|
|
65
|
+
<% alert.with_description do %>The following members will lose access immediately:<% end %>
|
|
66
|
+
<ul style="list-style:disc;padding-left:1.25rem;font-size:var(--ui-font-size-sm);line-height:1.75;">
|
|
67
|
+
<li>alice@example.com</li>
|
|
68
|
+
<li>bob@example.com</li>
|
|
69
|
+
</ul>
|
|
70
|
+
<% alert.with_cancel do %>
|
|
71
|
+
<%= render Ui::Button::Component.new(variant: :outline) do %>Cancel<% end %>
|
|
72
|
+
<% end %>
|
|
73
|
+
<% alert.with_action do %>
|
|
74
|
+
<%= render Ui::Button::Component.new(variant: :destructive) do %>Remove<% end %>
|
|
75
|
+
<% end %>
|
|
76
|
+
<% end %>
|
|
77
|
+
|
|
78
|
+
- title: Custom Attributes
|
|
79
|
+
examples:
|
|
80
|
+
- title: Alert dialog with custom data attributes
|
|
81
|
+
code: |
|
|
82
|
+
<%= render Ui::AlertDialog::Component.new(data: { turbo_frame: "modal" }) do |alert| %>
|
|
83
|
+
<% alert.with_trigger do %>
|
|
84
|
+
<%= render Ui::Button::Component.new(variant: :secondary) do %>Reset<% end %>
|
|
85
|
+
<% end %>
|
|
86
|
+
<% alert.with_title do %>Reset all settings?<% end %>
|
|
87
|
+
<% alert.with_description do %>This will restore all settings to their default values.<% end %>
|
|
88
|
+
<% alert.with_cancel do %>
|
|
89
|
+
<%= render Ui::Button::Component.new(variant: :outline) do %>Cancel<% end %>
|
|
90
|
+
<% end %>
|
|
91
|
+
<% alert.with_action do %>
|
|
92
|
+
<%= render Ui::Button::Component.new do %>Reset<% end %>
|
|
93
|
+
<% end %>
|
|
94
|
+
<% end %>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Avatar with image:
|
|
2
|
+
|
|
3
|
+
<%= render Ui::Avatar::Component.new(src: "/avatars/user.jpg", alt: "Jane Doe") %>
|
|
4
|
+
|
|
5
|
+
Fallback initials (auto-generated from alt):
|
|
6
|
+
|
|
7
|
+
<%= render Ui::Avatar::Component.new(alt: "Jane Doe") %>
|
|
8
|
+
|
|
9
|
+
Custom fallback:
|
|
10
|
+
|
|
11
|
+
<%= render Ui::Avatar::Component.new(fallback: "?") %>
|
|
12
|
+
|
|
13
|
+
Sizes (sm, md, lg):
|
|
14
|
+
|
|
15
|
+
<%= render Ui::Avatar::Component.new(alt: "Jane Doe", size: :sm) %>
|
|
16
|
+
<%= render Ui::Avatar::Component.new(alt: "Jane Doe", size: :lg) %>
|
|
17
|
+
|
|
18
|
+
With custom attributes:
|
|
19
|
+
|
|
20
|
+
<%= render Ui::Avatar::Component.new(alt: "Jane Doe", class: "extra", data: { tooltip: "User" }) %>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
* UikitRails — Avatar
|
|
3
|
+
*
|
|
4
|
+
* Sizes: sm, md, lg
|
|
5
|
+
* ============================================ */
|
|
6
|
+
|
|
7
|
+
.ui-avatar {
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
border-radius: 9999px;
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
vertical-align: middle;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ui-avatar__image {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
object-fit: cover;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ui-avatar__fallback {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 100%;
|
|
29
|
+
background-color: var(--ui-muted);
|
|
30
|
+
color: var(--ui-muted-foreground);
|
|
31
|
+
font-family: var(--ui-font-family);
|
|
32
|
+
font-weight: 500;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* --- Sizes --- */
|
|
36
|
+
|
|
37
|
+
.ui-avatar--sm {
|
|
38
|
+
width: 2rem;
|
|
39
|
+
height: 2rem;
|
|
40
|
+
font-size: var(--ui-font-size-xs);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ui-avatar--md {
|
|
44
|
+
width: 2.5rem;
|
|
45
|
+
height: 2.5rem;
|
|
46
|
+
font-size: var(--ui-font-size-sm);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ui-avatar--lg {
|
|
50
|
+
width: 3.5rem;
|
|
51
|
+
height: 3.5rem;
|
|
52
|
+
font-size: var(--ui-font-size-base);
|
|
53
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ui
|
|
4
|
+
module Avatar
|
|
5
|
+
# Circular avatar with image or fallback initials.
|
|
6
|
+
class Component < Ui::BaseComponent
|
|
7
|
+
SIZES = %i[sm md lg].freeze
|
|
8
|
+
|
|
9
|
+
attr_reader :src, :alt, :fallback, :size, :html_attrs
|
|
10
|
+
|
|
11
|
+
def initialize(src: nil, alt: "", fallback: nil, size: :md, **html_attrs)
|
|
12
|
+
@src = src
|
|
13
|
+
@alt = alt
|
|
14
|
+
@fallback = fallback || initials_from(alt)
|
|
15
|
+
@size = size.to_sym
|
|
16
|
+
@html_attrs = html_attrs
|
|
17
|
+
super()
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def computed_attrs
|
|
23
|
+
merge_attrs({ class: class_names("ui-avatar", "ui-avatar--#{size}") }, html_attrs)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def initials_from(name)
|
|
27
|
+
name.to_s.split(/\s+/).map { |w| w[0] }.first(2).join.upcase
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
description: A circular avatar that displays a user image or falls back to initials derived from the alt text.
|
|
2
|
+
|
|
3
|
+
sections:
|
|
4
|
+
- title: With Image
|
|
5
|
+
examples:
|
|
6
|
+
- title: Default (medium)
|
|
7
|
+
code: |
|
|
8
|
+
<%= render Ui::Avatar::Component.new(src: "https://i.pravatar.cc/80?u=jane", alt: "Jane Doe") %>
|
|
9
|
+
|
|
10
|
+
- title: Large with image
|
|
11
|
+
code: |
|
|
12
|
+
<%= render Ui::Avatar::Component.new(src: "https://i.pravatar.cc/80?u=john", alt: "John Smith", size: :lg) %>
|
|
13
|
+
|
|
14
|
+
- title: Fallback Initials
|
|
15
|
+
examples:
|
|
16
|
+
- title: Auto-generated initials from alt
|
|
17
|
+
code: |
|
|
18
|
+
<%= render Ui::Avatar::Component.new(alt: "Jane Doe") %>
|
|
19
|
+
|
|
20
|
+
- title: Custom fallback text
|
|
21
|
+
code: |
|
|
22
|
+
<%= render Ui::Avatar::Component.new(fallback: "?") %>
|
|
23
|
+
|
|
24
|
+
- title: Sizes
|
|
25
|
+
examples:
|
|
26
|
+
- title: Small
|
|
27
|
+
code: |
|
|
28
|
+
<%= render Ui::Avatar::Component.new(alt: "Alice Brown", size: :sm) %>
|
|
29
|
+
|
|
30
|
+
- title: Medium (default)
|
|
31
|
+
code: |
|
|
32
|
+
<%= render Ui::Avatar::Component.new(alt: "Alice Brown", size: :md) %>
|
|
33
|
+
|
|
34
|
+
- title: Large
|
|
35
|
+
code: |
|
|
36
|
+
<%= render Ui::Avatar::Component.new(alt: "Alice Brown", size: :lg) %>
|
|
37
|
+
|
|
38
|
+
- title: With Custom Attributes
|
|
39
|
+
examples:
|
|
40
|
+
- title: Custom class and data attributes
|
|
41
|
+
code: |
|
|
42
|
+
<%= render Ui::Avatar::Component.new(alt: "Jane Doe", class: "my-avatar", data: { controller: "tooltip" }) %>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Basic badge:
|
|
2
|
+
|
|
3
|
+
<%= render Ui::Badge::Component.new do %>Badge<% end %>
|
|
4
|
+
|
|
5
|
+
Variants (default, secondary, destructive, outline):
|
|
6
|
+
|
|
7
|
+
<%= render Ui::Badge::Component.new(variant: :secondary) do %>Secondary<% end %>
|
|
8
|
+
<%= render Ui::Badge::Component.new(variant: :destructive) do %>Error<% end %>
|
|
9
|
+
<%= render Ui::Badge::Component.new(variant: :outline) do %>Outline<% end %>
|
|
10
|
+
|
|
11
|
+
With custom attributes:
|
|
12
|
+
|
|
13
|
+
<%= render Ui::Badge::Component.new(class: "extra", data: { role: "status" }) do %>Custom<% end %>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
* UikitRails — Badge
|
|
3
|
+
*
|
|
4
|
+
* Variants: default, secondary, destructive, outline
|
|
5
|
+
* ============================================ */
|
|
6
|
+
|
|
7
|
+
.ui-badge {
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
white-space: nowrap;
|
|
11
|
+
font-family: var(--ui-font-family);
|
|
12
|
+
font-size: var(--ui-font-size-xs);
|
|
13
|
+
font-weight: 600;
|
|
14
|
+
line-height: 1;
|
|
15
|
+
padding: 0.25rem 0.625rem;
|
|
16
|
+
border: 1px solid transparent;
|
|
17
|
+
border-radius: 9999px;
|
|
18
|
+
transition:
|
|
19
|
+
background-color var(--ui-transition-speed) ease,
|
|
20
|
+
color var(--ui-transition-speed) ease;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ui-badge:focus-visible {
|
|
24
|
+
outline: 2px solid var(--ui-ring);
|
|
25
|
+
outline-offset: 2px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* --- Variants --- */
|
|
29
|
+
|
|
30
|
+
.ui-badge--default {
|
|
31
|
+
background-color: var(--ui-primary);
|
|
32
|
+
color: var(--ui-primary-foreground);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ui-badge--default:hover {
|
|
36
|
+
background-color: color-mix(in srgb, var(--ui-primary) 80%, transparent);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ui-badge--secondary {
|
|
40
|
+
background-color: var(--ui-secondary);
|
|
41
|
+
color: var(--ui-secondary-foreground);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ui-badge--secondary:hover {
|
|
45
|
+
background-color: color-mix(in srgb, var(--ui-secondary) 80%, transparent);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ui-badge--destructive {
|
|
49
|
+
background-color: var(--ui-destructive);
|
|
50
|
+
color: var(--ui-destructive-foreground);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ui-badge--destructive:hover {
|
|
54
|
+
background-color: color-mix(in srgb, var(--ui-destructive) 80%, transparent);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.ui-badge--outline {
|
|
58
|
+
border-color: var(--ui-border);
|
|
59
|
+
background-color: transparent;
|
|
60
|
+
color: var(--ui-foreground);
|
|
61
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ui
|
|
4
|
+
module Badge
|
|
5
|
+
# Small status indicator with variant styles.
|
|
6
|
+
class Component < Ui::BaseComponent
|
|
7
|
+
VARIANTS = %i[default secondary destructive outline].freeze
|
|
8
|
+
|
|
9
|
+
attr_reader :variant, :html_attrs
|
|
10
|
+
|
|
11
|
+
def initialize(variant: :default, **html_attrs)
|
|
12
|
+
@variant = variant.to_sym
|
|
13
|
+
@html_attrs = html_attrs
|
|
14
|
+
super()
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def call
|
|
18
|
+
content_tag(:span, content, **computed_attrs)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def computed_attrs
|
|
24
|
+
merge_attrs({ class: class_names("ui-badge", "ui-badge--#{variant}") }, html_attrs)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
description: A small status indicator rendered as a pill-shaped span with multiple variant styles.
|
|
2
|
+
|
|
3
|
+
sections:
|
|
4
|
+
- title: Variants
|
|
5
|
+
examples:
|
|
6
|
+
- title: Default
|
|
7
|
+
code: |
|
|
8
|
+
<%= render Ui::Badge::Component.new do %>Badge<% end %>
|
|
9
|
+
|
|
10
|
+
- title: Secondary
|
|
11
|
+
code: |
|
|
12
|
+
<%= render Ui::Badge::Component.new(variant: :secondary) do %>Secondary<% end %>
|
|
13
|
+
|
|
14
|
+
- title: Destructive
|
|
15
|
+
code: |
|
|
16
|
+
<%= render Ui::Badge::Component.new(variant: :destructive) do %>Destructive<% end %>
|
|
17
|
+
|
|
18
|
+
- title: Outline
|
|
19
|
+
code: |
|
|
20
|
+
<%= render Ui::Badge::Component.new(variant: :outline) do %>Outline<% end %>
|
|
21
|
+
|
|
22
|
+
- title: Usage Examples
|
|
23
|
+
examples:
|
|
24
|
+
- title: Status indicator
|
|
25
|
+
code: |
|
|
26
|
+
<%= render Ui::Badge::Component.new(variant: :secondary) do %>In Progress<% end %>
|
|
27
|
+
|
|
28
|
+
- title: Count badge
|
|
29
|
+
code: |
|
|
30
|
+
<%= render Ui::Badge::Component.new do %>3<% end %>
|
|
31
|
+
|
|
32
|
+
- title: With custom attributes
|
|
33
|
+
code: |
|
|
34
|
+
<%= render Ui::Badge::Component.new(
|
|
35
|
+
variant: :outline,
|
|
36
|
+
class: "my-custom-badge",
|
|
37
|
+
data: { role: "status" }
|
|
38
|
+
) do %>Custom<% end %>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Basic breadcrumb:
|
|
2
|
+
|
|
3
|
+
<%= render Ui::Breadcrumb::Component.new do |bc| %>
|
|
4
|
+
<% bc.with_item(href: "/") do %>Home<% end %>
|
|
5
|
+
<% bc.with_item(href: "/products") do %>Products<% end %>
|
|
6
|
+
<% bc.with_item(current: true) do %>Widget<% end %>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
Items with href render as links. Items without href (or with current: true) render as plain text.
|
|
10
|
+
|
|
11
|
+
Two-level breadcrumb:
|
|
12
|
+
|
|
13
|
+
<%= render Ui::Breadcrumb::Component.new do |bc| %>
|
|
14
|
+
<% bc.with_item(href: "/") do %>Home<% end %>
|
|
15
|
+
<% bc.with_item(current: true) do %>Dashboard<% end %>
|
|
16
|
+
<% end %>
|
|
17
|
+
|
|
18
|
+
With custom attributes:
|
|
19
|
+
|
|
20
|
+
<%= render Ui::Breadcrumb::Component.new(class: "my-nav", data: { controller: "breadcrumb" }) do |bc| %>
|
|
21
|
+
<% bc.with_item(href: "/") do %>Home<% end %>
|
|
22
|
+
<% bc.with_item(current: true) do %>Page<% end %>
|
|
23
|
+
<% end %>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
* UikitRails — Breadcrumb
|
|
3
|
+
*
|
|
4
|
+
* Navigation breadcrumb trail with chevron separators.
|
|
5
|
+
* ============================================ */
|
|
6
|
+
|
|
7
|
+
.ui-breadcrumb {
|
|
8
|
+
font-family: var(--ui-font-family);
|
|
9
|
+
font-size: var(--ui-font-size-sm);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.ui-breadcrumb__list {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 0.375rem;
|
|
16
|
+
list-style: none;
|
|
17
|
+
margin: 0;
|
|
18
|
+
padding: 0;
|
|
19
|
+
flex-wrap: wrap;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ui-breadcrumb__item {
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ui-breadcrumb__link {
|
|
28
|
+
color: var(--ui-muted-foreground);
|
|
29
|
+
text-decoration: none;
|
|
30
|
+
transition: color var(--ui-transition-speed) ease;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ui-breadcrumb__link:hover {
|
|
34
|
+
color: var(--ui-foreground);
|
|
35
|
+
text-decoration: underline;
|
|
36
|
+
text-underline-offset: 4px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ui-breadcrumb__link:focus-visible {
|
|
40
|
+
outline: 2px solid var(--ui-ring);
|
|
41
|
+
outline-offset: 2px;
|
|
42
|
+
border-radius: var(--ui-radius);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ui-breadcrumb__current {
|
|
46
|
+
color: var(--ui-foreground);
|
|
47
|
+
font-weight: 500;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ui-breadcrumb__separator {
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
color: var(--ui-muted-foreground);
|
|
54
|
+
list-style: none;
|
|
55
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<nav class="ui-breadcrumb" aria-label="Breadcrumb" <%= tag.attributes(html_attrs) %>>
|
|
2
|
+
<ol class="ui-breadcrumb__list">
|
|
3
|
+
<% items.each_with_index do |item, index| %>
|
|
4
|
+
<li class="ui-breadcrumb__item">
|
|
5
|
+
<%= item %>
|
|
6
|
+
</li>
|
|
7
|
+
<% unless index == items.size - 1 %>
|
|
8
|
+
<li class="ui-breadcrumb__separator" aria-hidden="true">
|
|
9
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>
|
|
10
|
+
</li>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% end %>
|
|
13
|
+
</ol>
|
|
14
|
+
</nav>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ui
|
|
4
|
+
module Breadcrumb
|
|
5
|
+
# Navigation breadcrumb trail.
|
|
6
|
+
class Component < Ui::BaseComponent
|
|
7
|
+
renders_many :items, lambda { |href: nil, current: false, **html_attrs|
|
|
8
|
+
Item.new(href: href, current: current, **html_attrs)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
attr_reader :html_attrs
|
|
12
|
+
|
|
13
|
+
def initialize(**html_attrs)
|
|
14
|
+
@html_attrs = html_attrs
|
|
15
|
+
super()
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Individual breadcrumb entry — renders as a link or current-page span.
|
|
19
|
+
class Item < Ui::BaseComponent
|
|
20
|
+
attr_reader :href, :current, :html_attrs
|
|
21
|
+
|
|
22
|
+
def initialize(href: nil, current: false, **html_attrs)
|
|
23
|
+
@href = href
|
|
24
|
+
@current = current
|
|
25
|
+
@html_attrs = html_attrs
|
|
26
|
+
super()
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def call
|
|
30
|
+
if href && !current
|
|
31
|
+
content_tag(:a, content, class: "ui-breadcrumb__link", href: href, **html_attrs)
|
|
32
|
+
else
|
|
33
|
+
content_tag(:span, content, class: "ui-breadcrumb__current", "aria-current": ("page" if current),
|
|
34
|
+
**html_attrs)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
description: A navigation breadcrumb trail showing the current page location within a hierarchy. Items can be links or plain text for the current page.
|
|
2
|
+
|
|
3
|
+
sections:
|
|
4
|
+
- title: Basic Breadcrumb
|
|
5
|
+
examples:
|
|
6
|
+
- title: Simple breadcrumb trail
|
|
7
|
+
code: |
|
|
8
|
+
<%= render Ui::Breadcrumb::Component.new do |bc| %>
|
|
9
|
+
<% bc.with_item(href: "/") do %>Home<% end %>
|
|
10
|
+
<% bc.with_item(href: "/products") do %>Products<% end %>
|
|
11
|
+
<% bc.with_item(current: true) do %>Widget<% end %>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
- title: Two Levels
|
|
15
|
+
examples:
|
|
16
|
+
- title: Short breadcrumb
|
|
17
|
+
code: |
|
|
18
|
+
<%= render Ui::Breadcrumb::Component.new do |bc| %>
|
|
19
|
+
<% bc.with_item(href: "/") do %>Home<% end %>
|
|
20
|
+
<% bc.with_item(current: true) do %>Dashboard<% end %>
|
|
21
|
+
<% end %>
|
|
22
|
+
|
|
23
|
+
- title: Deep Navigation
|
|
24
|
+
examples:
|
|
25
|
+
- title: Multiple levels
|
|
26
|
+
code: |
|
|
27
|
+
<%= render Ui::Breadcrumb::Component.new do |bc| %>
|
|
28
|
+
<% bc.with_item(href: "/") do %>Home<% end %>
|
|
29
|
+
<% bc.with_item(href: "/settings") do %>Settings<% end %>
|
|
30
|
+
<% bc.with_item(href: "/settings/account") do %>Account<% end %>
|
|
31
|
+
<% bc.with_item(current: true) do %>Security<% end %>
|
|
32
|
+
<% end %>
|
|
33
|
+
|
|
34
|
+
- title: All Links
|
|
35
|
+
examples:
|
|
36
|
+
- title: Without current marker
|
|
37
|
+
code: |
|
|
38
|
+
<%= render Ui::Breadcrumb::Component.new do |bc| %>
|
|
39
|
+
<% bc.with_item(href: "/") do %>Home<% end %>
|
|
40
|
+
<% bc.with_item(href: "/docs") do %>Documentation<% end %>
|
|
41
|
+
<% bc.with_item(href: "/docs/components") do %>Components<% end %>
|
|
42
|
+
<% end %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Basic button:
|
|
2
|
+
|
|
3
|
+
<%= render Ui::Button::Component.new do %>Click me<% end %>
|
|
4
|
+
|
|
5
|
+
Variants (default, destructive, outline, secondary, ghost, link):
|
|
6
|
+
|
|
7
|
+
<%= render Ui::Button::Component.new(variant: :destructive) do %>Delete<% end %>
|
|
8
|
+
<%= render Ui::Button::Component.new(variant: :outline) do %>Cancel<% end %>
|
|
9
|
+
|
|
10
|
+
Sizes (sm, md, lg, icon):
|
|
11
|
+
|
|
12
|
+
<%= render Ui::Button::Component.new(size: :sm) do %>Small<% end %>
|
|
13
|
+
<%= render Ui::Button::Component.new(size: :lg) do %>Large<% end %>
|
|
14
|
+
|
|
15
|
+
As a link:
|
|
16
|
+
|
|
17
|
+
<%= render Ui::Button::Component.new(tag: :a, href: "/path") do %>Go somewhere<% end %>
|
|
18
|
+
|
|
19
|
+
With custom attributes:
|
|
20
|
+
|
|
21
|
+
<%= render Ui::Button::Component.new(class: "extra", data: { turbo: false }) do %>Custom<% end %>
|