@adea-ai/ui 0.162.6 → 0.162.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/composites/about-dialog/about-dialog.js +5 -5
- package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
- package/dist/components/composites/accent-picker/accent-picker.js +3 -3
- package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
- package/dist/components/composites/accent-picker/custom-color-popover.js +2 -2
- package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +22 -22
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.js +2 -2
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +3 -3
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +10 -10
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +13 -13
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +12 -12
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js +13 -13
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser-group.js +9 -9
- package/dist/components/composites/catalog-browser/catalog-browser-group.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +10 -10
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.js +5 -5
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.js +7 -7
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.js +5 -5
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +13 -13
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.js +7 -7
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js +1 -1
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js +9 -9
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/help-center/help-center.js +5 -5
- package/dist/components/composites/help-center/help-center.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +10 -10
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/icon-picker/image-data-url.js.map +1 -1
- package/dist/components/composites/icon-picker/shell-icons.js +117 -117
- package/dist/components/composites/icon-picker/shell-icons.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.js +7 -7
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +1 -1
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/list-row/list-row.js +2 -2
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js +7 -7
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js +1 -1
- package/dist/components/composites/message-scroller/scroll-anchor.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.js +12 -12
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/plan/plan.js +5 -5
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/prompt-input/prompt-input.js +3 -3
- package/dist/components/composites/prompt-input/prompt-input.js.map +1 -1
- package/dist/components/composites/queue/queue.js +13 -13
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.js +5 -5
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/scene-controls/scene-controls.js +16 -16
- package/dist/components/composites/scene-controls/scene-controls.js.map +1 -1
- package/dist/components/composites/settings/settings-layout.js +2 -2
- package/dist/components/composites/settings/settings-layout.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +2 -2
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/settings/settings.js +5 -5
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/sources.js +5 -5
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/parse-stack-trace.js +2 -2
- package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js +10 -10
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.js +6 -6
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.js +5 -5
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/suggestion/suggestion.js +2 -2
- package/dist/components/composites/suggestion/suggestion.js.map +1 -1
- package/dist/components/composites/task/task.js +5 -5
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/ansi.js +1 -1
- package/dist/components/composites/terminal/ansi.js.map +1 -1
- package/dist/components/composites/terminal/terminal.js +18 -18
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results.js +17 -17
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.js +5 -5
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.js +6 -6
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js +1 -1
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +23 -23
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +2 -2
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js +6 -6
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.js +11 -11
- package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
- package/dist/components/conversation/atomic/chat-composer.js +1 -1
- package/dist/components/conversation/busy-send-button.js +10 -10
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/chat-composer.js +1 -1
- package/dist/components/conversation/composer-core.js +1 -1
- package/dist/components/conversation/composer-menu.js +2 -2
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.js +7 -7
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-pane.js +1 -1
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.js +5 -5
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +9 -9
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.js +9 -9
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.js +13 -13
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/paste-token-editor.js +1 -1
- package/dist/components/conversation/paste-token-editor.js.map +1 -1
- package/dist/components/conversation/scroll-follow.js +1 -1
- package/dist/components/conversation/thread-panel.js +5 -5
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.js +5 -5
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/app-shell/app-shell.js +1 -1
- package/dist/components/layout/app-shell/app-shell.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js +1 -1
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js +2 -2
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js +1 -1
- package/dist/components/layout/floating-preview/floating-preview.js +7 -7
- package/dist/components/layout/floating-preview/floating-preview.js.map +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -1
- package/dist/components/layout/page/page.js +2 -2
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/panel/panel.js +1 -1
- package/dist/components/layout/panel/panel.js.map +1 -1
- package/dist/components/layout/pixel-pane/pixel-pane.js +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +5 -5
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/shell-rail/shell-rail.js +5 -5
- package/dist/components/layout/shell-rail/shell-rail.js.map +1 -1
- package/dist/components/layout/shell-top-bar/shell-top-bar.js +2 -2
- package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +2 -2
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +5 -5
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/pane-focus.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +7 -7
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/status-bar/status-bar.js +1 -1
- package/dist/components/layout/status-bar/status-bar.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +5 -5
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js.map +1 -1
- package/dist/components/motion/presence.js +1 -1
- package/dist/components/theme/appearance-panel.js +3 -3
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/lazy.js +3 -3
- package/dist/components/theme/lazy.js.map +1 -1
- package/dist/components/theme/script-projection.js +1 -1
- package/dist/components/theme/theme-catalogue-source.js +1 -1
- package/dist/components/theme/theme-document.js.map +1 -1
- package/dist/components/theme/theme-mode-toggle.js +7 -7
- package/dist/components/theme/theme-mode-toggle.js.map +1 -1
- package/dist/components/theme/theme-picker.js +2 -2
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider-value.js +1 -1
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/theme/theme-provider.js +1 -1
- package/dist/components/theme/theme-toggle.js +7 -7
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/accordion/accordion.js +13 -13
- package/dist/components/ui/accordion/accordion.js.map +1 -1
- package/dist/components/ui/alert/alert.js +12 -12
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +14 -14
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.js +2 -2
- package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/ui/attachment/attachment.js +16 -16
- package/dist/components/ui/attachment/attachment.js.map +1 -1
- package/dist/components/ui/avatar/avatar.js +1 -1
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/badge/badge.js +2 -2
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/board/board.js +2 -2
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js +7 -7
- package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/ui/bubble/bubble.js +2 -2
- package/dist/components/ui/bubble/bubble.js.map +1 -1
- package/dist/components/ui/button/button.js +2 -2
- package/dist/components/ui/button-group/button-group.js +2 -2
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +8 -8
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/callout/callout.js +2 -2
- package/dist/components/ui/callout/callout.js.map +1 -1
- package/dist/components/ui/card/card.js +2 -2
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/carousel/carousel.js +8 -8
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/chart/chart.js +2 -2
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +6 -6
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.js +6 -6
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/collapsible/collapsible.js +7 -7
- package/dist/components/ui/collapsible/collapsible.js.map +1 -1
- package/dist/components/ui/combobox/combobox.js +21 -21
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/combobox/value-combobox.js +1 -1
- package/dist/components/ui/command/command.js +23 -23
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js +2 -2
- package/dist/components/ui/detail-panel/detail-panel.js +5 -5
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js +2 -2
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js +21 -21
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/diff-block/diff-block.js +2 -2
- package/dist/components/ui/diff-block/diff-block.js.map +1 -1
- package/dist/components/ui/drawer/drawer.js +14 -14
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +3 -3
- package/dist/components/ui/dropdown-menu/menu-parts.js +10 -10
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.js +5 -5
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/empty/empty.js +1 -1
- package/dist/components/ui/empty/empty.js.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +2 -2
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.js +14 -14
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.js +2 -2
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.js +10 -10
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/input/input-control.js +1 -1
- package/dist/components/ui/input/input-control.js.map +1 -1
- package/dist/components/ui/input/input.js +2 -2
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-group/input-group.js +2 -2
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-group/secret-input-group.js +2 -2
- package/dist/components/ui/input-otp/input-otp.js +2 -2
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/item/item.js +2 -2
- package/dist/components/ui/item/item.js.map +1 -1
- package/dist/components/ui/kbd/kbd.js +2 -2
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/label/label.js +1 -1
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/marker/marker.js +2 -2
- package/dist/components/ui/marker/marker.js.map +1 -1
- package/dist/components/ui/menubar/menubar.js +7 -7
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/message.js +3 -3
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +2 -2
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/native-select/native-select.js +5 -5
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +18 -18
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js +28 -28
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/popover/popover.js +15 -15
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/progress/progress.js +5 -5
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +10 -10
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +9 -9
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.js +11 -11
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/ui/select/select.js +21 -21
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/separator/separator.js +5 -5
- package/dist/components/ui/separator/separator.js.map +1 -1
- package/dist/components/ui/sheet/sheet.js +6 -6
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.js +1 -1
- package/dist/components/ui/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/slider/slider.js +5 -5
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/spinner/spinner.js +5 -5
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js +2 -2
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.js +4 -4
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/table/table.js +1 -1
- package/dist/components/ui/table/table.js.map +1 -1
- package/dist/components/ui/tabs/tabs.js +7 -7
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/text-link/text-link.js +1 -1
- package/dist/components/ui/text-link/text-link.js.map +1 -1
- package/dist/components/ui/textarea/textarea.js +2 -2
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.js +7 -7
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/toggle/toggle.js +6 -6
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/toggle-group/toggle-group.js +7 -8
- package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
- package/dist/components/ui/tooltip/deferred-tooltip.js +6 -6
- package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -1
- package/dist/components/ui/tooltip/lazy-tooltip.js +2 -2
- package/dist/components/ui/tooltip/tooltip.js +10 -10
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/trace.js +19 -19
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.js +2 -2
- package/dist/lib/accent-presets.js +1 -1
- package/dist/lib/accent-roles.js +2 -2
- package/dist/lib/async-action.js +1 -1
- package/dist/lib/create-poll.js +1 -1
- package/dist/lib/create-poll.js.map +1 -1
- package/dist/lib/external-link.js +1 -1
- package/dist/lib/external-link.js.map +1 -1
- package/dist/lib/fast-icon.js +1 -1
- package/dist/lib/theme-css.js +1 -1
- package/dist/lib/theme-engine-light.js +1 -1
- package/dist/lib/theme-projection.js +2 -2
- package/dist/lib/theme-records.js +1 -1
- package/dist/lib/themes.js +1 -1
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tooltip-focus-gate.js.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/vite/source-parser.js +1 -1
- package/dist/vite/tailwind-sources.js +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-icon.js","names":["{props.glyph.kind === 'component' ? (\n <Dynamic component={props.glyph.value} />\n ) : (\n props.glyph.value\n )}","<Dynamic component={props.glyph.value} />","<Show when={!failed()}>\n <img\n data-slot=\"entity-icon-image\"\n src={props.src}\n alt=\"\"\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute inset-0 size-full object-contain\"\n // Deferred a microtask: a DOM that fires `error` synchronously inside\n // the `src` write (happy-dom) would otherwise write during the render.\n onError={() => queueMicrotask(() => setFailed(true))}\n />\n </Show>","role=\"img\"","<Show\n when={glyph()}\n fallback={local.fallback ? local.fallback(local.name) : monogram(local.name)}\n >\n {(value) => <Glyph glyph={value()} />}\n </Show>","local.fallback ? local.fallback(local.name) : monogram(local.name)","<Glyph glyph={value()} />","<span\n data-slot=\"entity-icon\"\n class={cn(\n entityIconVariants({ shape: local.shape, size: local.size, tone: local.tone }),\n local.ring && 'ring-2 ring-ring ring-offset-2 ring-offset-background',\n // A presentation attribute (`fill=\"#4A154B\"`) loses to any CSS rule, so\n // this overrides the brand's hex without touching the caller's SVG.\n local.monochrome && \"[&_[fill]:not([fill='none'])]:fill-current\",\n local.class\n )}\n role=\"img\"\n aria-label={local.name}\n {...rest}\n >\n <Show\n when={glyph()}\n fallback={local.fallback ? local.fallback(local.name) : monogram(local.name)}\n >\n {(value) => <Glyph glyph={value()} />}\n </Show>\n <Show when={local.src} keyed>\n {(src) => <EntityIconImage src={src} />}\n </Show>\n <Show when={local.badge}>\n {(badgeSlot) => (\n <span class=\"absolute right-0 bottom-0 translate-x-1/4 translate-y-1/4\">\n {badgeSlot()}\n </span>\n )}\n </Show>\n </span>","<Show when={local.src} keyed>\n {(src) => <EntityIconImage src={src} />}\n </Show>","<EntityIconImage src={src} />","<Show when={local.badge}>\n {(badgeSlot) => (\n <span class=\"absolute right-0 bottom-0 translate-x-1/4 translate-y-1/4\">\n {badgeSlot()}\n </span>\n )}\n </Show>"],"sources":["../../../../src/components/ui/entity-icon/entity-icon.tsx"],"sourcesContent":["import { createSignal, Show, omit, type Component } from 'solid-js'\nimport { type ComponentProps, type JSX } from '@solidjs/web'\nimport { Dynamic } from '@solidjs/web'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * EntityIcon.\n *\n * A tile that stands for a thing: a room, a project, an agent, an installed\n * plugin, a workspace. Its job is to be identifiable in a column of its\n * siblings, which is a different job from `Avatar`'s (identifying a *person*) and\n * the reason the two are separate components rather than one with a `round` prop.\n *\n * Three decisions are baked in because getting them wrong is what makes icon\n * grids look messy:\n *\n * 1. **A glyph is always present.** A brand with no logo gets a monogram, not an\n * empty box. `fallback` takes the name and returns the glyph, so a caller can\n * choose initials, a domain letter, or a kind icon. When `src` is supplied,\n * its contained image overlays that glyph and failure reveals the glyph below.\n * 2. **The tile owns its own contrast.** `tone` tints the background while\n * monogram text keeps the body foreground; vector glyphs retain the status\n * colour. A caller never picks a colour pair or ships a glyph that disappears.\n * 3. **Size is on the control ladder**, not arbitrary. A tile in a rail and a\n * tile in a detail header are the same two or three sizes every other\n * interactive element uses.\n *\n * `shape=\"rounded\"` is the default because a rounded square reads as an object\n * and a circle reads as a person; use `circle` only when the tile really does\n * hold a face.\n *\n * `monochrome` is for a third-party brand mark — a vendor logo drawn with its\n * own `fill`. A brand's hex is chosen for a white page: GitHub's near-black and\n * Slack's aubergine all but vanish on a dark tile, and no tone can be picked\n * that suits every brand in both themes. `monochrome` repaints any explicitly\n * filled shape in the tile's glyph colour (the tone's), so the mark stays\n * recognisable by its shape and legible in every theme. Stroke-drawn icons\n * (Lucide, `fill=\"none\"`) are left alone.\n */\nexport const entityIconVariants = cva(\n 'relative inline-flex shrink-0 items-center justify-center overflow-hidden border font-semibold select-none [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n shape: {\n rounded: 'rounded-lg',\n circle: 'rounded-full',\n square: 'rounded-none',\n },\n size: {\n xs: 'size-5 text-2xs [&_svg]:size-3',\n sm: 'size-6 text-2xs [&_svg]:size-3.5',\n md: 'size-8 text-xs [&_svg]:size-4',\n lg: 'size-10 text-sm [&_svg]:size-5',\n xl: 'size-12 text-base [&_svg]:size-6',\n },\n tone: {\n /** Neutral: an inset tile with a hairline edge — the default. */\n neutral: 'border-border bg-muted text-muted-foreground',\n /** On the brand: for a thing the application itself owns. */\n primary: 'border-transparent bg-primary-subtle text-primary',\n /** Bare: no fill and no edge, for a tile that already sits on a surface. */\n bare: 'border-transparent bg-transparent text-foreground',\n success: 'border-transparent bg-success-subtle text-foreground [&_svg]:text-success',\n warning: 'border-transparent bg-warning-subtle text-foreground [&_svg]:text-warning',\n danger: 'border-transparent bg-destructive-subtle text-foreground [&_svg]:text-destructive',\n info: 'border-transparent bg-info-subtle text-foreground [&_svg]:text-info',\n },\n },\n defaultVariants: { shape: 'rounded', size: 'md', tone: 'neutral' },\n }\n)\n\ntype EntityIconVariantProps = VariantProps<typeof entityIconVariants>\n\nexport type EntityIconProps = Omit<ComponentProps<'span'>, 'children'> &\n EntityIconVariantProps & {\n /** The entity's name. Used for the accessible label and, via `fallback`, the monogram. */\n name: string\n /** Optional image URL. The image is decorative; `name` remains the accessible label. */\n src?: string\n /**\n * A logo or icon — a Lucide icon reference (`icon={Wrench}`) or an element\n * (`icon={<Wrench />}`). Both are accepted because both are what a caller\n * naturally writes, and the difference is an implementation detail they should\n * not have to know.\n */\n icon?: Component | JSX.Element\n /** Glyph for an entity with no icon. Defaults to the name's first two letters. */\n fallback?: (name: string) => JSX.Element\n /** A corner badge: a status dot, an unread count, an installed tick. */\n badge?: JSX.Element\n /** A second edge, drawn outside the tile — an active or selected ring. */\n ring?: boolean\n /** Repaint a brand mark's own fills in the tile's glyph colour. */\n monochrome?: boolean\n }\n\n/**\n * Two letters from a name, chosen so the result is stable and readable: the\n * first letter of the first two words when there are two (\"Agent HQ\" → \"AH\"),\n * otherwise the first two characters (\"Kitchen\" → \"Ki\").\n */\nexport function monogram(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean)\n if (words.length >= 2) return (words[0]![0]! + words[1]![0]!).toUpperCase()\n return name.trim().slice(0, 2)\n}\n\n/**\n * A glyph is either a component reference or an element, and the two render\n * differently — `Dynamic` for the first, the element itself for the second. The\n * union is discriminated so the branch is checked rather than cast.\n */\ntype Glyph = { kind: 'component'; value: Component } | { kind: 'element'; value: JSX.Element }\n\nfunction Glyph(props: { glyph: Glyph }) {\n // Inside JSX, so the branch is read where it is tracked, not once in the body.\n return (\n <>\n {props.glyph.kind === 'component' ? (\n <Dynamic component={props.glyph.value} />\n ) : (\n props.glyph.value\n )}\n </>\n )\n}\n\nfunction EntityIconImage(props: { src: string }) {\n const [failed, setFailed] = createSignal(false)\n\n return (\n <Show when={!failed()}>\n <img\n data-slot=\"entity-icon-image\"\n src={props.src}\n alt=\"\"\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute inset-0 size-full object-contain\"\n // Deferred a microtask: a DOM that fires `error` synchronously inside\n // the `src` write (happy-dom) would otherwise write during the render.\n onError={() => queueMicrotask(() => setFailed(true))}\n />\n </Show>\n )\n}\n\nexport function EntityIcon(props: EntityIconProps) {\n const local = props\n const rest = omit(\n props,\n 'name',\n 'src',\n 'icon',\n 'fallback',\n 'badge',\n 'ring',\n 'monochrome',\n 'shape',\n 'size',\n 'tone',\n 'class'\n )\n\n const glyph = (): Glyph | undefined => {\n const icon = local.icon\n if (!icon) return undefined\n return typeof icon === 'function'\n ? { kind: 'component', value: icon as Component }\n : { kind: 'element', value: icon as JSX.Element }\n }\n\n return (\n <span\n data-slot=\"entity-icon\"\n class={cn(\n entityIconVariants({ shape: local.shape, size: local.size, tone: local.tone }),\n local.ring && 'ring-2 ring-ring ring-offset-2 ring-offset-background',\n // A presentation attribute (`fill=\"#4A154B\"`) loses to any CSS rule, so\n // this overrides the brand's hex without touching the caller's SVG.\n local.monochrome && \"[&_[fill]:not([fill='none'])]:fill-current\",\n local.class\n )}\n role=\"img\"\n aria-label={local.name}\n {...rest}\n >\n <Show\n when={glyph()}\n fallback={local.fallback ? local.fallback(local.name) : monogram(local.name)}\n >\n {(value) => <Glyph glyph={value()} />}\n </Show>\n <Show when={local.src} keyed>\n {(src) => <EntityIconImage src={src} />}\n </Show>\n <Show when={local.badge}>\n {(badgeSlot) => (\n <span class=\"absolute right-0 bottom-0 translate-x-1/4 translate-y-1/4\">\n {badgeSlot()}\n </span>\n )}\n </Show>\n </span>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAa,qBAAqB,IAChC,2JACA;CACE,UAAU;EACR,OAAO;GACL,SAAS;GACT,QAAQ;GACR,QAAQ;EACV;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,MAAM;;GAEJ,SAAS;;GAET,SAAS;;GAET,MAAM;GACN,SAAS;GACT,SAAS;GACT,QAAQ;GACR,MAAM;EACR;CACF;CACA,iBAAiB;EAAE,OAAO;EAAW,MAAM;EAAM,MAAM;CAAU;AACnE,CACF;;;;;;AAgCA,SAAgB,SAAS,MAAsB;CAC7C,MAAM,QAAQ,KAAK,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO;CACrD,IAAI,MAAM,UAAU,GAAG,QAAQ,MAAM,EAAE,CAAE,KAAM,MAAM,EAAE,CAAE,GAAA,CAAK,YAAY;CAC1E,OAAO,KAAK,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;AAC/B;AASA,SAAS,MAAM,OAAyB;CAEtC,OAEIA,WAAAA;;GAAC,OAAA,MAAM,MAAM,SAAS;EAIrB,CAAA,CAAC,CAAD,IAHCC,gBAAAA,SAAAA,EAAS,IAAA,YAAA;GAAW,OAAA,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C,CAAD,IAAhD,MAAM,SAAS,MAAM,IAAI,IAAI,SAAS,MAAM,IAAI;EAAC;EAF9ED,WAII,UAAUE,gBAAAA,OAAAA,EAAO,IAAA,QAAA;GAAO,OAAA,MAAM;EAAC,EAAG,CAAA;CAChC,CAAA,GAnBRC,KA8BM;CA9BN,OAAA,OAoBEC,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAG;EAAE,OAAA;EAAvBA,WACI,QAAQC,gBAAAA,iBAAAA,EAAsB,IAAM,CAAA;CAClC,CAAA,GAtBRF,KA8BM;CA9BN,OAAA,OAuBEG,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAK;EAAvBA,WACI,qBACA;GAEM,IAAA,QAAA,QAAA;GAFN,OAAA,OACG,SACG;GAFN,OAAA;EAEM,EAAA,CAAA;CAEJ,CAAA,GA7BRH,KA8BM;CA/BR,OACEA;AAgCJ"}
|
|
1
|
+
{"version":3,"file":"entity-icon.js","names":["{props.glyph.kind === 'component' ? (\n <Dynamic component={props.glyph.value} />\n ) : (\n props.glyph.value\n )}","<Dynamic component={props.glyph.value} />","<Show when={!failed()}>\n <img\n data-slot=\"entity-icon-image\"\n src={props.src}\n alt=\"\"\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute inset-0 size-full object-contain\"\n // Deferred a microtask: a DOM that fires `error` synchronously inside\n // the `src` write (happy-dom) would otherwise write during the render.\n onError={() => queueMicrotask(() => setFailed(true))}\n />\n </Show>","role=\"img\"","<Show\n when={glyph()}\n fallback={local.fallback ? local.fallback(local.name) : monogram(local.name)}\n >\n {(value) => <Glyph glyph={value()} />}\n </Show>","local.fallback ? local.fallback(local.name) : monogram(local.name)","<Glyph glyph={value()} />","<span\n data-slot=\"entity-icon\"\n class={cn(\n entityIconVariants({ shape: local.shape, size: local.size, tone: local.tone }),\n local.ring && 'ring-2 ring-ring ring-offset-2 ring-offset-background',\n // A presentation attribute (`fill=\"#4A154B\"`) loses to any CSS rule, so\n // this overrides the brand's hex without touching the caller's SVG.\n local.monochrome && \"[&_[fill]:not([fill='none'])]:fill-current\",\n local.class\n )}\n role=\"img\"\n aria-label={local.name}\n {...rest}\n >\n <Show\n when={glyph()}\n fallback={local.fallback ? local.fallback(local.name) : monogram(local.name)}\n >\n {(value) => <Glyph glyph={value()} />}\n </Show>\n <Show when={local.src} keyed>\n {(src) => <EntityIconImage src={src} />}\n </Show>\n <Show when={local.badge}>\n {(badgeSlot) => (\n <span class=\"absolute right-0 bottom-0 translate-x-1/4 translate-y-1/4\">\n {badgeSlot()}\n </span>\n )}\n </Show>\n </span>","<Show when={local.src} keyed>\n {(src) => <EntityIconImage src={src} />}\n </Show>","<EntityIconImage src={src} />","<Show when={local.badge}>\n {(badgeSlot) => (\n <span class=\"absolute right-0 bottom-0 translate-x-1/4 translate-y-1/4\">\n {badgeSlot()}\n </span>\n )}\n </Show>","_$effect","_$setAttribute","_$spread","_$insert"],"sources":["../../../../src/components/ui/entity-icon/entity-icon.tsx"],"sourcesContent":["import { createSignal, Show, omit, type Component } from 'solid-js'\nimport { type ComponentProps, type JSX } from '@solidjs/web'\nimport { Dynamic } from '@solidjs/web'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * EntityIcon.\n *\n * A tile that stands for a thing: a room, a project, an agent, an installed\n * plugin, a workspace. Its job is to be identifiable in a column of its\n * siblings, which is a different job from `Avatar`'s (identifying a *person*) and\n * the reason the two are separate components rather than one with a `round` prop.\n *\n * Three decisions are baked in because getting them wrong is what makes icon\n * grids look messy:\n *\n * 1. **A glyph is always present.** A brand with no logo gets a monogram, not an\n * empty box. `fallback` takes the name and returns the glyph, so a caller can\n * choose initials, a domain letter, or a kind icon. When `src` is supplied,\n * its contained image overlays that glyph and failure reveals the glyph below.\n * 2. **The tile owns its own contrast.** `tone` tints the background while\n * monogram text keeps the body foreground; vector glyphs retain the status\n * colour. A caller never picks a colour pair or ships a glyph that disappears.\n * 3. **Size is on the control ladder**, not arbitrary. A tile in a rail and a\n * tile in a detail header are the same two or three sizes every other\n * interactive element uses.\n *\n * `shape=\"rounded\"` is the default because a rounded square reads as an object\n * and a circle reads as a person; use `circle` only when the tile really does\n * hold a face.\n *\n * `monochrome` is for a third-party brand mark — a vendor logo drawn with its\n * own `fill`. A brand's hex is chosen for a white page: GitHub's near-black and\n * Slack's aubergine all but vanish on a dark tile, and no tone can be picked\n * that suits every brand in both themes. `monochrome` repaints any explicitly\n * filled shape in the tile's glyph colour (the tone's), so the mark stays\n * recognisable by its shape and legible in every theme. Stroke-drawn icons\n * (Lucide, `fill=\"none\"`) are left alone.\n */\nexport const entityIconVariants = cva(\n 'relative inline-flex shrink-0 items-center justify-center overflow-hidden border font-semibold select-none [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n shape: {\n rounded: 'rounded-lg',\n circle: 'rounded-full',\n square: 'rounded-none',\n },\n size: {\n xs: 'size-5 text-2xs [&_svg]:size-3',\n sm: 'size-6 text-2xs [&_svg]:size-3.5',\n md: 'size-8 text-xs [&_svg]:size-4',\n lg: 'size-10 text-sm [&_svg]:size-5',\n xl: 'size-12 text-base [&_svg]:size-6',\n },\n tone: {\n /** Neutral: an inset tile with a hairline edge — the default. */\n neutral: 'border-border bg-muted text-muted-foreground',\n /** On the brand: for a thing the application itself owns. */\n primary: 'border-transparent bg-primary-subtle text-primary',\n /** Bare: no fill and no edge, for a tile that already sits on a surface. */\n bare: 'border-transparent bg-transparent text-foreground',\n success: 'border-transparent bg-success-subtle text-foreground [&_svg]:text-success',\n warning: 'border-transparent bg-warning-subtle text-foreground [&_svg]:text-warning',\n danger: 'border-transparent bg-destructive-subtle text-foreground [&_svg]:text-destructive',\n info: 'border-transparent bg-info-subtle text-foreground [&_svg]:text-info',\n },\n },\n defaultVariants: { shape: 'rounded', size: 'md', tone: 'neutral' },\n }\n)\n\ntype EntityIconVariantProps = VariantProps<typeof entityIconVariants>\n\nexport type EntityIconProps = Omit<ComponentProps<'span'>, 'children'> &\n EntityIconVariantProps & {\n /** The entity's name. Used for the accessible label and, via `fallback`, the monogram. */\n name: string\n /** Optional image URL. The image is decorative; `name` remains the accessible label. */\n src?: string\n /**\n * A logo or icon — a Lucide icon reference (`icon={Wrench}`) or an element\n * (`icon={<Wrench />}`). Both are accepted because both are what a caller\n * naturally writes, and the difference is an implementation detail they should\n * not have to know.\n */\n icon?: Component | JSX.Element\n /** Glyph for an entity with no icon. Defaults to the name's first two letters. */\n fallback?: (name: string) => JSX.Element\n /** A corner badge: a status dot, an unread count, an installed tick. */\n badge?: JSX.Element\n /** A second edge, drawn outside the tile — an active or selected ring. */\n ring?: boolean\n /** Repaint a brand mark's own fills in the tile's glyph colour. */\n monochrome?: boolean\n }\n\n/**\n * Two letters from a name, chosen so the result is stable and readable: the\n * first letter of the first two words when there are two (\"Agent HQ\" → \"AH\"),\n * otherwise the first two characters (\"Kitchen\" → \"Ki\").\n */\nexport function monogram(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean)\n if (words.length >= 2) return (words[0]![0]! + words[1]![0]!).toUpperCase()\n return name.trim().slice(0, 2)\n}\n\n/**\n * A glyph is either a component reference or an element, and the two render\n * differently — `Dynamic` for the first, the element itself for the second. The\n * union is discriminated so the branch is checked rather than cast.\n */\ntype Glyph = { kind: 'component'; value: Component } | { kind: 'element'; value: JSX.Element }\n\nfunction Glyph(props: { glyph: Glyph }) {\n // Inside JSX, so the branch is read where it is tracked, not once in the body.\n return (\n <>\n {props.glyph.kind === 'component' ? (\n <Dynamic component={props.glyph.value} />\n ) : (\n props.glyph.value\n )}\n </>\n )\n}\n\nfunction EntityIconImage(props: { src: string }) {\n const [failed, setFailed] = createSignal(false)\n\n return (\n <Show when={!failed()}>\n <img\n data-slot=\"entity-icon-image\"\n src={props.src}\n alt=\"\"\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute inset-0 size-full object-contain\"\n // Deferred a microtask: a DOM that fires `error` synchronously inside\n // the `src` write (happy-dom) would otherwise write during the render.\n onError={() => queueMicrotask(() => setFailed(true))}\n />\n </Show>\n )\n}\n\nexport function EntityIcon(props: EntityIconProps) {\n const local = props\n const rest = omit(\n props,\n 'name',\n 'src',\n 'icon',\n 'fallback',\n 'badge',\n 'ring',\n 'monochrome',\n 'shape',\n 'size',\n 'tone',\n 'class'\n )\n\n const glyph = (): Glyph | undefined => {\n const icon = local.icon\n if (!icon) return undefined\n return typeof icon === 'function'\n ? { kind: 'component', value: icon as Component }\n : { kind: 'element', value: icon as JSX.Element }\n }\n\n return (\n <span\n data-slot=\"entity-icon\"\n class={cn(\n entityIconVariants({ shape: local.shape, size: local.size, tone: local.tone }),\n local.ring && 'ring-2 ring-ring ring-offset-2 ring-offset-background',\n // A presentation attribute (`fill=\"#4A154B\"`) loses to any CSS rule, so\n // this overrides the brand's hex without touching the caller's SVG.\n local.monochrome && \"[&_[fill]:not([fill='none'])]:fill-current\",\n local.class\n )}\n role=\"img\"\n aria-label={local.name}\n {...rest}\n >\n <Show\n when={glyph()}\n fallback={local.fallback ? local.fallback(local.name) : monogram(local.name)}\n >\n {(value) => <Glyph glyph={value()} />}\n </Show>\n <Show when={local.src} keyed>\n {(src) => <EntityIconImage src={src} />}\n </Show>\n <Show when={local.badge}>\n {(badgeSlot) => (\n <span class=\"absolute right-0 bottom-0 translate-x-1/4 translate-y-1/4\">\n {badgeSlot()}\n </span>\n )}\n </Show>\n </span>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAa,qBAAqB,IAChC,2JACA;CACE,UAAU;EACR,OAAO;GACL,SAAS;GACT,QAAQ;GACR,QAAQ;EACV;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,MAAM;;GAEJ,SAAS;;GAET,SAAS;;GAET,MAAM;GACN,SAAS;GACT,SAAS;GACT,QAAQ;GACR,MAAM;EACR;CACF;CACA,iBA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,QA8BM;CA9BN,IAAA,QAAA,MAAA;;;CAYEC,OAAA,OAAA,CAAA;EAXA,aAAA;EACA,IAAA,UAAA;GAAO,OAAA,GACL,mBAAmB;IAAE,OAAO,MAAM;IAAO,MAAM,MAAM;IAAM,MAAM,MAAM;GAAK,CAAC,GAC7E,MAAM,QAAQ,yDAGd,MAAM,cAAc,8CACpB,MAAM,KACR;EAAC;EACDV,MAAAA;EACA,IAAA,eAAA;GAAY,OAAA,MAAM;EAAI;CACd,GAAJ,IAAA,GAAA,IAAA;CAZNW,OAAA,OAcEV,gBAAAA,MAAAA;EACE,IAAA,OAAA;GAAM,OAAA,MAAM;EAAC;EACb,IAAA,WAAA;GAAUC,OAAAA,WAAAA;IAAM,OAAA,CAAA,CAAA,MAAA;GAA2D,CAAA,CAAC,CAAD,IAAhD,MAAM,SAAS,MAAM,IAAI,IAAI,SAAS,MAAM,IAAI;EAAC;EAF9ED,WAII,UAAUE,gBAAAA,OAAAA,EAAO,IAAA,QAAA;GAAO,OAAA,MAAM;EAAC,EAAG,CAAA;CAChC,CAAA,GAnBRC,KA8BM;CA9BNO,OAAA,OAoBEN,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAG;EAAE,OAAA;EAAvBA,WACI,QAAQC,gBAAAA,iBAAAA,EAAsB,IAAM,CAAA;CAClC,CAAA,GAtBRF,KA8BM;CA9BNO,OAAA,OAuBEJ,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAK;EAAvBA,WACI,qBACA;GAEM,IAAA,QAAA,QAAA;GAFNI,OAAA,OACG,SACG;GAFN,OAAA;EAEM,EAAA,CAAA;CAEJ,CAAA,GA7BRP,KA8BM;CA/BR,OACEA;AAgCJ"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { createComponent, insert, memo, mergeProps, setAttribute, spread, template } from "@solidjs/web";
|
|
2
|
+
import { Field as Field$1, FieldDescription as FieldDescription$1, FieldError as FieldError$1, FieldLabel as FieldLabel$1 } from "@ui-sdk/solid/field";
|
|
3
|
+
import { Input } from "@ui-sdk/solid/input";
|
|
4
|
+
import { Textarea } from "@ui-sdk/solid/textarea";
|
|
5
|
+
import { Show, children, createContext, createUniqueId, merge, omit, useContext } from "solid-js";
|
|
1
6
|
import { Label } from "../label/label.js";
|
|
2
7
|
import { FormFieldContext, createFormFieldContext } from "../../../lib/form-field.js";
|
|
3
8
|
import { cn } from "../../../lib/utils.js";
|
|
4
9
|
import { headingVariants } from "../typography/typography.js";
|
|
5
|
-
import { createComponent, insert, memo, mergeProps, setAttribute, spread, template } from "@solidjs/web";
|
|
6
|
-
import { Show, children, createContext, createUniqueId, merge, omit, useContext } from "solid-js";
|
|
7
|
-
import { Field, FieldDescription, FieldError, FieldLabel } from "@ui-sdk/solid/field";
|
|
8
|
-
import { Input } from "@ui-sdk/solid/input";
|
|
9
|
-
import { Textarea } from "@ui-sdk/solid/textarea";
|
|
10
10
|
// src/components/ui/field/field.tsx
|
|
11
11
|
var _tmpl$ = /* @__PURE__ */ template(`<p class="text-muted-foreground text-sm">`);
|
|
12
12
|
var _tmpl$2 = /* @__PURE__ */ template(`<p role=alert class="text-foreground text-sm">`);
|
|
@@ -36,7 +36,7 @@ var FieldValueContext = createContext(null);
|
|
|
36
36
|
* `Field` owns the description and the error slot, so its controls line up and
|
|
37
37
|
* its messages land in the same place regardless of which part is used.
|
|
38
38
|
*/
|
|
39
|
-
function Field
|
|
39
|
+
function Field(props) {
|
|
40
40
|
const rest = omit(props, "class", "validationState", "invalid", "value", "defaultValue", "onChange", "required", "readOnly");
|
|
41
41
|
const invalid = () => props.invalid ?? (props.validationState === void 0 ? void 0 : props.validationState === "invalid");
|
|
42
42
|
return createComponent(FieldValueContext, {
|
|
@@ -58,7 +58,7 @@ function Field$1(props) {
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
get children() {
|
|
61
|
-
return createComponent(Field, mergeProps({
|
|
61
|
+
return createComponent(Field$1, mergeProps({
|
|
62
62
|
get "class"() {
|
|
63
63
|
return cn("flex flex-col gap-1.5", props.class);
|
|
64
64
|
},
|
|
@@ -176,15 +176,15 @@ function FormField(props) {
|
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
function FieldLabel
|
|
179
|
+
function FieldLabel(props) {
|
|
180
180
|
const rest = omit(props, "class");
|
|
181
|
-
return createComponent(FieldLabel, mergeProps({ get "class"() {
|
|
181
|
+
return createComponent(FieldLabel$1, mergeProps({ get "class"() {
|
|
182
182
|
return cn("text-sm leading-none font-medium", props.class);
|
|
183
183
|
} }, rest));
|
|
184
184
|
}
|
|
185
|
-
function FieldDescription
|
|
185
|
+
function FieldDescription(props) {
|
|
186
186
|
const rest = omit(props, "class");
|
|
187
|
-
return createComponent(FieldDescription, mergeProps({ get "class"() {
|
|
187
|
+
return createComponent(FieldDescription$1, mergeProps({ get "class"() {
|
|
188
188
|
return cn("text-muted-foreground text-sm", props.class);
|
|
189
189
|
} }, rest));
|
|
190
190
|
}
|
|
@@ -193,9 +193,9 @@ function FieldDescription$1(props) {
|
|
|
193
193
|
* browser's own validation once a submit finds the control invalid. Without
|
|
194
194
|
* children it shows the browser's message.
|
|
195
195
|
*/
|
|
196
|
-
function FieldError
|
|
196
|
+
function FieldError(props) {
|
|
197
197
|
const rest = omit(props, "class");
|
|
198
|
-
return createComponent(FieldError, mergeProps({ get "class"() {
|
|
198
|
+
return createComponent(FieldError$1, mergeProps({ get "class"() {
|
|
199
199
|
return cn("text-foreground text-sm", props.class);
|
|
200
200
|
} }, rest));
|
|
201
201
|
}
|
|
@@ -303,6 +303,6 @@ function FieldSeparator(props) {
|
|
|
303
303
|
}), _el$9);
|
|
304
304
|
return _el$7;
|
|
305
305
|
}
|
|
306
|
-
export { Field
|
|
306
|
+
export { Field, FieldDescription, FieldError, FieldGroup, FieldInput, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTextArea, FormField };
|
|
307
307
|
|
|
308
308
|
//# sourceMappingURL=field.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","names":["<FieldValueContext value={values}>\n <SdkField class={cn('flex flex-col gap-1.5', props.class)} invalid={invalid()} {...rest} />\n </FieldValueContext>","value={values}","<SdkField class={cn('flex flex-col gap-1.5', props.class)} invalid={invalid()} {...rest} />","<Show when={local.hint}>\n {(hintSlot) => (\n <p id={descriptionId} class=\"text-muted-foreground text-sm\">\n {hintSlot()}\n </p>\n )}\n </Show>","<Show when={local.error}>\n {(errorSlot) => (\n <p id={errorId} role=\"alert\" class=\"text-foreground text-sm\">\n {errorSlot()}\n </p>\n )}\n </Show>","<FieldSet\n class=\"flex flex-col gap-1.5\"\n aria-describedby={field.describedBy()}\n aria-invalid={field.invalid() ? 'true' : undefined}\n >\n <FieldLegend id={labelId} variant=\"label\">\n {local.label}\n </FieldLegend>\n {control()}\n {help()}\n </FieldSet>","class=\"flex flex-col gap-1.5\"","<FieldLegend id={labelId} variant=\"label\">\n {local.label}\n </FieldLegend>","id={labelId}","variant=\"label\"","control()","help()","<Label id={labelId} for={field.controlId()}>\n {local.label}\n </Label>","{control()}","{help()}","<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() ? 'true' : 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>","<FormFieldContext value={field}>\n <Body />\n </FormFieldContext>","value={field}","<Body />","<SdkFieldLabel class={cn('text-sm leading-none font-medium', props.class)} {...rest} />","<SdkFieldDescription class={cn('text-muted-foreground text-sm', props.class)} {...rest} />","<SdkFieldError class={cn('text-foreground text-sm', props.class)} {...rest} />","<SdkInput\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 props.class as string | undefined\n )}\n {...(rest as ComponentProps<typeof SdkInput>)}\n />","<SdkTextarea\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 props.class as string | undefined\n )}\n {...(rest as ComponentProps<typeof SdkTextarea>)}\n />","<fieldset class={cn('flex flex-col gap-4', local.class)} {...rest} />","<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 />","<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 />","<span class=\"bg-border h-px flex-1\" />","<Show when={local.children}>\n {(childrenSlot) => (\n <span class=\"text-muted-foreground text-2xs tracking-wide uppercase\">\n {childrenSlot()}\n </span>\n )}\n </Show>","<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>","Field","resolveChildren","FieldLabel","FieldDescription","FieldError"],"sources":["../../../../src/components/ui/field/field.tsx"],"sourcesContent":["import {\n Field as SdkField,\n FieldDescription as SdkFieldDescription,\n FieldError as SdkFieldError,\n FieldLabel as SdkFieldLabel,\n} from '@ui-sdk/solid/field'\nimport { Input as SdkInput } from '@ui-sdk/solid/input'\nimport { Textarea as SdkTextarea } from '@ui-sdk/solid/textarea'\nimport type { ComponentProps, JSX } from '@solidjs/web'\nimport {\n children as resolveChildren,\n createContext,\n createUniqueId,\n merge,\n Show,\n omit,\n useContext,\n} 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 * The text-field props `Field` has always taken on its root (it was once a\n * text-field primitive whose Input and TextArea rendered them). ui-sdk keeps the value on the control, so\n * `Field` hands these to `FieldInput` and `FieldTextArea` through a context\n * and a call site written for the old root keeps working unchanged.\n */\ntype FieldValueProps = {\n value?: string\n defaultValue?: string\n /** Called with the control's new text, as `Field` always has. */\n onChange?: (value: string) => void\n required?: boolean\n readOnly?: boolean\n}\n\nconst FieldValueContext = createContext<FieldValueProps | null>(null)\n\nexport type FieldProps = Omit<ComponentProps<typeof SdkField>, 'onChange' | 'defaultValue'> &\n FieldValueProps & {\n /**\n * `'invalid'` shows the field's errors and marks its control\n * `aria-invalid` right away; `'valid'` hides them whatever the browser's\n * own validation says. Left out, the browser's validation shows once a\n * submit finds the control invalid. `invalid` says the same as a\n * boolean and wins when both are given.\n */\n validationState?: 'valid' | 'invalid'\n }\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 composition is for its own `FieldLabel`, `FieldInput` and\n * `FieldTextArea` parts. Use `FormField` to wire the standalone shared\n * controls, including checkboxes, switches and comboboxes.\n *\n * It is built on ui-sdk's Field specifically so `aria-labelledby`,\n * `aria-describedby` and `aria-invalid` are wired by construction. Those\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. Every part carries `data-invalid` and\n * `data-disabled` while the field is.\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 part is used.\n */\nexport function Field(props: FieldProps) {\n const rest = omit(\n props,\n 'class',\n 'validationState',\n 'invalid',\n 'value',\n 'defaultValue',\n 'onChange',\n 'required',\n 'readOnly'\n )\n const invalid = () =>\n props.invalid ??\n (props.validationState === undefined ? undefined : props.validationState === 'invalid')\n const values: FieldValueProps = {\n get value() {\n return props.value\n },\n get defaultValue() {\n return props.defaultValue\n },\n get onChange() {\n return props.onChange\n },\n get required() {\n return props.required\n },\n get readOnly() {\n return props.readOnly\n },\n }\n return (\n <FieldValueContext value={values}>\n <SdkField class={cn('flex flex-col gap-1.5', props.class)} invalid={invalid()} {...rest} />\n </FieldValueContext>\n )\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 = props\n const rest = omit(props, 'class', 'label', 'hint', 'error', 'controlId', 'group', 'children')\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() ? 'true' : 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 value={field}>\n <Body />\n </FormFieldContext>\n )\n}\n\nexport function FieldLabel(props: ComponentProps<typeof SdkFieldLabel>) {\n const rest = omit(props, 'class')\n return <SdkFieldLabel class={cn('text-sm leading-none font-medium', props.class)} {...rest} />\n}\n\nexport function FieldDescription(props: ComponentProps<typeof SdkFieldDescription>) {\n const rest = omit(props, 'class')\n return <SdkFieldDescription class={cn('text-muted-foreground text-sm', props.class)} {...rest} />\n}\n\n/**\n * Shows while the field is invalid: `validationState=\"invalid\"`, or the\n * browser's own validation once a submit finds the control invalid. Without\n * children it shows the browser's message.\n */\nexport function FieldError(props: ComponentProps<typeof SdkFieldError>) {\n const rest = omit(props, 'class')\n return <SdkFieldError class={cn('text-foreground text-sm', props.class)} {...rest} />\n}\n\n/**\n * The control's value props: its own first, then those its `Field` was given.\n * `onChange` keeps its meaning on `Field`, the new text, and runs beside\n * the control's own `onValueChange`.\n */\nfunction useFieldValue<P extends { value?: unknown; onValueChange?: unknown }>(props: P) {\n const field = useContext(FieldValueContext)\n return merge(\n {\n get value() {\n return field?.value\n },\n get defaultValue() {\n return field?.defaultValue\n },\n get required() {\n return field?.required\n },\n get readOnly() {\n return field?.readOnly\n },\n },\n props,\n {\n onValueChange: (value: string, details: unknown) => {\n field?.onChange?.(value)\n ;(props.onValueChange as ((v: string, d: unknown) => void) | undefined)?.(value, details)\n },\n }\n )\n}\n\nexport function FieldInput(props: ComponentProps<typeof SdkInput>) {\n const rest = omit(useFieldValue(props), 'class')\n\n return (\n <SdkInput\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 props.class as string | undefined\n )}\n {...(rest as ComponentProps<typeof SdkInput>)}\n />\n )\n}\n\nexport function FieldTextArea(props: ComponentProps<typeof SdkTextarea>) {\n const rest = omit(useFieldValue(props), 'class')\n\n return (\n <SdkTextarea\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 props.class as string | undefined\n )}\n {...(rest as ComponentProps<typeof SdkTextarea>)}\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 *\n * A native element rather than ui-sdk's FieldSet: the native fieldset already\n * names itself from its first `<legend>` and disables what it holds, and\n * `FormField` wires its own description and invalid state onto this element,\n * which a second primitive would claim. ui-sdk's `FieldLegend` also throws\n * outside its set, where ours is a plain legend.\n */\nexport function FieldSet(props: ComponentProps<'fieldset'>) {\n const local = props\n const rest = omit(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 = props\n const rest = omit(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 = props\n const rest = omit(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 = props\n const rest = omit(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":";;;;;;;;;;;;;;;;;AAsCA,IAAM,oBAAoB,cAAsC,IAAI;;;;;;;;;;;;;;;;;;;;;AAkCpE,SAAgB8B,QAAM,OAAmB;CACvC,MAAM,OAAO,KACX,OACA,SACA,mBACA,WACA,SACA,gBACA,YACA,YACA,UACF;CACA,MAAM,gBACJ,MAAM,YACL,MAAM,oBAAoB,KAAA,IAAY,KAAA,IAAY,MAAM,oBAAoB;CAkB/E,OACE9B,gBAAAA,mBAAAA;EAAmBC,OAAO;GAjB1B,IAAI,QAAQ;IACV,OAAO,MAAM;GACf;GACA,IAAI,eAAe;IACjB,OAAO,MAAM;GACf;GACA,IAAI,WAAW;IACb,OAAO,MAAM;GACf;GACA,IAAI,WAAW;IACb,OAAO,MAAM;GACf;GACA,IAAI,WAAW;IACb,OAAO,MAAM;GACf;EAG0B;EAA1B,IAAA,WAAA;GACEC,OAAAA,gBAAAA,OAAAA,WAAAA;IAAU,IAAA,UAAA;KAAO,OAAA,GAAG,yBAAyB,MAAM,KAAK;IAAC;IAAE,IAAA,UAAA;KAAS,OAAA,QAAQ;IAAC;GAAa,GAAP,IAAO,CAAA;EACzE;;AAEvB;;;;;;;;;;AAoBA,SAAgB,UAAU,OAAuB;CAC/C,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,SAAS,QAAQ,SAAS,aAAa,SAAS,UAAU;CAC5F,MAAM,UAAU,eAAe;CAC/B,MAAM,UAAU,GAAG,QAAQ;CAC3B,MAAM,gBAAgB,GAAG,QAAQ;CACjC,MAAM,UAAU,GAAG,QAAQ;CAC3B,MAAM,QAAQ,uBAAuB;EACnC,WAAW,MAAM;EACjB,kBAAkB;EAClB;EACA;EACA;EACA,YAAY,MAAM;EAClB,aAAa,M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B,EAAE,MAAM,OAAO,CAAC,GACpF,MAAM,KACR;CAAC,EACO,GAAJ,IAAA,GAAA,KAAA;CAPR,OACEC;AASJ;;AAGA,SAAgB,eAAe,OAG5B;CACD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,UAAU;CAG1C,IAAA,QAAA,QAUK;CAVL,IAAA,QACEC,MAAAA,WAQAA;CAToE,OAAA,OAAA,CAAA,EAAjE,IAAA,UAAA;EAAO,OAAA,GAAG,yCAAyC,MAAM,KAAK;CAAC,EAAU,GAAJ,IAAA,GAAA,IAAA;CAA1E,OAAA,OAEEC,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAQ;EAA1BA,WACI,wBACA;GAEM,IAAA,SAAA,QAAA;GAFN,OAAA,QACG,YACG;GAFN,OAAA;EAEM,EAAA,CAAA;CAEJ,CAAA,GARRC,KAUK;CAXP,OACEA;AAYJ"}
|
|
1
|
+
{"version":3,"file":"field.js","names":["<FieldValueContext value={values}>\n <SdkField class={cn('flex flex-col gap-1.5', props.class)} invalid={invalid()} {...rest} />\n </FieldValueContext>","value={values}","<SdkField class={cn('flex flex-col gap-1.5', props.class)} invalid={invalid()} {...rest} />","<Show when={local.hint}>\n {(hintSlot) => (\n <p id={descriptionId} class=\"text-muted-foreground text-sm\">\n {hintSlot()}\n </p>\n )}\n </Show>","<Show when={local.error}>\n {(errorSlot) => (\n <p id={errorId} role=\"alert\" class=\"text-foreground text-sm\">\n {errorSlot()}\n </p>\n )}\n </Show>","<FieldSet\n class=\"flex flex-col gap-1.5\"\n aria-describedby={field.describedBy()}\n aria-invalid={field.invalid() ? 'true' : undefined}\n >\n <FieldLegend id={labelId} variant=\"label\">\n {local.label}\n </FieldLegend>\n {control()}\n {help()}\n </FieldSet>","class=\"flex flex-col gap-1.5\"","<FieldLegend id={labelId} variant=\"label\">\n {local.label}\n </FieldLegend>","id={labelId}","variant=\"label\"","control()","help()","<Label id={labelId} for={field.controlId()}>\n {local.label}\n </Label>","{control()}","{help()}","<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() ? 'true' : 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>","<FormFieldContext value={field}>\n <Body />\n </FormFieldContext>","value={field}","<Body />","<SdkFieldLabel class={cn('text-sm leading-none font-medium', props.class)} {...rest} />","<SdkFieldDescription class={cn('text-muted-foreground text-sm', props.class)} {...rest} />","<SdkFieldError class={cn('text-foreground text-sm', props.class)} {...rest} />","<SdkInput\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 props.class as string | undefined\n )}\n {...(rest as ComponentProps<typeof SdkInput>)}\n />","<SdkTextarea\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 props.class as string | undefined\n )}\n {...(rest as ComponentProps<typeof SdkTextarea>)}\n />","<fieldset class={cn('flex flex-col gap-4', local.class)} {...rest} />","<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 />","<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 />","<span class=\"bg-border h-px flex-1\" />","<Show when={local.children}>\n {(childrenSlot) => (\n <span class=\"text-muted-foreground text-2xs tracking-wide uppercase\">\n {childrenSlot()}\n </span>\n )}\n </Show>","<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>","_$setAttribute","_$insert","resolveChildren","_$spread"],"sources":["../../../../src/components/ui/field/field.tsx"],"sourcesContent":["import {\n Field as SdkField,\n FieldDescription as SdkFieldDescription,\n FieldError as SdkFieldError,\n FieldLabel as SdkFieldLabel,\n} from '@ui-sdk/solid/field'\nimport { Input as SdkInput } from '@ui-sdk/solid/input'\nimport { Textarea as SdkTextarea } from '@ui-sdk/solid/textarea'\nimport type { ComponentProps, JSX } from '@solidjs/web'\nimport {\n children as resolveChildren,\n createContext,\n createUniqueId,\n merge,\n Show,\n omit,\n useContext,\n} 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 * The text-field props `Field` has always taken on its root (it was once a\n * text-field primitive whose Input and TextArea rendered them). ui-sdk keeps the value on the control, so\n * `Field` hands these to `FieldInput` and `FieldTextArea` through a context\n * and a call site written for the old root keeps working unchanged.\n */\ntype FieldValueProps = {\n value?: string\n defaultValue?: string\n /** Called with the control's new text, as `Field` always has. */\n onChange?: (value: string) => void\n required?: boolean\n readOnly?: boolean\n}\n\nconst FieldValueContext = createContext<FieldValueProps | null>(null)\n\nexport type FieldProps = Omit<ComponentProps<typeof SdkField>, 'onChange' | 'defaultValue'> &\n FieldValueProps & {\n /**\n * `'invalid'` shows the field's errors and marks its control\n * `aria-invalid` right away; `'valid'` hides them whatever the browser's\n * own validation says. Left out, the browser's validation shows once a\n * submit finds the control invalid. `invalid` says the same as a\n * boolean and wins when both are given.\n */\n validationState?: 'valid' | 'invalid'\n }\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 composition is for its own `FieldLabel`, `FieldInput` and\n * `FieldTextArea` parts. Use `FormField` to wire the standalone shared\n * controls, including checkboxes, switches and comboboxes.\n *\n * It is built on ui-sdk's Field specifically so `aria-labelledby`,\n * `aria-describedby` and `aria-invalid` are wired by construction. Those\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. Every part carries `data-invalid` and\n * `data-disabled` while the field is.\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 part is used.\n */\nexport function Field(props: FieldProps) {\n const rest = omit(\n props,\n 'class',\n 'validationState',\n 'invalid',\n 'value',\n 'defaultValue',\n 'onChange',\n 'required',\n 'readOnly'\n )\n const invalid = () =>\n props.invalid ??\n (props.validationState === undefined ? undefined : props.validationState === 'invalid')\n const values: FieldValueProps = {\n get value() {\n return props.value\n },\n get defaultValue() {\n return props.defaultValue\n },\n get onChange() {\n return props.onChange\n },\n get required() {\n return props.required\n },\n get readOnly() {\n return props.readOnly\n },\n }\n return (\n <FieldValueContext value={values}>\n <SdkField class={cn('flex flex-col gap-1.5', props.class)} invalid={invalid()} {...rest} />\n </FieldValueContext>\n )\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 = props\n const rest = omit(props, 'class', 'label', 'hint', 'error', 'controlId', 'group', 'children')\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() ? 'true' : 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 value={field}>\n <Body />\n </FormFieldContext>\n )\n}\n\nexport function FieldLabel(props: ComponentProps<typeof SdkFieldLabel>) {\n const rest = omit(props, 'class')\n return <SdkFieldLabel class={cn('text-sm leading-none font-medium', props.class)} {...rest} />\n}\n\nexport function FieldDescription(props: ComponentProps<typeof SdkFieldDescription>) {\n const rest = omit(props, 'class')\n return <SdkFieldDescription class={cn('text-muted-foreground text-sm', props.class)} {...rest} />\n}\n\n/**\n * Shows while the field is invalid: `validationState=\"invalid\"`, or the\n * browser's own validation once a submit finds the control invalid. Without\n * children it shows the browser's message.\n */\nexport function FieldError(props: ComponentProps<typeof SdkFieldError>) {\n const rest = omit(props, 'class')\n return <SdkFieldError class={cn('text-foreground text-sm', props.class)} {...rest} />\n}\n\n/**\n * The control's value props: its own first, then those its `Field` was given.\n * `onChange` keeps its meaning on `Field`, the new text, and runs beside\n * the control's own `onValueChange`.\n */\nfunction useFieldValue<P extends { value?: unknown; onValueChange?: unknown }>(props: P) {\n const field = useContext(FieldValueContext)\n return merge(\n {\n get value() {\n return field?.value\n },\n get defaultValue() {\n return field?.defaultValue\n },\n get required() {\n return field?.required\n },\n get readOnly() {\n return field?.readOnly\n },\n },\n props,\n {\n onValueChange: (value: string, details: unknown) => {\n field?.onChange?.(value)\n ;(props.onValueChange as ((v: string, d: unknown) => void) | undefined)?.(value, details)\n },\n }\n )\n}\n\nexport function FieldInput(props: ComponentProps<typeof SdkInput>) {\n const rest = omit(useFieldValue(props), 'class')\n\n return (\n <SdkInput\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 props.class as string | undefined\n )}\n {...(rest as ComponentProps<typeof SdkInput>)}\n />\n )\n}\n\nexport function FieldTextArea(props: ComponentProps<typeof SdkTextarea>) {\n const rest = omit(useFieldValue(props), 'class')\n\n return (\n <SdkTextarea\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 props.class as string | undefined\n )}\n {...(rest as ComponentProps<typeof SdkTextarea>)}\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 *\n * A native element rather than ui-sdk's FieldSet: the native fieldset already\n * names itself from its first `<legend>` and disables what it holds, and\n * `FormField` wires its own description and invalid state onto this element,\n * which a second primitive would claim. ui-sdk's `FieldLegend` also throws\n * outside its set, where ours is a plain legend.\n */\nexport function FieldSet(props: ComponentProps<'fieldset'>) {\n const local = props\n const rest = omit(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 = props\n const rest = omit(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 = props\n const rest = omit(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 = props\n const rest = omit(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":";;;;;;;;;;;;;;;;;AAsCA,IAAM,oBAAoB,cAAsC,IAAI;;;;;;;;;;;;;;;;;;;;;AAkCpE,SAAgB,MAAM,OAAmB;CACvC,MAAM,OAAO,KACX,OACA,SACA,mBACA,WACA,SACA,gBACA,YACA,YACA,UACF;CACA,MAAM,gBACJ,MAAM,YACL,MAAM,oBAAoB,KAAA,IAAY,KAAA,IAAY,MAAM,oBAAoB;CAkB/E,OACEA,gBAAAA,mBAAAA;EAAmBC,OAAO;GAjB1B,IAAI,QAAQ;IACV,OAAO,MAAM;GACf;GACA,IAAI,eAAe;IACjB,OAAO,MAAM;GACf;GACA,IAAI,WAAW;IACb,OAAO,MAAM;GACf;GACA,IAAI,WAAW;IACb,OAAO,MAAM;GACf;GACA,IAAI,WAAW;IACb,OAAO,MAAM;GACf;EAG0B;EAA1B,IAAA,WAAA;GACEC,OAA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ent, isServer, mergeProps } from "@solidjs/web";
|
|
4
2
|
import { createEffect, createSignal } from "solid-js";
|
|
3
|
+
import { FormField } from "./field.js";
|
|
4
|
+
import { Input } from "../input/input.js";
|
|
5
5
|
// src/components/ui/field/number-field.tsx
|
|
6
6
|
var text = (value) => value === null ? "" : String(value);
|
|
7
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-field.js","names":["<FormField label={props.label} hint={props.hint} error={error()} class={props.class}>\n <Input\n type=\"number\"\n ref={(element: HTMLInputElement) => {\n input = element\n }}\n // Present only on the server: on the client even an undefined `value`\n // is a bound value, re-asserted as ''.\n {...(isServer ? { value: draft() } : {})}\n min={props.min}\n max={props.max}\n step={props.step ?? (integer() ? 1 : 'any')}\n required={!props.optional}\n disabled={props.disabled}\n onInput={(event) => {\n const raw = event.currentTarget.value\n // Read before touching the draft: writing '' back to the input would clear the entry and\n // with it `badInput`. An unparsable entry keeps the last draft and the text on screen, so\n // the user can correct it; blur restores the last good value.\n const badInput = event.currentTarget.validity.badInput\n if (!badInput) setDraft(raw)\n const nextError = validate(raw, badInput)\n setError(nextError)\n if (nextError) return\n // `optional` narrows the callback to `number | null`; a required field never sees `''`.\n ;(props.onChange as (value: number | null) => void)(raw ? Number(raw) : null)\n }}\n onBlur={(event) => {\n const nextError = validate(draft(), event.currentTarget.validity.badInput)\n if (nextError) {\n setDraft(text(props.value))\n setError('')\n // The draft of an unparsable entry is '' and so is the restored blank value: the signal\n // does not change, so the DOM has to be reset by hand to drop the leftover text.\n event.currentTarget.value = text(props.value)\n }\n props.onBlur?.(event)\n }}\n />\n </FormField>","<Input\n type=\"number\"\n ref={(element: HTMLInputElement) => {\n input = element\n }}\n // Present only on the server: on the client even an undefined `value`\n // is a bound value, re-asserted as ''.\n {...(isServer ? { value: draft() } : {})}\n min={props.min}\n max={props.max}\n step={props.step ?? (integer() ? 1 : 'any')}\n required={!props.optional}\n disabled={props.disabled}\n onInput={(event) => {\n const raw = event.currentTarget.value\n // Read before touching the draft: writing '' back to the input would clear the entry and\n // with it `badInput`. An unparsable entry keeps the last draft and the text on screen, so\n // the user can correct it; blur restores the last good value.\n const badInput = event.currentTarget.validity.badInput\n if (!badInput) setDraft(raw)\n const nextError = validate(raw, badInput)\n setError(nextError)\n if (nextError) return\n // `optional` narrows the callback to `number | null`; a required field never sees `''`.\n ;(props.onChange as (value: number | null) => void)(raw ? Number(raw) : null)\n }}\n onBlur={(event) => {\n const nextError = validate(draft(), event.currentTarget.validity.badInput)\n if (nextError) {\n setDraft(text(props.value))\n setError('')\n // The draft of an unparsable entry is '' and so is the restored blank value: the signal\n // does not change, so the DOM has to be reset by hand to drop the leftover text.\n event.currentTarget.value = text(props.value)\n }\n props.onBlur?.(event)\n }}\n />","type=\"number\"","ref={(element: HTMLInputElement) => {\n input = element\n }}","onInput={(event) => {\n const raw = event.currentTarget.value\n // Read before touching the draft: writing '' back to the input would clear the entry and\n // with it `badInput`. An unparsable entry keeps the last draft and the text on screen, so\n // the user can correct it; blur restores the last good value.\n const badInput = event.currentTarget.validity.badInput\n if (!badInput) setDraft(raw)\n const nextError = validate(raw, badInput)\n setError(nextError)\n if (nextError) return\n // `optional` narrows the callback to `number | null`; a required field never sees `''`.\n ;(props.onChange as (value: number | null) => void)(raw ? Number(raw) : null)\n }}","onBlur={(event) => {\n const nextError = validate(draft(), event.currentTarget.validity.badInput)\n if (nextError) {\n setDraft(text(props.value))\n setError('')\n // The draft of an unparsable entry is '' and so is the restored blank value: the signal\n // does not change, so the DOM has to be reset by hand to drop the leftover text.\n event.currentTarget.value = text(props.value)\n }\n props.onBlur?.(event)\n }}"],"sources":["../../../../src/components/ui/field/number-field.tsx"],"sourcesContent":["import { createEffect, createSignal } from 'solid-js'\nimport { isServer, type JSX } from '@solidjs/web'\nimport { FormField } from './field'\nimport { Input } from '../input'\n\ntype NumberFieldBaseProps = {\n label: string\n hint?: string\n min: number\n max: number\n /**\n * The increment of the spinner and the arrow keys, and the grid a typed value\n * must sit on: `min` plus a whole number of steps. Use it for stepped or\n * fractional values (`0.05` for a 0-1 score, `5` for a percentage in fives).\n * Without it a field steps by 1, or by `any` when `integer` is `false`, which\n * accepts every decimal but leaves the spinner moving in whole numbers.\n */\n step?: number\n /**\n * Whether only whole numbers are valid. It defaults to `true`, or, when a\n * `step` is given, to whether both the step and its base `min` are whole\n * numbers, so `step={0.05}` accepts decimals without also saying\n * `integer={false}`, and `min={0.5} step={1}` accepts 0.5, 1.5, 2.5.\n */\n integer?: boolean\n /** Locks the input; a locked field keeps its value and reports nothing. */\n disabled?: boolean\n class?: string\n onBlur?: JSX.EventHandler<HTMLInputElement, FocusEvent>\n}\n\nexport type NumberFieldProps = NumberFieldBaseProps &\n (\n | {\n optional?: false\n value: number\n onChange: (value: number) => void\n }\n | {\n /**\n * Lets the field be left blank: a blank field is valid and reports `null`,\n * and a `null` value shows a blank field. Use it for a limit that falls\n * back to a default when unset, so a caller never maps `''` to\n * `undefined` of its own.\n */\n optional: true\n value: number | null\n onChange: (value: number | null) => void\n }\n )\n\nconst text = (value: number | null) => (value === null ? '' : String(value))\n\n/**\n * A controlled numeric field that keeps an editable draft while validating\n * range, integer and step constraints. Invalid drafts are announced and restored\n * to the latest controlled value when focus leaves the input, so `onChange`\n * only ever receives a value the field accepts, a caller never needs a\n * `Number(value) || fallback` of its own. With `optional`, blank is accepted and\n * reported as `null`.\n */\nexport function NumberField(props: NumberFieldProps) {\n // A writable derivation: a new controlled value replaces whatever draft is on\n // screen, and typing overwrites the draft until the next one arrives.\n const [draft, setDraft] = createSignal(() => text(props.value))\n const [error, setError] = createSignal('')\n // Whole numbers only when nothing on the grid is fractional: a whole step from\n // a fractional `min` (0.5, 1.5, 2.5) puts the spinner's own values off the\n // integers, so inference needs the step and its base to both be whole.\n const integer = () =>\n props.integer ??\n (props.step === undefined || (Number.isInteger(props.step) && Number.isInteger(props.min)))\n\n // The draft reaches the input when it changes, not through a `value` prop.\n // Solid 2 re-asserts a bound `value` on every pass of the input's spread, and\n // that pass runs again when the error appears (`aria-invalid` and the\n // description change), so a bound value would overwrite text the input cannot\n // parse (\"1e\") with the last good draft, and clear `badInput` with it, while the\n // user is still typing. The server has no input to write to, so it renders the\n // draft as the attribute.\n let input: HTMLInputElement | undefined\n createEffect(draft, (value) => {\n if (input && input.value !== value) input.value = value\n })\n\n // A number input reports '' both when it is empty and when it holds text it cannot parse\n // (\"abc\", \"-\", \"1e\"); only `validity.badInput` tells them apart, and a bad draft must never\n // count as blank (it would report `null` and clear the limit).\n const validate = (raw: string, badInput: boolean) => {\n if (badInput) return `${props.label} must be a valid number.`\n if (!raw) return props.optional ? '' : `${props.label} is required.`\n const next = Number(raw)\n if (!Number.isFinite(next)) return `${props.label} must be a valid number.`\n if (integer() && !Number.isInteger(next)) {\n return `${props.label} must be a whole number.`\n }\n if (next < props.min || next > props.max) {\n return `${props.label} must be between ${props.min} and ${props.max}.`\n }\n if (props.step !== undefined && props.step > 0) {\n // Compare in whole steps with a tolerance: 0.15 / 0.05 is 3.0000000000000004,\n // and rejecting it would make the spinner's own values invalid.\n const steps = (next - props.min) / props.step\n if (Math.abs(steps - Math.round(steps)) > 1e-9) {\n return props.min === 0\n ? `${props.label} must be a multiple of ${props.step}.`\n : `${props.label} must be ${props.min} plus a multiple of ${props.step}.`\n }\n }\n return ''\n }\n\n return (\n <FormField label={props.label} hint={props.hint} error={error()} class={props.class}>\n <Input\n type=\"number\"\n ref={(element: HTMLInputElement) => {\n input = element\n }}\n // Present only on the server: on the client even an undefined `value`\n // is a bound value, re-asserted as ''.\n {...(isServer ? { value: draft() } : {})}\n min={props.min}\n max={props.max}\n step={props.step ?? (integer() ? 1 : 'any')}\n required={!props.optional}\n disabled={props.disabled}\n onInput={(event) => {\n const raw = event.currentTarget.value\n // Read before touching the draft: writing '' back to the input would clear the entry and\n // with it `badInput`. An unparsable entry keeps the last draft and the text on screen, so\n // the user can correct it; blur restores the last good value.\n const badInput = event.currentTarget.validity.badInput\n if (!badInput) setDraft(raw)\n const nextError = validate(raw, badInput)\n setError(nextError)\n if (nextError) return\n // `optional` narrows the callback to `number | null`; a required field never sees `''`.\n ;(props.onChange as (value: number | null) => void)(raw ? Number(raw) : null)\n }}\n onBlur={(event) => {\n const nextError = validate(draft(), event.currentTarget.validity.badInput)\n if (nextError) {\n setDraft(text(props.value))\n setError('')\n // The draft of an unparsable entry is '' and so is the restored blank value: the signal\n // does not change, so the DOM has to be reset by hand to drop the leftover text.\n event.currentTarget.value = text(props.value)\n }\n props.onBlur?.(event)\n }}\n />\n </FormField>\n )\n}\n"],"mappings":";;;;;AAmDA,IAAM,QAAQ,UAA0B,UAAU,OAAO,KAAK,OAAO,KAAK;;;;;;;;;AAU1E,SAAgB,YAAY,OAAyB;CAGnD,MAAM,CAAC,OAAO,YAAY,mBAAmB,KAAK,MAAM,KAAK,CAAC;CAC9D,MAAM,CAAC,OAAO,YAAY,aAAa,EAAE;CAIzC,MAAM,gBACJ,MAAM,YACL,MAAM,SAAS,KAAA,KAAc,OAAO,UAAU,MAAM,IAAI,KAAK,OAAO,UAAU,MAAM,GAAG;CAS1F,IAAI;CACJ,aAAa,QAAQ,UAAU;EAC7B,IAAI,SAAS,MAAM,UAAU,OAAO,MAAM,QAAQ;CACpD,CAAC;CAKD,MAAM,YAAY,KAAa,aAAsB;EACnD,IAAI,UAAU,OAAO,GAAG,MAAM,MAAM;EACpC,IAAI,CAAC,KAAK,OAAO,MAAM,WAAW,KAAK,GAAG,MAAM,MAAM;EACtD,MAAM,OAAO,OAAO,GAAG;EACvB,IAAI,CAAC,OAAO,SAAS,IAAI,GAAG,OAAO,GAAG,MAAM,MAAM;EAClD,IAAI,QAAQ,KAAK,CAAC,OAAO,UAAU,IAAI,GACrC,OAAO,GAAG,MAAM,MAAM;EAExB,IAAI,OAAO,MAAM,OAAO,OAAO,MAAM,KACnC,OAAO,GAAG,MAAM,MAAM,mBAAmB,MAAM,IAAI,OAAO,MAAM,IAAI;EAEtE,IAAI,MAAM,SAAS,KAAA,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D,GAAW;MACb,SAAS,KAAK,MAAM,KAAK,CAAC;MAC1B,SAAS,EAAE;MAGX,MAAM,cAAc,QAAQ,KAAK,MAAM,KAAK;KAC9C;KACA,MAAM,SAAS,KAAK;IACtB;GACD,C;EACQ;;AAEf"}
|
|
1
|
+
{"version":3,"file":"number-field.js","names":["<FormField label={props.label} hint={props.hint} error={error()} class={props.class}>\n <Input\n type=\"number\"\n ref={(element: HTMLInputElement) => {\n input = element\n }}\n // Present only on the server: on the client even an undefined `value`\n // is a bound value, re-asserted as ''.\n {...(isServer ? { value: draft() } : {})}\n min={props.min}\n max={props.max}\n step={props.step ?? (integer() ? 1 : 'any')}\n required={!props.optional}\n disabled={props.disabled}\n onInput={(event) => {\n const raw = event.currentTarget.value\n // Read before touching the draft: writing '' back to the input would clear the entry and\n // with it `badInput`. An unparsable entry keeps the last draft and the text on screen, so\n // the user can correct it; blur restores the last good value.\n const badInput = event.currentTarget.validity.badInput\n if (!badInput) setDraft(raw)\n const nextError = validate(raw, badInput)\n setError(nextError)\n if (nextError) return\n // `optional` narrows the callback to `number | null`; a required field never sees `''`.\n ;(props.onChange as (value: number | null) => void)(raw ? Number(raw) : null)\n }}\n onBlur={(event) => {\n const nextError = validate(draft(), event.currentTarget.validity.badInput)\n if (nextError) {\n setDraft(text(props.value))\n setError('')\n // The draft of an unparsable entry is '' and so is the restored blank value: the signal\n // does not change, so the DOM has to be reset by hand to drop the leftover text.\n event.currentTarget.value = text(props.value)\n }\n props.onBlur?.(event)\n }}\n />\n </FormField>","<Input\n type=\"number\"\n ref={(element: HTMLInputElement) => {\n input = element\n }}\n // Present only on the server: on the client even an undefined `value`\n // is a bound value, re-asserted as ''.\n {...(isServer ? { value: draft() } : {})}\n min={props.min}\n max={props.max}\n step={props.step ?? (integer() ? 1 : 'any')}\n required={!props.optional}\n disabled={props.disabled}\n onInput={(event) => {\n const raw = event.currentTarget.value\n // Read before touching the draft: writing '' back to the input would clear the entry and\n // with it `badInput`. An unparsable entry keeps the last draft and the text on screen, so\n // the user can correct it; blur restores the last good value.\n const badInput = event.currentTarget.validity.badInput\n if (!badInput) setDraft(raw)\n const nextError = validate(raw, badInput)\n setError(nextError)\n if (nextError) return\n // `optional` narrows the callback to `number | null`; a required field never sees `''`.\n ;(props.onChange as (value: number | null) => void)(raw ? Number(raw) : null)\n }}\n onBlur={(event) => {\n const nextError = validate(draft(), event.currentTarget.validity.badInput)\n if (nextError) {\n setDraft(text(props.value))\n setError('')\n // The draft of an unparsable entry is '' and so is the restored blank value: the signal\n // does not change, so the DOM has to be reset by hand to drop the leftover text.\n event.currentTarget.value = text(props.value)\n }\n props.onBlur?.(event)\n }}\n />","type=\"number\"","ref={(element: HTMLInputElement) => {\n input = element\n }}","onInput={(event) => {\n const raw = event.currentTarget.value\n // Read before touching the draft: writing '' back to the input would clear the entry and\n // with it `badInput`. An unparsable entry keeps the last draft and the text on screen, so\n // the user can correct it; blur restores the last good value.\n const badInput = event.currentTarget.validity.badInput\n if (!badInput) setDraft(raw)\n const nextError = validate(raw, badInput)\n setError(nextError)\n if (nextError) return\n // `optional` narrows the callback to `number | null`; a required field never sees `''`.\n ;(props.onChange as (value: number | null) => void)(raw ? Number(raw) : null)\n }}","onBlur={(event) => {\n const nextError = validate(draft(), event.currentTarget.validity.badInput)\n if (nextError) {\n setDraft(text(props.value))\n setError('')\n // The draft of an unparsable entry is '' and so is the restored blank value: the signal\n // does not change, so the DOM has to be reset by hand to drop the leftover text.\n event.currentTarget.value = text(props.value)\n }\n props.onBlur?.(event)\n }}"],"sources":["../../../../src/components/ui/field/number-field.tsx"],"sourcesContent":["import { createEffect, createSignal } from 'solid-js'\nimport { isServer, type JSX } from '@solidjs/web'\nimport { FormField } from './field'\nimport { Input } from '../input'\n\ntype NumberFieldBaseProps = {\n label: string\n hint?: string\n min: number\n max: number\n /**\n * The increment of the spinner and the arrow keys, and the grid a typed value\n * must sit on: `min` plus a whole number of steps. Use it for stepped or\n * fractional values (`0.05` for a 0-1 score, `5` for a percentage in fives).\n * Without it a field steps by 1, or by `any` when `integer` is `false`, which\n * accepts every decimal but leaves the spinner moving in whole numbers.\n */\n step?: number\n /**\n * Whether only whole numbers are valid. It defaults to `true`, or, when a\n * `step` is given, to whether both the step and its base `min` are whole\n * numbers, so `step={0.05}` accepts decimals without also saying\n * `integer={false}`, and `min={0.5} step={1}` accepts 0.5, 1.5, 2.5.\n */\n integer?: boolean\n /** Locks the input; a locked field keeps its value and reports nothing. */\n disabled?: boolean\n class?: string\n onBlur?: JSX.EventHandler<HTMLInputElement, FocusEvent>\n}\n\nexport type NumberFieldProps = NumberFieldBaseProps &\n (\n | {\n optional?: false\n value: number\n onChange: (value: number) => void\n }\n | {\n /**\n * Lets the field be left blank: a blank field is valid and reports `null`,\n * and a `null` value shows a blank field. Use it for a limit that falls\n * back to a default when unset, so a caller never maps `''` to\n * `undefined` of its own.\n */\n optional: true\n value: number | null\n onChange: (value: number | null) => void\n }\n )\n\nconst text = (value: number | null) => (value === null ? '' : String(value))\n\n/**\n * A controlled numeric field that keeps an editable draft while validating\n * range, integer and step constraints. Invalid drafts are announced and restored\n * to the latest controlled value when focus leaves the input, so `onChange`\n * only ever receives a value the field accepts, a caller never needs a\n * `Number(value) || fallback` of its own. With `optional`, blank is accepted and\n * reported as `null`.\n */\nexport function NumberField(props: NumberFieldProps) {\n // A writable derivation: a new controlled value replaces whatever draft is on\n // screen, and typing overwrites the draft until the next one arrives.\n const [draft, setDraft] = createSignal(() => text(props.value))\n const [error, setError] = createSignal('')\n // Whole numbers only when nothing on the grid is fractional: a whole step from\n // a fractional `min` (0.5, 1.5, 2.5) puts the spinner's own values off the\n // integers, so inference needs the step and its base to both be whole.\n const integer = () =>\n props.integer ??\n (props.step === undefined || (Number.isInteger(props.step) && Number.isInteger(props.min)))\n\n // The draft reaches the input when it changes, not through a `value` prop.\n // Solid 2 re-asserts a bound `value` on every pass of the input's spread, and\n // that pass runs again when the error appears (`aria-invalid` and the\n // description change), so a bound value would overwrite text the input cannot\n // parse (\"1e\") with the last good draft, and clear `badInput` with it, while the\n // user is still typing. The server has no input to write to, so it renders the\n // draft as the attribute.\n let input: HTMLInputElement | undefined\n createEffect(draft, (value) => {\n if (input && input.value !== value) input.value = value\n })\n\n // A number input reports '' both when it is empty and when it holds text it cannot parse\n // (\"abc\", \"-\", \"1e\"); only `validity.badInput` tells them apart, and a bad draft must never\n // count as blank (it would report `null` and clear the limit).\n const validate = (raw: string, badInput: boolean) => {\n if (badInput) return `${props.label} must be a valid number.`\n if (!raw) return props.optional ? '' : `${props.label} is required.`\n const next = Number(raw)\n if (!Number.isFinite(next)) return `${props.label} must be a valid number.`\n if (integer() && !Number.isInteger(next)) {\n return `${props.label} must be a whole number.`\n }\n if (next < props.min || next > props.max) {\n return `${props.label} must be between ${props.min} and ${props.max}.`\n }\n if (props.step !== undefined && props.step > 0) {\n // Compare in whole steps with a tolerance: 0.15 / 0.05 is 3.0000000000000004,\n // and rejecting it would make the spinner's own values invalid.\n const steps = (next - props.min) / props.step\n if (Math.abs(steps - Math.round(steps)) > 1e-9) {\n return props.min === 0\n ? `${props.label} must be a multiple of ${props.step}.`\n : `${props.label} must be ${props.min} plus a multiple of ${props.step}.`\n }\n }\n return ''\n }\n\n return (\n <FormField label={props.label} hint={props.hint} error={error()} class={props.class}>\n <Input\n type=\"number\"\n ref={(element: HTMLInputElement) => {\n input = element\n }}\n // Present only on the server: on the client even an undefined `value`\n // is a bound value, re-asserted as ''.\n {...(isServer ? { value: draft() } : {})}\n min={props.min}\n max={props.max}\n step={props.step ?? (integer() ? 1 : 'any')}\n required={!props.optional}\n disabled={props.disabled}\n onInput={(event) => {\n const raw = event.currentTarget.value\n // Read before touching the draft: writing '' back to the input would clear the entry and\n // with it `badInput`. An unparsable entry keeps the last draft and the text on screen, so\n // the user can correct it; blur restores the last good value.\n const badInput = event.currentTarget.validity.badInput\n if (!badInput) setDraft(raw)\n const nextError = validate(raw, badInput)\n setError(nextError)\n if (nextError) return\n // `optional` narrows the callback to `number | null`; a required field never sees `''`.\n ;(props.onChange as (value: number | null) => void)(raw ? Number(raw) : null)\n }}\n onBlur={(event) => {\n const nextError = validate(draft(), event.currentTarget.validity.badInput)\n if (nextError) {\n setDraft(text(props.value))\n setError('')\n // The draft of an unparsable entry is '' and so is the restored blank value: the signal\n // does not change, so the DOM has to be reset by hand to drop the leftover text.\n event.currentTarget.value = text(props.value)\n }\n props.onBlur?.(event)\n }}\n />\n </FormField>\n )\n}\n"],"mappings":";;;;;AAmDA,IAAM,QAAQ,UAA0B,UAAU,OAAO,KAAK,OAAO,KAAK;;;;;;;;;AAU1E,SAAgB,YAAY,OAAyB;CAGnD,MAAM,CAAC,OAAO,YAAY,mBAAmB,KAAK,MAAM,KAAK,CAAC;CAC9D,MAAM,CAAC,OAAO,YAAY,aAAa,EAAE;CAIzC,MAAM,gBACJ,MAAM,YACL,MAAM,SAAS,KAAA,KAAc,OAAO,UAAU,MAAM,IAAI,KAAK,OAAO,UAAU,MAAM,GAAG;CAS1F,IAAI;CACJ,aAAa,QAAQ,UAAU;EAC7B,IAAI,SAAS,MAAM,UAAU,OAAO,MAAM,QAAQ;CACpD,CAAC;CAKD,MAAM,YAAY,KAAa,aAAsB;EACnD,IAAI,UAAU,OAAO,GAAG,MAAM,MAAM;EACpC,IAAI,CAAC,KAAK,OAAO,MAAM,WAAW,KAAK,GAAG,MAAM,MAAM;EACtD,MAAM,OAAO,OAAO,GAAG;EACvB,IAAI,CAAC,OAAO,SAAS,IAAI,GAAG,OAAO,GAAG,MAAM,MAAM;EAClD,IAAI,QAAQ,KAAK,CAAC,OAAO,UAAU,IAAI,GACrC,OAAO,GAAG,MAAM,MAAM;EAExB,IAAI,OAAO,MAAM,OAAO,OAAO,MAAM,KACnC,OAAO,GAAG,MAAM,MAAM,mBAAmB,MAAM,IAAI,OAAO,MAAM,IAAI;EAEtE,IAAI,MAAM,SAAS,KAAA,KAAa,MAAM,OAAO,GAAG;GAG9C,MAAM,SAAS,OAAO,MAAM,OAAO,MAA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GX,MAAM,cAAc,QAAQ,KAAK,MAAM,KAAK;KAC9C;KACA,MAAM,SAAS,KAAK;IACtB;GACD,C;EACQ;;AAEf"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { createComponent, memo, mergeProps } from "@solidjs/web";
|
|
2
|
+
import { HoverCard as HoverCard$1, HoverCardArrow, HoverCardContent as HoverCardContent$1, HoverCardTrigger as HoverCardTrigger$1 } from "@ui-sdk/solid/hover-card";
|
|
3
|
+
import { createContext, omit, useContext } from "solid-js";
|
|
1
4
|
import { overlaySurface, popoverArrow, tooltipMotion } from "../../../lib/overlay.js";
|
|
2
5
|
import { cn } from "../../../lib/utils.js";
|
|
3
6
|
import { ArrowGlyph, arrowPlacement, expandedDiv, overlayContainer, placementProps, triggerRender } from "../tooltip/tooltip.js";
|
|
4
|
-
import { createComponent, memo, mergeProps } from "@solidjs/web";
|
|
5
|
-
import { createContext, omit, useContext } from "solid-js";
|
|
6
|
-
import { HoverCard, HoverCardArrow, HoverCardContent, HoverCardTrigger } from "@ui-sdk/solid/hover-card";
|
|
7
7
|
// src/components/ui/hover-card/hover-card.tsx
|
|
8
8
|
var HoverCardPlacementContext = createContext(() => ({}));
|
|
9
|
-
function HoverCard
|
|
9
|
+
function HoverCard(props) {
|
|
10
10
|
const rest = omit(props, "children", "openDelay", "placement", "gutter", "shift", "id", "forceMount", "ignoreSafeArea");
|
|
11
11
|
return createComponent(HoverCardPlacementContext, {
|
|
12
12
|
value: () => ({
|
|
@@ -15,7 +15,7 @@ function HoverCard$1(props) {
|
|
|
15
15
|
shift: props.shift
|
|
16
16
|
}),
|
|
17
17
|
get children() {
|
|
18
|
-
return createComponent(HoverCard, mergeProps(rest, {
|
|
18
|
+
return createComponent(HoverCard$1, mergeProps(rest, {
|
|
19
19
|
get delay() {
|
|
20
20
|
return props.openDelay ?? 700;
|
|
21
21
|
},
|
|
@@ -29,14 +29,14 @@ function HoverCard$1(props) {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
function HoverCardTrigger
|
|
33
|
-
return createComponent(HoverCardTrigger, mergeProps(() => {
|
|
32
|
+
function HoverCardTrigger(props) {
|
|
33
|
+
return createComponent(HoverCardTrigger$1, mergeProps(() => {
|
|
34
34
|
return omit(props, "as");
|
|
35
35
|
}, { get render() {
|
|
36
36
|
return triggerRender(props.as, "a", () => props["data-slot"]);
|
|
37
37
|
} }));
|
|
38
38
|
}
|
|
39
|
-
function HoverCardContent
|
|
39
|
+
function HoverCardContent(props) {
|
|
40
40
|
const root = useContext(HoverCardPlacementContext);
|
|
41
41
|
const rest = omit(props, "class", "children", "placement", "gutter", "shift");
|
|
42
42
|
const placement = () => placementProps({
|
|
@@ -47,7 +47,7 @@ function HoverCardContent$1(props) {
|
|
|
47
47
|
placement: "bottom",
|
|
48
48
|
gutter: 0
|
|
49
49
|
});
|
|
50
|
-
return createComponent(HoverCardContent, mergeProps({
|
|
50
|
+
return createComponent(HoverCardContent$1, mergeProps({
|
|
51
51
|
get container() {
|
|
52
52
|
return overlayContainer();
|
|
53
53
|
},
|
|
@@ -80,6 +80,6 @@ function HoverCardContent$1(props) {
|
|
|
80
80
|
})];
|
|
81
81
|
} }));
|
|
82
82
|
}
|
|
83
|
-
export { HoverCard
|
|
83
|
+
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
|
84
84
|
|
|
85
85
|
//# sourceMappingURL=hover-card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover-card.js","names":["<HoverCardPlacementContext\n value={() => ({ placement: props.placement, gutter: props.gutter, shift: props.shift })}\n >\n {/* Kobalte's timing, which every card in the kit was tuned against. */}\n <UiHoverCard\n {...(rest as HoverCardOptions)}\n delay={props.openDelay ?? 700}\n closeDelay={props.closeDelay ?? 300}\n >\n {props.children}\n </UiHoverCard>\n </HoverCardPlacementContext>","value={() => ({ placement: props.placement, gutter: props.gutter, shift: props.shift })}","<UiHoverCard\n {...(rest as HoverCardOptions)}\n delay={props.openDelay ?? 700}\n closeDelay={props.closeDelay ?? 300}\n >\n {props.children}\n </UiHoverCard>","<UiHoverCardTrigger\n {...omit(props, 'as')}\n render={triggerRender(props.as, 'a', () => props['data-slot'])}\n />","<UiHoverCardContent\n container={overlayContainer()}\n side={placement().side}\n align={placement().align}\n sideOffset={placement().sideOffset + ARROW_OFFSET}\n alignOffset={placement().alignOffset}\n class={cn(\n overlaySurface,\n 'z-(--z-menu) w-64 p-3',\n 'origin-(--transform-origin)',\n tooltipMotion,\n props.class\n )}\n render={expandedDiv}\n {...rest}\n >\n {props.children}\n <UiHoverCardArrow class={cn(arrowPlacement, popoverArrow)}>\n <ArrowGlyph />\n </UiHoverCardArrow>\n </UiHoverCardContent>","render={expandedDiv}","props.children","<UiHoverCardArrow class={cn(arrowPlacement, popoverArrow)}>\n <ArrowGlyph />\n </UiHoverCardArrow>","<ArrowGlyph />"
|
|
1
|
+
{"version":3,"file":"hover-card.js","names":["<HoverCardPlacementContext\n value={() => ({ placement: props.placement, gutter: props.gutter, shift: props.shift })}\n >\n {/* Kobalte's timing, which every card in the kit was tuned against. */}\n <UiHoverCard\n {...(rest as HoverCardOptions)}\n delay={props.openDelay ?? 700}\n closeDelay={props.closeDelay ?? 300}\n >\n {props.children}\n </UiHoverCard>\n </HoverCardPlacementContext>","value={() => ({ placement: props.placement, gutter: props.gutter, shift: props.shift })}","<UiHoverCard\n {...(rest as HoverCardOptions)}\n delay={props.openDelay ?? 700}\n closeDelay={props.closeDelay ?? 300}\n >\n {props.children}\n </UiHoverCard>","<UiHoverCardTrigger\n {...omit(props, 'as')}\n render={triggerRender(props.as, 'a', () => props['data-slot'])}\n />","<UiHoverCardContent\n container={overlayContainer()}\n side={placement().side}\n align={placement().align}\n sideOffset={placement().sideOffset + ARROW_OFFSET}\n alignOffset={placement().alignOffset}\n class={cn(\n overlaySurface,\n 'z-(--z-menu) w-64 p-3',\n 'origin-(--transform-origin)',\n tooltipMotion,\n props.class\n )}\n render={expandedDiv}\n {...rest}\n >\n {props.children}\n <UiHoverCardArrow class={cn(arrowPlacement, popoverArrow)}>\n <ArrowGlyph />\n </UiHoverCardArrow>\n </UiHoverCardContent>","render={expandedDiv}","props.children","<UiHoverCardArrow class={cn(arrowPlacement, popoverArrow)}>\n <ArrowGlyph />\n </UiHoverCardArrow>","<ArrowGlyph />"],"sources":["../../../../src/components/ui/hover-card/hover-card.tsx"],"sourcesContent":["import {\n HoverCard as UiHoverCard,\n HoverCardArrow as UiHoverCardArrow,\n HoverCardContent as UiHoverCardContent,\n HoverCardTrigger as UiHoverCardTrigger,\n type HoverCardContentState,\n type HoverCardOptions,\n} from '@ui-sdk/solid/hover-card'\nimport type { PartProps } from '@ui-sdk/solid/primitive'\nimport type { Accessor } from 'solid-js'\nimport type { JSX, ValidComponent } from '@solidjs/web'\nimport { createContext, omit, useContext } from 'solid-js'\nimport { overlaySurface, popoverArrow, tooltipMotion } from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport {\n ArrowGlyph,\n ARROW_OFFSET,\n arrowPlacement,\n triggerRender,\n expandedDiv,\n overlayContainer,\n placementProps,\n type OverlayPlacementOptions,\n} from '../tooltip/tooltip'\n\n/**\n * HoverCard.\n *\n * A rich preview shown on hover: a user's profile, a file's summary, a link's\n * destination. The difference from Tooltip is that this may be hovered *into*\n * the pointer can leave the trigger, cross the gap, and read the card.\n *\n * Because it only opens on hover, its content must also be reachable another\n * way (clicking the trigger, for instance). A hover card that holds the only\n * route to something is unreachable by keyboard and by touch.\n */\nexport type HoverCardProps = Omit<HoverCardOptions, 'delay'> &\n OverlayPlacementOptions & {\n children?: JSX.Element\n /** Milliseconds the pointer rests on the trigger before the card opens. */\n openDelay?: number\n }\n\nconst HoverCardPlacementContext = createContext<Accessor<OverlayPlacementOptions>>(() => ({}))\n\nexport function HoverCard(props: HoverCardProps) {\n const rest = omit(\n props as HoverCardProps & Record<string, unknown>,\n 'children',\n 'openDelay',\n 'placement',\n 'gutter',\n 'shift',\n 'id',\n 'forceMount',\n 'ignoreSafeArea'\n )\n return (\n <HoverCardPlacementContext\n value={() => ({ placement: props.placement, gutter: props.gutter, shift: props.shift })}\n >\n {/* Kobalte's timing, which every card in the kit was tuned against. */}\n <UiHoverCard\n {...(rest as HoverCardOptions)}\n delay={props.openDelay ?? 700}\n closeDelay={props.closeDelay ?? 300}\n >\n {props.children}\n </UiHoverCard>\n </HoverCardPlacementContext>\n )\n}\n\nexport function HoverCardTrigger(\n props: PartProps<'a'> & { as?: ValidComponent; [key: string]: unknown }\n) {\n return (\n <UiHoverCardTrigger\n {...omit(props, 'as')}\n render={triggerRender(props.as, 'a', () => props['data-slot'])}\n />\n )\n}\n\nexport type HoverCardContentProps = Omit<\n PartProps<'div', HoverCardContentState>,\n 'class' | 'children' | 'render'\n> &\n OverlayPlacementOptions & { class?: string; children?: JSX.Element }\n\nexport function HoverCardContent(props: HoverCardContentProps) {\n const root = useContext(HoverCardPlacementContext)\n const rest = omit(props, 'class', 'children', 'placement', 'gutter', 'shift')\n const placement = () =>\n placementProps(\n {\n placement: props.placement ?? root().placement,\n gutter: props.gutter ?? root().gutter,\n shift: props.shift ?? root().shift,\n },\n { placement: 'bottom', gutter: 0 }\n )\n\n return (\n <UiHoverCardContent\n container={overlayContainer()}\n side={placement().side}\n align={placement().align}\n sideOffset={placement().sideOffset + ARROW_OFFSET}\n alignOffset={placement().alignOffset}\n class={cn(\n overlaySurface,\n 'z-(--z-menu) w-64 p-3',\n 'origin-(--transform-origin)',\n tooltipMotion,\n props.class\n )}\n render={expandedDiv}\n {...rest}\n >\n {props.children}\n <UiHoverCardArrow class={cn(arrowPlacement, popoverArrow)}>\n <ArrowGlyph />\n </UiHoverCardArrow>\n </UiHoverCardContent>\n )\n}\n"],"mappings":";;;;;;;AA2CA,IAAM,4BAA4B,qBAAwD,CAAC,EAAE;AAE7F,SAAgB,UAAU,OAAuB;CAC/C,MAAM,OAAO,KACX,OACA,YACA,aACA,aACA,UACA,SACA,MACA,cACA,gBACF;CACA,OAC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,MAdN,EAAA,IAAA,WAAA;EAeC,OAAA,CACEC,WAAAA;GAAM,OAAA,MAAA;EAAO,CAAA,GACdC,gBAAAA,gBAAAA;GAAkB,IAAA,UAAA;IAAO,OAAA,GAAG,gBAAgB,YAAY;GAAC;GAAzD,IAAA,WAAA;IACEC,OAAAA,gBAAAA,YAAAA,CAAa,CAAA;GACG;EAHnB,CAAA,CAAA;CAImB,EAAA,CAAA,CAAA;AAExB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { cn } from "../../../lib/utils.js";
|
|
2
1
|
import { spread, template } from "@solidjs/web";
|
|
3
2
|
import { omit } from "solid-js";
|
|
3
|
+
import { cn } from "../../../lib/utils.js";
|
|
4
4
|
// src/components/ui/input/input-control.tsx
|
|
5
5
|
var _tmpl$ = /* @__PURE__ */ template(`<input>`);
|
|
6
6
|
var inputBase = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-control.js","names":["<input\n data-slot=\"input\"\n type={local.type ?? 'text'}\n class={inputControlClass(local.size, local.class)}\n {...rest}\n />"],"sources":["../../../../src/components/ui/input/input-control.tsx"],"sourcesContent":["import type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport type { ClassValue } from 'cn'\nimport { cn } from '#lib/utils'\n\n/**\n * InputControl.\n *\n * A styled native input with no optional suggestion-list behavior. Use this\n * when a consumer needs only the control; `Input` adds native datalist\n * suggestions for forms that need them.\n */\nexport type InputControlProps = Omit<ComponentProps<'input'>, 'size'> & {\n /**\n * The control rung, matching `SelectTrigger`: `sm` for a dense toolbar or\n * pane filter beside `icon-sm` actions, `md` (the default) everywhere else.\n */\n size?: 'sm' | 'md' | 'lg'\n}\n\nconst inputBase = [\n 'w-full min-w-0 rounded-md border border-input bg-transparent py-1',\n 'transition-[color,box-shadow,border-color] ease-out outline-none',\n 'placeholder:text-muted-foreground',\n 'selection:bg-primary selection:text-primary-foreground',\n 'file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground',\n /* A pointer click on a text field is a typing affordance, so the ring\n appears where the user agent already matches :focus-visible. */\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 'read-only:bg-surface-hover',\n].join(' ')\n\n/** Each rung's full class list, merged once rather than on every input. */\nconst inputSizeClass = {\n sm: cn(inputBase, 'h-control-sm px-control-sm text-xs'),\n md: cn(inputBase, 'h-control-md px-control-md text-sm'),\n lg: cn(inputBase, 'h-control-lg px-control-lg text-sm'),\n} as const\n\n/** The input's class for a rung, with the caller's class merged last. */\nexport function inputControlClass(size: InputControlProps['size'], className?: ClassValue) {\n const base = inputSizeClass[size ?? 'md']\n return className ? cn(base, className) : base\n}\n\nexport function InputControl(props: InputControlProps) {\n const local = props\n const rest = omit(props, 'class', 'type', 'size')\n\n return (\n <input\n data-slot=\"input\"\n type={local.type ?? 'text'}\n class={inputControlClass(local.size, local.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;AAoBA,IAAM,YAAY;CAChB;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG;;AAGV,IAAM,iBAAiB;CACrB,IAAI,GAAG,WAAW,oCAAoC;CACtD,IAAI,GAAG,WAAW,oCAAoC;CACtD,IAAI,GAAG,WAAW,oCAAoC;AACxD;;AAGA,SAAgB,kBAAkB,MAAiC,WAAwB;CACzF,MAAM,OAAO,eAAe,QAAQ;CACpC,OAAO,YAAY,GAAG,MAAM,SAAS,IAAI;AAC3C;AAEA,SAAgB,aAAa,OAA0B;CACrD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,QAAQ,MAAM;CAG9C,IAAA,OAAA,OAKC;
|
|
1
|
+
{"version":3,"file":"input-control.js","names":["<input\n data-slot=\"input\"\n type={local.type ?? 'text'}\n class={inputControlClass(local.size, local.class)}\n {...rest}\n />","_$spread"],"sources":["../../../../src/components/ui/input/input-control.tsx"],"sourcesContent":["import type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport type { ClassValue } from 'cn'\nimport { cn } from '#lib/utils'\n\n/**\n * InputControl.\n *\n * A styled native input with no optional suggestion-list behavior. Use this\n * when a consumer needs only the control; `Input` adds native datalist\n * suggestions for forms that need them.\n */\nexport type InputControlProps = Omit<ComponentProps<'input'>, 'size'> & {\n /**\n * The control rung, matching `SelectTrigger`: `sm` for a dense toolbar or\n * pane filter beside `icon-sm` actions, `md` (the default) everywhere else.\n */\n size?: 'sm' | 'md' | 'lg'\n}\n\nconst inputBase = [\n 'w-full min-w-0 rounded-md border border-input bg-transparent py-1',\n 'transition-[color,box-shadow,border-color] ease-out outline-none',\n 'placeholder:text-muted-foreground',\n 'selection:bg-primary selection:text-primary-foreground',\n 'file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground',\n /* A pointer click on a text field is a typing affordance, so the ring\n appears where the user agent already matches :focus-visible. */\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 'read-only:bg-surface-hover',\n].join(' ')\n\n/** Each rung's full class list, merged once rather than on every input. */\nconst inputSizeClass = {\n sm: cn(inputBase, 'h-control-sm px-control-sm text-xs'),\n md: cn(inputBase, 'h-control-md px-control-md text-sm'),\n lg: cn(inputBase, 'h-control-lg px-control-lg text-sm'),\n} as const\n\n/** The input's class for a rung, with the caller's class merged last. */\nexport function inputControlClass(size: InputControlProps['size'], className?: ClassValue) {\n const base = inputSizeClass[size ?? 'md']\n return className ? cn(base, className) : base\n}\n\nexport function InputControl(props: InputControlProps) {\n const local = props\n const rest = omit(props, 'class', 'type', 'size')\n\n return (\n <input\n data-slot=\"input\"\n type={local.type ?? 'text'}\n class={inputControlClass(local.size, local.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;AAoBA,IAAM,YAAY;CAChB;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG;;AAGV,IAAM,iBAAiB;CACrB,IAAI,GAAG,WAAW,oCAAoC;CACtD,IAAI,GAAG,WAAW,oCAAoC;CACtD,IAAI,GAAG,WAAW,oCAAoC;AACxD;;AAGA,SAAgB,kBAAkB,MAAiC,WAAwB;CACzF,MAAM,OAAO,eAAe,QAAQ;CACpC,OAAO,YAAY,GAAG,MAAM,SAAS,IAAI;AAC3C;AAEA,SAAgB,aAAa,OAA0B;CACrD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,QAAQ,MAAM;CAG9C,IAAA,OAAA,OAKC;CADCC,OAAA,MAAA,CAAA;EAHA,aAAA;EACA,IAAA,OAAA;GAAM,OAAA,MAAM,QAAQ;EAAM;EAC1B,IAAA,UAAA;GAAO,OAAA,kBAAkB,MAAM,MAAM,MAAM,KAAK;EAAC;CACzC,GAAJ,IAAA,GAAA,KAAA;CALR,OACED;AAOJ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useFormFieldControl } from "../../../lib/form-field.js";
|
|
2
|
-
import { inputControlClass } from "./input-control.js";
|
|
3
1
|
import { createComponent, effect, insert, setAttribute, spread, template } from "@solidjs/web";
|
|
4
2
|
import { For, Show, createUniqueId, omit } from "solid-js";
|
|
3
|
+
import { useFormFieldControl } from "../../../lib/form-field.js";
|
|
4
|
+
import { inputControlClass } from "./input-control.js";
|
|
5
5
|
// src/components/ui/input/input.tsx
|
|
6
6
|
var _tmpl$ = /* @__PURE__ */ template(`<input>`);
|
|
7
7
|
var _tmpl$2 = /* @__PURE__ */ template(`<datalist>`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","names":["<Show when={local.suggestions}>\n {(suggestions) => (\n <datalist id={listId()}>\n <For each={suggestions()}>{(value) => <option value={value} />}</For>\n </datalist>\n )}\n </Show>","<For each={suggestions()}>{(value) => <option value={value} />}</For>"],"sources":["../../../../src/components/ui/input/input.tsx"],"sourcesContent":["import { createUniqueId, For, Show, omit } from 'solid-js'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { inputControlClass, type InputControlProps } from './input-control'\n\n/**\n * Input.\n *\n * Deliberately a plain `<input>` rather than a headless text-field part. The\n * styling contract is what a consumer needs from an input; validation,\n * description and error wiring come from `Field`, which composes this. Keeping\n * them separate is what lets an input sit inside a custom control without\n * inheriting a form's ARIA graph.\n *\n * Height comes from the control tokens (`size`, `md` by default); an input\n * cannot be given a height off that ladder, which is what keeps it aligned\n * with Button and Select.\n */\nexport type InputProps = InputControlProps & {\n /** Native text suggestions; custom values remain valid and submit unchanged. */\n suggestions?: readonly string[]\n}\n\nexport function Input(props: InputProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'type',\n 'size',\n 'id',\n 'list',\n 'suggestions',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage'\n )\n const field = useFormFieldControl('control', local)\n const suggestionsId = createUniqueId()\n const listId = () => local.list ?? `input-suggestions-${suggestionsId}`\n\n // The input is written here rather than through InputControl: one prop\n // split and one spread instead of two of each.\n return (\n <>\n <input\n data-slot=\"input\"\n {...rest}\n type={local.type ?? 'text'}\n class={inputControlClass(local.size, local.class)}\n id={field?.id ?? local.id}\n list={local.suggestions ? listId() : local.list}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n />\n <Show when={local.suggestions}>\n {(suggestions) => (\n <datalist id={listId()}>\n <For each={suggestions()}>{(value) => <option value={value} />}</For>\n </datalist>\n )}\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;AAsBA,SAAgB,MAAM,OAAmB;CACvC,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,SACA,QACA,QACA,MACA,QACA,eACA,cACA,mBACA,oBACA,gBACA,mBACF;CACA,MAAM,QAAQ,oBAAoB,WAAW,KAAK;CAClD,MAAM,gBAAgB,eAAe;CACrC,MAAM,eAAe,MAAM,QAAQ,qBAAqB;CAIxD,OACI,QACA;EAYC,IAAA,OAAA,OAAA;;GAVC,EADA,aAAA,QACQ;GAAJ;;IACJ,IAAA,OAAA;KAAM,OAAA,MAAM,QAAQ;IAAM;IAC1B,IAAA,UAAA;KAAO,OAAA,kBAAkB,MAAM,MAAM,MAAM,KAAK;IAAC;IACjD,IAAA,KAAA;KAAI,OAAA,OAAO,MAAM,MAAM;IAAE;IACzB,IAAA,OAAA;KAAM,OAAA,MAAM,cAAc,OAAO,IAAI,MAAM;IAAI;IAC/C,IAAA,eAAA;KAAY,OAAA,MAAM;IAAa;IAC/B,IAAA,oBAAA;KAAiB,OAAA,QAAQ,sBAAsB,MAAM;IAAkB;IACvE,IAAA,qBAAA;KAAkB,OAAA,QAAQ,uBAAuB,MAAM;IAAmB;IAC1E,IAAA,iBAAA;KAAc,OAAA,QAAQ,mBAAmB,MAAM;IAAe;IAC9D,IAAA,sBAAA;KAAmB,OAAA,QAAQ,wBAAwB,MAAM;IAAoB;;;EAX/E,OAAA;CAYC,EAAA,CAAA,GACDA,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,MAAM;EAAW;EAA7BA,WACI,uBACA;GAEU,IAAA,QAAA,QAAA;
|
|
1
|
+
{"version":3,"file":"input.js","names":["<Show when={local.suggestions}>\n {(suggestions) => (\n <datalist id={listId()}>\n <For each={suggestions()}>{(value) => <option value={value} />}</For>\n </datalist>\n )}\n </Show>","<For each={suggestions()}>{(value) => <option value={value} />}</For>","_$insert","_$effect","_$setAttribute"],"sources":["../../../../src/components/ui/input/input.tsx"],"sourcesContent":["import { createUniqueId, For, Show, omit } from 'solid-js'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { inputControlClass, type InputControlProps } from './input-control'\n\n/**\n * Input.\n *\n * Deliberately a plain `<input>` rather than a headless text-field part. The\n * styling contract is what a consumer needs from an input; validation,\n * description and error wiring come from `Field`, which composes this. Keeping\n * them separate is what lets an input sit inside a custom control without\n * inheriting a form's ARIA graph.\n *\n * Height comes from the control tokens (`size`, `md` by default); an input\n * cannot be given a height off that ladder, which is what keeps it aligned\n * with Button and Select.\n */\nexport type InputProps = InputControlProps & {\n /** Native text suggestions; custom values remain valid and submit unchanged. */\n suggestions?: readonly string[]\n}\n\nexport function Input(props: InputProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'type',\n 'size',\n 'id',\n 'list',\n 'suggestions',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage'\n )\n const field = useFormFieldControl('control', local)\n const suggestionsId = createUniqueId()\n const listId = () => local.list ?? `input-suggestions-${suggestionsId}`\n\n // The input is written here rather than through InputControl: one prop\n // split and one spread instead of two of each.\n return (\n <>\n <input\n data-slot=\"input\"\n {...rest}\n type={local.type ?? 'text'}\n class={inputControlClass(local.size, local.class)}\n id={field?.id ?? local.id}\n list={local.suggestions ? listId() : local.list}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n />\n <Show when={local.suggestions}>\n {(suggestions) => (\n <datalist id={listId()}>\n <For each={suggestions()}>{(value) => <option value={value} />}</For>\n </datalist>\n )}\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;AAsBA,SAAgB,MAAM,OAAmB;CACvC,MAAM,QAAQ;CACd,MA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AsBL"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { createComponent, insert, mergeProps, spread, template } from "@solidjs/web";
|
|
2
|
+
import { omit } from "solid-js";
|
|
1
3
|
import { callHandler } from "../../../lib/events.js";
|
|
2
4
|
import { useFormFieldControl } from "../../../lib/form-field.js";
|
|
3
5
|
import { cn } from "../../../lib/utils.js";
|
|
4
6
|
import { Button } from "../button/button.js";
|
|
5
|
-
import { createComponent, insert, mergeProps, spread, template } from "@solidjs/web";
|
|
6
|
-
import { omit } from "solid-js";
|
|
7
7
|
// src/components/ui/input-group/input-group.tsx
|
|
8
8
|
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
9
9
|
var _tmpl$2 = /* @__PURE__ */ template(`<input>`);
|