@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
|
@@ -394,14 +394,101 @@ export function parseMessageText(
|
|
|
394
394
|
text: string,
|
|
395
395
|
options: { streaming?: boolean; citations?: number } = {}
|
|
396
396
|
): readonly MessageBlock[] {
|
|
397
|
+
return parseLines(text.replace(/\r\n?/g, '\n'), options).blocks
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export type MessageParseOptions = { streaming?: boolean; citations?: number }
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* A parse that the next, longer text can continue from. See
|
|
404
|
+
* {@link parseMessageTextIncremental}.
|
|
405
|
+
*/
|
|
406
|
+
export type MessageParse = Readonly<{
|
|
407
|
+
/** The normalised text that was parsed. */
|
|
408
|
+
text: string
|
|
409
|
+
streaming: boolean
|
|
410
|
+
citations: number
|
|
411
|
+
blocks: readonly MessageBlock[]
|
|
412
|
+
/** The offset in `text` where each block's first line starts. */
|
|
413
|
+
starts: readonly number[]
|
|
414
|
+
}>
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* `parseMessageText`, resumed.
|
|
418
|
+
*
|
|
419
|
+
* A streaming reply grows by appending, and reparsing the whole text per token
|
|
420
|
+
* makes a long reply quadratic. When `text` extends `previous.text` under the same
|
|
421
|
+
* options, only its final line can still change, since it may be unfinished. A block
|
|
422
|
+
* that ends before that line is terminated by a finished line (a blank line, a
|
|
423
|
+
* closing fence, or the line that starts the next block), so appending cannot
|
|
424
|
+
* change it. Only the tail from the last block that starts before the final line
|
|
425
|
+
* is parsed again, and the earlier blocks are returned as the same objects. The
|
|
426
|
+
* parser keeps no state across a block boundary, so the tail parsed alone gives
|
|
427
|
+
* exactly the blocks a full parse gives there. Anything else (an edit, a
|
|
428
|
+
* different option) is a full parse.
|
|
429
|
+
*/
|
|
430
|
+
export function parseMessageTextIncremental(
|
|
431
|
+
previous: MessageParse | undefined,
|
|
432
|
+
text: string,
|
|
433
|
+
options: MessageParseOptions = {}
|
|
434
|
+
): MessageParse {
|
|
435
|
+
const normalized = text.replace(/\r\n?/g, '\n')
|
|
436
|
+
const streaming = options.streaming ?? false
|
|
437
|
+
const citations = options.citations ?? 0
|
|
438
|
+
if (
|
|
439
|
+
previous &&
|
|
440
|
+
previous.streaming === streaming &&
|
|
441
|
+
previous.citations === citations &&
|
|
442
|
+
previous.blocks.length > 0 &&
|
|
443
|
+
normalized.length >= previous.text.length &&
|
|
444
|
+
normalized.startsWith(previous.text)
|
|
445
|
+
) {
|
|
446
|
+
// Only the final line can still change (it may not be finished), and with it
|
|
447
|
+
// the block it belongs to or the one it ends. Resume from the last block that
|
|
448
|
+
// starts before that line: every block before it ends at a finished line.
|
|
449
|
+
const lastLine = previous.text.lastIndexOf('\n') + 1
|
|
450
|
+
let keep = previous.starts.length - 1
|
|
451
|
+
while (keep >= 0 && previous.starts[keep]! >= lastLine) keep -= 1
|
|
452
|
+
if (keep > 0) {
|
|
453
|
+
const resumeAt = previous.starts[keep]!
|
|
454
|
+
const tail = parseLines(normalized.slice(resumeAt), options)
|
|
455
|
+
return {
|
|
456
|
+
text: normalized,
|
|
457
|
+
streaming,
|
|
458
|
+
citations,
|
|
459
|
+
blocks: [...previous.blocks.slice(0, keep), ...tail.blocks],
|
|
460
|
+
starts: [
|
|
461
|
+
...previous.starts.slice(0, keep),
|
|
462
|
+
...tail.starts.map((start) => start + resumeAt),
|
|
463
|
+
],
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
const full = parseLines(normalized, options)
|
|
468
|
+
return { text: normalized, streaming, citations, ...full }
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
function parseLines(
|
|
472
|
+
text: string,
|
|
473
|
+
options: MessageParseOptions
|
|
474
|
+
): { blocks: MessageBlock[]; starts: number[] } {
|
|
397
475
|
const inline = (source: string) => parseInline(source, 0, { citations: options.citations })
|
|
398
|
-
const lines = text.
|
|
476
|
+
const lines = text.split('\n')
|
|
477
|
+
// The offset where each line starts, so a block can record where it began.
|
|
478
|
+
const lineStarts: number[] = []
|
|
479
|
+
for (let line = 0, offset = 0; line < lines.length; line++) {
|
|
480
|
+
lineStarts.push(offset)
|
|
481
|
+
offset += lines[line]!.length + 1
|
|
482
|
+
}
|
|
399
483
|
const blocks: MessageBlock[] = []
|
|
484
|
+
const starts: number[] = []
|
|
400
485
|
let paragraph: string[] = []
|
|
486
|
+
let paragraphStart = 0
|
|
401
487
|
const flushParagraph = () => {
|
|
402
488
|
if (paragraph.length === 0) return
|
|
403
489
|
const raw = paragraph.join('\n')
|
|
404
490
|
blocks.push({ kind: 'paragraph', inline: inline(raw), raw })
|
|
491
|
+
starts.push(lineStarts[paragraphStart]!)
|
|
405
492
|
paragraph = []
|
|
406
493
|
}
|
|
407
494
|
|
|
@@ -414,6 +501,7 @@ export function parseMessageText(
|
|
|
414
501
|
const marker = fence.marker
|
|
415
502
|
const language = fence.language || undefined
|
|
416
503
|
const { code, closed, next } = readFence(lines, index + 1, fence)
|
|
504
|
+
starts.push(lineStarts[index]!)
|
|
417
505
|
index = next
|
|
418
506
|
blocks.push({
|
|
419
507
|
kind: 'code',
|
|
@@ -432,6 +520,7 @@ export function parseMessageText(
|
|
|
432
520
|
const heading = headingOf(line)
|
|
433
521
|
if (heading) {
|
|
434
522
|
flushParagraph()
|
|
523
|
+
starts.push(lineStarts[index]!)
|
|
435
524
|
blocks.push({
|
|
436
525
|
kind: 'heading',
|
|
437
526
|
level: heading.level,
|
|
@@ -445,6 +534,7 @@ export function parseMessageText(
|
|
|
445
534
|
const ordered = bullet ? null : ORDERED.exec(line)
|
|
446
535
|
if (bullet || ordered) {
|
|
447
536
|
flushParagraph()
|
|
537
|
+
starts.push(lineStarts[index]!)
|
|
448
538
|
const items: MessageInline[][] = []
|
|
449
539
|
const rawLines: string[] = []
|
|
450
540
|
const isOrdered = ordered !== null
|
|
@@ -479,6 +569,7 @@ export function parseMessageText(
|
|
|
479
569
|
const quote = QUOTE.exec(line)
|
|
480
570
|
if (quote) {
|
|
481
571
|
flushParagraph()
|
|
572
|
+
starts.push(lineStarts[index]!)
|
|
482
573
|
const quoted: string[] = []
|
|
483
574
|
while (index < lines.length) {
|
|
484
575
|
const match = QUOTE.exec(lines[index]!)
|
|
@@ -490,9 +581,10 @@ export function parseMessageText(
|
|
|
490
581
|
blocks.push({ kind: 'quote', inline: inline(raw), raw })
|
|
491
582
|
continue
|
|
492
583
|
}
|
|
584
|
+
if (paragraph.length === 0) paragraphStart = index
|
|
493
585
|
paragraph.push(line)
|
|
494
586
|
index += 1
|
|
495
587
|
}
|
|
496
588
|
flushParagraph()
|
|
497
|
-
return blocks
|
|
589
|
+
return { blocks, starts }
|
|
498
590
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { ChevronDownIcon } from 'lucide-solid'
|
|
1
|
+
import { ChevronDownIcon as LucideChevronDownIcon } from 'lucide-solid'
|
|
2
2
|
import type { ComponentProps } from 'solid-js'
|
|
3
3
|
import { createEffect, For, onMount, Show, splitProps } from 'solid-js'
|
|
4
4
|
import { useFormFieldControl } from '#lib/form-field'
|
|
5
5
|
import { cn } from '#lib/utils'
|
|
6
|
+
import { fastIcon } from '#lib/fast-icon'
|
|
7
|
+
|
|
8
|
+
// lucide icons drawn from a cloned template (see fastIcon).
|
|
9
|
+
const ChevronDownIcon = fastIcon(LucideChevronDownIcon)
|
|
6
10
|
|
|
7
11
|
export type NativeSelectProps = Omit<ComponentProps<'select'>, 'size'> & {
|
|
8
12
|
/**
|
|
@@ -99,14 +103,7 @@ export function NativeSelect(props: NativeSelectProps) {
|
|
|
99
103
|
'aria-invalid',
|
|
100
104
|
'aria-errormessage',
|
|
101
105
|
])
|
|
102
|
-
const field = useFormFieldControl('control',
|
|
103
|
-
id: local.id,
|
|
104
|
-
'aria-label': local['aria-label'],
|
|
105
|
-
'aria-labelledby': local['aria-labelledby'],
|
|
106
|
-
'aria-describedby': local['aria-describedby'],
|
|
107
|
-
'aria-invalid': local['aria-invalid'],
|
|
108
|
-
'aria-errormessage': local['aria-errormessage'],
|
|
109
|
-
})
|
|
106
|
+
const field = useFormFieldControl('control', local)
|
|
110
107
|
let select: HTMLSelectElement | undefined
|
|
111
108
|
|
|
112
109
|
// Set selection after native options exist; setting select.value before its
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { children as resolveChildren, splitProps, type ComponentProps, type JSX } from 'solid-js'
|
|
2
2
|
import * as KobalteNavigationMenu from '@kobalte/core/navigation-menu'
|
|
3
|
-
import { ChevronDown } from 'lucide-solid'
|
|
3
|
+
import { ChevronDown as LucideChevronDown } from 'lucide-solid'
|
|
4
4
|
import { cn } from '#lib/utils'
|
|
5
5
|
import {
|
|
6
6
|
menuContentPadding,
|
|
@@ -10,6 +10,10 @@ import {
|
|
|
10
10
|
overlayMotion,
|
|
11
11
|
overlaySurface,
|
|
12
12
|
} from '#lib/overlay'
|
|
13
|
+
import { fastIcon } from '#lib/fast-icon'
|
|
14
|
+
|
|
15
|
+
// lucide icons drawn from a cloned template (see fastIcon).
|
|
16
|
+
const ChevronDown = fastIcon(LucideChevronDown)
|
|
13
17
|
|
|
14
18
|
/**
|
|
15
19
|
* NavigationMenu.
|
|
@@ -2,10 +2,20 @@ import {
|
|
|
2
2
|
Pagination as KobaltePagination,
|
|
3
3
|
type PaginationRootOptions,
|
|
4
4
|
} from '@kobalte/core/pagination'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
ChevronLeft as LucideChevronLeft,
|
|
7
|
+
ChevronRight as LucideChevronRight,
|
|
8
|
+
MoreHorizontal as LucideMoreHorizontal,
|
|
9
|
+
} from 'lucide-solid'
|
|
6
10
|
import type { ComponentProps, JSX } from 'solid-js'
|
|
7
11
|
import { Show, splitProps } from 'solid-js'
|
|
8
12
|
import { cn } from '#lib/utils'
|
|
13
|
+
import { fastIcon } from '#lib/fast-icon'
|
|
14
|
+
|
|
15
|
+
// lucide icons drawn from a cloned template (see fastIcon).
|
|
16
|
+
const ChevronLeft = fastIcon(LucideChevronLeft)
|
|
17
|
+
const ChevronRight = fastIcon(LucideChevronRight)
|
|
18
|
+
const MoreHorizontal = fastIcon(LucideMoreHorizontal)
|
|
9
19
|
|
|
10
20
|
/**
|
|
11
21
|
* Pagination.
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Check as LucideCheck,
|
|
3
|
+
CircleHelp as LucideCircleHelp,
|
|
4
|
+
Clock as LucideClock,
|
|
5
|
+
LoaderCircle as LucideLoaderCircle,
|
|
6
|
+
} from 'lucide-solid'
|
|
2
7
|
import {
|
|
3
8
|
createEffect,
|
|
4
9
|
createMemo,
|
|
@@ -16,6 +21,13 @@ import { Button } from '../button'
|
|
|
16
21
|
import { Checkbox } from '../checkbox'
|
|
17
22
|
import { RadioGroup, RadioGroupItem } from '../radio-group'
|
|
18
23
|
import { Textarea } from '../textarea'
|
|
24
|
+
import { fastIcon } from '#lib/fast-icon'
|
|
25
|
+
|
|
26
|
+
// lucide icons drawn from a cloned template (see fastIcon).
|
|
27
|
+
const Check = fastIcon(LucideCheck)
|
|
28
|
+
const CircleHelp = fastIcon(LucideCircleHelp)
|
|
29
|
+
const Clock = fastIcon(LucideClock)
|
|
30
|
+
const LoaderCircle = fastIcon(LucideLoaderCircle)
|
|
19
31
|
|
|
20
32
|
/**
|
|
21
33
|
* Questionnaire.
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { RadioGroup as KobalteRadioGroup } from '@kobalte/core/radio-group'
|
|
2
|
-
import { Circle } from 'lucide-solid'
|
|
2
|
+
import { Circle as LucideCircle } from 'lucide-solid'
|
|
3
3
|
import type { ComponentProps, JSX } from 'solid-js'
|
|
4
4
|
import { Show, children as resolveChildren, splitProps } from 'solid-js'
|
|
5
5
|
import { useFormFieldControl } from '#lib/form-field'
|
|
6
6
|
import { cn } from '#lib/utils'
|
|
7
|
+
import { fastIcon } from '#lib/fast-icon'
|
|
8
|
+
|
|
9
|
+
// lucide icons drawn from a cloned template (see fastIcon).
|
|
10
|
+
const Circle = fastIcon(LucideCircle)
|
|
7
11
|
|
|
8
12
|
/**
|
|
9
13
|
* RadioGroup.
|
|
@@ -27,14 +31,7 @@ export function RadioGroup(props: ComponentProps<typeof KobalteRadioGroup>) {
|
|
|
27
31
|
'aria-invalid',
|
|
28
32
|
'aria-errormessage',
|
|
29
33
|
])
|
|
30
|
-
const field = useFormFieldControl('group',
|
|
31
|
-
id: local.id,
|
|
32
|
-
'aria-label': local['aria-label'],
|
|
33
|
-
'aria-labelledby': local['aria-labelledby'],
|
|
34
|
-
'aria-describedby': local['aria-describedby'],
|
|
35
|
-
'aria-invalid': local['aria-invalid'],
|
|
36
|
-
'aria-errormessage': local['aria-errormessage'],
|
|
37
|
-
})
|
|
34
|
+
const field = useFormFieldControl('group', local)
|
|
38
35
|
return (
|
|
39
36
|
<KobalteRadioGroup
|
|
40
37
|
data-slot="radio-group"
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import Resizable from '@corvu/resizable'
|
|
2
|
-
import { GripVertical } from 'lucide-solid'
|
|
2
|
+
import { GripVertical as LucideGripVertical } from 'lucide-solid'
|
|
3
3
|
import type { ComponentProps } from 'solid-js'
|
|
4
4
|
import { createContext, splitProps, useContext } from 'solid-js'
|
|
5
5
|
import { cn } from '#lib/utils'
|
|
6
6
|
import { resizeGripClass, resizeGripIconClass, resizeSeparatorClass } from '#lib/resize-separator'
|
|
7
|
+
import { fastIcon } from '#lib/fast-icon'
|
|
8
|
+
|
|
9
|
+
// lucide icons drawn from a cloned template (see fastIcon).
|
|
10
|
+
const GripVertical = fastIcon(LucideGripVertical)
|
|
7
11
|
|
|
8
12
|
/**
|
|
9
13
|
* Resizable.
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Select as KobalteSelect } from '@kobalte/core/select'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Check as LucideCheck,
|
|
4
|
+
ChevronDown as LucideChevronDown,
|
|
5
|
+
ChevronsUpDown as LucideChevronsUpDown,
|
|
6
|
+
} from 'lucide-solid'
|
|
3
7
|
import type { ComponentProps } from 'solid-js'
|
|
4
8
|
import { Show, splitProps } from 'solid-js'
|
|
5
9
|
import {
|
|
@@ -10,6 +14,12 @@ import {
|
|
|
10
14
|
topLayerProps,
|
|
11
15
|
} from '#lib/overlay'
|
|
12
16
|
import { cn } from '#lib/utils'
|
|
17
|
+
import { fastIcon } from '#lib/fast-icon'
|
|
18
|
+
|
|
19
|
+
// lucide icons drawn from a cloned template (see fastIcon).
|
|
20
|
+
const Check = fastIcon(LucideCheck)
|
|
21
|
+
const ChevronDown = fastIcon(LucideChevronDown)
|
|
22
|
+
const ChevronsUpDown = fastIcon(LucideChevronsUpDown)
|
|
13
23
|
|
|
14
24
|
/**
|
|
15
25
|
* Select.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dialog as KobalteDialog, Content as KobalteDialogContent } from '@kobalte/core/dialog'
|
|
2
2
|
// AlertDialog shares DialogRoot.Content; Sheet uses the stable named primitive.
|
|
3
|
-
import { X } from 'lucide-solid'
|
|
3
|
+
import { X as LucideX } from 'lucide-solid'
|
|
4
4
|
import type { Accessor, ComponentProps, JSX } from 'solid-js'
|
|
5
5
|
import { children as resolveChildren, Show, splitProps } from 'solid-js'
|
|
6
6
|
import { cva, type VariantProps } from '#lib/variants'
|
|
@@ -8,6 +8,10 @@ import { overlayCornerClose, overlayDescription, overlayTitle } from '#lib/overl
|
|
|
8
8
|
import { cn } from '#lib/utils'
|
|
9
9
|
import { DialogOverlay } from '../dialog'
|
|
10
10
|
import { createDialogLayer, DialogEscapeTarget } from '../dialog/dialog-layer'
|
|
11
|
+
import { fastIcon } from '#lib/fast-icon'
|
|
12
|
+
|
|
13
|
+
// lucide icons drawn from a cloned template (see fastIcon).
|
|
14
|
+
const X = fastIcon(LucideX)
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
17
|
* Sheet.
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { LoaderCircle } from 'lucide-solid'
|
|
1
|
+
import { LoaderCircle as LucideLoaderCircle } from 'lucide-solid'
|
|
2
2
|
import type { ComponentProps } from 'solid-js'
|
|
3
3
|
import { splitProps } from 'solid-js'
|
|
4
4
|
import { cva, type VariantProps } from '#lib/variants'
|
|
5
5
|
import { cn } from '#lib/utils'
|
|
6
|
+
import { fastIcon } from '#lib/fast-icon'
|
|
7
|
+
|
|
8
|
+
// lucide icons drawn from a cloned template (see fastIcon).
|
|
9
|
+
const LoaderCircle = fastIcon(LucideLoaderCircle)
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* Spinner.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Show, splitProps, type ComponentProps, type JSX } from 'solid-js'
|
|
2
2
|
import { cva } from '#lib/variants'
|
|
3
3
|
import { cn } from '#lib/utils'
|
|
4
|
-
import {
|
|
4
|
+
import { LazyTooltip } from '../tooltip'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* StatusChip.
|
|
@@ -107,12 +107,19 @@ export function StatusChip(props: StatusChipProps) {
|
|
|
107
107
|
return (
|
|
108
108
|
<Show when={local.detail} fallback={chip}>
|
|
109
109
|
{(detail) => (
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
<LazyTooltip content={detail()} contentProps={{ 'data-slot': 'tooltip-content' }}>
|
|
111
|
+
{(tip) => (
|
|
112
|
+
<span
|
|
113
|
+
ref={tip.ref}
|
|
114
|
+
class="inline-flex"
|
|
115
|
+
aria-describedby={tip.describedBy()}
|
|
116
|
+
onPointerEnter={tip.onPointerEnter}
|
|
117
|
+
onFocus={tip.onFocus}
|
|
118
|
+
>
|
|
119
|
+
{chip}
|
|
120
|
+
</span>
|
|
121
|
+
)}
|
|
122
|
+
</LazyTooltip>
|
|
116
123
|
)}
|
|
117
124
|
</Show>
|
|
118
125
|
)
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { Switch as KobalteSwitch } from '@kobalte/core/switch'
|
|
2
2
|
import type { ComponentProps, JSX } from 'solid-js'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
children as resolveChildren,
|
|
5
|
+
createSignal,
|
|
6
|
+
createUniqueId,
|
|
7
|
+
mergeProps,
|
|
8
|
+
onCleanup,
|
|
9
|
+
onMount,
|
|
10
|
+
Show,
|
|
11
|
+
splitProps,
|
|
12
|
+
} from 'solid-js'
|
|
4
13
|
import { useFormFieldControl } from '#lib/form-field'
|
|
5
14
|
import { cn } from '#lib/utils'
|
|
6
15
|
|
|
@@ -33,7 +42,221 @@ export type SwitchProps = Omit<ComponentProps<typeof KobalteSwitch>, 'children'>
|
|
|
33
42
|
children?: JSX.Element
|
|
34
43
|
}
|
|
35
44
|
|
|
45
|
+
const switchControlClass = (className?: string) =>
|
|
46
|
+
cn(
|
|
47
|
+
'bg-input inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent',
|
|
48
|
+
'transition-colors ease-out outline-none',
|
|
49
|
+
'peer-focus-visible:border-ring peer-focus-visible:ring-3 peer-focus-visible:ring-primary-subtle',
|
|
50
|
+
'data-[checked]:bg-primary',
|
|
51
|
+
'data-[invalid]:border-destructive',
|
|
52
|
+
'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',
|
|
53
|
+
className
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
const switchThumbClass = (className?: string) =>
|
|
57
|
+
cn(
|
|
58
|
+
'bg-background pointer-events-none block size-4 rounded-full shadow-xs',
|
|
59
|
+
'transition-transform ease-out',
|
|
60
|
+
'data-[checked]:translate-x-4',
|
|
61
|
+
className
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
const flag = (on: boolean | undefined) => (on ? '' : undefined)
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Without `children` it renders a native `role="switch"` checkbox and its
|
|
68
|
+
* painted track directly, for the same reason and with the same Kobalte
|
|
69
|
+
* contract as `Checkbox`. With `children` the caller composes the parts, so it
|
|
70
|
+
* renders through Kobalte, whose context `SwitchLabel` and `SwitchDescription`
|
|
71
|
+
* need.
|
|
72
|
+
*/
|
|
36
73
|
export function Switch(props: SwitchProps) {
|
|
74
|
+
if ('children' in props) return <ComposedSwitch {...props} />
|
|
75
|
+
const [local, state, rest] = splitProps(
|
|
76
|
+
props,
|
|
77
|
+
[
|
|
78
|
+
'class',
|
|
79
|
+
'controlClass',
|
|
80
|
+
'thumbClass',
|
|
81
|
+
'labelClass',
|
|
82
|
+
'descriptionClass',
|
|
83
|
+
'label',
|
|
84
|
+
'description',
|
|
85
|
+
'aria-label',
|
|
86
|
+
'aria-labelledby',
|
|
87
|
+
'aria-describedby',
|
|
88
|
+
'aria-invalid',
|
|
89
|
+
'aria-errormessage',
|
|
90
|
+
'aria-busy',
|
|
91
|
+
'id',
|
|
92
|
+
'inputId',
|
|
93
|
+
'title',
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
'checked',
|
|
97
|
+
'defaultChecked',
|
|
98
|
+
'onChange',
|
|
99
|
+
'name',
|
|
100
|
+
'value',
|
|
101
|
+
'required',
|
|
102
|
+
'disabled',
|
|
103
|
+
'readOnly',
|
|
104
|
+
'validationState',
|
|
105
|
+
]
|
|
106
|
+
)
|
|
107
|
+
const field = useFormFieldControl(
|
|
108
|
+
'control',
|
|
109
|
+
mergeProps(local, {
|
|
110
|
+
get id() {
|
|
111
|
+
return local.inputId ?? local.id
|
|
112
|
+
},
|
|
113
|
+
})
|
|
114
|
+
)
|
|
115
|
+
const uid = createUniqueId()
|
|
116
|
+
// Kobalte's ids and defaults: the root names the input and, without a `name`, the form value.
|
|
117
|
+
const rootId = () => (field ? undefined : local.id) ?? `switch-${uid}`
|
|
118
|
+
const inputId = () => field?.id ?? local.inputId ?? `${rootId()}-input`
|
|
119
|
+
const descriptionId = `switch-${uid}-description`
|
|
120
|
+
const labelId = `switch-${uid}-label`
|
|
121
|
+
const [ownChecked, setOwnChecked] = createSignal(state.defaultChecked ?? false)
|
|
122
|
+
const checked = () => state.checked ?? ownChecked()
|
|
123
|
+
const setChecked = (next: boolean) => {
|
|
124
|
+
if (state.disabled || state.readOnly || next === checked()) return
|
|
125
|
+
if (state.checked === undefined) setOwnChecked(next)
|
|
126
|
+
state.onChange?.(next)
|
|
127
|
+
}
|
|
128
|
+
let input: HTMLInputElement | undefined
|
|
129
|
+
// A native form reset puts the input back on its default without an input or
|
|
130
|
+
// change event, so the state follows it, as Kobalte's does.
|
|
131
|
+
onMount(() => {
|
|
132
|
+
// The reset baseline (the `checked` attribute); `checked` above only sets the property.
|
|
133
|
+
if (input) input.defaultChecked = state.defaultChecked ?? false
|
|
134
|
+
const form = input?.form
|
|
135
|
+
if (!form) return
|
|
136
|
+
const reset = () => {
|
|
137
|
+
setChecked(state.defaultChecked ?? false)
|
|
138
|
+
// The browser resets the input after this event; then the input shows the state.
|
|
139
|
+
setTimeout(() => {
|
|
140
|
+
if (input) input.checked = checked()
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
form.addEventListener('reset', reset)
|
|
144
|
+
onCleanup(() => form.removeEventListener('reset', reset))
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
const label = resolveChildren(() => local.label)
|
|
148
|
+
const description = resolveChildren(() => local.description)
|
|
149
|
+
// Kobalte's naming rules: the label element, then the input itself when it
|
|
150
|
+
// also has an aria-label; the description before any caller's description.
|
|
151
|
+
const labelledBy = () => {
|
|
152
|
+
const external = field?.['aria-labelledby'] ?? local['aria-labelledby']
|
|
153
|
+
const own = label() ? labelId : undefined
|
|
154
|
+
const self = (external || own) && local['aria-label'] ? inputId() : undefined
|
|
155
|
+
return [external, own, self].filter(Boolean).join(' ') || undefined
|
|
156
|
+
}
|
|
157
|
+
const describedBy = () =>
|
|
158
|
+
[description() ? descriptionId : '', field?.['aria-describedby'] ?? local['aria-describedby']]
|
|
159
|
+
.filter(Boolean)
|
|
160
|
+
.join(' ') || undefined
|
|
161
|
+
const dataChecked = () => flag(checked())
|
|
162
|
+
const dataInvalid = () => flag(state.validationState === 'invalid')
|
|
163
|
+
const dataDisabled = () => flag(state.disabled)
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<div
|
|
167
|
+
data-slot="switch"
|
|
168
|
+
role="group"
|
|
169
|
+
id={rootId()}
|
|
170
|
+
title={local.title}
|
|
171
|
+
class={cn('group/switch relative flex items-center gap-2.5', local.class)}
|
|
172
|
+
data-checked={dataChecked()}
|
|
173
|
+
data-invalid={dataInvalid()}
|
|
174
|
+
data-valid={flag(state.validationState === 'valid')}
|
|
175
|
+
data-required={flag(state.required)}
|
|
176
|
+
data-disabled={dataDisabled()}
|
|
177
|
+
data-readonly={flag(state.readOnly)}
|
|
178
|
+
{...(rest as ComponentProps<'div'>)}
|
|
179
|
+
>
|
|
180
|
+
{/* The name belongs on the input; see Checkbox for why. */}
|
|
181
|
+
<input
|
|
182
|
+
ref={(element) => {
|
|
183
|
+
input = element
|
|
184
|
+
}}
|
|
185
|
+
type="checkbox"
|
|
186
|
+
role="switch"
|
|
187
|
+
class="peer sr-only"
|
|
188
|
+
id={inputId()}
|
|
189
|
+
name={state.name ?? rootId()}
|
|
190
|
+
value={state.value ?? 'on'}
|
|
191
|
+
checked={checked()}
|
|
192
|
+
aria-checked={checked()}
|
|
193
|
+
required={state.required}
|
|
194
|
+
disabled={state.disabled}
|
|
195
|
+
readOnly={state.readOnly}
|
|
196
|
+
aria-label={local['aria-label']}
|
|
197
|
+
aria-labelledby={labelledBy()}
|
|
198
|
+
aria-describedby={describedBy()}
|
|
199
|
+
aria-invalid={
|
|
200
|
+
field?.['aria-invalid'] ??
|
|
201
|
+
local['aria-invalid'] ??
|
|
202
|
+
(state.validationState === 'invalid' || undefined)
|
|
203
|
+
}
|
|
204
|
+
aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}
|
|
205
|
+
aria-busy={local['aria-busy']}
|
|
206
|
+
aria-required={state.required}
|
|
207
|
+
aria-disabled={state.disabled}
|
|
208
|
+
aria-readonly={state.readOnly}
|
|
209
|
+
title={local.title}
|
|
210
|
+
data-checked={dataChecked()}
|
|
211
|
+
onChange={(event) => {
|
|
212
|
+
event.stopPropagation()
|
|
213
|
+
setChecked(event.currentTarget.checked)
|
|
214
|
+
// Controlled: the switch shows the value the host keeps, not the click.
|
|
215
|
+
event.currentTarget.checked = checked()
|
|
216
|
+
}}
|
|
217
|
+
/>
|
|
218
|
+
<div
|
|
219
|
+
data-checked={dataChecked()}
|
|
220
|
+
data-invalid={dataInvalid()}
|
|
221
|
+
data-disabled={dataDisabled()}
|
|
222
|
+
class={switchControlClass(local.controlClass)}
|
|
223
|
+
onClick={() => {
|
|
224
|
+
setChecked(!checked())
|
|
225
|
+
input?.focus({ preventScroll: true })
|
|
226
|
+
}}
|
|
227
|
+
>
|
|
228
|
+
<div data-checked={dataChecked()} class={switchThumbClass(local.thumbClass)} />
|
|
229
|
+
</div>
|
|
230
|
+
<Show when={label() || description()}>
|
|
231
|
+
<div class="grid gap-0.5">
|
|
232
|
+
<Show when={label()}>
|
|
233
|
+
<label
|
|
234
|
+
id={labelId}
|
|
235
|
+
for={inputId()}
|
|
236
|
+
class={cn('text-sm leading-none font-medium', local.labelClass)}
|
|
237
|
+
data-checked={dataChecked()}
|
|
238
|
+
data-disabled={dataDisabled()}
|
|
239
|
+
>
|
|
240
|
+
{label()}
|
|
241
|
+
</label>
|
|
242
|
+
</Show>
|
|
243
|
+
<Show when={description()}>
|
|
244
|
+
<div
|
|
245
|
+
id={descriptionId}
|
|
246
|
+
class={cn('text-muted-foreground text-sm', local.descriptionClass)}
|
|
247
|
+
data-checked={dataChecked()}
|
|
248
|
+
data-disabled={dataDisabled()}
|
|
249
|
+
>
|
|
250
|
+
{description()}
|
|
251
|
+
</div>
|
|
252
|
+
</Show>
|
|
253
|
+
</div>
|
|
254
|
+
</Show>
|
|
255
|
+
</div>
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function ComposedSwitch(props: SwitchProps) {
|
|
37
260
|
const [local, rest] = splitProps(props, [
|
|
38
261
|
'class',
|
|
39
262
|
'controlClass',
|
|
@@ -53,14 +276,14 @@ export function Switch(props: SwitchProps) {
|
|
|
53
276
|
'inputId',
|
|
54
277
|
'title',
|
|
55
278
|
])
|
|
56
|
-
const field = useFormFieldControl(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
279
|
+
const field = useFormFieldControl(
|
|
280
|
+
'control',
|
|
281
|
+
mergeProps(local, {
|
|
282
|
+
get id() {
|
|
283
|
+
return local.inputId ?? local.id
|
|
284
|
+
},
|
|
285
|
+
})
|
|
286
|
+
)
|
|
64
287
|
|
|
65
288
|
// Slots are JSX getters that build per read; resolve each once.
|
|
66
289
|
const label = resolveChildren(() => local.label)
|
|
@@ -75,6 +298,7 @@ export function Switch(props: SwitchProps) {
|
|
|
75
298
|
>
|
|
76
299
|
{/* The name belongs on the input; see Checkbox for why. */}
|
|
77
300
|
<KobalteSwitch.Input
|
|
301
|
+
class="peer"
|
|
78
302
|
id={field?.id ?? local.inputId}
|
|
79
303
|
aria-label={local['aria-label']}
|
|
80
304
|
aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}
|
|
@@ -84,25 +308,8 @@ export function Switch(props: SwitchProps) {
|
|
|
84
308
|
aria-busy={local['aria-busy']}
|
|
85
309
|
title={local.title}
|
|
86
310
|
/>
|
|
87
|
-
<KobalteSwitch.Control
|
|
88
|
-
class={
|
|
89
|
-
'bg-input inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent',
|
|
90
|
-
'transition-colors ease-out outline-none',
|
|
91
|
-
'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',
|
|
92
|
-
'data-[checked]:bg-primary',
|
|
93
|
-
'data-[invalid]:border-destructive',
|
|
94
|
-
'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',
|
|
95
|
-
local.controlClass
|
|
96
|
-
)}
|
|
97
|
-
>
|
|
98
|
-
<KobalteSwitch.Thumb
|
|
99
|
-
class={cn(
|
|
100
|
-
'bg-background pointer-events-none block size-4 rounded-full shadow-xs',
|
|
101
|
-
'transition-transform ease-out',
|
|
102
|
-
'data-[checked]:translate-x-4',
|
|
103
|
-
local.thumbClass
|
|
104
|
-
)}
|
|
105
|
-
/>
|
|
311
|
+
<KobalteSwitch.Control class={switchControlClass(local.controlClass)}>
|
|
312
|
+
<KobalteSwitch.Thumb class={switchThumbClass(local.thumbClass)} />
|
|
106
313
|
</KobalteSwitch.Control>
|
|
107
314
|
{local.children ??
|
|
108
315
|
(label() || description() ? (
|