@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":"table.js","names":["<div data-slot=\"table-container\" class=\"relative w-full overflow-x-auto\">\n <table data-slot=\"table\" class={cn('w-full caption-bottom text-sm', local.class)} {...rest} />\n </div>","<thead\n data-slot=\"table-header\"\n class={cn(\n '[&_tr]:border-b [&_tr]:border-border sticky top-0 z-(--z-docked) bg-background',\n local.class\n )}\n {...rest}\n />","<tbody data-slot=\"table-body\" class={cn('[&_tr:last-child]:border-0', local.class)} {...rest} />","<tfoot\n data-slot=\"table-footer\"\n class={cn(\n 'bg-surface-hover border-t border-border font-medium [&>tr]:last:border-b-0',\n local.class\n )}\n {...rest}\n />","<tr\n data-slot=\"table-row\"\n class={cn(\n 'border-b border-border transition-colors ease-out',\n 'hover:bg-surface-hover data-[state=selected]:bg-primary-subtle',\n local.class\n )}\n {...rest}\n />","<th\n data-slot=\"table-head\"\n scope={props.scope ?? 'col'}\n class={cn(\n 'text-muted-foreground h-9 px-3 text-start align-middle text-xs font-medium whitespace-nowrap',\n local.class\n )}\n {...rest}\n />","<td data-slot=\"table-cell\" class={cn('px-3 py-2 align-middle', local.class)} {...rest} />","<td\n data-slot=\"table-cell\"\n class={cn('px-3 py-2 text-end align-middle tabular-nums', local.class)}\n {...rest}\n />","<caption\n data-slot=\"table-caption\"\n class={cn('text-muted-foreground mt-3 text-sm', local.class)}\n {...rest}\n />"],"sources":["../../../../src/components/ui/table/table.tsx"],"sourcesContent":["import type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * Table.\n *\n * Semantic markup, not a grid of divs. A `<table>` with a caption, a header\n * scope and cells is navigable by a screen reader in ways a flex layout cannot\n * be reproduced into, and it is what makes \"row 3 of 12, Name column\" work.\n *\n * Two decisions worth keeping:\n *\n * - The header is sticky by default. A scrollable table whose header leaves\n * the viewport makes every row below it anonymous.\n * - Numbers are right-aligned and tabular. `text-end` plus `tabular-nums` is\n * what lets a column of figures be compared by eye; a proportional font\n * with ragged digits is unreadable at a glance.\n *\n * `TableNumericCell` exists so callers do not have to remember the second\n * half of that rule.\n */\nexport function Table(props: ComponentProps<'table'>) {\n const local = props\n const rest = omit(props, 'class')\n\n return (\n <div data-slot=\"table-container\" class=\"relative w-full overflow-x-auto\">\n <table data-slot=\"table\" class={cn('w-full caption-bottom text-sm', local.class)} {...rest} />\n </div>\n )\n}\n\nexport function TableHeader(props: ComponentProps<'thead'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <thead\n data-slot=\"table-header\"\n class={cn(\n '[&_tr]:border-b [&_tr]:border-border sticky top-0 z-(--z-docked) bg-background',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function TableBody(props: ComponentProps<'tbody'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <tbody data-slot=\"table-body\" class={cn('[&_tr:last-child]:border-0', local.class)} {...rest} />\n )\n}\n\nexport function TableFooter(props: ComponentProps<'tfoot'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <tfoot\n data-slot=\"table-footer\"\n class={cn(\n 'bg-surface-hover border-t border-border font-medium [&>tr]:last:border-b-0',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function TableRow(props: ComponentProps<'tr'>) {\n const local = props\n const rest = omit(props, 'class')\n\n return (\n <tr\n data-slot=\"table-row\"\n class={cn(\n 'border-b border-border transition-colors ease-out',\n 'hover:bg-surface-hover data-[state=selected]:bg-primary-subtle',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function TableHead(props: ComponentProps<'th'>) {\n const local = props\n const rest = omit(props, 'class')\n\n return (\n <th\n data-slot=\"table-head\"\n scope={props.scope ?? 'col'}\n class={cn(\n 'text-muted-foreground h-9 px-3 text-start align-middle text-xs font-medium whitespace-nowrap',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function TableCell(props: ComponentProps<'td'>) {\n const local = props\n const rest = omit(props, 'class')\n return <td data-slot=\"table-cell\" class={cn('px-3 py-2 align-middle', local.class)} {...rest} />\n}\n\nexport function TableNumericCell(props: ComponentProps<'td'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <td\n data-slot=\"table-cell\"\n class={cn('px-3 py-2 text-end align-middle tabular-nums', local.class)}\n {...rest}\n />\n )\n}\n\nexport function TableCaption(props: ComponentProps<'caption'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <caption\n data-slot=\"table-caption\"\n class={cn('text-muted-foreground mt-3 text-sm', local.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,MAAM,OAAgC;CACpD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,OAAO;CAG9B,IAAA,OAAA,OAEK;CADH,IAAA,QAAA,KAAA;
|
|
1
|
+
{"version":3,"file":"table.js","names":["<div data-slot=\"table-container\" class=\"relative w-full overflow-x-auto\">\n <table data-slot=\"table\" class={cn('w-full caption-bottom text-sm', local.class)} {...rest} />\n </div>","<thead\n data-slot=\"table-header\"\n class={cn(\n '[&_tr]:border-b [&_tr]:border-border sticky top-0 z-(--z-docked) bg-background',\n local.class\n )}\n {...rest}\n />","<tbody data-slot=\"table-body\" class={cn('[&_tr:last-child]:border-0', local.class)} {...rest} />","<tfoot\n data-slot=\"table-footer\"\n class={cn(\n 'bg-surface-hover border-t border-border font-medium [&>tr]:last:border-b-0',\n local.class\n )}\n {...rest}\n />","<tr\n data-slot=\"table-row\"\n class={cn(\n 'border-b border-border transition-colors ease-out',\n 'hover:bg-surface-hover data-[state=selected]:bg-primary-subtle',\n local.class\n )}\n {...rest}\n />","<th\n data-slot=\"table-head\"\n scope={props.scope ?? 'col'}\n class={cn(\n 'text-muted-foreground h-9 px-3 text-start align-middle text-xs font-medium whitespace-nowrap',\n local.class\n )}\n {...rest}\n />","<td data-slot=\"table-cell\" class={cn('px-3 py-2 align-middle', local.class)} {...rest} />","<td\n data-slot=\"table-cell\"\n class={cn('px-3 py-2 text-end align-middle tabular-nums', local.class)}\n {...rest}\n />","<caption\n data-slot=\"table-caption\"\n class={cn('text-muted-foreground mt-3 text-sm', local.class)}\n {...rest}\n />","_$spread"],"sources":["../../../../src/components/ui/table/table.tsx"],"sourcesContent":["import type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * Table.\n *\n * Semantic markup, not a grid of divs. A `<table>` with a caption, a header\n * scope and cells is navigable by a screen reader in ways a flex layout cannot\n * be reproduced into, and it is what makes \"row 3 of 12, Name column\" work.\n *\n * Two decisions worth keeping:\n *\n * - The header is sticky by default. A scrollable table whose header leaves\n * the viewport makes every row below it anonymous.\n * - Numbers are right-aligned and tabular. `text-end` plus `tabular-nums` is\n * what lets a column of figures be compared by eye; a proportional font\n * with ragged digits is unreadable at a glance.\n *\n * `TableNumericCell` exists so callers do not have to remember the second\n * half of that rule.\n */\nexport function Table(props: ComponentProps<'table'>) {\n const local = props\n const rest = omit(props, 'class')\n\n return (\n <div data-slot=\"table-container\" class=\"relative w-full overflow-x-auto\">\n <table data-slot=\"table\" class={cn('w-full caption-bottom text-sm', local.class)} {...rest} />\n </div>\n )\n}\n\nexport function TableHeader(props: ComponentProps<'thead'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <thead\n data-slot=\"table-header\"\n class={cn(\n '[&_tr]:border-b [&_tr]:border-border sticky top-0 z-(--z-docked) bg-background',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function TableBody(props: ComponentProps<'tbody'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <tbody data-slot=\"table-body\" class={cn('[&_tr:last-child]:border-0', local.class)} {...rest} />\n )\n}\n\nexport function TableFooter(props: ComponentProps<'tfoot'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <tfoot\n data-slot=\"table-footer\"\n class={cn(\n 'bg-surface-hover border-t border-border font-medium [&>tr]:last:border-b-0',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function TableRow(props: ComponentProps<'tr'>) {\n const local = props\n const rest = omit(props, 'class')\n\n return (\n <tr\n data-slot=\"table-row\"\n class={cn(\n 'border-b border-border transition-colors ease-out',\n 'hover:bg-surface-hover data-[state=selected]:bg-primary-subtle',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function TableHead(props: ComponentProps<'th'>) {\n const local = props\n const rest = omit(props, 'class')\n\n return (\n <th\n data-slot=\"table-head\"\n scope={props.scope ?? 'col'}\n class={cn(\n 'text-muted-foreground h-9 px-3 text-start align-middle text-xs font-medium whitespace-nowrap',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function TableCell(props: ComponentProps<'td'>) {\n const local = props\n const rest = omit(props, 'class')\n return <td data-slot=\"table-cell\" class={cn('px-3 py-2 align-middle', local.class)} {...rest} />\n}\n\nexport function TableNumericCell(props: ComponentProps<'td'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <td\n data-slot=\"table-cell\"\n class={cn('px-3 py-2 text-end align-middle tabular-nums', local.class)}\n {...rest}\n />\n )\n}\n\nexport function TableCaption(props: ComponentProps<'caption'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <caption\n data-slot=\"table-caption\"\n class={cn('text-muted-foreground mt-3 text-sm', local.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,MAAM,OAAgC;CACpD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,OAAO;CAG9B,IAAA,OAAA,OAEK;CADH,IAAA,QAAA,KAAA;CAAkFS,OAAA,OAAA,CAAA;EAA3E,aAAA;EAAkB,IAAA,UAAA;GAAO,OAAA,GAAG,iCAAiC,MAAM,KAAK;EAAC;CAAU,GAAJ,IAAA,GAAA,KAAA;CAF1F,OACET;AAIJ;AAEA,SA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,KACR;EAAC;CACO,GAAJ,IAAA,GAAA,KAAA;CARR,OACEJ;AAUJ;AAEA,SAAgB,UAAU,OAA6B;CACrD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,OAAO;CACzB,IAAA,QAAA,QAAwF;CAAXI,OAAA,OAAA,CAAA;EAAzE,aAAA;EAAuB,IAAA,UAAA;GAAO,OAAA,GAAG,0BAA0B,MAAM,KAAK;EAAC;CAAU,GAAJ,IAAA,GAAA,KAAA;CAAxF,OAAOH;AACT;AAEA,SAAgB,iBAAiB,OAA6B;CAC5D,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,OAAO;CAE9B,IAAA,QAAA,QAIC;CADCG,OAAA,OAAA,CAAA;EAFA,aAAA;EACA,IAAA,UAAA;GAAO,OAAA,GAAG,gDAAgD,MAAM,KAAK;EAAC;CAC9D,GAAJ,IAAA,GAAA,KAAA;CAJR,OACEF;AAMJ;AAEA,SAAgB,aAAa,OAAkC;CAC7D,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,OAAO;CAE9B,IAAA,SAAA,QAIC;CADCE,OAAA,QAAA,CAAA;EAFA,aAAA;EACA,IAAA,UAAA;GAAO,OAAA,GAAG,sCAAsC,MAAM,KAAK;EAAC;CACpD,GAAJ,IAAA,GAAA,KAAA;CAJR,OACED;AAMJ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { cn } from "../../../lib/utils.js";
|
|
2
1
|
import { createComponent, mergeProps, spread, template } from "@solidjs/web";
|
|
2
|
+
import { Tabs as Tabs$1, TabsList as TabsList$1, TabsPanel, TabsTab } from "@ui-sdk/solid/tabs";
|
|
3
3
|
import { createContext, createRenderEffect, createSignal, createUniqueId, omit, useContext } from "solid-js";
|
|
4
|
-
import {
|
|
4
|
+
import { cn } from "../../../lib/utils.js";
|
|
5
5
|
// src/components/ui/tabs/tabs.tsx
|
|
6
6
|
var _tmpl$ = /* @__PURE__ */ template(`<button>`);
|
|
7
7
|
var _tmpl$2 = /* @__PURE__ */ template(`<div>`);
|
|
@@ -11,7 +11,7 @@ function useTabsId() {
|
|
|
11
11
|
if (!tabs) throw new Error("[adea-ui]: Tabs parts must be used within Tabs.");
|
|
12
12
|
return tabs;
|
|
13
13
|
}
|
|
14
|
-
function Tabs
|
|
14
|
+
function Tabs(props) {
|
|
15
15
|
const local = props;
|
|
16
16
|
const rest = omit(props, "class", "id", "value", "defaultValue", "onChange", "activationMode");
|
|
17
17
|
const generatedId = `tabs-${createUniqueId()}`;
|
|
@@ -35,7 +35,7 @@ function Tabs$1(props) {
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
get children() {
|
|
38
|
-
return createComponent(Tabs, mergeProps({
|
|
38
|
+
return createComponent(Tabs$1, mergeProps({
|
|
39
39
|
"data-slot": "tabs",
|
|
40
40
|
get id() {
|
|
41
41
|
return id();
|
|
@@ -71,11 +71,11 @@ function Tabs$1(props) {
|
|
|
71
71
|
* by that pixel. It reserves the pixel as padding instead and paints the rule
|
|
72
72
|
* there with an inset shadow, which lands exactly where the border was.
|
|
73
73
|
*/
|
|
74
|
-
function TabsList
|
|
74
|
+
function TabsList(props) {
|
|
75
75
|
const local = props;
|
|
76
76
|
const rest = omit(props, "class", "appearance", "fill", "scrollable");
|
|
77
77
|
const underline = () => local.appearance !== "segmented";
|
|
78
|
-
return createComponent(TabsList, mergeProps({
|
|
78
|
+
return createComponent(TabsList$1, mergeProps({
|
|
79
79
|
"data-slot": "tabs-list",
|
|
80
80
|
get "class"() {
|
|
81
81
|
return cn("shrink-0 items-center", local.fill || local.scrollable ? "flex w-full justify-start" : "inline-flex w-fit justify-center", local.scrollable && "no-scrollbar overflow-x-auto overflow-y-hidden", !underline() ? "gap-0.5 rounded-lg bg-surface-hover p-0.5" : local.scrollable ? "gap-1 rounded-none pb-px shadow-[inset_0_-1px_0_var(--border)] data-[orientation=vertical]:pb-0 data-[orientation=vertical]:shadow-none" : "gap-1 rounded-none border-b border-border data-[orientation=vertical]:border-b-0", "data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch", local.class);
|
|
@@ -149,6 +149,6 @@ function TabsContent(props) {
|
|
|
149
149
|
}
|
|
150
150
|
}, rest));
|
|
151
151
|
}
|
|
152
|
-
export { Tabs
|
|
152
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
|
153
153
|
|
|
154
154
|
//# sourceMappingURL=tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","names":["<TabsIdContext value={tabs}>\n <SdkTabs\n data-slot=\"tabs\"\n id={id()}\n value={local.value}\n defaultValue={local.defaultValue}\n onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}\n activation={local.activationMode}\n class={cn(\n 'flex min-h-0 min-w-0 flex-col gap-2 data-[orientation=vertical]:flex-row',\n local.class as string\n )}\n {...rest}\n />\n </TabsIdContext>","value={tabs}","<SdkTabs\n data-slot=\"tabs\"\n id={id()}\n value={local.value}\n defaultValue={local.defaultValue}\n onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}\n activation={local.activationMode}\n class={cn(\n 'flex min-h-0 min-w-0 flex-col gap-2 data-[orientation=vertical]:flex-row',\n local.class as string\n )}\n {...rest}\n />","onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}","<SdkTabsList\n data-slot=\"tabs-list\"\n class={cn(\n 'shrink-0 items-center',\n local.fill || local.scrollable\n ? 'flex w-full justify-start'\n : 'inline-flex w-fit justify-center',\n local.scrollable && 'no-scrollbar overflow-x-auto overflow-y-hidden',\n !underline()\n ? 'gap-0.5 rounded-lg bg-surface-hover p-0.5'\n : local.scrollable\n ? 'gap-1 rounded-none pb-px shadow-[inset_0_-1px_0_var(--border)] data-[orientation=vertical]:pb-0 data-[orientation=vertical]:shadow-none'\n : 'gap-1 rounded-none border-b border-border data-[orientation=vertical]:border-b-0',\n 'data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch',\n local.class as string\n )}\n {...rest}\n />","<SdkTabsTab\n // ui-sdk keeps a part's own `data-slot`; the trigger keeps its public one.\n render={(tabProps) => <button {...tabProps} data-slot=\"tabs-trigger\" />}\n id={triggerId()}\n // The value as a hook for hosts and tests, as Kobalte's tab carried it.\n data-key={rest.value}\n class={cn(\n 'inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium',\n 'transition-colors ease-out outline-none select-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n 'text-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4',\n local.appearance === 'segmented'\n ? 'h-control-sm rounded-md px-control-sm data-[selected]:bg-primary-subtle data-[selected]:text-foreground'\n : tabs.orientation() === 'vertical'\n ? 'h-control-md justify-start rounded-none border-s-2 border-transparent ps-3 pe-2 data-[selected]:border-primary'\n : 'h-control-md -mb-px rounded-none border-b-2 border-transparent px-2 pb-2 data-[selected]:border-primary',\n local.class as string\n )}\n {...rest}\n />","render={(tabProps) => <button {...tabProps} data-slot=\"tabs-trigger\" />}","<SdkTabsPanel\n render={(panelProps) => <div {...panelProps} data-slot=\"tabs-content\" />}\n keepMounted={local.forceMount}\n // Panel ids stay `<tabs id>-content-<value>`, as they were on Kobalte, so a host can\n // point at a panel by its tabs' id. ui-sdk adopts an authored id and points the\n // tab's `aria-controls` at it.\n id={local.id ?? `${tabs.id()}-content-${rest.value}`}\n aria-labelledby={\n local['aria-labelledby'] ??\n tabs.triggerIds().get(rest.value) ??\n `${tabs.id()}-trigger-${rest.value}`\n }\n class={cn('min-h-0 min-w-0 flex-1 outline-none', local.class as string)}\n {...rest}\n />","render={(panelProps) => <div {...panelProps} data-slot=\"tabs-content\" />}","Tabs","TabsList"],"sources":["../../../../src/components/ui/tabs/tabs.tsx"],"sourcesContent":["import {\n Tabs as SdkTabs,\n TabsList as SdkTabsList,\n TabsPanel as SdkTabsPanel,\n TabsTab as SdkTabsTab,\n} from '@ui-sdk/solid/tabs'\nimport type { Accessor } from 'solid-js'\nimport type { ComponentProps, JSX } from '@solidjs/web'\nimport {\n createContext,\n createRenderEffect,\n createSignal,\n createUniqueId,\n omit,\n useContext,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\n\ntype TabsIdContextValue = {\n id: Accessor<string>\n orientation: Accessor<'horizontal' | 'vertical'>\n triggerIds: Accessor<ReadonlyMap<string, string>>\n registerTriggerId: (value: string, id: string) => void\n unregisterTriggerId: (value: string, id: string) => void\n}\n\nconst TabsIdContext = createContext<TabsIdContextValue>()\n\nfunction useTabsId() {\n const tabs = useContext(TabsIdContext)\n if (!tabs) throw new Error('[adea-ui]: Tabs parts must be used within Tabs.')\n return tabs\n}\n\n/**\n * Tabs.\n *\n * For switching between sibling views of the *same* subject, a file's code,\n * diff and history. Not for moving between pages: a tab is expected to keep\n * its panel and its scroll position, which a route does not.\n *\n * `appearance=\"segmented\"` gives the joined bar KiroCrew uses inside a pane\n * where a full-width underline would collide with the panel's own header rule.\n *\n * Built on ui-sdk's Tabs: one tab stop for the list, arrow keys between tabs\n * (selecting as they move unless `activationMode=\"manual\"`), and the\n * tab/tabpanel ARIA wiring. Trigger ids stay `<tabs id>-trigger-<value>`, so a\n * panel can name its tab even while that tab is not rendered.\n */\nexport type TabsProps = Omit<\n ComponentProps<typeof SdkTabs>,\n 'value' | 'defaultValue' | 'onValueChange' | 'onChange' | 'activation'\n> & {\n /** The selected tab's value. Pass it to control the tabs. */\n value?: string\n /** The tab selected at first; the first enabled tab otherwise. */\n defaultValue?: string\n /** Called with the newly selected tab's value. */\n onChange?: (value: string) => void\n /** `manual` waits for Enter or Space before selecting a focused tab. */\n activationMode?: 'automatic' | 'manual'\n}\n\nexport function Tabs(props: TabsProps) {\n const local = props\n const rest = omit(props, 'class', 'id', 'value', 'defaultValue', 'onChange', 'activationMode')\n const generatedId = `tabs-${createUniqueId()}`\n const id = () => local.id || generatedId\n // `ownedWrite`: each trigger registers its id while it renders (see\n // TabsTrigger), so a panel names its tab in the first render, the server's\n // included. Only the panels' `aria-labelledby` reads it.\n const [triggerIds, setTriggerIds] = createSignal<ReadonlyMap<string, string>>(new Map(), {\n ownedWrite: true,\n })\n const tabs: TabsIdContextValue = {\n id,\n orientation: () => local.orientation ?? 'horizontal',\n triggerIds,\n registerTriggerId: (value, triggerId) => {\n setTriggerIds((current) => new Map(current).set(value, triggerId))\n },\n unregisterTriggerId: (value, triggerId) => {\n setTriggerIds((current) => {\n if (current.get(value) !== triggerId) return current\n const next = new Map(current)\n next.delete(value)\n return next\n })\n },\n }\n\n return (\n <TabsIdContext value={tabs}>\n <SdkTabs\n data-slot=\"tabs\"\n id={id()}\n value={local.value}\n defaultValue={local.defaultValue}\n onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}\n activation={local.activationMode}\n class={cn(\n 'flex min-h-0 min-w-0 flex-col gap-2 data-[orientation=vertical]:flex-row',\n local.class as string\n )}\n {...rest}\n />\n </TabsIdContext>\n )\n}\n\nexport type TabsListProps = ComponentProps<typeof SdkTabsList> & {\n appearance?: 'underline' | 'segmented'\n /**\n * Span the container, with the triggers at the start. For a row of tabs that\n * heads a pane: the underline's rule then runs the pane's full width, the\n * way the pane's other header rules do, instead of stopping at the last tab.\n */\n fill?: boolean\n /**\n * Scroll sideways when the triggers outgrow the row, with no visible\n * scrollbar, instead of overflowing it. Implies `fill`. The underline's rule\n * is drawn inside the scroller so the selected mark still sits on it.\n */\n scrollable?: boolean\n}\n\n/**\n * The underline appearance's rule is the baseline a horizontal row of tabs sits\n * on. A vertical list has no baseline, its triggers stack, so the rule is\n * dropped there; otherwise it draws as a stray line under the last trigger,\n * spanning only the list's width (the SettingsLayout rail showed exactly that).\n *\n * A scrolling list cannot draw that rule as its border: a scroller clips at its\n * padding edge, and the selected trigger's mark overlaps the border by a pixel\n * (`-mb-px`), so the mark would be cut off and the list would scroll vertically\n * by that pixel. It reserves the pixel as padding instead and paints the rule\n * there with an inset shadow, which lands exactly where the border was.\n */\nexport function TabsList(props: TabsListProps) {\n const local = props\n const rest = omit(props, 'class', 'appearance', 'fill', 'scrollable')\n const underline = () => local.appearance !== 'segmented'\n\n return (\n <SdkTabsList\n data-slot=\"tabs-list\"\n class={cn(\n 'shrink-0 items-center',\n local.fill || local.scrollable\n ? 'flex w-full justify-start'\n : 'inline-flex w-fit justify-center',\n local.scrollable && 'no-scrollbar overflow-x-auto overflow-y-hidden',\n !underline()\n ? 'gap-0.5 rounded-lg bg-surface-hover p-0.5'\n : local.scrollable\n ? 'gap-1 rounded-none pb-px shadow-[inset_0_-1px_0_var(--border)] data-[orientation=vertical]:pb-0 data-[orientation=vertical]:shadow-none'\n : 'gap-1 rounded-none border-b border-border data-[orientation=vertical]:border-b-0',\n 'data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch',\n local.class as string\n )}\n {...rest}\n />\n )\n}\n\nexport type TabsTriggerProps = ComponentProps<typeof SdkTabsTab> & {\n appearance?: 'underline' | 'segmented'\n}\n\n/**\n * The underline appearance marks the selected trigger on the edge it shares\n * with the list's axis. A horizontal row reads left to right along a baseline,\n * so the mark is a bottom bar sitting on the list's rule. A vertical list stacks\n * its triggers, and a bottom bar there underlines one row of a column, it reads\n * as a divider, not a selection, so the mark moves to the inline-start edge,\n * the leading bar a side navigation uses, and the label aligns to that edge.\n *\n * The orientation is read from the root rather than from a `data-orientation`\n * selector so the vertical classes are unprefixed: a composite that replaces the\n * mark (SettingsNavigation's filled row passes `border-0`) then overrides it\n * through the ordinary class merge instead of fighting a variant-scoped border.\n *\n * A disabled tab stays focusable, as the tabs pattern asks, so it is\n * `aria-disabled` rather than `:disabled`; `data-[disabled]` repeats the\n * disabled look for it.\n */\nexport function TabsTrigger(props: TabsTriggerProps) {\n const local = props\n const rest = omit(props, 'class', 'appearance', 'id')\n const tabs = useTabsId()\n const triggerId = () => local.id || `${tabs.id()}-trigger-${rest.value}`\n\n // Register before panels render, including SSR where createEffect is skipped.\n createRenderEffect(\n () => [rest.value, triggerId()] as const,\n ([value, id]) => {\n tabs.registerTriggerId(value, id)\n return () => tabs.unregisterTriggerId(value, id)\n }\n )\n\n return (\n <SdkTabsTab\n // ui-sdk keeps a part's own `data-slot`; the trigger keeps its public one.\n render={(tabProps) => <button {...tabProps} data-slot=\"tabs-trigger\" />}\n id={triggerId()}\n // The value as a hook for hosts and tests, as Kobalte's tab carried it.\n data-key={rest.value}\n class={cn(\n 'inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium',\n 'transition-colors ease-out outline-none select-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n 'text-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4',\n local.appearance === 'segmented'\n ? 'h-control-sm rounded-md px-control-sm data-[selected]:bg-primary-subtle data-[selected]:text-foreground'\n : tabs.orientation() === 'vertical'\n ? 'h-control-md justify-start rounded-none border-s-2 border-transparent ps-3 pe-2 data-[selected]:border-primary'\n : 'h-control-md -mb-px rounded-none border-b-2 border-transparent px-2 pb-2 data-[selected]:border-primary',\n local.class as string\n )}\n {...rest}\n />\n )\n}\n\nexport type TabsContentProps = ComponentProps<typeof SdkTabsPanel> & {\n /** Keeps the panel in the page, hidden, while its tab is not selected. */\n forceMount?: boolean\n children?: JSX.Element\n}\n\nexport function TabsContent(props: TabsContentProps) {\n const local = props\n const rest = omit(props, 'class', 'id', 'aria-labelledby', 'forceMount')\n const tabs = useTabsId()\n return (\n <SdkTabsPanel\n render={(panelProps) => <div {...panelProps} data-slot=\"tabs-content\" />}\n keepMounted={local.forceMount}\n // Panel ids stay `<tabs id>-content-<value>`, as they were on Kobalte, so a host can\n // point at a panel by its tabs' id. ui-sdk adopts an authored id and points the\n // tab's `aria-controls` at it.\n id={local.id ?? `${tabs.id()}-content-${rest.value}`}\n aria-labelledby={\n local['aria-labelledby'] ??\n tabs.triggerIds().get(rest.value) ??\n `${tabs.id()}-trigger-${rest.value}`\n }\n class={cn('min-h-0 min-w-0 flex-1 outline-none', local.class as string)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;AA0BA,IAAM,gBAAgB,cAAkC;AAExD,SAAS,YAAY;CACnB,MAAM,OAAO,WAAW,aAAa;CACrC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,iDAAiD;CAC5E,OAAO;AACT;AA+BA,SAAgBS,OAAK,OAAkB;CACrC,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,MAAM,SAAS,gBAAgB,YAAY,gBAAgB;CAC7F,MAAM,cAAc,QAAQ,eAAe;CAC3C,MAAM,WAAW,MAAM,MAAM;CAI7B,MAAM,CAAC,YAAY,iBAAiB,6BAA0C,IAAI,IAAI,GAAG,EACvF,YAAY,KACd,CAAC;CAkBD,OACET,gBAAAA,eAAAA;EAAeC,OAAO;GAjBtB;GACA,mBAAmB,MAAM,eAAe;GACxC;GACA,oBAAoB,OAAO,cAAc;IACvC,eAAe,YAAY,IAAI,IAAI,OAAO,CAAC,CAAC,IAAI,OAAO,SAAS,CAAC;GACnE;GACA,sBAAsB,OAAO,cAAc;IACzC,eAAe,YAAY;KACzB,IAAI,QAAQ,IAAI,KAAK,MAAM,WAAW,OAAO;KAC7C,MAAM,OAAO,IAAI,IAAI,OAAO;KAC5B,KAAK,OAAO,KAAK;KACjB,OAAO;IACT,CAAC;GACH;EAIsB;EAAtB,IAAA,WAAA;GACEC,OAAAA,gBAAAA,MAAAA,WAAAA;IACE,aAAU;IACV,IAAA,KAAA;KAAI,OAAA,GAAG;IAAC;IACR,IAAA,QAAA;KAAO,OAAA,MAAM;IAAK;IAClB,IAAA,eAAA;KAAc,OAAA,MAAM;IAAY;IAChCC,gBAAgB,UAAU;KACxB,IAAI,UAAU,MAAM,MAAM,WAAW,KAAK;IAC5C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eAAe,cACjB,4GACA,KAAK,YAAY,MAAM,aACrB,mHACA,2GACN,MAAM,KACR;EAAC;CAEF,GADK,IACL,CAAA;AAEL;AAQA,SAAgB,YAAY,OAAyB;CACnD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,MAAM,mBAAmB,YAAY;CACvE,MAAM,OAAO,UAAU;CACvB,OACEC,gBAAAA,WAAAA,WAAAA;EACEC,SAAS,sBAAe;GAA+C,IAAA,QAAA,QAAA;GAAtC,OAAA,OAAA,CAAA,YAAA,EAAY,aAAA,eAAA,CAAA,GAAA,KAAA;GAArB,OAAA;EAA+C,EAAA,CAAA;EACvE,IAAA,cAAA;GAAa,OAAA,MAAM;EAAU;EAI7B,IAAA,KAAA;GAAI,OAAA,MAAM,MAAM,GAAG,KAAK,GAAG,EAAE,WAAW,KAAK;EAAO;EACpD,IAAA,oBAAA;GACE,OAAA,MAAM,sBACN,KAAK,WAAW,CAAC,CAAC,IAAI,KAAK,KAAK,KAChC,GAAG,KAAK,GAAG,EAAE,WAAW,KAAK;EAC/B;EACA,IAAA,UAAA;GAAO,OAAA,GAAG,uCAAuC,MAAM,KAAe;EAAC;CAExE,GADK,IACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"tabs.js","names":["<TabsIdContext value={tabs}>\n <SdkTabs\n data-slot=\"tabs\"\n id={id()}\n value={local.value}\n defaultValue={local.defaultValue}\n onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}\n activation={local.activationMode}\n class={cn(\n 'flex min-h-0 min-w-0 flex-col gap-2 data-[orientation=vertical]:flex-row',\n local.class as string\n )}\n {...rest}\n />\n </TabsIdContext>","value={tabs}","<SdkTabs\n data-slot=\"tabs\"\n id={id()}\n value={local.value}\n defaultValue={local.defaultValue}\n onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}\n activation={local.activationMode}\n class={cn(\n 'flex min-h-0 min-w-0 flex-col gap-2 data-[orientation=vertical]:flex-row',\n local.class as string\n )}\n {...rest}\n />","onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}","<SdkTabsList\n data-slot=\"tabs-list\"\n class={cn(\n 'shrink-0 items-center',\n local.fill || local.scrollable\n ? 'flex w-full justify-start'\n : 'inline-flex w-fit justify-center',\n local.scrollable && 'no-scrollbar overflow-x-auto overflow-y-hidden',\n !underline()\n ? 'gap-0.5 rounded-lg bg-surface-hover p-0.5'\n : local.scrollable\n ? 'gap-1 rounded-none pb-px shadow-[inset_0_-1px_0_var(--border)] data-[orientation=vertical]:pb-0 data-[orientation=vertical]:shadow-none'\n : 'gap-1 rounded-none border-b border-border data-[orientation=vertical]:border-b-0',\n 'data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch',\n local.class as string\n )}\n {...rest}\n />","<SdkTabsTab\n // ui-sdk keeps a part's own `data-slot`; the trigger keeps its public one.\n render={(tabProps) => <button {...tabProps} data-slot=\"tabs-trigger\" />}\n id={triggerId()}\n // The value as a hook for hosts and tests, as Kobalte's tab carried it.\n data-key={rest.value}\n class={cn(\n 'inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium',\n 'transition-colors ease-out outline-none select-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n 'text-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4',\n local.appearance === 'segmented'\n ? 'h-control-sm rounded-md px-control-sm data-[selected]:bg-primary-subtle data-[selected]:text-foreground'\n : tabs.orientation() === 'vertical'\n ? 'h-control-md justify-start rounded-none border-s-2 border-transparent ps-3 pe-2 data-[selected]:border-primary'\n : 'h-control-md -mb-px rounded-none border-b-2 border-transparent px-2 pb-2 data-[selected]:border-primary',\n local.class as string\n )}\n {...rest}\n />","render={(tabProps) => <button {...tabProps} data-slot=\"tabs-trigger\" />}","<SdkTabsPanel\n render={(panelProps) => <div {...panelProps} data-slot=\"tabs-content\" />}\n keepMounted={local.forceMount}\n // Panel ids stay `<tabs id>-content-<value>`, as they were on Kobalte, so a host can\n // point at a panel by its tabs' id. ui-sdk adopts an authored id and points the\n // tab's `aria-controls` at it.\n id={local.id ?? `${tabs.id()}-content-${rest.value}`}\n aria-labelledby={\n local['aria-labelledby'] ??\n tabs.triggerIds().get(rest.value) ??\n `${tabs.id()}-trigger-${rest.value}`\n }\n class={cn('min-h-0 min-w-0 flex-1 outline-none', local.class as string)}\n {...rest}\n />","render={(panelProps) => <div {...panelProps} data-slot=\"tabs-content\" />}","_$spread"],"sources":["../../../../src/components/ui/tabs/tabs.tsx"],"sourcesContent":["import {\n Tabs as SdkTabs,\n TabsList as SdkTabsList,\n TabsPanel as SdkTabsPanel,\n TabsTab as SdkTabsTab,\n} from '@ui-sdk/solid/tabs'\nimport type { Accessor } from 'solid-js'\nimport type { ComponentProps, JSX } from '@solidjs/web'\nimport {\n createContext,\n createRenderEffect,\n createSignal,\n createUniqueId,\n omit,\n useContext,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\n\ntype TabsIdContextValue = {\n id: Accessor<string>\n orientation: Accessor<'horizontal' | 'vertical'>\n triggerIds: Accessor<ReadonlyMap<string, string>>\n registerTriggerId: (value: string, id: string) => void\n unregisterTriggerId: (value: string, id: string) => void\n}\n\nconst TabsIdContext = createContext<TabsIdContextValue>()\n\nfunction useTabsId() {\n const tabs = useContext(TabsIdContext)\n if (!tabs) throw new Error('[adea-ui]: Tabs parts must be used within Tabs.')\n return tabs\n}\n\n/**\n * Tabs.\n *\n * For switching between sibling views of the *same* subject, a file's code,\n * diff and history. Not for moving between pages: a tab is expected to keep\n * its panel and its scroll position, which a route does not.\n *\n * `appearance=\"segmented\"` gives the joined bar KiroCrew uses inside a pane\n * where a full-width underline would collide with the panel's own header rule.\n *\n * Built on ui-sdk's Tabs: one tab stop for the list, arrow keys between tabs\n * (selecting as they move unless `activationMode=\"manual\"`), and the\n * tab/tabpanel ARIA wiring. Trigger ids stay `<tabs id>-trigger-<value>`, so a\n * panel can name its tab even while that tab is not rendered.\n */\nexport type TabsProps = Omit<\n ComponentProps<typeof SdkTabs>,\n 'value' | 'defaultValue' | 'onValueChange' | 'onChange' | 'activation'\n> & {\n /** The selected tab's value. Pass it to control the tabs. */\n value?: string\n /** The tab selected at first; the first enabled tab otherwise. */\n defaultValue?: string\n /** Called with the newly selected tab's value. */\n onChange?: (value: string) => void\n /** `manual` waits for Enter or Space before selecting a focused tab. */\n activationMode?: 'automatic' | 'manual'\n}\n\nexport function Tabs(props: TabsProps) {\n const local = props\n const rest = omit(props, 'class', 'id', 'value', 'defaultValue', 'onChange', 'activationMode')\n const generatedId = `tabs-${createUniqueId()}`\n const id = () => local.id || generatedId\n // `ownedWrite`: each trigger registers its id while it renders (see\n // TabsTrigger), so a panel names its tab in the first render, the server's\n // included. Only the panels' `aria-labelledby` reads it.\n const [triggerIds, setTriggerIds] = createSignal<ReadonlyMap<string, string>>(new Map(), {\n ownedWrite: true,\n })\n const tabs: TabsIdContextValue = {\n id,\n orientation: () => local.orientation ?? 'horizontal',\n triggerIds,\n registerTriggerId: (value, triggerId) => {\n setTriggerIds((current) => new Map(current).set(value, triggerId))\n },\n unregisterTriggerId: (value, triggerId) => {\n setTriggerIds((current) => {\n if (current.get(value) !== triggerId) return current\n const next = new Map(current)\n next.delete(value)\n return next\n })\n },\n }\n\n return (\n <TabsIdContext value={tabs}>\n <SdkTabs\n data-slot=\"tabs\"\n id={id()}\n value={local.value}\n defaultValue={local.defaultValue}\n onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}\n activation={local.activationMode}\n class={cn(\n 'flex min-h-0 min-w-0 flex-col gap-2 data-[orientation=vertical]:flex-row',\n local.class as string\n )}\n {...rest}\n />\n </TabsIdContext>\n )\n}\n\nexport type TabsListProps = ComponentProps<typeof SdkTabsList> & {\n appearance?: 'underline' | 'segmented'\n /**\n * Span the container, with the triggers at the start. For a row of tabs that\n * heads a pane: the underline's rule then runs the pane's full width, the\n * way the pane's other header rules do, instead of stopping at the last tab.\n */\n fill?: boolean\n /**\n * Scroll sideways when the triggers outgrow the row, with no visible\n * scrollbar, instead of overflowing it. Implies `fill`. The underline's rule\n * is drawn inside the scroller so the selected mark still sits on it.\n */\n scrollable?: boolean\n}\n\n/**\n * The underline appearance's rule is the baseline a horizontal row of tabs sits\n * on. A vertical list has no baseline, its triggers stack, so the rule is\n * dropped there; otherwise it draws as a stray line under the last trigger,\n * spanning only the list's width (the SettingsLayout rail showed exactly that).\n *\n * A scrolling list cannot draw that rule as its border: a scroller clips at its\n * padding edge, and the selected trigger's mark overlaps the border by a pixel\n * (`-mb-px`), so the mark would be cut off and the list would scroll vertically\n * by that pixel. It reserves the pixel as padding instead and paints the rule\n * there with an inset shadow, which lands exactly where the border was.\n */\nexport function TabsList(props: TabsListProps) {\n const local = props\n const rest = omit(props, 'class', 'appearance', 'fill', 'scrollable')\n const underline = () => local.appearance !== 'segmented'\n\n return (\n <SdkTabsList\n data-slot=\"tabs-list\"\n class={cn(\n 'shrink-0 items-center',\n local.fill || local.scrollable\n ? 'flex w-full justify-start'\n : 'inline-flex w-fit justify-center',\n local.scrollable && 'no-scrollbar overflow-x-auto overflow-y-hidden',\n !underline()\n ? 'gap-0.5 rounded-lg bg-surface-hover p-0.5'\n : local.scrollable\n ? 'gap-1 rounded-none pb-px shadow-[inset_0_-1px_0_var(--border)] data-[orientation=vertical]:pb-0 data-[orientation=vertical]:shadow-none'\n : 'gap-1 rounded-none border-b border-border data-[orientation=vertical]:border-b-0',\n 'data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch',\n local.class as string\n )}\n {...rest}\n />\n )\n}\n\nexport type TabsTriggerProps = ComponentProps<typeof SdkTabsTab> & {\n appearance?: 'underline' | 'segmented'\n}\n\n/**\n * The underline appearance marks the selected trigger on the edge it shares\n * with the list's axis. A horizontal row reads left to right along a baseline,\n * so the mark is a bottom bar sitting on the list's rule. A vertical list stacks\n * its triggers, and a bottom bar there underlines one row of a column, it reads\n * as a divider, not a selection, so the mark moves to the inline-start edge,\n * the leading bar a side navigation uses, and the label aligns to that edge.\n *\n * The orientation is read from the root rather than from a `data-orientation`\n * selector so the vertical classes are unprefixed: a composite that replaces the\n * mark (SettingsNavigation's filled row passes `border-0`) then overrides it\n * through the ordinary class merge instead of fighting a variant-scoped border.\n *\n * A disabled tab stays focusable, as the tabs pattern asks, so it is\n * `aria-disabled` rather than `:disabled`; `data-[disabled]` repeats the\n * disabled look for it.\n */\nexport function TabsTrigger(props: TabsTriggerProps) {\n const local = props\n const rest = omit(props, 'class', 'appearance', 'id')\n const tabs = useTabsId()\n const triggerId = () => local.id || `${tabs.id()}-trigger-${rest.value}`\n\n // Register before panels render, including SSR where createEffect is skipped.\n createRenderEffect(\n () => [rest.value, triggerId()] as const,\n ([value, id]) => {\n tabs.registerTriggerId(value, id)\n return () => tabs.unregisterTriggerId(value, id)\n }\n )\n\n return (\n <SdkTabsTab\n // ui-sdk keeps a part's own `data-slot`; the trigger keeps its public one.\n render={(tabProps) => <button {...tabProps} data-slot=\"tabs-trigger\" />}\n id={triggerId()}\n // The value as a hook for hosts and tests, as Kobalte's tab carried it.\n data-key={rest.value}\n class={cn(\n 'inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium',\n 'transition-colors ease-out outline-none select-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n 'text-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4',\n local.appearance === 'segmented'\n ? 'h-control-sm rounded-md px-control-sm data-[selected]:bg-primary-subtle data-[selected]:text-foreground'\n : tabs.orientation() === 'vertical'\n ? 'h-control-md justify-start rounded-none border-s-2 border-transparent ps-3 pe-2 data-[selected]:border-primary'\n : 'h-control-md -mb-px rounded-none border-b-2 border-transparent px-2 pb-2 data-[selected]:border-primary',\n local.class as string\n )}\n {...rest}\n />\n )\n}\n\nexport type TabsContentProps = ComponentProps<typeof SdkTabsPanel> & {\n /** Keeps the panel in the page, hidden, while its tab is not selected. */\n forceMount?: boolean\n children?: JSX.Element\n}\n\nexport function TabsContent(props: TabsContentProps) {\n const local = props\n const rest = omit(props, 'class', 'id', 'aria-labelledby', 'forceMount')\n const tabs = useTabsId()\n return (\n <SdkTabsPanel\n render={(panelProps) => <div {...panelProps} data-slot=\"tabs-content\" />}\n keepMounted={local.forceMount}\n // Panel ids stay `<tabs id>-content-<value>`, as they were on Kobalte, so a host can\n // point at a panel by its tabs' id. ui-sdk adopts an authored id and points the\n // tab's `aria-controls` at it.\n id={local.id ?? `${tabs.id()}-content-${rest.value}`}\n aria-labelledby={\n local['aria-labelledby'] ??\n tabs.triggerIds().get(rest.value) ??\n `${tabs.id()}-trigger-${rest.value}`\n }\n class={cn('min-h-0 min-w-0 flex-1 outline-none', local.class as string)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;AA0BA,IAAM,gBAAgB,cAAkC;AAExD,SAAS,YAAY;CACnB,MAAM,OAAO,WAAW,aAAa;CACrC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,iDAAiD;CAC5E,OAAO;AACT;AA+BA,SAAgB,KAAK,OAAkB;CACrC,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,MAAM,SAAS,gBAAgB,YAAY,gBAAgB;CAC7F,MAAM,cAAc,QAAQ,eAAe;CAC3C,MAAM,WAAW,MAAM,MAAM;CAI7B,MAAM,CAAC,YAAY,iBAAiB,6BAA0C,IAAI,IAAI,GAAG,EACvF,YAAY,KACd,CAAC;CAkBD,OACEA,gBAAAA,eAAAA;EAAeC,OAAO;GAjBtB;GACA,mBAAmB,MAAM,eAAe;GACxC;GACA,oBAAoB,OAAO,cAAc;IACvC,eAAe,YAAY,IAAI,IAAI,OAAO,CAAC,CAAC,IAAI,OAAO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 -1,6 +1,6 @@
|
|
|
1
|
-
import { cn } from "../../../lib/utils.js";
|
|
2
1
|
import { spread, template } from "@solidjs/web";
|
|
3
2
|
import { omit } from "solid-js";
|
|
3
|
+
import { cn } from "../../../lib/utils.js";
|
|
4
4
|
// src/components/ui/text-link/text-link.tsx
|
|
5
5
|
var _tmpl$ = /* @__PURE__ */ template(`<a>`);
|
|
6
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-link.js","names":["<a\n data-slot=\"textlink\"\n class={cn(\n 'rounded-sm text-foreground underline decoration-primary underline-offset-4',\n 'transition-colors ease-out hover:decoration-foreground outline-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'motion-reduce:transition-none',\n local.class\n )}\n tabindex={local.tabindex ?? 0}\n {...rest}\n />"],"sources":["../../../../src/components/ui/text-link/text-link.tsx"],"sourcesContent":["import type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * TextLink.\n *\n * An inline, underlined link for prose and content navigation. Use ActionButton\n * or ListRow when the link is a compact action or a row-sized target.\n */\nexport function TextLink(props: ComponentProps<'a'>) {\n const local = props\n const rest = omit(props, 'class', 'tabindex')\n\n return (\n <a\n data-slot=\"textlink\"\n class={cn(\n 'rounded-sm text-foreground underline decoration-primary underline-offset-4',\n 'transition-colors ease-out hover:decoration-foreground outline-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'motion-reduce:transition-none',\n local.class\n )}\n tabindex={local.tabindex ?? 0}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,SAAS,OAA4B;CACnD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,UAAU;CAG1C,IAAA,OAAA,OAWC;
|
|
1
|
+
{"version":3,"file":"text-link.js","names":["<a\n data-slot=\"textlink\"\n class={cn(\n 'rounded-sm text-foreground underline decoration-primary underline-offset-4',\n 'transition-colors ease-out hover:decoration-foreground outline-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'motion-reduce:transition-none',\n local.class\n )}\n tabindex={local.tabindex ?? 0}\n {...rest}\n />","_$spread"],"sources":["../../../../src/components/ui/text-link/text-link.tsx"],"sourcesContent":["import type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * TextLink.\n *\n * An inline, underlined link for prose and content navigation. Use ActionButton\n * or ListRow when the link is a compact action or a row-sized target.\n */\nexport function TextLink(props: ComponentProps<'a'>) {\n const local = props\n const rest = omit(props, 'class', 'tabindex')\n\n return (\n <a\n data-slot=\"textlink\"\n class={cn(\n 'rounded-sm text-foreground underline decoration-primary underline-offset-4',\n 'transition-colors ease-out hover:decoration-foreground outline-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'motion-reduce:transition-none',\n local.class\n )}\n tabindex={local.tabindex ?? 0}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,SAAS,OAA4B;CACnD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,UAAU;CAG1C,IAAA,OAAA,OAWC;CADCC,OAAA,MAAA,CAAA;EATA,aAAA;EACA,IAAA,UAAA;GAAO,OAAA,GACL,8EACA,uEACA,oFACA,iCACA,MAAM,KACR;EAAC;EACD,IAAA,WAAA;GAAU,OAAA,MAAM,YAAY;EAAC;CACrB,GAAJ,IAAA,GAAA,KAAA;CAXR,OACED;AAaJ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useFormFieldControl } from "../../../lib/form-field.js";
|
|
2
|
-
import { cn } from "../../../lib/utils.js";
|
|
3
1
|
import { ref, spread, template } from "@solidjs/web";
|
|
4
2
|
import { omit } from "solid-js";
|
|
5
3
|
import { cva } from "class-variance-authority";
|
|
4
|
+
import { useFormFieldControl } from "../../../lib/form-field.js";
|
|
5
|
+
import { cn } from "../../../lib/utils.js";
|
|
6
6
|
// src/components/ui/textarea/textarea.tsx
|
|
7
7
|
var _tmpl$ = /* @__PURE__ */ template(`<textarea>`);
|
|
8
8
|
var textareaVariants = cva([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.js","names":["ref={local.ref}","<textarea\n data-slot=\"textarea\"\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n ref={local.ref}\n class={cn(\n textareaVariants({ variant: local.variant, size: local.size, resize: local.resize }),\n local.class\n )}\n {...rest}\n />"],"sources":["../../../../src/components/ui/textarea/textarea.tsx"],"sourcesContent":["import type { Ref } from 'solid-js'\nimport type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\n\nexport const textareaVariants = cva(\n [\n 'flex field-sizing-content w-full rounded-md border border-input bg-transparent px-control-md py-2 text-sm',\n 'transition-[color,box-shadow,border-color] ease-out outline-none',\n 'placeholder:text-muted-foreground',\n 'selection:bg-primary selection:text-primary-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive-subtle',\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',\n ],\n {\n variants: {\n variant: {\n default: '',\n composer: 'border-0 bg-transparent p-0 shadow-none focus-visible:ring-0',\n code: 'font-mono',\n },\n size: {\n default: 'min-h-16',\n comfortable: 'min-h-16 max-h-48',\n },\n resize: {\n vertical: 'resize-y',\n none: 'resize-none',\n both: 'resize',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n resize: 'vertical',\n },\n }\n)\n\nexport type TextareaProps = Omit<ComponentProps<'textarea'>, 'size'> &\n VariantProps<typeof textareaVariants> & {\n /** Solid's actual textarea element, rather than its containing component or form. */\n ref?: Ref<HTMLTextAreaElement>\n }\n\n/**\n * Textarea.\n *\n * Shares the Input's border, focus and invalid treatment exactly, the two are\n * the same control at different aspect ratios, and a form that mixes them must\n * not show a seam between them.\n *\n * `field-sizing: content` lets the element grow with its content where the\n * engine supports it, which is the behaviour a chat composer wants; `rows`\n * remains the fallback so an unsupported engine still gets a usable height.\n * `variant=\"composer\"` removes the standalone field surface when nested in a\n * composer shell. `variant=\"code\"` keeps the field surface and sets the\n * monospace face, for commands, snippets and other literal text. `size=\"comfortable\"` caps growth at the shared 12rem rung, and\n * the finite `resize` variants keep browser resize behavior explicit.\n */\nexport function Textarea(props: TextareaProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'variant',\n 'size',\n 'resize',\n 'ref',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage'\n )\n const field = useFormFieldControl('control', local)\n\n return (\n <textarea\n data-slot=\"textarea\"\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n ref={local.ref}\n class={cn(\n textareaVariants({ variant: local.variant, size: local.size, resize: local.resize }),\n local.class\n )}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;AAOA,IAAa,mBAAmB,IAC9B;CACE;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,UAAU;GACV,MAAM;EACR;EACA,MAAM;GACJ,SAAS;GACT,aAAa;EACf;EACA,QAAQ;GACN,UAAU;GACV,MAAM;GACN,MAAM;EACR;CACF;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;EACN,QAAQ;CACV;AACF,CACF;;;;;;;;;;;;;;;;AAuBA,SAAgB,SAAS,OAAsB;CAC7C,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,SACA,WACA,QACA,UACA,OACA,MACA,cACA,mBACA,oBACA,gBACA,mBACF;CACA,MAAM,QAAQ,oBAAoB,WAAW,KAAK;CAGhD,IAAA,OAAA,OAcC;
|
|
1
|
+
{"version":3,"file":"textarea.js","names":["ref={local.ref}","<textarea\n data-slot=\"textarea\"\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n ref={local.ref}\n class={cn(\n textareaVariants({ variant: local.variant, size: local.size, resize: local.resize }),\n local.class\n )}\n {...rest}\n />","_$spread"],"sources":["../../../../src/components/ui/textarea/textarea.tsx"],"sourcesContent":["import type { Ref } from 'solid-js'\nimport type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\n\nexport const textareaVariants = cva(\n [\n 'flex field-sizing-content w-full rounded-md border border-input bg-transparent px-control-md py-2 text-sm',\n 'transition-[color,box-shadow,border-color] ease-out outline-none',\n 'placeholder:text-muted-foreground',\n 'selection:bg-primary selection:text-primary-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive-subtle',\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',\n ],\n {\n variants: {\n variant: {\n default: '',\n composer: 'border-0 bg-transparent p-0 shadow-none focus-visible:ring-0',\n code: 'font-mono',\n },\n size: {\n default: 'min-h-16',\n comfortable: 'min-h-16 max-h-48',\n },\n resize: {\n vertical: 'resize-y',\n none: 'resize-none',\n both: 'resize',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n resize: 'vertical',\n },\n }\n)\n\nexport type TextareaProps = Omit<ComponentProps<'textarea'>, 'size'> &\n VariantProps<typeof textareaVariants> & {\n /** Solid's actual textarea element, rather than its containing component or form. */\n ref?: Ref<HTMLTextAreaElement>\n }\n\n/**\n * Textarea.\n *\n * Shares the Input's border, focus and invalid treatment exactly, the two are\n * the same control at different aspect ratios, and a form that mixes them must\n * not show a seam between them.\n *\n * `field-sizing: content` lets the element grow with its content where the\n * engine supports it, which is the behaviour a chat composer wants; `rows`\n * remains the fallback so an unsupported engine still gets a usable height.\n * `variant=\"composer\"` removes the standalone field surface when nested in a\n * composer shell. `variant=\"code\"` keeps the field surface and sets the\n * monospace face, for commands, snippets and other literal text. `size=\"comfortable\"` caps growth at the shared 12rem rung, and\n * the finite `resize` variants keep browser resize behavior explicit.\n */\nexport function Textarea(props: TextareaProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'variant',\n 'size',\n 'resize',\n 'ref',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage'\n )\n const field = useFormFieldControl('control', local)\n\n return (\n <textarea\n data-slot=\"textarea\"\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n ref={local.ref}\n class={cn(\n textareaVariants({ variant: local.variant, size: local.size, resize: local.resize }),\n local.class\n )}\n {...rest}\n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@@
|
|
|
1
|
+
import { createComponent, insert, memo, mergeProps, spread, template } from "@solidjs/web";
|
|
2
|
+
import { Toast, ToastClose, ToastDescription, ToastRegion, ToastTitle, createToaster } from "@ui-sdk/solid/toast";
|
|
3
|
+
import { X as X$1 } from "@lucide/solid";
|
|
4
|
+
import { Show, createEffect, createSignal, omit } from "solid-js";
|
|
1
5
|
import { cn } from "../../../lib/utils.js";
|
|
2
6
|
import { fastIcon } from "../../../lib/fast-icon.js";
|
|
3
7
|
import { forwardRef } from "../../../lib/refs.js";
|
|
4
|
-
import { createComponent, insert, memo, mergeProps, spread, template } from "@solidjs/web";
|
|
5
|
-
import { X } from "@lucide/solid";
|
|
6
|
-
import { Show, createEffect, createSignal, omit } from "solid-js";
|
|
7
|
-
import { Toast, ToastClose, ToastDescription, ToastRegion, ToastTitle, createToaster } from "@ui-sdk/solid/toast";
|
|
8
8
|
// src/components/ui/toast/toast.tsx
|
|
9
9
|
var _tmpl$ = /* @__PURE__ */ template(`<span aria-hidden=true class="mt-1.5 size-1.5 shrink-0 rounded-full"style=background-color:var(--toast-tone)>`);
|
|
10
10
|
var _tmpl$2 = /* @__PURE__ */ template(`<div class="flex min-w-0 flex-1 flex-col gap-0.5"><!><!><!>`);
|
|
11
11
|
var _tmpl$3 = /* @__PURE__ */ template(`<li>`);
|
|
12
12
|
var _tmpl$4 = /* @__PURE__ */ template(`<div class="mt-1.5 flex items-center gap-2">`);
|
|
13
|
-
var X
|
|
13
|
+
var X = fastIcon(X$1);
|
|
14
14
|
/**
|
|
15
15
|
* The tone dot's colour. A custom property rather than five colour utilities
|
|
16
16
|
* because the value is applied inline (the tone is data, not markup) and a
|
|
@@ -57,7 +57,7 @@ function toastFields(options) {
|
|
|
57
57
|
title: options.title,
|
|
58
58
|
description: options.description,
|
|
59
59
|
type: toastTypes[tone],
|
|
60
|
-
duration: options.persistent ?
|
|
60
|
+
duration: options.persistent ? 1e400 : options.duration,
|
|
61
61
|
/**
|
|
62
62
|
* A user-initiated outcome is announced; a background one waits its turn.
|
|
63
63
|
* A failure the user caused is worth interrupting for; a sync finishing
|
|
@@ -126,7 +126,7 @@ function ToastCard(props) {
|
|
|
126
126
|
"aria-label": "Dismiss notification",
|
|
127
127
|
class: "text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle",
|
|
128
128
|
get children() {
|
|
129
|
-
return createComponent(X
|
|
129
|
+
return createComponent(X, { class: "size-3.5" });
|
|
130
130
|
}
|
|
131
131
|
})
|
|
132
132
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","names":["<UiToast\n // Kobalte marked a shown toast `data-opened` and a leaving one\n // `data-closed`; the animation classes below read those, so the card\n // carries them from ui-sdk's `leaving` state.\n render={(cardProps, state) => (\n <li\n {...cardProps}\n data-opened={state.leaving ? undefined : ''}\n data-closed={state.leaving ? '' : undefined}\n />\n )}\n class={cn(\n 'pointer-events-auto flex w-full items-start gap-3 rounded-xl border border-border bg-popover p-3 shadow-lg',\n 'data-[opened]:animate-in data-[opened]:slide-in-from-right-full data-[opened]:fade-in-0',\n 'data-[closed]:animate-out data-[closed]:slide-out-to-right-full data-[closed]:fade-out-0',\n // ui-sdk marks a toast being dragged `data-swiping` and writes the\n // drag to `--toast-swipe-x` and `--toast-swipe-y` (Kobalte:\n // `data-swipe=\"move\"`, `--kb-toast-swipe-move-x`). A released swipe\n // that does not dismiss drops the attribute and the card eases back.\n 'transition-transform data-swiping:translate-x-(--toast-swipe-x) data-swiping:translate-y-(--toast-swipe-y) data-swiping:transition-none',\n 'data-[swipe-direction=down]:slide-out-to-bottom-full data-[swipe-direction=up]:slide-out-to-top-full'\n )}\n style={{ '--toast-tone': toastTones[data().tone] }}\n >\n <span\n aria-hidden=\"true\"\n class=\"mt-1.5 size-1.5 shrink-0 rounded-full\"\n style={{ 'background-color': 'var(--toast-tone)' }}\n />\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <UiToastTitle class=\"text-sm font-medium\" />\n <Show when={props.toast.description}>\n <UiToastDescription class=\"text-sm text-muted-foreground\" />\n </Show>\n <Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>\n </div>\n <UiToastClose\n aria-label=\"Dismiss notification\"\n class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <X class=\"size-3.5\" />\n </UiToastClose>\n </UiToast>","render={(cardProps, state) => (\n <li\n {...cardProps}\n data-opened={state.leaving ? undefined : ''}\n data-closed={state.leaving ? '' : undefined}\n />\n )}","<span\n aria-hidden=\"true\"\n class=\"mt-1.5 size-1.5 shrink-0 rounded-full\"\n style={{ 'background-color': 'var(--toast-tone)' }}\n />","<UiToastTitle class=\"text-sm font-medium\" />","class=\"text-sm font-medium\"","<div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <UiToastTitle class=\"text-sm font-medium\" />\n <Show when={props.toast.description}>\n <UiToastDescription class=\"text-sm text-muted-foreground\" />\n </Show>\n <Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>\n </div>","<UiToastDescription class=\"text-sm text-muted-foreground\" />","class=\"text-sm text-muted-foreground\"","<Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>","<UiToastClose\n aria-label=\"Dismiss notification\"\n class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <X class=\"size-3.5\" />\n </UiToastClose>","class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"","<X class=\"size-3.5\" />","class=\"size-3.5\"","<UiToastRegion\n toaster={toasterFor(props.region)}\n side={toasterPlacement[position()].side}\n align={toasterPlacement[position()].align}\n maxVisible={3}\n /**\n * The toast region is a top layer: opening a dialog must not hide an\n * in-flight notification, and clicking a toast must not dismiss the\n * dialog behind it.\n */\n class={cn(\n 'pointer-events-none fixed z-(--z-toast) flex max-h-screen w-full flex-col gap-2 p-4 sm:max-w-sm',\n toasterPosition[position()],\n props.class\n )}\n {...rest}\n ref={(element: HTMLElement) => {\n setRegion(element)\n forwardRef(() => props.ref, element)\n }}\n >\n {(item) => <ToastCard toast={item} />}\n </UiToastRegion>","maxVisible={3}","ref={(element: HTMLElement) => {\n setRegion(element)\n forwardRef(() => props.ref, element)\n }}","<ToastCard toast={item} />","toast={item}","X","LucideX"],"sources":["../../../../src/components/ui/toast/toast.tsx"],"sourcesContent":["import {\n createToaster,\n Toast as UiToast,\n ToastClose as UiToastClose,\n ToastDescription as UiToastDescription,\n ToastRegion as UiToastRegion,\n ToastTitle as UiToastTitle,\n type ToastData,\n type ToastRegionProps as UiToastRegionProps,\n type ToastType,\n} from '@ui-sdk/solid/toast'\nimport { X as LucideX } from '@lucide/solid'\nimport type { JSX } from '@solidjs/web'\nimport { createEffect, createSignal, Show, omit } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { fastIcon } from '#lib/fast-icon'\nimport { forwardRef } from '#lib/refs'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst X = fastIcon(LucideX)\n\n/**\n * Toast.\n *\n * A short, self-dismissing message about something that already happened.\n *\n * The rules that make toasts helpful rather than hostile are built into this\n * API rather than left to callers:\n *\n * - A toast never carries the only route to an action. Anything important\n * enough to need doing belongs in the interface, not in a message that\n * disappears. `action` exists, but it is a convenience, not a flow.\n * - Errors from user-initiated work get `priority=\"high\"` so a screen reader\n * interrupts to announce them; background progress uses the default low\n * priority so it is not read over whatever the user is doing.\n * - A toast with a way to undo is preferred to a confirmation dialog for a\n * reversible action. Undo after the fact costs the user nothing; a modal\n * before it costs everyone a click.\n *\n * `Toaster` is mounted once, near the root of the app.\n *\n * ui-sdk's toast runs the queue, the timers (paused while the pointer or focus\n * is in the stack), the announcements (through shared live regions, so the\n * visible region is not itself live), swipe-to-dismiss, F6 to reach the\n * newest toast, and the top layer, so a toast stays above an open dialog.\n */\n\ntype ToastTone = 'default' | 'success' | 'warning' | 'destructive' | 'info'\n\n/**\n * The tone dot's colour. A custom property rather than five colour utilities\n * because the value is applied inline (the tone is data, not markup) and a\n * Tailwind colour class cannot be built from a runtime value without becoming\n * invisible to the linter.\n */\nconst toastTones: Record<ToastTone, string> = {\n default: 'var(--foreground)',\n success: 'var(--success)',\n warning: 'var(--warning)',\n destructive: 'var(--destructive)',\n info: 'var(--info)',\n}\n\nexport type ToastOptions = {\n title: string\n description?: string\n tone?: ToastTone\n /**\n * Renders a control inside the toast, usually an Undo: `action: () => <Button…>`.\n * A function, so the control is built inside the toast that shows it (under\n * its owner, and again for each toast) rather than once where `show` is called.\n */\n action?: () => JSX.Element\n /** Keep the toast until it is dismissed. Use for a failure the user must see. */\n persistent?: boolean\n /** Milliseconds before auto-dismiss. Overrides the region's setting. */\n duration?: number\n /** Which Toaster region to render into. */\n region?: string\n}\n\n/** The kit's tone as ui-sdk's toast type, which the card carries as `data-type`. */\nconst toastTypes: Record<ToastTone, ToastType> = {\n default: 'default',\n success: 'success',\n warning: 'warning',\n destructive: 'error',\n info: 'info',\n}\n\n/** What the kit keeps on each ui-sdk toast as its `data`. */\ntype ToastCardData = { tone: ToastTone; action?: () => JSX.Element }\n\n/**\n * One queue per named region, created on first use, so a toast sent to a\n * region shows only there. The unnamed region is `undefined`.\n */\nconst toasters = new Map<string | undefined, ReturnType<typeof createToaster<JSX.Element>>>()\n\nfunction toasterFor(region: string | undefined) {\n let queue = toasters.get(region)\n if (!queue) {\n // Kobalte's region default, which every caller was tuned against.\n queue = createToaster<JSX.Element>({ duration: 5000 })\n toasters.set(region, queue)\n }\n return queue\n}\n\n/**\n * Toast ids stay numbers, as they were: ui-sdk's are strings, so each toast\n * takes the next number as its ui-sdk id.\n */\nlet nextId = 0\n\n/** The ui-sdk options a kit toast becomes; also an update of a shown one. */\nfunction toastFields(options: ToastOptions) {\n const tone = options.tone ?? 'default'\n return {\n title: options.title,\n description: options.description,\n type: toastTypes[tone],\n duration: options.persistent ? Infinity : options.duration,\n /**\n * A user-initiated outcome is announced; a background one waits its turn.\n * A failure the user caused is worth interrupting for; a sync finishing\n * quietly is not.\n */\n priority: tone === 'destructive' ? ('assertive' as const) : ('polite' as const),\n data: { tone, action: options.action } satisfies ToastCardData,\n }\n}\n\nfunction ToastCard(props: { toast: ToastData<JSX.Element> }) {\n const data = () => (props.toast.data as ToastCardData | undefined) ?? { tone: 'default' as const }\n\n return (\n <UiToast\n // Kobalte marked a shown toast `data-opened` and a leaving one\n // `data-closed`; the animation classes below read those, so the card\n // carries them from ui-sdk's `leaving` state.\n render={(cardProps, state) => (\n <li\n {...cardProps}\n data-opened={state.leaving ? undefined : ''}\n data-closed={state.leaving ? '' : undefined}\n />\n )}\n class={cn(\n 'pointer-events-auto flex w-full items-start gap-3 rounded-xl border border-border bg-popover p-3 shadow-lg',\n 'data-[opened]:animate-in data-[opened]:slide-in-from-right-full data-[opened]:fade-in-0',\n 'data-[closed]:animate-out data-[closed]:slide-out-to-right-full data-[closed]:fade-out-0',\n // ui-sdk marks a toast being dragged `data-swiping` and writes the\n // drag to `--toast-swipe-x` and `--toast-swipe-y` (Kobalte:\n // `data-swipe=\"move\"`, `--kb-toast-swipe-move-x`). A released swipe\n // that does not dismiss drops the attribute and the card eases back.\n 'transition-transform data-swiping:translate-x-(--toast-swipe-x) data-swiping:translate-y-(--toast-swipe-y) data-swiping:transition-none',\n 'data-[swipe-direction=down]:slide-out-to-bottom-full data-[swipe-direction=up]:slide-out-to-top-full'\n )}\n style={{ '--toast-tone': toastTones[data().tone] }}\n >\n <span\n aria-hidden=\"true\"\n class=\"mt-1.5 size-1.5 shrink-0 rounded-full\"\n style={{ 'background-color': 'var(--toast-tone)' }}\n />\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <UiToastTitle class=\"text-sm font-medium\" />\n <Show when={props.toast.description}>\n <UiToastDescription class=\"text-sm text-muted-foreground\" />\n </Show>\n <Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>\n </div>\n <UiToastClose\n aria-label=\"Dismiss notification\"\n class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <X class=\"size-3.5\" />\n </UiToastClose>\n </UiToast>\n )\n}\n\n/**\n * The error contract, resolved: destructive tone, persistent unless the caller\n * says otherwise. Exported because this decision is the part a caller depends\n * on and the part testable without a browser — the card render itself needs one.\n */\nexport function errorToastOptions(\n title: string,\n options?: Omit<ToastOptions, 'title' | 'tone'>\n): ToastOptions {\n return { ...options, title, tone: 'destructive', persistent: options?.persistent ?? true }\n}\n\n/**\n * The toast API. `show` is the general form; the tone helpers are shorthand for\n * the four cases that come up constantly.\n */\nexport const toast = {\n show(options: ToastOptions): number {\n const id = nextId++\n toasterFor(options.region)({ ...toastFields(options), id: String(id) })\n return id\n },\n success(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show({ ...options, title, tone: 'success' })\n },\n /**\n * A failure the user caused. Persistent by default — an error that times out\n * while its reader is mid-sentence has not been reported — but `persistent`\n * stays caller-owned: a failure inside a retry loop (a failed \"check again\",\n * a background poll) passes `persistent: false` and a `duration`, because a\n * dismiss-only toast there is one more thing to close by hand.\n */\n error(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show(errorToastOptions(title, options))\n },\n warning(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show({ ...options, title, tone: 'warning' })\n },\n info(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show({ ...options, title, tone: 'info' })\n },\n /**\n * A toast that resolves with a promise: pending, then success or failure.\n * The right shape for an operation with a visible duration, because the user\n * gets one message instead of three. The pending toast stays until the\n * promise settles, and the same toast then turns into the outcome, which\n * keeps its place in the stack; a failure stays until it is dismissed.\n */\n promise<T>(\n promise: Promise<T> | (() => Promise<T>),\n messages: {\n pending: string\n success: string | ((data: T) => string)\n error: string | ((error: unknown) => string)\n }\n ): Promise<T> {\n const resolved = typeof promise === 'function' ? promise() : promise\n const id = toast.show({ title: messages.pending, persistent: true })\n const queue = toasterFor(undefined)\n resolved.then(\n (data) =>\n queue.update(\n String(id),\n toastFields({\n title:\n typeof messages.success === 'function' ? messages.success(data) : messages.success,\n tone: 'success',\n })\n ),\n (error: unknown) =>\n queue.update(\n String(id),\n toastFields({\n title: typeof messages.error === 'function' ? messages.error(error) : messages.error,\n tone: 'destructive',\n persistent: true,\n })\n )\n )\n return resolved\n },\n /** Dismisses one toast, wherever it is shown. */\n dismiss(id: number): void {\n for (const queue of toasters.values()) queue.dismiss(String(id))\n },\n /** Dismisses every toast in every region. */\n clear(): void {\n for (const queue of toasters.values()) queue.dismiss()\n },\n}\n\n/**\n * The imperative half under its Kobalte-era name, for callers that imported\n * `toaster` to dismiss or clear. Prefer `toast`.\n */\nexport const toaster = { dismiss: toast.dismiss, clear: toast.clear }\n\nexport type ToasterProps = Omit<\n UiToastRegionProps,\n 'children' | 'toaster' | 'side' | 'align' | 'maxVisible' | 'class'\n> & {\n /** Where the stack sits. Defaults to the bottom-right, clear of the shell. */\n position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n region?: string\n class?: string\n}\n\n/**\n * `class` lands on the region too: the props describe the region, and the\n * region is the element a caller lays out (an inset clear of a status bar, a\n * narrower stack). The list inside it is an implementation detail.\n *\n * The corner is set on the region, not the list. The region is the `fixed`\n * element: an inset on the list inside it positions nothing, and the region falls\n * back to wherever it happens to sit in the document flow.\n */\nconst toasterPosition = {\n 'top-left': 'top-0 left-0',\n 'top-right': 'top-0 right-0',\n 'bottom-left': 'bottom-0 left-0',\n 'bottom-right': 'bottom-0 right-0',\n}\n\nconst toasterAlignment = {\n 'top-left': 'items-start',\n 'top-right': 'items-end',\n 'bottom-left': 'items-start',\n 'bottom-right': 'items-end',\n}\n\n/**\n * The corner as ui-sdk's side and alignment, which decide the swipe\n * directions: toward the edge the stack sits on, and toward its corner.\n * Physical, like the classes: `left` is the start only in a left-to-right page.\n */\nconst toasterPlacement = {\n 'top-left': { side: 'top', align: 'start' },\n 'top-right': { side: 'top', align: 'end' },\n 'bottom-left': { side: 'bottom', align: 'start' },\n 'bottom-right': { side: 'bottom', align: 'end' },\n} as const\n\n/** Mount once, near the root. Renders the stack and owns its timing defaults. */\nexport function Toaster(props: ToasterProps) {\n const rest = omit(props, 'position', 'region', 'class', 'ref')\n const position = () => props.position ?? 'bottom-right'\n const [region, setRegion] = createSignal<HTMLElement>()\n\n // ui-sdk renders the list inside the region itself and takes no props for\n // it, so the list's classes (the stack's alignment in its corner) are\n // written onto it once it is in the page.\n createEffect(\n () => ({ element: region(), position: position() }),\n ({ element, position: corner }) => {\n const list = element?.querySelector('[data-slot=\"toast-list\"]')\n if (list) list.setAttribute('class', cn('flex flex-col gap-2', toasterAlignment[corner]))\n }\n )\n\n return (\n <UiToastRegion\n toaster={toasterFor(props.region)}\n side={toasterPlacement[position()].side}\n align={toasterPlacement[position()].align}\n maxVisible={3}\n /**\n * The toast region is a top layer: opening a dialog must not hide an\n * in-flight notification, and clicking a toast must not dismiss the\n * dialog behind it.\n */\n class={cn(\n 'pointer-events-none fixed z-(--z-toast) flex max-h-screen w-full flex-col gap-2 p-4 sm:max-w-sm',\n toasterPosition[position()],\n props.class\n )}\n {...rest}\n ref={(element: HTMLElement) => {\n setRegion(element)\n forwardRef(() => props.ref, element)\n }}\n >\n {(item) => <ToastCard toast={item} />}\n </UiToastRegion>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,IAAMkB,MAAI,SAASC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OAAO;CAAM;CACzC,eAAe;EAAE,MAAM;EAAU,OAAO;CAAQ;CAChD,gBAAgB;EAAE,MAAM;EAAU,OAAO;CAAM;AACjD;;AAGA,SAAgB,QAAQ,OAAqB;CAC3C,MAAM,OAAO,KAAK,OAAO,YAAY,UAAU,SAAS,KAAK;CAC7D,MAAM,iBAAiB,MAAM,YAAY;CACzC,MAAM,CAAC,QAAQ,aAAa,aAA0B;CAKtD,oBACS;EAAE,SAAS,OAAO;EAAG,UAAU,SAAS;CAAE,KAChD,EAAE,SAAS,UAAU,aAAa;EACjC,MAAM,OAAO,SAAS,cAAc,4BAA0B;EAC9D,IAAI,MAAM,KAAK,aAAa,SAAS,GAAG,uBAAuB,iBAAiB,OAAO,CAAC;CAC1F,CACF;CAEA,OACEC,gBAAAA,aAAAA,WAAAA;EACE,IAAA,UAAA;GAAS,OAAA,WAAW,MAAM,MAAM;EAAC;EACjC,IAAA,OAAA;GAAM,OAAA,iBAAiB,SAAS,EAAE,CAAC;EAAI;EACvC,IAAA,QAAA;GAAO,OAAA,iBAAiB,SAAS,EAAE,CAAC;EAAK;EACzCC,YAAY;;;;;;EAMZ,IAAA,UAAA;GAAO,OAAA,GACL,mGACA,gBAAgB,SAAS,IACzB,MAAM,KACR;EAAC;CAQY,GAPT,MAfN;EAgBEC,MAAM,YAAyB;GAC7B,UAAU,OAAO;GACjB,iBAAiB,MAAM,KAAK,OAAO;EACrC;EAnBFF,WAqBI,SAASG,gBAAAA,WAAAA,EAAWC,OAAO,KAAO,CAAA;CACvB,CAAA,CAAA;AAEnB"}
|
|
1
|
+
{"version":3,"file":"toast.js","names":["<UiToast\n // Kobalte marked a shown toast `data-opened` and a leaving one\n // `data-closed`; the animation classes below read those, so the card\n // carries them from ui-sdk's `leaving` state.\n render={(cardProps, state) => (\n <li\n {...cardProps}\n data-opened={state.leaving ? undefined : ''}\n data-closed={state.leaving ? '' : undefined}\n />\n )}\n class={cn(\n 'pointer-events-auto flex w-full items-start gap-3 rounded-xl border border-border bg-popover p-3 shadow-lg',\n 'data-[opened]:animate-in data-[opened]:slide-in-from-right-full data-[opened]:fade-in-0',\n 'data-[closed]:animate-out data-[closed]:slide-out-to-right-full data-[closed]:fade-out-0',\n // ui-sdk marks a toast being dragged `data-swiping` and writes the\n // drag to `--toast-swipe-x` and `--toast-swipe-y` (Kobalte:\n // `data-swipe=\"move\"`, `--kb-toast-swipe-move-x`). A released swipe\n // that does not dismiss drops the attribute and the card eases back.\n 'transition-transform data-swiping:translate-x-(--toast-swipe-x) data-swiping:translate-y-(--toast-swipe-y) data-swiping:transition-none',\n 'data-[swipe-direction=down]:slide-out-to-bottom-full data-[swipe-direction=up]:slide-out-to-top-full'\n )}\n style={{ '--toast-tone': toastTones[data().tone] }}\n >\n <span\n aria-hidden=\"true\"\n class=\"mt-1.5 size-1.5 shrink-0 rounded-full\"\n style={{ 'background-color': 'var(--toast-tone)' }}\n />\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <UiToastTitle class=\"text-sm font-medium\" />\n <Show when={props.toast.description}>\n <UiToastDescription class=\"text-sm text-muted-foreground\" />\n </Show>\n <Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>\n </div>\n <UiToastClose\n aria-label=\"Dismiss notification\"\n class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <X class=\"size-3.5\" />\n </UiToastClose>\n </UiToast>","render={(cardProps, state) => (\n <li\n {...cardProps}\n data-opened={state.leaving ? undefined : ''}\n data-closed={state.leaving ? '' : undefined}\n />\n )}","<span\n aria-hidden=\"true\"\n class=\"mt-1.5 size-1.5 shrink-0 rounded-full\"\n style={{ 'background-color': 'var(--toast-tone)' }}\n />","<UiToastTitle class=\"text-sm font-medium\" />","class=\"text-sm font-medium\"","<div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <UiToastTitle class=\"text-sm font-medium\" />\n <Show when={props.toast.description}>\n <UiToastDescription class=\"text-sm text-muted-foreground\" />\n </Show>\n <Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>\n </div>","<UiToastDescription class=\"text-sm text-muted-foreground\" />","class=\"text-sm text-muted-foreground\"","<Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>","<UiToastClose\n aria-label=\"Dismiss notification\"\n class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <X class=\"size-3.5\" />\n </UiToastClose>","class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"","<X class=\"size-3.5\" />","class=\"size-3.5\"","<UiToastRegion\n toaster={toasterFor(props.region)}\n side={toasterPlacement[position()].side}\n align={toasterPlacement[position()].align}\n maxVisible={3}\n /**\n * The toast region is a top layer: opening a dialog must not hide an\n * in-flight notification, and clicking a toast must not dismiss the\n * dialog behind it.\n */\n class={cn(\n 'pointer-events-none fixed z-(--z-toast) flex max-h-screen w-full flex-col gap-2 p-4 sm:max-w-sm',\n toasterPosition[position()],\n props.class\n )}\n {...rest}\n ref={(element: HTMLElement) => {\n setRegion(element)\n forwardRef(() => props.ref, element)\n }}\n >\n {(item) => <ToastCard toast={item} />}\n </UiToastRegion>","maxVisible={3}","ref={(element: HTMLElement) => {\n setRegion(element)\n forwardRef(() => props.ref, element)\n }}","<ToastCard toast={item} />","toast={item}","LucideX","_$spread","_$insert"],"sources":["../../../../src/components/ui/toast/toast.tsx"],"sourcesContent":["import {\n createToaster,\n Toast as UiToast,\n ToastClose as UiToastClose,\n ToastDescription as UiToastDescription,\n ToastRegion as UiToastRegion,\n ToastTitle as UiToastTitle,\n type ToastData,\n type ToastRegionProps as UiToastRegionProps,\n type ToastType,\n} from '@ui-sdk/solid/toast'\nimport { X as LucideX } from '@lucide/solid'\nimport type { JSX } from '@solidjs/web'\nimport { createEffect, createSignal, Show, omit } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { fastIcon } from '#lib/fast-icon'\nimport { forwardRef } from '#lib/refs'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst X = fastIcon(LucideX)\n\n/**\n * Toast.\n *\n * A short, self-dismissing message about something that already happened.\n *\n * The rules that make toasts helpful rather than hostile are built into this\n * API rather than left to callers:\n *\n * - A toast never carries the only route to an action. Anything important\n * enough to need doing belongs in the interface, not in a message that\n * disappears. `action` exists, but it is a convenience, not a flow.\n * - Errors from user-initiated work get `priority=\"high\"` so a screen reader\n * interrupts to announce them; background progress uses the default low\n * priority so it is not read over whatever the user is doing.\n * - A toast with a way to undo is preferred to a confirmation dialog for a\n * reversible action. Undo after the fact costs the user nothing; a modal\n * before it costs everyone a click.\n *\n * `Toaster` is mounted once, near the root of the app.\n *\n * ui-sdk's toast runs the queue, the timers (paused while the pointer or focus\n * is in the stack), the announcements (through shared live regions, so the\n * visible region is not itself live), swipe-to-dismiss, F6 to reach the\n * newest toast, and the top layer, so a toast stays above an open dialog.\n */\n\ntype ToastTone = 'default' | 'success' | 'warning' | 'destructive' | 'info'\n\n/**\n * The tone dot's colour. A custom property rather than five colour utilities\n * because the value is applied inline (the tone is data, not markup) and a\n * Tailwind colour class cannot be built from a runtime value without becoming\n * invisible to the linter.\n */\nconst toastTones: Record<ToastTone, string> = {\n default: 'var(--foreground)',\n success: 'var(--success)',\n warning: 'var(--warning)',\n destructive: 'var(--destructive)',\n info: 'var(--info)',\n}\n\nexport type ToastOptions = {\n title: string\n description?: string\n tone?: ToastTone\n /**\n * Renders a control inside the toast, usually an Undo: `action: () => <Button…>`.\n * A function, so the control is built inside the toast that shows it (under\n * its owner, and again for each toast) rather than once where `show` is called.\n */\n action?: () => JSX.Element\n /** Keep the toast until it is dismissed. Use for a failure the user must see. */\n persistent?: boolean\n /** Milliseconds before auto-dismiss. Overrides the region's setting. */\n duration?: number\n /** Which Toaster region to render into. */\n region?: string\n}\n\n/** The kit's tone as ui-sdk's toast type, which the card carries as `data-type`. */\nconst toastTypes: Record<ToastTone, ToastType> = {\n default: 'default',\n success: 'success',\n warning: 'warning',\n destructive: 'error',\n info: 'info',\n}\n\n/** What the kit keeps on each ui-sdk toast as its `data`. */\ntype ToastCardData = { tone: ToastTone; action?: () => JSX.Element }\n\n/**\n * One queue per named region, created on first use, so a toast sent to a\n * region shows only there. The unnamed region is `undefined`.\n */\nconst toasters = new Map<string | undefined, ReturnType<typeof createToaster<JSX.Element>>>()\n\nfunction toasterFor(region: string | undefined) {\n let queue = toasters.get(region)\n if (!queue) {\n // Kobalte's region default, which every caller was tuned against.\n queue = createToaster<JSX.Element>({ duration: 5000 })\n toasters.set(region, queue)\n }\n return queue\n}\n\n/**\n * Toast ids stay numbers, as they were: ui-sdk's are strings, so each toast\n * takes the next number as its ui-sdk id.\n */\nlet nextId = 0\n\n/** The ui-sdk options a kit toast becomes; also an update of a shown one. */\nfunction toastFields(options: ToastOptions) {\n const tone = options.tone ?? 'default'\n return {\n title: options.title,\n description: options.description,\n type: toastTypes[tone],\n duration: options.persistent ? Infinity : options.duration,\n /**\n * A user-initiated outcome is announced; a background one waits its turn.\n * A failure the user caused is worth interrupting for; a sync finishing\n * quietly is not.\n */\n priority: tone === 'destructive' ? ('assertive' as const) : ('polite' as const),\n data: { tone, action: options.action } satisfies ToastCardData,\n }\n}\n\nfunction ToastCard(props: { toast: ToastData<JSX.Element> }) {\n const data = () => (props.toast.data as ToastCardData | undefined) ?? { tone: 'default' as const }\n\n return (\n <UiToast\n // Kobalte marked a shown toast `data-opened` and a leaving one\n // `data-closed`; the animation classes below read those, so the card\n // carries them from ui-sdk's `leaving` state.\n render={(cardProps, state) => (\n <li\n {...cardProps}\n data-opened={state.leaving ? undefined : ''}\n data-closed={state.leaving ? '' : undefined}\n />\n )}\n class={cn(\n 'pointer-events-auto flex w-full items-start gap-3 rounded-xl border border-border bg-popover p-3 shadow-lg',\n 'data-[opened]:animate-in data-[opened]:slide-in-from-right-full data-[opened]:fade-in-0',\n 'data-[closed]:animate-out data-[closed]:slide-out-to-right-full data-[closed]:fade-out-0',\n // ui-sdk marks a toast being dragged `data-swiping` and writes the\n // drag to `--toast-swipe-x` and `--toast-swipe-y` (Kobalte:\n // `data-swipe=\"move\"`, `--kb-toast-swipe-move-x`). A released swipe\n // that does not dismiss drops the attribute and the card eases back.\n 'transition-transform data-swiping:translate-x-(--toast-swipe-x) data-swiping:translate-y-(--toast-swipe-y) data-swiping:transition-none',\n 'data-[swipe-direction=down]:slide-out-to-bottom-full data-[swipe-direction=up]:slide-out-to-top-full'\n )}\n style={{ '--toast-tone': toastTones[data().tone] }}\n >\n <span\n aria-hidden=\"true\"\n class=\"mt-1.5 size-1.5 shrink-0 rounded-full\"\n style={{ 'background-color': 'var(--toast-tone)' }}\n />\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <UiToastTitle class=\"text-sm font-medium\" />\n <Show when={props.toast.description}>\n <UiToastDescription class=\"text-sm text-muted-foreground\" />\n </Show>\n <Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>\n </div>\n <UiToastClose\n aria-label=\"Dismiss notification\"\n class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <X class=\"size-3.5\" />\n </UiToastClose>\n </UiToast>\n )\n}\n\n/**\n * The error contract, resolved: destructive tone, persistent unless the caller\n * says otherwise. Exported because this decision is the part a caller depends\n * on and the part testable without a browser — the card render itself needs one.\n */\nexport function errorToastOptions(\n title: string,\n options?: Omit<ToastOptions, 'title' | 'tone'>\n): ToastOptions {\n return { ...options, title, tone: 'destructive', persistent: options?.persistent ?? true }\n}\n\n/**\n * The toast API. `show` is the general form; the tone helpers are shorthand for\n * the four cases that come up constantly.\n */\nexport const toast = {\n show(options: ToastOptions): number {\n const id = nextId++\n toasterFor(options.region)({ ...toastFields(options), id: String(id) })\n return id\n },\n success(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show({ ...options, title, tone: 'success' })\n },\n /**\n * A failure the user caused. Persistent by default — an error that times out\n * while its reader is mid-sentence has not been reported — but `persistent`\n * stays caller-owned: a failure inside a retry loop (a failed \"check again\",\n * a background poll) passes `persistent: false` and a `duration`, because a\n * dismiss-only toast there is one more thing to close by hand.\n */\n error(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show(errorToastOptions(title, options))\n },\n warning(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show({ ...options, title, tone: 'warning' })\n },\n info(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show({ ...options, title, tone: 'info' })\n },\n /**\n * A toast that resolves with a promise: pending, then success or failure.\n * The right shape for an operation with a visible duration, because the user\n * gets one message instead of three. The pending toast stays until the\n * promise settles, and the same toast then turns into the outcome, which\n * keeps its place in the stack; a failure stays until it is dismissed.\n */\n promise<T>(\n promise: Promise<T> | (() => Promise<T>),\n messages: {\n pending: string\n success: string | ((data: T) => string)\n error: string | ((error: unknown) => string)\n }\n ): Promise<T> {\n const resolved = typeof promise === 'function' ? promise() : promise\n const id = toast.show({ title: messages.pending, persistent: true })\n const queue = toasterFor(undefined)\n resolved.then(\n (data) =>\n queue.update(\n String(id),\n toastFields({\n title:\n typeof messages.success === 'function' ? messages.success(data) : messages.success,\n tone: 'success',\n })\n ),\n (error: unknown) =>\n queue.update(\n String(id),\n toastFields({\n title: typeof messages.error === 'function' ? messages.error(error) : messages.error,\n tone: 'destructive',\n persistent: true,\n })\n )\n )\n return resolved\n },\n /** Dismisses one toast, wherever it is shown. */\n dismiss(id: number): void {\n for (const queue of toasters.values()) queue.dismiss(String(id))\n },\n /** Dismisses every toast in every region. */\n clear(): void {\n for (const queue of toasters.values()) queue.dismiss()\n },\n}\n\n/**\n * The imperative half under its Kobalte-era name, for callers that imported\n * `toaster` to dismiss or clear. Prefer `toast`.\n */\nexport const toaster = { dismiss: toast.dismiss, clear: toast.clear }\n\nexport type ToasterProps = Omit<\n UiToastRegionProps,\n 'children' | 'toaster' | 'side' | 'align' | 'maxVisible' | 'class'\n> & {\n /** Where the stack sits. Defaults to the bottom-right, clear of the shell. */\n position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n region?: string\n class?: string\n}\n\n/**\n * `class` lands on the region too: the props describe the region, and the\n * region is the element a caller lays out (an inset clear of a status bar, a\n * narrower stack). The list inside it is an implementation detail.\n *\n * The corner is set on the region, not the list. The region is the `fixed`\n * element: an inset on the list inside it positions nothing, and the region falls\n * back to wherever it happens to sit in the document flow.\n */\nconst toasterPosition = {\n 'top-left': 'top-0 left-0',\n 'top-right': 'top-0 right-0',\n 'bottom-left': 'bottom-0 left-0',\n 'bottom-right': 'bottom-0 right-0',\n}\n\nconst toasterAlignment = {\n 'top-left': 'items-start',\n 'top-right': 'items-end',\n 'bottom-left': 'items-start',\n 'bottom-right': 'items-end',\n}\n\n/**\n * The corner as ui-sdk's side and alignment, which decide the swipe\n * directions: toward the edge the stack sits on, and toward its corner.\n * Physical, like the classes: `left` is the start only in a left-to-right page.\n */\nconst toasterPlacement = {\n 'top-left': { side: 'top', align: 'start' },\n 'top-right': { side: 'top', align: 'end' },\n 'bottom-left': { side: 'bottom', align: 'start' },\n 'bottom-right': { side: 'bottom', align: 'end' },\n} as const\n\n/** Mount once, near the root. Renders the stack and owns its timing defaults. */\nexport function Toaster(props: ToasterProps) {\n const rest = omit(props, 'position', 'region', 'class', 'ref')\n const position = () => props.position ?? 'bottom-right'\n const [region, setRegion] = createSignal<HTMLElement>()\n\n // ui-sdk renders the list inside the region itself and takes no props for\n // it, so the list's classes (the stack's alignment in its corner) are\n // written onto it once it is in the page.\n createEffect(\n () => ({ element: region(), position: position() }),\n ({ element, position: corner }) => {\n const list = element?.querySelector('[data-slot=\"toast-list\"]')\n if (list) list.setAttribute('class', cn('flex flex-col gap-2', toasterAlignment[corner]))\n }\n )\n\n return (\n <UiToastRegion\n toaster={toasterFor(props.region)}\n side={toasterPlacement[position()].side}\n align={toasterPlacement[position()].align}\n maxVisible={3}\n /**\n * The toast region is a top layer: opening a dialog must not hide an\n * in-flight notification, and clicking a toast must not dismiss the\n * dialog behind it.\n */\n class={cn(\n 'pointer-events-none fixed z-(--z-toast) flex max-h-screen w-full flex-col gap-2 p-4 sm:max-w-sm',\n toasterPosition[position()],\n props.class\n )}\n {...rest}\n ref={(element: HTMLElement) => {\n setRegion(element)\n forwardRef(() => props.ref, element)\n }}\n >\n {(item) => <ToastCard toast={item} />}\n </UiToastRegion>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,IAAM,IAAI,SAASkB,GAAO;;;;;;;AAoC1B,IAAM,aAAwC;CAC5C,SAAS;CACT,SAAS;CACT,SAAS;CACT,aAAa;CACb,MAAM;AACR;;AAqBA,IAAM,aAA2C;CAC/C,SAAS;CACT,SAAS;CACT,SAAS;CACT,aAAa;CACb,MAAM;AACR;;;;;AASA,IAAM,2BAAW,IAAI,IAAuE;AAE5F,SAAS,WAAW,QAA4B;CAC9C,IAAI,QAAQ,SAAS,IAAI,MAAM;CAC/B,IAAI,CAAC,OAAO;EAEV,QAAQ,cAA2B,EAAE,UAAU,IAAK,CAAC;EACrD,SAAS,IAAI,QAAQ,KAAK;CAC5B;CACA,OAAO;AACT;;;;;AAMA,IAAI,SAAS;;AAGb,SAAS,YAAY,SAAuB;CAC1C,MAAM,OAAO,QAAQ,QAAQ;CAC7B,OAAO;EACL,OAAO,QAAQ;EACf,aAAa,QAAQ;EACrB,MAAM,WAAW;EACjB,UAAU,QAAQ,aAAa,QAAW,QAAQ;;;;;;EAMlD,UAAU,SAAS,gBAAiB,cAAyB;EAC7D,M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A;GAAO,OAAA,iBAAiB,SAAS,EAAE,CAAC;EAAK;EACzCC,YAAY;;;;;;EAMZ,IAAA,UAAA;GAAO,OAAA,GACL,mGACA,gBAAgB,SAAS,IACzB,MAAM,KACR;EAAC;CAQY,GAPT,MAfN;EAgBEC,MAAM,YAAyB;GAC7B,UAAU,OAAO;GACjB,iBAAiB,MAAM,KAAK,OAAO;EACrC;EAnBFF,WAqBI,SAASG,gBAAAA,WAAAA,EAAWC,OAAO,KAAO,CAAA;CACvB,CAAA,CAAA;AAEnB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { controlInteractive, controlSize, cva } from "../../../lib/variants.js";
|
|
2
|
-
import { cn } from "../../../lib/utils.js";
|
|
3
1
|
import { createComponent, mergeProps } from "@solidjs/web";
|
|
2
|
+
import { Toggle as Toggle$1 } from "@ui-sdk/solid/toggle";
|
|
4
3
|
import { omit } from "solid-js";
|
|
5
|
-
import {
|
|
4
|
+
import { controlInteractive, controlSize, cva } from "../../../lib/variants.js";
|
|
5
|
+
import { cn } from "../../../lib/utils.js";
|
|
6
6
|
// src/components/ui/toggle/toggle.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Toggle.
|
|
@@ -51,9 +51,9 @@ var toggleVariants = cva(`${controlInteractive} inline-flex items-center justify
|
|
|
51
51
|
size: "md"
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
function Toggle
|
|
54
|
+
function Toggle(props) {
|
|
55
55
|
const rest = omit(props, "variant", "size", "class", "onChange", "onPressedChange");
|
|
56
|
-
return createComponent(Toggle, mergeProps({
|
|
56
|
+
return createComponent(Toggle$1, mergeProps({
|
|
57
57
|
"data-slot": "toggle",
|
|
58
58
|
get "class"() {
|
|
59
59
|
return cn(toggleVariants({
|
|
@@ -67,6 +67,6 @@ function Toggle$1(props) {
|
|
|
67
67
|
}
|
|
68
68
|
}, rest));
|
|
69
69
|
}
|
|
70
|
-
export { Toggle
|
|
70
|
+
export { Toggle, toggleVariants };
|
|
71
71
|
|
|
72
72
|
//# sourceMappingURL=toggle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.js","names":["<SdkToggle\n data-slot=\"toggle\"\n class={cn(\n toggleVariants({ variant: props.variant, size: props.size }),\n props.class as string\n )}\n onPressedChange={(pressed, details) => {\n props.onPressedChange?.(pressed, details)\n props.onChange?.(pressed)\n }}\n {...rest}\n />","onPressedChange={(pressed, details) => {\n props.onPressedChange?.(pressed, details)\n props.onChange?.(pressed)\n }}"
|
|
1
|
+
{"version":3,"file":"toggle.js","names":["<SdkToggle\n data-slot=\"toggle\"\n class={cn(\n toggleVariants({ variant: props.variant, size: props.size }),\n props.class as string\n )}\n onPressedChange={(pressed, details) => {\n props.onPressedChange?.(pressed, details)\n props.onChange?.(pressed)\n }}\n {...rest}\n />","onPressedChange={(pressed, details) => {\n props.onPressedChange?.(pressed, details)\n props.onChange?.(pressed)\n }}"],"sources":["../../../../src/components/ui/toggle/toggle.tsx"],"sourcesContent":["import { Toggle as SdkToggle } from '@ui-sdk/solid/toggle'\nimport type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport { cva, controlInteractive, controlSize, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Toggle.\n *\n * A button that stays pressed. The difference from Button is state, not looks:\n * a Toggle reports `aria-pressed` and holds its pressed appearance until\n * released, which is what makes it right for a formatting control and wrong\n * for a command.\n *\n * ui-sdk's Toggle supplies the pressed state, `aria-pressed` and the keyboard\n * behaviour (and, inside a `ToggleGroup`, the roving focus); the styling\n * adds the one thing a headless primitive cannot know, that a pressed toggle\n * in a toolbar should read as *filled*, not merely outlined. Pressed reads on\n * the accent rung (`primary-subtle`, foreground text, accent glyph): pressed is the\n * control's on state, the same family the checked checkbox and switch own, so\n * it keeps a touch of the user's accent instead of a neutral fill.\n */\nexport const toggleVariants = cva(\n `${controlInteractive} inline-flex items-center justify-center rounded-md font-medium whitespace-nowrap select-none hover:bg-surface-hover hover:text-foreground data-[pressed]:bg-primary-subtle data-[pressed]:text-foreground data-[pressed]:[&_svg]:text-primary disabled:pointer-events-none disabled:opacity-50 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,\n {\n variants: {\n variant: {\n default: 'bg-transparent',\n /** Sits inside a field or toolbar that already has a fill. */\n outline: 'border border-border bg-transparent',\n /** Filled even when unpressed, for a segmented control's idle item. */\n subtle: 'bg-surface-hover',\n },\n size: {\n '2xs': `${controlSize['2xs']} [&_svg]:size-3`,\n xs: `${controlSize.xs} [&_svg]:size-3.5`,\n sm: `${controlSize.sm} [&_svg]:size-3.5`,\n md: `${controlSize.md} [&_svg]:size-4`,\n lg: `${controlSize.lg} [&_svg]:size-4`,\n xl: `${controlSize.xl} [&_svg]:size-5`,\n '2xl': `${controlSize['2xl']} [&_svg]:size-6`,\n 'icon-2xs': 'size-control-2xs p-0 [&_svg]:size-3',\n 'icon-xs': 'size-control-xs p-0 [&_svg]:size-3.5',\n 'icon-sm': 'size-control-sm p-0 [&_svg]:size-3.5',\n 'icon-md': 'size-control-md p-0 [&_svg]:size-4',\n 'icon-lg': 'size-control-lg p-0 [&_svg]:size-4',\n 'icon-xl': 'size-control-xl p-0 [&_svg]:size-5',\n 'icon-2xl': 'size-control-2xl p-0 [&_svg]:size-6',\n },\n },\n defaultVariants: { variant: 'default', size: 'md' },\n }\n)\n\nexport type ToggleProps = Omit<ComponentProps<typeof SdkToggle>, 'onChange'> &\n VariantProps<typeof toggleVariants> & {\n /** Called with the new pressed state, beside ui-sdk's own `onPressedChange`. */\n onChange?: (pressed: boolean) => void\n }\n\n/*\n * `data-[disabled]` mirrors `disabled:` because a toggle inside a group stays\n * focusable when disabled (ui-sdk marks it `aria-disabled` and `data-disabled`\n * so arrow keys still reach it) and so never matches `:disabled`.\n */\nexport function Toggle(props: ToggleProps) {\n const rest = omit(props, 'variant', 'size', 'class', 'onChange', 'onPressedChange')\n\n return (\n <SdkToggle\n data-slot=\"toggle\"\n class={cn(\n toggleVariants({ variant: props.variant, size: props.size }),\n props.class as string\n )}\n onPressedChange={(pressed, details) => {\n props.onPressedChange?.(pressed, details)\n props.onChange?.(pressed)\n }}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,iBAAiB,IAC5B,GAAG,mBAAmB,8YACtB;CACE,UAAU;EACR,SAAS;GACP,SAAS;;GAET,SAAS;;GAET,QAAQ;EACV;EACA,MAAM;GACJ,OAAO,GAAG,YAAY,OAAO;GAC7B,IAAI,GAAG,YAAY,GAAG;GACtB,IAAI,GAAG,YAAY,GAAG;GACtB,IAAI,GAAG,YAAY,GAAG;GACtB,IAAI,GAAG,YAAY,GAAG;GACtB,IAAI,GAAG,YAAY,GAAG;GACtB,OAAO,GAAG,YAAY,OAAO;GAC7B,YAAY;GACZ,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,YAAY;EACd;CACF;CACA,iBAAiB;EAAE,SAAS;EAAW,MAAM;CAAK;AACpD,CACF;AAaA,SAAgB,OAAO,OAAoB;CACzC,MAAM,OAAO,KAAK,OAAO,WAAW,QAAQ,SAAS,YAAY,iBAAiB;CAElF,OACEA,gBAAAA,UAAAA,WAAAA;EACE,aAAU;EACV,IAAA,UAAA;GAAO,OAAA,GACL,eAAe;IAAE,SAAS,MAAM;IAAS,MAAM,MAAM;GAAK,CAAC,GAC3D,MAAM,KACR;EAAC;EACDC,kBAAkB,SAAS,YAAY;GACrC,MAAM,kBAAkB,SAAS,OAAO;GACxC,MAAM,WAAW,OAAO;EAC1B;CAED,GADK,IACL,CAAA;AAEL"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { cn } from "../../../lib/utils.js";
|
|
2
|
-
import { Toggle as Toggle$1 } from "../toggle/toggle.js";
|
|
3
1
|
import { createComponent, mergeProps, spread, template } from "@solidjs/web";
|
|
2
|
+
import { ToggleGroup as ToggleGroup$1 } from "@ui-sdk/solid/toggle";
|
|
4
3
|
import { omit } from "solid-js";
|
|
5
|
-
import {
|
|
4
|
+
import { cn } from "../../../lib/utils.js";
|
|
5
|
+
import { Toggle as Toggle$1 } from "../toggle/toggle.js";
|
|
6
6
|
// src/components/ui/toggle-group/toggle-group.tsx
|
|
7
7
|
var _tmpl$ = /* @__PURE__ */ template(`<button>`);
|
|
8
8
|
var toArray = (value) => value === void 0 ? void 0 : value === null ? [] : Array.isArray(value) ? value : [value];
|
|
9
|
-
function ToggleGroup
|
|
9
|
+
function ToggleGroup(props) {
|
|
10
10
|
const rest = omit(props, "class", "attached", "multiple", "value", "defaultValue", "onChange");
|
|
11
|
-
return createComponent(ToggleGroup, mergeProps({
|
|
11
|
+
return createComponent(ToggleGroup$1, mergeProps({
|
|
12
12
|
"data-slot": "toggle-group",
|
|
13
13
|
get multiple() {
|
|
14
14
|
return props.multiple ?? false;
|
|
@@ -20,8 +20,7 @@ function ToggleGroup$1(props) {
|
|
|
20
20
|
return toArray(props.defaultValue);
|
|
21
21
|
},
|
|
22
22
|
onValueChange: (value) => {
|
|
23
|
-
|
|
24
|
-
report?.(props.multiple ? value : value[0] ?? null);
|
|
23
|
+
(0, props.onChange)?.(props.multiple ? value : value[0] ?? null);
|
|
25
24
|
},
|
|
26
25
|
get "class"() {
|
|
27
26
|
return cn("flex w-fit flex-row items-center", props.attached ? "[&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:not(:first-child)]:-ms-px" : "gap-1", props.class);
|
|
@@ -40,6 +39,6 @@ function ToggleGroupItem(props) {
|
|
|
40
39
|
return _el$;
|
|
41
40
|
})() }));
|
|
42
41
|
}
|
|
43
|
-
export { ToggleGroup
|
|
42
|
+
export { ToggleGroup, ToggleGroupItem };
|
|
44
43
|
|
|
45
44
|
//# sourceMappingURL=toggle-group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-group.js","names":["<SdkToggleGroup\n data-slot=\"toggle-group\"\n multiple={props.multiple ?? false}\n value={toArray(props.value)}\n defaultValue={toArray(props.defaultValue)}\n onValueChange={(value) => {\n const report = props.onChange as ((value: string | string[] | null) => void) | undefined\n report?.(props.multiple ? value : (value[0] ?? null))\n }}\n class={cn(\n 'flex w-fit flex-row items-center',\n props.attached\n ? '[&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:not(:first-child)]:-ms-px'\n : 'gap-1',\n props.class as string\n )}\n {...rest}\n />","onValueChange={(value) => {\n const report = props.onChange as ((value: string | string[] | null) => void) | undefined\n report?.(props.multiple ? value : (value[0] ?? null))\n }}","<Toggle\n {...props}\n render={(itemProps) => <button {...itemProps} data-slot=\"toggle-group-item\" />}\n />","render={(itemProps) => <button {...itemProps} data-slot=\"toggle-group-item\" />}","
|
|
1
|
+
{"version":3,"file":"toggle-group.js","names":["<SdkToggleGroup\n data-slot=\"toggle-group\"\n multiple={props.multiple ?? false}\n value={toArray(props.value)}\n defaultValue={toArray(props.defaultValue)}\n onValueChange={(value) => {\n const report = props.onChange as ((value: string | string[] | null) => void) | undefined\n report?.(props.multiple ? value : (value[0] ?? null))\n }}\n class={cn(\n 'flex w-fit flex-row items-center',\n props.attached\n ? '[&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:not(:first-child)]:-ms-px'\n : 'gap-1',\n props.class as string\n )}\n {...rest}\n />","onValueChange={(value) => {\n const report = props.onChange as ((value: string | string[] | null) => void) | undefined\n report?.(props.multiple ? value : (value[0] ?? null))\n }}","<Toggle\n {...props}\n render={(itemProps) => <button {...itemProps} data-slot=\"toggle-group-item\" />}\n />","render={(itemProps) => <button {...itemProps} data-slot=\"toggle-group-item\" />}","_$spread"],"sources":["../../../../src/components/ui/toggle-group/toggle-group.tsx"],"sourcesContent":["import { ToggleGroup as SdkToggleGroup } from '@ui-sdk/solid/toggle'\nimport type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport type { VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\nimport { Toggle, toggleVariants } from '../toggle'\n\n/**\n * ToggleGroup.\n *\n * A set of related toggles that behave as one control: at most one pressed\n * (`multiple={false}`, the default) or any number (`multiple={true}`). The\n * group owns the selection and the roving focus, which is what makes arrow keys\n * move between items and a screen reader announce the position within the set.\n * A row of independent Toggles looks identical and does neither.\n *\n * `attached` joins the items into one rounded run for a segmented control. The\n * joining lives on the *group*, via child selectors, so an item never has to\n * know whether it sits at an end — which is also where the border collapse\n * (`-ms-px`) belongs.\n */\ntype SdkGroupProps = ComponentProps<typeof SdkToggleGroup>\n\n/**\n * `multiple` is optional and defaults to single selection, so the common case\n * is a one-word component and a caller that wants many passes `multiple`.\n *\n * The value keeps its single/multiple shape: a single group takes and reports\n * one value or `null`, a multiple group an array. ui-sdk always speaks arrays;\n * the conversion lives here so no caller has to.\n */\nexport type ToggleGroupProps = Omit<\n SdkGroupProps,\n 'multiple' | 'value' | 'defaultValue' | 'onValueChange' | 'onChange'\n> & {\n multiple?: boolean\n value?: string | string[] | null\n defaultValue?: string | string[] | null\n /** The pressed value (`null` for none), or the pressed values with `multiple`. */\n onChange?: ((value: string | null) => void) | ((value: string[]) => void)\n variant?: VariantProps<typeof toggleVariants>['variant']\n size?: VariantProps<typeof toggleVariants>['size']\n /** Join the items into one rounded run instead of a spaced row. */\n attached?: boolean\n}\n\nconst toArray = (value: string | string[] | null | undefined) =>\n value === undefined ? undefined : value === null ? [] : Array.isArray(value) ? value : [value]\n\nexport function ToggleGroup(props: ToggleGroupProps) {\n const rest = omit(props, 'class', 'attached', 'multiple', 'value', 'defaultValue', 'onChange')\n\n return (\n <SdkToggleGroup\n data-slot=\"toggle-group\"\n multiple={props.multiple ?? false}\n value={toArray(props.value)}\n defaultValue={toArray(props.defaultValue)}\n onValueChange={(value) => {\n const report = props.onChange as ((value: string | string[] | null) => void) | undefined\n report?.(props.multiple ? value : (value[0] ?? null))\n }}\n class={cn(\n 'flex w-fit flex-row items-center',\n props.attached\n ? '[&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:not(:first-child)]:-ms-px'\n : 'gap-1',\n props.class as string\n )}\n {...rest}\n />\n )\n}\n\nexport type ToggleGroupItemProps = Omit<ComponentProps<typeof Toggle>, 'value'> & {\n /** Identifies the item: the group's value lists the pressed items' values. */\n value: string\n}\n\n/**\n * One toggle of the group: a `Toggle`, which joins the group around it.\n * Escape is left alone: the group has no use for it, so an enclosing dialog or\n * drawer still gets the Escape it dismisses on.\n */\nexport function ToggleGroupItem(props: ToggleGroupItemProps) {\n // ui-sdk keeps a part's own `data-slot` over the props it is given, so the\n // item's name is set on the element it renders.\n return (\n <Toggle\n {...props}\n render={(itemProps) => <button {...itemProps} data-slot=\"toggle-group-item\" />}\n />\n )\n}\n"],"mappings":";;;;;;;AA8CA,IAAM,WAAW,UACf,UAAU,KAAA,IAAY,KAAA,IAAY,UAAU,OAAO,CAAC,IAAI,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK;AAE/F,SAAgB,YAAY,OAAyB;CACnD,MAAM,OAAO,KAAK,OAAO,SAAS,YAAY,YAAY,SAAS,gBAAgB,UAAU;CAE7F,OACEA,gBAAAA,eAAAA,WAAAA;EACE,aAAU;EACV,IAAA,WAAA;GAAU,OAAA,MAAM,YAAY;EAAK;EACjC,IAAA,QAAA;GAAO,OAAA,QAAQ,MAAM,KAAK;EAAC;EAC3B,IAAA,eAAA;GAAc,OAAA,QAAQ,MAAM,YAAY;EAAC;EACzCC,gBAAgB,UAAU;GAExB,CAAA,GADe,MAAM,SAAA,GACZ,MAAM,WAAW,QAAS,MAAM,MAAM,IAAK;EACtD;EACA,IAAA,UAAA;GAAO,OAAA,GACL,oCACA,MAAM,WACF,0JACA,SACJ,MAAM,KACR;EAAC;CAEF,GADK,IACL,CAAA;AAEL;;;;;;AAYA,SAAgB,gBAAgB,OAA6B;CAG3D,OACEC,gBAAAA,UAAAA,WACM,OADN,EAEEC,SAAS,qBAAc;EAAsD,IAAA,OAAA,OAAA;EAA1CC,OAAA,MAAA,CAAA,WAAA,EAAW,aAAA,oBAAA,CAAA,GAAA,KAAA;EAAvB,OAAA;CAAsD,EAAA,CAAA,EAC9E,CAAA,CAAA;AAEL"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { callHandler } from "../../../lib/events.js";
|
|
2
|
-
import { acquireTooltipFocusGate, releaseTooltipFocusGate } from "../../../lib/tooltip-focus-gate.js";
|
|
3
|
-
import { isServer, spread } from "@solidjs/web";
|
|
4
1
|
import { createSignal, flush, omit, onCleanup, untrack } from "solid-js";
|
|
2
|
+
import { isServer, spread } from "@solidjs/web";
|
|
3
|
+
import { callHandler } from "../../../lib/events.js";
|
|
5
4
|
import { sourceOf } from "@ui-sdk/core";
|
|
5
|
+
import { acquireTooltipFocusGate, releaseTooltipFocusGate } from "../../../lib/tooltip-focus-gate.js";
|
|
6
6
|
// src/components/ui/tooltip/deferred-tooltip.tsx
|
|
7
7
|
/** ui-sdk hands a part's `ref` as an array (the caller's and its own); call each. */
|
|
8
|
-
function applyRef
|
|
8
|
+
function applyRef(ref, element) {
|
|
9
9
|
if (typeof ref === "function") ref(element);
|
|
10
|
-
else if (Array.isArray(ref)) for (const each of ref) applyRef
|
|
10
|
+
else if (Array.isArray(ref)) for (const each of ref) applyRef(each, element);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Props the control keeps for itself: its type, its description, its content,
|
|
@@ -79,7 +79,7 @@ function createDeferredTooltip(options) {
|
|
|
79
79
|
const control = element();
|
|
80
80
|
if (!control) return null;
|
|
81
81
|
const rest = omit(props, ...controlOwned);
|
|
82
|
-
applyRef
|
|
82
|
+
applyRef(props.ref, control);
|
|
83
83
|
const attributes = {};
|
|
84
84
|
for (const key of Object.keys(rest)) {
|
|
85
85
|
const value = rest[key];
|