velvetkit 0.2.2 → 0.4.0
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 +4 -4
- data/CHANGELOG.md +80 -0
- data/README.md +30 -8
- data/lib/generators/velvetkit/add/add_generator.rb +77 -0
- data/lib/generators/velvetkit/helpers.rb +29 -2
- data/lib/generators/velvetkit/icons/icons_generator.rb +71 -0
- data/lib/generators/velvetkit/install/install_generator.rb +9 -12
- data/lib/velvetkit/icons.rb +148 -0
- data/lib/velvetkit/registry.rb +5 -2
- data/lib/velvetkit/version.rb +4 -1
- data/lib/velvetkit.rb +8 -0
- data/registry/app/assets/tailwind/velvetkit.css +90 -155
- data/registry/app/components/ui/alert.rb +1 -1
- data/registry/app/components/ui/chart.html.erb +47 -0
- data/registry/app/components/ui/chart.rb +177 -0
- data/registry/app/components/ui/command/group.rb +27 -0
- data/registry/app/components/ui/command/item.rb +64 -0
- data/registry/app/components/ui/command.html.erb +41 -0
- data/registry/app/components/ui/command.rb +122 -0
- data/registry/app/components/ui/confirm_dialog.html.erb +13 -0
- data/registry/app/components/ui/confirm_dialog.rb +55 -0
- data/registry/app/components/ui/date_picker.html.erb +58 -64
- data/registry/app/components/ui/date_picker.rb +199 -75
- data/registry/app/components/ui/empty_state.html.erb +20 -0
- data/registry/app/components/ui/empty_state.rb +46 -0
- data/registry/app/components/ui/file_field.html.erb +14 -4
- data/registry/app/components/ui/file_field.rb +179 -28
- data/registry/app/components/ui/gallery/image.rb +20 -0
- data/registry/app/components/ui/gallery.html.erb +52 -0
- data/registry/app/components/ui/gallery.rb +164 -0
- data/registry/app/components/ui/icon.html.erb +1 -1
- data/registry/app/components/ui/icon.rb +80 -8
- data/registry/app/components/ui/kbd.html.erb +27 -0
- data/registry/app/components/ui/kbd.rb +134 -0
- data/registry/app/components/ui/number_input.html.erb +11 -0
- data/registry/app/components/ui/number_input.rb +103 -0
- data/registry/app/components/ui/password_input.html.erb +1 -1
- data/registry/app/components/ui/progress/segment.rb +25 -0
- data/registry/app/components/ui/progress.html.erb +25 -0
- data/registry/app/components/ui/progress.rb +182 -0
- data/registry/app/components/ui/select.html.erb +24 -5
- data/registry/app/components/ui/select.rb +44 -5
- data/registry/app/components/ui/stepper/step.html.erb +27 -0
- data/registry/app/components/ui/stepper/step.rb +213 -0
- data/registry/app/components/ui/stepper.html.erb +19 -0
- data/registry/app/components/ui/stepper.rb +145 -0
- data/registry/app/components/ui/theme_toggle.rb +2 -4
- data/registry/app/components/ui/timeline/item.html.erb +21 -0
- data/registry/app/components/ui/timeline/item.rb +145 -0
- data/registry/app/components/ui/timeline.html.erb +1 -0
- data/registry/app/components/ui/timeline.rb +42 -0
- data/registry/app/components/ui/toast.rb +6 -6
- data/registry/app/components/ui/toggle_group/item.html.erb +1 -0
- data/registry/app/components/ui/toggle_group/item.rb +85 -0
- data/registry/app/components/ui/toggle_group.html.erb +1 -0
- data/registry/app/components/ui/toggle_group.rb +79 -0
- data/registry/app/javascript/chart_js.ts +37 -0
- data/registry/app/javascript/controllers/ui/_internal/date_format.ts +74 -0
- data/registry/app/javascript/controllers/ui/_internal/shortcut.ts +80 -0
- data/registry/app/javascript/controllers/ui/chart_controller.ts +585 -0
- data/registry/app/javascript/controllers/ui/command_controller.ts +454 -0
- data/registry/app/javascript/controllers/ui/confirm_dialog_controller.ts +110 -0
- data/registry/app/javascript/controllers/ui/date_picker_controller.ts +247 -82
- data/registry/app/javascript/controllers/ui/file_field_controller.ts +288 -16
- data/registry/app/javascript/controllers/ui/gallery_controller.ts +568 -0
- data/registry/app/javascript/controllers/ui/kbd_controller.ts +60 -0
- data/registry/app/javascript/controllers/ui/number_input_controller.ts +111 -0
- data/registry/app/javascript/controllers/ui/progress_controller.ts +87 -0
- data/registry/app/javascript/controllers/ui/select_controller.ts +198 -8
- data/registry/app/javascript/controllers/ui/stepper_controller.ts +187 -0
- data/registry/app/javascript/vanilla_calendar.ts +15 -0
- data/registry/components.yml +28 -5
- data/registry/config/locales/velvetkit.en.yml +84 -0
- data/registry/docs/agents.md +7 -4
- data/registry/icons/lucide/LICENSE +39 -0
- data/registry/icons/lucide/align-center.svg +17 -0
- data/registry/icons/lucide/align-left.svg +17 -0
- data/registry/icons/lucide/align-right.svg +17 -0
- data/registry/icons/lucide/arrow-left.svg +16 -0
- data/registry/icons/lucide/arrow-right.svg +16 -0
- data/registry/icons/lucide/badge-check.svg +16 -0
- data/registry/icons/lucide/bar-chart-3.svg +18 -0
- data/registry/icons/lucide/bell.svg +16 -0
- data/registry/icons/lucide/bold.svg +15 -0
- data/registry/icons/lucide/book-open.svg +16 -0
- data/registry/icons/lucide/calendar.svg +18 -0
- data/registry/icons/lucide/chart-column.svg +18 -0
- data/registry/icons/lucide/check.svg +15 -0
- data/registry/icons/lucide/chevron-down.svg +15 -0
- data/registry/icons/lucide/chevron-left.svg +15 -0
- data/registry/icons/lucide/chevron-right.svg +15 -0
- data/registry/icons/lucide/chevrons-up-down.svg +16 -0
- data/registry/icons/lucide/circle-alert.svg +17 -0
- data/registry/icons/lucide/circle-check.svg +16 -0
- data/registry/icons/lucide/cloud.svg +15 -0
- data/registry/icons/lucide/credit-card.svg +16 -0
- data/registry/icons/lucide/download.svg +17 -0
- data/registry/icons/lucide/ellipsis-vertical.svg +17 -0
- data/registry/icons/lucide/ellipsis.svg +17 -0
- data/registry/icons/lucide/eye-off.svg +18 -0
- data/registry/icons/lucide/eye.svg +16 -0
- data/registry/icons/lucide/file-plus.svg +18 -0
- data/registry/icons/lucide/file-text.svg +19 -0
- data/registry/icons/lucide/file.svg +16 -0
- data/registry/icons/lucide/folder-kanban.svg +18 -0
- data/registry/icons/lucide/folder.svg +15 -0
- data/registry/icons/lucide/git-branch.svg +18 -0
- data/registry/icons/lucide/globe.svg +17 -0
- data/registry/icons/lucide/graduation-cap.svg +17 -0
- data/registry/icons/lucide/grip-vertical.svg +20 -0
- data/registry/icons/lucide/home.svg +16 -0
- data/registry/icons/lucide/inbox.svg +16 -0
- data/registry/icons/lucide/info.svg +17 -0
- data/registry/icons/lucide/italic.svg +17 -0
- data/registry/icons/lucide/keyboard.svg +23 -0
- data/registry/icons/lucide/layout-dashboard.svg +18 -0
- data/registry/icons/lucide/layout-grid.svg +18 -0
- data/registry/icons/lucide/life-buoy.svg +20 -0
- data/registry/icons/lucide/list.svg +20 -0
- data/registry/icons/lucide/loader.svg +22 -0
- data/registry/icons/lucide/lock.svg +16 -0
- data/registry/icons/lucide/log-out.svg +17 -0
- data/registry/icons/lucide/mail.svg +16 -0
- data/registry/icons/lucide/menu.svg +17 -0
- data/registry/icons/lucide/message-circle.svg +15 -0
- data/registry/icons/lucide/minus.svg +15 -0
- data/registry/icons/lucide/monitor.svg +17 -0
- data/registry/icons/lucide/moon.svg +15 -0
- data/registry/icons/lucide/newspaper.svg +18 -0
- data/registry/icons/lucide/package.svg +18 -0
- data/registry/icons/lucide/panel-left.svg +16 -0
- data/registry/icons/lucide/pause.svg +16 -0
- data/registry/icons/lucide/percent.svg +17 -0
- data/registry/icons/lucide/plus.svg +16 -0
- data/registry/icons/lucide/printer.svg +17 -0
- data/registry/icons/lucide/qr-code.svg +26 -0
- data/registry/icons/lucide/receipt.svg +17 -0
- data/registry/icons/lucide/rocket.svg +18 -0
- data/registry/icons/lucide/rotate-cw.svg +16 -0
- data/registry/icons/lucide/search.svg +16 -0
- data/registry/icons/lucide/settings.svg +16 -0
- data/registry/icons/lucide/shield-check.svg +16 -0
- data/registry/icons/lucide/shield.svg +15 -0
- data/registry/icons/lucide/store.svg +17 -0
- data/registry/icons/lucide/sun-moon.svg +19 -0
- data/registry/icons/lucide/sun.svg +23 -0
- data/registry/icons/lucide/trash-2.svg +19 -0
- data/registry/icons/lucide/truck.svg +19 -0
- data/registry/icons/lucide/underline.svg +16 -0
- data/registry/icons/lucide/upload.svg +17 -0
- data/registry/icons/lucide/user-plus.svg +18 -0
- data/registry/icons/lucide/user.svg +16 -0
- data/registry/icons/lucide/users.svg +18 -0
- data/registry/icons/lucide/workflow.svg +17 -0
- data/registry/icons/lucide/x.svg +16 -0
- data/registry/icons/lucide/zoom-in.svg +18 -0
- data/registry/icons/lucide/zoom-out.svg +17 -0
- data/registry/icons/phosphor/LICENSE +21 -0
- data/registry/icons/phosphor/arrow-clockwise.svg +2 -0
- data/registry/icons/phosphor/arrow-left.svg +2 -0
- data/registry/icons/phosphor/arrow-right.svg +2 -0
- data/registry/icons/phosphor/bell.svg +2 -0
- data/registry/icons/phosphor/book-open.svg +2 -0
- data/registry/icons/phosphor/calendar-blank.svg +2 -0
- data/registry/icons/phosphor/caret-down.svg +2 -0
- data/registry/icons/phosphor/caret-left.svg +2 -0
- data/registry/icons/phosphor/caret-right.svg +2 -0
- data/registry/icons/phosphor/caret-up-down.svg +2 -0
- data/registry/icons/phosphor/chart-bar.svg +2 -0
- data/registry/icons/phosphor/chat-circle.svg +2 -0
- data/registry/icons/phosphor/check-circle.svg +2 -0
- data/registry/icons/phosphor/check.svg +2 -0
- data/registry/icons/phosphor/circle-half.svg +2 -0
- data/registry/icons/phosphor/cloud.svg +2 -0
- data/registry/icons/phosphor/credit-card.svg +2 -0
- data/registry/icons/phosphor/desktop.svg +2 -0
- data/registry/icons/phosphor/dots-six-vertical.svg +2 -0
- data/registry/icons/phosphor/dots-three-vertical.svg +2 -0
- data/registry/icons/phosphor/dots-three.svg +2 -0
- data/registry/icons/phosphor/download-simple.svg +2 -0
- data/registry/icons/phosphor/envelope.svg +2 -0
- data/registry/icons/phosphor/eye-slash.svg +2 -0
- data/registry/icons/phosphor/eye.svg +2 -0
- data/registry/icons/phosphor/file-plus.svg +2 -0
- data/registry/icons/phosphor/file-text.svg +2 -0
- data/registry/icons/phosphor/file.svg +2 -0
- data/registry/icons/phosphor/flow-arrow.svg +2 -0
- data/registry/icons/phosphor/folder.svg +2 -0
- data/registry/icons/phosphor/gear.svg +2 -0
- data/registry/icons/phosphor/git-branch.svg +2 -0
- data/registry/icons/phosphor/globe.svg +2 -0
- data/registry/icons/phosphor/graduation-cap.svg +2 -0
- data/registry/icons/phosphor/grid-four.svg +2 -0
- data/registry/icons/phosphor/house.svg +2 -0
- data/registry/icons/phosphor/info.svg +2 -0
- data/registry/icons/phosphor/kanban.svg +2 -0
- data/registry/icons/phosphor/keyboard.svg +2 -0
- data/registry/icons/phosphor/lifebuoy.svg +2 -0
- data/registry/icons/phosphor/list.svg +2 -0
- data/registry/icons/phosphor/lock.svg +2 -0
- data/registry/icons/phosphor/magnifying-glass-minus.svg +2 -0
- data/registry/icons/phosphor/magnifying-glass-plus.svg +2 -0
- data/registry/icons/phosphor/magnifying-glass.svg +2 -0
- data/registry/icons/phosphor/minus.svg +2 -0
- data/registry/icons/phosphor/moon.svg +2 -0
- data/registry/icons/phosphor/newspaper.svg +2 -0
- data/registry/icons/phosphor/package.svg +2 -0
- data/registry/icons/phosphor/pause.svg +2 -0
- data/registry/icons/phosphor/percent.svg +2 -0
- data/registry/icons/phosphor/plus.svg +2 -0
- data/registry/icons/phosphor/printer.svg +2 -0
- data/registry/icons/phosphor/qr-code.svg +2 -0
- data/registry/icons/phosphor/receipt.svg +2 -0
- data/registry/icons/phosphor/rocket.svg +2 -0
- data/registry/icons/phosphor/seal-check.svg +2 -0
- data/registry/icons/phosphor/shield-check.svg +2 -0
- data/registry/icons/phosphor/shield.svg +2 -0
- data/registry/icons/phosphor/sidebar.svg +2 -0
- data/registry/icons/phosphor/sign-out.svg +2 -0
- data/registry/icons/phosphor/spinner.svg +2 -0
- data/registry/icons/phosphor/squares-four.svg +2 -0
- data/registry/icons/phosphor/storefront.svg +2 -0
- data/registry/icons/phosphor/sun.svg +2 -0
- data/registry/icons/phosphor/text-align-center.svg +2 -0
- data/registry/icons/phosphor/text-align-left.svg +2 -0
- data/registry/icons/phosphor/text-align-right.svg +2 -0
- data/registry/icons/phosphor/text-b.svg +2 -0
- data/registry/icons/phosphor/text-italic.svg +2 -0
- data/registry/icons/phosphor/text-underline.svg +2 -0
- data/registry/icons/phosphor/trash.svg +2 -0
- data/registry/icons/phosphor/tray.svg +2 -0
- data/registry/icons/phosphor/truck.svg +2 -0
- data/registry/icons/phosphor/upload-simple.svg +2 -0
- data/registry/icons/phosphor/user-plus.svg +2 -0
- data/registry/icons/phosphor/user.svg +2 -0
- data/registry/icons/phosphor/users.svg +2 -0
- data/registry/icons/phosphor/warning-circle.svg +2 -0
- data/registry/icons/phosphor/x.svg +2 -0
- data/registry/icons/tabler/LICENSE +21 -0
- data/registry/icons/tabler/alert-circle.svg +18 -0
- data/registry/icons/tabler/align-center.svg +18 -0
- data/registry/icons/tabler/align-left.svg +18 -0
- data/registry/icons/tabler/align-right.svg +18 -0
- data/registry/icons/tabler/arrow-left.svg +18 -0
- data/registry/icons/tabler/arrow-right.svg +18 -0
- data/registry/icons/tabler/bell.svg +17 -0
- data/registry/icons/tabler/bold.svg +17 -0
- data/registry/icons/tabler/book.svg +20 -0
- data/registry/icons/tabler/building-store.svg +20 -0
- data/registry/icons/tabler/calendar.svg +21 -0
- data/registry/icons/tabler/chart-bar.svg +19 -0
- data/registry/icons/tabler/check.svg +16 -0
- data/registry/icons/tabler/chevron-down.svg +16 -0
- data/registry/icons/tabler/chevron-left.svg +16 -0
- data/registry/icons/tabler/chevron-right.svg +16 -0
- data/registry/icons/tabler/circle-check.svg +17 -0
- data/registry/icons/tabler/cloud.svg +16 -0
- data/registry/icons/tabler/credit-card.svg +19 -0
- data/registry/icons/tabler/device-desktop.svg +19 -0
- data/registry/icons/tabler/dots-vertical.svg +18 -0
- data/registry/icons/tabler/dots.svg +18 -0
- data/registry/icons/tabler/download.svg +18 -0
- data/registry/icons/tabler/eye-off.svg +18 -0
- data/registry/icons/tabler/eye.svg +17 -0
- data/registry/icons/tabler/file-plus.svg +19 -0
- data/registry/icons/tabler/file-text.svg +20 -0
- data/registry/icons/tabler/file.svg +17 -0
- data/registry/icons/tabler/folder.svg +16 -0
- data/registry/icons/tabler/git-branch.svg +21 -0
- data/registry/icons/tabler/grip-vertical.svg +21 -0
- data/registry/icons/tabler/home.svg +18 -0
- data/registry/icons/tabler/inbox.svg +17 -0
- data/registry/icons/tabler/info-circle.svg +18 -0
- data/registry/icons/tabler/italic.svg +18 -0
- data/registry/icons/tabler/keyboard.svg +23 -0
- data/registry/icons/tabler/layout-dashboard.svg +19 -0
- data/registry/icons/tabler/layout-grid.svg +19 -0
- data/registry/icons/tabler/layout-kanban.svg +19 -0
- data/registry/icons/tabler/layout-sidebar.svg +17 -0
- data/registry/icons/tabler/lifebuoy.svg +21 -0
- data/registry/icons/tabler/list.svg +21 -0
- data/registry/icons/tabler/loader.svg +23 -0
- data/registry/icons/tabler/lock.svg +18 -0
- data/registry/icons/tabler/logout.svg +18 -0
- data/registry/icons/tabler/mail.svg +17 -0
- data/registry/icons/tabler/menu-2.svg +18 -0
- data/registry/icons/tabler/message-circle.svg +16 -0
- data/registry/icons/tabler/minus.svg +16 -0
- data/registry/icons/tabler/moon.svg +16 -0
- data/registry/icons/tabler/news.svg +19 -0
- data/registry/icons/tabler/package.svg +20 -0
- data/registry/icons/tabler/percentage.svg +18 -0
- data/registry/icons/tabler/player-pause.svg +17 -0
- data/registry/icons/tabler/plus.svg +17 -0
- data/registry/icons/tabler/printer.svg +18 -0
- data/registry/icons/tabler/qrcode.svg +27 -0
- data/registry/icons/tabler/receipt.svg +16 -0
- data/registry/icons/tabler/rocket.svg +18 -0
- data/registry/icons/tabler/rosette-discount-check.svg +17 -0
- data/registry/icons/tabler/rotate-clockwise.svg +16 -0
- data/registry/icons/tabler/school.svg +17 -0
- data/registry/icons/tabler/search.svg +17 -0
- data/registry/icons/tabler/selector.svg +17 -0
- data/registry/icons/tabler/settings.svg +17 -0
- data/registry/icons/tabler/shield-check.svg +17 -0
- data/registry/icons/tabler/shield.svg +16 -0
- data/registry/icons/tabler/sitemap.svg +20 -0
- data/registry/icons/tabler/sun-moon.svg +21 -0
- data/registry/icons/tabler/sun.svg +17 -0
- data/registry/icons/tabler/trash.svg +20 -0
- data/registry/icons/tabler/truck.svg +18 -0
- data/registry/icons/tabler/underline.svg +17 -0
- data/registry/icons/tabler/upload.svg +18 -0
- data/registry/icons/tabler/user-plus.svg +19 -0
- data/registry/icons/tabler/user.svg +17 -0
- data/registry/icons/tabler/users.svg +19 -0
- data/registry/icons/tabler/world.svg +20 -0
- data/registry/icons/tabler/x.svg +17 -0
- data/registry/icons/tabler/zoom-in.svg +19 -0
- data/registry/icons/tabler/zoom-out.svg +18 -0
- data/registry/icons.yml +90 -0
- data/registry/test/components/previews/ui/chart_preview/cash_flow.html.erb +6 -0
- data/registry/test/components/previews/ui/chart_preview/donut.html.erb +6 -0
- data/registry/test/components/previews/ui/chart_preview/margin.html.erb +6 -0
- data/registry/test/components/previews/ui/chart_preview/pie.html.erb +6 -0
- data/registry/test/components/previews/ui/chart_preview/sales.html.erb +6 -0
- data/registry/test/components/previews/ui/chart_preview/stock.html.erb +6 -0
- data/registry/test/components/previews/ui/chart_preview/takings.html.erb +8 -0
- data/registry/test/components/previews/ui/chart_preview.rb +46 -0
- data/registry/test/components/previews/ui/command_preview/_picked.html.erb +14 -0
- data/registry/test/components/previews/ui/command_preview/dialog.html.erb +24 -0
- data/registry/test/components/previews/ui/command_preview/inline.html.erb +16 -0
- data/registry/test/components/previews/ui/command_preview/playground.html.erb +15 -0
- data/registry/test/components/previews/ui/command_preview/server_search.html.erb +24 -0
- data/registry/test/components/previews/ui/command_preview/shortcuts.html.erb +12 -0
- data/registry/test/components/previews/ui/command_preview/till.html.erb +17 -0
- data/registry/test/components/previews/ui/command_preview.rb +25 -0
- data/registry/test/components/previews/ui/confirm_dialog_preview/destructive.html.erb +7 -0
- data/registry/test/components/previews/ui/confirm_dialog_preview/in_form.html.erb +6 -0
- data/registry/test/components/previews/ui/confirm_dialog_preview/on_link.html.erb +5 -0
- data/registry/test/components/previews/ui/confirm_dialog_preview/plain.html.erb +3 -0
- data/registry/test/components/previews/ui/confirm_dialog_preview/with_description.html.erb +4 -0
- data/registry/test/components/previews/ui/confirm_dialog_preview.rb +20 -0
- data/registry/test/components/previews/ui/date_picker_preview/custom_presets.html.erb +6 -0
- data/registry/test/components/previews/ui/date_picker_preview/in_form.html.erb +11 -0
- data/registry/test/components/previews/ui/date_picker_preview/range.html.erb +5 -0
- data/registry/test/components/previews/ui/date_picker_preview/states.html.erb +4 -3
- data/registry/test/components/previews/ui/date_picker_preview.rb +26 -6
- data/registry/test/components/previews/ui/empty_state_preview/in_card.html.erb +7 -0
- data/registry/test/components/previews/ui/empty_state_preview/no_results.html.erb +3 -0
- data/registry/test/components/previews/ui/empty_state_preview/outline.html.erb +3 -0
- data/registry/test/components/previews/ui/empty_state_preview/with_actions.html.erb +4 -0
- data/registry/test/components/previews/ui/empty_state_preview/with_media.html.erb +8 -0
- data/registry/test/components/previews/ui/empty_state_preview.rb +26 -0
- data/registry/test/components/previews/ui/file_field_preview/multiple_files.html.erb +1 -1
- data/registry/test/components/previews/ui/file_field_preview/product_photos.html.erb +12 -0
- data/registry/test/components/previews/ui/file_field_preview/single_image.html.erb +4 -0
- data/registry/test/components/previews/ui/file_field_preview.rb +32 -5
- data/registry/test/components/previews/ui/gallery_preview/hover_zoom.html.erb +13 -0
- data/registry/test/components/previews/ui/gallery_preview/landscape.html.erb +5 -0
- data/registry/test/components/previews/ui/gallery_preview/product_page.html.erb +13 -0
- data/registry/test/components/previews/ui/gallery_preview/single.html.erb +3 -0
- data/registry/test/components/previews/ui/gallery_preview.rb +45 -0
- data/registry/test/components/previews/ui/icon_preview/common.html.erb +19 -3
- data/registry/test/components/previews/ui/icon_preview/labelled.html.erb +4 -0
- data/registry/test/components/previews/ui/icon_preview/missing.html.erb +3 -0
- data/registry/test/components/previews/ui/icon_preview.rb +18 -3
- data/registry/test/components/previews/ui/input_group_preview/playground.html.erb +2 -2
- data/registry/test/components/previews/ui/input_group_preview.rb +3 -3
- data/registry/test/components/previews/ui/kbd_preview/bound.html.erb +20 -0
- data/registry/test/components/previews/ui/kbd_preview/keys.html.erb +13 -0
- data/registry/test/components/previews/ui/kbd_preview/menu.html.erb +13 -0
- data/registry/test/components/previews/ui/kbd_preview/search_field.html.erb +8 -0
- data/registry/test/components/previews/ui/kbd_preview/shortcuts_list.html.erb +17 -0
- data/registry/test/components/previews/ui/kbd_preview/till.html.erb +23 -0
- data/registry/test/components/previews/ui/kbd_preview/tooltip_and_buttons.html.erb +14 -0
- data/registry/test/components/previews/ui/kbd_preview.rb +32 -0
- data/registry/test/components/previews/ui/number_input_preview/cart.html.erb +11 -0
- data/registry/test/components/previews/ui/number_input_preview/decimals.html.erb +4 -0
- data/registry/test/components/previews/ui/number_input_preview/sizes.html.erb +5 -0
- data/registry/test/components/previews/ui/number_input_preview/states.html.erb +7 -0
- data/registry/test/components/previews/ui/number_input_preview/stock_adjustment.html.erb +3 -0
- data/registry/test/components/previews/ui/number_input_preview.rb +36 -0
- data/registry/test/components/previews/ui/progress_preview/file_upload.html.erb +36 -0
- data/registry/test/components/previews/ui/progress_preview/free_shipping.html.erb +4 -0
- data/registry/test/components/previews/ui/progress_preview/indeterminate.html.erb +4 -0
- data/registry/test/components/previews/ui/progress_preview/sizes_and_tones.html.erb +8 -0
- data/registry/test/components/previews/ui/progress_preview/steps.html.erb +9 -0
- data/registry/test/components/previews/ui/progress_preview/storage.html.erb +8 -0
- data/registry/test/components/previews/ui/progress_preview/storage_by_category.html.erb +7 -0
- data/registry/test/components/previews/ui/progress_preview/tasks_by_status.html.erb +14 -0
- data/registry/test/components/previews/ui/progress_preview/traffic_by_source.html.erb +15 -0
- data/registry/test/components/previews/ui/progress_preview.rb +46 -0
- data/registry/test/components/previews/ui/select_preview/server_search.html.erb +22 -0
- data/registry/test/components/previews/ui/select_preview.rb +5 -0
- data/registry/test/components/previews/ui/stepper_preview/approvals.html.erb +9 -0
- data/registry/test/components/previews/ui/stepper_preview/checklist.html.erb +12 -0
- data/registry/test/components/previews/ui/stepper_preview/dot_wizard.html.erb +41 -0
- data/registry/test/components/previews/ui/stepper_preview/failed_deploy.html.erb +13 -0
- data/registry/test/components/previews/ui/stepper_preview/inline.html.erb +31 -0
- data/registry/test/components/previews/ui/stepper_preview/onboarding.html.erb +12 -0
- data/registry/test/components/previews/ui/stepper_preview/order_tracking.html.erb +10 -0
- data/registry/test/components/previews/ui/stepper_preview/price_calculator.html.erb +14 -0
- data/registry/test/components/previews/ui/stepper_preview/server_driven.html.erb +20 -0
- data/registry/test/components/previews/ui/stepper_preview/sidebar.html.erb +43 -0
- data/registry/test/components/previews/ui/stepper_preview/wizard.html.erb +55 -0
- data/registry/test/components/previews/ui/stepper_preview.rb +57 -0
- data/registry/test/components/previews/ui/timeline_preview/activity_log.html.erb +7 -0
- data/registry/test/components/previews/ui/timeline_preview/colored.html.erb +7 -0
- data/registry/test/components/previews/ui/timeline_preview/colored_by_meaning.html.erb +7 -0
- data/registry/test/components/previews/ui/timeline_preview/failed_delivery.html.erb +6 -0
- data/registry/test/components/previews/ui/timeline_preview/order_status.html.erb +9 -0
- data/registry/test/components/previews/ui/timeline_preview/real_dates.html.erb +5 -0
- data/registry/test/components/previews/ui/timeline_preview/stock_history.html.erb +6 -0
- data/registry/test/components/previews/ui/timeline_preview.rb +40 -0
- data/registry/test/components/previews/ui/toggle_group_preview/icon_only.html.erb +5 -0
- data/registry/test/components/previews/ui/toggle_group_preview/in_form.html.erb +11 -0
- data/registry/test/components/previews/ui/toggle_group_preview/multiple.html.erb +5 -0
- data/registry/test/components/previews/ui/toggle_group_preview/outline.html.erb +5 -0
- data/registry/test/components/previews/ui/toggle_group_preview/sizes.html.erb +9 -0
- data/registry/test/components/previews/ui/toggle_group_preview/with_icons.html.erb +5 -0
- data/registry/test/components/previews/ui/toggle_group_preview.rb +36 -0
- data/registry/test/components/ui/accordion/trigger_test.rb +1 -1
- data/registry/test/components/ui/alert_test.rb +10 -10
- data/registry/test/components/ui/badge_test.rb +3 -3
- data/registry/test/components/ui/banner_test.rb +3 -3
- data/registry/test/components/ui/breadcrumb/ellipsis_test.rb +2 -2
- data/registry/test/components/ui/button_test.rb +17 -14
- data/registry/test/components/ui/button_to_test.rb +2 -2
- data/registry/test/components/ui/chart_test.rb +187 -0
- data/registry/test/components/ui/checkbox_test.rb +2 -2
- data/registry/test/components/ui/command/group_test.rb +19 -0
- data/registry/test/components/ui/command/item_test.rb +47 -0
- data/registry/test/components/ui/command_test.rb +110 -0
- data/registry/test/components/ui/confirm_dialog_test.rb +68 -0
- data/registry/test/components/ui/date_picker_test.rb +129 -111
- data/registry/test/components/ui/empty_state_test.rb +87 -0
- data/registry/test/components/ui/file_field_test.rb +105 -9
- data/registry/test/components/ui/gallery_test.rb +192 -0
- data/registry/test/components/ui/icon_test.rb +60 -20
- data/registry/test/components/ui/input_group_test.rb +1 -1
- data/registry/test/components/ui/kbd_test.rb +150 -0
- data/registry/test/components/ui/link_test.rb +3 -3
- data/registry/test/components/ui/navigation_menu_test.rb +2 -2
- data/registry/test/components/ui/number_input_test.rb +155 -0
- data/registry/test/components/ui/progress_test.rb +188 -0
- data/registry/test/components/ui/select_test.rb +62 -0
- data/registry/test/components/ui/session_tabs_test.rb +3 -3
- data/registry/test/components/ui/spinner_test.rb +9 -9
- data/registry/test/components/ui/stepper_test.rb +239 -0
- data/registry/test/components/ui/tabs/trigger_test.rb +2 -2
- data/registry/test/components/ui/theme_toggle_test.rb +6 -8
- data/registry/test/components/ui/timeline_test.rb +175 -0
- data/registry/test/components/ui/toast_test.rb +11 -10
- data/registry/test/components/ui/toggle_group_test.rb +162 -0
- metadata +399 -3
- data/registry/app/javascript/cally.ts +0 -8
- data/registry/app/javascript/velvetkit_icons.ts +0 -78
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "securerandom"
|
|
4
|
+
|
|
5
|
+
# A search box over everything you can do or go to: pages, actions, and, with
|
|
6
|
+
# `url:`, records from the server. Type to narrow it, arrows to move, Enter to
|
|
7
|
+
# go. On a page as it is, or `dialog: true` for the ⌘K kind, over the page.
|
|
8
|
+
#
|
|
9
|
+
# <%= render(UI::Command.new(dialog: true, url: search_path)) do |command| %>
|
|
10
|
+
# <% command.with_trigger %>
|
|
11
|
+
# <% command.with_group(heading: "Pages") do |group| %>
|
|
12
|
+
# <% group.with_item(label: "Dashboard", href: dashboard_path, icon: "house") %>
|
|
13
|
+
# <% group.with_item(label: "Settings", href: settings_path, icon: "settings", shortcut: "mod+,") %>
|
|
14
|
+
# <% end %>
|
|
15
|
+
# <% command.with_group(heading: "Actions") do |group| %>
|
|
16
|
+
# <% group.with_item(label: "New invoice", value: "new-invoice", icon: "plus", keywords: "create bill") %>
|
|
17
|
+
# <% end %>
|
|
18
|
+
# <% end %>
|
|
19
|
+
#
|
|
20
|
+
# An item with `href:` is visited (with Turbo when it's there; ⌘ or Ctrl+Enter
|
|
21
|
+
# opens a new tab). Every pick fires `ui--command:select` with its value,
|
|
22
|
+
# label and href first; cancel it to handle the pick yourself.
|
|
23
|
+
#
|
|
24
|
+
# Typing filters the items on the page by label and `keywords:`, best matches
|
|
25
|
+
# first, every word counting. With `url:` it also asks the server, as UI::Select
|
|
26
|
+
# does: GET url?q=… returning [{ label, href, value, description, group }],
|
|
27
|
+
# listed under `group`, or "Results". Searches are spaced out, a slow one shows
|
|
28
|
+
# a spinner, and answers are remembered for a minute.
|
|
29
|
+
#
|
|
30
|
+
# The dialog opens on `shortcut:` (mod+k) from anywhere on the page, from the
|
|
31
|
+
# trigger, or from any element with data-action="ui--command#open" inside it.
|
|
32
|
+
# `shortcut:` can be a list, like ["mod+k", "/"]; the trigger shows the first.
|
|
33
|
+
#
|
|
34
|
+
# `sort_groups: true` puts the group with the best match first, so a strong
|
|
35
|
+
# match isn't buried under a weak one in an earlier group. `empty:` says what
|
|
36
|
+
# to show when nothing matches. After each search it fires
|
|
37
|
+
# `ui--command:search` with the query and how many items match, for
|
|
38
|
+
# analytics, say.
|
|
39
|
+
class UI::Command < UI::Base
|
|
40
|
+
renders_many :groups, "UI::Command::Group"
|
|
41
|
+
|
|
42
|
+
# The button that opens the dialog: "Search…" and the shortcut, unless a
|
|
43
|
+
# block says otherwise. Takes UI::Button's options.
|
|
44
|
+
renders_one :trigger, lambda { |label: nil, **opts, &block|
|
|
45
|
+
content = block ? view_context.capture(&block) : default_trigger_content(label)
|
|
46
|
+
actions = [ "ui--command#open", opts.dig(:data, :action) ].compact.join(" ")
|
|
47
|
+
render(UI::Button.new(variant: :outline, **opts,
|
|
48
|
+
class: cn("justify-between gap-6 font-normal text-muted-foreground", opts[:class]),
|
|
49
|
+
aria: { haspopup: "dialog", **(opts[:aria] || {}) },
|
|
50
|
+
data: { **(opts[:data] || {}), action: actions })) { content }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# The dialog sits near the top, where the eye already is, and doesn't jump
|
|
54
|
+
# as the list shrinks.
|
|
55
|
+
DIALOG = "fixed inset-0 m-0 p-0 max-w-none max-h-none w-full h-full bg-transparent border-0 overflow-visible " \
|
|
56
|
+
"open:flex open:items-start open:justify-center open:px-4 open:pt-[12vh] " \
|
|
57
|
+
"backdrop:bg-black/50 backdrop:backdrop-blur-[1px]"
|
|
58
|
+
|
|
59
|
+
PANEL = "flex w-full flex-col overflow-hidden rounded-lg border bg-popover text-popover-foreground"
|
|
60
|
+
|
|
61
|
+
def initialize(placeholder: nil, dialog: false, shortcut: "mod+k", url: nil, param: "q", results_heading: nil,
|
|
62
|
+
label: nil, empty: nil, sort_groups: false, class: nil, **html_attrs)
|
|
63
|
+
@placeholder = placeholder
|
|
64
|
+
@dialog = dialog
|
|
65
|
+
@shortcuts = Array(shortcut).map(&:to_s).reject(&:empty?)
|
|
66
|
+
@empty = empty
|
|
67
|
+
@sort_groups = sort_groups
|
|
68
|
+
@url = url
|
|
69
|
+
@param = param
|
|
70
|
+
@results_heading = results_heading
|
|
71
|
+
@label = label
|
|
72
|
+
@user_class = binding.local_variable_get(:class)
|
|
73
|
+
@html_attrs = html_attrs
|
|
74
|
+
@id = html_attrs[:id] || "ui-command-#{SecureRandom.hex(4)}"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
attr_reader :id
|
|
78
|
+
|
|
79
|
+
# The one the trigger shows.
|
|
80
|
+
def shortcut = @shortcuts.first
|
|
81
|
+
|
|
82
|
+
def dialog? = @dialog
|
|
83
|
+
def remote? = @url.present?
|
|
84
|
+
|
|
85
|
+
def listbox_id = "#{id}-list"
|
|
86
|
+
def input_id = "#{id}-input"
|
|
87
|
+
|
|
88
|
+
def placeholder = @placeholder || t("ui.command.placeholder", default: "Type a command or search…")
|
|
89
|
+
def label = @label || t("ui.command.label", default: "Command menu")
|
|
90
|
+
def results_heading = @results_heading || t("ui.command.results", default: "Results")
|
|
91
|
+
|
|
92
|
+
def root_attrs
|
|
93
|
+
{ **@html_attrs.except(:id), id: id, class: cn(!dialog? && "w-full", @user_class),
|
|
94
|
+
data: { controller: "ui--command", **controller_values, **(@html_attrs[:data] || {}) } }
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def panel_class = cn(PANEL, dialog? ? "max-w-xl shadow-2xl max-h-[min(32rem,76vh)]" : "shadow-sm")
|
|
98
|
+
|
|
99
|
+
private
|
|
100
|
+
|
|
101
|
+
def default_trigger_content(label)
|
|
102
|
+
safe_join([
|
|
103
|
+
tag.span(class: "flex items-center gap-2") do
|
|
104
|
+
safe_join([ render(UI::Icon.new(name: "search", size: :sm)), label || t("ui.command.trigger", default: "Search…") ])
|
|
105
|
+
end,
|
|
106
|
+
(render(UI::Kbd.new(shortcut, size: :sm)) if shortcut)
|
|
107
|
+
])
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def controller_values
|
|
111
|
+
# Shortcuts never have spaces ("space" is the key), so they're listed with them.
|
|
112
|
+
values = { "ui--command-dialog-value": dialog?, "ui--command-shortcut-value": (dialog? ? @shortcuts.join(" ") : ""),
|
|
113
|
+
"ui--command-sort-groups-value": @sort_groups,
|
|
114
|
+
"ui--command-empty-value": @empty || t("ui.command.empty", default: "No results found."),
|
|
115
|
+
"ui--command-searching-value": t("ui.command.searching", default: "Searching…"),
|
|
116
|
+
"ui--command-failed-value": t("ui.command.failed", default: "Couldn't search. Try again.") }
|
|
117
|
+
return values unless remote?
|
|
118
|
+
|
|
119
|
+
values.merge("ui--command-url-value": @url, "ui--command-param-value": @param,
|
|
120
|
+
"ui--command-results-heading-value": results_heading)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%= tag.dialog(**dialog_attrs) do %>
|
|
2
|
+
<%= tag.form method: "dialog", class: PANEL, data: { state: "closed", "ui--confirm-dialog-target": "panel" } do %>
|
|
3
|
+
<div class="flex flex-col gap-2 text-center sm:text-left">
|
|
4
|
+
<%= tag.h2 id: title_id, class: "text-lg font-semibold leading-none tracking-tight", data: { "ui--confirm-dialog-target": "title" } %>
|
|
5
|
+
<%= tag.p id: description_id, hidden: true, class: "text-sm text-muted-foreground", data: { "ui--confirm-dialog-target": "description" } %>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end">
|
|
8
|
+
<%= render(UI::Button.new(type: :submit, variant: :outline, value: "cancel", autofocus: true, data: { "ui--confirm-dialog-target": "cancel" })) { cancel_label } %>
|
|
9
|
+
<%= render(UI::Button.new(type: :submit, value: "confirm", data: { "ui--confirm-dialog-target": "confirm" })) { confirm_label } %>
|
|
10
|
+
<%= render(UI::Button.new(type: :submit, variant: :destructive, value: "confirm", hidden: true, data: { "ui--confirm-dialog-target": "destructive" })) { confirm_label } %>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
<% end %>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# A styled replacement for the browser's confirm() box that Turbo shows for
|
|
4
|
+
# `data-turbo-confirm`. Render one in your layout and every link, form and
|
|
5
|
+
# button_to that already asks for confirmation uses it, with no other change:
|
|
6
|
+
#
|
|
7
|
+
# <%= render(UI::ConfirmDialog.new) %>
|
|
8
|
+
#
|
|
9
|
+
# <%= button_to "Delete", project_path(@project), method: :delete,
|
|
10
|
+
# data: { turbo_confirm: "Delete this project?",
|
|
11
|
+
# confirm_description: "Its pages and files go too. This can't be undone.",
|
|
12
|
+
# confirm_button: "Delete project", confirm_variant: "destructive" } %>
|
|
13
|
+
#
|
|
14
|
+
# The confirm message is the dialog's title. Optional data attributes, on the
|
|
15
|
+
# same element as data-turbo-confirm, fill in the rest: `confirm-description`,
|
|
16
|
+
# `confirm-button` and `confirm-cancel` (the button labels), and
|
|
17
|
+
# `confirm-variant="destructive"` for a red confirm button.
|
|
18
|
+
#
|
|
19
|
+
# It's a native <dialog>: Escape and clicking outside cancel, focus is trapped
|
|
20
|
+
# inside and returns to the trigger, and Cancel has focus when it opens so a
|
|
21
|
+
# stray Enter never confirms.
|
|
22
|
+
class UI::ConfirmDialog < UI::Base
|
|
23
|
+
PANEL = "relative flex w-full max-w-md flex-col gap-6 rounded-lg border bg-background p-6 shadow-lg " \
|
|
24
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95"
|
|
25
|
+
|
|
26
|
+
def initialize(confirm_label: nil, cancel_label: nil, class: nil, **html_attrs)
|
|
27
|
+
@confirm_label = confirm_label
|
|
28
|
+
@cancel_label = cancel_label
|
|
29
|
+
@user_class = binding.local_variable_get(:class)
|
|
30
|
+
@html_attrs = html_attrs
|
|
31
|
+
@id = html_attrs[:id] || "ui-confirm-dialog"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def confirm_label = @confirm_label || t("ui.confirm_dialog.confirm", default: "Confirm")
|
|
35
|
+
def cancel_label = @cancel_label || t("ui.confirm_dialog.cancel", default: "Cancel")
|
|
36
|
+
def title_id = "#{@id}-title"
|
|
37
|
+
def description_id = "#{@id}-description"
|
|
38
|
+
|
|
39
|
+
def dialog_attrs
|
|
40
|
+
attrs = @html_attrs.except(:data)
|
|
41
|
+
attrs[:id] = @id
|
|
42
|
+
attrs[:class] = cn(
|
|
43
|
+
"fixed inset-0 m-0 h-full max-h-none w-full max-w-none border-0 bg-transparent p-4 overflow-visible " \
|
|
44
|
+
"open:flex open:items-center open:justify-center backdrop:bg-black/60 backdrop:backdrop-blur-[1px]",
|
|
45
|
+
@user_class
|
|
46
|
+
)
|
|
47
|
+
attrs[:aria] = { labelledby: title_id, describedby: description_id }
|
|
48
|
+
attrs[:data] = {
|
|
49
|
+
slot: "confirm-dialog", controller: "ui--confirm-dialog",
|
|
50
|
+
"ui--confirm-dialog-confirm-label-value": confirm_label,
|
|
51
|
+
"ui--confirm-dialog-cancel-label-value": cancel_label
|
|
52
|
+
}.merge(@html_attrs[:data] || {})
|
|
53
|
+
attrs
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -1,73 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
data-ui--date-picker-module-url-value="<%= helpers.asset_path('cally.js') %>"
|
|
3
|
-
data-ui--date-picker-order-value="<%= part_order %>"
|
|
4
|
-
data-ui--date-picker-separator-value="<%= separator %>"
|
|
5
|
-
data-action="click@window->ui--date-picker#closeOnOutsideClick keydown@window->ui--date-picker#closeOnEscape"
|
|
6
|
-
<%= tag.attributes(@html_attrs) %>>
|
|
1
|
+
<%= tag.div(**root_attrs) do %>
|
|
7
2
|
<% if render_label? %>
|
|
8
|
-
|
|
9
|
-
<%= label_text %><% if @required %><span class="ml-0.5 text-destructive">*</span><% end %>
|
|
10
|
-
</label>
|
|
3
|
+
<%= tag.label for: input_id, class: "mb-1.5 block text-sm font-medium text-foreground" do %><%= label_text %><% if required? %><span class="ml-0.5 text-destructive">*</span><% end %><% end %>
|
|
11
4
|
<% end %>
|
|
12
5
|
|
|
13
|
-
|
|
14
|
-
<%# What
|
|
15
|
-
half-typed date
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
6
|
+
<%= tag.div class: group_classes do %>
|
|
7
|
+
<%# What people type. Not named: only the hidden ISO fields are submitted,
|
|
8
|
+
so a half-typed date can't reach the server. %>
|
|
9
|
+
<% fields.each_with_index do |(target, _, iso), index| %>
|
|
10
|
+
<% if index.positive? %><span class="shrink-0 text-muted-foreground" aria-hidden="true">–</span><% end %>
|
|
11
|
+
<%= tag.input(**input_attrs(target, iso)) %>
|
|
12
|
+
<% end %>
|
|
13
|
+
<span class="flex h-full shrink-0 items-center">
|
|
14
|
+
<%= tag.button type: "button", hidden: !value? || required? || disabled?,
|
|
15
|
+
aria: { label: t("ui.date_picker.clear", default: "Clear") },
|
|
16
|
+
class: "flex size-7 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground #{UI::Base::FOCUS_RING}",
|
|
17
|
+
data: { "ui--date-picker-target": "clear", action: "ui--date-picker#clear" } do %>
|
|
18
|
+
<%= render(UI::Icon.new(name: "x", size: :sm)) %>
|
|
19
|
+
<% end %>
|
|
20
|
+
<%= tag.button type: "button", disabled: disabled?, tabindex: -1,
|
|
21
|
+
aria: { haspopup: "dialog", expanded: "false", controls: panel_id, label: t("ui.date_picker.open", default: "Open the calendar") },
|
|
22
|
+
class: toggle_classes,
|
|
23
|
+
data: { "ui--date-picker-target": "toggle", action: "ui--date-picker#toggle" } do %>
|
|
24
|
+
<%= render(UI::Icon.new(name: "calendar", size: :sm)) %>
|
|
25
|
+
<% end %>
|
|
26
|
+
</span>
|
|
27
|
+
<% end %>
|
|
28
|
+
<% fields.each do |target, name, iso| %>
|
|
29
|
+
<%= tag.input type: "hidden", name: name, value: iso, data: { "ui--date-picker-target": "hidden", field: target } %>
|
|
30
|
+
<% end %>
|
|
38
31
|
|
|
39
32
|
<% if render_hint? %>
|
|
40
|
-
|
|
41
|
-
<%= t("ui.date_picker.hint", pattern: placeholder) %>
|
|
42
|
-
</p>
|
|
33
|
+
<%= tag.p hint_text, id: hint_id, class: "mt-1 text-xs text-muted-foreground" %>
|
|
43
34
|
<% end %>
|
|
44
35
|
<% if wrapper.error_message %>
|
|
45
|
-
<%= tag.p
|
|
36
|
+
<%= tag.p wrapper.error_message, id: wrapper.error_id, class: "mt-1 text-xs text-destructive" %>
|
|
46
37
|
<% end %>
|
|
47
38
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
39
|
+
<%# Below the field, or a sheet from the bottom of the screen on a phone. %>
|
|
40
|
+
<%= tag.div id: panel_id, role: "dialog", hidden: true,
|
|
41
|
+
aria: { label: t(range? ? "ui.date_picker.dialog_range" : "ui.date_picker.dialog", default: range? ? "Choose dates" : "Choose a date") },
|
|
42
|
+
class: "absolute left-0 top-full z-40 mt-1 flex w-max flex-col rounded-md border bg-popover text-popover-foreground shadow-md " \
|
|
43
|
+
"sm:flex-row max-sm:fixed max-sm:inset-x-0 max-sm:top-auto max-sm:bottom-0 max-sm:mt-0 max-sm:w-auto " \
|
|
44
|
+
"max-sm:max-h-[85dvh] max-sm:overflow-y-auto max-sm:rounded-b-none max-sm:border-x-0 max-sm:border-b-0",
|
|
45
|
+
data: { "ui--date-picker-target": "panel" } do %>
|
|
46
|
+
<% if preset_list.any? %>
|
|
47
|
+
<%= tag.ul class: "flex gap-1 overflow-x-auto border-b p-2 sm:flex-col sm:overflow-visible sm:border-b-0 sm:border-e",
|
|
48
|
+
aria: { label: t("ui.date_picker.presets_label", default: "Quick ranges") } do %>
|
|
49
|
+
<% preset_list.each do |name, from, to| %>
|
|
50
|
+
<li class="shrink-0"><%= tag.button name, type: "button", aria: { pressed: preset_pressed?(from, to).to_s },
|
|
51
|
+
class: "w-full whitespace-nowrap rounded-md px-3 py-1.5 text-start text-sm hover:bg-accent hover:text-accent-foreground " \
|
|
52
|
+
"aria-pressed:bg-primary/10 aria-pressed:font-medium aria-pressed:text-primary dark:aria-pressed:text-foreground #{UI::Base::FOCUS_RING}",
|
|
53
|
+
data: { action: "ui--date-picker#preset", "ui--date-picker-from-param": from,
|
|
54
|
+
"ui--date-picker-to-param": to, "ui--date-picker-target": "preset" } %></li>
|
|
55
|
+
<% end %>
|
|
56
|
+
<% end %>
|
|
57
|
+
<% end %>
|
|
58
|
+
<div class="flex min-w-0 flex-col">
|
|
59
|
+
<%# The calendar replaces the classes of the element it's given, so the
|
|
60
|
+
kit's colours sit on this wrapper instead. %>
|
|
61
|
+
<div class="velvetkit-calendar p-2"><%= tag.div data: { "ui--date-picker-target": "calendar" } %></div>
|
|
62
|
+
<% if range? %>
|
|
63
|
+
<%= tag.p "", role: "status", class: "min-h-5 px-4 pb-3 text-xs text-muted-foreground", data: { "ui--date-picker-target": "status" } %>
|
|
64
|
+
<% end %>
|
|
65
|
+
</div>
|
|
66
|
+
<% end %>
|
|
67
|
+
<% end %>
|