@adea-ai/ui 0.162.6 → 0.162.7
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.
- package/dist/components/composites/about-dialog/about-dialog.js +5 -5
- package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
- package/dist/components/composites/accent-picker/accent-picker.js +3 -3
- package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
- package/dist/components/composites/accent-picker/custom-color-popover.js +2 -2
- package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +22 -22
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.js +2 -2
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +3 -3
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +10 -10
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +13 -13
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +12 -12
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js +13 -13
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser-group.js +9 -9
- package/dist/components/composites/catalog-browser/catalog-browser-group.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +10 -10
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.js +5 -5
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.js +7 -7
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.js +5 -5
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +13 -13
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.js +7 -7
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +9 -9
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/help-center/help-center.js +5 -5
- package/dist/components/composites/help-center/help-center.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +10 -10
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/icon-picker/image-data-url.js.map +1 -1
- package/dist/components/composites/icon-picker/shell-icons.js +117 -117
- package/dist/components/composites/icon-picker/shell-icons.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.js +7 -7
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +1 -1
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/list-row/list-row.js +2 -2
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js +7 -7
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.js +12 -12
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/plan/plan.js +5 -5
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/prompt-input/prompt-input.js +3 -3
- package/dist/components/composites/prompt-input/prompt-input.js.map +1 -1
- package/dist/components/composites/queue/queue.js +13 -13
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.js +5 -5
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/scene-controls/scene-controls.js +16 -16
- package/dist/components/composites/scene-controls/scene-controls.js.map +1 -1
- package/dist/components/composites/settings/settings-layout.js +2 -2
- package/dist/components/composites/settings/settings-layout.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +2 -2
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/settings/settings.js +5 -5
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/sources.js +5 -5
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/parse-stack-trace.js +2 -2
- package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js +10 -10
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.js +6 -6
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.js +5 -5
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/suggestion/suggestion.js +2 -2
- package/dist/components/composites/suggestion/suggestion.js.map +1 -1
- package/dist/components/composites/task/task.js +5 -5
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/ansi.js +1 -1
- package/dist/components/composites/terminal/ansi.js.map +1 -1
- package/dist/components/composites/terminal/terminal.js +18 -18
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results.js +17 -17
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.js +5 -5
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.js +6 -6
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +1 -1
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +23 -23
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +2 -2
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js +6 -6
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.js +11 -11
- package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
- package/dist/components/conversation/atomic/chat-composer.js +1 -1
- package/dist/components/conversation/busy-send-button.js +10 -10
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/chat-composer.js +1 -1
- package/dist/components/conversation/composer-core.js +1 -1
- package/dist/components/conversation/composer-menu.js +2 -2
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.js +7 -7
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-pane.js +1 -1
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.js +5 -5
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +9 -9
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.js +9 -9
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.js +13 -13
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/paste-token-editor.js +1 -1
- package/dist/components/conversation/paste-token-editor.js.map +1 -1
- package/dist/components/conversation/scroll-follow.js +1 -1
- package/dist/components/conversation/thread-panel.js +5 -5
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.js +5 -5
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/app-shell/app-shell.js +1 -1
- package/dist/components/layout/app-shell/app-shell.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js +1 -1
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js +2 -2
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js +1 -1
- package/dist/components/layout/floating-preview/floating-preview.js +7 -7
- package/dist/components/layout/floating-preview/floating-preview.js.map +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -1
- package/dist/components/layout/page/page.js +2 -2
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/panel/panel.js +1 -1
- package/dist/components/layout/panel/panel.js.map +1 -1
- package/dist/components/layout/pixel-pane/pixel-pane.js +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +5 -5
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/shell-rail/shell-rail.js +5 -5
- package/dist/components/layout/shell-rail/shell-rail.js.map +1 -1
- package/dist/components/layout/shell-top-bar/shell-top-bar.js +2 -2
- package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +2 -2
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +5 -5
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/pane-focus.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +7 -7
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/status-bar/status-bar.js +1 -1
- package/dist/components/layout/status-bar/status-bar.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +5 -5
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js.map +1 -1
- package/dist/components/motion/presence.js +1 -1
- package/dist/components/theme/appearance-panel.js +3 -3
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/lazy.js +3 -3
- package/dist/components/theme/lazy.js.map +1 -1
- package/dist/components/theme/script-projection.js +1 -1
- package/dist/components/theme/theme-catalogue-source.js +1 -1
- package/dist/components/theme/theme-document.js.map +1 -1
- package/dist/components/theme/theme-mode-toggle.js +7 -7
- package/dist/components/theme/theme-mode-toggle.js.map +1 -1
- package/dist/components/theme/theme-picker.js +2 -2
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider-value.js +1 -1
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/theme/theme-provider.js +1 -1
- package/dist/components/theme/theme-toggle.js +7 -7
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/accordion/accordion.js +13 -13
- package/dist/components/ui/accordion/accordion.js.map +1 -1
- package/dist/components/ui/alert/alert.js +12 -12
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +14 -14
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.js +2 -2
- package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/ui/attachment/attachment.js +16 -16
- package/dist/components/ui/attachment/attachment.js.map +1 -1
- package/dist/components/ui/avatar/avatar.js +1 -1
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/badge/badge.js +2 -2
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/board/board.js +2 -2
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js +7 -7
- package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/ui/bubble/bubble.js +2 -2
- package/dist/components/ui/bubble/bubble.js.map +1 -1
- package/dist/components/ui/button/button.js +2 -2
- package/dist/components/ui/button-group/button-group.js +2 -2
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +8 -8
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/callout/callout.js +2 -2
- package/dist/components/ui/callout/callout.js.map +1 -1
- package/dist/components/ui/card/card.js +2 -2
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/carousel/carousel.js +8 -8
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/chart/chart.js +2 -2
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +6 -6
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.js +6 -6
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/collapsible/collapsible.js +7 -7
- package/dist/components/ui/collapsible/collapsible.js.map +1 -1
- package/dist/components/ui/combobox/combobox.js +21 -21
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/combobox/value-combobox.js +1 -1
- package/dist/components/ui/command/command.js +23 -23
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js +2 -2
- package/dist/components/ui/detail-panel/detail-panel.js +5 -5
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js +2 -2
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js +21 -21
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/diff-block/diff-block.js +2 -2
- package/dist/components/ui/diff-block/diff-block.js.map +1 -1
- package/dist/components/ui/drawer/drawer.js +14 -14
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +3 -3
- package/dist/components/ui/dropdown-menu/menu-parts.js +10 -10
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.js +5 -5
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/empty/empty.js +1 -1
- package/dist/components/ui/empty/empty.js.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +2 -2
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.js +14 -14
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.js +2 -2
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.js +10 -10
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/input/input-control.js +1 -1
- package/dist/components/ui/input/input-control.js.map +1 -1
- package/dist/components/ui/input/input.js +2 -2
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-group/input-group.js +2 -2
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-group/secret-input-group.js +2 -2
- package/dist/components/ui/input-otp/input-otp.js +2 -2
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/item/item.js +2 -2
- package/dist/components/ui/item/item.js.map +1 -1
- package/dist/components/ui/kbd/kbd.js +2 -2
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/label/label.js +1 -1
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/marker/marker.js +2 -2
- package/dist/components/ui/marker/marker.js.map +1 -1
- package/dist/components/ui/menubar/menubar.js +7 -7
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/message.js +3 -3
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +2 -2
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/native-select/native-select.js +5 -5
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +18 -18
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js +28 -28
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/popover/popover.js +15 -15
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/progress/progress.js +5 -5
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +10 -10
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +9 -9
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.js +11 -11
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/ui/select/select.js +21 -21
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/separator/separator.js +5 -5
- package/dist/components/ui/separator/separator.js.map +1 -1
- package/dist/components/ui/sheet/sheet.js +6 -6
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.js +1 -1
- package/dist/components/ui/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/slider/slider.js +5 -5
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/spinner/spinner.js +5 -5
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js +2 -2
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.js +4 -4
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/table/table.js +1 -1
- package/dist/components/ui/table/table.js.map +1 -1
- package/dist/components/ui/tabs/tabs.js +7 -7
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/text-link/text-link.js +1 -1
- package/dist/components/ui/text-link/text-link.js.map +1 -1
- package/dist/components/ui/textarea/textarea.js +2 -2
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.js +7 -7
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/toggle/toggle.js +6 -6
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/toggle-group/toggle-group.js +7 -8
- package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
- package/dist/components/ui/tooltip/deferred-tooltip.js +6 -6
- package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -1
- package/dist/components/ui/tooltip/lazy-tooltip.js +2 -2
- package/dist/components/ui/tooltip/tooltip.js +10 -10
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/trace.js +19 -19
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.js +2 -2
- package/dist/lib/accent-presets.js +1 -1
- package/dist/lib/accent-roles.js +2 -2
- package/dist/lib/async-action.js +1 -1
- package/dist/lib/create-poll.js +1 -1
- package/dist/lib/create-poll.js.map +1 -1
- package/dist/lib/external-link.js +1 -1
- package/dist/lib/external-link.js.map +1 -1
- package/dist/lib/fast-icon.js +1 -1
- package/dist/lib/theme-css.js +1 -1
- package/dist/lib/theme-engine-light.js +1 -1
- package/dist/lib/theme-projection.js +2 -2
- package/dist/lib/theme-records.js +1 -1
- package/dist/lib/themes.js +1 -1
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tooltip-focus-gate.js.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/vite/source-parser.js +1 -1
- package/dist/vite/tailwind-sources.js +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","names":["<CalendarPrevious\n aria-label={props.previousLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </CalendarPrevious>","render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}","<Button {...part} variant=\"ghost\" size=\"icon-sm\" />","variant=\"ghost\"","size=\"icon-sm\"","<ChevronLeft aria-hidden=\"true\" />","<div class=\"flex items-center justify-between gap-2\">\n <CalendarPrevious\n aria-label={props.previousLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </CalendarPrevious>\n {/*\n The first month's caption is ui-sdk's heading, a polite live region, so a\n turn of the month is announced once. Its id is fixed per calendar, so the\n months after it take a plain heading; each grid is named by its month.\n */}\n <Show when={props.offset === 0} fallback={<h2 class={captionClass}>{monthLabel()}</h2>}>\n <CalendarHeading class={captionClass}>{monthLabel()}</CalendarHeading>\n </Show>\n <CalendarNext\n aria-label={props.nextLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronRight aria-hidden=\"true\" />\n </CalendarNext>\n </div>","<CalendarHeading class={captionClass}>{monthLabel()}</CalendarHeading>","class={captionClass}","<CalendarNext\n aria-label={props.nextLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronRight aria-hidden=\"true\" />\n </CalendarNext>","<ChevronRight aria-hidden=\"true\" />","<CalendarGrid offset={props.offset} class=\"w-full border-collapse\">\n <CalendarWeekdays>\n {(index) => (\n <CalendarWeekday index={index} class=\"pb-1 text-2xs font-medium text-muted-foreground\">\n {(state) => weekdays()[state.weekday]}\n </CalendarWeekday>\n )}\n </CalendarWeekdays>\n <CalendarWeeks>\n {(cell) => (\n <CalendarDay\n value={cell.date}\n // The full date is the name: \"25\" alone is meaningless out of context.\n // Formatted here rather than by ui-sdk so it follows the runtime's\n // default locale and time zone, as the caption and weekdays do.\n aria-label={dayFormatter().format(fromISODate(cell.date))}\n class=\"group p-0.5 text-center focus-visible:outline-none\"\n >\n {(state: CalendarDayState) => (\n // The states are mirrored onto the painted box rather than read off\n // the cell, so the padding around it stays unfilled, as it was when\n // the box was a button inside the cell. `data-in-range` is the span\n // strictly between the ends, and an outside day is disabled here\n // while `disableOutsideDays` holds.\n <span\n aria-hidden=\"true\"\n class={DAY_CLASS}\n data-selected={flag(state.selected)}\n data-in-range={flag(state.inRange && !state.rangeStart && !state.rangeEnd)}\n data-range-start={flag(state.rangeStart)}\n data-range-end={flag(state.rangeEnd)}\n data-today={flag(state.today)}\n data-disabled={flag(state.disabled || (state.outside && props.outsideDisabled))}\n >\n {Number(state.date.slice(8))}\n </span>\n )}\n </CalendarDay>\n )}\n </CalendarWeeks>\n </CalendarGrid>","class=\"w-full border-collapse\"","<CalendarWeekdays>\n {(index) => (\n <CalendarWeekday index={index} class=\"pb-1 text-2xs font-medium text-muted-foreground\">\n {(state) => weekdays()[state.weekday]}\n </CalendarWeekday>\n )}\n </CalendarWeekdays>","<CalendarWeekday index={index} class=\"pb-1 text-2xs font-medium text-muted-foreground\">\n {(state) => weekdays()[state.weekday]}\n </CalendarWeekday>","class=\"pb-1 text-2xs font-medium text-muted-foreground\"","<CalendarWeeks>\n {(cell) => (\n <CalendarDay\n value={cell.date}\n // The full date is the name: \"25\" alone is meaningless out of context.\n // Formatted here rather than by ui-sdk so it follows the runtime's\n // default locale and time zone, as the caption and weekdays do.\n aria-label={dayFormatter().format(fromISODate(cell.date))}\n class=\"group p-0.5 text-center focus-visible:outline-none\"\n >\n {(state: CalendarDayState) => (\n // The states are mirrored onto the painted box rather than read off\n // the cell, so the padding around it stays unfilled, as it was when\n // the box was a button inside the cell. `data-in-range` is the span\n // strictly between the ends, and an outside day is disabled here\n // while `disableOutsideDays` holds.\n <span\n aria-hidden=\"true\"\n class={DAY_CLASS}\n data-selected={flag(state.selected)}\n data-in-range={flag(state.inRange && !state.rangeStart && !state.rangeEnd)}\n data-range-start={flag(state.rangeStart)}\n data-range-end={flag(state.rangeEnd)}\n data-today={flag(state.today)}\n data-disabled={flag(state.disabled || (state.outside && props.outsideDisabled))}\n >\n {Number(state.date.slice(8))}\n </span>\n )}\n </CalendarDay>\n )}\n </CalendarWeeks>","<CalendarDay\n value={cell.date}\n // The full date is the name: \"25\" alone is meaningless out of context.\n // Formatted here rather than by ui-sdk so it follows the runtime's\n // default locale and time zone, as the caption and weekdays do.\n aria-label={dayFormatter().format(fromISODate(cell.date))}\n class=\"group p-0.5 text-center focus-visible:outline-none\"\n >\n {(state: CalendarDayState) => (\n // The states are mirrored onto the painted box rather than read off\n // the cell, so the padding around it stays unfilled, as it was when\n // the box was a button inside the cell. `data-in-range` is the span\n // strictly between the ends, and an outside day is disabled here\n // while `disableOutsideDays` holds.\n <span\n aria-hidden=\"true\"\n class={DAY_CLASS}\n data-selected={flag(state.selected)}\n data-in-range={flag(state.inRange && !state.rangeStart && !state.rangeEnd)}\n data-range-start={flag(state.rangeStart)}\n data-range-end={flag(state.rangeEnd)}\n data-today={flag(state.today)}\n data-disabled={flag(state.disabled || (state.outside && props.outsideDisabled))}\n >\n {Number(state.date.slice(8))}\n </span>\n )}\n </CalendarDay>","class=\"group p-0.5 text-center focus-visible:outline-none\"","data-selected={flag(state.selected)}","data-in-range={flag(state.inRange && !state.rangeStart && !state.rangeEnd)}","data-range-start={flag(state.rangeStart)}","data-range-end={flag(state.rangeEnd)}","data-today={flag(state.today)}","data-disabled={flag(state.disabled || (state.outside && props.outsideDisabled))}","<div class=\"flex flex-col gap-2\">\n <div class=\"flex items-center justify-between gap-2\">\n <CalendarPrevious\n aria-label={props.previousLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </CalendarPrevious>\n {/*\n The first month's caption is ui-sdk's heading, a polite live region, so a\n turn of the month is announced once. Its id is fixed per calendar, so the\n months after it take a plain heading; each grid is named by its month.\n */}\n <Show when={props.offset === 0} fallback={<h2 class={captionClass}>{monthLabel()}</h2>}>\n <CalendarHeading class={captionClass}>{monthLabel()}</CalendarHeading>\n </Show>\n <CalendarNext\n aria-label={props.nextLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronRight aria-hidden=\"true\" />\n </CalendarNext>\n </div>\n <CalendarGrid offset={props.offset} class=\"w-full border-collapse\">\n <CalendarWeekdays>\n {(index) => (\n <CalendarWeekday index={index} class=\"pb-1 text-2xs font-medium text-muted-foreground\">\n {(state) => weekdays()[state.weekday]}\n </CalendarWeekday>\n )}\n </CalendarWeekdays>\n <CalendarWeeks>\n {(cell) => (\n <CalendarDay\n value={cell.date}\n // The full date is the name: \"25\" alone is meaningless out of context.\n // Formatted here rather than by ui-sdk so it follows the runtime's\n // default locale and time zone, as the caption and weekdays do.\n aria-label={dayFormatter().format(fromISODate(cell.date))}\n class=\"group p-0.5 text-center focus-visible:outline-none\"\n >\n {(state: CalendarDayState) => (\n // The states are mirrored onto the painted box rather than read off\n // the cell, so the padding around it stays unfilled, as it was when\n // the box was a button inside the cell. `data-in-range` is the span\n // strictly between the ends, and an outside day is disabled here\n // while `disableOutsideDays` holds.\n <span\n aria-hidden=\"true\"\n class={DAY_CLASS}\n data-selected={flag(state.selected)}\n data-in-range={flag(state.inRange && !state.rangeStart && !state.rangeEnd)}\n data-range-start={flag(state.rangeStart)}\n data-range-end={flag(state.rangeEnd)}\n data-today={flag(state.today)}\n data-disabled={flag(state.disabled || (state.outside && props.outsideDisabled))}\n >\n {Number(state.date.slice(8))}\n </span>\n )}\n </CalendarDay>\n )}\n </CalendarWeeks>\n </CalendarGrid>\n </div>","<Calendar\n {...options}\n class={cn('w-fit rounded-lg border border-border bg-card p-3', local.class)}\n onValueChange={(value, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n if (local.mode === 'multiple' && Array.isArray(value)) {\n // ui-sdk has no count bounds for a multiple selection; corvu's are kept here.\n const tooMany = local.max !== undefined && value.length > local.max\n const tooFew = local.min !== undefined && value.length < local.min\n if (tooMany || tooFew) return details.cancel()\n }\n ;(local.onValueChange as ((value: unknown) => void) | undefined)?.(\n fromSdkValue(local.mode, value)\n )\n }}\n onMonthChange={(month, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n local.onMonthChange?.(fromISODate(month))\n }}\n onFocusedChange={(date, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n local.onFocusedDayChange?.(fromISODate(date))\n }}\n >\n {(calendar: CalendarState) => (\n <For each={offsets()}>\n {(offset) => (\n <CalendarMonth\n calendar={calendar}\n offset={offset}\n weekdayLabels={local.weekdayLabels}\n previousLabel={local.previousLabel ?? 'Previous month'}\n nextLabel={local.nextLabel ?? 'Next month'}\n formatMonth={local.formatMonth}\n outsideDisabled={outsideDisabled()}\n />\n )}\n </For>\n )}\n </Calendar>","onValueChange={(value, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n if (local.mode === 'multiple' && Array.isArray(value)) {\n // ui-sdk has no count bounds for a multiple selection; corvu's are kept here.\n const tooMany = local.max !== undefined && value.length > local.max\n const tooFew = local.min !== undefined && value.length < local.min\n if (tooMany || tooFew) return details.cancel()\n }\n ;(local.onValueChange as ((value: unknown) => void) | undefined)?.(\n fromSdkValue(local.mode, value)\n )\n }}","onMonthChange={(month, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n local.onMonthChange?.(fromISODate(month))\n }}","onFocusedChange={(date, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n local.onFocusedDayChange?.(fromISODate(date))\n }}","<For each={offsets()}>\n {(offset) => (\n <CalendarMonth\n calendar={calendar}\n offset={offset}\n weekdayLabels={local.weekdayLabels}\n previousLabel={local.previousLabel ?? 'Previous month'}\n nextLabel={local.nextLabel ?? 'Next month'}\n formatMonth={local.formatMonth}\n outsideDisabled={outsideDisabled()}\n />\n )}\n </For>","<CalendarMonth\n calendar={calendar}\n offset={offset}\n weekdayLabels={local.weekdayLabels}\n previousLabel={local.previousLabel ?? 'Previous month'}\n nextLabel={local.nextLabel ?? 'Next month'}\n formatMonth={local.formatMonth}\n outsideDisabled={outsideDisabled()}\n />","<Show when={props.label}>\n {(labelSlot) => <p class=\"text-xs font-semibold text-foreground\">{labelSlot()}</p>}\n </Show>","<div class={cn('grid w-fit gap-2', props.class)}>\n <Show when={props.label}>\n {(labelSlot) => <p class=\"text-xs font-semibold text-foreground\">{labelSlot()}</p>}\n </Show>\n <CalendarSurface\n {...rest}\n mode=\"single\"\n value={props.value}\n onValueChange={props.onValueChange}\n />\n <Show when={props.footer}>\n {(footerSlot) => <div class=\"flex justify-end gap-2\">{footerSlot()}</div>}\n </Show>\n </div>","<CalendarSurface\n {...rest}\n mode=\"single\"\n value={props.value}\n onValueChange={props.onValueChange}\n />","mode=\"single\"","<Show when={props.footer}>\n {(footerSlot) => <div class=\"flex justify-end gap-2\">{footerSlot()}</div>}\n </Show>","ChevronLeft","LucideChevronLeft","ChevronRight","LucideChevronRight","_$readShallow","_$setAttribute"],"sources":["../../../../src/components/ui/calendar/calendar.tsx"],"sourcesContent":["import { createMemo, For, Show, omit } from 'solid-js'\nimport { type ComponentProps, type JSX } from '@solidjs/web'\nimport {\n Calendar,\n CalendarDay,\n CalendarGrid,\n CalendarHeading,\n CalendarNext,\n CalendarPrevious,\n CalendarWeekday,\n CalendarWeekdays,\n CalendarWeeks,\n type CalendarDayState,\n type CalendarOptions,\n type CalendarState,\n type CalendarValue,\n} from '@ui-sdk/solid/calendar'\nimport { ChevronLeft as LucideChevronLeft, ChevronRight as LucideChevronRight } from '@lucide/solid'\nimport { fastIcon } from '#lib/fast-icon'\nimport { cn } from '#lib/utils'\nimport { Button } from '../button'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst ChevronLeft = fastIcon(LucideChevronLeft)\nconst ChevronRight = fastIcon(LucideChevronRight)\n\n/** The three selection modes. `mode` decides the shape of `value`. */\nexport type CalendarMode = 'single' | 'multiple' | 'range'\n\n/**\n * Calendar.\n *\n * A month grid, over ui-sdk's calendar. The primitive owns the hard part — the\n * roving `tabindex` that makes a grid of days one tab stop rather than 42, the\n * arrow-key, Page Up/Down and Home/End navigation, the range preview, and the\n * `aria-selected`/`aria-disabled`/`aria-current` bookkeeping on each day's\n * `gridcell`.\n *\n * What this component owns is the *presentation* of those states, and it is worth\n * saying why they are styled from `data-*` rather than from props: a day is today,\n * selected, in range, at a range end, and disabled independently, and a range\n * start that is also today has to read as both. Boolean props cannot express that\n * without a combinatorial explosion; the data attributes can.\n *\n * The props are `Date`-based and keep the shape this component had over corvu:\n * `value` is a `Date`, a `Date[]` or a `{ from, to }` range by `mode`, and the\n * month is `initialMonth`/`month`. ui-sdk speaks ISO strings (`\"2026-09-25\"`,\n * `[start, end]`), so this translates at the edge instead of making every caller\n * change. Dates are read and built in local time, as corvu did.\n *\n * Four things the primitive leaves open, and this closes:\n *\n * 1. **Each month has a caption heading.** The first is ui-sdk's heading, a polite\n * live region, so a screen reader user hears the month change.\n * 2. **The nav buttons have accessible names.** A bare chevron is not a name.\n * 3. **Today is a ring, not a fill.** A fill would be indistinguishable from\n * selected, and today is often also selected.\n * 4. **Outside days are drawn but not pickable** unless `disableOutsideDays` is\n * false — corvu's default, which ui-sdk does not have (it selects the day and\n * turns the month). A press on one is cancelled before it lands.\n */\n\n/** A range value. `to` is null while only the start is known. */\nexport type CalendarRange = { from: Date | null; to: Date | null }\n\n/** The props every mode shares. */\ntype CalendarSharedProps = {\n /** The month shown first when uncontrolled. Defaults to the selection's month, else today's. */\n initialMonth?: Date\n /** The month shown first, to control navigation. */\n month?: Date\n /** The first shown month changed (navigation, or a key moving past the edge). */\n onMonthChange?: (month: Date) => void\n /** Focus is about to move to another day. */\n onFocusedDayChange?: (day: Date) => void\n /** The first day of the week, 0 for Sunday. Defaults to Sunday. */\n startOfWeek?: number\n /** How many months show side by side. */\n numberOfMonths?: number\n /** Whether the neighbouring months' days at the grid's edges can be picked. Defaults to true (they cannot). */\n disableOutsideDays?: boolean\n /** Six weeks always, so the grid does not change height between months. */\n fixedWeeks?: boolean\n /** Days that cannot be picked. They stay focusable, so a keyboard user hears them. */\n disabled?: (day: Date) => boolean\n /** Accepted for compatibility; the grid follows the page's `dir`. */\n textDirection?: 'ltr' | 'rtl'\n}\n\nexport type CalendarSingleProps = CalendarSharedProps & {\n mode: 'single'\n value?: Date | null\n initialValue?: Date | null\n onValueChange?: (value: Date | null) => void\n /** When true, pressing the selected day again keeps it selected. */\n required?: boolean\n}\n\nexport type CalendarMultipleProps = CalendarSharedProps & {\n mode: 'multiple'\n value?: Date[]\n initialValue?: Date[]\n onValueChange?: (value: Date[]) => void\n /** The fewest days that may be selected. */\n min?: number\n /** The most days that may be selected. */\n max?: number\n}\n\nexport type CalendarRangeProps = CalendarSharedProps & {\n mode: 'range'\n value?: CalendarRange\n initialValue?: CalendarRange\n /** Runs once both ends are picked; between the presses ui-sdk previews the range. */\n onValueChange?: (value: CalendarRange) => void\n /** The fewest days a range can span, counting both ends. */\n min?: number\n /** The most days a range can span, counting both ends. */\n max?: number\n /** When true, a range cannot span a day `disabled` names. */\n excludeDisabled?: boolean\n}\n\n/**\n * The props this wrapper adds on top of the selection's. They are separate so\n * `omit` has a fixed list to pull out.\n */\ntype CalendarExtras = {\n /** Weekday header labels, Sunday first. Defaults to the locale's short names. */\n weekdayLabels?: readonly string[]\n /** Accessible names for the month navigation. Override for a non-English app. */\n previousLabel?: string\n nextLabel?: string\n /** Format a month for the caption. Defaults to `Intl.DateTimeFormat`. */\n formatMonth?: (month: Date) => string\n class?: string\n}\n\n/** The props of any of the three modes. `mode` decides the shape of `value`. */\nexport type CalendarProps = (CalendarSingleProps | CalendarMultipleProps | CalendarRangeProps) &\n CalendarExtras\n\n/** Every mode's props at once, for the translation code that switches on `mode` itself. */\ntype AnyModeProps = CalendarSharedProps &\n CalendarExtras & {\n mode: CalendarMode\n value?: Date | null | Date[] | CalendarRange\n initialValue?: Date | null | Date[] | CalendarRange\n onValueChange?: (value: never) => void\n required?: boolean\n min?: number\n max?: number\n excludeDisabled?: boolean\n }\n\nconst MONTH_FORMAT: Intl.DateTimeFormatOptions = { month: 'long', year: 'numeric' }\n\nconst pad = (value: number) => String(value).padStart(2, '0')\n\n/** A local `Date` as an ISO date, the calendar day the caller sees. */\nfunction toISODate(date: Date): string {\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`\n}\n\n/** An ISO date (or month, which reads as its first day) as a local `Date`. */\nfunction fromISODate(iso: string): Date {\n const [year, month, day] = iso.split('-').map(Number)\n return new Date(year!, month! - 1, day ?? 1)\n}\n\n/** An ISO month moved by whole months, like `\"2026-09\"` + 1 → `\"2026-10\"`. */\nfunction addMonths(month: string, offset: number): string {\n const [year, index] = month.split('-').map(Number)\n const date = new Date(year!, index! - 1 + offset, 1)\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}`\n}\n\nfunction toSdkValue(mode: CalendarMode, value: AnyModeProps['value']): CalendarValue | undefined {\n if (value === undefined) return undefined\n if (mode === 'multiple') return (value as Date[]).map(toISODate)\n if (mode === 'range') {\n const range = value as CalendarRange | null\n // A range with only a start reads as a one-day range: ui-sdk has no shape for\n // half a range outside the press that is picking it.\n return range?.from ? [toISODate(range.from), toISODate(range.to ?? range.from)] : null\n }\n return value ? toISODate(value as Date) : null\n}\n\nfunction fromSdkValue(mode: CalendarMode, value: CalendarValue): AnyModeProps['value'] {\n if (mode === 'multiple') return (Array.isArray(value) ? value : []).map(fromISODate)\n if (mode === 'range') {\n const [from, to] = Array.isArray(value) ? value : []\n return { from: from ? fromISODate(from) : null, to: to ? fromISODate(to) : null }\n }\n return typeof value === 'string' ? fromISODate(value) : null\n}\n\n/** The locale's short weekday names, Sunday first, indexed by `getDay()`. */\nfunction defaultWeekdays(): string[] {\n const format = new Intl.DateTimeFormat(undefined, { weekday: 'short' })\n // 2024-01-07 is a Sunday, so index 0 is Sunday without arithmetic.\n return Array.from({ length: 7 }, (_, index) => format.format(new Date(2024, 0, 7 + index)))\n}\n\n/** Whether a change came from a press on another month's day at the grid's edge. */\nfunction pressedOutsideDay(details: { event?: Event }): boolean {\n const target = details.event?.target\n return (\n target instanceof Element &&\n !!target.closest('[data-slot=\"calendar-day\"]')?.hasAttribute('data-outside')\n )\n}\n\nconst DAY_CLASS = cn(\n 'flex w-full items-center justify-center rounded-md text-xs text-foreground transition-colors',\n 'min-h-control-xs',\n // The day cell itself takes focus (it is the grid's `gridcell`), so the ring is\n // drawn here from the cell's focus, inside the cell's padding as before.\n 'hover:bg-muted group-focus-visible:ring-2 group-focus-visible:ring-ring',\n // Styled from data states, so a day can be a range end and today at once\n // without a prop per pair.\n 'data-selected:bg-primary data-selected:text-primary-foreground',\n // Every day of a range is selected, so the span between the ends steps back\n // to the subtle fill and the ends take the solid one again.\n 'data-in-range:bg-primary-subtle data-in-range:text-foreground',\n 'data-range-start:bg-primary data-range-start:text-primary-foreground',\n 'data-range-end:bg-primary data-range-end:text-primary-foreground',\n 'data-range-start:rounded-r-none data-range-end:rounded-l-none',\n 'data-today:ring-1 data-today:ring-ring',\n 'data-disabled:text-muted-foreground data-disabled:line-through',\n 'data-disabled:hover:bg-transparent'\n)\n\nconst flag = (on: boolean) => (on ? '' : undefined)\n\n/**\n * One month: its navigation row, its caption and its grid. `offset` is which of\n * the months shown it is; `calendar` is the root's state, read lazily in the JSX\n * so a month change re-renders the caption rather than the whole block.\n */\nfunction CalendarMonth(props: {\n calendar: CalendarState\n offset: number\n weekdayLabels?: readonly string[]\n previousLabel: string\n nextLabel: string\n formatMonth?: (month: Date) => string\n outsideDisabled: boolean\n}) {\n const month = createMemo(() => addMonths(props.calendar.month, props.offset))\n // The default names and the day formatter are rebuilt when the month turns, so\n // navigation picks up changed locale and time-zone defaults.\n const weekdays = createMemo(() => {\n void month()\n return props.weekdayLabels ?? defaultWeekdays()\n })\n const dayFormatter = createMemo(() => {\n void month()\n return new Intl.DateTimeFormat(undefined, { day: 'numeric', month: 'long', year: 'numeric' })\n })\n const monthLabel = () => {\n const date = fromISODate(month())\n return props.formatMonth\n ? props.formatMonth(date)\n : new Intl.DateTimeFormat(undefined, MONTH_FORMAT).format(date)\n }\n const captionClass = 'text-sm font-semibold text-foreground'\n\n return (\n <div class=\"flex flex-col gap-2\">\n <div class=\"flex items-center justify-between gap-2\">\n <CalendarPrevious\n aria-label={props.previousLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </CalendarPrevious>\n {/*\n The first month's caption is ui-sdk's heading, a polite live region, so a\n turn of the month is announced once. Its id is fixed per calendar, so the\n months after it take a plain heading; each grid is named by its month.\n */}\n <Show when={props.offset === 0} fallback={<h2 class={captionClass}>{monthLabel()}</h2>}>\n <CalendarHeading class={captionClass}>{monthLabel()}</CalendarHeading>\n </Show>\n <CalendarNext\n aria-label={props.nextLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronRight aria-hidden=\"true\" />\n </CalendarNext>\n </div>\n <CalendarGrid offset={props.offset} class=\"w-full border-collapse\">\n <CalendarWeekdays>\n {(index) => (\n <CalendarWeekday index={index} class=\"pb-1 text-2xs font-medium text-muted-foreground\">\n {(state) => weekdays()[state.weekday]}\n </CalendarWeekday>\n )}\n </CalendarWeekdays>\n <CalendarWeeks>\n {(cell) => (\n <CalendarDay\n value={cell.date}\n // The full date is the name: \"25\" alone is meaningless out of context.\n // Formatted here rather than by ui-sdk so it follows the runtime's\n // default locale and time zone, as the caption and weekdays do.\n aria-label={dayFormatter().format(fromISODate(cell.date))}\n class=\"group p-0.5 text-center focus-visible:outline-none\"\n >\n {(state: CalendarDayState) => (\n // The states are mirrored onto the painted box rather than read off\n // the cell, so the padding around it stays unfilled, as it was when\n // the box was a button inside the cell. `data-in-range` is the span\n // strictly between the ends, and an outside day is disabled here\n // while `disableOutsideDays` holds.\n <span\n aria-hidden=\"true\"\n class={DAY_CLASS}\n data-selected={flag(state.selected)}\n data-in-range={flag(state.inRange && !state.rangeStart && !state.rangeEnd)}\n data-range-start={flag(state.rangeStart)}\n data-range-end={flag(state.rangeEnd)}\n data-today={flag(state.today)}\n data-disabled={flag(state.disabled || (state.outside && props.outsideDisabled))}\n >\n {Number(state.date.slice(8))}\n </span>\n )}\n </CalendarDay>\n )}\n </CalendarWeeks>\n </CalendarGrid>\n </div>\n )\n}\n\n/**\n * Generic over the mode on purpose: a type parameter keeps `mode` a literal at\n * the call site, so `value` and `onValueChange` are checked against that mode's\n * shape rather than the union of all three.\n */\nexport function CalendarSurface<M extends CalendarMode>(props: CalendarProps & { mode: M }) {\n const local = props as unknown as AnyModeProps\n const outsideDisabled = () => local.disableOutsideDays ?? true\n const offsets = () => Array.from({ length: Math.max(1, local.numberOfMonths ?? 1) }, (_, i) => i)\n\n const options = {\n get mode() {\n return local.mode\n },\n get value() {\n return toSdkValue(local.mode, local.value)\n },\n get defaultValue() {\n return toSdkValue(local.mode, local.initialValue)\n },\n get month() {\n return local.month ? toISODate(local.month).slice(0, 7) : undefined\n },\n get defaultMonth() {\n return local.initialMonth ? toISODate(local.initialMonth).slice(0, 7) : undefined\n },\n get weekStartsOn() {\n return local.startOfWeek ?? 0\n },\n get months() {\n return local.numberOfMonths\n },\n get fixedWeeks() {\n return local.fixedWeeks\n },\n get unavailable() {\n const disabled = local.disabled\n return disabled ? (date: string) => disabled(fromISODate(date)) : undefined\n },\n get deselectable() {\n return local.mode === 'single' && !local.required\n },\n get minDays() {\n return local.mode === 'range' ? local.min : undefined\n },\n get maxDays() {\n return local.mode === 'range' ? local.max : undefined\n },\n get allowUnavailable() {\n return local.mode === 'range' ? !local.excludeDisabled : undefined\n },\n } satisfies CalendarOptions\n\n return (\n <Calendar\n {...options}\n class={cn('w-fit rounded-lg border border-border bg-card p-3', local.class)}\n onValueChange={(value, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n if (local.mode === 'multiple' && Array.isArray(value)) {\n // ui-sdk has no count bounds for a multiple selection; corvu's are kept here.\n const tooMany = local.max !== undefined && value.length > local.max\n const tooFew = local.min !== undefined && value.length < local.min\n if (tooMany || tooFew) return details.cancel()\n }\n ;(local.onValueChange as ((value: unknown) => void) | undefined)?.(\n fromSdkValue(local.mode, value)\n )\n }}\n onMonthChange={(month, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n local.onMonthChange?.(fromISODate(month))\n }}\n onFocusedChange={(date, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n local.onFocusedDayChange?.(fromISODate(date))\n }}\n >\n {(calendar: CalendarState) => (\n <For each={offsets()}>\n {(offset) => (\n <CalendarMonth\n calendar={calendar}\n offset={offset}\n weekdayLabels={local.weekdayLabels}\n previousLabel={local.previousLabel ?? 'Previous month'}\n nextLabel={local.nextLabel ?? 'Next month'}\n formatMonth={local.formatMonth}\n outsideDisabled={outsideDisabled()}\n />\n )}\n </For>\n )}\n </Calendar>\n )\n}\n\n/**\n * Built from the *single* props rather than from `CalendarProps` with `mode`\n * omitted. Omitting a discriminant leaves the other members of the union behind\n * — `value` stays `Date | Date[] | {from,to}` — and the picker would then have to\n * cast to prove what its own name already says.\n */\nexport type DatePickerProps = Omit<CalendarSingleProps, 'mode'> &\n CalendarExtras & {\n /** A labelled heading above the grid. */\n label?: string\n /** A footer slot: the confirm and cancel row a picker usually has. */\n footer?: JSX.Element\n }\n\n/**\n * A single-day picker: the calendar with a name and a footer. Split from\n * `CalendarSurface` because a bare calendar is a control inside a form the caller\n * already owns, while a picker is a thing the caller drops in — and the two want\n * different surroundings.\n */\nexport function DatePicker(props: DatePickerProps) {\n const rest = omit(props, 'value', 'onValueChange', 'label', 'footer', 'class')\n\n return (\n <div class={cn('grid w-fit gap-2', props.class)}>\n <Show when={props.label}>\n {(labelSlot) => <p class=\"text-xs font-semibold text-foreground\">{labelSlot()}</p>}\n </Show>\n <CalendarSurface\n {...rest}\n mode=\"single\"\n value={props.value}\n onValueChange={props.onValueChange}\n />\n <Show when={props.footer}>\n {(footerSlot) => <div class=\"flex justify-end gap-2\">{footerSlot()}</div>}\n </Show>\n </div>\n )\n}\n\n/**\n * The name this type had when the props were corvu's; kept so a caller that typed\n * a value against it still compiles.\n */\nexport type { CalendarProps as CorvuCalendarProps }\n/** ui-sdk's calendar root, for a caller composing its own grid from ui-sdk's parts. */\nexport { Calendar as CalendarRoot }\nexport type CalendarElementProps = ComponentProps<'div'>\n"],"mappings":";;;;;;;;;;;;;;AAuBA,IAAMqC,gBAAc,SAASC,WAAiB;AAC9C,IAAMC,iBAAe,SAASC,YAAkB;AAmIhD,IAAM,eAA2C;CAAE,OAAO;CAAQ,MAAM;AAAU;AAElF,IAAM,OAAO,UAAkB,OAAO,KAAK,CAAC,CAAC,SAAS,GAAG,GAAG;;AAG5D,SAAS,UAAU,MAAoB;CACrC,OAAO,GAAG,KAAK,YAAY,EAAE,GAAG,IAAI,KAAK,SAAS,IAAI,CAAC,EAAE,GAAG,IAAI,KAAK,QAAQ,CAAC;AAChF;;AAGA,SAAS,YAAY,KAAmB;CACtC,MAAM,CAAC,MAAM,OAAO,OAAO,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CACpD,OAAO,IAAI,KAAK,MAAO,QAAS,GAAG,OAAO,CAAC;AAC7C;;AAGA,SAAS,UAAU,OAAe,QAAwB;CACxD,MAAM,CAAC,MAAM,SAAS,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CACjD,MAAM,OAAO,IAAI,KAAK,MAAO,QAAS,IAAI,QAAQ,CAAC;CACnD,OAAO,GAAG,KAAK,YAAY,EAAE,GAAG,IAA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AAe,OAAA,MAAM;IAAa;IAClC,IAAA,gBAAA;KAAe,OAAA,MAAM,iBAAiB;IAAgB;IACtD,IAAA,YAAA;KAAW,OAAA,MAAM,aAAa;IAAY;IAC1C,IAAA,cAAA;KAAa,OAAA,MAAM;IAAW;IAC9B,IAAA,kBAAA;KAAiB,OAAA,gBAAgB;IAAC;GACnC,CAAA;EAEA,CAAA;CAEC,CAAA,CAAA;AAEd;;;;;;;AAsBA,SAAgB,WAAW,OAAwB;CACjD,MAAM,OAAO,KAAK,OAAO,SAAS,iBAAiB,SAAS,UAAU,OAAO;CAG3E,IAAA,QAAA,QAaK;CAbL,IAAA,QAAA,MAAA;;;CACEC,OAAAA,OAAAA,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAK;EAAvBA,WACI,qBAAc;GAAiE,IAAA,SAAA,QAAA;GAAjE,OAAA,QAAkD,SAAe;GAAjE,OAAA;EAAiE,EAAA,CAAA;CAC7E,CAAA,GAHRC,KAaK;CAbL,OAAA,OAIEC,gBAAAA,iBAAAA,WACM,MADN;EAEEC,MAAK;EACL,IAAA,QAAA;GAAO,OAAA,MAAM;EAAK;EAClB,IAAA,gBAAA;GAAe,OAAA,MAAM;EAAa;CACnC,CAAA,CAAA,GATHF,MAaK;CAbL,OAAA,OAUEG,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAM;EAAxBA,WACI,sBAAe;GAAuD,IAAA,SAAA,QAAA;GAAvD,OAAA,QAAqC,UAAkB;GAAvD,OAAA;EAAuD,EAAA,CAAA;CACpE,CAAA,GAZRH,MAaK;CAbA,aAAAQ,YAAO,GAAG,oBAAoB,MAAM,KAAK,CAAC,IAA1C,KAAA,QAAA;EAA0C,UAAA,OAAA,KAAA,GAAA;;CADjD,OACER;AAeJ"}
|
|
1
|
+
{"version":3,"file":"calendar.js","names":["<CalendarPrevious\n aria-label={props.previousLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </CalendarPrevious>","render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}","<Button {...part} variant=\"ghost\" size=\"icon-sm\" />","variant=\"ghost\"","size=\"icon-sm\"","<ChevronLeft aria-hidden=\"true\" />","<div class=\"flex items-center justify-between gap-2\">\n <CalendarPrevious\n aria-label={props.previousLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </CalendarPrevious>\n {/*\n The first month's caption is ui-sdk's heading, a polite live region, so a\n turn of the month is announced once. Its id is fixed per calendar, so the\n months after it take a plain heading; each grid is named by its month.\n */}\n <Show when={props.offset === 0} fallback={<h2 class={captionClass}>{monthLabel()}</h2>}>\n <CalendarHeading class={captionClass}>{monthLabel()}</CalendarHeading>\n </Show>\n <CalendarNext\n aria-label={props.nextLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronRight aria-hidden=\"true\" />\n </CalendarNext>\n </div>","<CalendarHeading class={captionClass}>{monthLabel()}</CalendarHeading>","class={captionClass}","<CalendarNext\n aria-label={props.nextLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronRight aria-hidden=\"true\" />\n </CalendarNext>","<ChevronRight aria-hidden=\"true\" />","<CalendarGrid offset={props.offset} class=\"w-full border-collapse\">\n <CalendarWeekdays>\n {(index) => (\n <CalendarWeekday index={index} class=\"pb-1 text-2xs font-medium text-muted-foreground\">\n {(state) => weekdays()[state.weekday]}\n </CalendarWeekday>\n )}\n </CalendarWeekdays>\n <CalendarWeeks>\n {(cell) => (\n <CalendarDay\n value={cell.date}\n // The full date is the name: \"25\" alone is meaningless out of context.\n // Formatted here rather than by ui-sdk so it follows the runtime's\n // default locale and time zone, as the caption and weekdays do.\n aria-label={dayFormatter().format(fromISODate(cell.date))}\n class=\"group p-0.5 text-center focus-visible:outline-none\"\n >\n {(state: CalendarDayState) => (\n // The states are mirrored onto the painted box rather than read off\n // the cell, so the padding around it stays unfilled, as it was when\n // the box was a button inside the cell. `data-in-range` is the span\n // strictly between the ends, and an outside day is disabled here\n // while `disableOutsideDays` holds.\n <span\n aria-hidden=\"true\"\n class={DAY_CLASS}\n data-selected={flag(state.selected)}\n data-in-range={flag(state.inRange && !state.rangeStart && !state.rangeEnd)}\n data-range-start={flag(state.rangeStart)}\n data-range-end={flag(state.rangeEnd)}\n data-today={flag(state.today)}\n data-disabled={flag(state.disabled || (state.outside && props.outsideDisabled))}\n >\n {Number(state.date.slice(8))}\n </span>\n )}\n </CalendarDay>\n )}\n </CalendarWeeks>\n </CalendarGrid>","class=\"w-full border-collapse\"","<CalendarWeekdays>\n {(index) => (\n <CalendarWeekday index={index} class=\"pb-1 text-2xs font-medium text-muted-foreground\">\n {(state) => weekdays()[state.weekday]}\n </CalendarWeekday>\n )}\n </CalendarWeekdays>","<CalendarWeekday index={index} class=\"pb-1 text-2xs font-medium text-muted-foreground\">\n {(state) => weekdays()[state.weekday]}\n </CalendarWeekday>","class=\"pb-1 text-2xs font-medium text-muted-foreground\"","<CalendarWeeks>\n {(cell) => (\n <CalendarDay\n value={cell.date}\n // The full date is the name: \"25\" alone is meaningless out of context.\n // Formatted here rather than by ui-sdk so it follows the runtime's\n // default locale and time zone, as the caption and weekdays do.\n aria-label={dayFormatter().format(fromISODate(cell.date))}\n class=\"group p-0.5 text-center focus-visible:outline-none\"\n >\n {(state: CalendarDayState) => (\n // The states are mirrored onto the painted box rather than read off\n // the cell, so the padding around it stays unfilled, as it was when\n // the box was a button inside the cell. `data-in-range` is the span\n // strictly between the ends, and an outside day is disabled here\n // while `disableOutsideDays` holds.\n <span\n aria-hidden=\"true\"\n class={DAY_CLASS}\n data-selected={flag(state.selected)}\n data-in-range={flag(state.inRange && !state.rangeStart && !state.rangeEnd)}\n data-range-start={flag(state.rangeStart)}\n data-range-end={flag(state.rangeEnd)}\n data-today={flag(state.today)}\n data-disabled={flag(state.disabled || (state.outside && props.outsideDisabled))}\n >\n {Number(state.date.slice(8))}\n </span>\n )}\n </CalendarDay>\n )}\n </CalendarWeeks>","<CalendarDay\n value={cell.date}\n // The full date is the name: \"25\" alone is meaningless out of context.\n // Formatted here rather than by ui-sdk so it follows the runtime's\n // default locale and time zone, as the caption and weekdays do.\n aria-label={dayFormatter().format(fromISODate(cell.date))}\n class=\"group p-0.5 text-center focus-visible:outline-none\"\n >\n {(state: CalendarDayState) => (\n // The states are mirrored onto the painted box rather than read off\n // the cell, so the padding around it stays unfilled, as it was when\n // the box was a button inside the cell. `data-in-range` is the span\n // strictly between the ends, and an outside day is disabled here\n // while `disableOutsideDays` holds.\n <span\n aria-hidden=\"true\"\n class={DAY_CLASS}\n data-selected={flag(state.selected)}\n data-in-range={flag(state.inRange && !state.rangeStart && !state.rangeEnd)}\n data-range-start={flag(state.rangeStart)}\n data-range-end={flag(state.rangeEnd)}\n data-today={flag(state.today)}\n data-disabled={flag(state.disabled || (state.outside && props.outsideDisabled))}\n >\n {Number(state.date.slice(8))}\n </span>\n )}\n </CalendarDay>","class=\"group p-0.5 text-center focus-visible:outline-none\"","data-selected={flag(state.selected)}","data-in-range={flag(state.inRange && !state.rangeStart && !state.rangeEnd)}","data-range-start={flag(state.rangeStart)}","data-range-end={flag(state.rangeEnd)}","data-today={flag(state.today)}","data-disabled={flag(state.disabled || (state.outside && props.outsideDisabled))}","<div class=\"flex flex-col gap-2\">\n <div class=\"flex items-center justify-between gap-2\">\n <CalendarPrevious\n aria-label={props.previousLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </CalendarPrevious>\n {/*\n The first month's caption is ui-sdk's heading, a polite live region, so a\n turn of the month is announced once. Its id is fixed per calendar, so the\n months after it take a plain heading; each grid is named by its month.\n */}\n <Show when={props.offset === 0} fallback={<h2 class={captionClass}>{monthLabel()}</h2>}>\n <CalendarHeading class={captionClass}>{monthLabel()}</CalendarHeading>\n </Show>\n <CalendarNext\n aria-label={props.nextLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronRight aria-hidden=\"true\" />\n </CalendarNext>\n </div>\n <CalendarGrid offset={props.offset} class=\"w-full border-collapse\">\n <CalendarWeekdays>\n {(index) => (\n <CalendarWeekday index={index} class=\"pb-1 text-2xs font-medium text-muted-foreground\">\n {(state) => weekdays()[state.weekday]}\n </CalendarWeekday>\n )}\n </CalendarWeekdays>\n <CalendarWeeks>\n {(cell) => (\n <CalendarDay\n value={cell.date}\n // The full date is the name: \"25\" alone is meaningless out of context.\n // Formatted here rather than by ui-sdk so it follows the runtime's\n // default locale and time zone, as the caption and weekdays do.\n aria-label={dayFormatter().format(fromISODate(cell.date))}\n class=\"group p-0.5 text-center focus-visible:outline-none\"\n >\n {(state: CalendarDayState) => (\n // The states are mirrored onto the painted box rather than read off\n // the cell, so the padding around it stays unfilled, as it was when\n // the box was a button inside the cell. `data-in-range` is the span\n // strictly between the ends, and an outside day is disabled here\n // while `disableOutsideDays` holds.\n <span\n aria-hidden=\"true\"\n class={DAY_CLASS}\n data-selected={flag(state.selected)}\n data-in-range={flag(state.inRange && !state.rangeStart && !state.rangeEnd)}\n data-range-start={flag(state.rangeStart)}\n data-range-end={flag(state.rangeEnd)}\n data-today={flag(state.today)}\n data-disabled={flag(state.disabled || (state.outside && props.outsideDisabled))}\n >\n {Number(state.date.slice(8))}\n </span>\n )}\n </CalendarDay>\n )}\n </CalendarWeeks>\n </CalendarGrid>\n </div>","<Calendar\n {...options}\n class={cn('w-fit rounded-lg border border-border bg-card p-3', local.class)}\n onValueChange={(value, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n if (local.mode === 'multiple' && Array.isArray(value)) {\n // ui-sdk has no count bounds for a multiple selection; corvu's are kept here.\n const tooMany = local.max !== undefined && value.length > local.max\n const tooFew = local.min !== undefined && value.length < local.min\n if (tooMany || tooFew) return details.cancel()\n }\n ;(local.onValueChange as ((value: unknown) => void) | undefined)?.(\n fromSdkValue(local.mode, value)\n )\n }}\n onMonthChange={(month, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n local.onMonthChange?.(fromISODate(month))\n }}\n onFocusedChange={(date, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n local.onFocusedDayChange?.(fromISODate(date))\n }}\n >\n {(calendar: CalendarState) => (\n <For each={offsets()}>\n {(offset) => (\n <CalendarMonth\n calendar={calendar}\n offset={offset}\n weekdayLabels={local.weekdayLabels}\n previousLabel={local.previousLabel ?? 'Previous month'}\n nextLabel={local.nextLabel ?? 'Next month'}\n formatMonth={local.formatMonth}\n outsideDisabled={outsideDisabled()}\n />\n )}\n </For>\n )}\n </Calendar>","onValueChange={(value, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n if (local.mode === 'multiple' && Array.isArray(value)) {\n // ui-sdk has no count bounds for a multiple selection; corvu's are kept here.\n const tooMany = local.max !== undefined && value.length > local.max\n const tooFew = local.min !== undefined && value.length < local.min\n if (tooMany || tooFew) return details.cancel()\n }\n ;(local.onValueChange as ((value: unknown) => void) | undefined)?.(\n fromSdkValue(local.mode, value)\n )\n }}","onMonthChange={(month, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n local.onMonthChange?.(fromISODate(month))\n }}","onFocusedChange={(date, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n local.onFocusedDayChange?.(fromISODate(date))\n }}","<For each={offsets()}>\n {(offset) => (\n <CalendarMonth\n calendar={calendar}\n offset={offset}\n weekdayLabels={local.weekdayLabels}\n previousLabel={local.previousLabel ?? 'Previous month'}\n nextLabel={local.nextLabel ?? 'Next month'}\n formatMonth={local.formatMonth}\n outsideDisabled={outsideDisabled()}\n />\n )}\n </For>","<CalendarMonth\n calendar={calendar}\n offset={offset}\n weekdayLabels={local.weekdayLabels}\n previousLabel={local.previousLabel ?? 'Previous month'}\n nextLabel={local.nextLabel ?? 'Next month'}\n formatMonth={local.formatMonth}\n outsideDisabled={outsideDisabled()}\n />","<Show when={props.label}>\n {(labelSlot) => <p class=\"text-xs font-semibold text-foreground\">{labelSlot()}</p>}\n </Show>","<div class={cn('grid w-fit gap-2', props.class)}>\n <Show when={props.label}>\n {(labelSlot) => <p class=\"text-xs font-semibold text-foreground\">{labelSlot()}</p>}\n </Show>\n <CalendarSurface\n {...rest}\n mode=\"single\"\n value={props.value}\n onValueChange={props.onValueChange}\n />\n <Show when={props.footer}>\n {(footerSlot) => <div class=\"flex justify-end gap-2\">{footerSlot()}</div>}\n </Show>\n </div>","<CalendarSurface\n {...rest}\n mode=\"single\"\n value={props.value}\n onValueChange={props.onValueChange}\n />","mode=\"single\"","<Show when={props.footer}>\n {(footerSlot) => <div class=\"flex justify-end gap-2\">{footerSlot()}</div>}\n </Show>","LucideChevronLeft","LucideChevronRight","_$insert","_$effect","_$readShallow","_$className","_$setAttribute"],"sources":["../../../../src/components/ui/calendar/calendar.tsx"],"sourcesContent":["import { createMemo, For, Show, omit } from 'solid-js'\nimport { type ComponentProps, type JSX } from '@solidjs/web'\nimport {\n Calendar,\n CalendarDay,\n CalendarGrid,\n CalendarHeading,\n CalendarNext,\n CalendarPrevious,\n CalendarWeekday,\n CalendarWeekdays,\n CalendarWeeks,\n type CalendarDayState,\n type CalendarOptions,\n type CalendarState,\n type CalendarValue,\n} from '@ui-sdk/solid/calendar'\nimport { ChevronLeft as LucideChevronLeft, ChevronRight as LucideChevronRight } from '@lucide/solid'\nimport { fastIcon } from '#lib/fast-icon'\nimport { cn } from '#lib/utils'\nimport { Button } from '../button'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst ChevronLeft = fastIcon(LucideChevronLeft)\nconst ChevronRight = fastIcon(LucideChevronRight)\n\n/** The three selection modes. `mode` decides the shape of `value`. */\nexport type CalendarMode = 'single' | 'multiple' | 'range'\n\n/**\n * Calendar.\n *\n * A month grid, over ui-sdk's calendar. The primitive owns the hard part — the\n * roving `tabindex` that makes a grid of days one tab stop rather than 42, the\n * arrow-key, Page Up/Down and Home/End navigation, the range preview, and the\n * `aria-selected`/`aria-disabled`/`aria-current` bookkeeping on each day's\n * `gridcell`.\n *\n * What this component owns is the *presentation* of those states, and it is worth\n * saying why they are styled from `data-*` rather than from props: a day is today,\n * selected, in range, at a range end, and disabled independently, and a range\n * start that is also today has to read as both. Boolean props cannot express that\n * without a combinatorial explosion; the data attributes can.\n *\n * The props are `Date`-based and keep the shape this component had over corvu:\n * `value` is a `Date`, a `Date[]` or a `{ from, to }` range by `mode`, and the\n * month is `initialMonth`/`month`. ui-sdk speaks ISO strings (`\"2026-09-25\"`,\n * `[start, end]`), so this translates at the edge instead of making every caller\n * change. Dates are read and built in local time, as corvu did.\n *\n * Four things the primitive leaves open, and this closes:\n *\n * 1. **Each month has a caption heading.** The first is ui-sdk's heading, a polite\n * live region, so a screen reader user hears the month change.\n * 2. **The nav buttons have accessible names.** A bare chevron is not a name.\n * 3. **Today is a ring, not a fill.** A fill would be indistinguishable from\n * selected, and today is often also selected.\n * 4. **Outside days are drawn but not pickable** unless `disableOutsideDays` is\n * false — corvu's default, which ui-sdk does not have (it selects the day and\n * turns the month). A press on one is cancelled before it lands.\n */\n\n/** A range value. `to` is null while only the start is known. */\nexport type CalendarRange = { from: Date | null; to: Date | null }\n\n/** The props every mode shares. */\ntype CalendarSharedProps = {\n /** The month shown first when uncontrolled. Defaults to the selection's month, else today's. */\n initialMonth?: Date\n /** The month shown first, to control navigation. */\n month?: Date\n /** The first shown month changed (navigation, or a key moving past the edge). */\n onMonthChange?: (month: Date) => void\n /** Focus is about to move to another day. */\n onFocusedDayChange?: (day: Date) => void\n /** The first day of the week, 0 for Sunday. Defaults to Sunday. */\n startOfWeek?: number\n /** How many months show side by side. */\n numberOfMonths?: number\n /** Whether the neighbouring months' days at the grid's edges can be picked. Defaults to true (they cannot). */\n disableOutsideDays?: boolean\n /** Six weeks always, so the grid does not change height between months. */\n fixedWeeks?: boolean\n /** Days that cannot be picked. They stay focusable, so a keyboard user hears them. */\n disabled?: (day: Date) => boolean\n /** Accepted for compatibility; the grid follows the page's `dir`. */\n textDirection?: 'ltr' | 'rtl'\n}\n\nexport type CalendarSingleProps = CalendarSharedProps & {\n mode: 'single'\n value?: Date | null\n initialValue?: Date | null\n onValueChange?: (value: Date | null) => void\n /** When true, pressing the selected day again keeps it selected. */\n required?: boolean\n}\n\nexport type CalendarMultipleProps = CalendarSharedProps & {\n mode: 'multiple'\n value?: Date[]\n initialValue?: Date[]\n onValueChange?: (value: Date[]) => void\n /** The fewest days that may be selected. */\n min?: number\n /** The most days that may be selected. */\n max?: number\n}\n\nexport type CalendarRangeProps = CalendarSharedProps & {\n mode: 'range'\n value?: CalendarRange\n initialValue?: CalendarRange\n /** Runs once both ends are picked; between the presses ui-sdk previews the range. */\n onValueChange?: (value: CalendarRange) => void\n /** The fewest days a range can span, counting both ends. */\n min?: number\n /** The most days a range can span, counting both ends. */\n max?: number\n /** When true, a range cannot span a day `disabled` names. */\n excludeDisabled?: boolean\n}\n\n/**\n * The props this wrapper adds on top of the selection's. They are separate so\n * `omit` has a fixed list to pull out.\n */\ntype CalendarExtras = {\n /** Weekday header labels, Sunday first. Defaults to the locale's short names. */\n weekdayLabels?: readonly string[]\n /** Accessible names for the month navigation. Override for a non-English app. */\n previousLabel?: string\n nextLabel?: string\n /** Format a month for the caption. Defaults to `Intl.DateTimeFormat`. */\n formatMonth?: (month: Date) => string\n class?: string\n}\n\n/** The props of any of the three modes. `mode` decides the shape of `value`. */\nexport type CalendarProps = (CalendarSingleProps | CalendarMultipleProps | CalendarRangeProps) &\n CalendarExtras\n\n/** Every mode's props at once, for the translation code that switches on `mode` itself. */\ntype AnyModeProps = CalendarSharedProps &\n CalendarExtras & {\n mode: CalendarMode\n value?: Date | null | Date[] | CalendarRange\n initialValue?: Date | null | Date[] | CalendarRange\n onValueChange?: (value: never) => void\n required?: boolean\n min?: number\n max?: number\n excludeDisabled?: boolean\n }\n\nconst MONTH_FORMAT: Intl.DateTimeFormatOptions = { month: 'long', year: 'numeric' }\n\nconst pad = (value: number) => String(value).padStart(2, '0')\n\n/** A local `Date` as an ISO date, the calendar day the caller sees. */\nfunction toISODate(date: Date): string {\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`\n}\n\n/** An ISO date (or month, which reads as its first day) as a local `Date`. */\nfunction fromISODate(iso: string): Date {\n const [year, month, day] = iso.split('-').map(Number)\n return new Date(year!, month! - 1, day ?? 1)\n}\n\n/** An ISO month moved by whole months, like `\"2026-09\"` + 1 → `\"2026-10\"`. */\nfunction addMonths(month: string, offset: number): string {\n const [year, index] = month.split('-').map(Number)\n const date = new Date(year!, index! - 1 + offset, 1)\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}`\n}\n\nfunction toSdkValue(mode: CalendarMode, value: AnyModeProps['value']): CalendarValue | undefined {\n if (value === undefined) return undefined\n if (mode === 'multiple') return (value as Date[]).map(toISODate)\n if (mode === 'range') {\n const range = value as CalendarRange | null\n // A range with only a start reads as a one-day range: ui-sdk has no shape for\n // half a range outside the press that is picking it.\n return range?.from ? [toISODate(range.from), toISODate(range.to ?? range.from)] : null\n }\n return value ? toISODate(value as Date) : null\n}\n\nfunction fromSdkValue(mode: CalendarMode, value: CalendarValue): AnyModeProps['value'] {\n if (mode === 'multiple') return (Array.isArray(value) ? value : []).map(fromISODate)\n if (mode === 'range') {\n const [from, to] = Array.isArray(value) ? value : []\n return { from: from ? fromISODate(from) : null, to: to ? fromISODate(to) : null }\n }\n return typeof value === 'string' ? fromISODate(value) : null\n}\n\n/** The locale's short weekday names, Sunday first, indexed by `getDay()`. */\nfunction defaultWeekdays(): string[] {\n const format = new Intl.DateTimeFormat(undefined, { weekday: 'short' })\n // 2024-01-07 is a Sunday, so index 0 is Sunday without arithmetic.\n return Array.from({ length: 7 }, (_, index) => format.format(new Date(2024, 0, 7 + index)))\n}\n\n/** Whether a change came from a press on another month's day at the grid's edge. */\nfunction pressedOutsideDay(details: { event?: Event }): boolean {\n const target = details.event?.target\n return (\n target instanceof Element &&\n !!target.closest('[data-slot=\"calendar-day\"]')?.hasAttribute('data-outside')\n )\n}\n\nconst DAY_CLASS = cn(\n 'flex w-full items-center justify-center rounded-md text-xs text-foreground transition-colors',\n 'min-h-control-xs',\n // The day cell itself takes focus (it is the grid's `gridcell`), so the ring is\n // drawn here from the cell's focus, inside the cell's padding as before.\n 'hover:bg-muted group-focus-visible:ring-2 group-focus-visible:ring-ring',\n // Styled from data states, so a day can be a range end and today at once\n // without a prop per pair.\n 'data-selected:bg-primary data-selected:text-primary-foreground',\n // Every day of a range is selected, so the span between the ends steps back\n // to the subtle fill and the ends take the solid one again.\n 'data-in-range:bg-primary-subtle data-in-range:text-foreground',\n 'data-range-start:bg-primary data-range-start:text-primary-foreground',\n 'data-range-end:bg-primary data-range-end:text-primary-foreground',\n 'data-range-start:rounded-r-none data-range-end:rounded-l-none',\n 'data-today:ring-1 data-today:ring-ring',\n 'data-disabled:text-muted-foreground data-disabled:line-through',\n 'data-disabled:hover:bg-transparent'\n)\n\nconst flag = (on: boolean) => (on ? '' : undefined)\n\n/**\n * One month: its navigation row, its caption and its grid. `offset` is which of\n * the months shown it is; `calendar` is the root's state, read lazily in the JSX\n * so a month change re-renders the caption rather than the whole block.\n */\nfunction CalendarMonth(props: {\n calendar: CalendarState\n offset: number\n weekdayLabels?: readonly string[]\n previousLabel: string\n nextLabel: string\n formatMonth?: (month: Date) => string\n outsideDisabled: boolean\n}) {\n const month = createMemo(() => addMonths(props.calendar.month, props.offset))\n // The default names and the day formatter are rebuilt when the month turns, so\n // navigation picks up changed locale and time-zone defaults.\n const weekdays = createMemo(() => {\n void month()\n return props.weekdayLabels ?? defaultWeekdays()\n })\n const dayFormatter = createMemo(() => {\n void month()\n return new Intl.DateTimeFormat(undefined, { day: 'numeric', month: 'long', year: 'numeric' })\n })\n const monthLabel = () => {\n const date = fromISODate(month())\n return props.formatMonth\n ? props.formatMonth(date)\n : new Intl.DateTimeFormat(undefined, MONTH_FORMAT).format(date)\n }\n const captionClass = 'text-sm font-semibold text-foreground'\n\n return (\n <div class=\"flex flex-col gap-2\">\n <div class=\"flex items-center justify-between gap-2\">\n <CalendarPrevious\n aria-label={props.previousLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </CalendarPrevious>\n {/*\n The first month's caption is ui-sdk's heading, a polite live region, so a\n turn of the month is announced once. Its id is fixed per calendar, so the\n months after it take a plain heading; each grid is named by its month.\n */}\n <Show when={props.offset === 0} fallback={<h2 class={captionClass}>{monthLabel()}</h2>}>\n <CalendarHeading class={captionClass}>{monthLabel()}</CalendarHeading>\n </Show>\n <CalendarNext\n aria-label={props.nextLabel}\n render={(part) => <Button {...part} variant=\"ghost\" size=\"icon-sm\" />}\n >\n <ChevronRight aria-hidden=\"true\" />\n </CalendarNext>\n </div>\n <CalendarGrid offset={props.offset} class=\"w-full border-collapse\">\n <CalendarWeekdays>\n {(index) => (\n <CalendarWeekday index={index} class=\"pb-1 text-2xs font-medium text-muted-foreground\">\n {(state) => weekdays()[state.weekday]}\n </CalendarWeekday>\n )}\n </CalendarWeekdays>\n <CalendarWeeks>\n {(cell) => (\n <CalendarDay\n value={cell.date}\n // The full date is the name: \"25\" alone is meaningless out of context.\n // Formatted here rather than by ui-sdk so it follows the runtime's\n // default locale and time zone, as the caption and weekdays do.\n aria-label={dayFormatter().format(fromISODate(cell.date))}\n class=\"group p-0.5 text-center focus-visible:outline-none\"\n >\n {(state: CalendarDayState) => (\n // The states are mirrored onto the painted box rather than read off\n // the cell, so the padding around it stays unfilled, as it was when\n // the box was a button inside the cell. `data-in-range` is the span\n // strictly between the ends, and an outside day is disabled here\n // while `disableOutsideDays` holds.\n <span\n aria-hidden=\"true\"\n class={DAY_CLASS}\n data-selected={flag(state.selected)}\n data-in-range={flag(state.inRange && !state.rangeStart && !state.rangeEnd)}\n data-range-start={flag(state.rangeStart)}\n data-range-end={flag(state.rangeEnd)}\n data-today={flag(state.today)}\n data-disabled={flag(state.disabled || (state.outside && props.outsideDisabled))}\n >\n {Number(state.date.slice(8))}\n </span>\n )}\n </CalendarDay>\n )}\n </CalendarWeeks>\n </CalendarGrid>\n </div>\n )\n}\n\n/**\n * Generic over the mode on purpose: a type parameter keeps `mode` a literal at\n * the call site, so `value` and `onValueChange` are checked against that mode's\n * shape rather than the union of all three.\n */\nexport function CalendarSurface<M extends CalendarMode>(props: CalendarProps & { mode: M }) {\n const local = props as unknown as AnyModeProps\n const outsideDisabled = () => local.disableOutsideDays ?? true\n const offsets = () => Array.from({ length: Math.max(1, local.numberOfMonths ?? 1) }, (_, i) => i)\n\n const options = {\n get mode() {\n return local.mode\n },\n get value() {\n return toSdkValue(local.mode, local.value)\n },\n get defaultValue() {\n return toSdkValue(local.mode, local.initialValue)\n },\n get month() {\n return local.month ? toISODate(local.month).slice(0, 7) : undefined\n },\n get defaultMonth() {\n return local.initialMonth ? toISODate(local.initialMonth).slice(0, 7) : undefined\n },\n get weekStartsOn() {\n return local.startOfWeek ?? 0\n },\n get months() {\n return local.numberOfMonths\n },\n get fixedWeeks() {\n return local.fixedWeeks\n },\n get unavailable() {\n const disabled = local.disabled\n return disabled ? (date: string) => disabled(fromISODate(date)) : undefined\n },\n get deselectable() {\n return local.mode === 'single' && !local.required\n },\n get minDays() {\n return local.mode === 'range' ? local.min : undefined\n },\n get maxDays() {\n return local.mode === 'range' ? local.max : undefined\n },\n get allowUnavailable() {\n return local.mode === 'range' ? !local.excludeDisabled : undefined\n },\n } satisfies CalendarOptions\n\n return (\n <Calendar\n {...options}\n class={cn('w-fit rounded-lg border border-border bg-card p-3', local.class)}\n onValueChange={(value, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n if (local.mode === 'multiple' && Array.isArray(value)) {\n // ui-sdk has no count bounds for a multiple selection; corvu's are kept here.\n const tooMany = local.max !== undefined && value.length > local.max\n const tooFew = local.min !== undefined && value.length < local.min\n if (tooMany || tooFew) return details.cancel()\n }\n ;(local.onValueChange as ((value: unknown) => void) | undefined)?.(\n fromSdkValue(local.mode, value)\n )\n }}\n onMonthChange={(month, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n local.onMonthChange?.(fromISODate(month))\n }}\n onFocusedChange={(date, details) => {\n if (outsideDisabled() && pressedOutsideDay(details)) return details.cancel()\n local.onFocusedDayChange?.(fromISODate(date))\n }}\n >\n {(calendar: CalendarState) => (\n <For each={offsets()}>\n {(offset) => (\n <CalendarMonth\n calendar={calendar}\n offset={offset}\n weekdayLabels={local.weekdayLabels}\n previousLabel={local.previousLabel ?? 'Previous month'}\n nextLabel={local.nextLabel ?? 'Next month'}\n formatMonth={local.formatMonth}\n outsideDisabled={outsideDisabled()}\n />\n )}\n </For>\n )}\n </Calendar>\n )\n}\n\n/**\n * Built from the *single* props rather than from `CalendarProps` with `mode`\n * omitted. Omitting a discriminant leaves the other members of the union behind\n * — `value` stays `Date | Date[] | {from,to}` — and the picker would then have to\n * cast to prove what its own name already says.\n */\nexport type DatePickerProps = Omit<CalendarSingleProps, 'mode'> &\n CalendarExtras & {\n /** A labelled heading above the grid. */\n label?: string\n /** A footer slot: the confirm and cancel row a picker usually has. */\n footer?: JSX.Element\n }\n\n/**\n * A single-day picker: the calendar with a name and a footer. Split from\n * `CalendarSurface` because a bare calendar is a control inside a form the caller\n * already owns, while a picker is a thing the caller drops in — and the two want\n * different surroundings.\n */\nexport function DatePicker(props: DatePickerProps) {\n const rest = omit(props, 'value', 'onValueChange', 'label', 'footer', 'class')\n\n return (\n <div class={cn('grid w-fit gap-2', props.class)}>\n <Show when={props.label}>\n {(labelSlot) => <p class=\"text-xs font-semibold text-foreground\">{labelSlot()}</p>}\n </Show>\n <CalendarSurface\n {...rest}\n mode=\"single\"\n value={props.value}\n onValueChange={props.onValueChange}\n />\n <Show when={props.footer}>\n {(footerSlot) => <div class=\"flex justify-end gap-2\">{footerSlot()}</div>}\n </Show>\n </div>\n )\n}\n\n/**\n * The name this type had when the props were corvu's; kept so a caller that typed\n * a value against it still compiles.\n */\nexport type { CalendarProps as CorvuCalendarProps }\n/** ui-sdk's calendar root, for a caller composing its own grid from ui-sdk's parts. */\nexport { Calendar as CalendarRoot }\nexport type CalendarElementProps = ComponentProps<'div'>\n"],"mappings":";;;;;;;;;;;;;;AAuBA,IAAM,cAAc,SAASqC,aAAiB;AAC9C,IAAM,eAAe,SAASC,cAAkB;AAmIhD,IAAM,eAA2C;CAAE,OAAO;CAAQ,MAAM;AAAU;AAElF,IAAM,OAAO,UAAkB,OAAO,KAAK,CAAC,CAAC,SAAS,GAAG,GAAG;;AAG5D,SAAS,UAAU,MAAoB;CACrC,OAAO,GAAG,KAAK,YAAY,EAAE,GAAG,IAAI,KAAK,SAAS,IAAI,CAAC,EAAE,GAAG,IAAI,KAAK,QAAQ,CAAC;AAChF;;AAGA,SAAS,YAAY,KAAmB;CACtC,MAAM,CAAC,MAAM,OAAO,OAAO,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CACpD,OAAO,IAAI,KAAK,MAAO,QAAS,GAAG,OAAO,CAAC;AAC7C;;AAGA,SAAS,UAAU,OAAe,QAAwB;CACxD,MAAM,CAAC,MAAM,SAAS,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CACjD,MAAM,OAAO,IAAI,KAAK,MAAO,QAAS,IAAI,QAAQ,CAAC;CACnD,OAAO,GAAG,KAAK,YAAY,EAAE,GAAG,IAAI,KAAK,SAAS,IAAI,CAAC;AACzD;AAEA,SAAS,WAAW,MAAoB,OAAyD;CAC/F,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,IAAI,SAAS,YAAY,OAAQ,MAAiB,IAAI,SAAS;CAC/D,IAAI,SAAS,SAAS;EACpB,MAAM,QAAQ;EAGd,OAAO,OAAO,OAAO,CAAC,UAAU,M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AAA;EAEA,CAAA;CAEC,CAAA,CAAA;AAEd;;;;;;;AAsBA,SAAgB,WAAW,OAAwB;CACjD,MAAM,OAAO,KAAK,OAAO,SAAS,iBAAiB,SAAS,UAAU,OAAO;CAG3E,IAAA,QAAA,QAaK;CAbL,IAAA,QAAA,MAAA;;;CACEC,OAAAA,OAAAA,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAK;EAAvBA,WACI,qBAAc;GAAiE,IAAA,SAAA,QAAA;GAAjEO,OAAA,QAAkD,SAAe;GAAjE,OAAA;EAAiE,EAAA,CAAA;CAC7E,CAAA,GAHRN,KAaK;CAbLM,OAAA,OAIEL,gBAAAA,iBAAAA,WACM,MADN;EAEEC,MAAK;EACL,IAAA,QAAA;GAAO,OAAA,MAAM;EAAK;EAClB,IAAA,gBAAA;GAAe,OAAA,MAAM;EAAa;CACnC,CAAA,CAAA,GATHF,MAaK;CAbLM,OAAA,OAUEH,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAM;EAAxBA,WACI,sBAAe;GAAuD,IAAA,SAAA,QAAA;GAAvDG,OAAA,QAAqC,UAAkB;GAAvD,OAAA;EAAuD,EAAA,CAAA;CACpE,CAAA,GAZRN,MAaK;CAbAO,aAAAC,YAAO,GAAG,oBAAoB,MAAM,KAAK,CAAC,IAA1C,KAAA,QAAA;EAA0CC,UAAA,OAAA,KAAA,GAAA;;CADjD,OACET;AAeJ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { cva } from "../../../lib/variants.js";
|
|
2
|
-
import { cn } from "../../../lib/utils.js";
|
|
3
1
|
import { insert, spread, template } from "@solidjs/web";
|
|
4
2
|
import { children, createMemo, omit } from "solid-js";
|
|
3
|
+
import { cva } from "../../../lib/variants.js";
|
|
4
|
+
import { cn } from "../../../lib/utils.js";
|
|
5
5
|
// src/components/ui/callout/callout.tsx
|
|
6
6
|
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
7
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callout.js","names":["role=\"note\"","<div\n data-slot=\"callout\"\n data-title-only={titleOnly() ? '' : undefined}\n role=\"note\"\n class={cn(calloutVariants({ variant: local.variant, size: local.size }), local.class)}\n {...rest}\n >\n {resolved()}\n </div>","<div\n data-slot=\"callout-title\"\n class={cn('mb-1 font-medium tracking-tight in-data-title-only:mb-0', local.class)}\n {...rest}\n />"],"sources":["../../../../src/components/ui/callout/callout.tsx"],"sourcesContent":["import type { ComponentProps } from '@solidjs/web'\nimport { children, createMemo, omit } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Callout.\n *\n * A quiet aside that belongs to the content around it: the summary at the top of\n * an answer, a note in documentation, a remembered fact beside the reply that\n * used it. It is a card-coloured block with one rule on its start edge, and\n * nothing about it interrupts the reader.\n *\n * That is the difference from `Alert`. An `Alert` is a message about the state of\n * the surface it sits in, a failed sync, a validation summary, so it is always\n * `role=\"alert\"`, a live announcement, with a tone glyph and a tinted status\n * surface. A callout is static page content: a plain `div` with `role=\"note\"`, no\n * live region, no icon, and no tint. A caller whose note really is a status\n * message uses `Alert`; one whose note needs a different landmark role passes\n * `role`. Reach for `Card` when the block is a self-contained object with its own\n * header, content and footer; a callout has no parts beyond an optional\n * `CalloutTitle`.\n *\n * The rule is the only thing that varies by `variant`: `default` is the accent\n * (`--primary`), and the four status hues use the same tokens `Alert` does. The\n * rule is a logical `border-s-*`, so it moves to the right in RTL. The corners\n * stay square because a rounded box would curve the rule into a crescent.\n *\n * `size` is the padding rung and the rule's weight together, so a caller never\n * sets `p-*` or a border width to make one denser. The rungs are Cortana's three\n * answer-view callouts, expressed in the Tailwind spacing scale:\n *\n * - `lg`: 22px / 24px padding, 3px rule: Cortana's `.answer-copy`.\n * - `md`: 18px / 20px padding, 3px rule: Cortana's `.answer-memory`.\n * - `sm`: 12px / 14px padding, 2px rule: Cortana's `.answer-note`.\n *\n * Type size and colour are inherited rather than set (only the card foreground is\n * applied), so a callout in a dense panel and one in an article both read at the\n * size of the text around them.\n *\n * Text that has no break opportunity (a 200-character token, a URL, a file path)\n * wraps with `overflow-wrap: anywhere` rather than overflowing the box. `anywhere`\n * and not `break-word`, because only `anywhere` lowers the box's min-content width:\n * a callout that is a flex or grid item (auto minimum size) then shrinks to its\n * track instead of stretching it. The callout's own padding, rule and width are\n * untouched, so none of its sizing differs from Cortana's.\n *\n * The block is deliberately not a flex or grid container: its children are inline\n * text, links and code, and a flex root would turn each of those into a separate\n * item and break the line.\n */\nexport const calloutVariants = cva(\n 'bg-card text-card-foreground block rounded-none wrap-anywhere',\n {\n variants: {\n variant: {\n default: 'border-s-primary',\n destructive: 'border-s-destructive',\n success: 'border-s-success',\n warning: 'border-s-warning',\n info: 'border-s-info',\n },\n size: {\n /** 12px block / 14px inline padding, 2px rule: a short inline note. */\n sm: 'border-s-2 px-3.5 py-3',\n /** 18px block / 20px inline padding, 3px rule: a supporting aside. */\n md: 'border-s-3 px-5 py-4.5',\n /** 22px block / 24px inline padding, 3px rule: the lead summary of a view. */\n lg: 'border-s-3 px-6 py-5.5',\n },\n },\n defaultVariants: { variant: 'default', size: 'md' },\n }\n)\n\nexport type CalloutProps = ComponentProps<'div'> & VariantProps<typeof calloutVariants>\n\nconst isRendered = (node: unknown) =>\n node != null && typeof node !== 'boolean' && (typeof node !== 'string' || node.trim() !== '')\n\nconst isCalloutTitle = (node: unknown) =>\n typeof node === 'object' &&\n node !== null &&\n 'getAttribute' in node &&\n typeof node.getAttribute === 'function' &&\n node.getAttribute('data-slot') === 'callout-title'\n\nexport function Callout(props: CalloutProps) {\n const local = props\n const rest = omit(props, 'class', 'variant', 'size', 'children')\n const resolved = children(() => local.children)\n // CSS cannot see text nodes, so the callout looks at what it renders and marks a\n // title with nothing after it. The title reads the mark to drop its bottom margin.\n const titleOnly = createMemo(() => {\n const nodes = resolved.toArray().filter(isRendered)\n return nodes.length === 1 && isCalloutTitle(nodes[0])\n })\n return (\n <div\n data-slot=\"callout\"\n data-title-only={titleOnly() ? '' : undefined}\n role=\"note\"\n class={cn(calloutVariants({ variant: local.variant, size: local.size }), local.class)}\n {...rest}\n >\n {resolved()}\n </div>\n )\n}\n\n/**\n * An optional heading line for the callout. It is a styled `div`, not a heading\n * element: a callout sits inside someone else's outline, and a fixed heading\n * level would break it. Pass `role=\"heading\"` with `aria-level` where the\n * content does belong in the outline.\n *\n * The title carries a 4px (`mb-1`) margin below it, whatever follows: a\n * paragraph, a list, or bare text. CSS cannot see text nodes, so a selector such\n * as `:last-child` or `:only-child` cannot tell `<Title/>text` (needs the gap)\n * from `<Title/>` (needs none), and `not-last:mb-1` silently dropped the gap for\n * bare text, the most common body. So the gap stays the default and the one case\n * that does not want it is detected by `Callout`, which sees its rendered\n * children: a callout whose only child is a title carries `data-title-only`, and\n * the title drops its margin so the block ends at its own padding. A caller never\n * passes `mb-0` for this. Anything else after the title, text included, keeps the\n * gap.\n */\nexport function CalloutTitle(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <div\n data-slot=\"callout-title\"\n class={cn('mb-1 font-medium tracking-tight in-data-title-only:mb-0', local.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAa,kBAAkB,IAC7B,iEACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,aAAa;GACb,SAAS;GACT,SAAS;GACT,MAAM;EACR;EACA,MAAM;;GAEJ,IAAI;;GAEJ,IAAI;;GAEJ,IAAI;EACN;CACF;CACA,iBAAiB;EAAE,SAAS;EAAW,MAAM;CAAK;AACpD,CACF;AAIA,IAAM,cAAc,SAClB,QAAQ,QAAQ,OAAO,SAAS,cAAc,OAAO,SAAS,YAAY,KAAK,KAAK,MAAM;AAE5F,IAAM,kBAAkB,SACtB,OAAO,SAAS,YAChB,SAAS,QACT,kBAAkB,QAClB,OAAO,KAAK,iBAAiB,cAC7B,KAAK,aAAa,WAAW,MAAM;AAErC,SAAgB,QAAQ,OAAqB;CAC3C,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,WAAW,QAAQ,UAAU;CAC/D,MAAM,WAAW,eAAe,MAAM,QAAQ;CAG9C,MAAM,YAAY,iBAAiB;EACjC,MAAM,QAAQ,SAAS,QAAQ,CAAC,CAAC,OAAO,UAAU;EAClD,OAAO,MAAM,WAAW,KAAK,eAAe,MAAM,EAAE;CACtD,CAAC;CAEC,IAAA,OAAA,OAQK;
|
|
1
|
+
{"version":3,"file":"callout.js","names":["role=\"note\"","<div\n data-slot=\"callout\"\n data-title-only={titleOnly() ? '' : undefined}\n role=\"note\"\n class={cn(calloutVariants({ variant: local.variant, size: local.size }), local.class)}\n {...rest}\n >\n {resolved()}\n </div>","<div\n data-slot=\"callout-title\"\n class={cn('mb-1 font-medium tracking-tight in-data-title-only:mb-0', local.class)}\n {...rest}\n />","_$spread","_$insert"],"sources":["../../../../src/components/ui/callout/callout.tsx"],"sourcesContent":["import type { ComponentProps } from '@solidjs/web'\nimport { children, createMemo, omit } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Callout.\n *\n * A quiet aside that belongs to the content around it: the summary at the top of\n * an answer, a note in documentation, a remembered fact beside the reply that\n * used it. It is a card-coloured block with one rule on its start edge, and\n * nothing about it interrupts the reader.\n *\n * That is the difference from `Alert`. An `Alert` is a message about the state of\n * the surface it sits in, a failed sync, a validation summary, so it is always\n * `role=\"alert\"`, a live announcement, with a tone glyph and a tinted status\n * surface. A callout is static page content: a plain `div` with `role=\"note\"`, no\n * live region, no icon, and no tint. A caller whose note really is a status\n * message uses `Alert`; one whose note needs a different landmark role passes\n * `role`. Reach for `Card` when the block is a self-contained object with its own\n * header, content and footer; a callout has no parts beyond an optional\n * `CalloutTitle`.\n *\n * The rule is the only thing that varies by `variant`: `default` is the accent\n * (`--primary`), and the four status hues use the same tokens `Alert` does. The\n * rule is a logical `border-s-*`, so it moves to the right in RTL. The corners\n * stay square because a rounded box would curve the rule into a crescent.\n *\n * `size` is the padding rung and the rule's weight together, so a caller never\n * sets `p-*` or a border width to make one denser. The rungs are Cortana's three\n * answer-view callouts, expressed in the Tailwind spacing scale:\n *\n * - `lg`: 22px / 24px padding, 3px rule: Cortana's `.answer-copy`.\n * - `md`: 18px / 20px padding, 3px rule: Cortana's `.answer-memory`.\n * - `sm`: 12px / 14px padding, 2px rule: Cortana's `.answer-note`.\n *\n * Type size and colour are inherited rather than set (only the card foreground is\n * applied), so a callout in a dense panel and one in an article both read at the\n * size of the text around them.\n *\n * Text that has no break opportunity (a 200-character token, a URL, a file path)\n * wraps with `overflow-wrap: anywhere` rather than overflowing the box. `anywhere`\n * and not `break-word`, because only `anywhere` lowers the box's min-content width:\n * a callout that is a flex or grid item (auto minimum size) then shrinks to its\n * track instead of stretching it. The callout's own padding, rule and width are\n * untouched, so none of its sizing differs from Cortana's.\n *\n * The block is deliberately not a flex or grid container: its children are inline\n * text, links and code, and a flex root would turn each of those into a separate\n * item and break the line.\n */\nexport const calloutVariants = cva(\n 'bg-card text-card-foreground block rounded-none wrap-anywhere',\n {\n variants: {\n variant: {\n default: 'border-s-primary',\n destructive: 'border-s-destructive',\n success: 'border-s-success',\n warning: 'border-s-warning',\n info: 'border-s-info',\n },\n size: {\n /** 12px block / 14px inline padding, 2px rule: a short inline note. */\n sm: 'border-s-2 px-3.5 py-3',\n /** 18px block / 20px inline padding, 3px rule: a supporting aside. */\n md: 'border-s-3 px-5 py-4.5',\n /** 22px block / 24px inline padding, 3px rule: the lead summary of a view. */\n lg: 'border-s-3 px-6 py-5.5',\n },\n },\n defaultVariants: { variant: 'default', size: 'md' },\n }\n)\n\nexport type CalloutProps = ComponentProps<'div'> & VariantProps<typeof calloutVariants>\n\nconst isRendered = (node: unknown) =>\n node != null && typeof node !== 'boolean' && (typeof node !== 'string' || node.trim() !== '')\n\nconst isCalloutTitle = (node: unknown) =>\n typeof node === 'object' &&\n node !== null &&\n 'getAttribute' in node &&\n typeof node.getAttribute === 'function' &&\n node.getAttribute('data-slot') === 'callout-title'\n\nexport function Callout(props: CalloutProps) {\n const local = props\n const rest = omit(props, 'class', 'variant', 'size', 'children')\n const resolved = children(() => local.children)\n // CSS cannot see text nodes, so the callout looks at what it renders and marks a\n // title with nothing after it. The title reads the mark to drop its bottom margin.\n const titleOnly = createMemo(() => {\n const nodes = resolved.toArray().filter(isRendered)\n return nodes.length === 1 && isCalloutTitle(nodes[0])\n })\n return (\n <div\n data-slot=\"callout\"\n data-title-only={titleOnly() ? '' : undefined}\n role=\"note\"\n class={cn(calloutVariants({ variant: local.variant, size: local.size }), local.class)}\n {...rest}\n >\n {resolved()}\n </div>\n )\n}\n\n/**\n * An optional heading line for the callout. It is a styled `div`, not a heading\n * element: a callout sits inside someone else's outline, and a fixed heading\n * level would break it. Pass `role=\"heading\"` with `aria-level` where the\n * content does belong in the outline.\n *\n * The title carries a 4px (`mb-1`) margin below it, whatever follows: a\n * paragraph, a list, or bare text. CSS cannot see text nodes, so a selector such\n * as `:last-child` or `:only-child` cannot tell `<Title/>text` (needs the gap)\n * from `<Title/>` (needs none), and `not-last:mb-1` silently dropped the gap for\n * bare text, the most common body. So the gap stays the default and the one case\n * that does not want it is detected by `Callout`, which sees its rendered\n * children: a callout whose only child is a title carries `data-title-only`, and\n * the title drops its margin so the block ends at its own padding. A caller never\n * passes `mb-0` for this. Anything else after the title, text included, keeps the\n * gap.\n */\nexport function CalloutTitle(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <div\n data-slot=\"callout-title\"\n class={cn('mb-1 font-medium tracking-tight in-data-title-only:mb-0', local.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAa,kBAAkB,IAC7B,iE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A2D,MAAM,KAAK;EAAC;CACzE,GAAJ,IAAA,GAAA,KAAA;CAJR,OACED;AAMJ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { spread, template } from "@solidjs/web";
|
|
2
|
+
import { omit } from "solid-js";
|
|
1
3
|
import { cva } from "../../../lib/variants.js";
|
|
2
4
|
import { cn } from "../../../lib/utils.js";
|
|
3
5
|
import { headingVariants } from "../typography/typography.js";
|
|
4
|
-
import { spread, template } from "@solidjs/web";
|
|
5
|
-
import { omit } from "solid-js";
|
|
6
6
|
// src/components/ui/card/card.tsx
|
|
7
7
|
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","names":["<div data-slot=\"card\" class={cn(cardVariants({ size: local.size }), local.class)} {...rest} />","<div\n data-slot=\"card-header\"\n class={cn(\n 'grid grid-cols-1 auto-rows-min gap-x-4 gap-y-1 px-4 has-[>[data-slot=card-action]]:grid-cols-[minmax(0,1fr)_auto]',\n local.class\n )}\n {...rest}\n />","<div\n data-slot=\"card-title\"\n class={cn(headingVariants({ size: 'card', leading: 'none' }), local.class)}\n {...rest}\n />","<div\n data-slot=\"card-description\"\n class={cn('text-muted-foreground text-sm', local.class)}\n {...rest}\n />","<div\n data-slot=\"card-action\"\n class={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', local.class)}\n {...rest}\n />","<div data-slot=\"card-content\" class={cn('px-4', local.class)} {...rest} />","<div data-slot=\"card-footer\" class={cn('flex items-center px-4', local.class)} {...rest} />"],"sources":["../../../../src/components/ui/card/card.tsx"],"sourcesContent":["import type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\nimport { headingVariants } from '../typography'\n\n/**\n * Card.\n *\n * A surface that sits on the canvas. Every card carries its own edge, a\n * border, because in the light theme `--card` is one faint step off a white\n * `--background`, and a borderless card there all but disappears. Making the border\n * structural rather than optional is what stops one app's cards from reading\n * as floating panels and another's as nothing at all.\n *\n * The parts are separate components rather than a template because a card's\n * header, content and footer have different padding on purpose: the header and\n * footer are tight, the content breathes.\n *\n * `size` is the card's padding rung, so a caller never sets `p-*` or `gap-*` on\n * a card to make it denser. `sm` tightens the card and its header, content and\n * footer together (the parts' inline padding follows the card, so they stay\n * aligned with each other); `flush` removes the block padding and gap for a\n * card whose body is a list of rows or a scroll area that runs edge to edge.\n */\nexport const cardVariants = cva(\n 'bg-card text-card-foreground flex flex-col rounded-xl border border-border shadow-xs',\n {\n variants: {\n size: {\n /** 16px block padding and gap; the parts carry 16px inline padding. */\n default: 'gap-4 py-4',\n /** 12px everywhere: a dense settings or status card. */\n sm: 'gap-3 py-3 *:data-[slot=card-content]:px-3 *:data-[slot=card-footer]:px-3 *:data-[slot=card-header]:px-3',\n /** No block padding or gap: the card hosts a row list or a scroller. */\n flush: 'gap-0 py-0',\n },\n },\n defaultVariants: { size: 'default' },\n }\n)\n\nexport type CardProps = ComponentProps<'div'> & VariantProps<typeof cardVariants>\n\nexport function Card(props: CardProps) {\n const local = props\n const rest = omit(props, 'class', 'size')\n return (\n <div data-slot=\"card\" class={cn(cardVariants({ size: local.size }), local.class)} {...rest} />\n )\n}\n\n/**\n * The header is a grid so that `CardAction` has tracks to be placed in: the\n * action is a direct child that takes a second column spanning the title and\n * description rows. A flex column gives `col-start-2` nothing to land on and\n * the action would simply stack under the copy. The extra column exists only\n * for a direct-child action: a wrapper around it is then the header's single\n * grid item, so it keeps the full width. A header without an action lays out as\n * it always did (one full-width column, 4px between its children).\n */\nexport function CardHeader(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <div\n data-slot=\"card-header\"\n class={cn(\n 'grid grid-cols-1 auto-rows-min gap-x-4 gap-y-1 px-4 has-[>[data-slot=card-action]]:grid-cols-[minmax(0,1fr)_auto]',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function CardTitle(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <div\n data-slot=\"card-title\"\n class={cn(headingVariants({ size: 'card', leading: 'none' }), local.class)}\n {...rest}\n />\n )\n}\n\nexport function CardDescription(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <div\n data-slot=\"card-description\"\n class={cn('text-muted-foreground text-sm', local.class)}\n {...rest}\n />\n )\n}\n\nexport function CardAction(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <div\n data-slot=\"card-action\"\n class={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', local.class)}\n {...rest}\n />\n )\n}\n\nexport function CardContent(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return <div data-slot=\"card-content\" class={cn('px-4', local.class)} {...rest} />\n}\n\nexport function CardFooter(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return <div data-slot=\"card-footer\" class={cn('flex items-center px-4', local.class)} {...rest} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAa,eAAe,IAC1B,wFACA;CACE,UAAU,EACR,MAAM;;EAEJ,SAAS;;EAET,IAAI;;EAEJ,OAAO;CACT,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CACF;AAIA,SAAgB,KAAK,OAAkB;CACrC,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,MAAM;CAEtC,IAAA,OAAA,OAA6F;
|
|
1
|
+
{"version":3,"file":"card.js","names":["<div data-slot=\"card\" class={cn(cardVariants({ size: local.size }), local.class)} {...rest} />","<div\n data-slot=\"card-header\"\n class={cn(\n 'grid grid-cols-1 auto-rows-min gap-x-4 gap-y-1 px-4 has-[>[data-slot=card-action]]:grid-cols-[minmax(0,1fr)_auto]',\n local.class\n )}\n {...rest}\n />","<div\n data-slot=\"card-title\"\n class={cn(headingVariants({ size: 'card', leading: 'none' }), local.class)}\n {...rest}\n />","<div\n data-slot=\"card-description\"\n class={cn('text-muted-foreground text-sm', local.class)}\n {...rest}\n />","<div\n data-slot=\"card-action\"\n class={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', local.class)}\n {...rest}\n />","<div data-slot=\"card-content\" class={cn('px-4', local.class)} {...rest} />","<div data-slot=\"card-footer\" class={cn('flex items-center px-4', local.class)} {...rest} />","_$spread"],"sources":["../../../../src/components/ui/card/card.tsx"],"sourcesContent":["import type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\nimport { headingVariants } from '../typography'\n\n/**\n * Card.\n *\n * A surface that sits on the canvas. Every card carries its own edge, a\n * border, because in the light theme `--card` is one faint step off a white\n * `--background`, and a borderless card there all but disappears. Making the border\n * structural rather than optional is what stops one app's cards from reading\n * as floating panels and another's as nothing at all.\n *\n * The parts are separate components rather than a template because a card's\n * header, content and footer have different padding on purpose: the header and\n * footer are tight, the content breathes.\n *\n * `size` is the card's padding rung, so a caller never sets `p-*` or `gap-*` on\n * a card to make it denser. `sm` tightens the card and its header, content and\n * footer together (the parts' inline padding follows the card, so they stay\n * aligned with each other); `flush` removes the block padding and gap for a\n * card whose body is a list of rows or a scroll area that runs edge to edge.\n */\nexport const cardVariants = cva(\n 'bg-card text-card-foreground flex flex-col rounded-xl border border-border shadow-xs',\n {\n variants: {\n size: {\n /** 16px block padding and gap; the parts carry 16px inline padding. */\n default: 'gap-4 py-4',\n /** 12px everywhere: a dense settings or status card. */\n sm: 'gap-3 py-3 *:data-[slot=card-content]:px-3 *:data-[slot=card-footer]:px-3 *:data-[slot=card-header]:px-3',\n /** No block padding or gap: the card hosts a row list or a scroller. */\n flush: 'gap-0 py-0',\n },\n },\n defaultVariants: { size: 'default' },\n }\n)\n\nexport type CardProps = ComponentProps<'div'> & VariantProps<typeof cardVariants>\n\nexport function Card(props: CardProps) {\n const local = props\n const rest = omit(props, 'class', 'size')\n return (\n <div data-slot=\"card\" class={cn(cardVariants({ size: local.size }), local.class)} {...rest} />\n )\n}\n\n/**\n * The header is a grid so that `CardAction` has tracks to be placed in: the\n * action is a direct child that takes a second column spanning the title and\n * description rows. A flex column gives `col-start-2` nothing to land on and\n * the action would simply stack under the copy. The extra column exists only\n * for a direct-child action: a wrapper around it is then the header's single\n * grid item, so it keeps the full width. A header without an action lays out as\n * it always did (one full-width column, 4px between its children).\n */\nexport function CardHeader(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <div\n data-slot=\"card-header\"\n class={cn(\n 'grid grid-cols-1 auto-rows-min gap-x-4 gap-y-1 px-4 has-[>[data-slot=card-action]]:grid-cols-[minmax(0,1fr)_auto]',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function CardTitle(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <div\n data-slot=\"card-title\"\n class={cn(headingVariants({ size: 'card', leading: 'none' }), local.class)}\n {...rest}\n />\n )\n}\n\nexport function CardDescription(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <div\n data-slot=\"card-description\"\n class={cn('text-muted-foreground text-sm', local.class)}\n {...rest}\n />\n )\n}\n\nexport function CardAction(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <div\n data-slot=\"card-action\"\n class={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', local.class)}\n {...rest}\n />\n )\n}\n\nexport function CardContent(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return <div data-slot=\"card-content\" class={cn('px-4', local.class)} {...rest} />\n}\n\nexport function CardFooter(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class')\n return <div data-slot=\"card-footer\" class={cn('flex items-center px-4', local.class)} {...rest} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAa,eAAe,IAC1B,wFACA;CACE,UAAU,EACR,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AA8B;CACvD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,OAAO;CAE9B,IAAA,QAAA,OAIC;CADCI,OAAA,OAAA,CAAA;EAFA,aAAA;EACA,IAAA,UAAA;GAAO,OAAA,GAAG,kEAAkE,MAAM,KAAK;EAAC;CAChF,GAAJ,IAAA,GAAA,KAAA;CAJR,OACEH;AAMJ;AAEA,SAAgB,YAAY,OAA8B;CACxD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,OAAO;CACzB,IAAA,QAAA,OAAyE;CAAXG,OAAA,OAAA,CAAA;EAAzD,aAAA;EAAyB,IAAA,UAAA;GAAO,OAAA,GAAG,QAAQ,MAAM,KAAK;EAAC;CAAU,GAAJ,IAAA,GAAA,KAAA;CAAzE,OAAOF;AACT;AAEA,SAAgB,WAAW,OAA8B;CACvD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,OAAO;CACzB,IAAA,QAAA,OAA0F;CAAXE,OAAA,OAAA,CAAA;EAA1E,aAAA;EAAwB,IAAA,UAAA;GAAO,OAAA,GAAG,0BAA0B,MAAM,KAAK;EAAC;CAAU,GAAJ,IAAA,GAAA,KAAA;CAA1F,OAAOD;AACT"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { cn } from "../../../lib/utils.js";
|
|
2
|
-
import { Button } from "../button/button.js";
|
|
3
|
-
import { fastIcon } from "../../../lib/fast-icon.js";
|
|
4
1
|
import { className, createComponent, delegateEvents, effect, insert, memo, readShallow, ref, setAttribute, setStyleProperty, spread, template } from "@solidjs/web";
|
|
5
|
-
import { ChevronLeft, ChevronRight } from "@lucide/solid";
|
|
6
2
|
import { For, createEffect, createMemo, createSignal, omit, onSettled } from "solid-js";
|
|
7
3
|
import EmblaCarousel from "embla-carousel";
|
|
4
|
+
import { ChevronLeft as ChevronLeft$1, ChevronRight as ChevronRight$1 } from "@lucide/solid";
|
|
5
|
+
import { cn } from "../../../lib/utils.js";
|
|
6
|
+
import { Button } from "../button/button.js";
|
|
7
|
+
import { fastIcon } from "../../../lib/fast-icon.js";
|
|
8
8
|
// src/components/ui/carousel/carousel.tsx
|
|
9
9
|
var _tmpl$ = /* @__PURE__ */ template(`<div><div tabindex=0 aria-label=Carousel><div>`);
|
|
10
10
|
var _tmpl$2 = /* @__PURE__ */ template(`<div class="flex items-center justify-center gap-1"><!><!><!>`);
|
|
11
11
|
var _tmpl$3 = /* @__PURE__ */ template(`<div class="flex items-center gap-1 px-1">`);
|
|
12
12
|
var _tmpl$4 = /* @__PURE__ */ template(`<button type=button>`);
|
|
13
13
|
var _tmpl$5 = /* @__PURE__ */ template(`<div role=group aria-roledescription=slide>`);
|
|
14
|
-
var ChevronLeft
|
|
15
|
-
var ChevronRight
|
|
14
|
+
var ChevronLeft = fastIcon(ChevronLeft$1);
|
|
15
|
+
var ChevronRight = fastIcon(ChevronRight$1);
|
|
16
16
|
function Carousel(props) {
|
|
17
17
|
const local = props;
|
|
18
18
|
const rest = omit(props, "children", "orientation", "slidesToShow", "align", "loop", "controls", "dots", "previousLabel", "nextLabel", "dotLabel", "onApi", "class");
|
|
@@ -99,7 +99,7 @@ function Carousel(props) {
|
|
|
99
99
|
},
|
|
100
100
|
onClick: () => embla()?.scrollPrev(),
|
|
101
101
|
get children() {
|
|
102
|
-
return createComponent(ChevronLeft
|
|
102
|
+
return createComponent(ChevronLeft, {
|
|
103
103
|
"aria-hidden": "true",
|
|
104
104
|
class: "rotate-0"
|
|
105
105
|
});
|
|
@@ -148,7 +148,7 @@ function Carousel(props) {
|
|
|
148
148
|
},
|
|
149
149
|
onClick: () => embla()?.scrollNext(),
|
|
150
150
|
get children() {
|
|
151
|
-
return createComponent(ChevronRight
|
|
151
|
+
return createComponent(ChevronRight, { "aria-hidden": "true" });
|
|
152
152
|
}
|
|
153
153
|
}), _el$7);
|
|
154
154
|
return _el$4;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","names":["role=\"group\"","ref={(element) => (viewport = element)}","<Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canPrev()}\n aria-label={local.previousLabel ?? 'Previous slide'}\n onClick={() => embla()?.scrollPrev()}\n >\n <ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />\n </Button>","variant=\"ghost\"","size=\"icon-sm\"","onClick={() => embla()?.scrollPrev()}","<ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />","class=\"rotate-0\"","<div class=\"flex items-center justify-center gap-1\">\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canPrev()}\n aria-label={local.previousLabel ?? 'Previous slide'}\n onClick={() => embla()?.scrollPrev()}\n >\n <ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />\n </Button>\n <Show when={local.dots}>\n <div class=\"flex items-center gap-1 px-1\">\n <For each={Array.from({ length: count() })}>\n {(_, index) => (\n <button\n type=\"button\"\n class={cn(\n 'size-1.5 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground',\n selected() === index() && 'bg-primary'\n )}\n aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}\n aria-current={selected() === index() ? 'true' : undefined}\n onClick={() => embla()?.scrollTo(index())}\n />\n )}\n </For>\n </div>\n </Show>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canNext()}\n aria-label={local.nextLabel ?? 'Next slide'}\n onClick={() => embla()?.scrollNext()}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </div>","<For each={Array.from({ length: count() })}>\n {(_, index) => (\n <button\n type=\"button\"\n class={cn(\n 'size-1.5 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground',\n selected() === index() && 'bg-primary'\n )}\n aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}\n aria-current={selected() === index() ? 'true' : undefined}\n onClick={() => embla()?.scrollTo(index())}\n />\n )}\n </For>","aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}","aria-current={selected() === index() ? 'true' : undefined}","<Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canNext()}\n aria-label={local.nextLabel ?? 'Next slide'}\n onClick={() => embla()?.scrollNext()}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>","onClick={() => embla()?.scrollNext()}","<ChevronRight aria-hidden=\"true\" />","class={cn('flex', orientation() === 'vertical' ? 'flex-col' : 'flex-row')}","<div\n class={cn('group/carousel relative grid gap-2', local.class)}\n role=\"group\"\n aria-roledescription=\"carousel\"\n {...rest}\n >\n <div\n ref={(element) => (viewport = element)}\n // A scroll container has to be reachable by keyboard, the same\n // requirement the code block's scroller meets.\n tabindex=\"0\"\n class={cn(\n 'scroll-fade overflow-hidden rounded-lg focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none'\n )}\n aria-label=\"Carousel\"\n >\n <div class={cn('flex', orientation() === 'vertical' ? 'flex-col' : 'flex-row')}>\n {local.children}\n </div>\n </div>\n\n <Show when={local.controls ?? true}>\n <div class=\"flex items-center justify-center gap-1\">\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canPrev()}\n aria-label={local.previousLabel ?? 'Previous slide'}\n onClick={() => embla()?.scrollPrev()}\n >\n <ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />\n </Button>\n <Show when={local.dots}>\n <div class=\"flex items-center gap-1 px-1\">\n <For each={Array.from({ length: count() })}>\n {(_, index) => (\n <button\n type=\"button\"\n class={cn(\n 'size-1.5 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground',\n selected() === index() && 'bg-primary'\n )}\n aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}\n aria-current={selected() === index() ? 'true' : undefined}\n onClick={() => embla()?.scrollTo(index())}\n />\n )}\n </For>\n </div>\n </Show>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canNext()}\n aria-label={local.nextLabel ?? 'Next slide'}\n onClick={() => embla()?.scrollNext()}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </div>\n </Show>\n </div>","'flex-basis': `${100 / (props.slidesToShow ?? 1)}%`","<div\n class={cn('min-w-0 shrink-0 grow-0', props.class)}\n style={{ 'flex-basis': `${100 / (props.slidesToShow ?? 1)}%` }}\n role=\"group\"\n aria-roledescription=\"slide\"\n >\n {props.children}\n </div>","ChevronLeft","LucideChevronLeft","ChevronRight","LucideChevronRight","_$readShallow","_$setAttribute","_$setStyleProperty"],"sources":["../../../../src/components/ui/carousel/carousel.tsx"],"sourcesContent":["import { createEffect, createMemo, createSignal, For, onSettled, Show, omit } from 'solid-js'\nimport { type JSX } from '@solidjs/web'\nimport EmblaCarousel, { type EmblaCarouselType, type EmblaOptionsType } from 'embla-carousel'\nimport { ChevronLeft as LucideChevronLeft, ChevronRight as LucideChevronRight } from '@lucide/solid'\nimport { cn } from '#lib/utils'\nimport { Button } from '../button'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst ChevronLeft = fastIcon(LucideChevronLeft)\nconst ChevronRight = fastIcon(LucideChevronRight)\n\n/**\n * Carousel.\n *\n * A horizontal scroller with snap points, over embla. The primitive owns the\n * physics, momentum, snapping, drag, and this owns the two things a carousel\n * always needs and embla deliberately leaves to the caller: a keyboard path and a\n * way to tell how far along you are.\n *\n * Embla is driven directly rather than through `embla-carousel-solid`, which has\n * no Solid 2 release, and rather than ui-sdk's carousel, because `onApi` hands the\n * caller embla's own API (`CarouselApi`): moving primitives would change that\n * public type. The adapter is the few lines below: create on mount, `reInit`\n * when the options change, destroy on unmount.\n *\n * **It is a scroll container, not a slide show.** `slidesToScroll` defaults to 1\n * and the track is keyboard-focusable, so arrow keys move between slides and a\n * slide that contains a link stays reachable. A carousel that hijacks the arrow\n * keys or hides its off-screen slides from the tab order is the standard\n * accessibility failure of this component, and both are avoided here by not\n * disabling anything: the slides stay in the DOM and in the tab order, and the\n * container scrolls.\n *\n * `orientation=\"vertical\"` exists because embla supports it and a vertical\n * carousel is what a short list of cards becomes on a phone. It is a prop rather\n * than a second component because every part, the track, the previous/next\n * buttons, the dots, has the same relationship to the axis.\n *\n * The dot indicators are buttons, not spans: a carousel with twelve slides and a\n * \"go to slide 7\" affordance is the only way to reach the seventh without\n * dragging through six. Each is labelled, because a row of unlabelled dots is a\n * row of identical controls to a screen reader.\n */\n\nexport type CarouselApi = EmblaCarouselType\n\nexport type CarouselProps = {\n /** The slides. Each is wrapped in its own element so embla can measure it. */\n children: JSX.Element\n /** The axis. Vertical is what a card list becomes on a narrow screen. */\n orientation?: 'horizontal' | 'vertical'\n /** How many slides are visible at once. */\n slidesToShow?: number\n /** Align the active slide to the start, centre, or end of the viewport. */\n align?: 'start' | 'center' | 'end'\n /** Whether dragging past the ends loops. Off by default: a loop hides the ends. */\n loop?: boolean\n /** Show the previous/next controls. */\n controls?: boolean\n /** Show the dot indicators. Off by default, a single-slide carousel needs none. */\n dots?: boolean\n /** Accessible names. Override for a non-English application. */\n previousLabel?: string\n nextLabel?: string\n /** The label for a dot, given a zero-based index. */\n dotLabel?: (index: number) => string\n /** Receives the embla API, for a caller that needs to drive it. */\n onApi?: (api: CarouselApi) => void\n class?: string\n}\n\nexport function Carousel(props: CarouselProps) {\n const local = props\n const rest = omit(\n props,\n 'children',\n 'orientation',\n 'slidesToShow',\n 'align',\n 'loop',\n 'controls',\n 'dots',\n 'previousLabel',\n 'nextLabel',\n 'dotLabel',\n 'onApi',\n 'class'\n )\n\n const orientation = () => local.orientation ?? 'horizontal'\n const options = createMemo<EmblaOptionsType>(() => ({\n axis: orientation() === 'vertical' ? 'y' : 'x',\n loop: local.loop ?? false,\n align: local.align ?? 'start',\n slidesToScroll: 1,\n containScroll: 'trimSnaps',\n }))\n\n let viewport: HTMLDivElement | undefined\n const [embla, setEmbla] = createSignal<EmblaCarouselType>()\n const [selected, setSelected] = createSignal(0)\n const [count, setCount] = createSignal(0)\n const [canPrev, setCanPrev] = createSignal(false)\n const [canNext, setCanNext] = createSignal(false)\n\n // A change of axis, loop or alignment re-measures the same instance, so the\n // position and the listeners below survive it.\n let created: EmblaOptionsType | undefined\n createEffect(\n () => ({ api: embla(), next: options() }),\n ({ api, next }) => {\n // The instance was just built with these; only a later change re-measures.\n if (api && next !== created) api.reInit(next)\n },\n { defer: true }\n )\n\n /**\n * The scroll event, not the select event alone: `select` fires on a settle, so a\n * drag in progress would leave the dots behind the thumb. `scroll` covers both.\n */\n onSettled(() => {\n if (!viewport) return\n created = options()\n const api = EmblaCarousel(viewport, created)\n setEmbla(api)\n local.onApi?.(api)\n\n const sync = () => {\n setSelected(api.selectedScrollSnap())\n setCanPrev(api.canScrollPrev())\n setCanNext(api.canScrollNext())\n }\n // A reInit (slides added or removed, a resize that changes the snaps) can\n // change how many snaps there are, so the dots are recounted with it.\n const remeasure = () => {\n setCount(api.scrollSnapList().length)\n sync()\n }\n remeasure()\n\n api.on('select', sync)\n api.on('scroll', sync)\n api.on('reInit', remeasure)\n // Destroying the instance removes its listeners with it.\n return () => api.destroy()\n })\n\n return (\n <div\n class={cn('group/carousel relative grid gap-2', local.class)}\n role=\"group\"\n aria-roledescription=\"carousel\"\n {...rest}\n >\n <div\n ref={(element) => (viewport = element)}\n // A scroll container has to be reachable by keyboard, the same\n // requirement the code block's scroller meets.\n tabindex=\"0\"\n class={cn(\n 'scroll-fade overflow-hidden rounded-lg focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none'\n )}\n aria-label=\"Carousel\"\n >\n <div class={cn('flex', orientation() === 'vertical' ? 'flex-col' : 'flex-row')}>\n {local.children}\n </div>\n </div>\n\n <Show when={local.controls ?? true}>\n <div class=\"flex items-center justify-center gap-1\">\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canPrev()}\n aria-label={local.previousLabel ?? 'Previous slide'}\n onClick={() => embla()?.scrollPrev()}\n >\n <ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />\n </Button>\n <Show when={local.dots}>\n <div class=\"flex items-center gap-1 px-1\">\n <For each={Array.from({ length: count() })}>\n {(_, index) => (\n <button\n type=\"button\"\n class={cn(\n 'size-1.5 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground',\n selected() === index() && 'bg-primary'\n )}\n aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}\n aria-current={selected() === index() ? 'true' : undefined}\n onClick={() => embla()?.scrollTo(index())}\n />\n )}\n </For>\n </div>\n </Show>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canNext()}\n aria-label={local.nextLabel ?? 'Next slide'}\n onClick={() => embla()?.scrollNext()}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </div>\n </Show>\n </div>\n )\n}\n\n/**\n * One slide. `basis` is what makes `slidesToShow` work: embla measures the slide\n * elements, so a slide that is not sized to a fraction of the viewport would show\n * one per screen regardless of the setting.\n */\nexport function CarouselSlide(props: {\n children: JSX.Element\n /** How many slides share the viewport at this slide's widest breakpoint. */\n slidesToShow?: number\n class?: string\n}) {\n return (\n <div\n class={cn('min-w-0 shrink-0 grow-0', props.class)}\n style={{ 'flex-basis': `${100 / (props.slidesToShow ?? 1)}%` }}\n role=\"group\"\n aria-roledescription=\"slide\"\n >\n {props.children}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AASA,IAAMmB,gBAAc,SAASC,WAAiB;AAC9C,IAAMC,iBAAe,SAASC,YAAkB;AA8DhD,SAAgB,SAAS,OAAsB;CAC7C,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,YACA,eACA,gBACA,SACA,QACA,YACA,QACA,iBACA,aACA,YACA,SACA,OACF;CAEA,MAAM,oBAAoB,MAAM,eAAe;CAC/C,MAAM,UAAU,kBAAoC;EAClD,MAAM,YAAY,MAAM,aAAa,MAAM;EAC3C,MAAM,MAAM,QAAQ;EACpB,OAAO,MAAM,SAAS;EACtB,gBAAgB;EAChB,eAAe;CACjB,EAAE;CAEF,IAAI;CACJ,MAAM,CAAC,OAAO,YAAY,aAAgC;CAC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M;IAAC,EAAA,CAAD,GA3BRhB,KAqCK;IArCL,OAAA,OA4BEI,gBAAAA,QAAAA;KACET,SAAQ;KACRC,MAAK;KACL,IAAA,WAAA;MAAU,OAAA,CAAC,QAAQ;KAAC;KACpB,IAAA,eAAA;MAAY,OAAA,MAAM,aAAa;KAAY;KAC3CS,eAAe,MAAM,CAAC,EAAE,WAAW;KALrC,IAAA,WAAA;MAOEC,OAAAA,gBAAAA,gBAAAA,EAAc,eAAY,OAAQ,CAAA;KAC5B;IApCVN,CAAAA,GAAAA,KAqCK;IArCL,OAAA;GAqCK,EAAA,CAAA,IAtCP,KAAA;EAuCM;CAAC,EAAA,CAAD,GA5DR,IA6DK;CAlDD,aAAA;;GAAO,GAAAe,YAAA,GACL,gHACF,CAAC;GAGIR,GAAAA,YAAO,GAAG,QAAQ,YAAY,MAAM,aAAa,aAAa,UAAU,CAAC;EAH7E;CAFD,IAAA,EAAA,GAAA,KAAA,QAAA;EAEC,UAAA,OAAA,GAAA,KAAA,CAAA;EAGI,UAAA,OAAA,GAAA,KAAA,CAAyE;CAH7E,CAAA;CAdP,OACEC;AA+DJ;;;;;;AAOA,SAAgB,cAAc,OAK3B;CAEC,IAAA,SAAA,QAOK;CAPL,OAAA,cAME;EAAC,OAAA,MAAM;CAAQ,CACZ;CANH,aAAA;;GAAO,GAAAO,YAAA,GAAG,2BAA2B,MAAM,KAAK,CAAC;GACxCN,GAAc,GAAG,OAAO,MAAM,gBAAgB,GAAG;EADT;CAAjD,IAAA,EAAA,GAAA,KAAA,QAAA;EAAiD,UAAA,QAAA,GAAA,KAAA,CAAA;EACxC,MAAA,KAAA,KAAAQ,iBAAA,QAAA,cAAA,CAAkD;CADV,CAAA;CAFrD,OACEP;AASJ"}
|
|
1
|
+
{"version":3,"file":"carousel.js","names":["role=\"group\"","ref={(element) => (viewport = element)}","<Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canPrev()}\n aria-label={local.previousLabel ?? 'Previous slide'}\n onClick={() => embla()?.scrollPrev()}\n >\n <ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />\n </Button>","variant=\"ghost\"","size=\"icon-sm\"","onClick={() => embla()?.scrollPrev()}","<ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />","class=\"rotate-0\"","<div class=\"flex items-center justify-center gap-1\">\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canPrev()}\n aria-label={local.previousLabel ?? 'Previous slide'}\n onClick={() => embla()?.scrollPrev()}\n >\n <ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />\n </Button>\n <Show when={local.dots}>\n <div class=\"flex items-center gap-1 px-1\">\n <For each={Array.from({ length: count() })}>\n {(_, index) => (\n <button\n type=\"button\"\n class={cn(\n 'size-1.5 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground',\n selected() === index() && 'bg-primary'\n )}\n aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}\n aria-current={selected() === index() ? 'true' : undefined}\n onClick={() => embla()?.scrollTo(index())}\n />\n )}\n </For>\n </div>\n </Show>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canNext()}\n aria-label={local.nextLabel ?? 'Next slide'}\n onClick={() => embla()?.scrollNext()}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </div>","<For each={Array.from({ length: count() })}>\n {(_, index) => (\n <button\n type=\"button\"\n class={cn(\n 'size-1.5 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground',\n selected() === index() && 'bg-primary'\n )}\n aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}\n aria-current={selected() === index() ? 'true' : undefined}\n onClick={() => embla()?.scrollTo(index())}\n />\n )}\n </For>","aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}","aria-current={selected() === index() ? 'true' : undefined}","<Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canNext()}\n aria-label={local.nextLabel ?? 'Next slide'}\n onClick={() => embla()?.scrollNext()}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>","onClick={() => embla()?.scrollNext()}","<ChevronRight aria-hidden=\"true\" />","class={cn('flex', orientation() === 'vertical' ? 'flex-col' : 'flex-row')}","<div\n class={cn('group/carousel relative grid gap-2', local.class)}\n role=\"group\"\n aria-roledescription=\"carousel\"\n {...rest}\n >\n <div\n ref={(element) => (viewport = element)}\n // A scroll container has to be reachable by keyboard, the same\n // requirement the code block's scroller meets.\n tabindex=\"0\"\n class={cn(\n 'scroll-fade overflow-hidden rounded-lg focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none'\n )}\n aria-label=\"Carousel\"\n >\n <div class={cn('flex', orientation() === 'vertical' ? 'flex-col' : 'flex-row')}>\n {local.children}\n </div>\n </div>\n\n <Show when={local.controls ?? true}>\n <div class=\"flex items-center justify-center gap-1\">\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canPrev()}\n aria-label={local.previousLabel ?? 'Previous slide'}\n onClick={() => embla()?.scrollPrev()}\n >\n <ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />\n </Button>\n <Show when={local.dots}>\n <div class=\"flex items-center gap-1 px-1\">\n <For each={Array.from({ length: count() })}>\n {(_, index) => (\n <button\n type=\"button\"\n class={cn(\n 'size-1.5 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground',\n selected() === index() && 'bg-primary'\n )}\n aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}\n aria-current={selected() === index() ? 'true' : undefined}\n onClick={() => embla()?.scrollTo(index())}\n />\n )}\n </For>\n </div>\n </Show>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canNext()}\n aria-label={local.nextLabel ?? 'Next slide'}\n onClick={() => embla()?.scrollNext()}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </div>\n </Show>\n </div>","'flex-basis': `${100 / (props.slidesToShow ?? 1)}%`","<div\n class={cn('min-w-0 shrink-0 grow-0', props.class)}\n style={{ 'flex-basis': `${100 / (props.slidesToShow ?? 1)}%` }}\n role=\"group\"\n aria-roledescription=\"slide\"\n >\n {props.children}\n </div>","LucideChevronLeft","LucideChevronRight","_$spread","_$ref","_$insert","_$effect","_$readShallow","_$className","_$setAttribute","_$setStyleProperty"],"sources":["../../../../src/components/ui/carousel/carousel.tsx"],"sourcesContent":["import { createEffect, createMemo, createSignal, For, onSettled, Show, omit } from 'solid-js'\nimport { type JSX } from '@solidjs/web'\nimport EmblaCarousel, { type EmblaCarouselType, type EmblaOptionsType } from 'embla-carousel'\nimport { ChevronLeft as LucideChevronLeft, ChevronRight as LucideChevronRight } from '@lucide/solid'\nimport { cn } from '#lib/utils'\nimport { Button } from '../button'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst ChevronLeft = fastIcon(LucideChevronLeft)\nconst ChevronRight = fastIcon(LucideChevronRight)\n\n/**\n * Carousel.\n *\n * A horizontal scroller with snap points, over embla. The primitive owns the\n * physics, momentum, snapping, drag, and this owns the two things a carousel\n * always needs and embla deliberately leaves to the caller: a keyboard path and a\n * way to tell how far along you are.\n *\n * Embla is driven directly rather than through `embla-carousel-solid`, which has\n * no Solid 2 release, and rather than ui-sdk's carousel, because `onApi` hands the\n * caller embla's own API (`CarouselApi`): moving primitives would change that\n * public type. The adapter is the few lines below: create on mount, `reInit`\n * when the options change, destroy on unmount.\n *\n * **It is a scroll container, not a slide show.** `slidesToScroll` defaults to 1\n * and the track is keyboard-focusable, so arrow keys move between slides and a\n * slide that contains a link stays reachable. A carousel that hijacks the arrow\n * keys or hides its off-screen slides from the tab order is the standard\n * accessibility failure of this component, and both are avoided here by not\n * disabling anything: the slides stay in the DOM and in the tab order, and the\n * container scrolls.\n *\n * `orientation=\"vertical\"` exists because embla supports it and a vertical\n * carousel is what a short list of cards becomes on a phone. It is a prop rather\n * than a second component because every part, the track, the previous/next\n * buttons, the dots, has the same relationship to the axis.\n *\n * The dot indicators are buttons, not spans: a carousel with twelve slides and a\n * \"go to slide 7\" affordance is the only way to reach the seventh without\n * dragging through six. Each is labelled, because a row of unlabelled dots is a\n * row of identical controls to a screen reader.\n */\n\nexport type CarouselApi = EmblaCarouselType\n\nexport type CarouselProps = {\n /** The slides. Each is wrapped in its own element so embla can measure it. */\n children: JSX.Element\n /** The axis. Vertical is what a card list becomes on a narrow screen. */\n orientation?: 'horizontal' | 'vertical'\n /** How many slides are visible at once. */\n slidesToShow?: number\n /** Align the active slide to the start, centre, or end of the viewport. */\n align?: 'start' | 'center' | 'end'\n /** Whether dragging past the ends loops. Off by default: a loop hides the ends. */\n loop?: boolean\n /** Show the previous/next controls. */\n controls?: boolean\n /** Show the dot indicators. Off by default, a single-slide carousel needs none. */\n dots?: boolean\n /** Accessible names. Override for a non-English application. */\n previousLabel?: string\n nextLabel?: string\n /** The label for a dot, given a zero-based index. */\n dotLabel?: (index: number) => string\n /** Receives the embla API, for a caller that needs to drive it. */\n onApi?: (api: CarouselApi) => void\n class?: string\n}\n\nexport function Carousel(props: CarouselProps) {\n const local = props\n const rest = omit(\n props,\n 'children',\n 'orientation',\n 'slidesToShow',\n 'align',\n 'loop',\n 'controls',\n 'dots',\n 'previousLabel',\n 'nextLabel',\n 'dotLabel',\n 'onApi',\n 'class'\n )\n\n const orientation = () => local.orientation ?? 'horizontal'\n const options = createMemo<EmblaOptionsType>(() => ({\n axis: orientation() === 'vertical' ? 'y' : 'x',\n loop: local.loop ?? false,\n align: local.align ?? 'start',\n slidesToScroll: 1,\n containScroll: 'trimSnaps',\n }))\n\n let viewport: HTMLDivElement | undefined\n const [embla, setEmbla] = createSignal<EmblaCarouselType>()\n const [selected, setSelected] = createSignal(0)\n const [count, setCount] = createSignal(0)\n const [canPrev, setCanPrev] = createSignal(false)\n const [canNext, setCanNext] = createSignal(false)\n\n // A change of axis, loop or alignment re-measures the same instance, so the\n // position and the listeners below survive it.\n let created: EmblaOptionsType | undefined\n createEffect(\n () => ({ api: embla(), next: options() }),\n ({ api, next }) => {\n // The instance was just built with these; only a later change re-measures.\n if (api && next !== created) api.reInit(next)\n },\n { defer: true }\n )\n\n /**\n * The scroll event, not the select event alone: `select` fires on a settle, so a\n * drag in progress would leave the dots behind the thumb. `scroll` covers both.\n */\n onSettled(() => {\n if (!viewport) return\n created = options()\n const api = EmblaCarousel(viewport, created)\n setEmbla(api)\n local.onApi?.(api)\n\n const sync = () => {\n setSelected(api.selectedScrollSnap())\n setCanPrev(api.canScrollPrev())\n setCanNext(api.canScrollNext())\n }\n // A reInit (slides added or removed, a resize that changes the snaps) can\n // change how many snaps there are, so the dots are recounted with it.\n const remeasure = () => {\n setCount(api.scrollSnapList().length)\n sync()\n }\n remeasure()\n\n api.on('select', sync)\n api.on('scroll', sync)\n api.on('reInit', remeasure)\n // Destroying the instance removes its listeners with it.\n return () => api.destroy()\n })\n\n return (\n <div\n class={cn('group/carousel relative grid gap-2', local.class)}\n role=\"group\"\n aria-roledescription=\"carousel\"\n {...rest}\n >\n <div\n ref={(element) => (viewport = element)}\n // A scroll container has to be reachable by keyboard, the same\n // requirement the code block's scroller meets.\n tabindex=\"0\"\n class={cn(\n 'scroll-fade overflow-hidden rounded-lg focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none'\n )}\n aria-label=\"Carousel\"\n >\n <div class={cn('flex', orientation() === 'vertical' ? 'flex-col' : 'flex-row')}>\n {local.children}\n </div>\n </div>\n\n <Show when={local.controls ?? true}>\n <div class=\"flex items-center justify-center gap-1\">\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canPrev()}\n aria-label={local.previousLabel ?? 'Previous slide'}\n onClick={() => embla()?.scrollPrev()}\n >\n <ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />\n </Button>\n <Show when={local.dots}>\n <div class=\"flex items-center gap-1 px-1\">\n <For each={Array.from({ length: count() })}>\n {(_, index) => (\n <button\n type=\"button\"\n class={cn(\n 'size-1.5 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground',\n selected() === index() && 'bg-primary'\n )}\n aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}\n aria-current={selected() === index() ? 'true' : undefined}\n onClick={() => embla()?.scrollTo(index())}\n />\n )}\n </For>\n </div>\n </Show>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canNext()}\n aria-label={local.nextLabel ?? 'Next slide'}\n onClick={() => embla()?.scrollNext()}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </div>\n </Show>\n </div>\n )\n}\n\n/**\n * One slide. `basis` is what makes `slidesToShow` work: embla measures the slide\n * elements, so a slide that is not sized to a fraction of the viewport would show\n * one per screen regardless of the setting.\n */\nexport function CarouselSlide(props: {\n children: JSX.Element\n /** How many slides share the viewport at this slide's widest breakpoint. */\n slidesToShow?: number\n class?: string\n}) {\n return (\n <div\n class={cn('min-w-0 shrink-0 grow-0', props.class)}\n style={{ 'flex-basis': `${100 / (props.slidesToShow ?? 1)}%` }}\n role=\"group\"\n aria-roledescription=\"slide\"\n >\n {props.children}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AASA,IAAM,cAAc,SAASmB,aAAiB;AAC9C,IAAM,eAAe,SAASC,cAAkB;AA8DhD,SAAgB,SAAS,OAAsB;CAC7C,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,YACA,eACA,gBACA,SACA,QACA,YACA,QACA,iBACA,aACA,YACA,SACA,OACF;CAEA,MAAM,oBAAoB,MAAM,eAAe;CAC/C,MAAM,UAAU,kBAAoC;EAClD,MAAM,YAAY,MAAM,aAAa,MAAM;EAC3C,MAAM,MAAM,QAAQ;EACpB,OAAO,MAAM,SAAS;EACtB,gBAAgB;EAChB,eAAe;CACjB,EAAE;CAEF,IAAI;CACJ,MAAM,CAAC,OAAO,YAAY,aAAgC;CAC1D,MAAM,CAAC,UAAU,eAAe,aAAa,CAAC;CAC9C,MAAM,CAAC,OAAO,YAAY,aAAa,CAAC;CACxC,M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ET,SAAQ;KACRC,MAAK;KACL,IAAA,WAAA;MAAU,OAAA,CAAC,QAAQ;KAAC;KACpB,IAAA,eAAA;MAAY,OAAA,MAAM,aAAa;KAAY;KAC3CS,eAAe,MAAM,CAAC,EAAE,WAAW;KALrC,IAAA,WAAA;MAOEC,OAAAA,gBAAAA,cAAAA,EAAc,eAAY,OAAQ,CAAA;KAC5B;IApCVN,CAAAA,GAAAA,KAqCK;IArCL,OAAA;GAqCK,EAAA,CAAA,IAtCP,KAAA;EAuCM;CAAC,EAAA,CAAD,GA5DR,IA6DK;CAlDDgB,aAAA;;GAAO,GAAAC,YAAA,GACL,gHACF,CAAC;GAGIV,GAAAA,YAAO,GAAG,QAAQ,YAAY,MAAM,aAAa,aAAa,UAAU,CAAC;EAH7E;CAFD,IAAA,EAAA,GAAA,KAAA,QAAA;EAECW,UAAA,OAAA,GAAA,KAAA,CAAA;EAGIA,UAAA,OAAA,GAAA,KAAA,CAAyE;CAH7E,CAAA;CAdP,OACEV;AA+DJ;;;;;;AAOA,SAAgB,cAAc,OAK3B;CAEC,IAAA,SAAA,QAOK;CAPLO,OAAA,cAME;EAAC,OAAA,MAAM;CAAQ,CACZ;CANHC,aAAA;;GAAO,GAAAC,YAAA,GAAG,2BAA2B,MAAM,KAAK,CAAC;GACxCR,GAAc,GAAG,OAAO,MAAM,gBAAgB,GAAG;EADT;CAAjD,IAAA,EAAA,GAAA,KAAA,QAAA;EAAiDS,UAAA,QAAA,GAAA,KAAA,CAAA;EACxC,MAAA,KAAA,KAAAE,iBAAA,QAAA,cAAA,CAAkD;CADV,CAAA;CAFrD,OACEV;AASJ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { cn } from "../../../lib/utils.js";
|
|
2
|
-
import { chartOptions, chartSeriesColors, mergeChartOptions, resolveCssVariables } from "./chart-options.js";
|
|
3
1
|
import { className, createComponent, effect, insert, readShallow, ref, setStyleProperty, template } from "@solidjs/web";
|
|
4
2
|
import { For, Show, createEffect, createSignal, onSettled } from "solid-js";
|
|
5
3
|
import { ArcElement, BarController, BarElement, BubbleController, CategoryScale, Chart, DoughnutController, Filler, Legend, LineController, LineElement, LinearScale, LogarithmicScale, PieController, PointElement, PolarAreaController, RadarController, RadialLinearScale, ScatterController, Tooltip } from "chart.js";
|
|
4
|
+
import { cn } from "../../../lib/utils.js";
|
|
5
|
+
import { chartOptions, chartSeriesColors, mergeChartOptions, resolveCssVariables } from "./chart-options.js";
|
|
6
6
|
// src/components/ui/chart/chart.tsx
|
|
7
7
|
var _tmpl$ = /* @__PURE__ */ template(`<canvas width=512 height=512>`);
|
|
8
8
|
var _tmpl$2 = /* @__PURE__ */ template(`<figure><figcaption class="flex items-start justify-between gap-3"><div><h3 class="text-sm font-semibold text-foreground">`);
|