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,412 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>UikitRails — Styleguide</title>
|
|
7
|
+
|
|
8
|
+
<%# Load the host app's design tokens and component CSS %>
|
|
9
|
+
<% if Rails.root.join("app/assets/stylesheets/uikit_rails.css").exist? %>
|
|
10
|
+
<%= stylesheet_link_tag "uikit_rails" %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% Dir.glob(Rails.root.join("app/assets/stylesheets/ui/**/*.css")).sort.each do |css_file| %>
|
|
13
|
+
<%= stylesheet_link_tag "ui/#{File.basename(css_file, '.css')}" %>
|
|
14
|
+
<% end %>
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
/* ============================================
|
|
18
|
+
* Styleguide chrome — fully self-contained
|
|
19
|
+
* ============================================ */
|
|
20
|
+
*, *::before, *::after { box-sizing: border-box; }
|
|
21
|
+
|
|
22
|
+
body.uikit-rails-styleguide {
|
|
23
|
+
margin: 0;
|
|
24
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
25
|
+
background: #f8f9fb;
|
|
26
|
+
color: #1a1a2e;
|
|
27
|
+
display: flex;
|
|
28
|
+
min-height: 100vh;
|
|
29
|
+
-webkit-font-smoothing: antialiased;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* --- Sidebar --- */
|
|
33
|
+
.sg-sidebar {
|
|
34
|
+
width: 260px;
|
|
35
|
+
background: #ffffff;
|
|
36
|
+
border-right: 1px solid #e5e7eb;
|
|
37
|
+
position: fixed;
|
|
38
|
+
top: 0;
|
|
39
|
+
left: 0;
|
|
40
|
+
bottom: 0;
|
|
41
|
+
overflow-y: auto;
|
|
42
|
+
z-index: 40;
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.sg-sidebar-brand {
|
|
48
|
+
padding: 1.5rem 1.5rem 1.25rem;
|
|
49
|
+
font-size: 1.125rem;
|
|
50
|
+
font-weight: 700;
|
|
51
|
+
color: #0f172a;
|
|
52
|
+
border-bottom: 1px solid #e5e7eb;
|
|
53
|
+
text-decoration: none;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
gap: 0.5rem;
|
|
57
|
+
letter-spacing: -0.01em;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.sg-sidebar-brand span { color: #6366f1; }
|
|
61
|
+
|
|
62
|
+
.sg-sidebar-brand small {
|
|
63
|
+
font-size: 0.625rem;
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
color: #94a3b8;
|
|
66
|
+
background: #f1f5f9;
|
|
67
|
+
padding: 0.125rem 0.5rem;
|
|
68
|
+
border-radius: 9999px;
|
|
69
|
+
letter-spacing: 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.sg-sidebar-section {
|
|
73
|
+
padding: 1rem 0.75rem;
|
|
74
|
+
flex: 1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.sg-sidebar-label {
|
|
78
|
+
font-size: 0.6875rem;
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
text-transform: uppercase;
|
|
81
|
+
letter-spacing: 0.06em;
|
|
82
|
+
color: #94a3b8;
|
|
83
|
+
padding: 0.375rem 0.75rem;
|
|
84
|
+
margin-bottom: 0.25rem;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.sg-sidebar-link {
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
gap: 0.5rem;
|
|
91
|
+
padding: 0.5rem 0.75rem;
|
|
92
|
+
border-radius: 0.5rem;
|
|
93
|
+
font-size: 0.875rem;
|
|
94
|
+
color: #475569;
|
|
95
|
+
text-decoration: none;
|
|
96
|
+
transition: all 120ms ease;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.sg-sidebar-link:hover {
|
|
100
|
+
background: #f1f5f9;
|
|
101
|
+
color: #0f172a;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.sg-sidebar-link.active {
|
|
105
|
+
background: #6366f1;
|
|
106
|
+
color: #ffffff;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.sg-sidebar-link svg {
|
|
110
|
+
width: 16px;
|
|
111
|
+
height: 16px;
|
|
112
|
+
opacity: 0.5;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.sg-sidebar-link.active svg { opacity: 1; }
|
|
116
|
+
|
|
117
|
+
/* --- Main content --- */
|
|
118
|
+
.sg-main {
|
|
119
|
+
margin-left: 260px;
|
|
120
|
+
flex: 1;
|
|
121
|
+
padding: 2.5rem 3rem;
|
|
122
|
+
min-width: 0;
|
|
123
|
+
max-width: 960px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.sg-header h1 {
|
|
127
|
+
font-size: 2rem;
|
|
128
|
+
font-weight: 700;
|
|
129
|
+
margin: 0 0 0.25rem;
|
|
130
|
+
text-transform: capitalize;
|
|
131
|
+
letter-spacing: -0.02em;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.sg-header p {
|
|
135
|
+
color: #64748b;
|
|
136
|
+
margin: 0 0 2rem;
|
|
137
|
+
font-size: 0.9375rem;
|
|
138
|
+
line-height: 1.5;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* --- Component grid (index page) --- */
|
|
142
|
+
.sg-grid {
|
|
143
|
+
display: grid;
|
|
144
|
+
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
|
145
|
+
gap: 1rem;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.sg-component-card {
|
|
149
|
+
background: #ffffff;
|
|
150
|
+
border: 1px solid #e5e7eb;
|
|
151
|
+
border-radius: 0.75rem;
|
|
152
|
+
padding: 1.75rem 1.25rem;
|
|
153
|
+
text-decoration: none;
|
|
154
|
+
color: inherit;
|
|
155
|
+
transition: all 180ms ease;
|
|
156
|
+
display: flex;
|
|
157
|
+
flex-direction: column;
|
|
158
|
+
align-items: center;
|
|
159
|
+
gap: 0.75rem;
|
|
160
|
+
text-align: center;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.sg-component-card:hover {
|
|
164
|
+
border-color: #6366f1;
|
|
165
|
+
box-shadow: 0 4px 16px rgba(99, 102, 241, 0.08);
|
|
166
|
+
transform: translateY(-2px);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.sg-component-icon {
|
|
170
|
+
width: 44px;
|
|
171
|
+
height: 44px;
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
justify-content: center;
|
|
175
|
+
border-radius: 0.625rem;
|
|
176
|
+
background: #f1f5f9;
|
|
177
|
+
color: #6366f1;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.sg-component-name {
|
|
181
|
+
font-weight: 600;
|
|
182
|
+
font-size: 0.9375rem;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.sg-badge {
|
|
186
|
+
display: inline-flex;
|
|
187
|
+
padding: 0.125rem 0.5rem;
|
|
188
|
+
border-radius: 9999px;
|
|
189
|
+
font-size: 0.6875rem;
|
|
190
|
+
font-weight: 500;
|
|
191
|
+
background: #e0e7ff;
|
|
192
|
+
color: #4338ca;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* --- Show page: sections & examples --- */
|
|
196
|
+
.sg-section {
|
|
197
|
+
margin-bottom: 2.5rem;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.sg-section-title {
|
|
201
|
+
font-size: 1.125rem;
|
|
202
|
+
font-weight: 600;
|
|
203
|
+
margin: 0 0 1rem;
|
|
204
|
+
color: #0f172a;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.sg-examples {
|
|
208
|
+
display: flex;
|
|
209
|
+
flex-direction: column;
|
|
210
|
+
gap: 1rem;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.sg-example-card {
|
|
214
|
+
background: #ffffff;
|
|
215
|
+
border: 1px solid #e5e7eb;
|
|
216
|
+
border-radius: 0.75rem;
|
|
217
|
+
overflow: hidden;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.sg-example-label {
|
|
221
|
+
padding: 0.625rem 1rem;
|
|
222
|
+
font-size: 0.8125rem;
|
|
223
|
+
font-weight: 500;
|
|
224
|
+
color: #64748b;
|
|
225
|
+
border-bottom: 1px solid #f1f5f9;
|
|
226
|
+
background: #fafbfc;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.sg-example-preview {
|
|
230
|
+
padding: 2rem 1.5rem;
|
|
231
|
+
display: flex;
|
|
232
|
+
flex-wrap: wrap;
|
|
233
|
+
gap: 0.75rem;
|
|
234
|
+
align-items: center;
|
|
235
|
+
min-height: 4.5rem;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.sg-example-code-wrapper {
|
|
239
|
+
border-top: 1px solid #e5e7eb;
|
|
240
|
+
background: #1e293b;
|
|
241
|
+
position: relative;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.sg-example-code-header {
|
|
245
|
+
display: flex;
|
|
246
|
+
align-items: center;
|
|
247
|
+
justify-content: space-between;
|
|
248
|
+
padding: 0.5rem 1rem;
|
|
249
|
+
border-bottom: 1px solid rgba(255,255,255,0.06);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.sg-example-code-header span {
|
|
253
|
+
font-size: 0.6875rem;
|
|
254
|
+
font-weight: 600;
|
|
255
|
+
text-transform: uppercase;
|
|
256
|
+
letter-spacing: 0.05em;
|
|
257
|
+
color: #94a3b8;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.sg-copy-btn {
|
|
261
|
+
display: inline-flex;
|
|
262
|
+
align-items: center;
|
|
263
|
+
gap: 0.375rem;
|
|
264
|
+
padding: 0.25rem 0.625rem;
|
|
265
|
+
border: 1px solid rgba(255,255,255,0.1);
|
|
266
|
+
border-radius: 0.375rem;
|
|
267
|
+
background: rgba(255,255,255,0.05);
|
|
268
|
+
color: #94a3b8;
|
|
269
|
+
font-size: 0.75rem;
|
|
270
|
+
font-weight: 500;
|
|
271
|
+
cursor: pointer;
|
|
272
|
+
transition: all 120ms ease;
|
|
273
|
+
font-family: inherit;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.sg-copy-btn:hover {
|
|
277
|
+
background: rgba(255,255,255,0.1);
|
|
278
|
+
color: #e2e8f0;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.sg-copy-btn.copied {
|
|
282
|
+
color: #4ade80;
|
|
283
|
+
border-color: rgba(74, 222, 128, 0.3);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.sg-example-code {
|
|
287
|
+
margin: 0;
|
|
288
|
+
padding: 1rem;
|
|
289
|
+
overflow-x: auto;
|
|
290
|
+
font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
|
|
291
|
+
font-size: 0.8125rem;
|
|
292
|
+
line-height: 1.6;
|
|
293
|
+
color: #e2e8f0;
|
|
294
|
+
tab-size: 2;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.sg-example-code code {
|
|
298
|
+
font-family: inherit;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/* --- Empty state --- */
|
|
302
|
+
.sg-empty {
|
|
303
|
+
text-align: center;
|
|
304
|
+
padding: 4rem 2rem;
|
|
305
|
+
color: #94a3b8;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.sg-empty code {
|
|
309
|
+
display: inline-block;
|
|
310
|
+
margin-top: 0.75rem;
|
|
311
|
+
padding: 0.5rem 1rem;
|
|
312
|
+
background: #f1f5f9;
|
|
313
|
+
border-radius: 0.375rem;
|
|
314
|
+
font-size: 0.875rem;
|
|
315
|
+
color: #475569;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* --- Install command card --- */
|
|
319
|
+
.sg-install-card {
|
|
320
|
+
display: flex;
|
|
321
|
+
align-items: center;
|
|
322
|
+
justify-content: space-between;
|
|
323
|
+
gap: 1rem;
|
|
324
|
+
background: #1e293b;
|
|
325
|
+
border-radius: 0.75rem;
|
|
326
|
+
padding: 0.875rem 1rem 0.875rem 1.25rem;
|
|
327
|
+
margin-bottom: 2rem;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.sg-install-inner {
|
|
331
|
+
display: flex;
|
|
332
|
+
align-items: center;
|
|
333
|
+
gap: 0.75rem;
|
|
334
|
+
min-width: 0;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.sg-install-prompt {
|
|
338
|
+
color: #4ade80;
|
|
339
|
+
font-family: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
|
|
340
|
+
font-weight: 600;
|
|
341
|
+
font-size: 0.875rem;
|
|
342
|
+
flex-shrink: 0;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.sg-install-cmd {
|
|
346
|
+
font-family: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
|
|
347
|
+
font-size: 0.875rem;
|
|
348
|
+
color: #e2e8f0;
|
|
349
|
+
white-space: nowrap;
|
|
350
|
+
overflow: hidden;
|
|
351
|
+
text-overflow: ellipsis;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.sg-copy-btn--light {
|
|
355
|
+
border-color: rgba(255,255,255,0.15);
|
|
356
|
+
background: rgba(255,255,255,0.08);
|
|
357
|
+
flex-shrink: 0;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.sg-copy-btn--light:hover {
|
|
361
|
+
background: rgba(255,255,255,0.14);
|
|
362
|
+
color: #e2e8f0;
|
|
363
|
+
}
|
|
364
|
+
</style>
|
|
365
|
+
|
|
366
|
+
<%# Load the host app's JavaScript (Stimulus controllers, etc.) %>
|
|
367
|
+
<% if respond_to?(:javascript_importmap_tags) %>
|
|
368
|
+
<%= javascript_importmap_tags %>
|
|
369
|
+
<% elsif respond_to?(:javascript_include_tag) %>
|
|
370
|
+
<%= javascript_include_tag "application", "data-turbo-track": "reload" rescue nil %>
|
|
371
|
+
<% end %>
|
|
372
|
+
|
|
373
|
+
<script>
|
|
374
|
+
function uikitRailsCopy(button) {
|
|
375
|
+
var code = button.getAttribute("data-code");
|
|
376
|
+
var label = button.querySelector(".sg-copy-label");
|
|
377
|
+
|
|
378
|
+
navigator.clipboard.writeText(code).then(function() {
|
|
379
|
+
button.classList.add("copied");
|
|
380
|
+
label.textContent = "Copied!";
|
|
381
|
+
setTimeout(function() {
|
|
382
|
+
button.classList.remove("copied");
|
|
383
|
+
label.textContent = "Copy";
|
|
384
|
+
}, 2000);
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
</script>
|
|
388
|
+
</head>
|
|
389
|
+
<body class="uikit-rails-styleguide">
|
|
390
|
+
<nav class="sg-sidebar">
|
|
391
|
+
<%= link_to uikit_rails.root_path, class: "sg-sidebar-brand" do %>
|
|
392
|
+
Uikit<span>Rails</span>
|
|
393
|
+
<small>styleguide</small>
|
|
394
|
+
<% end %>
|
|
395
|
+
|
|
396
|
+
<div class="sg-sidebar-section">
|
|
397
|
+
<div class="sg-sidebar-label">Components</div>
|
|
398
|
+
<% @components.each do |name| %>
|
|
399
|
+
<%= link_to uikit_rails.component_path(component: name),
|
|
400
|
+
class: "sg-sidebar-link #{'active' if defined?(@component) && @component == name}" do %>
|
|
401
|
+
<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"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="m10 8 4 4-4 4"/></svg>
|
|
402
|
+
<%= name.titleize %>
|
|
403
|
+
<% end %>
|
|
404
|
+
<% end %>
|
|
405
|
+
</div>
|
|
406
|
+
</nav>
|
|
407
|
+
|
|
408
|
+
<main class="sg-main">
|
|
409
|
+
<%= yield %>
|
|
410
|
+
</main>
|
|
411
|
+
</body>
|
|
412
|
+
</html>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<div class="sg-header">
|
|
2
|
+
<h1>Components</h1>
|
|
3
|
+
<p><%= @components.size %> component<%= @components.size == 1 ? "" : "s" %> installed — click any to see live previews and copy code.</p>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<% if @components.any? %>
|
|
7
|
+
<div class="sg-grid">
|
|
8
|
+
<% @components.each do |name| %>
|
|
9
|
+
<% preview_path = Rails.root.join("app/components/ui", name, "preview.yml") %>
|
|
10
|
+
<% has_preview = preview_path.exist? %>
|
|
11
|
+
<%= link_to uikit_rails.component_path(component: name), class: "sg-component-card" do %>
|
|
12
|
+
<div class="sg-component-icon">
|
|
13
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="m10 8 4 4-4 4"/></svg>
|
|
14
|
+
</div>
|
|
15
|
+
<span class="sg-component-name"><%= name.titleize %></span>
|
|
16
|
+
<% if has_preview %>
|
|
17
|
+
<span class="sg-badge">Preview</span>
|
|
18
|
+
<% end %>
|
|
19
|
+
<% end %>
|
|
20
|
+
<% end %>
|
|
21
|
+
</div>
|
|
22
|
+
<% else %>
|
|
23
|
+
<div class="sg-empty">
|
|
24
|
+
<p>No components installed yet.</p>
|
|
25
|
+
<code>rails generate uikit_rails:add button</code>
|
|
26
|
+
</div>
|
|
27
|
+
<% end %>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<div class="sg-header">
|
|
2
|
+
<h1><%= @component %></h1>
|
|
3
|
+
<% if @description.present? %>
|
|
4
|
+
<p><%= @description %></p>
|
|
5
|
+
<% end %>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<% install_cmd = "rails generate uikit_rails:add #{@component}" %>
|
|
9
|
+
<div class="sg-install-card">
|
|
10
|
+
<div class="sg-install-inner">
|
|
11
|
+
<span class="sg-install-prompt">$</span>
|
|
12
|
+
<code class="sg-install-cmd"><%= install_cmd %></code>
|
|
13
|
+
</div>
|
|
14
|
+
<button class="sg-copy-btn sg-copy-btn--light" onclick="uikitRailsCopy(this)" data-code="<%= install_cmd %>">
|
|
15
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>
|
|
16
|
+
<span class="sg-copy-label">Copy</span>
|
|
17
|
+
</button>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<% if @sections.any? %>
|
|
21
|
+
<% @sections.each do |section| %>
|
|
22
|
+
<div class="sg-section">
|
|
23
|
+
<h2 class="sg-section-title"><%= section[:title] %></h2>
|
|
24
|
+
|
|
25
|
+
<div class="sg-examples">
|
|
26
|
+
<% section[:examples].each do |example| %>
|
|
27
|
+
<div class="sg-example-card">
|
|
28
|
+
<% if example[:title].present? %>
|
|
29
|
+
<div class="sg-example-label"><%= example[:title] %></div>
|
|
30
|
+
<% end %>
|
|
31
|
+
|
|
32
|
+
<div class="sg-example-preview">
|
|
33
|
+
<%= raw example[:rendered] %>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div class="sg-example-code-wrapper">
|
|
37
|
+
<div class="sg-example-code-header">
|
|
38
|
+
<span>ERB</span>
|
|
39
|
+
<button class="sg-copy-btn" onclick="uikitRailsCopy(this)" data-code="<%= ERB::Util.html_escape(example[:code]) %>">
|
|
40
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>
|
|
41
|
+
<span class="sg-copy-label">Copy</span>
|
|
42
|
+
</button>
|
|
43
|
+
</div>
|
|
44
|
+
<pre class="sg-example-code"><code><%= ERB::Util.html_escape(example[:code]) %></code></pre>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<% end %>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<% end %>
|
|
51
|
+
<% else %>
|
|
52
|
+
<div class="sg-empty">
|
|
53
|
+
<p>No preview available for this component.</p>
|
|
54
|
+
<p style="margin-top: 0.5rem;">Add a <code>preview.yml</code> file to <code>app/components/ui/<%= @component %>/</code></p>
|
|
55
|
+
</div>
|
|
56
|
+
<% end %>
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UikitRails
|
|
4
|
+
# Mountable engine providing the component styleguide UI.
|
|
5
|
+
class Engine < ::Rails::Engine
|
|
6
|
+
isolate_namespace UikitRails
|
|
7
|
+
|
|
8
|
+
generators do
|
|
9
|
+
require_relative "generators/install_generator"
|
|
10
|
+
require_relative "generators/add_generator"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/generators"
|
|
4
|
+
|
|
5
|
+
module UikitRails
|
|
6
|
+
module Generators
|
|
7
|
+
# Copies individual UI components into the host Rails application.
|
|
8
|
+
class AddGenerator < Rails::Generators::Base
|
|
9
|
+
argument :components, type: :array, required: false, default: [],
|
|
10
|
+
banner: "component [component ...]"
|
|
11
|
+
class_option :all, type: :boolean, default: false,
|
|
12
|
+
desc: "Install all available components"
|
|
13
|
+
|
|
14
|
+
desc "Add UikitRails components to your application"
|
|
15
|
+
|
|
16
|
+
def verify_installation
|
|
17
|
+
return if File.exist?(File.join(destination_root, "app/components/ui/base_component.rb"))
|
|
18
|
+
|
|
19
|
+
raise Error, "UikitRails is not installed. Run `rails generate uikit_rails:install` first."
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def copy_components
|
|
23
|
+
names = options[:all] ? UikitRails::COMPONENTS : components
|
|
24
|
+
if names.empty?
|
|
25
|
+
say_status :error, "Specify components or use --all", :red
|
|
26
|
+
say "Usage: rails generate uikit_rails:add button card input"
|
|
27
|
+
say " rails generate uikit_rails:add --all"
|
|
28
|
+
return
|
|
29
|
+
end
|
|
30
|
+
@installing_multiple = names.size > 1
|
|
31
|
+
names.each { |name| copy_component(name) }
|
|
32
|
+
print_summary(names) if @installing_multiple
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
def copy_component(name)
|
|
38
|
+
return report_unknown(name) unless UikitRails.component_exists?(name)
|
|
39
|
+
return if already_exists?(name)
|
|
40
|
+
|
|
41
|
+
say_status :add, name, :green
|
|
42
|
+
copy_component_files(name)
|
|
43
|
+
copy_stimulus_controller(name)
|
|
44
|
+
print_component_usage(name) unless @installing_multiple
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def report_unknown(name)
|
|
48
|
+
say_status :error, "Unknown component: #{name}", :red
|
|
49
|
+
say "Available components: #{UikitRails.available_components.join(", ")}"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def already_exists?(name)
|
|
53
|
+
target_dir = File.join(destination_root, "app/components/ui", name)
|
|
54
|
+
return false unless File.exist?(target_dir)
|
|
55
|
+
return false if @installing_multiple
|
|
56
|
+
|
|
57
|
+
answer = ask("Component '#{name}' already exists. Overwrite? [y/N]")
|
|
58
|
+
!answer.downcase.start_with?("y")
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def copy_component_files(name)
|
|
62
|
+
source_dir = UikitRails.component_path(name)
|
|
63
|
+
target_dir = File.join("app/components/ui", name)
|
|
64
|
+
|
|
65
|
+
Dir.glob(File.join(source_dir, "**", "*")).each do |file|
|
|
66
|
+
next if File.directory?(file) || File.basename(file) == "USAGE"
|
|
67
|
+
|
|
68
|
+
relative = file.sub("#{source_dir}/", "")
|
|
69
|
+
target = target_path_for(relative, target_dir)
|
|
70
|
+
create_file target, File.read(file), force: true
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def target_path_for(relative, component_dir)
|
|
75
|
+
if relative.end_with?(".css")
|
|
76
|
+
File.join("app/assets/stylesheets/ui", relative)
|
|
77
|
+
else
|
|
78
|
+
File.join(component_dir, relative)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def copy_stimulus_controller(name)
|
|
83
|
+
stimulus_dir = File.join(UikitRails.templates_root, "stimulus")
|
|
84
|
+
stimulus_source = File.join(stimulus_dir, "#{name}_controller.js")
|
|
85
|
+
return unless File.exist?(stimulus_source)
|
|
86
|
+
|
|
87
|
+
target = File.join("app/javascript/controllers/ui", "#{name}_controller.js")
|
|
88
|
+
create_file target, File.read(stimulus_source), force: true
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def print_component_usage(name)
|
|
92
|
+
usage_file = File.join(UikitRails.component_path(name), "USAGE")
|
|
93
|
+
return unless File.exist?(usage_file)
|
|
94
|
+
|
|
95
|
+
say ""
|
|
96
|
+
say "Usage:", :yellow
|
|
97
|
+
say File.read(usage_file)
|
|
98
|
+
say ""
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def print_summary(names)
|
|
102
|
+
say ""
|
|
103
|
+
say "#{names.size} components installed!", :green
|
|
104
|
+
say "View usage for any component: rails generate uikit_rails:add <component> --help"
|
|
105
|
+
say "Browse the styleguide at your mounted path (e.g. /ui)"
|
|
106
|
+
say ""
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/generators"
|
|
4
|
+
|
|
5
|
+
module UikitRails
|
|
6
|
+
module Generators
|
|
7
|
+
# Sets up UikitRails in a Rails app: base component, design tokens CSS.
|
|
8
|
+
class InstallGenerator < Rails::Generators::Base
|
|
9
|
+
source_root File.expand_path("templates", __dir__)
|
|
10
|
+
|
|
11
|
+
desc "Install UikitRails into your Rails application"
|
|
12
|
+
|
|
13
|
+
def check_prerequisites
|
|
14
|
+
return if File.exist?(File.join(destination_root, "Gemfile"))
|
|
15
|
+
|
|
16
|
+
raise Error, "This generator must be run from a Rails application root"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def create_directories
|
|
20
|
+
empty_directory "app/components/ui"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def create_base_component
|
|
24
|
+
template "base_component.rb.tt", "app/components/ui/base_component.rb"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def create_base_styles
|
|
28
|
+
template "uikit_rails.css.tt", "app/assets/stylesheets/uikit_rails.css"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def print_post_install
|
|
32
|
+
say ""
|
|
33
|
+
say "UikitRails installed successfully!", :green
|
|
34
|
+
say ""
|
|
35
|
+
print_next_steps
|
|
36
|
+
print_available_components
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def print_next_steps
|
|
42
|
+
say "Next steps:", :yellow
|
|
43
|
+
say " 1. Import the base styles in your application stylesheet:"
|
|
44
|
+
say ""
|
|
45
|
+
say " For Sprockets: *= require uikit_rails"
|
|
46
|
+
say " For Propshaft: @import 'uikit_rails';"
|
|
47
|
+
say ""
|
|
48
|
+
say " 2. Add components:"
|
|
49
|
+
say " rails generate uikit_rails:add button"
|
|
50
|
+
say ""
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def print_available_components
|
|
54
|
+
say "Available components:", :yellow
|
|
55
|
+
UikitRails.available_components.each do |component|
|
|
56
|
+
say " - #{component}"
|
|
57
|
+
end
|
|
58
|
+
say ""
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|