@adea-ai/ui 0.153.0 → 0.154.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/dist/NOTICE +10 -1
- package/dist/components/composites/about-dialog/about-dialog.d.ts.map +1 -1
- package/dist/components/composites/about-dialog/about-dialog.js +3 -1
- package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
- package/dist/components/composites/accent-picker/accent-picker.js +20 -9
- package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
- package/dist/components/composites/account-menu/account-menu.d.ts.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +20 -10
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +37 -24
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +7 -3
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +11 -6
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +8 -3
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js +8 -4
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser-group.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser-group.js +7 -3
- package/dist/components/composites/catalog-browser/catalog-browser-group.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +8 -4
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.js +3 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.d.ts.map +1 -1
- package/dist/components/composites/chat/chat.js +5 -1
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.d.ts.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.js +3 -1
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.d.ts.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +11 -5
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.d.ts.map +1 -1
- package/dist/components/composites/context/context.js +7 -4
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.d.ts.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +7 -3
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/help-center/help-center.d.ts.map +1 -1
- package/dist/components/composites/help-center/help-center.js +3 -1
- package/dist/components/composites/help-center/help-center.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.d.ts +2 -2
- package/dist/components/composites/icon-picker/icon-picker.d.ts.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +77 -71
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/icon-picker/shell-icons.d.ts.map +1 -1
- package/dist/components/composites/icon-picker/shell-icons.js +119 -59
- package/dist/components/composites/icon-picker/shell-icons.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.d.ts.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.js +5 -2
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +3 -4
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.d.ts.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js +5 -2
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.d.ts +15 -1
- package/dist/components/composites/model-selector/model-selector.d.ts.map +1 -1
- package/dist/components/composites/model-selector/model-selector.js +271 -33
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/plan/plan.d.ts.map +1 -1
- package/dist/components/composites/plan/plan.js +3 -1
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/queue/queue.d.ts.map +1 -1
- package/dist/components/composites/queue/queue.js +11 -5
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.d.ts.map +1 -1
- package/dist/components/composites/reasoning/reasoning.js +3 -1
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/scene-controls/scene-controls.d.ts.map +1 -1
- package/dist/components/composites/scene-controls/scene-controls.js +14 -7
- package/dist/components/composites/scene-controls/scene-controls.js.map +1 -1
- package/dist/components/composites/settings/settings.d.ts.map +1 -1
- package/dist/components/composites/settings/settings.js +77 -67
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/sources.d.ts.map +1 -1
- package/dist/components/composites/sources/sources.js +39 -39
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.d.ts.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js +9 -4
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.d.ts.map +1 -1
- package/dist/components/composites/stat/stat.js +4 -1
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.d.ts.map +1 -1
- package/dist/components/composites/subagent/subagent.js +3 -1
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/task/task.d.ts.map +1 -1
- package/dist/components/composites/task/task.js +3 -1
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/ansi.d.ts.map +1 -1
- package/dist/components/composites/terminal/ansi.js +16 -0
- package/dist/components/composites/terminal/ansi.js.map +1 -1
- package/dist/components/composites/terminal/terminal.d.ts.map +1 -1
- package/dist/components/composites/terminal/terminal.js +15 -7
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results.d.ts.map +1 -1
- package/dist/components/composites/test-results/test-results.js +15 -7
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.d.ts.map +1 -1
- package/dist/components/composites/tool/tool.js +3 -1
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.d.ts.map +1 -1
- package/dist/components/composites/tree/tree.js +3 -1
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +34 -24
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.d.ts.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +17 -12
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.d.ts.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js +5 -2
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.d.ts.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.js +9 -4
- package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
- package/dist/components/conversation/busy-send-button.d.ts.map +1 -1
- package/dist/components/conversation/busy-send-button.js +9 -5
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.d.ts.map +1 -1
- package/dist/components/conversation/conversation-avatar.js +6 -3
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-surface.d.ts.map +1 -1
- package/dist/components/conversation/conversation-surface.js +3 -1
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.d.ts.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +9 -4
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.d.ts.map +1 -1
- package/dist/components/conversation/message-composer.js +9 -4
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.d.ts.map +1 -1
- package/dist/components/conversation/message-row.js +11 -5
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/thread-panel.d.ts.map +1 -1
- package/dist/components/conversation/thread-panel.js +3 -1
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.d.ts.map +1 -1
- package/dist/components/conversation/transcript-composition.js +3 -1
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/floating-preview/floating-preview.d.ts.map +1 -1
- package/dist/components/layout/floating-preview/floating-preview.js +5 -2
- package/dist/components/layout/floating-preview/floating-preview.js.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.d.ts.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +3 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/shell-rail/shell-rail.d.ts.map +1 -1
- package/dist/components/layout/shell-rail/shell-rail.js +3 -1
- package/dist/components/layout/shell-rail/shell-rail.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +46 -42
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +3 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.d.ts.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +5 -2
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.d.ts.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +16 -13
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/theme/appearance-panel.d.ts.map +1 -1
- package/dist/components/theme/appearance-panel.js +3 -1
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/theme-mode-toggle.d.ts.map +1 -1
- package/dist/components/theme/theme-mode-toggle.js +6 -3
- package/dist/components/theme/theme-mode-toggle.js.map +1 -1
- package/dist/components/theme/theme-toggle.d.ts.map +1 -1
- package/dist/components/theme/theme-toggle.js +6 -3
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/accordion/accordion.d.ts.map +1 -1
- package/dist/components/ui/accordion/accordion.js +3 -1
- package/dist/components/ui/accordion/accordion.js.map +1 -1
- package/dist/components/ui/alert/alert.d.ts.map +1 -1
- package/dist/components/ui/alert/alert.js +15 -9
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.d.ts.map +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.js +5 -4
- package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
- package/dist/components/ui/attachment/attachment.d.ts.map +1 -1
- package/dist/components/ui/attachment/attachment.js +18 -9
- package/dist/components/ui/attachment/attachment.js.map +1 -1
- package/dist/components/ui/badge/badge.d.ts.map +1 -1
- package/dist/components/ui/badge/badge.js +30 -11
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js +5 -2
- package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/ui/button/button.d.ts.map +1 -1
- package/dist/components/ui/button/button.js +37 -13
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/calendar/calendar.d.ts.map +1 -1
- package/dist/components/ui/calendar/calendar.js +5 -2
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/carousel/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel/carousel.js +12 -6
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.d.ts +13 -0
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +296 -21
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/ui/code-block/code-block.js +9 -6
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/combobox/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox/combobox.js +8 -11
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/command/command.d.ts.map +1 -1
- package/dist/components/ui/command/command.js +4 -2
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.d.ts.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.js +3 -1
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js +10 -10
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.js +3 -1
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.js +7 -3
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.d.ts.map +1 -1
- package/dist/components/ui/empty/empty-state.js +3 -1
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/field/field.d.ts.map +1 -1
- package/dist/components/ui/field/field.js +12 -6
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/input/input-control.d.ts +2 -0
- package/dist/components/ui/input/input-control.d.ts.map +1 -1
- package/dist/components/ui/input/input-control.js +24 -6
- package/dist/components/ui/input/input-control.js.map +1 -1
- package/dist/components/ui/input/input.d.ts.map +1 -1
- package/dist/components/ui/input/input.js +47 -48
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-group/input-group.d.ts.map +1 -1
- package/dist/components/ui/input-group/input-group.js +1 -8
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/kbd/kbd.d.ts +23 -10
- package/dist/components/ui/kbd/kbd.d.ts.map +1 -1
- package/dist/components/ui/kbd/kbd.js +42 -11
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/message/index.d.ts +1 -1
- package/dist/components/ui/message/index.d.ts.map +1 -1
- package/dist/components/ui/message/index.js +2 -2
- package/dist/components/ui/message/message.d.ts.map +1 -1
- package/dist/components/ui/message/message.js +5 -3
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/message/parse-message-text.d.ts +32 -0
- package/dist/components/ui/message/parse-message-text.d.ts.map +1 -1
- package/dist/components/ui/message/parse-message-text.js +63 -3
- package/dist/components/ui/message/parse-message-text.js.map +1 -1
- package/dist/components/ui/native-select/native-select.d.ts.map +1 -1
- package/dist/components/ui/native-select/native-select.js +4 -9
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +3 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination/pagination.js +7 -3
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.d.ts.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +9 -4
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +4 -9
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.d.ts.map +1 -1
- package/dist/components/ui/resizable/resizable.js +3 -1
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/select/select.d.ts.map +1 -1
- package/dist/components/ui/select/select.js +7 -3
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/sheet/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet/sheet.js +3 -1
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/spinner/spinner.d.ts.map +1 -1
- package/dist/components/ui/spinner/spinner.js +3 -1
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.d.ts.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js +35 -30
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.d.ts +7 -0
- package/dist/components/ui/switch/switch.d.ts.map +1 -1
- package/dist/components/ui/switch/switch.js +255 -17
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/textarea/textarea.d.ts.map +1 -1
- package/dist/components/ui/textarea/textarea.js +1 -8
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.d.ts.map +1 -1
- package/dist/components/ui/toast/toast.js +3 -1
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/tooltip/deferred-tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip/deferred-tooltip.js +10 -4
- package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -1
- package/dist/components/ui/tooltip/index.d.ts +1 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -1
- package/dist/components/ui/tooltip/index.js +2 -1
- package/dist/components/ui/tooltip/lazy-tooltip.d.ts +40 -0
- package/dist/components/ui/tooltip/lazy-tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip/lazy-tooltip.js +61 -0
- package/dist/components/ui/tooltip/lazy-tooltip.js.map +1 -0
- package/dist/components/ui/trace/trace.d.ts.map +1 -1
- package/dist/components/ui/trace/trace.js +82 -68
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.d.ts +1 -1
- package/dist/components/ui/typography/typography.d.ts.map +1 -1
- package/dist/components/ui/typography/typography.js +5 -6
- package/dist/components/ui/typography/typography.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/lib/clipboard.d.ts.map +1 -1
- package/dist/lib/clipboard.js +3 -0
- package/dist/lib/clipboard.js.map +1 -1
- package/dist/lib/fast-icon.d.ts +18 -0
- package/dist/lib/fast-icon.d.ts.map +1 -0
- package/dist/lib/fast-icon.js +75 -0
- package/dist/lib/fast-icon.js.map +1 -0
- package/dist/lib/form-field.d.ts +1 -1
- package/dist/lib/form-field.js +3 -1
- package/dist/lib/form-field.js.map +1 -1
- package/dist/lib/observe-resize.d.ts +14 -0
- package/dist/lib/observe-resize.d.ts.map +1 -0
- package/dist/lib/observe-resize.js +19 -0
- package/dist/lib/observe-resize.js.map +1 -0
- package/dist/lib/overlay.d.ts +1 -1
- package/dist/lib/overlay.d.ts.map +1 -1
- package/dist/lib/overlay.js +1 -1
- package/dist/lib/overlay.js.map +1 -1
- package/dist/lint/index.d.ts +1 -0
- package/dist/lint/index.d.ts.map +1 -1
- package/dist/lint.js +251 -118
- package/dist/lint.js.map +1 -1
- package/dist/r/action-button.json +3 -1
- package/dist/r/floating-preview.json +2 -1
- package/dist/r/icon-picker.json +0 -1
- package/dist/r/lib.json +10 -0
- package/dist/r/model-selector.json +1 -0
- package/dist/r/plan.json +2 -1
- package/dist/r/queue.json +2 -1
- package/dist/r/registry.json +33 -9
- package/dist/r/scene-controls.json +2 -1
- package/dist/r/side-rail.json +1 -0
- package/dist/r/src/components/composites/about-dialog/about-dialog.tsx +5 -1
- package/dist/r/src/components/composites/accent-picker/accent-picker.tsx +22 -17
- package/dist/r/src/components/composites/account-menu/account-menu.tsx +21 -9
- package/dist/r/src/components/composites/action-button/action-button.tsx +38 -21
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +7 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +13 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +13 -1
- package/dist/r/src/components/composites/appearance-editor/font-settings-group.tsx +13 -1
- package/dist/r/src/components/composites/catalog-browser/catalog-browser-group.tsx +11 -1
- package/dist/r/src/components/composites/catalog-browser/catalog-browser.tsx +11 -1
- package/dist/r/src/components/composites/chain-of-thought/chain-of-thought.tsx +5 -1
- package/dist/r/src/components/composites/chat/chat.tsx +11 -1
- package/dist/r/src/components/composites/checkpoint/checkpoint.tsx +5 -1
- package/dist/r/src/components/composites/confirmation/confirmation.tsx +15 -1
- package/dist/r/src/components/composites/context/context.tsx +9 -1
- package/dist/r/src/components/composites/file-tree/file-tree.tsx +11 -1
- package/dist/r/src/components/composites/help-center/help-center.tsx +5 -1
- package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +59 -31
- package/dist/r/src/components/composites/icon-picker/shell-icons.ts +121 -59
- package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +6 -1
- package/dist/r/src/components/composites/list-row/list-row-control.tsx +7 -5
- package/dist/r/src/components/composites/message-scroller/message-scroller.tsx +6 -1
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +197 -11
- package/dist/r/src/components/composites/plan/plan.tsx +5 -1
- package/dist/r/src/components/composites/queue/queue.tsx +15 -1
- package/dist/r/src/components/composites/reasoning/reasoning.tsx +5 -1
- package/dist/r/src/components/composites/scene-controls/scene-controls.tsx +17 -1
- package/dist/r/src/components/composites/settings/settings.tsx +23 -14
- package/dist/r/src/components/composites/sources/sources.tsx +27 -20
- package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +13 -1
- package/dist/r/src/components/composites/stat/stat.tsx +9 -1
- package/dist/r/src/components/composites/subagent/subagent.tsx +5 -1
- package/dist/r/src/components/composites/task/task.tsx +5 -1
- package/dist/r/src/components/composites/terminal/ansi.ts +18 -0
- package/dist/r/src/components/composites/terminal/terminal.tsx +17 -7
- package/dist/r/src/components/composites/test-results/test-results.tsx +17 -7
- package/dist/r/src/components/composites/tool/tool.tsx +5 -1
- package/dist/r/src/components/composites/tree/tree.tsx +5 -1
- package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +35 -15
- package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +14 -7
- package/dist/r/src/components/composites/workspace-switcher/workspace-reorder-dialog.tsx +6 -1
- package/dist/r/src/components/composites/workspace-switcher/workspace-switcher.tsx +13 -1
- package/dist/r/src/components/conversation/busy-send-button.tsx +11 -1
- package/dist/r/src/components/conversation/conversation-avatar.tsx +7 -1
- package/dist/r/src/components/conversation/conversation-surface.tsx +5 -1
- package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +13 -1
- package/dist/r/src/components/conversation/message-composer.tsx +13 -1
- package/dist/r/src/components/conversation/message-row.tsx +15 -1
- package/dist/r/src/components/conversation/thread-panel.tsx +5 -1
- package/dist/r/src/components/conversation/transcript-composition.tsx +5 -1
- package/dist/r/src/components/layout/floating-preview/floating-preview.tsx +6 -1
- package/dist/r/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +5 -1
- package/dist/r/src/components/layout/shell-rail/shell-rail.tsx +5 -1
- package/dist/r/src/components/layout/side-rail/side-rail.tsx +16 -19
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +5 -1
- package/dist/r/src/components/layout/split-layout/split-layout.tsx +6 -1
- package/dist/r/src/components/layout/top-bar/top-bar.tsx +8 -8
- package/dist/r/src/components/theme/appearance-panel.tsx +6 -1
- package/dist/r/src/components/theme/theme-mode-toggle.tsx +7 -1
- package/dist/r/src/components/theme/theme-toggle.tsx +7 -1
- package/dist/r/src/components/ui/accordion/accordion.tsx +5 -1
- package/dist/r/src/components/ui/alert/alert.tsx +20 -3
- package/dist/r/src/components/ui/annotation-surface/annotation-surface.tsx +6 -3
- package/dist/r/src/components/ui/attachment/attachment.tsx +19 -8
- package/dist/r/src/components/ui/badge/badge.tsx +24 -8
- package/dist/r/src/components/ui/breadcrumb/breadcrumb.tsx +9 -1
- package/dist/r/src/components/ui/button/button.tsx +47 -16
- package/dist/r/src/components/ui/calendar/calendar.tsx +6 -1
- package/dist/r/src/components/ui/carousel/carousel.tsx +15 -5
- package/dist/r/src/components/ui/checkbox/checkbox.tsx +260 -22
- package/dist/r/src/components/ui/code-block/code-block.tsx +11 -5
- package/dist/r/src/components/ui/combobox/combobox.tsx +8 -9
- package/dist/r/src/components/ui/command/command.tsx +8 -4
- package/dist/r/src/components/ui/detail-panel/detail-panel.tsx +5 -1
- package/dist/r/src/components/ui/dialog/dialog-layer.tsx +16 -18
- package/dist/r/src/components/ui/dialog/dialog.tsx +5 -1
- package/dist/r/src/components/ui/dropdown-menu/menu-parts.tsx +11 -1
- package/dist/r/src/components/ui/empty/empty-state.tsx +5 -1
- package/dist/r/src/components/ui/field/field.tsx +14 -5
- package/dist/r/src/components/ui/input/input-control.tsx +28 -19
- package/dist/r/src/components/ui/input/input.tsx +9 -12
- package/dist/r/src/components/ui/input-group/input-group.tsx +1 -8
- package/dist/r/src/components/ui/kbd/kbd.tsx +53 -12
- package/dist/r/src/components/ui/message/index.ts +3 -0
- package/dist/r/src/components/ui/message/message.tsx +11 -2
- package/dist/r/src/components/ui/message/parse-message-text.ts +94 -2
- package/dist/r/src/components/ui/native-select/native-select.tsx +6 -9
- package/dist/r/src/components/ui/navigation-menu/navigation-menu.tsx +5 -1
- package/dist/r/src/components/ui/pagination/pagination.tsx +11 -1
- package/dist/r/src/components/ui/questionnaire/questionnaire.tsx +13 -1
- package/dist/r/src/components/ui/radio-group/radio-group.tsx +6 -9
- package/dist/r/src/components/ui/resizable/resizable.tsx +5 -1
- package/dist/r/src/components/ui/select/select.tsx +11 -1
- package/dist/r/src/components/ui/sheet/sheet.tsx +5 -1
- package/dist/r/src/components/ui/spinner/spinner.tsx +5 -1
- package/dist/r/src/components/ui/status-chip/status-chip.tsx +14 -7
- package/dist/r/src/components/ui/switch/switch.tsx +235 -28
- package/dist/r/src/components/ui/textarea/textarea.tsx +1 -8
- package/dist/r/src/components/ui/toast/toast.tsx +5 -1
- package/dist/r/src/components/ui/tooltip/deferred-tooltip.tsx +14 -8
- package/dist/r/src/components/ui/tooltip/index.ts +1 -0
- package/dist/r/src/components/ui/tooltip/lazy-tooltip.tsx +73 -0
- package/dist/r/src/components/ui/trace/trace.tsx +61 -28
- package/dist/r/src/components/ui/typography/typography.tsx +6 -5
- package/dist/r/src/lib/clipboard.ts +4 -0
- package/dist/r/src/lib/fast-icon.ts +88 -0
- package/dist/r/src/lib/form-field.ts +7 -7
- package/dist/r/src/lib/observe-resize.ts +28 -0
- package/dist/r/src/lib/overlay.ts +1 -1
- package/dist/r/subagent.json +2 -1
- package/dist/r/tool.json +2 -1
- package/dist/r/tooltip.json +5 -0
- package/dist/r/top-bar.json +1 -0
- package/dist/r/trace.json +0 -1
- package/package.json +1 -1
- package/registry.json +33 -9
- package/src/components/composites/about-dialog/about-dialog.tsx +5 -1
- package/src/components/composites/accent-picker/accent-picker.tsx +22 -17
- package/src/components/composites/account-menu/account-menu.tsx +21 -9
- package/src/components/composites/action-button/action-button.tsx +38 -21
- package/src/components/composites/appearance-editor/appearance-choices.tsx +7 -1
- package/src/components/composites/appearance-editor/appearance-editor.tsx +13 -1
- package/src/components/composites/appearance-editor/appearance-rows.tsx +13 -1
- package/src/components/composites/appearance-editor/font-settings-group.tsx +13 -1
- package/src/components/composites/catalog-browser/catalog-browser-group.tsx +11 -1
- package/src/components/composites/catalog-browser/catalog-browser.tsx +11 -1
- package/src/components/composites/chain-of-thought/chain-of-thought.tsx +5 -1
- package/src/components/composites/chat/chat.tsx +11 -1
- package/src/components/composites/checkpoint/checkpoint.tsx +5 -1
- package/src/components/composites/confirmation/confirmation.tsx +15 -1
- package/src/components/composites/context/context.tsx +9 -1
- package/src/components/composites/file-tree/file-tree.tsx +11 -1
- package/src/components/composites/help-center/help-center.tsx +5 -1
- package/src/components/composites/icon-picker/icon-picker.tsx +59 -31
- package/src/components/composites/icon-picker/shell-icons.ts +121 -59
- package/src/components/composites/inline-citation/inline-citation.tsx +6 -1
- package/src/components/composites/list-row/list-row-control.tsx +7 -5
- package/src/components/composites/message-scroller/message-scroller.tsx +6 -1
- package/src/components/composites/model-selector/model-selector.tsx +197 -11
- package/src/components/composites/plan/plan.tsx +5 -1
- package/src/components/composites/queue/queue.tsx +15 -1
- package/src/components/composites/reasoning/reasoning.tsx +5 -1
- package/src/components/composites/scene-controls/scene-controls.tsx +17 -1
- package/src/components/composites/settings/settings.tsx +23 -14
- package/src/components/composites/sources/sources.tsx +27 -20
- package/src/components/composites/stack-trace/stack-trace.tsx +13 -1
- package/src/components/composites/stat/stat.tsx +9 -1
- package/src/components/composites/subagent/subagent.tsx +5 -1
- package/src/components/composites/task/task.tsx +5 -1
- package/src/components/composites/terminal/ansi.ts +18 -0
- package/src/components/composites/terminal/terminal.tsx +17 -7
- package/src/components/composites/test-results/test-results.tsx +17 -7
- package/src/components/composites/tool/tool.tsx +5 -1
- package/src/components/composites/tree/tree.tsx +5 -1
- package/src/components/composites/update-dialog/update-dialog.tsx +35 -15
- package/src/components/composites/workspace-mark/workspace-mark.tsx +14 -7
- package/src/components/composites/workspace-switcher/workspace-reorder-dialog.tsx +6 -1
- package/src/components/composites/workspace-switcher/workspace-switcher.tsx +13 -1
- package/src/components/conversation/busy-send-button.tsx +11 -1
- package/src/components/conversation/conversation-avatar.tsx +7 -1
- package/src/components/conversation/conversation-surface.tsx +5 -1
- package/src/components/conversation/internal/chat-composer-shell.tsx +13 -1
- package/src/components/conversation/message-composer.tsx +13 -1
- package/src/components/conversation/message-row.tsx +15 -1
- package/src/components/conversation/thread-panel.tsx +5 -1
- package/src/components/conversation/transcript-composition.tsx +5 -1
- package/src/components/layout/floating-preview/floating-preview.tsx +6 -1
- package/src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx +5 -1
- package/src/components/layout/shell-rail/shell-rail.tsx +5 -1
- package/src/components/layout/side-rail/side-rail.tsx +16 -19
- package/src/components/layout/sidebar-nav/sidebar-nav.tsx +5 -1
- package/src/components/layout/split-layout/split-layout.tsx +6 -1
- package/src/components/layout/top-bar/top-bar.tsx +8 -8
- package/src/components/theme/appearance-panel.tsx +6 -1
- package/src/components/theme/theme-mode-toggle.tsx +7 -1
- package/src/components/theme/theme-toggle.tsx +7 -1
- package/src/components/ui/accordion/accordion.tsx +5 -1
- package/src/components/ui/alert/alert.tsx +20 -3
- package/src/components/ui/annotation-surface/annotation-surface.tsx +6 -3
- package/src/components/ui/attachment/attachment.tsx +19 -8
- package/src/components/ui/badge/badge.tsx +24 -8
- package/src/components/ui/breadcrumb/breadcrumb.tsx +9 -1
- package/src/components/ui/button/button.tsx +47 -16
- package/src/components/ui/calendar/calendar.tsx +6 -1
- package/src/components/ui/carousel/carousel.tsx +15 -5
- package/src/components/ui/checkbox/checkbox.tsx +260 -22
- package/src/components/ui/code-block/code-block.tsx +11 -5
- package/src/components/ui/combobox/combobox.tsx +8 -9
- package/src/components/ui/command/command.tsx +8 -4
- package/src/components/ui/detail-panel/detail-panel.tsx +5 -1
- package/src/components/ui/dialog/dialog-layer.tsx +16 -18
- package/src/components/ui/dialog/dialog.tsx +5 -1
- package/src/components/ui/dropdown-menu/menu-parts.tsx +11 -1
- package/src/components/ui/empty/empty-state.tsx +5 -1
- package/src/components/ui/field/field.tsx +14 -5
- package/src/components/ui/input/input-control.tsx +28 -19
- package/src/components/ui/input/input.tsx +9 -12
- package/src/components/ui/input-group/input-group.tsx +1 -8
- package/src/components/ui/kbd/kbd.tsx +53 -12
- package/src/components/ui/message/index.ts +3 -0
- package/src/components/ui/message/message.tsx +11 -2
- package/src/components/ui/message/parse-message-text.ts +94 -2
- package/src/components/ui/native-select/native-select.tsx +6 -9
- package/src/components/ui/navigation-menu/navigation-menu.tsx +5 -1
- package/src/components/ui/pagination/pagination.tsx +11 -1
- package/src/components/ui/questionnaire/questionnaire.tsx +13 -1
- package/src/components/ui/radio-group/radio-group.tsx +6 -9
- package/src/components/ui/resizable/resizable.tsx +5 -1
- package/src/components/ui/select/select.tsx +11 -1
- package/src/components/ui/sheet/sheet.tsx +5 -1
- package/src/components/ui/spinner/spinner.tsx +5 -1
- package/src/components/ui/status-chip/status-chip.tsx +14 -7
- package/src/components/ui/switch/switch.tsx +235 -28
- package/src/components/ui/textarea/textarea.tsx +1 -8
- package/src/components/ui/toast/toast.tsx +5 -1
- package/src/components/ui/tooltip/deferred-tooltip.tsx +14 -8
- package/src/components/ui/tooltip/index.ts +1 -0
- package/src/components/ui/tooltip/lazy-tooltip.tsx +73 -0
- package/src/components/ui/trace/trace.tsx +61 -28
- package/src/components/ui/typography/typography.tsx +6 -5
- package/src/lib/clipboard.ts +4 -0
- package/src/lib/fast-icon.ts +88 -0
- package/src/lib/form-field.ts +7 -7
- package/src/lib/observe-resize.ts +28 -0
- package/src/lib/overlay.ts +1 -1
- package/src/lint/index.ts +199 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-layer.js","names":["useDialogContext","createRenderEffect","onCleanup","TooltipEscapeTargetContext","event","restoreFocusRef","HTMLElement","onOpenAutoFocus","onCloseAutoFocus","content","opener","openerEligible","closed","focusMovedOutside","closeAutoFocusScheduled","deadlinePassed","frame","fallbackTimer","observer","MutationObserver","onFocusIn","openLayers","Set","isVisible","element","isConnected","getClientRects","length","canRestoreFocus","target","document","body","documentElement","closest","matches","anotherLayerOpen","layer","contains","FOCUS_RESTORE_DEADLINE_MS","createDialogFocusReturn","open","options","focusCycles","WeakMap","activeFocusCycle","pendingOpener","pendingOpenerEligible","active","activeElement","finishFocusCycle","cycle","undefined","window","cancelAnimationFrame","clearTimeout","disconnect","removeEventListener","delete","markClosed","scheduleFocusRestore","requestAnimationFrame","focusIsAvailable","Node","focus","preventScroll","currentTarget","openerWasCaptured","openerElement","focusEvent","set","add","addEventListener","get","defaultPrevented","observe","attributes","attributeFilter","childList","subtree","setTimeout","queueMicrotask","createDialogLayer","isOpen","DialogEscapeTarget","props","onEscapeKeyDown","children","dialog","dismiss","close","_$createComponent","Provider","value","contentRef"],"sources":["../../../../src/components/ui/dialog/dialog-layer.tsx"],"sourcesContent":["import { useDialogContext } from '@kobalte/core/dialog'\nimport type { Accessor, JSX } from 'solid-js'\nimport { createRenderEffect, onCleanup } from 'solid-js'\nimport { TooltipEscapeTargetContext } from '../tooltip/tooltip'\n\n/**\n * The rules the kit's dialog-shaped layers share, so a caller never wires them\n * by hand:\n *\n * 1. Focus returns to whatever had it before the layer opened. Kobalte only\n * returns focus to its own `Trigger`; a controlled layer opened from a menu\n * row, a shortcut or another layer would otherwise drop focus on `<body>`.\n * Dialog, AlertDialog, Sheet and the command palette.\n * 2. An Escape that a tooltip inside the layer swallowed still closes the layer\n * (see `TooltipEscapeTargetContext`). Dialog, AlertDialog and Sheet only;\n * the command palette does not provide it.\n *\n * Private to the overlay kit: content components apply it; callers pass\n * `restoreFocusRef` when the opener is gone by the time the layer opens.\n */\n\ntype AutoFocusHandler = (event: Event) => void\n\nexport type DialogLayerOptions = {\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n onOpenAutoFocus?: AutoFocusHandler\n onCloseAutoFocus?: AutoFocusHandler\n}\n\ntype FocusCycle = {\n content: HTMLElement\n opener: HTMLElement | null\n openerEligible: boolean\n closed: boolean\n focusMovedOutside: boolean\n closeAutoFocusScheduled: boolean\n /** The restore deadline passed: stop waiting on the opener after the frame that is due. */\n deadlinePassed: boolean\n frame?: number\n fallbackTimer?: number\n observer?: MutationObserver\n onFocusIn: (event: FocusEvent) => void\n}\n\n/** The kit's dialog layers that are open now, so a closing layer can tell a newer one took over. */\nconst openLayers = new Set<HTMLElement>()\n\nfunction isVisible(element: HTMLElement) {\n return element.isConnected && element.getClientRects().length > 0\n}\n\nfunction canRestoreFocus(target: HTMLElement): boolean {\n return (\n target !== document.body &&\n target !== document.documentElement &&\n !target.closest('[inert], [aria-hidden=\"true\"]') &&\n !target.matches(':disabled') &&\n isVisible(target)\n )\n}\n\nfunction anotherLayerOpen(content: HTMLElement, opener: HTMLElement): boolean {\n for (const layer of openLayers) {\n if (\n layer !== content &&\n !content.contains(layer) &&\n !layer.contains(opener) &&\n !layer.closest('[aria-hidden=\"true\"], [inert]') &&\n isVisible(layer)\n ) {\n return true\n }\n }\n return false\n}\n\n/**\n * The focus-return half of the layer rules, for a layer whose open state is\n * `open`. Returns the autofocus handlers to give the Kobalte content.\n */\n/** How long a closed layer may wait for its opener to become focusable again. */\nconst FOCUS_RESTORE_DEADLINE_MS = 1000\n\nexport function createDialogFocusReturn(\n open: Accessor<boolean>,\n options: DialogLayerOptions\n): { onOpenAutoFocus: AutoFocusHandler; onCloseAutoFocus: AutoFocusHandler } {\n const focusCycles = new WeakMap<HTMLElement, FocusCycle>()\n let activeFocusCycle: FocusCycle | undefined\n let pendingOpener: HTMLElement | null = null\n let pendingOpenerEligible = false\n\n // Captured while the open state changes, before Kobalte's effects move focus\n // into the layer and before a closing menu takes its row out of the page.\n createRenderEffect(() => {\n if (!open() || typeof document === 'undefined') {\n pendingOpener = null\n pendingOpenerEligible = false\n return\n }\n const active = options.restoreFocusRef?.() ?? document.activeElement\n pendingOpener = active instanceof HTMLElement ? active : null\n pendingOpenerEligible = active instanceof HTMLElement && canRestoreFocus(active)\n })\n\n const finishFocusCycle = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) window.cancelAnimationFrame(cycle.frame)\n if (cycle.fallbackTimer !== undefined) window.clearTimeout(cycle.fallbackTimer)\n cycle.observer?.disconnect()\n document.removeEventListener('focusin', cycle.onFocusIn)\n openLayers.delete(cycle.content)\n if (activeFocusCycle === cycle) activeFocusCycle = undefined\n }\n\n const markClosed = (cycle: FocusCycle) => {\n cycle.closed = true\n openLayers.delete(cycle.content)\n }\n\n const scheduleFocusRestore = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) return\n cycle.frame = window.requestAnimationFrame(() => {\n cycle.frame = undefined\n const opener = cycle.opener\n const active = document.activeElement\n const focusIsAvailable =\n active === document.body ||\n active === document.documentElement ||\n active === cycle.content ||\n (active instanceof Node && cycle.content.contains(active))\n if (\n activeFocusCycle !== cycle ||\n !cycle.closed ||\n cycle.focusMovedOutside ||\n !opener ||\n !isVisible(opener) ||\n opener.matches(':disabled') ||\n !focusIsAvailable ||\n anotherLayerOpen(cycle.content, opener)\n ) {\n finishFocusCycle(cycle)\n return\n }\n\n // Nothing to restore: stop watching the document now.\n if (!cycle.openerEligible) {\n finishFocusCycle(cycle)\n return\n }\n // Kobalte removes the `inert` / `aria-hidden` it put on the background\n // only after the layer unmounts; the observer below brings us back here.\n if (opener.closest('[inert], [aria-hidden=\"true\"]')) {\n if (cycle.deadlinePassed) finishFocusCycle(cycle)\n return\n }\n if (cycle.openerEligible && canRestoreFocus(opener)) {\n opener.focus({ preventScroll: true })\n }\n finishFocusCycle(cycle)\n })\n }\n\n const onOpenAutoFocus = (event: Event) => {\n const element = event.currentTarget\n if (element instanceof HTMLElement) {\n if (activeFocusCycle) finishFocusCycle(activeFocusCycle)\n\n const openerWasCaptured = pendingOpener !== null\n const opener = pendingOpener ?? document.activeElement\n const openerEligible = openerWasCaptured\n ? pendingOpenerEligible\n : opener instanceof HTMLElement && canRestoreFocus(opener)\n pendingOpener = null\n pendingOpenerEligible = false\n const openerElement = opener instanceof HTMLElement ? opener : null\n const cycle: FocusCycle = {\n content: element,\n opener: openerElement,\n openerEligible,\n closed: false,\n focusMovedOutside: false,\n closeAutoFocusScheduled: false,\n deadlinePassed: false,\n onFocusIn: (focusEvent) => {\n const target = focusEvent.target\n if (\n !(target instanceof HTMLElement) ||\n target === document.body ||\n target === document.documentElement\n ) {\n return\n }\n if (target === element || element.contains(target) || target === openerElement) {\n if (!cycle.closed) cycle.focusMovedOutside = false\n return\n }\n cycle.focusMovedOutside = true\n },\n }\n focusCycles.set(element, cycle)\n activeFocusCycle = cycle\n openLayers.add(element)\n document.addEventListener('focusin', cycle.onFocusIn)\n }\n options.onOpenAutoFocus?.(event)\n }\n\n const onCloseAutoFocus = (event: Event) => {\n const element = event.currentTarget\n const cycle = element instanceof HTMLElement ? focusCycles.get(element) : undefined\n options.onCloseAutoFocus?.(event)\n\n if (!cycle) return\n markClosed(cycle)\n\n // A caller that prevents Kobalte's close autofocus owns the focus decision.\n if (event.defaultPrevented) {\n finishFocusCycle(cycle)\n return\n }\n\n if (cycle.fallbackTimer !== undefined) {\n window.clearTimeout(cycle.fallbackTimer)\n cycle.fallbackTimer = undefined\n }\n cycle.closeAutoFocusScheduled = true\n cycle.observer = new MutationObserver(() => scheduleFocusRestore(cycle))\n cycle.observer.observe(document.body, {\n attributes: true,\n attributeFilter: ['aria-hidden', 'inert'],\n childList: true,\n subtree: true,\n })\n scheduleFocusRestore(cycle)\n // The observer watches every mutation in the document. If the opener stays\n // under an `inert` or `aria-hidden` that is not this layer's, nothing above\n // finishes the cycle, and a streaming page would schedule a frame per DOM\n // change for good. Kobalte clears its own markers within a frame or two.\n // The deadline stops the watching, not a restore already asked for: a busy\n // or throttled page (WebKit under load) can hold the frame past it.\n cycle.fallbackTimer = window.setTimeout(() => {\n cycle.fallbackTimer = undefined\n cycle.deadlinePassed = true\n cycle.observer?.disconnect()\n if (cycle.frame === undefined) finishFocusCycle(cycle)\n }, FOCUS_RESTORE_DEADLINE_MS)\n }\n\n onCleanup(() => {\n const cycle = activeFocusCycle\n if (!cycle) return\n markClosed(cycle)\n\n // Kobalte dispatches the close autofocus from a timer after unmount. If the\n // content never dispatches it, release the focus listener after that timer.\n queueMicrotask(() => {\n if (cycle.closeAutoFocusScheduled) return\n cycle.fallbackTimer = window.setTimeout(() => {\n cycle.fallbackTimer = undefined\n if (!cycle.closeAutoFocusScheduled) finishFocusCycle(cycle)\n }, 0)\n })\n })\n\n return { onOpenAutoFocus, onCloseAutoFocus }\n}\n\n/** The layer rules for a content rendered inside a Kobalte Dialog or AlertDialog root. */\nexport function createDialogLayer(options: DialogLayerOptions) {\n return createDialogFocusReturn(useDialogContext().isOpen, options)\n}\n\n/**\n * Lets an Escape swallowed by a tooltip inside the layer close the layer. The\n * content's own `onEscapeKeyDown` sees that Escape first, so a layer that\n * blocks Escape (a dirty form, a save in flight) stays blocked.\n */\nexport function DialogEscapeTarget(props: {\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n children?: JSX.Element\n}) {\n const dialog = useDialogContext()\n const dismiss = (event: KeyboardEvent) => {\n props.onEscapeKeyDown?.(event)\n if (!event.defaultPrevented) dialog.close()\n }\n return (\n <TooltipEscapeTargetContext.Provider value={{ element: dialog.contentRef, dismiss }}>\n {props.children}\n </TooltipEscapeTargetContext.Provider>\n )\n}\n"],"mappings":";;;;;;AA6CA,IAAMqB,6BAAa,IAAIC,IAAiB;AAExC,SAASC,UAAUC,SAAsB;CACvC,OAAOA,QAAQC,eAAeD,QAAQE,eAAe,CAAC,CAACC,SAAS;AAClE;AAEA,SAASC,gBAAgBC,QAA8B;CACrD,OACEA,WAAWC,SAASC,QACpBF,WAAWC,SAASE,mBACpB,CAACH,OAAOI,QAAQ,iCAA+B,KAC/C,CAACJ,OAAOK,QAAQ,WAAW,KAC3BX,UAAUM,MAAM;AAEpB;AAEA,SAASM,iBAAiB1B,SAAsBC,QAA8B;CAC5E,KAAK,MAAM0B,SAASf,YAClB,IACEe,UAAU3B,WACV,CAACA,QAAQ4B,SAASD,KAAK,KACvB,CAACA,MAAMC,SAAS3B,MAAM,KACtB,CAAC0B,MAAMH,QAAQ,iCAA+B,KAC9CV,UAAUa,KAAK,G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AK;EAIhB8B,qBAAqB;GACnB,IAAI9B,MAAMpC,yBAAyB;GACnCoC,MAAMjC,gBAAgBmC,OAAO2B,iBAAiB;IAC5C7B,MAAMjC,gBAAgBkC,KAAAA;IACtB,IAAI,CAACD,MAAMpC,yBAAyBmC,iBAAiBC,KAAK;GAC5D,GAAG,CAAC;EACN,CAAC;CACH,CAAC;CAED,OAAO;EAAE3C;EAAiBC;CAAiB;AAC7C;;AAGA,SAAgByE,kBAAkBxC,SAA6B;CAC7D,OAAOF,wBAAwBvC,iBAAiB,CAAC,CAACkF,QAAQzC,OAAO;AACnE;;;;;;AAOA,SAAgB0C,mBAAmBC,OAGhC;CACD,MAAMG,SAASvF,iBAAiB;CAChC,MAAMwF,WAAWpF,UAAyB;EACxCgF,MAAMC,kBAAkBjF,KAAK;EAC7B,IAAI,CAACA,MAAMqE,kBAAkBc,OAAOE,MAAM;CAC5C;CACA,OAAAC,gBACGvF,2BAA2BwF,UAAQ;EAAA,IAACC,QAAK;GAAA,OAAE;IAAEpE,SAAS+D,OAAOM;IAAYL;GAAQ;EAAC;EAAA,IAAAF,WAAA;GAAA,OAChFF,MAAME;EAAQ;CAAA,CAAA;AAGrB"}
|
|
1
|
+
{"version":3,"file":"dialog-layer.js","names":["useDialogContext","createRenderEffect","onCleanup","TooltipEscapeTargetContext","event","restoreFocusRef","HTMLElement","onOpenAutoFocus","onCloseAutoFocus","content","opener","openerEligible","closed","focusMovedOutside","closeAutoFocusScheduled","hiddenFrames","frame","fallbackTimer","observer","MutationObserver","onFocusIn","openLayers","Set","isVisible","element","isConnected","getClientRects","length","canRestoreFocus","target","document","body","documentElement","closest","matches","anotherLayerOpen","layer","contains","FOCUS_RESTORE_FRAME_BUDGET","createDialogFocusReturn","open","options","focusCycles","WeakMap","activeFocusCycle","pendingOpener","pendingOpenerEligible","active","activeElement","finishFocusCycle","cycle","undefined","window","cancelAnimationFrame","clearTimeout","disconnect","removeEventListener","delete","markClosed","scheduleFocusRestore","requestAnimationFrame","focusIsAvailable","Node","focus","preventScroll","currentTarget","openerWasCaptured","openerElement","focusEvent","set","add","addEventListener","get","defaultPrevented","observe","attributes","attributeFilter","childList","subtree","queueMicrotask","setTimeout","createDialogLayer","isOpen","DialogEscapeTarget","props","onEscapeKeyDown","children","dialog","dismiss","close","_$createComponent","Provider","value","contentRef"],"sources":["../../../../src/components/ui/dialog/dialog-layer.tsx"],"sourcesContent":["import { useDialogContext } from '@kobalte/core/dialog'\nimport type { Accessor, JSX } from 'solid-js'\nimport { createRenderEffect, onCleanup } from 'solid-js'\nimport { TooltipEscapeTargetContext } from '../tooltip/tooltip'\n\n/**\n * The rules the kit's dialog-shaped layers share, so a caller never wires them\n * by hand:\n *\n * 1. Focus returns to whatever had it before the layer opened. Kobalte only\n * returns focus to its own `Trigger`; a controlled layer opened from a menu\n * row, a shortcut or another layer would otherwise drop focus on `<body>`.\n * Dialog, AlertDialog, Sheet and the command palette.\n * 2. An Escape that a tooltip inside the layer swallowed still closes the layer\n * (see `TooltipEscapeTargetContext`). Dialog, AlertDialog and Sheet only;\n * the command palette does not provide it.\n *\n * Private to the overlay kit: content components apply it; callers pass\n * `restoreFocusRef` when the opener is gone by the time the layer opens.\n */\n\ntype AutoFocusHandler = (event: Event) => void\n\nexport type DialogLayerOptions = {\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n onOpenAutoFocus?: AutoFocusHandler\n onCloseAutoFocus?: AutoFocusHandler\n}\n\ntype FocusCycle = {\n content: HTMLElement\n opener: HTMLElement | null\n openerEligible: boolean\n closed: boolean\n focusMovedOutside: boolean\n closeAutoFocusScheduled: boolean\n /** Restore frames that found the opener still hidden; see FOCUS_RESTORE_FRAME_BUDGET. */\n hiddenFrames: number\n frame?: number\n fallbackTimer?: number\n observer?: MutationObserver\n onFocusIn: (event: FocusEvent) => void\n}\n\n/** The kit's dialog layers that are open now, so a closing layer can tell a newer one took over. */\nconst openLayers = new Set<HTMLElement>()\n\nfunction isVisible(element: HTMLElement) {\n return element.isConnected && element.getClientRects().length > 0\n}\n\nfunction canRestoreFocus(target: HTMLElement): boolean {\n return (\n target !== document.body &&\n target !== document.documentElement &&\n !target.closest('[inert], [aria-hidden=\"true\"]') &&\n !target.matches(':disabled') &&\n isVisible(target)\n )\n}\n\nfunction anotherLayerOpen(content: HTMLElement, opener: HTMLElement): boolean {\n for (const layer of openLayers) {\n if (\n layer !== content &&\n !content.contains(layer) &&\n !layer.contains(opener) &&\n !layer.closest('[aria-hidden=\"true\"], [inert]') &&\n isVisible(layer)\n ) {\n return true\n }\n }\n return false\n}\n\n/**\n * The focus-return half of the layer rules, for a layer whose open state is\n * `open`. Returns the autofocus handlers to give the Kobalte content.\n */\n/**\n * How many restore frames a closed layer may spend on an opener that is still\n * hidden. It counts frames, not time: Kobalte clears its own markers when the\n * overlay finishes unmounting, which on a loaded machine (WebKit in CI) can be\n * well over a second, and a frame count slows down with the page.\n */\nconst FOCUS_RESTORE_FRAME_BUDGET = 120\n\nexport function createDialogFocusReturn(\n open: Accessor<boolean>,\n options: DialogLayerOptions\n): { onOpenAutoFocus: AutoFocusHandler; onCloseAutoFocus: AutoFocusHandler } {\n const focusCycles = new WeakMap<HTMLElement, FocusCycle>()\n let activeFocusCycle: FocusCycle | undefined\n let pendingOpener: HTMLElement | null = null\n let pendingOpenerEligible = false\n\n // Captured while the open state changes, before Kobalte's effects move focus\n // into the layer and before a closing menu takes its row out of the page.\n createRenderEffect(() => {\n if (!open() || typeof document === 'undefined') {\n pendingOpener = null\n pendingOpenerEligible = false\n return\n }\n const active = options.restoreFocusRef?.() ?? document.activeElement\n pendingOpener = active instanceof HTMLElement ? active : null\n pendingOpenerEligible = active instanceof HTMLElement && canRestoreFocus(active)\n })\n\n const finishFocusCycle = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) window.cancelAnimationFrame(cycle.frame)\n if (cycle.fallbackTimer !== undefined) window.clearTimeout(cycle.fallbackTimer)\n cycle.observer?.disconnect()\n document.removeEventListener('focusin', cycle.onFocusIn)\n openLayers.delete(cycle.content)\n if (activeFocusCycle === cycle) activeFocusCycle = undefined\n }\n\n const markClosed = (cycle: FocusCycle) => {\n cycle.closed = true\n openLayers.delete(cycle.content)\n }\n\n const scheduleFocusRestore = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) return\n cycle.frame = window.requestAnimationFrame(() => {\n cycle.frame = undefined\n const opener = cycle.opener\n const active = document.activeElement\n const focusIsAvailable =\n active === document.body ||\n active === document.documentElement ||\n active === cycle.content ||\n (active instanceof Node && cycle.content.contains(active))\n if (\n activeFocusCycle !== cycle ||\n !cycle.closed ||\n cycle.focusMovedOutside ||\n !opener ||\n !isVisible(opener) ||\n opener.matches(':disabled') ||\n !focusIsAvailable ||\n anotherLayerOpen(cycle.content, opener)\n ) {\n finishFocusCycle(cycle)\n return\n }\n\n // Nothing to restore: stop watching the document now.\n if (!cycle.openerEligible) {\n finishFocusCycle(cycle)\n return\n }\n // Kobalte removes the `inert` / `aria-hidden` it put on the background\n // only after the layer unmounts; the observer below brings us back here.\n if (opener.closest('[inert], [aria-hidden=\"true\"]')) {\n cycle.hiddenFrames += 1\n if (cycle.hiddenFrames >= FOCUS_RESTORE_FRAME_BUDGET) finishFocusCycle(cycle)\n return\n }\n if (cycle.openerEligible && canRestoreFocus(opener)) {\n opener.focus({ preventScroll: true })\n }\n finishFocusCycle(cycle)\n })\n }\n\n const onOpenAutoFocus = (event: Event) => {\n const element = event.currentTarget\n if (element instanceof HTMLElement) {\n if (activeFocusCycle) finishFocusCycle(activeFocusCycle)\n\n const openerWasCaptured = pendingOpener !== null\n const opener = pendingOpener ?? document.activeElement\n const openerEligible = openerWasCaptured\n ? pendingOpenerEligible\n : opener instanceof HTMLElement && canRestoreFocus(opener)\n pendingOpener = null\n pendingOpenerEligible = false\n const openerElement = opener instanceof HTMLElement ? opener : null\n const cycle: FocusCycle = {\n content: element,\n opener: openerElement,\n openerEligible,\n closed: false,\n focusMovedOutside: false,\n closeAutoFocusScheduled: false,\n hiddenFrames: 0,\n onFocusIn: (focusEvent) => {\n const target = focusEvent.target\n if (\n !(target instanceof HTMLElement) ||\n target === document.body ||\n target === document.documentElement\n ) {\n return\n }\n if (target === element || element.contains(target) || target === openerElement) {\n if (!cycle.closed) cycle.focusMovedOutside = false\n return\n }\n cycle.focusMovedOutside = true\n },\n }\n focusCycles.set(element, cycle)\n activeFocusCycle = cycle\n openLayers.add(element)\n document.addEventListener('focusin', cycle.onFocusIn)\n }\n options.onOpenAutoFocus?.(event)\n }\n\n const onCloseAutoFocus = (event: Event) => {\n const element = event.currentTarget\n const cycle = element instanceof HTMLElement ? focusCycles.get(element) : undefined\n options.onCloseAutoFocus?.(event)\n\n if (!cycle) return\n markClosed(cycle)\n\n // A caller that prevents Kobalte's close autofocus owns the focus decision.\n if (event.defaultPrevented) {\n finishFocusCycle(cycle)\n return\n }\n\n if (cycle.fallbackTimer !== undefined) {\n window.clearTimeout(cycle.fallbackTimer)\n cycle.fallbackTimer = undefined\n }\n cycle.closeAutoFocusScheduled = true\n cycle.observer = new MutationObserver(() => scheduleFocusRestore(cycle))\n cycle.observer.observe(document.body, {\n attributes: true,\n attributeFilter: ['aria-hidden', 'inert'],\n childList: true,\n subtree: true,\n })\n // The observer watches every mutation in the document. If the opener stays\n // under an `inert` or `aria-hidden` that is not this layer's, a streaming\n // page would schedule a frame per DOM change for good, so the frames that\n // find it hidden are capped. A quiet page schedules none while it waits.\n scheduleFocusRestore(cycle)\n }\n\n onCleanup(() => {\n const cycle = activeFocusCycle\n if (!cycle) return\n markClosed(cycle)\n\n // Kobalte dispatches the close autofocus from a timer after unmount. If the\n // content never dispatches it, release the focus listener after that timer.\n queueMicrotask(() => {\n if (cycle.closeAutoFocusScheduled) return\n cycle.fallbackTimer = window.setTimeout(() => {\n cycle.fallbackTimer = undefined\n if (!cycle.closeAutoFocusScheduled) finishFocusCycle(cycle)\n }, 0)\n })\n })\n\n return { onOpenAutoFocus, onCloseAutoFocus }\n}\n\n/** The layer rules for a content rendered inside a Kobalte Dialog or AlertDialog root. */\nexport function createDialogLayer(options: DialogLayerOptions) {\n return createDialogFocusReturn(useDialogContext().isOpen, options)\n}\n\n/**\n * Lets an Escape swallowed by a tooltip inside the layer close the layer. The\n * content's own `onEscapeKeyDown` sees that Escape first, so a layer that\n * blocks Escape (a dirty form, a save in flight) stays blocked.\n */\nexport function DialogEscapeTarget(props: {\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n children?: JSX.Element\n}) {\n const dialog = useDialogContext()\n const dismiss = (event: KeyboardEvent) => {\n props.onEscapeKeyDown?.(event)\n if (!event.defaultPrevented) dialog.close()\n }\n return (\n <TooltipEscapeTargetContext.Provider value={{ element: dialog.contentRef, dismiss }}>\n {props.children}\n </TooltipEscapeTargetContext.Provider>\n )\n}\n"],"mappings":";;;;;;AA6CA,IAAMqB,6BAAa,IAAIC,IAAiB;AAExC,SAASC,UAAUC,SAAsB;CACvC,OAAOA,QAAQC,eAAeD,QAAQE,eAAe,CAAC,CAACC,SAAS;AAClE;AAEA,SAASC,gBAAgBC,QAA8B;CACrD,OACEA,WAAWC,SAASC,QACpBF,WAAWC,SAASE,mBACpB,CAACH,OAAOI,QAAQ,iCAA+B,KAC/C,CAACJ,OAAOK,QAAQ,WAAW,KAC3BX,UAAUM,MAAM;AAEpB;AAEA,SAASM,iBAAiB1B,SAAsBC,QAA8B;CAC5E,KAAK,MAAM0B,SAASf,YAClB,IACEe,UAAU3B,WACV,CAACA,QAAQ4B,SAASD,KAAK,KACvB,CAACA,MAAMC,SAAS3B,MAAM,KACtB,CAAC0B,MAAMH,QAAQ,iCAA+B,KAC9CV,UAAUa,KAAK,GAEf,OAAO;CAGX,OAAO;AACT;;;;;;;;;;;AAYA,IAAME,6BAA6B;AAEnC,SAAgBC,wBACdC,MACAC,SAC2E;CAC3E,MAAMC,8BAAc,IAAIC,QAAiC;CACzD,IAAIC;CACJ,IAAIC,gBAAoC;CACxC,IAAIC,wBAAwB;CAI5B7C,yBAAyB;EACvB,IAAI,CAACuC,K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C;CACD,MAAMG,SAASvF,iBAAiB;CAChC,MAAMwF,WAAWpF,UAAyB;EACxCgF,MAAMC,kBAAkBjF,KAAK;EAC7B,IAAI,CAACA,MAAMqE,kBAAkBc,OAAOE,MAAM;CAC5C;CACA,OAAAC,gBACGvF,2BAA2BwF,UAAQ;EAAA,IAACC,QAAK;GAAA,OAAE;IAAEpE,SAAS+D,OAAOM;IAAYL;GAAQ;EAAC;EAAA,IAAAF,WAAA;GAAA,OAChFF,MAAME;EAAQ;CAAA,CAAA;AAGrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/dialog/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,IAAI,aAAa,EACvB,OAAO,IAAI,oBAAoB,EAC/B,OAAO,IAAI,oBAAoB,EAChC,MAAM,sBAAsB,CAAA;AAG7B,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/dialog/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,IAAI,aAAa,EACvB,OAAO,IAAI,oBAAoB,EAC/B,OAAO,IAAI,oBAAoB,EAChC,MAAM,sBAAsB,CAAA;AAG7B,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAsB7D;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,IAAI,IAAI,MAAM,EACd,OAAO,IAAI,aAAa,EACxB,MAAM,IAAI,YAAY,GACvB,MAAM,sBAAsB,CAAA;AAE7B,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,oBAAoB,CAAC,eAK/E;AAED,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,oBAAoB,CAAC,GAAG;IAC7E;;;;OAIG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escription, overlayFooter, o
|
|
|
2
2
|
import { cn } from "../../../lib/utils.js";
|
|
3
3
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../tooltip/tooltip.js";
|
|
4
4
|
import { DialogEscapeTarget, createDialogLayer } from "./dialog-layer.js";
|
|
5
|
+
import { fastIcon } from "../../../lib/fast-icon.js";
|
|
5
6
|
import { className, createComponent, effect, insert, memo, mergeProps, spread, template } from "solid-js/web";
|
|
6
7
|
import { X } from "lucide-solid";
|
|
7
8
|
import { Show, children, splitProps } from "solid-js";
|
|
@@ -10,6 +11,7 @@ import { Content, Dialog, Overlay, Portal as DialogPortal, Root as Dialog$1, Tri
|
|
|
10
11
|
var _tmpl$ = /*#__PURE__*/ template(`<div>`);
|
|
11
12
|
var _tmpl$2 = /*#__PURE__*/ template(`<div data-slot=dialog-header>`);
|
|
12
13
|
var _tmpl$3 = /*#__PURE__*/ template(`<div data-slot=dialog-footer>`);
|
|
14
|
+
var X$1 = fastIcon(X);
|
|
13
15
|
function DialogOverlay(props) {
|
|
14
16
|
const [local, rest] = splitProps(props, ["class"]);
|
|
15
17
|
return createComponent(Overlay, mergeProps({ get ["class"]() {
|
|
@@ -82,7 +84,7 @@ function DialogContent(props) {
|
|
|
82
84
|
},
|
|
83
85
|
"class": overlayCornerClose,
|
|
84
86
|
get children() {
|
|
85
|
-
return closeButton() ?? createComponent(X, { "class": "size-4" });
|
|
87
|
+
return closeButton() ?? createComponent(X$1, { "class": "size-4" });
|
|
86
88
|
}
|
|
87
89
|
}), createComponent(TooltipContent, { get children() {
|
|
88
90
|
return memo(() => !!local.closeLabel)() ? `${local.closeLabel}.` : "Close dialog.";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":["KobalteDialog","KobalteDialogContent","KobalteDialogOverlay","X","children","resolveChildren","Show","splitProps","dialogSurface","overlayCornerClose","overlayDescription","overlayFooter","overlayHeader","overlayMotion","overlayPositioner","overlayScrim","overlayScrimMotion","overlayTitle","cn","Tooltip","TooltipContent","TooltipTrigger","createDialogLayer","DialogEscapeTarget","Portal","DialogOverlay","props","local","rest","_$createComponent","_$mergeProps","class","closeButton","closeLabel","positioner","size","initialFocus","restoreFocusRef","HTMLElement","dialogContentSizes","sm","md","lg","xl","DialogContent","layer","onOpenAutoFocus","event","defaultPrevented","currentTarget","preventDefault","focus","preventScroll","onCloseAutoFocus","_el$","_tmpl$","_$insert","onEscapeKeyDown","_$memo","when","as","CloseButton","_$effect","_$className","DialogHeader","band","_el$2","_tmpl$2","_$spread","DialogFooter","_el$3","_tmpl$3","DialogTitle","Title","DialogDescription","Description","DialogClose","DialogCloseButton"],"sources":["../../../../src/components/ui/dialog/dialog.tsx"],"sourcesContent":["import {\n Dialog as KobalteDialog,\n Content as KobalteDialogContent,\n Overlay as KobalteDialogOverlay,\n} from '@kobalte/core/dialog'\n// AlertDialog assigns to the shared DialogRoot.Content object, so these named exports stay role-stable.\nimport { X } from 'lucide-solid'\nimport type { Accessor, ComponentProps, JSX } from 'solid-js'\nimport { children as resolveChildren, Show, splitProps } from 'solid-js'\nimport {\n dialogSurface,\n overlayCornerClose,\n overlayDescription,\n overlayFooter,\n overlayHeader,\n overlayMotion,\n overlayPositioner,\n overlayScrim,\n overlayScrimMotion,\n overlayTitle,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip'\nimport { createDialogLayer, DialogEscapeTarget } from './dialog-layer'\n\n/**\n * Dialog.\n *\n * A modal surface for a decision or a short task. `Dialog.Portal` keeps the\n * panel out of the app's stacking and overflow contexts, `Dialog.Overlay`\n * dims what is behind it, and Kobalte handles the focus trap, the escape key\n * and scroll locking. Focus returns on close to whatever had it before the\n * dialog opened, trigger or not (pass `restoreFocusRef` when that control is\n * gone by then, such as a menu row).\n *\n * The close button is part of the content rather than optional, because every\n * modal needs a way out that is not the keyboard. A dialog whose only exit is\n * Escape is a trap for anyone using a pointer.\n */\nexport {\n Root as Dialog,\n Trigger as DialogTrigger,\n Portal as DialogPortal,\n} from '@kobalte/core/dialog'\n\nexport function DialogOverlay(props: ComponentProps<typeof KobalteDialogOverlay>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteDialogOverlay class={cn(overlayScrim, overlayScrimMotion, local.class)} {...rest} />\n )\n}\n\nexport type DialogContentProps = ComponentProps<typeof KobalteDialogContent> & {\n /**\n * Replaces the default close button. Pass `false` to remove it — only for a\n * dialog that cannot be dismissed (an update that must finish); anything the\n * user can escape from needs the button.\n */\n closeButton?: JSX.Element | false\n /**\n * The corner close's accessible name. Defaults to \"Close\". Name it for the\n * dialog (\"Close version and updates\") when the footer also has a text\n * \"Close\", so the two controls do not share one name.\n */\n closeLabel?: string\n /** Use a 1rem inset as the positioner bounds for tall, viewport-filling surfaces. */\n positioner?: 'default' | 'inset'\n /**\n * The panel's maximum width. `md` (32rem) is the default and right for a\n * confirmation or a short form; `sm` (28rem) for a single question; `lg`\n * (42rem) for a picker or a form with two columns; `xl` (48rem) for a\n * multi-step flow that needs a table or a preview beside its fields.\n */\n size?: DialogContentSize\n /**\n * Where focus lands on open. `first-control` (the default) is the first\n * tabbable control; `panel` focuses the panel itself, for a dialog whose\n * content should be read before an action is reached (an About box, an\n * update summary).\n */\n initialFocus?: 'first-control' | 'panel'\n /** The control to focus on close when the one focused before opening is gone by then. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n}\n\n/** The dialog width ladder, so a caller picks a rung instead of a `max-w-*`. */\nexport const dialogContentSizes = {\n sm: 'max-w-md',\n md: 'max-w-lg',\n lg: 'max-w-2xl',\n xl: 'max-w-3xl',\n} as const\n\nexport type DialogContentSize = keyof typeof dialogContentSizes\n\nexport function DialogContent(props: DialogContentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'children',\n 'closeButton',\n 'closeLabel',\n 'positioner',\n 'size',\n 'initialFocus',\n 'restoreFocusRef',\n 'onOpenAutoFocus',\n 'onCloseAutoFocus',\n ])\n const layer = createDialogLayer({\n restoreFocusRef: local.restoreFocusRef,\n onOpenAutoFocus: (event) => {\n local.onOpenAutoFocus?.(event)\n if (\n local.initialFocus === 'panel' &&\n !event.defaultPrevented &&\n event.currentTarget instanceof HTMLElement\n ) {\n event.preventDefault()\n event.currentTarget.focus({ preventScroll: true })\n }\n },\n onCloseAutoFocus: (event) => local.onCloseAutoFocus?.(event),\n })\n\n const closeButton = resolveChildren(() => local.closeButton)\n return (\n <KobalteDialog.Portal>\n <DialogOverlay />\n <div class={cn(overlayPositioner, local.positioner === 'inset' && 'inset-4 grid-rows-1 p-0')}>\n <KobalteDialogContent\n class={cn(\n dialogSurface,\n overlayMotion,\n 'relative grid max-h-full w-full gap-4 overflow-y-auto p-5',\n dialogContentSizes[local.size ?? 'md'],\n local.class\n )}\n {...rest}\n onOpenAutoFocus={layer.onOpenAutoFocus}\n onCloseAutoFocus={layer.onCloseAutoFocus}\n >\n <DialogEscapeTarget onEscapeKeyDown={props.onEscapeKeyDown}>\n {local.children}\n <Show when={closeButton() !== false}>\n {/* The corner close is icon-only, so it carries the shared tooltip\n treatment. */}\n <Tooltip>\n <TooltipTrigger\n as={KobalteDialog.CloseButton}\n data-slot=\"dialog-corner-close\"\n aria-label={local.closeLabel ?? 'Close'}\n class={overlayCornerClose}\n >\n {closeButton() ?? <X class=\"size-4\" />}\n </TooltipTrigger>\n <TooltipContent>\n {local.closeLabel ? `${local.closeLabel}.` : 'Close dialog.'}\n </TooltipContent>\n </Tooltip>\n </Show>\n </DialogEscapeTarget>\n </KobalteDialogContent>\n </div>\n </KobalteDialog.Portal>\n )\n}\n\n/**\n * The dialog's title block. `band` steps it onto the elevation ladder's\n * subtle-fill rung (`--muted`), the same treatment as the sheet parts' band —\n * for the dialog family whose panel anatomy matches a sheet's (a title band\n * over a full-bleed shell, such as a settings dialog) rather than the centred\n * modal's documented flat surface. See `SheetFooter` for the rung's rationale.\n */\nexport function DialogHeader(props: ComponentProps<'div'> & { band?: boolean }) {\n const [local, rest] = splitProps(props, ['class', 'band'])\n return (\n <div\n data-slot=\"dialog-header\"\n class={cn(overlayHeader, 'pe-6', { 'bg-muted': local.band }, local.class)}\n {...rest}\n />\n )\n}\n\nexport function DialogFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"dialog-footer\" class={cn(overlayFooter, local.class)} {...rest} />\n}\n\nexport function DialogTitle(props: ComponentProps<typeof KobalteDialog.Title>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.Title class={cn(overlayTitle, local.class)} {...rest} />\n}\n\nexport function DialogDescription(props: ComponentProps<typeof KobalteDialog.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.Description class={cn(overlayDescription, local.class)} {...rest} />\n}\n\n/**\n * A close control of the caller's own, polymorphic — for a footer's text\n * \"Cancel\" or \"Close\", which is a different control from the corner icon the\n * content draws. Take it as `as={Button}` so it carries the button's variants\n * rather than a copied class string.\n */\nexport function DialogClose(props: ComponentProps<typeof KobalteDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.CloseButton class={cn('focus-ring', local.class)} {...rest} />\n}\n\n/** The earlier name for `DialogClose`. */\nexport const DialogCloseButton = DialogClose\n"],"mappings":";;;;;;;;;;;;AA6CA,SAAgByB,cAAcC,OAAoD;CAChF,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACG3B,SAAoB4B,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQZ,GAAGH,cAAcC,oBAAoBW,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAE5F;;AAoCA,IAAaW,qBAAqB;CAChCC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;AACN;AAIA,SAAgBC,cAAclB,OAA2B;CACvD,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;E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SAAgBE,YAAY9C,OAAmD;CAC7E,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQ7B,OAAcyE,OAAK3C,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQZ,GAAGD,cAAcU,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAC5E;AAEA,SAAgB8C,kBAAkBhD,OAAyD;CACzF,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQ7B,OAAc2E,aAAW7C,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQZ,GAAGR,oBAAoBiB,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AACxF;;;;;;;AAQA,SAAgBgD,YAAYlD,OAAyD;CACnF,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQ7B,OAAc6D,aAAW/B,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQZ,GAAG,cAAcS,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAClF;;AAGA,IAAaiD,oBAAoBD"}
|
|
1
|
+
{"version":3,"file":"dialog.js","names":["KobalteDialog","KobalteDialogContent","KobalteDialogOverlay","X","LucideX","children","resolveChildren","Show","splitProps","dialogSurface","overlayCornerClose","overlayDescription","overlayFooter","overlayHeader","overlayMotion","overlayPositioner","overlayScrim","overlayScrimMotion","overlayTitle","cn","Tooltip","TooltipContent","TooltipTrigger","createDialogLayer","DialogEscapeTarget","fastIcon","Portal","DialogOverlay","props","local","rest","_$createComponent","_$mergeProps","class","closeButton","closeLabel","positioner","size","initialFocus","restoreFocusRef","HTMLElement","dialogContentSizes","sm","md","lg","xl","DialogContent","layer","onOpenAutoFocus","event","defaultPrevented","currentTarget","preventDefault","focus","preventScroll","onCloseAutoFocus","_el$","_tmpl$","_$insert","onEscapeKeyDown","_$memo","when","as","CloseButton","_$effect","_$className","DialogHeader","band","_el$2","_tmpl$2","_$spread","DialogFooter","_el$3","_tmpl$3","DialogTitle","Title","DialogDescription","Description","DialogClose","DialogCloseButton"],"sources":["../../../../src/components/ui/dialog/dialog.tsx"],"sourcesContent":["import {\n Dialog as KobalteDialog,\n Content as KobalteDialogContent,\n Overlay as KobalteDialogOverlay,\n} from '@kobalte/core/dialog'\n// AlertDialog assigns to the shared DialogRoot.Content object, so these named exports stay role-stable.\nimport { X as LucideX } from 'lucide-solid'\nimport type { Accessor, ComponentProps, JSX } from 'solid-js'\nimport { children as resolveChildren, Show, splitProps } from 'solid-js'\nimport {\n dialogSurface,\n overlayCornerClose,\n overlayDescription,\n overlayFooter,\n overlayHeader,\n overlayMotion,\n overlayPositioner,\n overlayScrim,\n overlayScrimMotion,\n overlayTitle,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip'\nimport { createDialogLayer, DialogEscapeTarget } from './dialog-layer'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst X = fastIcon(LucideX)\n\n/**\n * Dialog.\n *\n * A modal surface for a decision or a short task. `Dialog.Portal` keeps the\n * panel out of the app's stacking and overflow contexts, `Dialog.Overlay`\n * dims what is behind it, and Kobalte handles the focus trap, the escape key\n * and scroll locking. Focus returns on close to whatever had it before the\n * dialog opened, trigger or not (pass `restoreFocusRef` when that control is\n * gone by then, such as a menu row).\n *\n * The close button is part of the content rather than optional, because every\n * modal needs a way out that is not the keyboard. A dialog whose only exit is\n * Escape is a trap for anyone using a pointer.\n */\nexport {\n Root as Dialog,\n Trigger as DialogTrigger,\n Portal as DialogPortal,\n} from '@kobalte/core/dialog'\n\nexport function DialogOverlay(props: ComponentProps<typeof KobalteDialogOverlay>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteDialogOverlay class={cn(overlayScrim, overlayScrimMotion, local.class)} {...rest} />\n )\n}\n\nexport type DialogContentProps = ComponentProps<typeof KobalteDialogContent> & {\n /**\n * Replaces the default close button. Pass `false` to remove it — only for a\n * dialog that cannot be dismissed (an update that must finish); anything the\n * user can escape from needs the button.\n */\n closeButton?: JSX.Element | false\n /**\n * The corner close's accessible name. Defaults to \"Close\". Name it for the\n * dialog (\"Close version and updates\") when the footer also has a text\n * \"Close\", so the two controls do not share one name.\n */\n closeLabel?: string\n /** Use a 1rem inset as the positioner bounds for tall, viewport-filling surfaces. */\n positioner?: 'default' | 'inset'\n /**\n * The panel's maximum width. `md` (32rem) is the default and right for a\n * confirmation or a short form; `sm` (28rem) for a single question; `lg`\n * (42rem) for a picker or a form with two columns; `xl` (48rem) for a\n * multi-step flow that needs a table or a preview beside its fields.\n */\n size?: DialogContentSize\n /**\n * Where focus lands on open. `first-control` (the default) is the first\n * tabbable control; `panel` focuses the panel itself, for a dialog whose\n * content should be read before an action is reached (an About box, an\n * update summary).\n */\n initialFocus?: 'first-control' | 'panel'\n /** The control to focus on close when the one focused before opening is gone by then. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n}\n\n/** The dialog width ladder, so a caller picks a rung instead of a `max-w-*`. */\nexport const dialogContentSizes = {\n sm: 'max-w-md',\n md: 'max-w-lg',\n lg: 'max-w-2xl',\n xl: 'max-w-3xl',\n} as const\n\nexport type DialogContentSize = keyof typeof dialogContentSizes\n\nexport function DialogContent(props: DialogContentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'children',\n 'closeButton',\n 'closeLabel',\n 'positioner',\n 'size',\n 'initialFocus',\n 'restoreFocusRef',\n 'onOpenAutoFocus',\n 'onCloseAutoFocus',\n ])\n const layer = createDialogLayer({\n restoreFocusRef: local.restoreFocusRef,\n onOpenAutoFocus: (event) => {\n local.onOpenAutoFocus?.(event)\n if (\n local.initialFocus === 'panel' &&\n !event.defaultPrevented &&\n event.currentTarget instanceof HTMLElement\n ) {\n event.preventDefault()\n event.currentTarget.focus({ preventScroll: true })\n }\n },\n onCloseAutoFocus: (event) => local.onCloseAutoFocus?.(event),\n })\n\n const closeButton = resolveChildren(() => local.closeButton)\n return (\n <KobalteDialog.Portal>\n <DialogOverlay />\n <div class={cn(overlayPositioner, local.positioner === 'inset' && 'inset-4 grid-rows-1 p-0')}>\n <KobalteDialogContent\n class={cn(\n dialogSurface,\n overlayMotion,\n 'relative grid max-h-full w-full gap-4 overflow-y-auto p-5',\n dialogContentSizes[local.size ?? 'md'],\n local.class\n )}\n {...rest}\n onOpenAutoFocus={layer.onOpenAutoFocus}\n onCloseAutoFocus={layer.onCloseAutoFocus}\n >\n <DialogEscapeTarget onEscapeKeyDown={props.onEscapeKeyDown}>\n {local.children}\n <Show when={closeButton() !== false}>\n {/* The corner close is icon-only, so it carries the shared tooltip\n treatment. */}\n <Tooltip>\n <TooltipTrigger\n as={KobalteDialog.CloseButton}\n data-slot=\"dialog-corner-close\"\n aria-label={local.closeLabel ?? 'Close'}\n class={overlayCornerClose}\n >\n {closeButton() ?? <X class=\"size-4\" />}\n </TooltipTrigger>\n <TooltipContent>\n {local.closeLabel ? `${local.closeLabel}.` : 'Close dialog.'}\n </TooltipContent>\n </Tooltip>\n </Show>\n </DialogEscapeTarget>\n </KobalteDialogContent>\n </div>\n </KobalteDialog.Portal>\n )\n}\n\n/**\n * The dialog's title block. `band` steps it onto the elevation ladder's\n * subtle-fill rung (`--muted`), the same treatment as the sheet parts' band —\n * for the dialog family whose panel anatomy matches a sheet's (a title band\n * over a full-bleed shell, such as a settings dialog) rather than the centred\n * modal's documented flat surface. See `SheetFooter` for the rung's rationale.\n */\nexport function DialogHeader(props: ComponentProps<'div'> & { band?: boolean }) {\n const [local, rest] = splitProps(props, ['class', 'band'])\n return (\n <div\n data-slot=\"dialog-header\"\n class={cn(overlayHeader, 'pe-6', { 'bg-muted': local.band }, local.class)}\n {...rest}\n />\n )\n}\n\nexport function DialogFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"dialog-footer\" class={cn(overlayFooter, local.class)} {...rest} />\n}\n\nexport function DialogTitle(props: ComponentProps<typeof KobalteDialog.Title>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.Title class={cn(overlayTitle, local.class)} {...rest} />\n}\n\nexport function DialogDescription(props: ComponentProps<typeof KobalteDialog.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.Description class={cn(overlayDescription, local.class)} {...rest} />\n}\n\n/**\n * A close control of the caller's own, polymorphic — for a footer's text\n * \"Cancel\" or \"Close\", which is a different control from the corner icon the\n * content draws. Take it as `as={Button}` so it carries the button's variants\n * rather than a copied class string.\n */\nexport function DialogClose(props: ComponentProps<typeof KobalteDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.CloseButton class={cn('focus-ring', local.class)} {...rest} />\n}\n\n/** The earlier name for `DialogClose`. */\nexport const DialogCloseButton = DialogClose\n"],"mappings":";;;;;;;;;;;;;AA2BA,IAAMG,MAAIsB,SAASrB,CAAO;AAsB1B,SAAgBuB,cAAcC,OAAoD;CAChF,MAAM,CAACC,OAAOC,QAAQtB,WAAWoB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACG7B,SAAoB8B,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQb,GAAGH,cAAcC,oBAAoBY,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAE5F;;AAoCA,IAAaW,qBAAqB;CAChCC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;AACN;AAIA,SAAgBC,cAAclB,OAA2B;CACvD,MAAM,CAACC,OAAOC,QAAQtB,WAAWoB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAkB,CACnB;CACD,MAAMmB,QAAQxB,kBAAkB;EAC9BgB,iBAAiBV,MAAMU;EACvBS,kBAAkBC,UAAU;GAC1BpB,MAAMmB,kBAAkBC,KAAK;GAC7B,IACE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EAAA,KAAA,WAAA;EAAA,OAAQb,GAAGD,cAAcW,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAC5E;AAEA,SAAgB8C,kBAAkBhD,OAAyD;CACzF,MAAM,CAACC,OAAOC,QAAQtB,WAAWoB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQ/B,OAAc6E,aAAW7C,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQb,GAAGR,oBAAoBkB,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AACxF;;;;;;;AAQA,SAAgBgD,YAAYlD,OAAyD;CACnF,MAAM,CAACC,OAAOC,QAAQtB,WAAWoB,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQ/B,OAAc+D,aAAW/B,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQb,GAAG,cAAcU,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AAClF;;AAGA,IAAaiD,oBAAoBD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-parts.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/dropdown-menu/menu-parts.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"menu-parts.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/dropdown-menu/menu-parts.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAMtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,OAAO,EAWL,KAAK,cAAc,EACpB,MAAM,cAAc,CAAA;AASrB;;;;;GAKG;AACH,KAAK,cAAc,GAAG,IAAI,CACxB,OAAO,mBAAmB,EACxB,MAAM,GACN,cAAc,GACd,WAAW,GACX,eAAe,GACf,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,QAAQ,CACX,CAAA;AAED,0EAA0E;AAC1E,eAAO,MAAM,SAAS,QAKrB,CAAA;AAED,MAAM,MAAM,aAAa,CAAC,IAAI,IAAI,IAAI,GAAG;IACvC,qEAAqE;IACrE,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;IACnC,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;8BAE0B;IAC1B,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,mBAAmB,CAAC,IAAI,IAAI,IAAI,GAAG;IAC7C;wCACoC;IACpC,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB,CAAA;AAUD,wBAAgB,eAAe,CAC7B,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,eAAe,GAAG,cAAc,GAAG,SAAS;kBAI/B,aAAa,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;sBAqC1D,cAAc,CAAC,MAAM,CAAC;0BAetC,mBAAmB,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,YAAY,CAAC,CAAC;uBAmB5E,mBAAmB,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,SAAS,CAAC,CAAC;mBA0B5D,cAAc,CAAC,OAAO,mBAAmB,CAAC,UAAU,CAAC;uBAMjD,cAAc,CAAC,OAAO,mBAAmB,CAAC,SAAS,CAAC;wBAMnD,cAAc,CAAC,OAAO,mBAAmB,CAAC,UAAU,CAAC;wBAWrD,cAAc,CAAC,OAAO,mBAAmB,CAAC,UAAU,CAAC;EAejF"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { destructiveMenuItem, menuItem, menuLabel, menuSeparator, menuShortcut, menuSwatchTone, overlayMotion, overlaySurface, topLayerProps } from "../../../lib/overlay.js";
|
|
2
2
|
import { cn } from "../../../lib/utils.js";
|
|
3
|
+
import { fastIcon } from "../../../lib/fast-icon.js";
|
|
3
4
|
import { className, createComponent, effect, insert, memo, mergeProps, setAttribute, spread, template } from "solid-js/web";
|
|
4
5
|
import { Check, ChevronRight, Circle } from "lucide-solid";
|
|
5
6
|
import { Show, splitProps } from "solid-js";
|
|
6
7
|
// src/components/ui/dropdown-menu/menu-parts.tsx
|
|
7
8
|
var _tmpl$ = /*#__PURE__*/ template(`<span aria-hidden=true>`);
|
|
9
|
+
var Check$1 = fastIcon(Check);
|
|
10
|
+
var ChevronRight$1 = fastIcon(ChevronRight);
|
|
11
|
+
var Circle$1 = fastIcon(Circle);
|
|
8
12
|
/** The floating panel of a menu or submenu; `min-w-*` is the caller's. */
|
|
9
13
|
var menuPanel = cn(overlaySurface, overlayMotion, "z-(--z-menu) origin-(--kb-menu-content-transform-origin) overflow-hidden", "p-1");
|
|
10
14
|
function Swatch(props) {
|
|
@@ -89,7 +93,7 @@ function createMenuParts(Menu, family) {
|
|
|
89
93
|
"data-slot": indicatorSlot,
|
|
90
94
|
"class": "absolute end-2 flex size-4 items-center justify-center text-primary",
|
|
91
95
|
get children() {
|
|
92
|
-
return createComponent(Check, { "class": "size-4" });
|
|
96
|
+
return createComponent(Check$1, { "class": "size-4" });
|
|
93
97
|
}
|
|
94
98
|
})
|
|
95
99
|
];
|
|
@@ -114,7 +118,7 @@ function createMenuParts(Menu, family) {
|
|
|
114
118
|
"data-slot": indicatorSlot,
|
|
115
119
|
"class": "absolute end-2 flex size-4 items-center justify-center text-primary",
|
|
116
120
|
get children() {
|
|
117
|
-
return createComponent(Circle, { "class": "size-2 fill-current" });
|
|
121
|
+
return createComponent(Circle$1, { "class": "size-2 fill-current" });
|
|
118
122
|
}
|
|
119
123
|
})
|
|
120
124
|
];
|
|
@@ -148,7 +152,7 @@ function createMenuParts(Menu, family) {
|
|
|
148
152
|
return createComponent(SubTriggerPrimitive, mergeProps({ get ["class"]() {
|
|
149
153
|
return cn(menuItem, local.class);
|
|
150
154
|
} }, rest, { get children() {
|
|
151
|
-
return [memo(() => local.children), createComponent(ChevronRight, { "class": "ms-auto size-4" })];
|
|
155
|
+
return [memo(() => local.children), createComponent(ChevronRight$1, { "class": "ms-auto size-4" })];
|
|
152
156
|
} }));
|
|
153
157
|
}
|
|
154
158
|
function SubContent(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-parts.js","names":["Check","ChevronRight","Circle","Show","splitProps","destructiveMenuItem","menuItem","menuLabel","menuSeparator","menuShortcut","menuSwatchTone","overlayMotion","overlaySurface","topLayerProps","cn","menuPanel","Item","variant","shortcut","keyshortcuts","swatch","Swatch","props","tone","_$createComponent","when","children","_el$","_tmpl$","_$effect","_$className","createMenuParts","Menu","family","indicatorSlot","ItemPrimitive","local","rest","_$mergeProps","class","_$memo","_el$2","_$insert","Shortcut","_el$3","_$setAttribute","_$spread","CheckboxItem","CheckboxItemPrimitive","ItemIndicator","RadioItem","RadioItemPrimitive","Label","GroupLabel","Separator","SeparatorPrimitive","SubTrigger","SubTriggerPrimitive","SubContent","SubContentPrimitive","Portal"],"sources":["../../../../src/components/ui/dropdown-menu/menu-parts.tsx"],"sourcesContent":["import type { DropdownMenu as KobalteDropdownMenu } from '@kobalte/core/dropdown-menu'\nimport { Check, ChevronRight, Circle } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport {\n destructiveMenuItem,\n menuContentPadding,\n menuItem,\n menuLabel,\n menuSeparator,\n menuShortcut,\n menuSwatchTone,\n overlayMotion,\n overlaySurface,\n topLayerProps,\n type MenuSwatchTone,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * The rows and panels every Kobalte menu family draws alike: DropdownMenu,\n * ContextMenu and Menubar. Kobalte builds all three from the same menu\n * primitives; each family passes its own namespace and keeps its own exported\n * names, so a row looks and reads the same whichever menu it is in.\n */\ntype MenuPrimitives = Pick<\n typeof KobalteDropdownMenu,\n | 'Item'\n | 'CheckboxItem'\n | 'RadioItem'\n | 'ItemIndicator'\n | 'GroupLabel'\n | 'Separator'\n | 'SubTrigger'\n | 'SubContent'\n | 'Portal'\n>\n\n/** The floating panel of a menu or submenu; `min-w-*` is the caller's. */\nexport const menuPanel = cn(\n overlaySurface,\n overlayMotion,\n 'z-(--z-menu) origin-(--kb-menu-content-transform-origin) overflow-hidden',\n menuContentPadding\n)\n\nexport type MenuItemProps<Item> = Item & {\n /** Colour the row as a destructive action. Confirm it separately. */\n variant?: 'default' | 'destructive'\n /** Draw a shortcut hint at the trailing edge of the row. */\n shortcut?: string\n /**\n * The parseable chord behind `shortcut`, e.g. `Meta+E`. The drawn glyph is\n * `aria-hidden`, reading it out would pollute the item's accessible name,\n * so this is what assistive technology announces instead. Supply it\n * whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n /** Draw a leading colour dot from the shared tone ladder, the accent or\n * status role the option's card badge carries. `aria-hidden`; the label\n * carries the meaning. */\n swatch?: MenuSwatchTone\n}\n\nexport type MenuChoiceItemProps<Item> = Item & {\n /** Draw a leading colour dot from the shared tone ladder. `aria-hidden`;\n * the label carries the meaning. */\n swatch?: MenuSwatchTone\n}\n\nfunction Swatch(props: { tone: MenuSwatchTone | undefined }) {\n return (\n <Show when={props.tone}>\n <span aria-hidden=\"true\" class={menuSwatchTone({ tone: props.tone })} />\n </Show>\n )\n}\n\nexport function createMenuParts(\n Menu: MenuPrimitives,\n family: 'dropdown-menu' | 'context-menu' | 'menubar'\n) {\n const indicatorSlot = `${family}-indicator`\n\n function Item(props: MenuItemProps<ComponentProps<typeof KobalteDropdownMenu.Item>>) {\n const ItemPrimitive = Menu.Item\n const [local, rest] = splitProps(props, [\n 'class',\n 'variant',\n 'shortcut',\n 'keyshortcuts',\n 'swatch',\n 'children',\n ])\n return (\n <ItemPrimitive\n class={cn(\n menuItem,\n { [destructiveMenuItem]: local.variant === 'destructive' },\n local.class\n )}\n aria-keyshortcuts={local.keyshortcuts}\n {...rest}\n >\n <Swatch tone={local.swatch} />\n {local.children}\n {local.shortcut ? (\n <span aria-hidden=\"true\" class={menuShortcut}>\n {local.shortcut}\n </span>\n ) : null}\n </ItemPrimitive>\n )\n }\n\n /**\n * The chord drawn at a row's trailing edge, for a caller composing a row by\n * hand. The glyphs are decorative: the span is `aria-hidden` and the\n * parseable chord belongs in the row's `aria-keyshortcuts`, so the item's\n * accessible name stays exactly its label.\n */\n function Shortcut(props: ComponentProps<'span'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <span\n data-slot={`${family}-shortcut`}\n aria-hidden=\"true\"\n class={cn(menuShortcut, local.class)}\n {...rest}\n />\n )\n }\n\n // Selection indicators read in the accent, like every other selected state\n // in the system, a canvas-coloured mark on a checked row reads as decoration.\n function CheckboxItem(\n props: MenuChoiceItemProps<ComponentProps<typeof KobalteDropdownMenu.CheckboxItem>>\n ) {\n const { CheckboxItem: CheckboxItemPrimitive, ItemIndicator } = Menu\n const [local, rest] = splitProps(props, ['class', 'swatch', 'children'])\n return (\n <CheckboxItemPrimitive class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <Swatch tone={local.swatch} />\n {local.children}\n <ItemIndicator\n data-slot={indicatorSlot}\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </ItemIndicator>\n </CheckboxItemPrimitive>\n )\n }\n\n function RadioItem(\n props: MenuChoiceItemProps<ComponentProps<typeof KobalteDropdownMenu.RadioItem>>\n ) {\n const { RadioItem: RadioItemPrimitive, ItemIndicator } = Menu\n const [local, rest] = splitProps(props, ['class', 'swatch', 'children'])\n return (\n <RadioItemPrimitive class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <Swatch tone={local.swatch} />\n {local.children}\n <ItemIndicator\n data-slot={indicatorSlot}\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Circle class=\"size-2 fill-current\" />\n </ItemIndicator>\n </RadioItemPrimitive>\n )\n }\n\n /**\n * The caption of a group, and that group's accessible name. It must be a\n * child of the group it names: Kobalte reads the group from context, so a\n * label placed directly in the content throws `useMenuGroupContext must be\n * used within a Menu.Group` the moment the menu opens. For an ungrouped\n * caption, wrap the label and its items in a group anyway, the grouping is\n * what a screen reader announces.\n */\n function Label(props: ComponentProps<typeof KobalteDropdownMenu.GroupLabel>) {\n const GroupLabel = Menu.GroupLabel\n const [local, rest] = splitProps(props, ['class'])\n return <GroupLabel class={cn(menuLabel, local.class)} {...rest} />\n }\n\n function Separator(props: ComponentProps<typeof KobalteDropdownMenu.Separator>) {\n const SeparatorPrimitive = Menu.Separator\n const [local, rest] = splitProps(props, ['class'])\n return <SeparatorPrimitive class={cn(menuSeparator, local.class)} {...rest} />\n }\n\n function SubTrigger(props: ComponentProps<typeof KobalteDropdownMenu.SubTrigger>) {\n const SubTriggerPrimitive = Menu.SubTrigger\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <SubTriggerPrimitive class={cn(menuItem, local.class)} {...rest}>\n {local.children}\n <ChevronRight class=\"ms-auto size-4\" />\n </SubTriggerPrimitive>\n )\n }\n\n function SubContent(props: ComponentProps<typeof KobalteDropdownMenu.SubContent>) {\n const { SubContent: SubContentPrimitive, Portal } = Menu\n const [local, rest] = splitProps(props, ['class'])\n return (\n <Portal>\n <SubContentPrimitive\n {...topLayerProps}\n class={cn(menuPanel, 'min-w-[8rem]', local.class)}\n {...rest}\n />\n </Portal>\n )\n }\n\n return { Item, Shortcut, CheckboxItem, RadioItem, Label, Separator, SubTrigger, SubContent }\n}\n"],"mappings":";;;;;;;;AAuCA,IAAae,YAAYD,GACvBF,gBACAD,eACA,4EAAA,KAEF;AA0BA,SAASU,OAAOC,OAA6C;CAC3D,OAAAE,gBACGrB,MAAI;EAAA,IAACsB,OAAI;GAAA,OAAEH,MAAMC;EAAI;EAAA,IAAAG,WAAA;GAAA,IAAAC,OAAAC,OAAA;GAAAC,aAAAC,UAAAH,MACYjB,eAAe,EAAEa,MAAMD,MAAMC,KAAK,CA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I,CAAA;EAAA,EAAA,CAAA;CAIhB;CAEA,OAAO;EAAErB;EAAM2B;EAAUI;EAAcG;EAAWE;EAAOE;EAAWE;EAAYE;CAAW;AAC7F"}
|
|
1
|
+
{"version":3,"file":"menu-parts.js","names":["Check","LucideCheck","ChevronRight","LucideChevronRight","Circle","LucideCircle","Show","splitProps","destructiveMenuItem","menuItem","menuLabel","menuSeparator","menuShortcut","menuSwatchTone","overlayMotion","overlaySurface","topLayerProps","cn","fastIcon","menuPanel","Item","variant","shortcut","keyshortcuts","swatch","Swatch","props","tone","_$createComponent","when","children","_el$","_tmpl$","_$effect","_$className","createMenuParts","Menu","family","indicatorSlot","ItemPrimitive","local","rest","_$mergeProps","class","_$memo","_el$2","_$insert","Shortcut","_el$3","_$setAttribute","_$spread","CheckboxItem","CheckboxItemPrimitive","ItemIndicator","RadioItem","RadioItemPrimitive","Label","GroupLabel","Separator","SeparatorPrimitive","SubTrigger","SubTriggerPrimitive","SubContent","SubContentPrimitive","Portal"],"sources":["../../../../src/components/ui/dropdown-menu/menu-parts.tsx"],"sourcesContent":["import type { DropdownMenu as KobalteDropdownMenu } from '@kobalte/core/dropdown-menu'\nimport {\n Check as LucideCheck,\n ChevronRight as LucideChevronRight,\n Circle as LucideCircle,\n} from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport {\n destructiveMenuItem,\n menuContentPadding,\n menuItem,\n menuLabel,\n menuSeparator,\n menuShortcut,\n menuSwatchTone,\n overlayMotion,\n overlaySurface,\n topLayerProps,\n type MenuSwatchTone,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst Check = fastIcon(LucideCheck)\nconst ChevronRight = fastIcon(LucideChevronRight)\nconst Circle = fastIcon(LucideCircle)\n\n/**\n * The rows and panels every Kobalte menu family draws alike: DropdownMenu,\n * ContextMenu and Menubar. Kobalte builds all three from the same menu\n * primitives; each family passes its own namespace and keeps its own exported\n * names, so a row looks and reads the same whichever menu it is in.\n */\ntype MenuPrimitives = Pick<\n typeof KobalteDropdownMenu,\n | 'Item'\n | 'CheckboxItem'\n | 'RadioItem'\n | 'ItemIndicator'\n | 'GroupLabel'\n | 'Separator'\n | 'SubTrigger'\n | 'SubContent'\n | 'Portal'\n>\n\n/** The floating panel of a menu or submenu; `min-w-*` is the caller's. */\nexport const menuPanel = cn(\n overlaySurface,\n overlayMotion,\n 'z-(--z-menu) origin-(--kb-menu-content-transform-origin) overflow-hidden',\n menuContentPadding\n)\n\nexport type MenuItemProps<Item> = Item & {\n /** Colour the row as a destructive action. Confirm it separately. */\n variant?: 'default' | 'destructive'\n /** Draw a shortcut hint at the trailing edge of the row. */\n shortcut?: string\n /**\n * The parseable chord behind `shortcut`, e.g. `Meta+E`. The drawn glyph is\n * `aria-hidden`, reading it out would pollute the item's accessible name,\n * so this is what assistive technology announces instead. Supply it\n * whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n /** Draw a leading colour dot from the shared tone ladder, the accent or\n * status role the option's card badge carries. `aria-hidden`; the label\n * carries the meaning. */\n swatch?: MenuSwatchTone\n}\n\nexport type MenuChoiceItemProps<Item> = Item & {\n /** Draw a leading colour dot from the shared tone ladder. `aria-hidden`;\n * the label carries the meaning. */\n swatch?: MenuSwatchTone\n}\n\nfunction Swatch(props: { tone: MenuSwatchTone | undefined }) {\n return (\n <Show when={props.tone}>\n <span aria-hidden=\"true\" class={menuSwatchTone({ tone: props.tone })} />\n </Show>\n )\n}\n\nexport function createMenuParts(\n Menu: MenuPrimitives,\n family: 'dropdown-menu' | 'context-menu' | 'menubar'\n) {\n const indicatorSlot = `${family}-indicator`\n\n function Item(props: MenuItemProps<ComponentProps<typeof KobalteDropdownMenu.Item>>) {\n const ItemPrimitive = Menu.Item\n const [local, rest] = splitProps(props, [\n 'class',\n 'variant',\n 'shortcut',\n 'keyshortcuts',\n 'swatch',\n 'children',\n ])\n return (\n <ItemPrimitive\n class={cn(\n menuItem,\n { [destructiveMenuItem]: local.variant === 'destructive' },\n local.class\n )}\n aria-keyshortcuts={local.keyshortcuts}\n {...rest}\n >\n <Swatch tone={local.swatch} />\n {local.children}\n {local.shortcut ? (\n <span aria-hidden=\"true\" class={menuShortcut}>\n {local.shortcut}\n </span>\n ) : null}\n </ItemPrimitive>\n )\n }\n\n /**\n * The chord drawn at a row's trailing edge, for a caller composing a row by\n * hand. The glyphs are decorative: the span is `aria-hidden` and the\n * parseable chord belongs in the row's `aria-keyshortcuts`, so the item's\n * accessible name stays exactly its label.\n */\n function Shortcut(props: ComponentProps<'span'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <span\n data-slot={`${family}-shortcut`}\n aria-hidden=\"true\"\n class={cn(menuShortcut, local.class)}\n {...rest}\n />\n )\n }\n\n // Selection indicators read in the accent, like every other selected state\n // in the system, a canvas-coloured mark on a checked row reads as decoration.\n function CheckboxItem(\n props: MenuChoiceItemProps<ComponentProps<typeof KobalteDropdownMenu.CheckboxItem>>\n ) {\n const { CheckboxItem: CheckboxItemPrimitive, ItemIndicator } = Menu\n const [local, rest] = splitProps(props, ['class', 'swatch', 'children'])\n return (\n <CheckboxItemPrimitive class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <Swatch tone={local.swatch} />\n {local.children}\n <ItemIndicator\n data-slot={indicatorSlot}\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </ItemIndicator>\n </CheckboxItemPrimitive>\n )\n }\n\n function RadioItem(\n props: MenuChoiceItemProps<ComponentProps<typeof KobalteDropdownMenu.RadioItem>>\n ) {\n const { RadioItem: RadioItemPrimitive, ItemIndicator } = Menu\n const [local, rest] = splitProps(props, ['class', 'swatch', 'children'])\n return (\n <RadioItemPrimitive class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <Swatch tone={local.swatch} />\n {local.children}\n <ItemIndicator\n data-slot={indicatorSlot}\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Circle class=\"size-2 fill-current\" />\n </ItemIndicator>\n </RadioItemPrimitive>\n )\n }\n\n /**\n * The caption of a group, and that group's accessible name. It must be a\n * child of the group it names: Kobalte reads the group from context, so a\n * label placed directly in the content throws `useMenuGroupContext must be\n * used within a Menu.Group` the moment the menu opens. For an ungrouped\n * caption, wrap the label and its items in a group anyway, the grouping is\n * what a screen reader announces.\n */\n function Label(props: ComponentProps<typeof KobalteDropdownMenu.GroupLabel>) {\n const GroupLabel = Menu.GroupLabel\n const [local, rest] = splitProps(props, ['class'])\n return <GroupLabel class={cn(menuLabel, local.class)} {...rest} />\n }\n\n function Separator(props: ComponentProps<typeof KobalteDropdownMenu.Separator>) {\n const SeparatorPrimitive = Menu.Separator\n const [local, rest] = splitProps(props, ['class'])\n return <SeparatorPrimitive class={cn(menuSeparator, local.class)} {...rest} />\n }\n\n function SubTrigger(props: ComponentProps<typeof KobalteDropdownMenu.SubTrigger>) {\n const SubTriggerPrimitive = Menu.SubTrigger\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <SubTriggerPrimitive class={cn(menuItem, local.class)} {...rest}>\n {local.children}\n <ChevronRight class=\"ms-auto size-4\" />\n </SubTriggerPrimitive>\n )\n }\n\n function SubContent(props: ComponentProps<typeof KobalteDropdownMenu.SubContent>) {\n const { SubContent: SubContentPrimitive, Portal } = Menu\n const [local, rest] = splitProps(props, ['class'])\n return (\n <Portal>\n <SubContentPrimitive\n {...topLayerProps}\n class={cn(menuPanel, 'min-w-[8rem]', local.class)}\n {...rest}\n />\n </Portal>\n )\n }\n\n return { Item, Shortcut, CheckboxItem, RadioItem, Label, Separator, SubTrigger, SubContent }\n}\n"],"mappings":";;;;;;;;AAyBA,IAAMA,UAAQkB,SAASjB,KAAW;AAClC,IAAMC,iBAAegB,SAASf,YAAkB;AAChD,IAAMC,WAASc,SAASb,MAAY;;AAsBpC,IAAac,YAAYF,GACvBF,gBACAD,eACA,4EAAA,KAEF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AAWmB,OAAO,CAAC,OAAO,CAAC;EACjD,OAAAE,gBACGoC,QAAM,EAAA,IAAAlC,WAAA;GAAA,OAAAF,gBACJmC,qBAAmBrB,WACd1B,eAAa,EAAA,KAAA,WAAA;IAAA,OACVC,GAAGE,WAAW,gBAAgBqB,MAAMG,KAAK;GAAC,EAAA,GAC7CF,IAAI,CAAA;EAAA,EAAA,CAAA;CAIhB;CAEA,OAAO;EAAErB;EAAM2B;EAAUI;EAAcG;EAAWE;EAAOE;EAAWE;EAAYE;CAAW;AAC7F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/empty/empty-state.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/empty/empty-state.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAWnD,KAAK,yBAAyB,GAC1B;IACE,eAAe,CAAC,EAAE,SAAS,CAAA;IAC3B,oBAAoB,CAAC,EAAE,SAAS,CAAA;IAChC,sBAAsB,CAAC,EAAE,KAAK,CAAA;CAC/B,GACD;IACE,kFAAkF;IAClF,eAAe,EAAE,MAAM,IAAI,CAAA;IAC3B,kFAAkF;IAClF,oBAAoB,EAAE,MAAM,CAAA;IAC5B,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC,CAAA;AAEL,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC,GAC1F,yBAAyB,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC/B,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAEH;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAsEhD"}
|
|
@@ -2,10 +2,12 @@ import { ActionButton } from "../../composites/action-button/action-button.js";
|
|
|
2
2
|
import { cn } from "../../../lib/utils.js";
|
|
3
3
|
import { Spinner } from "../spinner/spinner.js";
|
|
4
4
|
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "./empty.js";
|
|
5
|
+
import { fastIcon } from "../../../lib/fast-icon.js";
|
|
5
6
|
import { createComponent, memo, mergeProps } from "solid-js/web";
|
|
6
7
|
import { Search } from "lucide-solid";
|
|
7
8
|
import { Show, children, splitProps } from "solid-js";
|
|
8
9
|
// src/components/ui/empty/empty-state.tsx
|
|
10
|
+
var Search$1 = fastIcon(Search);
|
|
9
11
|
/**
|
|
10
12
|
* A semantic empty, loading, or error state built from the shared empty parts.
|
|
11
13
|
*
|
|
@@ -58,7 +60,7 @@ function EmptyState(props) {
|
|
|
58
60
|
return memo(() => !!local.busy)() ? createComponent(Spinner, {
|
|
59
61
|
label: false,
|
|
60
62
|
"aria-hidden": "true"
|
|
61
|
-
}) : icon() ?? createComponent(Search, { "aria-hidden": "true" });
|
|
63
|
+
}) : icon() ?? createComponent(Search$1, { "aria-hidden": "true" });
|
|
62
64
|
}
|
|
63
65
|
});
|
|
64
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-state.js","names":["Search","children","resolveChildren","Show","splitProps","ActionButton","cn","Spinner","Empty","EmptyContent","EmptyDescription","EmptyHeader","EmptyMedia","EmptyTitle","secondaryAction","secondaryActionLabel","secondaryActionTooltip","title","detail","busy","icon","announceAs","headingLevel","action","actionLabel","actionTooltip","EmptyState","props","local","rest","_$createComponent","_$mergeProps","class","role","undefined","when","variant","_$memo","label","actionSlot","tooltip","onClick","secondaryActionSlot"],"sources":["../../../../src/components/ui/empty/empty-state.tsx"],"sourcesContent":["import { Search } from 'lucide-solid'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { children as resolveChildren, Show, splitProps } from 'solid-js'\nimport { ActionButton } from '../../composites/action-button'\nimport { cn } from '#lib/utils'\nimport { Spinner } from '../spinner'\nimport { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from './empty'\n\ntype EmptyStateSecondaryAction =\n | {\n secondaryAction?: undefined\n secondaryActionLabel?: undefined\n secondaryActionTooltip?: never\n }\n | {\n /** A second, quieter way out beside `action`: \"Open settings\" next to \"Retry\". */\n secondaryAction: () => void\n /** Required: there is no sensible default name for an arbitrary second action. */\n secondaryActionLabel: string\n secondaryActionTooltip?: string\n }\n\nexport type EmptyStateProps = Omit<ComponentProps<'div'>, 'children' | 'role' | 'aria-live'> &\n EmptyStateSecondaryAction & {\n title: string\n detail: string\n busy?: boolean\n icon?: JSX.Element\n announceAs?: 'alert' | 'status'\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6\n action?: () => void\n actionLabel?: string\n actionTooltip?: string\n }\n\n/**\n * A semantic empty, loading, or error state built from the shared empty parts.\n *\n * `action` is the primary way forward. `secondaryAction` adds one quieter\n * alternative after it, in a `secondary` button, so the primary stays first in\n * the tab order. Two actions side by side is the limit: a state that needs more\n * should compose the `Empty*` parts directly.\n */\nexport function EmptyState(props: EmptyStateProps) {\n const [local, rest] = splitProps(props, [\n 'title',\n 'detail',\n 'busy',\n 'icon',\n 'announceAs',\n 'headingLevel',\n 'action',\n 'actionLabel',\n 'actionTooltip',\n 'secondaryAction',\n 'secondaryActionLabel',\n 'secondaryActionTooltip',\n 'class',\n ])\n\n const icon = resolveChildren(() => local.icon)\n return (\n <Empty\n {...rest}\n class={local.class}\n role={local.announceAs}\n aria-live={local.announceAs === 'status' ? 'polite' : undefined}\n aria-busy={local.busy || undefined}\n >\n <EmptyHeader>\n <Show when={local.busy || icon()}>\n <EmptyMedia variant=\"icon\">\n {local.busy ? (\n <Spinner label={false} aria-hidden=\"true\" />\n ) : (\n (icon() ?? <Search aria-hidden=\"true\" />)\n )}\n </EmptyMedia>\n </Show>\n <EmptyTitle role=\"heading\" aria-level={local.headingLevel ?? 1}>\n {local.title}\n </EmptyTitle>\n <EmptyDescription>{local.detail}</EmptyDescription>\n </EmptyHeader>\n <Show when={local.action || local.secondaryAction}>\n <EmptyContent class={cn({ 'flex-row flex-wrap justify-center': !!local.secondaryAction })}>\n <Show when={local.action}>\n {(actionSlot) => (\n <ActionButton\n tooltip={local.actionTooltip ?? local.actionLabel ?? 'Try again'}\n aria-label={local.actionLabel ?? 'Try again'}\n onClick={actionSlot()}\n >\n {local.actionLabel ?? 'Try again'}\n </ActionButton>\n )}\n </Show>\n <Show when={local.secondaryAction}>\n {(secondaryActionSlot) => (\n <ActionButton\n variant=\"secondary\"\n tooltip={local.secondaryActionTooltip ?? local.secondaryActionLabel}\n aria-label={local.secondaryActionLabel}\n onClick={secondaryActionSlot()}\n >\n {local.secondaryActionLabel}\n </ActionButton>\n )}\n </Show>\n </EmptyContent>\n </Show>\n </Empty>\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"empty-state.js","names":["Search","LucideSearch","children","resolveChildren","Show","splitProps","ActionButton","cn","Spinner","Empty","EmptyContent","EmptyDescription","EmptyHeader","EmptyMedia","EmptyTitle","fastIcon","secondaryAction","secondaryActionLabel","secondaryActionTooltip","title","detail","busy","icon","announceAs","headingLevel","action","actionLabel","actionTooltip","EmptyState","props","local","rest","_$createComponent","_$mergeProps","class","role","undefined","when","variant","_$memo","label","actionSlot","tooltip","onClick","secondaryActionSlot"],"sources":["../../../../src/components/ui/empty/empty-state.tsx"],"sourcesContent":["import { Search as LucideSearch } from 'lucide-solid'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { children as resolveChildren, Show, splitProps } from 'solid-js'\nimport { ActionButton } from '../../composites/action-button'\nimport { cn } from '#lib/utils'\nimport { Spinner } from '../spinner'\nimport { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from './empty'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst Search = fastIcon(LucideSearch)\n\ntype EmptyStateSecondaryAction =\n | {\n secondaryAction?: undefined\n secondaryActionLabel?: undefined\n secondaryActionTooltip?: never\n }\n | {\n /** A second, quieter way out beside `action`: \"Open settings\" next to \"Retry\". */\n secondaryAction: () => void\n /** Required: there is no sensible default name for an arbitrary second action. */\n secondaryActionLabel: string\n secondaryActionTooltip?: string\n }\n\nexport type EmptyStateProps = Omit<ComponentProps<'div'>, 'children' | 'role' | 'aria-live'> &\n EmptyStateSecondaryAction & {\n title: string\n detail: string\n busy?: boolean\n icon?: JSX.Element\n announceAs?: 'alert' | 'status'\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6\n action?: () => void\n actionLabel?: string\n actionTooltip?: string\n }\n\n/**\n * A semantic empty, loading, or error state built from the shared empty parts.\n *\n * `action` is the primary way forward. `secondaryAction` adds one quieter\n * alternative after it, in a `secondary` button, so the primary stays first in\n * the tab order. Two actions side by side is the limit: a state that needs more\n * should compose the `Empty*` parts directly.\n */\nexport function EmptyState(props: EmptyStateProps) {\n const [local, rest] = splitProps(props, [\n 'title',\n 'detail',\n 'busy',\n 'icon',\n 'announceAs',\n 'headingLevel',\n 'action',\n 'actionLabel',\n 'actionTooltip',\n 'secondaryAction',\n 'secondaryActionLabel',\n 'secondaryActionTooltip',\n 'class',\n ])\n\n const icon = resolveChildren(() => local.icon)\n return (\n <Empty\n {...rest}\n class={local.class}\n role={local.announceAs}\n aria-live={local.announceAs === 'status' ? 'polite' : undefined}\n aria-busy={local.busy || undefined}\n >\n <EmptyHeader>\n <Show when={local.busy || icon()}>\n <EmptyMedia variant=\"icon\">\n {local.busy ? (\n <Spinner label={false} aria-hidden=\"true\" />\n ) : (\n (icon() ?? <Search aria-hidden=\"true\" />)\n )}\n </EmptyMedia>\n </Show>\n <EmptyTitle role=\"heading\" aria-level={local.headingLevel ?? 1}>\n {local.title}\n </EmptyTitle>\n <EmptyDescription>{local.detail}</EmptyDescription>\n </EmptyHeader>\n <Show when={local.action || local.secondaryAction}>\n <EmptyContent class={cn({ 'flex-row flex-wrap justify-center': !!local.secondaryAction })}>\n <Show when={local.action}>\n {(actionSlot) => (\n <ActionButton\n tooltip={local.actionTooltip ?? local.actionLabel ?? 'Try again'}\n aria-label={local.actionLabel ?? 'Try again'}\n onClick={actionSlot()}\n >\n {local.actionLabel ?? 'Try again'}\n </ActionButton>\n )}\n </Show>\n <Show when={local.secondaryAction}>\n {(secondaryActionSlot) => (\n <ActionButton\n variant=\"secondary\"\n tooltip={local.secondaryActionTooltip ?? local.secondaryActionLabel}\n aria-label={local.secondaryActionLabel}\n onClick={secondaryActionSlot()}\n >\n {local.secondaryActionLabel}\n </ActionButton>\n )}\n </Show>\n </EmptyContent>\n </Show>\n </Empty>\n )\n}\n"],"mappings":";;;;;;;;;AAUA,IAAMA,WAASe,SAASd,MAAY;;;;;;;;;AAqCpC,SAAgB2B,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQ1B,WAAWwB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAMP,OAAOnB,eAAsB2B,MAAMR,IAAI;CAC7C,OAAAU,gBACGvB,OAAKwB,WACAF,MAAI;EAAA,KAAA,WAAA;GAAA,OACDD,MAAMI;EAAK;EAAA,IAClBC,OAAI;GAAA,OAAEL,MAAMP;EAAU;EAAA,KA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C,OAAO,gBAAgB,CAAC,KAAK,CAAC,eAiB9E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,eAiBpF;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,UAAU,CAAC,eAGzD;AAED,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACpD;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;CACpB,CAAA;AAED,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAgBhD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;CAAE,eAY7F;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,KAAK,EAAE;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAA;CAC9C,eAgBA"}
|
|
@@ -3,7 +3,7 @@ import { FormFieldContext, createFormFieldContext } from "../../../lib/form-fiel
|
|
|
3
3
|
import { cn } from "../../../lib/utils.js";
|
|
4
4
|
import { headingVariants } from "../typography/typography.js";
|
|
5
5
|
import { createComponent, insert, memo, mergeProps, setAttribute, spread, template } from "solid-js/web";
|
|
6
|
-
import { Show, createUniqueId, splitProps } from "solid-js";
|
|
6
|
+
import { Show, children, createUniqueId, splitProps } from "solid-js";
|
|
7
7
|
import { TextField } from "@kobalte/core/text-field";
|
|
8
8
|
// src/components/ui/field/field.tsx
|
|
9
9
|
var _tmpl$ = /*#__PURE__*/ template(`<p class="text-muted-foreground text-sm">`);
|
|
@@ -93,9 +93,9 @@ function FormField(props) {
|
|
|
93
93
|
return _el$2;
|
|
94
94
|
})()
|
|
95
95
|
})];
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
const Body = () => {
|
|
97
|
+
const control = children(() => local.children);
|
|
98
|
+
return (() => {
|
|
99
99
|
var _el$3 = _tmpl$3();
|
|
100
100
|
spread(_el$3, mergeProps({ get ["class"]() {
|
|
101
101
|
return cn("flex flex-col gap-1.5", local.class);
|
|
@@ -119,7 +119,7 @@ function FormField(props) {
|
|
|
119
119
|
return local.label;
|
|
120
120
|
}
|
|
121
121
|
}),
|
|
122
|
-
memo(() =>
|
|
122
|
+
memo(() => control()),
|
|
123
123
|
memo(() => help())
|
|
124
124
|
];
|
|
125
125
|
}
|
|
@@ -133,11 +133,17 @@ function FormField(props) {
|
|
|
133
133
|
return local.label;
|
|
134
134
|
}
|
|
135
135
|
}),
|
|
136
|
-
memo(
|
|
136
|
+
memo(control),
|
|
137
137
|
memo(help)
|
|
138
138
|
];
|
|
139
139
|
})());
|
|
140
140
|
return _el$3;
|
|
141
|
+
})();
|
|
142
|
+
};
|
|
143
|
+
return createComponent(FormFieldContext.Provider, {
|
|
144
|
+
value: field,
|
|
145
|
+
get children() {
|
|
146
|
+
return createComponent(Body, {});
|
|
141
147
|
}
|
|
142
148
|
});
|
|
143
149
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","names":["KobalteTextField","createUniqueId","Show","splitProps","Label","createFormFieldContext","FormFieldContext","cn","headingVariants","Field","props","local","rest","_$createComponent","_$mergeProps","class","label","hint","error","controlId","group","children","FormField","fieldId","labelId","descriptionId","errorId","field","defaultControlId","help","when","hintSlot","_el$","_tmpl$","_$setAttribute","_$insert","errorSlot","_el$2","_tmpl$2","Provider","value","_el$3","_tmpl$3","_$spread","_c$","_$memo","FieldSet","describedBy","invalid","undefined","FieldLegend","id","variant","FieldLabel","FieldDescription","Description","FieldError","ErrorMessage","FieldInput","Input","FieldTextArea","TextArea","_el$4","_tmpl$4","columns","FieldGroup","_el$5","_tmpl$5","_el$6","_tmpl$6","size","FieldSeparator","_el$7","_tmpl$7","firstChild","_el$9","nextSibling","childrenSlot","_el$0","_tmpl$8"],"sources":["../../../../src/components/ui/field/field.tsx"],"sourcesContent":["import { TextField as KobalteTextField } from '@kobalte/core/text-field'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { createUniqueId, Show, splitProps } from 'solid-js'\nimport { Label } from '../label'\nimport { createFormFieldContext, FormFieldContext } from '#lib/form-field'\nimport { cn } from '#lib/utils'\nimport { headingVariants } from '../typography'\n\n/**\n * Field.\n *\n * The wrapper that makes a form control describable and validatable: a label,\n * a description, an error message, and the ARIA relationships between them.\n *\n * This Kobalte TextField composition is for its own `FieldLabel`, `FieldInput`\n * and `FieldTextArea` parts. Use `FormField` to wire the standalone shared\n * controls, including checkboxes, switches and comboboxes.\n *\n * It is built on Kobalte's TextField specifically so `aria-describedby`,\n * `aria-invalid` and `aria-errormessage` are wired by construction. Those three\n * attributes are the difference between \"this field is required and empty\" and\n * a red border that only a sighted user can perceive — and they are also the\n * first thing a hand-rolled form drops.\n *\n * `Field` owns the description and the error slot, so its controls line up and\n * its messages land in the same place regardless of which TextField part is used.\n */\nexport function Field(props: ComponentProps<typeof KobalteTextField>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteTextField class={cn('flex flex-col gap-1.5', local.class)} {...rest} />\n}\n\nexport type FormFieldProps = Omit<ComponentProps<'div'>, 'children' | 'ref'> & {\n label: string\n hint?: string\n error?: string\n controlId?: string\n group?: boolean\n children: JSX.Element\n}\n\n/**\n * FormField.\n *\n * A shared label, help and validation wrapper for any one shared control. Its\n * context is consumed by Input, Textarea, NativeSelect, Checkbox, Switch,\n * RadioGroup and ComboboxInput, so the actual focusable element receives the\n * generated ID and description relationships. Set `group` when the label names\n * a set of controls; the wrapper then uses fieldset and legend semantics.\n */\nexport function FormField(props: FormFieldProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'label',\n 'hint',\n 'error',\n 'controlId',\n 'group',\n 'children',\n ])\n const fieldId = createUniqueId()\n const labelId = `${fieldId}-label`\n const descriptionId = `${fieldId}-description`\n const errorId = `${fieldId}-error`\n const field = createFormFieldContext({\n controlId: local.controlId,\n defaultControlId: fieldId,\n labelId,\n descriptionId,\n errorId,\n hint: () => local.hint,\n error: () => local.error,\n group: () => local.group ?? false,\n })\n const help = () => (\n <>\n <Show when={local.hint}>\n {(hintSlot) => (\n <p id={descriptionId} class=\"text-muted-foreground text-sm\">\n {hintSlot()}\n </p>\n )}\n </Show>\n <Show when={local.error}>\n {(errorSlot) => (\n <p id={errorId} role=\"alert\" class=\"text-foreground text-sm\">\n {errorSlot()}\n </p>\n )}\n </Show>\n </>\n )\n\n return (\n <FormFieldContext.Provider value={field}>\n <div class={cn('flex flex-col gap-1.5', local.class)} {...rest}>\n {local.group ? (\n <FieldSet\n class=\"flex flex-col gap-1.5\"\n aria-describedby={field.describedBy()}\n aria-invalid={field.invalid() || undefined}\n >\n <FieldLegend id={labelId} variant=\"label\">\n {local.label}\n </FieldLegend>\n {local.children}\n {help()}\n </FieldSet>\n ) : (\n <>\n <Label id={labelId} for={field.controlId()}>\n {local.label}\n </Label>\n {local.children}\n {help()}\n </>\n )}\n </div>\n </FormFieldContext.Provider>\n )\n}\n\nexport function FieldLabel(props: ComponentProps<typeof KobalteTextField.Label>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteTextField.Label class={cn('text-sm leading-none font-medium', local.class)} {...rest} />\n )\n}\n\nexport function FieldDescription(props: ComponentProps<typeof KobalteTextField.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteTextField.Description\n class={cn('text-muted-foreground text-sm', local.class)}\n {...rest}\n />\n )\n}\n\nexport function FieldError(props: ComponentProps<typeof KobalteTextField.ErrorMessage>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteTextField.ErrorMessage class={cn('text-foreground text-sm', local.class)} {...rest} />\n )\n}\n\nexport function FieldInput(props: ComponentProps<typeof KobalteTextField.Input>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteTextField.Input\n class={cn(\n 'h-control-md w-full min-w-0 rounded-md border border-input bg-transparent px-control-md py-1 text-sm',\n 'transition-[color,box-shadow,border-color] ease-out outline-none',\n 'placeholder:text-muted-foreground 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 local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function FieldTextArea(props: ComponentProps<typeof KobalteTextField.TextArea>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteTextField.TextArea\n class={cn(\n 'flex field-sizing-content min-h-16 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 resize-y',\n 'placeholder:text-muted-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 local.class\n )}\n {...rest}\n />\n )\n}\n\n/**\n * A labelled group of fields with a single legend, for a real `<fieldset>`.\n * Grouping is what lets a screen reader announce \"Shipping address, group\"\n * before reading the four fields inside it.\n */\nexport function FieldSet(props: ComponentProps<'fieldset'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <fieldset class={cn('flex flex-col gap-4', local.class)} {...rest} />\n}\n\nexport type FieldGroupProps = ComponentProps<'div'> & {\n /**\n * `2` lays the fields out in two columns from the `sm` breakpoint up — a\n * short form of paired values (host and port, a name and a model). A field\n * that needs the full width says `class=\"col-span-full\"`. Below `sm` it is\n * one column again, because two inputs side by side on a phone are each too\n * narrow to read.\n *\n * `3` is the same grid with three columns from `sm`, for a row of short values\n * (a trio of limits, a day count and two thresholds). Each column is a third of\n * the group, so reach for `2` when a field holds a path, a URL or a sentence.\n */\n columns?: 1 | 2 | 3\n}\n\n/** A visual stack for related controls that does not imply fieldset semantics. */\nexport function FieldGroup(props: FieldGroupProps) {\n const [local, rest] = splitProps(props, ['class', 'columns'])\n return (\n <div\n data-slot=\"field-group\"\n class={cn(\n {\n 'grid gap-4 sm:grid-cols-2': local.columns === 2,\n 'grid gap-4 sm:grid-cols-3': local.columns === 3,\n 'flex flex-col gap-4': local.columns !== 2 && local.columns !== 3,\n },\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function FieldLegend(props: ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n const [local, rest] = splitProps(props, ['class', 'variant'])\n return (\n <legend\n class={cn(\n 'mb-1',\n local.variant === 'label' ? 'text-sm font-medium' : headingVariants({ size: 'card' }),\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/** A horizontal rule with a word in it, for \"or continue with\" separators. */\nexport function FieldSeparator(props: {\n class?: string\n children?: ComponentProps<'span'>['children']\n}) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <div class={cn('relative flex items-center gap-3 py-1', local.class)} {...rest}>\n <span class=\"bg-border h-px flex-1\" />\n <Show when={local.children}>\n {(childrenSlot) => (\n <span class=\"text-muted-foreground text-2xs tracking-wide uppercase\">\n {childrenSlot()}\n </span>\n )}\n </Show>\n <span class=\"bg-border h-px flex-1\" />\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAgBS,MAAMC,OAAgD;CACpE,MAAM,CAACC,OAAOC,QAAQT,WAAWO,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQb,WAAgBc,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQP,GAAG,yBAAyBI,MAAMI,KAAK;CAAC,EAAA,GAAMH,IAAI,CAAA;AACpF;;;;;;;;;;AAoBA,SAAgBU,UAAUZ,OAAuB;CAC/C,MAAM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Y,KAAKrD,MAAMqD,YAAY;GAClE,GACArD,MAAMI,KACR;EAAC,EAAA,GACGH,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAsD;CAAA,EAAA,CAAA;AAGd;AAEA,SAAgBhB,YAAYxC,OAAoE;CAC9F,MAAM,CAACC,OAAOC,QAAQT,WAAWO,OAAO,CAAC,SAAS,SAAS,CAAC;CAC5D,cAAA;EAAA,IAAA0D,QAAAC,QAAA;EAAA1B,OAAAyB,OAAAtD,WAAA,EAAA,KAAA,WAAA;GAAA,OAEWP,GACL,QACAI,MAAMyC,YAAY,UAAU,wBAAwB5C,gBAAgB,EAAE8D,MAAM,OAAO,CAAC,GACpF3D,MAAMI,KACR;EAAC,EAAA,GACGH,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAwD;CAAA,EAAA,CAAA;AAGd;;AAGA,SAAgBG,eAAe7D,OAG5B;CACD,MAAM,CAACC,OAAOC,QAAQT,WAAWO,OAAO,CAAC,SAAS,UAAU,CAAC;CAE7D,cAAA;EAAA,IAAA8D,QAAAC,QAAA,GAAAE,QAAAH,MAAAE,WAAAE;EAAAjC,OAAA6B,OAAA1D,WAAA,EAAA,KAAA,WAAA;GAAA,OACcP,GAAG,yCAAyCI,MAAMI,KAAK;EAAC,EAAA,GAAMH,IAAI,GAAA,OAAA,IAAA;EAAAuB,OAAAqC,OAAA3D,gBAE3EX,MAAI;GAAA,IAAC4B,OAAI;IAAA,OAAEnB,MAAMU;GAAQ;GAAAA,WACtBwD,wBAAY;IAAA,IAAAC,QAAAC,QAAA;IAAA5C,OAAA2C,OAETD,YAAY;IAAA,OAAAC;GAAA,EAAA,CAAA;EAEhB,CAAA,GAAAH,KAAA;EAAA,OAAAH;CAAA,EAAA,CAAA;AAKT"}
|
|
1
|
+
{"version":3,"file":"field.js","names":["KobalteTextField","children","resolveChildren","createUniqueId","Show","splitProps","Label","createFormFieldContext","FormFieldContext","cn","headingVariants","Field","props","local","rest","_$createComponent","_$mergeProps","class","label","hint","error","controlId","group","FormField","fieldId","labelId","descriptionId","errorId","field","defaultControlId","help","when","hintSlot","_el$","_tmpl$","_$setAttribute","_$insert","errorSlot","_el$2","_tmpl$2","Body","control","_el$3","_tmpl$3","_$spread","_c$","_$memo","FieldSet","describedBy","invalid","undefined","FieldLegend","id","variant","Provider","value","FieldLabel","FieldDescription","Description","FieldError","ErrorMessage","FieldInput","Input","FieldTextArea","TextArea","_el$4","_tmpl$4","columns","FieldGroup","_el$5","_tmpl$5","_el$6","_tmpl$6","size","FieldSeparator","_el$7","_tmpl$7","firstChild","_el$9","nextSibling","childrenSlot","_el$0","_tmpl$8"],"sources":["../../../../src/components/ui/field/field.tsx"],"sourcesContent":["import { TextField as KobalteTextField } from '@kobalte/core/text-field'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { children as resolveChildren, createUniqueId, Show, splitProps } from 'solid-js'\nimport { Label } from '../label'\nimport { createFormFieldContext, FormFieldContext } from '#lib/form-field'\nimport { cn } from '#lib/utils'\nimport { headingVariants } from '../typography'\n\n/**\n * Field.\n *\n * The wrapper that makes a form control describable and validatable: a label,\n * a description, an error message, and the ARIA relationships between them.\n *\n * This Kobalte TextField composition is for its own `FieldLabel`, `FieldInput`\n * and `FieldTextArea` parts. Use `FormField` to wire the standalone shared\n * controls, including checkboxes, switches and comboboxes.\n *\n * It is built on Kobalte's TextField specifically so `aria-describedby`,\n * `aria-invalid` and `aria-errormessage` are wired by construction. Those three\n * attributes are the difference between \"this field is required and empty\" and\n * a red border that only a sighted user can perceive — and they are also the\n * first thing a hand-rolled form drops.\n *\n * `Field` owns the description and the error slot, so its controls line up and\n * its messages land in the same place regardless of which TextField part is used.\n */\nexport function Field(props: ComponentProps<typeof KobalteTextField>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteTextField class={cn('flex flex-col gap-1.5', local.class)} {...rest} />\n}\n\nexport type FormFieldProps = Omit<ComponentProps<'div'>, 'children' | 'ref'> & {\n label: string\n hint?: string\n error?: string\n controlId?: string\n group?: boolean\n children: JSX.Element\n}\n\n/**\n * FormField.\n *\n * A shared label, help and validation wrapper for any one shared control. Its\n * context is consumed by Input, Textarea, NativeSelect, Checkbox, Switch,\n * RadioGroup and ComboboxInput, so the actual focusable element receives the\n * generated ID and description relationships. Set `group` when the label names\n * a set of controls; the wrapper then uses fieldset and legend semantics.\n */\nexport function FormField(props: FormFieldProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'label',\n 'hint',\n 'error',\n 'controlId',\n 'group',\n 'children',\n ])\n const fieldId = createUniqueId()\n const labelId = `${fieldId}-label`\n const descriptionId = `${fieldId}-description`\n const errorId = `${fieldId}-error`\n const field = createFormFieldContext({\n controlId: local.controlId,\n defaultControlId: fieldId,\n labelId,\n descriptionId,\n errorId,\n hint: () => local.hint,\n error: () => local.error,\n group: () => local.group ?? false,\n })\n const help = () => (\n <>\n <Show when={local.hint}>\n {(hintSlot) => (\n <p id={descriptionId} class=\"text-muted-foreground text-sm\">\n {hintSlot()}\n </p>\n )}\n </Show>\n <Show when={local.error}>\n {(errorSlot) => (\n <p id={errorId} role=\"alert\" class=\"text-foreground text-sm\">\n {errorSlot()}\n </p>\n )}\n </Show>\n </>\n )\n\n // Rendered under the provider so the control sees the field context. The control is\n // built once: switching `group` moves the same control between the two layouts.\n const Body = () => {\n const control = resolveChildren(() => local.children)\n return (\n <div class={cn('flex flex-col gap-1.5', local.class)} {...rest}>\n {local.group ? (\n <FieldSet\n class=\"flex flex-col gap-1.5\"\n aria-describedby={field.describedBy()}\n aria-invalid={field.invalid() || undefined}\n >\n <FieldLegend id={labelId} variant=\"label\">\n {local.label}\n </FieldLegend>\n {control()}\n {help()}\n </FieldSet>\n ) : (\n <>\n <Label id={labelId} for={field.controlId()}>\n {local.label}\n </Label>\n {control()}\n {help()}\n </>\n )}\n </div>\n )\n }\n\n return (\n <FormFieldContext.Provider value={field}>\n <Body />\n </FormFieldContext.Provider>\n )\n}\n\nexport function FieldLabel(props: ComponentProps<typeof KobalteTextField.Label>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteTextField.Label class={cn('text-sm leading-none font-medium', local.class)} {...rest} />\n )\n}\n\nexport function FieldDescription(props: ComponentProps<typeof KobalteTextField.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteTextField.Description\n class={cn('text-muted-foreground text-sm', local.class)}\n {...rest}\n />\n )\n}\n\nexport function FieldError(props: ComponentProps<typeof KobalteTextField.ErrorMessage>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteTextField.ErrorMessage class={cn('text-foreground text-sm', local.class)} {...rest} />\n )\n}\n\nexport function FieldInput(props: ComponentProps<typeof KobalteTextField.Input>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteTextField.Input\n class={cn(\n 'h-control-md w-full min-w-0 rounded-md border border-input bg-transparent px-control-md py-1 text-sm',\n 'transition-[color,box-shadow,border-color] ease-out outline-none',\n 'placeholder:text-muted-foreground 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 local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function FieldTextArea(props: ComponentProps<typeof KobalteTextField.TextArea>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteTextField.TextArea\n class={cn(\n 'flex field-sizing-content min-h-16 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 resize-y',\n 'placeholder:text-muted-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 local.class\n )}\n {...rest}\n />\n )\n}\n\n/**\n * A labelled group of fields with a single legend, for a real `<fieldset>`.\n * Grouping is what lets a screen reader announce \"Shipping address, group\"\n * before reading the four fields inside it.\n */\nexport function FieldSet(props: ComponentProps<'fieldset'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <fieldset class={cn('flex flex-col gap-4', local.class)} {...rest} />\n}\n\nexport type FieldGroupProps = ComponentProps<'div'> & {\n /**\n * `2` lays the fields out in two columns from the `sm` breakpoint up — a\n * short form of paired values (host and port, a name and a model). A field\n * that needs the full width says `class=\"col-span-full\"`. Below `sm` it is\n * one column again, because two inputs side by side on a phone are each too\n * narrow to read.\n *\n * `3` is the same grid with three columns from `sm`, for a row of short values\n * (a trio of limits, a day count and two thresholds). Each column is a third of\n * the group, so reach for `2` when a field holds a path, a URL or a sentence.\n */\n columns?: 1 | 2 | 3\n}\n\n/** A visual stack for related controls that does not imply fieldset semantics. */\nexport function FieldGroup(props: FieldGroupProps) {\n const [local, rest] = splitProps(props, ['class', 'columns'])\n return (\n <div\n data-slot=\"field-group\"\n class={cn(\n {\n 'grid gap-4 sm:grid-cols-2': local.columns === 2,\n 'grid gap-4 sm:grid-cols-3': local.columns === 3,\n 'flex flex-col gap-4': local.columns !== 2 && local.columns !== 3,\n },\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function FieldLegend(props: ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n const [local, rest] = splitProps(props, ['class', 'variant'])\n return (\n <legend\n class={cn(\n 'mb-1',\n local.variant === 'label' ? 'text-sm font-medium' : headingVariants({ size: 'card' }),\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/** A horizontal rule with a word in it, for \"or continue with\" separators. */\nexport function FieldSeparator(props: {\n class?: string\n children?: ComponentProps<'span'>['children']\n}) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <div class={cn('relative flex items-center gap-3 py-1', local.class)} {...rest}>\n <span class=\"bg-border h-px flex-1\" />\n <Show when={local.children}>\n {(childrenSlot) => (\n <span class=\"text-muted-foreground text-2xs tracking-w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EAAAnC,OAAA+B,OAAA3D,WAAA,EAAA,KAAA,WAAA;GAAA,OACcP,GAAG,yCAAyCI,MAAMI,KAAK;EAAC,EAAA,GAAMH,IAAI,GAAA,OAAA,IAAA;EAAAsB,OAAAuC,OAAA5D,gBAE3EX,MAAI;GAAA,IAAC2B,OAAI;IAAA,OAAElB,MAAMZ;GAAQ;GAAAA,WACtB+E,wBAAY;IAAA,IAAAC,QAAAC,QAAA;IAAA9C,OAAA6C,OAETD,YAAY;IAAA,OAAAC;GAAA,EAAA,CAAA;EAEhB,CAAA,GAAAH,KAAA;EAAA,OAAAH;CAAA,EAAA,CAAA;AAKT"}
|
|
@@ -13,5 +13,7 @@ export type InputControlProps = Omit<ComponentProps<'input'>, 'size'> & {
|
|
|
13
13
|
*/
|
|
14
14
|
size?: 'sm' | 'md' | 'lg';
|
|
15
15
|
};
|
|
16
|
+
/** The input's class for a rung, with the caller's class merged last. */
|
|
17
|
+
export declare function inputControlClass(size: InputControlProps['size'], className?: string): string;
|
|
16
18
|
export declare function InputControl(props: InputControlProps): import("solid-js").JSX.Element;
|
|
17
19
|
//# sourceMappingURL=input-control.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-control.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/input/input-control.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,GAAG;IACtE;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1B,CAAA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"input-control.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/input/input-control.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,GAAG;IACtE;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1B,CAAA;AAuBD,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,UAGpF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,kCAWpD"}
|
|
@@ -3,6 +3,28 @@ import { mergeProps, spread, template } from "solid-js/web";
|
|
|
3
3
|
import { splitProps } from "solid-js";
|
|
4
4
|
// src/components/ui/input/input-control.tsx
|
|
5
5
|
var _tmpl$ = /*#__PURE__*/ template(`<input data-slot=input>`);
|
|
6
|
+
var inputBase = [
|
|
7
|
+
"w-full min-w-0 rounded-md border border-input bg-transparent py-1",
|
|
8
|
+
"transition-[color,box-shadow,border-color] ease-out outline-none",
|
|
9
|
+
"placeholder:text-muted-foreground",
|
|
10
|
+
"selection:bg-primary selection:text-primary-foreground",
|
|
11
|
+
"file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
|
|
12
|
+
"focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle",
|
|
13
|
+
"aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive-subtle",
|
|
14
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
15
|
+
"read-only:bg-surface-hover"
|
|
16
|
+
].join(" ");
|
|
17
|
+
/** Each rung's full class list, merged once rather than on every input. */
|
|
18
|
+
var inputSizeClass = {
|
|
19
|
+
sm: cn(inputBase, "h-control-sm px-control-sm text-xs"),
|
|
20
|
+
md: cn(inputBase, "h-control-md px-control-md text-sm"),
|
|
21
|
+
lg: cn(inputBase, "h-control-lg px-control-lg text-sm")
|
|
22
|
+
};
|
|
23
|
+
/** The input's class for a rung, with the caller's class merged last. */
|
|
24
|
+
function inputControlClass(size, className) {
|
|
25
|
+
const base = inputSizeClass[size ?? "md"];
|
|
26
|
+
return className ? cn(base, className) : base;
|
|
27
|
+
}
|
|
6
28
|
function InputControl(props) {
|
|
7
29
|
const [local, rest] = splitProps(props, [
|
|
8
30
|
"class",
|
|
@@ -16,16 +38,12 @@ function InputControl(props) {
|
|
|
16
38
|
return local.type ?? "text";
|
|
17
39
|
},
|
|
18
40
|
get ["class"]() {
|
|
19
|
-
return
|
|
20
|
-
"h-control-sm px-control-sm text-xs": local.size === "sm",
|
|
21
|
-
"h-control-md px-control-md text-sm": local.size === "md" || local.size === void 0,
|
|
22
|
-
"h-control-lg px-control-lg text-sm": local.size === "lg"
|
|
23
|
-
}, "transition-[color,box-shadow,border-color] ease-out outline-none", "placeholder:text-muted-foreground", "selection:bg-primary selection:text-primary-foreground", "file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground", "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle", "aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive-subtle", "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", "read-only:bg-surface-hover", local.class);
|
|
41
|
+
return inputControlClass(local.size, local.class);
|
|
24
42
|
}
|
|
25
43
|
}, rest), false, false);
|
|
26
44
|
return _el$;
|
|
27
45
|
})();
|
|
28
46
|
}
|
|
29
|
-
export { InputControl };
|
|
47
|
+
export { InputControl, inputControlClass };
|
|
30
48
|
|
|
31
49
|
//# sourceMappingURL=input-control.js.map
|