@snowui-design-system/components 0.3.0-alpha.1 → 0.3.0-alpha.12
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/AGENTS.md +39 -0
- package/LICENSE +152 -91
- package/README.md +41 -7
- package/THIRD_PARTY_NOTICES.md +41 -0
- package/component-catalog.json +531 -84
- package/dist/client/blocks/Sidebar.js +183 -141
- package/dist/client/blocks/SidebarItem.js +27 -13
- package/dist/client/blocks/SidebarSection.js +11 -3
- package/dist/client/blocks/index.js +2 -0
- package/dist/client/compat.js +2 -0
- package/dist/client/components/Accordion.d.ts +2 -0
- package/dist/client/components/Accordion.js +37 -16
- package/dist/client/components/AccordionItem.js +1 -1
- package/dist/client/components/BarChart.js +10 -3
- package/dist/client/components/Breadcrumb.d.ts +1 -0
- package/dist/client/components/Breadcrumb.js +44 -18
- package/dist/client/components/Button.d.ts +2 -0
- package/dist/client/components/Button.js +6 -1
- package/dist/client/components/ChartGroup.js +23 -10
- package/dist/client/components/Checkbox.d.ts +2 -0
- package/dist/client/components/Checkbox.js +19 -4
- package/dist/client/components/Chip.js +2 -2
- package/dist/client/components/CircularChart.js +10 -3
- package/dist/client/components/CodeBlock.js +283 -226
- package/dist/client/components/CopyButton.js +5 -2
- package/dist/client/components/CopyLink.js +1 -1
- package/dist/client/components/DataTable.d.ts +8 -2
- package/dist/client/components/DataTable.js +9 -3
- package/dist/client/components/Dialog.js +1 -1
- package/dist/client/components/ExpandButton.js +10 -3
- package/dist/client/components/Field.js +3 -2
- package/dist/client/components/Frame.js +24 -16
- package/dist/client/components/GaugeChart.js +10 -3
- package/dist/client/components/Icon.js +6 -3
- package/dist/client/components/Image.d.ts +2 -0
- package/dist/client/components/Image.js +14 -2
- package/dist/client/components/ImageViewer.js +51 -27
- package/dist/client/components/Indicator.js +5 -3
- package/dist/client/components/Input.d.ts +1 -0
- package/dist/client/components/Input.js +51 -24
- package/dist/client/components/LineChart.js +10 -3
- package/dist/client/components/Link.d.ts +1 -1
- package/dist/client/components/Link.js +58 -30
- package/dist/client/components/Listbox.d.ts +2 -0
- package/dist/client/components/Listbox.js +98 -43
- package/dist/client/components/MenuItem.d.ts +2 -0
- package/dist/client/components/MenuItem.js +15 -2
- package/dist/client/components/OTPInput.d.ts +32 -0
- package/dist/client/components/OTPInput.js +556 -0
- package/dist/client/components/OverflowAction.d.ts +2 -0
- package/dist/client/components/OverflowAction.js +146 -65
- package/dist/client/components/OverflowActions.d.ts +7 -1
- package/dist/client/components/OverflowActions.js +102 -26
- package/dist/client/components/Pagination.js +117 -68
- package/dist/client/components/Radio.d.ts +2 -0
- package/dist/client/components/Radio.js +20 -5
- package/dist/client/components/ScrambleText.js +4 -1
- package/dist/client/components/ScrollArea.js +11 -5
- package/dist/client/components/SearchBox.d.ts +1 -0
- package/dist/client/components/SearchBox.js +32 -7
- package/dist/client/components/SearchInput.js +43 -3
- package/dist/client/components/Select.d.ts +1 -0
- package/dist/client/components/Select.js +65 -27
- package/dist/client/components/SidePanel.js +81 -54
- package/dist/client/components/Slider.d.ts +1 -1
- package/dist/client/components/Slider.js +36 -13
- package/dist/client/components/SnowUILogo.js +1 -1
- package/dist/client/components/Spinner.js +9 -2
- package/dist/client/components/Switch.d.ts +2 -0
- package/dist/client/components/Switch.js +18 -3
- package/dist/client/components/Tab.js +90 -81
- package/dist/client/components/Table.js +30 -16
- package/dist/client/components/TableBody.js +10 -4
- package/dist/client/components/TableCell.d.ts +1 -0
- package/dist/client/components/TableCell.js +100 -50
- package/dist/client/components/TableHead.js +72 -39
- package/dist/client/components/TableToolbar.js +217 -141
- package/dist/client/components/Tag.js +21 -3
- package/dist/client/components/Text.js +163 -83
- package/dist/client/components/Textarea.js +8 -2
- package/dist/client/components/Toast.js +9 -2
- package/dist/client/components/Toaster.d.ts +2 -0
- package/dist/client/components/Toaster.js +51 -37
- package/dist/client/components/Tooltip.js +229 -201
- package/dist/client/context.js +2 -0
- package/dist/client/dev.js +2 -0
- package/dist/client/i18n/messages.d.ts +2 -2
- package/dist/client/i18n/messages.js +177 -1
- package/dist/client/index.d.ts +4 -1
- package/dist/client/index.js +5 -1
- package/dist/client/internal/code-block/prettier-svelte.d.ts +2 -0
- package/dist/client/internal/component-icon/index.js +2 -0
- package/dist/client/internal/snow-ui-logo/Wordmark.js +21 -9
- package/dist/client/internal/snow-ui-logo/emoji-metrics.js +2 -0
- package/dist/client/keys.d.ts +1 -0
- package/dist/client/keys.js +3 -0
- package/dist/client/lib/adaptive-contrast-renderer.js +2 -0
- package/dist/client/lib/chart/ChartHoverPanel.js +1 -1
- package/dist/client/lib/chart/appearance-timeline.js +2 -0
- package/dist/client/lib/chart/arc-path.js +2 -0
- package/dist/client/lib/chart/colors.js +2 -0
- package/dist/client/lib/chart/size.js +2 -0
- package/dist/client/lib/clipboard.js +2 -0
- package/dist/client/lib/color.js +2 -0
- package/dist/client/lib/date-format.js +2 -0
- package/dist/client/lib/edge-fade.js +2 -0
- package/dist/client/lib/media-loading.d.ts +7 -0
- package/dist/client/lib/media-loading.js +12 -0
- package/dist/client/lib/number-format.js +8 -0
- package/dist/client/lib/overflow-actions-motion.js +2 -0
- package/dist/client/lib/overlay-scrollbar.d.ts +1 -0
- package/dist/client/lib/overlay-scrollbar.js +9 -0
- package/dist/client/lib/overlay-trigger-timing.js +2 -0
- package/dist/client/lib/progressive-blur.d.ts +13 -0
- package/dist/client/lib/progressive-blur.js +54 -0
- package/dist/client/lib/responsive-exit.js +2 -0
- package/dist/client/lib/search-filter.js +2 -0
- package/dist/client/lib/side-panel.js +2 -0
- package/dist/client/lib/split-pane.js +2 -0
- package/dist/client/lib/table-column-motion.js +2 -0
- package/dist/client/lib/table-context.d.ts +5 -0
- package/dist/client/lib/table-context.js +4 -1
- package/dist/client/lib/table-responsive.d.ts +1 -1
- package/dist/client/lib/table-responsive.js +41 -7
- package/dist/client/lib/table-selection-fade.js +2 -0
- package/dist/client/lib/table-truncation.js +2 -0
- package/dist/client/lib/text-motion/animation.js +2 -0
- package/dist/client/lib/text-motion/character.js +2 -0
- package/dist/client/lib/text-motion/color.js +2 -0
- package/dist/client/lib/text-motion/layout.js +2 -0
- package/dist/client/lib/text-motion/preference.js +2 -0
- package/dist/client/lib/text-motion/sequence.js +2 -0
- package/dist/client/lib/text-motion/typography.js +2 -0
- package/dist/client/lib/tooltip-delay.js +2 -0
- package/dist/client/lib/tooltip-motion-dismiss.js +2 -0
- package/dist/client/lib/tooltip-pointer-speed.js +2 -0
- package/dist/client/lib/truncate.js +2 -0
- package/dist/client/logic/ComponentPartsBoundary.d.ts +7 -0
- package/dist/client/logic/ComponentPartsBoundary.js +15 -0
- package/dist/client/logic/content-line.d.ts +5 -0
- package/dist/client/logic/content-line.js +13 -0
- package/dist/client/logic/frame-dom-runtime.d.ts +3 -1
- package/dist/client/logic/frame-dom-runtime.js +5 -3
- package/dist/client/logic/frame-field-control.js +2 -0
- package/dist/client/logic/frame-inline-style.js +2 -3
- package/dist/client/logic/frame-layout.js +3 -0
- package/dist/client/logic/frame-motion-defaults.js +2 -0
- package/dist/client/logic/frame-prop-filter.d.ts +1 -1
- package/dist/client/logic/frame-prop-filter.js +3 -0
- package/dist/client/logic/frame-responsive.js +22 -6
- package/dist/client/logic/frame-types.d.ts +2 -0
- package/dist/client/logic/geometry-cache.js +2 -0
- package/dist/client/logic/layout-flip.js +2 -0
- package/dist/client/logic/morph.js +2 -0
- package/dist/client/logic/motion-engine.js +2 -0
- package/dist/client/logic/motion-orchestration.js +2 -0
- package/dist/client/logic/motion-types.js +2 -0
- package/dist/client/logic/overflow-actions.d.ts +11 -2
- package/dist/client/logic/overflow-actions.js +5 -0
- package/dist/client/logic/toast.js +7 -4
- package/dist/client/logic/wc-adapter.js +2 -0
- package/dist/client/motion/bridge.js +2 -0
- package/dist/client/motion/content-crossfade.js +2 -0
- package/dist/client/motion/expand.js +2 -0
- package/dist/client/motion/fade-in.js +2 -0
- package/dist/client/motion/fade-out.js +2 -0
- package/dist/client/motion/morph.js +2 -0
- package/dist/client/motion/move.js +2 -0
- package/dist/client/motion/number.js +2 -0
- package/dist/client/motion/replace.js +2 -0
- package/dist/client/motion/rotate.css +2 -0
- package/dist/client/motion/rotate.js +2 -0
- package/dist/client/motion/scale-in.js +2 -0
- package/dist/client/motion/tokens.js +2 -0
- package/dist/client/motion/while-2xl.js +2 -0
- package/dist/client/motion/while-active.js +2 -0
- package/dist/client/motion/while-appear.js +2 -0
- package/dist/client/motion/while-click.js +2 -0
- package/dist/client/motion/while-collapsed.js +2 -0
- package/dist/client/motion/while-disabled.js +2 -0
- package/dist/client/motion/while-disappear.js +2 -0
- package/dist/client/motion/while-drag.js +2 -0
- package/dist/client/motion/while-editing.js +2 -0
- package/dist/client/motion/while-expanded.js +2 -0
- package/dist/client/motion/while-focus.js +2 -0
- package/dist/client/motion/while-hover.js +2 -0
- package/dist/client/motion/while-idle.js +2 -0
- package/dist/client/motion/while-key.js +2 -0
- package/dist/client/motion/while-lg.js +2 -0
- package/dist/client/motion/while-load.js +2 -0
- package/dist/client/motion/while-md.js +2 -0
- package/dist/client/motion/while-reload.js +2 -0
- package/dist/client/motion/while-scroll.js +2 -0
- package/dist/client/motion/while-sm.js +2 -0
- package/dist/client/motion/while-uploading.js +2 -0
- package/dist/client/motion/while-validating.js +2 -0
- package/dist/client/motion/while-xl.js +2 -0
- package/dist/client/motion/while-xs.js +2 -0
- package/dist/client/styles/auto-layout.css +23 -1
- package/dist/client/styles/backdrop.css +2 -0
- package/dist/client/styles/components.css +14 -6
- package/dist/client/styles/index.css +2 -0
- package/dist/client/styles/layout.css +32 -6
- package/dist/client/styles/scale.css +2 -0
- package/dist/client/styles/scrollbar.css +16 -1
- package/dist/client/styles/themes.css +7 -4
- package/dist/client/styles/tokens.css +2 -0
- package/dist/client/vite-env.d.ts +2 -0
- package/dist/server/blocks/Sidebar.js +45 -25
- package/dist/server/blocks/SidebarItem.js +5 -3
- package/dist/server/blocks/SidebarSection.js +11 -3
- package/dist/server/blocks/index.js +2 -0
- package/dist/server/compat.js +2 -0
- package/dist/server/components/Accordion.d.ts +2 -0
- package/dist/server/components/Accordion.js +12 -1
- package/dist/server/components/AccordionItem.js +1 -1
- package/dist/server/components/BarChart.js +6 -3
- package/dist/server/components/Breadcrumb.d.ts +1 -0
- package/dist/server/components/Breadcrumb.js +26 -5
- package/dist/server/components/Button.d.ts +2 -0
- package/dist/server/components/Button.js +6 -1
- package/dist/server/components/ChartGroup.js +6 -3
- package/dist/server/components/Checkbox.d.ts +2 -0
- package/dist/server/components/Checkbox.js +16 -3
- package/dist/server/components/Chip.js +2 -2
- package/dist/server/components/CircularChart.js +6 -3
- package/dist/server/components/CodeBlock.js +27 -14
- package/dist/server/components/CopyButton.js +6 -2
- package/dist/server/components/CopyLink.js +1 -1
- package/dist/server/components/DataTable.d.ts +8 -2
- package/dist/server/components/DataTable.js +9 -3
- package/dist/server/components/Dialog.js +1 -1
- package/dist/server/components/ExpandButton.js +7 -3
- package/dist/server/components/Field.js +3 -2
- package/dist/server/components/Frame.js +19 -10
- package/dist/server/components/GaugeChart.js +6 -3
- package/dist/server/components/Icon.js +5 -4
- package/dist/server/components/Image.d.ts +2 -0
- package/dist/server/components/Image.js +11 -4
- package/dist/server/components/ImageViewer.js +6 -3
- package/dist/server/components/Indicator.js +5 -3
- package/dist/server/components/Input.d.ts +1 -0
- package/dist/server/components/Input.js +32 -22
- package/dist/server/components/LineChart.js +6 -3
- package/dist/server/components/Link.d.ts +1 -1
- package/dist/server/components/Link.js +22 -3
- package/dist/server/components/Listbox.d.ts +2 -0
- package/dist/server/components/Listbox.js +81 -22
- package/dist/server/components/MenuItem.d.ts +2 -0
- package/dist/server/components/MenuItem.js +9 -2
- package/dist/server/components/OTPInput.d.ts +32 -0
- package/dist/server/components/OTPInput.js +401 -0
- package/dist/server/components/OverflowAction.d.ts +2 -0
- package/dist/server/components/OverflowAction.js +70 -26
- package/dist/server/components/OverflowActions.d.ts +7 -1
- package/dist/server/components/OverflowActions.js +88 -30
- package/dist/server/components/Pagination.js +42 -22
- package/dist/server/components/Radio.d.ts +2 -0
- package/dist/server/components/Radio.js +15 -5
- package/dist/server/components/ScrambleText.js +4 -1
- package/dist/server/components/ScrollArea.js +5 -2
- package/dist/server/components/SearchBox.d.ts +1 -0
- package/dist/server/components/SearchBox.js +25 -5
- package/dist/server/components/SearchInput.js +12 -3
- package/dist/server/components/Select.d.ts +1 -0
- package/dist/server/components/Select.js +55 -20
- package/dist/server/components/SidePanel.js +33 -12
- package/dist/server/components/Slider.d.ts +1 -1
- package/dist/server/components/Slider.js +34 -11
- package/dist/server/components/SnowUILogo.js +1 -1
- package/dist/server/components/Spinner.js +4 -2
- package/dist/server/components/Switch.d.ts +2 -0
- package/dist/server/components/Switch.js +14 -3
- package/dist/server/components/Tab.js +62 -52
- package/dist/server/components/Table.js +16 -6
- package/dist/server/components/TableBody.js +9 -2
- package/dist/server/components/TableCell.d.ts +1 -0
- package/dist/server/components/TableCell.js +68 -25
- package/dist/server/components/TableHead.js +35 -8
- package/dist/server/components/TableToolbar.js +104 -55
- package/dist/server/components/Tag.js +17 -3
- package/dist/server/components/Text.js +64 -15
- package/dist/server/components/Textarea.js +5 -2
- package/dist/server/components/Toast.js +5 -2
- package/dist/server/components/Toaster.d.ts +2 -0
- package/dist/server/components/Toaster.js +17 -2
- package/dist/server/components/Tooltip.js +39 -16
- package/dist/server/context.js +2 -0
- package/dist/server/dev.js +2 -0
- package/dist/server/i18n/messages.d.ts +2 -2
- package/dist/server/i18n/messages.js +177 -1
- package/dist/server/index.d.ts +4 -1
- package/dist/server/index.js +5 -1
- package/dist/server/internal/code-block/prettier-svelte.d.ts +2 -0
- package/dist/server/internal/component-icon/index.js +2 -0
- package/dist/server/internal/snow-ui-logo/Wordmark.js +15 -7
- package/dist/server/internal/snow-ui-logo/emoji-metrics.js +2 -0
- package/dist/server/keys.d.ts +1 -0
- package/dist/server/keys.js +3 -0
- package/dist/server/lib/adaptive-contrast-renderer.js +2 -0
- package/dist/server/lib/chart/ChartHoverPanel.js +1 -1
- package/dist/server/lib/chart/appearance-timeline.js +2 -0
- package/dist/server/lib/chart/arc-path.js +2 -0
- package/dist/server/lib/chart/colors.js +2 -0
- package/dist/server/lib/chart/size.js +2 -0
- package/dist/server/lib/clipboard.js +2 -0
- package/dist/server/lib/color.js +2 -0
- package/dist/server/lib/date-format.js +2 -0
- package/dist/server/lib/edge-fade.js +2 -0
- package/dist/server/lib/media-loading.d.ts +7 -0
- package/dist/server/lib/media-loading.js +12 -0
- package/dist/server/lib/number-format.js +8 -0
- package/dist/server/lib/overflow-actions-motion.js +2 -0
- package/dist/server/lib/overlay-scrollbar.d.ts +1 -0
- package/dist/server/lib/overlay-scrollbar.js +9 -0
- package/dist/server/lib/overlay-trigger-timing.js +2 -0
- package/dist/server/lib/progressive-blur.d.ts +13 -0
- package/dist/server/lib/progressive-blur.js +54 -0
- package/dist/server/lib/responsive-exit.js +2 -0
- package/dist/server/lib/search-filter.js +2 -0
- package/dist/server/lib/side-panel.js +2 -0
- package/dist/server/lib/split-pane.js +2 -0
- package/dist/server/lib/table-column-motion.js +2 -0
- package/dist/server/lib/table-context.d.ts +5 -0
- package/dist/server/lib/table-context.js +4 -1
- package/dist/server/lib/table-responsive.d.ts +1 -1
- package/dist/server/lib/table-responsive.js +41 -7
- package/dist/server/lib/table-selection-fade.js +2 -0
- package/dist/server/lib/table-truncation.js +2 -0
- package/dist/server/lib/text-motion/animation.js +2 -0
- package/dist/server/lib/text-motion/character.js +2 -0
- package/dist/server/lib/text-motion/color.js +2 -0
- package/dist/server/lib/text-motion/layout.js +2 -0
- package/dist/server/lib/text-motion/preference.js +2 -0
- package/dist/server/lib/text-motion/sequence.js +2 -0
- package/dist/server/lib/text-motion/typography.js +2 -0
- package/dist/server/lib/tooltip-delay.js +2 -0
- package/dist/server/lib/tooltip-motion-dismiss.js +2 -0
- package/dist/server/lib/tooltip-pointer-speed.js +2 -0
- package/dist/server/lib/truncate.js +2 -0
- package/dist/server/logic/ComponentPartsBoundary.d.ts +7 -0
- package/dist/server/logic/ComponentPartsBoundary.js +12 -0
- package/dist/server/logic/content-line.d.ts +5 -0
- package/dist/server/logic/content-line.js +13 -0
- package/dist/server/logic/frame-dom-runtime.d.ts +3 -1
- package/dist/server/logic/frame-dom-runtime.js +5 -3
- package/dist/server/logic/frame-field-control.js +2 -0
- package/dist/server/logic/frame-inline-style.js +2 -3
- package/dist/server/logic/frame-layout.js +3 -0
- package/dist/server/logic/frame-motion-defaults.js +2 -0
- package/dist/server/logic/frame-prop-filter.d.ts +1 -1
- package/dist/server/logic/frame-prop-filter.js +3 -0
- package/dist/server/logic/frame-responsive.js +22 -6
- package/dist/server/logic/frame-types.d.ts +2 -0
- package/dist/server/logic/geometry-cache.js +2 -0
- package/dist/server/logic/layout-flip.js +2 -0
- package/dist/server/logic/morph.js +2 -0
- package/dist/server/logic/motion-engine.js +2 -0
- package/dist/server/logic/motion-orchestration.js +2 -0
- package/dist/server/logic/motion-types.js +2 -0
- package/dist/server/logic/overflow-actions.d.ts +11 -2
- package/dist/server/logic/overflow-actions.js +5 -0
- package/dist/server/logic/toast.js +7 -4
- package/dist/server/logic/wc-adapter.js +2 -0
- package/dist/server/motion/bridge.js +2 -0
- package/dist/server/motion/content-crossfade.js +2 -0
- package/dist/server/motion/expand.js +2 -0
- package/dist/server/motion/fade-in.js +2 -0
- package/dist/server/motion/fade-out.js +2 -0
- package/dist/server/motion/morph.js +2 -0
- package/dist/server/motion/move.js +2 -0
- package/dist/server/motion/number.js +2 -0
- package/dist/server/motion/replace.js +2 -0
- package/dist/server/motion/rotate.css +2 -0
- package/dist/server/motion/rotate.js +2 -0
- package/dist/server/motion/scale-in.js +2 -0
- package/dist/server/motion/tokens.js +2 -0
- package/dist/server/motion/while-2xl.js +2 -0
- package/dist/server/motion/while-active.js +2 -0
- package/dist/server/motion/while-appear.js +2 -0
- package/dist/server/motion/while-click.js +2 -0
- package/dist/server/motion/while-collapsed.js +2 -0
- package/dist/server/motion/while-disabled.js +2 -0
- package/dist/server/motion/while-disappear.js +2 -0
- package/dist/server/motion/while-drag.js +2 -0
- package/dist/server/motion/while-editing.js +2 -0
- package/dist/server/motion/while-expanded.js +2 -0
- package/dist/server/motion/while-focus.js +2 -0
- package/dist/server/motion/while-hover.js +2 -0
- package/dist/server/motion/while-idle.js +2 -0
- package/dist/server/motion/while-key.js +2 -0
- package/dist/server/motion/while-lg.js +2 -0
- package/dist/server/motion/while-load.js +2 -0
- package/dist/server/motion/while-md.js +2 -0
- package/dist/server/motion/while-reload.js +2 -0
- package/dist/server/motion/while-scroll.js +2 -0
- package/dist/server/motion/while-sm.js +2 -0
- package/dist/server/motion/while-uploading.js +2 -0
- package/dist/server/motion/while-validating.js +2 -0
- package/dist/server/motion/while-xl.js +2 -0
- package/dist/server/motion/while-xs.js +2 -0
- package/dist/server/styles/auto-layout.css +23 -1
- package/dist/server/styles/backdrop.css +2 -0
- package/dist/server/styles/components.css +14 -6
- package/dist/server/styles/index.css +2 -0
- package/dist/server/styles/layout.css +32 -6
- package/dist/server/styles/scale.css +2 -0
- package/dist/server/styles/scrollbar.css +16 -1
- package/dist/server/styles/themes.css +7 -4
- package/dist/server/styles/tokens.css +2 -0
- package/dist/server/vite-env.d.ts +2 -0
- package/llms.txt +8 -0
- package/package.json +15 -6
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import 'svelte/internal/disclose-version';
|
|
2
2
|
import * as $ from 'svelte/internal/client';
|
|
3
|
+
import { contentLineGap } from "../logic/content-line.js";
|
|
4
|
+
import { useLocale } from "../i18n/locale.js";
|
|
3
5
|
import { Button } from "../index.js";
|
|
4
6
|
import { ComponentIcon } from "../internal/component-icon/index.js";
|
|
5
7
|
import { Frame, resizeManager } from "../index.js";
|
|
@@ -9,6 +11,7 @@ var rest_excludes = new Set([
|
|
|
9
11
|
'$$events',
|
|
10
12
|
'$$legacy',
|
|
11
13
|
'variant',
|
|
14
|
+
'gap',
|
|
12
15
|
'value',
|
|
13
16
|
'placeholder',
|
|
14
17
|
'open',
|
|
@@ -23,6 +26,7 @@ var rest_excludes = new Set([
|
|
|
23
26
|
'onClear',
|
|
24
27
|
'onclick',
|
|
25
28
|
'onkeydown',
|
|
29
|
+
'enableAutoLayout',
|
|
26
30
|
'enableResponsive',
|
|
27
31
|
'enableContext',
|
|
28
32
|
'enableScaleObserver',
|
|
@@ -36,7 +40,7 @@ var root = $.from_html(`<!> <span> </span> <!> <!>`, 1);
|
|
|
36
40
|
|
|
37
41
|
const $$css = {
|
|
38
42
|
hash: 'svelte-1l1hf0x',
|
|
39
|
-
code: '\n /* ─── 根节点变量与视觉 ─────────────────────────────────────\n * 布局(grid-template-columns / 槽位落列)由 auto-layout.css 接管,\n * 组件层不重复声明,只负责视觉与 token. */:where(.snowui-search-box) {--snowui-search-box-padding-y: var(--padding-1);--snowui-search-box-padding-x: var(--padding-2);--snowui-search-box-gap: var(--gap-2);--snowui-search-box-radius: var(--radius-4);--snowui-search-box-font-size: var(--text-14);--snowui-search-box-line-height: var(--leading-14);--snowui-search-box-background: var(--black-4, #0000000a);--snowui-search-box-border-color: transparent;--snowui-search-box-hover-border-color: transparent;\n /* StyleSpec §2.4.2: --black-4 / --surface-1 等浅色背景 hover-opacity 4% */--snowui-search-box-hover-opacity: 4%;--snowui-hover-overlay-opacity: 0%;\n /* placeholder 文本色:对齐 Input 的 --snowui-input-placeholder-color */--snowui-search-box-placeholder-color: var(--black-20, #00000033);\n /* 默认搜索图标色:静止 Black/20%,hover 加深到 Black/40% */--snowui-search-box-icon-color: var(--black-20, #00000033);--snowui-search-box-icon-hover-color: var(--black-40, #00000066);--snowui-search-box-trailing-color: var(--black-20, #00000033);width:var(--snowui-search-box-width-override, auto);min-width:0;flex-wrap:nowrap;padding:var(\n --snowui-search-box-padding-override,\n var(--snowui-search-box-padding-y)\n var(--snowui-search-box-padding-x)\n );gap:var(
|
|
43
|
+
code: '\n /* ─── 根节点变量与视觉 ─────────────────────────────────────\n * 布局(grid-template-columns / 槽位落列)由 auto-layout.css 接管,\n * 组件层不重复声明,只负责视觉与 token. */:where(.snowui-search-box) {--snowui-search-box-padding-y: var(--padding-1);--snowui-search-box-padding-x: var(--padding-2);--snowui-search-box-gap: var(--gap-2);--snowui-search-box-radius: var(--radius-4);--snowui-search-box-font-size: var(--text-14);--snowui-search-box-line-height: var(--leading-14);--snowui-search-box-background: var(--black-4, #0000000a);--snowui-search-box-border-color: transparent;--snowui-search-box-hover-border-color: transparent;\n /* StyleSpec §2.4.2: --black-4 / --surface-1 等浅色背景 hover-opacity 4% */--snowui-search-box-hover-opacity: 4%;--snowui-hover-overlay-opacity: 0%;\n /* placeholder 文本色:对齐 Input 的 --snowui-input-placeholder-color */--snowui-search-box-placeholder-color: var(--black-20, #00000033);\n /* 默认搜索图标色:静止 Black/20%,hover 加深到 Black/40% */--snowui-search-box-icon-color: var(--black-20, #00000033);--snowui-search-box-icon-hover-color: var(--black-40, #00000066);--snowui-search-box-trailing-color: var(--black-20, #00000033);width:var(--snowui-search-box-width-override, auto);min-width:0;flex-wrap:nowrap;padding:var(\n --snowui-search-box-padding-override,\n var(--snowui-search-box-padding-y)\n var(--snowui-search-box-padding-x)\n );gap:max(4px, var(--snowui-search-box-gap-override, var(--snowui-search-box-gap)));border-radius:var(\n --snowui-search-box-radius-override,\n var(--snowui-search-box-radius)\n );background-color:var(\n --snowui-search-box-background-override,\n var(--snowui-search-box-background)\n );backdrop-filter:blur(\n var(--snowui-search-box-background-blur-override, 1.25rem)\n );-webkit-backdrop-filter:blur(\n var(--snowui-search-box-background-blur-override, 1.25rem)\n );\n /* StyleSpec §2.4.1 显式渐变 hover overlay 自行声明 */background-image:linear-gradient(\n color-mix(\n in srgb,\n currentColor var(--snowui-hover-overlay-opacity),\n transparent\n ),\n color-mix(\n in srgb,\n currentColor var(--snowui-hover-overlay-opacity),\n transparent\n )\n );color:inherit;font-size:var(\n --snowui-search-box-font-size-override,\n var(--snowui-search-box-font-size)\n );line-height:var(\n --snowui-search-box-line-height-override,\n var(--snowui-search-box-line-height)\n );cursor:var(--snowui-field-cursor, pointer);box-sizing:border-box;user-select:none;overflow:hidden;--snowui-field-cursor: pointer;--snowui-field-border-color: var(--snowui-search-box-border-color);--snowui-field-hover-border-color: var(\n --snowui-search-box-hover-border-color\n );\n /* SearchBox 不需要焦点态:让 field-bordered 的 focus-within 视觉与静止态一致 */--snowui-field-focus-border-color: var(\n --snowui-search-box-border-color\n );--snowui-field-focus-ring-width: 0;--snowui-field-focus-ring-color: transparent;\n /* StyleSpec §2.4.7: hover overlay 必须显式过渡 --snowui-hover-overlay-opacity */transition:--snowui-hover-overlay-opacity\n var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out),\n background-color\n var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out),\n color var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}\n :where(\n .snowui-search-box[data-responsive-collapse="icon"]\n )\n {grid-template-columns:auto;justify-content:center;min-width:max-content;gap:0;}\n :where(\n .snowui-search-box[data-responsive-collapse="icon"]\n > :not([data-as="leading"])\n )\n {display:none;}\n :where(\n .snowui-search-box[data-responsive-collapse="icon"]\n > [data-as="leading"]\n )\n {grid-column:1;grid-row:1;justify-self:center;}\n\n /* outline 变体:透明底 + 可见边框,hover 时边框加深(参 Button outline) */:where(.snowui-search-box[data-variant="outline"]) {--snowui-search-box-background: var(--surface-1, #ffffffcc);--snowui-search-box-border-color: var(--black-20, #00000033);--snowui-search-box-hover-border-color: var(--black-40, #00000066);}\n\n /* SearchBox 是搜索浮层触发器,不显示焦点外圈;Esc 等键盘操作不应恢复全局 focus-visible outline。 */:where(.snowui-search-box:focus, .snowui-search-box:focus-visible) {outline:none;}\n\n /* hover:激活渐变 overlay(适用所有 variant);disabled 排除 */\n :where(.snowui-search-box):hover:not([data-disabled="true"])\n {--snowui-hover-overlay-opacity: var(\n --snowui-search-box-hover-opacity\n );}\n\n /* Dark mode:浅色背景 hover-opacity 提升到 10%(StyleSpec §2.4.2) */\n :where([theme="dark"]) :where(.snowui-search-box)\n {--snowui-search-box-hover-opacity: 10%;}:where(.snowui-search-box[data-disabled="true"]) {pointer-events:none;}\n\n /* ─── Content(占位/文本)截断 ─────────────────────────── */:where(.snowui-search-box-content) {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}:where(.snowui-search-box-placeholder) {color:var(\n --snowui-search-box-placeholder-color-override,\n var(--snowui-search-box-placeholder-color)\n );}\n\n /* ─── 默认搜索图标:静止 Black/20%、hover Black/40%、外部 leading 隐藏 ─── */:where(.snowui-search-box-default-icon) {color:var(\n --snowui-search-box-icon-color-override,\n var(--snowui-search-box-icon-color)\n );transition:color var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}\n\n /* ComponentIcon 直出图标元素;hover / has-value 仍用后代选择器。 */\n .snowui-search-box:hover:not([data-disabled="true"])\n .snowui-search-box-default-icon,\n .snowui-search-box[data-has-value="true"]\n .snowui-search-box-default-icon\n {color:var(\n --snowui-search-box-icon-hover-color-override,\n var(--snowui-search-box-icon-hover-color)\n );}\n\n /* LayoutProtocol §4.1.5: 外置 leading 存在时隐藏直系默认 Search。 */\n :where(.snowui-search-box):has(\n > [data-as="leading"] ~ [data-as="leading"]\n )\n > .snowui-search-box-default-icon[data-as="leading"]\n {display:none;}\n\n /* 外置 trailing 默认使用 Black/20%;内建清除 X 保留共享按钮颜色。 */\n :where(\n .snowui-search-box\n > [data-as="trailing"]:not(\n .snowui-search-box-clear-btn\n )\n )\n {color:var(--snowui-search-box-trailing-color);}\n\n /* ─── Clear (X) 按钮 ─────────────────────────────────────────\n * 视觉/交互复用 Button bare。\n * 此处仅保留 SearchBox 专属的默认隐藏;focus-within 显示规则在下方。\n * grid 落列由 auto-layout.css 通过 [data-as="trailing"] 接管。 */:where(.snowui-search-box-clear-btn) {display:none;}\n\n /* 有值 + focus-within → 显示 X */\n .snowui-search-box[data-has-value="true"]:focus-within\n .snowui-search-box-clear-btn\n {display:inline-flex;}\n\n /* X 可见时隐藏外置 trailing(如 Kbd),与 Input 一致 */\n .snowui-search-box[data-has-value="true"]:focus-within\n > [data-as="trailing"]:not(.snowui-search-box-clear-btn)\n {display:none;}'
|
|
40
44
|
};
|
|
41
45
|
|
|
42
46
|
export default function SearchBox($$anchor, $$props) {
|
|
@@ -44,10 +48,13 @@ export default function SearchBox($$anchor, $$props) {
|
|
|
44
48
|
$.append_styles($$anchor, $$css);
|
|
45
49
|
|
|
46
50
|
// SnowUI 许可入口:首次阅读源码请先读 ../../LICENSE;访问文件不代表获得修改或移植权,官方维护授权及同任务去重见该文件。
|
|
51
|
+
const localeContext = useLocale();
|
|
52
|
+
|
|
47
53
|
/** 内置图标按钮配置;事件与角色由所属组件控制。 */
|
|
48
54
|
let variant = $.prop($$props, 'variant', 3, "gray"),
|
|
55
|
+
gap = $.prop($$props, 'gap', 3, undefined),
|
|
49
56
|
value = $.prop($$props, 'value', 15),
|
|
50
|
-
placeholder = $.prop($$props, 'placeholder', 3,
|
|
57
|
+
placeholder = $.prop($$props, 'placeholder', 3, undefined),
|
|
51
58
|
open = $.prop($$props, 'open', 15, false),
|
|
52
59
|
disabled = $.prop($$props, 'disabled', 3, false),
|
|
53
60
|
readonly = $.prop($$props, 'readonly', 3, false),
|
|
@@ -59,6 +66,7 @@ export default function SearchBox($$anchor, $$props) {
|
|
|
59
66
|
onClear = $.prop($$props, 'onClear', 3, undefined),
|
|
60
67
|
userOnClick = $.prop($$props, 'onclick', 3, undefined),
|
|
61
68
|
userOnKeyDown = $.prop($$props, 'onkeydown', 3, undefined),
|
|
69
|
+
enableAutoLayout = $.prop($$props, 'enableAutoLayout', 3, true),
|
|
62
70
|
enableResponsive = $.prop($$props, 'enableResponsive', 3, false),
|
|
63
71
|
enableContext = $.prop($$props, 'enableContext', 3, true),
|
|
64
72
|
enableScaleObserver = $.prop($$props, 'enableScaleObserver', 3, false),
|
|
@@ -68,8 +76,20 @@ export default function SearchBox($$anchor, $$props) {
|
|
|
68
76
|
element = $.prop($$props, 'element', 15),
|
|
69
77
|
rest = $.rest_props($$props, rest_excludes);
|
|
70
78
|
|
|
79
|
+
const internalAutoLayout = $.derived(() => enableAutoLayout() === false ? true : enableAutoLayout());
|
|
80
|
+
|
|
81
|
+
const rootStyle = $.derived(() => [
|
|
82
|
+
gap() !== undefined
|
|
83
|
+
? `--snowui-search-box-gap-override: ${contentLineGap(gap())}`
|
|
84
|
+
: "",
|
|
85
|
+
userStyle()
|
|
86
|
+
].filter(Boolean).join("; ") || undefined);
|
|
87
|
+
|
|
71
88
|
const hasValue = $.derived(() => value() !== undefined && value() !== null && String(value()) !== "");
|
|
72
|
-
|
|
89
|
+
|
|
90
|
+
const displayText = $.derived(() => $.get(hasValue)
|
|
91
|
+
? String(value())
|
|
92
|
+
: placeholder() ?? localeContext.t("searchBox.placeholder"));
|
|
73
93
|
|
|
74
94
|
const searchBoxRenderHints = $.derived(() => ({
|
|
75
95
|
variant: userRenderHints()?.variant ?? "line",
|
|
@@ -156,8 +176,6 @@ export default function SearchBox($$anchor, $$props) {
|
|
|
156
176
|
userClass()
|
|
157
177
|
].filter(Boolean).join(" "));
|
|
158
178
|
|
|
159
|
-
let $9 = $.derived(() => userStyle() || undefined);
|
|
160
|
-
|
|
161
179
|
Frame($$anchor, $.spread_props(
|
|
162
180
|
{
|
|
163
181
|
tag: 'div',
|
|
@@ -207,7 +225,7 @@ export default function SearchBox($$anchor, $$props) {
|
|
|
207
225
|
},
|
|
208
226
|
|
|
209
227
|
get style() {
|
|
210
|
-
return $.get(
|
|
228
|
+
return $.get(rootStyle);
|
|
211
229
|
},
|
|
212
230
|
|
|
213
231
|
get enableResponsive() {
|
|
@@ -230,6 +248,10 @@ export default function SearchBox($$anchor, $$props) {
|
|
|
230
248
|
},
|
|
231
249
|
() => rest,
|
|
232
250
|
{
|
|
251
|
+
get enableAutoLayout() {
|
|
252
|
+
return $.get(internalAutoLayout);
|
|
253
|
+
},
|
|
254
|
+
singleLine: true,
|
|
233
255
|
get element() {
|
|
234
256
|
return element();
|
|
235
257
|
},
|
|
@@ -273,6 +295,7 @@ export default function SearchBox($$anchor, $$props) {
|
|
|
273
295
|
var consequent_1 = ($$anchor) => {
|
|
274
296
|
{
|
|
275
297
|
let $0 = $.derived(() => `snowui-clear-icon-btn snowui-search-box-clear-btn${parts()?.Button?.class ? ` ${parts().Button.class}` : ""}`);
|
|
298
|
+
let $1 = $.derived(() => localeContext.t("searchBox.clear"));
|
|
276
299
|
|
|
277
300
|
Button($$anchor, $.spread_props({ bare: true, emphasis: 'muted', size: 'sm' }, () => parts()?.Button, {
|
|
278
301
|
type: 'button',
|
|
@@ -280,7 +303,9 @@ export default function SearchBox($$anchor, $$props) {
|
|
|
280
303
|
return $.get($0);
|
|
281
304
|
},
|
|
282
305
|
as: 'trailing',
|
|
283
|
-
'aria-label'
|
|
306
|
+
get 'aria-label'() {
|
|
307
|
+
return $.get($1);
|
|
308
|
+
},
|
|
284
309
|
onclick: handleClear,
|
|
285
310
|
onmousedown: (event) => event.preventDefault(),
|
|
286
311
|
tabindex: -1,
|
|
@@ -10,7 +10,7 @@ var root = $.from_html(`<!> <!>`, 1);
|
|
|
10
10
|
|
|
11
11
|
const $$css = {
|
|
12
12
|
hash: 'svelte-1623ob8',
|
|
13
|
-
code: '\n .snowui-frame.snowui-input.snowui-search-input.snowui-search-input-responsive-icon:not(\n :focus-within\n ):not(
|
|
13
|
+
code: '\n .snowui-frame.snowui-input.snowui-search-input.snowui-search-input-responsive-icon:not(\n :focus-within\n ):not([data-has-content="true"])\n {display:grid;grid-template-columns:minmax(0, 1fr);justify-items:center;min-width:max-content;gap:0;}\n :where(\n .snowui-input.snowui-search-input-responsive-icon:not(\n :focus-within\n ):not([data-has-content="true"])\n > [data-as="leading"]\n )\n {grid-column:1;grid-row:1;justify-self:center;}\n\n /* 原生 input 覆盖整个 icon-only 命中区:视觉收敛但仍可直接聚焦,\n focus-within 后自动回到 Input 的标准三槽位布局。 */\n :where(\n .snowui-input.snowui-search-input-responsive-icon:not(\n :focus-within\n ):not([data-has-content="true"])\n > .snowui-input-control\n )\n {position:absolute;inset:0;z-index:1;width:100%;height:100%;padding:0;opacity:0;cursor:text;}\n :where(\n .snowui-input.snowui-search-input-responsive-icon:not(\n :focus-within\n ):not([data-has-content="true"])\n > :not([data-as="leading"]):not(\n .snowui-input-control\n )\n )\n {display:none;}:where(.snowui-input.snowui-search-input-borderless) {--snowui-field-border-width: 0rem;--snowui-field-focus-ring-width: 0rem;--snowui-input-background-override: transparent;flex:1 1 0;width:auto;max-width:100%;min-width:0;align-content:center;}\n\n /* Borderless SearchInput is commonly used in intrinsic/shrink-to-fit\n layouts. Keep the clear button in layout while visually hidden so its\n appearance cannot change the component width. */:where(.snowui-input.snowui-search-input-borderless) .snowui-input-clear-btn {display:inline-flex;visibility:hidden;pointer-events:none;}:where(.snowui-input.snowui-search-input-borderless:focus-within:has(> input:not(:placeholder-shown))) .snowui-input-clear-btn {visibility:visible;pointer-events:auto;}\n\n /* 保留三列对 shrink-to-fit 宽度的贡献,同时让有值时的 control\n 延伸到预留的 gap + X 列下方,恢复 Input 原有的贴近/渐隐效果。 */\n :where(\n .snowui-input.snowui-search-input-borderless:focus-within:has(\n > .snowui-input-control:not(:placeholder-shown)\n ):has(> .snowui-input-clear-btn)\n > .snowui-input-control\n )\n {width:calc(\n 100% +\n var(--snowui-input-gap-resolved) +\n var(--snowui-search-input-clear-width, var(--snowui-clear-icon-size-override, 1rem))\n );}\n\n /* SearchInput 专属默认 Search 颜色;只影响内置图标,不影响通用 Icon 或外置 leading。 */\n :where(.snowui-input.snowui-search-input)\n .snowui-search-input-default-icon\n {color:var(\n --snowui-search-input-icon-color,\n var(--black-20, #00000033)\n );}\n :where(.snowui-input.snowui-search-input):focus-within\n .snowui-search-input-default-icon\n {color:var(\n --snowui-search-input-active-icon-color,\n var(--black-40, #00000066)\n );}\n\n /* LayoutProtocol §4.1.5: 外置 leading 存在时隐藏直系默认 Search。 */\n :where(.snowui-input.snowui-search-input):has(\n > [data-as="leading"] ~ [data-as="leading"]\n )\n > .snowui-search-input-default-icon[data-as="leading"]\n {display:none;}'
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export default function SearchInput($$anchor, $$props) {
|
|
@@ -45,14 +45,48 @@ export default function SearchInput($$anchor, $$props) {
|
|
|
45
45
|
]));
|
|
46
46
|
|
|
47
47
|
let responsiveIcon = $.state(false);
|
|
48
|
-
|
|
48
|
+
let clearControlWidth = $.state(void 0);
|
|
49
|
+
|
|
50
|
+
const searchRootStyle = $.derived(() => [
|
|
51
|
+
$.get(clearControlWidth) !== undefined
|
|
52
|
+
? `--snowui-search-input-clear-width: ${$.get(clearControlWidth)}px`
|
|
53
|
+
: "",
|
|
54
|
+
$.get(rest).style
|
|
55
|
+
].filter(Boolean).join("; ") || undefined);
|
|
49
56
|
|
|
50
57
|
$.user_effect(() => {
|
|
51
58
|
const node = element();
|
|
52
59
|
const threshold = $.get(collapseBelow);
|
|
60
|
+
const currentVariant = $.get(variant);
|
|
61
|
+
|
|
62
|
+
// 默认外观不登记额外尺寸订阅;仅 borderless 预留列需要真实按钮宽度。
|
|
63
|
+
$.get(rest).clearable;
|
|
64
|
+
|
|
65
|
+
$.get(rest).disabled;
|
|
66
|
+
$.get(rest).readonly;
|
|
53
67
|
|
|
54
68
|
if (!node) return;
|
|
55
69
|
|
|
70
|
+
const clearControl = currentVariant === "borderless"
|
|
71
|
+
? node.querySelector(":scope > .snowui-input-clear-btn")
|
|
72
|
+
: null;
|
|
73
|
+
|
|
74
|
+
const updateClearWidth = (entry) => {
|
|
75
|
+
$.set(
|
|
76
|
+
clearControlWidth,
|
|
77
|
+
clearControl
|
|
78
|
+
? entry?.borderBoxSize?.[0]?.inlineSize ?? clearControl.offsetWidth
|
|
79
|
+
: undefined,
|
|
80
|
+
true
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
updateClearWidth();
|
|
85
|
+
|
|
86
|
+
const stopClear = clearControl
|
|
87
|
+
? resizeManager.watch(clearControl, updateClearWidth)
|
|
88
|
+
: undefined;
|
|
89
|
+
|
|
56
90
|
const update = (width) => {
|
|
57
91
|
if (typeof threshold === "number" && threshold > 0 && width <= threshold) {
|
|
58
92
|
$.set(responsiveIcon, true);
|
|
@@ -67,12 +101,14 @@ export default function SearchInput($$anchor, $$props) {
|
|
|
67
101
|
|
|
68
102
|
return () => {
|
|
69
103
|
unwatch();
|
|
104
|
+
stopClear?.();
|
|
105
|
+
$.set(clearControlWidth, undefined);
|
|
70
106
|
$.set(responsiveIcon, false);
|
|
71
107
|
};
|
|
72
108
|
});
|
|
73
109
|
|
|
74
110
|
{
|
|
75
|
-
let $0 = $.derived(() => `snowui-search-input snowui-search-input-${$.get(variant)}${$.get(responsiveIcon) ? " snowui-search-input-responsive-icon" : ""}${$.get(
|
|
111
|
+
let $0 = $.derived(() => `snowui-search-input snowui-search-input-${$.get(variant)}${$.get(responsiveIcon) ? " snowui-search-input-responsive-icon" : ""}${$.get(userClass) ? ` ${$.get(userClass)}` : ""}`);
|
|
76
112
|
|
|
77
113
|
Input($$anchor, $.spread_props(
|
|
78
114
|
{
|
|
@@ -94,6 +130,10 @@ export default function SearchInput($$anchor, $$props) {
|
|
|
94
130
|
},
|
|
95
131
|
() => $.get(rest),
|
|
96
132
|
{
|
|
133
|
+
get style() {
|
|
134
|
+
return $.get(searchRootStyle);
|
|
135
|
+
},
|
|
136
|
+
|
|
97
137
|
get value() {
|
|
98
138
|
return value();
|
|
99
139
|
},
|
|
@@ -10,9 +10,11 @@ import MenuItem from "./MenuItem.js";
|
|
|
10
10
|
import { getField } from "../context.js";
|
|
11
11
|
import { LISTBOX_OWNER_CONTEXT_KEY } from "../keys.js";
|
|
12
12
|
import { resolveFrameFieldInvalid, resolveFrameFieldValue } from "../logic/frame-field-control.js";
|
|
13
|
+
import { contentLineGap } from "../logic/content-line.js";
|
|
13
14
|
import { splitFrameHostProps } from "../logic/frame-prop-filter.js";
|
|
14
15
|
import { matchesSearch } from "../lib/search-filter.js";
|
|
15
16
|
import { mergeComponentPartProps, useComponentPart } from "../logic/component-parts.js";
|
|
17
|
+
import ComponentPartsBoundary from "../logic/ComponentPartsBoundary.js";
|
|
16
18
|
|
|
17
19
|
var rest_excludes = new Set(['$$slots', '$$events', '$$legacy', 'value']);
|
|
18
20
|
var root = $.from_html(`<input type="hidden"/>`);
|
|
@@ -21,7 +23,7 @@ var root_2 = $.from_html(`<!> <!> <!> <!>`, 1);
|
|
|
21
23
|
|
|
22
24
|
const $$css = {
|
|
23
25
|
hash: 'svelte-124sfg',
|
|
24
|
-
code: '\n /* ── 宿主容器 ── */:where(.snowui-select) {position:relative;flex-wrap:nowrap;--snowui-select-width: 100%;--snowui-select-height: auto;--snowui-select-radius: var(--radius-4);--snowui-select-background: var(--surface-1, #ffffffcc);--snowui-select-padding-y: var(--padding-3); /* 12px */--snowui-select-padding-x: var(--padding-4); /* 16px */--snowui-select-gap: var(--gap-2);--snowui-select-font-size: var(--text-14);--snowui-select-line-height: var(--leading-14);--snowui-select-placeholder-color: var(--black-20, #00000033);--snowui-select-indicator-color: var(--black-100, #000000ff);--snowui-select-indicator-size: var(--size-4);width:var(--snowui-select-width-override, var(--snowui-select-width));height:var(--snowui-select-height-override, var(--snowui-select-height));min-width:0;gap:var(--snowui-select-gap-
|
|
26
|
+
code: '\n /* ── 宿主容器 ── */:where(.snowui-select) {position:relative;flex-wrap:nowrap;--snowui-select-width: 100%;--snowui-select-height: auto;--snowui-select-radius: var(--radius-4);--snowui-select-background: var(--surface-1, #ffffffcc);--snowui-select-padding-y: var(--padding-3); /* 12px */--snowui-select-padding-x: var(--padding-4); /* 16px */--snowui-select-gap: var(--gap-2);--snowui-select-gap-resolved: max(4px, var(--snowui-select-gap-override, var(--snowui-select-gap)));--snowui-select-font-size: var(--text-14);--snowui-select-line-height: var(--leading-14);--snowui-select-placeholder-color: var(--black-20, #00000033);--snowui-select-indicator-color: var(--black-100, #000000ff);--snowui-select-indicator-size: var(--size-4);width:var(--snowui-select-width-override, var(--snowui-select-width));height:var(--snowui-select-height-override, var(--snowui-select-height));min-width:0;gap:var(--snowui-select-gap-resolved);padding:var(--snowui-select-padding-y) var(--snowui-select-padding-x);border-radius:var(--snowui-select-radius-override, var(--snowui-select-radius));background-color:var(--snowui-select-background-override, var(--snowui-select-background));font-size:var(--snowui-select-font-size-override, var(--snowui-select-font-size));line-height:var(--snowui-select-line-height-override, var(--snowui-select-line-height));box-sizing:border-box;}:where(.snowui-select:has(> .snowui-select-button-trigger)) {width:auto;height:auto;padding:0;gap:0;overflow:visible;border:0;background:transparent;box-shadow:none;}\n\n /* 嵌入态(非 segment):Field 接管外壳 */:where(.snowui-select[data-embedded="true"]:not([data-as="segment"])) {padding:var(--snowui-select-padding-override, 0);gap:var(--snowui-select-gap-resolved);border-radius:0;background-color:transparent;overflow:visible;}\n\n /* segment 嵌入态:保留自身 padding(Field 通过 CSS 变量注入值) */:where(.snowui-select[data-embedded="true"][data-as="segment"]) {padding:var(--snowui-select-padding-override, var(--snowui-select-padding-y) var(--snowui-select-padding-x));border-radius:0;background-color:transparent;}\n\n /* 错误态 */:where(.snowui-select[data-invalid="true"]:not([data-embedded="true"])) {--snowui-field-border-color: var(--secondary-red, #ff4747ff);--snowui-field-hover-border-color: var(--secondary-red, #ff4747ff);--snowui-field-focus-border-color: var(--secondary-red, #ff4747ff);}\n\n /*\n * Select 暂时不显示 Field 通用焦点外环,只保留内边框焦点态。\n * 如需恢复外环,删除当前单行 box-shadow,并启用下方被注释的完整 box-shadow。\n */:where(.snowui-select:focus-within:not([data-embedded="true"]):not(:has(> .snowui-select-button-trigger))) {box-shadow:inset 0 0 0 var(--snowui-field-border-width, 0.03125rem) var(--snowui-field-focus-border-color, var(--black-40, #00000066));\n /*\n box-shadow:\n inset 0 0 0 var(--snowui-field-border-width, 0.03125rem) var(--snowui-field-focus-border-color, var(--black-40, #00000066)),\n 0 0 0 var(--snowui-field-focus-ring-width, 0.25rem) var(--snowui-field-focus-ring-color, var(--black-4, #0000000a));\n */}\n\n /* 禁用态 */:where(.snowui-select.snowui-disabled:not([data-embedded="true"])),\n :where(.snowui-select:not([data-embedded="true"]):has(.snowui-select-trigger:disabled)) {pointer-events:none;}\n\n /* 只读态背景 */:where(.snowui-select[data-readonly="true"]:not([data-embedded="true"])) {background-color:var(--surface-2, #00000008);}:where(.snowui-select[data-readonly="true"] .snowui-select-trigger) {pointer-events:none;cursor:default;}\n\n /* 骨架屏:确保在 flex row 容器内横向展开 */:where(.snowui-select > .snowui-skeleton-layout) {flex:1 1 auto;min-width:0;}\n\n /* 根级三槽位:leading / trigger(content) / trailing */:where(.snowui-select > [data-as="leading"]),\n :where(.snowui-select > [data-as="trailing"]:not(.snowui-select-indicator):not(:has(.snowui-select-indicator))) {display:inline-flex;align-items:inherit;justify-content:center;gap:var(--snowui-select-gap-resolved);min-width:0;white-space:nowrap;}:where(.snowui-select:has(> [data-as="trailing"]:not(.snowui-select-indicator):not(:has(.snowui-select-indicator))) > .snowui-select-indicator) {display:none;}\n\n /* ── Trigger button ── */:where(.snowui-select-trigger) {display:block;width:100%;min-width:0;min-height:var(--snowui-select-line-height-override, var(--snowui-select-line-height));padding:0;border:0;outline:none;background:transparent;color:inherit;font-size:inherit;line-height:inherit;text-align:left;cursor:pointer;box-sizing:border-box;}:where(.snowui-select:has(> [data-as]) > .snowui-select-trigger) {grid-row:1;min-width:0;}:where(.snowui-select:has(> [data-as="leading"]) > .snowui-select-trigger) {grid-column:2;}:where(.snowui-select:not(:has(> [data-as="leading"])):has(> [data-as="trailing"]) > .snowui-select-trigger) {grid-column:1;}:where(.snowui-select-trigger:focus) {outline:none;}:where(.snowui-select-trigger:disabled) {cursor:not-allowed;}\n\n /* ── Value 显示文本 ── */:where(.snowui-select-value) {display:block;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:inherit;}\n\n /* placeholder 状态 */:where(.snowui-select[data-placeholder-visible="true"] .snowui-select-value) {color:var(--snowui-select-placeholder-color-override, var(--snowui-select-placeholder-color));}\n\n /* ── 指示器图标 ── */:where(.snowui-select-indicator) {display:flex;align-items:center;justify-content:center;align-self:auto;width:var(--snowui-select-indicator-size-override, var(--snowui-select-indicator-size));height:var(--snowui-select-indicator-size-override, var(--snowui-select-indicator-size));min-width:var(--snowui-select-indicator-size-override, var(--snowui-select-indicator-size));min-height:var(--snowui-select-indicator-size-override, var(--snowui-select-indicator-size));color:var(--snowui-select-indicator-color-override, var(--snowui-select-indicator-color));opacity:var(--snowui-state-opacity, 0.4);cursor:pointer;flex-shrink:0;transition:transform\n var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out),\n color\n var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out),\n opacity\n var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}:where(.snowui-select-indicator:hover),\n :where(.snowui-select:hover .snowui-select-indicator) {opacity:var(--snowui-state-opacity, 1);}'
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
export default function Select($$anchor, $$props) {
|
|
@@ -75,6 +77,7 @@ export default function Select($$anchor, $$props) {
|
|
|
75
77
|
enableScaleObserver = $.derived(() => $.fallback($.get($$d).enableScaleObserver, false)),
|
|
76
78
|
userClass = $.derived(() => $.fallback($.get($$d).class, "")),
|
|
77
79
|
userStyle = $.derived(() => $.fallback($.get($$d).style, "")),
|
|
80
|
+
gap = $.derived(() => $.fallback($.get($$d).gap, undefined)),
|
|
78
81
|
userRenderHints = $.derived(() => $.fallback($.get($$d).renderHints, undefined)),
|
|
79
82
|
rest = $.derived(() => $.exclude_from_object($.get($$d), [
|
|
80
83
|
'defaultValue',
|
|
@@ -111,9 +114,17 @@ export default function Select($$anchor, $$props) {
|
|
|
111
114
|
'enableScaleObserver',
|
|
112
115
|
'class',
|
|
113
116
|
'style',
|
|
117
|
+
'gap',
|
|
114
118
|
'renderHints'
|
|
115
119
|
]));
|
|
116
120
|
|
|
121
|
+
const selectRootStyle = $.derived(() => [
|
|
122
|
+
$.get(gap) !== undefined
|
|
123
|
+
? `--snowui-select-gap-override: ${contentLineGap($.get(gap))}`
|
|
124
|
+
: "",
|
|
125
|
+
$.get(userStyle)
|
|
126
|
+
].filter(Boolean).join("; ") || undefined);
|
|
127
|
+
|
|
117
128
|
const splitProps = $.derived(() => splitFrameHostProps($.get(rest)));
|
|
118
129
|
const frameRestProps = $.derived(() => $.get(splitProps).frameProps);
|
|
119
130
|
const internalAutoLayout = $.derived(() => $.get(enableAutoLayout) === false ? true : $.get(enableAutoLayout));
|
|
@@ -153,6 +164,16 @@ export default function Select($$anchor, $$props) {
|
|
|
153
164
|
// 通过 MenuItem 注册收集的选项
|
|
154
165
|
let registeredOptions = $.state($.proxy([]));
|
|
155
166
|
|
|
167
|
+
// options 模式以调用方当前数据为准;MenuItem 的注册只发生在挂载时,
|
|
168
|
+
// 同一 value 的标签随语言或业务状态更新时不能继续使用旧注册快照。
|
|
169
|
+
const availableOptions = $.derived(() => $.get(children)
|
|
170
|
+
? $.get(registeredOptions)
|
|
171
|
+
: $.get(options).map((option) => ({
|
|
172
|
+
value: option.value,
|
|
173
|
+
label: option.label,
|
|
174
|
+
disabled: option.disabled ?? false
|
|
175
|
+
})));
|
|
176
|
+
|
|
156
177
|
// 搜索过滤状态
|
|
157
178
|
let filterText = $.state("");
|
|
158
179
|
|
|
@@ -165,15 +186,15 @@ export default function Select($$anchor, $$props) {
|
|
|
165
186
|
// 自定义项始终显示(不参与过滤,由 MenuItem 自身判断)
|
|
166
187
|
// 匹配策略由 src/lib/search-filter.ts 的 matchesSearch 统一处理
|
|
167
188
|
const filteredOptions = $.derived(() => {
|
|
168
|
-
if (!$.get(filterText)) return $.get(
|
|
189
|
+
if (!$.get(filterText)) return $.get(availableOptions);
|
|
169
190
|
|
|
170
|
-
return $.get(
|
|
191
|
+
return $.get(availableOptions).filter((o) => matchesSearch(o.label, $.get(filterText)));
|
|
171
192
|
});
|
|
172
193
|
|
|
173
194
|
// 派生显示值
|
|
174
195
|
const hasValue = $.derived(() => $.get(resolvedValueStr) !== undefined && $.get(resolvedValueStr) !== "");
|
|
175
196
|
|
|
176
|
-
const selectedOption = $.derived(() => $.get(
|
|
197
|
+
const selectedOption = $.derived(() => $.get(availableOptions).find((o) => o.value === $.get(resolvedValueStr)) ?? $.get(customOptions).find((o) => o.value === $.get(resolvedValueStr)));
|
|
177
198
|
const selectedLabel = $.derived(() => $.get(selectedOption)?.label ?? ($.get(hasValue) ? $.get(resolvedValueStr) : undefined));
|
|
178
199
|
const isPlaceholderVisible = $.derived(() => !$.get(hasValue));
|
|
179
200
|
|
|
@@ -233,7 +254,9 @@ export default function Select($$anchor, $$props) {
|
|
|
233
254
|
},
|
|
234
255
|
|
|
235
256
|
get triggerEl() {
|
|
236
|
-
return $.get(buttonTrigger)
|
|
257
|
+
return $.get(buttonTrigger)
|
|
258
|
+
? $.get(selectEl)?.querySelector("button") ?? null
|
|
259
|
+
: $.get(triggerEl) ?? null;
|
|
237
260
|
},
|
|
238
261
|
|
|
239
262
|
get anchorEl() {
|
|
@@ -298,7 +321,7 @@ export default function Select($$anchor, $$props) {
|
|
|
298
321
|
if (!trimmed) return;
|
|
299
322
|
|
|
300
323
|
// 不与已有静态项或自定义项重复
|
|
301
|
-
if ($.get(
|
|
324
|
+
if ($.get(availableOptions).some((o) => o.value === trimmed)) return;
|
|
302
325
|
|
|
303
326
|
if ($.get(customOptions).some((o) => o.value === trimmed)) return;
|
|
304
327
|
|
|
@@ -333,7 +356,7 @@ export default function Select($$anchor, $$props) {
|
|
|
333
356
|
|
|
334
357
|
// 打开 Listbox
|
|
335
358
|
function openListbox() {
|
|
336
|
-
const allOptions = [...$.get(
|
|
359
|
+
const allOptions = [...$.get(availableOptions), ...$.get(customOptions)];
|
|
337
360
|
const idx = allOptions.findIndex((o) => o.value === $.get(resolvedValueStr));
|
|
338
361
|
|
|
339
362
|
$.set(activeIndex, idx >= 0 ? idx : 0, true);
|
|
@@ -438,7 +461,7 @@ export default function Select($$anchor, $$props) {
|
|
|
438
461
|
let $5 = $.derived(() => $.get(isEmbedded) ? "select" : undefined);
|
|
439
462
|
let $6 = $.derived(() => $.get(readonly) ? "true" : undefined);
|
|
440
463
|
let $7 = $.derived(() => $.get(open) ? "true" : undefined);
|
|
441
|
-
let $8 = $.derived(() =>
|
|
464
|
+
let $8 = $.derived(() => !$.get(buttonTrigger));
|
|
442
465
|
|
|
443
466
|
Frame($$anchor, $.spread_props(
|
|
444
467
|
{
|
|
@@ -481,7 +504,7 @@ export default function Select($$anchor, $$props) {
|
|
|
481
504
|
},
|
|
482
505
|
|
|
483
506
|
get style() {
|
|
484
|
-
return $.get(
|
|
507
|
+
return $.get(selectRootStyle);
|
|
485
508
|
},
|
|
486
509
|
|
|
487
510
|
get enableResponsive() {
|
|
@@ -510,6 +533,10 @@ export default function Select($$anchor, $$props) {
|
|
|
510
533
|
},
|
|
511
534
|
() => $.get(frameRestProps),
|
|
512
535
|
{
|
|
536
|
+
get singleLine() {
|
|
537
|
+
return $.get($8);
|
|
538
|
+
},
|
|
539
|
+
|
|
513
540
|
get element() {
|
|
514
541
|
return $.get(selectEl);
|
|
515
542
|
},
|
|
@@ -588,19 +615,24 @@ export default function Select($$anchor, $$props) {
|
|
|
588
615
|
|
|
589
616
|
{
|
|
590
617
|
var consequent_1 = ($$anchor) => {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
618
|
+
ComponentPartsBoundary($$anchor, {
|
|
619
|
+
children: ($$anchor, $$slotProps) => {
|
|
620
|
+
var fragment_5 = $.comment();
|
|
621
|
+
var node_3 = $.first_child(fragment_5);
|
|
622
|
+
|
|
623
|
+
$.snippet(node_3, () => $.get(triggerContent), () => ({
|
|
624
|
+
value: $.get(resolvedValue),
|
|
625
|
+
option: $.get(selectedOption),
|
|
626
|
+
label: $.get(selectedLabel),
|
|
627
|
+
placeholder: $.get(placeholder),
|
|
628
|
+
open: $.get(open),
|
|
629
|
+
disabled: $.get(disabled)
|
|
630
|
+
}));
|
|
631
|
+
|
|
632
|
+
$.append($$anchor, fragment_5);
|
|
633
|
+
},
|
|
634
|
+
$$slots: { default: true }
|
|
635
|
+
});
|
|
604
636
|
};
|
|
605
637
|
|
|
606
638
|
var alternate = ($$anchor) => {
|
|
@@ -635,6 +667,7 @@ export default function Select($$anchor, $$props) {
|
|
|
635
667
|
$.bind_this(button, ($$value) => $.set(triggerEl, $$value), () => $.get(triggerEl));
|
|
636
668
|
|
|
637
669
|
$.template_effect(() => {
|
|
670
|
+
$.set_attribute(button, 'aria-label', $.get(ariaLabel));
|
|
638
671
|
$.set_attribute(button, 'aria-expanded', $.get(open));
|
|
639
672
|
$.set_attribute(button, 'aria-controls', listboxId);
|
|
640
673
|
$.set_attribute(button, 'aria-activedescendant', $.get(open) && $.get(activeIndex) >= 0 ? `${listboxId}-opt-${$.get(activeIndex)}` : undefined);
|
|
@@ -693,11 +726,16 @@ export default function Select($$anchor, $$props) {
|
|
|
693
726
|
|
|
694
727
|
{
|
|
695
728
|
var consequent_4 = ($$anchor) => {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
729
|
+
ComponentPartsBoundary($$anchor, {
|
|
730
|
+
children: ($$anchor, $$slotProps) => {
|
|
731
|
+
var fragment_9 = $.comment();
|
|
732
|
+
var node_6 = $.first_child(fragment_9);
|
|
733
|
+
|
|
734
|
+
$.snippet(node_6, () => $.get(children));
|
|
735
|
+
$.append($$anchor, fragment_9);
|
|
736
|
+
},
|
|
737
|
+
$$slots: { default: true }
|
|
738
|
+
});
|
|
701
739
|
};
|
|
702
740
|
|
|
703
741
|
var alternate_2 = ($$anchor) => {
|