@snowui-design-system/components 0.3.0-alpha.1 → 0.3.0-alpha.11
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
|
@@ -6,6 +6,7 @@ import Tooltip from "./Tooltip.js";
|
|
|
6
6
|
import { resolveSnowUIColor } from "../lib/color.js";
|
|
7
7
|
import { fitTextToElement, measureTextForElement } from "../lib/truncate.js";
|
|
8
8
|
import { TruncationController } from "../logic/frame-truncation.js";
|
|
9
|
+
import ComponentPartsBoundary from "../logic/ComponentPartsBoundary.js";
|
|
9
10
|
|
|
10
11
|
var rest_excludes = new Set([
|
|
11
12
|
'$$slots',
|
|
@@ -43,7 +44,7 @@ var root_4 = $.from_html(`<span class="snowui-link-content"><span class="snowui-
|
|
|
43
44
|
|
|
44
45
|
const $$css = {
|
|
45
46
|
hash: 'svelte-96nnl8',
|
|
46
|
-
code: ':where(.snowui-link) {--snowui-link-font-size: var(--text-14);--snowui-link-line-height: var(--leading-14);--snowui-link-gap:
|
|
47
|
+
code: ':where(.snowui-link) {--snowui-link-font-size: var(--text-14);--snowui-link-line-height: var(--leading-14);--snowui-link-gap: var(--gap-1);--snowui-link-icon-size: var(--size-3);--snowui-link-color: var(--black-40, #00000066);--snowui-link-hover-color: var(--black-100, #000000ff);--snowui-link-decoration-opacity: var(--snowui-state-opacity, 0.4);--snowui-link-decoration-hover-opacity: var(--snowui-state-opacity, 1);color:var(--snowui-link-color-override, var(--snowui-link-color));text-decoration:none;width:fit-content;max-width:100%;gap:max(4px, var(--snowui-link-gap-override, var(--snowui-link-gap)));font-size:var(\n --snowui-link-font-size-override,\n var(--snowui-link-font-size)\n );line-height:var(\n --snowui-link-line-height-override,\n var(--snowui-link-line-height)\n );cursor:var(--snowui-state-cursor, pointer);--snowui-frame-component-transition:\n color var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}:where(.snowui-link)[data-auto-layout] {gap:max(4px, var(--snowui-link-gap-override, var(--snowui-link-gap)));}:where(.snowui-link):hover:not(.snowui-disabled),\n :where(.snowui-link):active:not(.snowui-disabled) {color:var(--snowui-link-hover-color);}:where(.snowui-link):focus-visible {outline:var(--border-1) solid currentColor;outline-offset:var(--border-2);}:where(.snowui-link-content) {min-width:0;max-width:100%;}:where(.snowui-link)[data-lines="1"] > .snowui-link-content {width:var(--snowui-link-truncated-content-width, auto);overflow:hidden;}:where(.snowui-link)[data-lines="1"] {width:fit-content;}:where(.snowui-link-label) {min-width:0;max-width:100%;}:where(.snowui-link-label)[data-lines="1"] {display:grid;grid-template-columns:minmax(0, 1fr);}:where(.snowui-link-label-text) {display:block;min-width:0;max-width:100%;text-decoration-line:none;text-decoration-color:currentColor;}:where(.snowui-link-label)[data-lines="1"] > .snowui-link-label-text {grid-column:1;grid-row:1;overflow:hidden;text-overflow:clip;white-space:nowrap;}:where(.snowui-link-label-measure) {visibility:hidden;}:where(.snowui-link-label-visible) {grid-column:1;grid-row:1;min-width:0;overflow:hidden;white-space:nowrap;}:where(.snowui-link-ellipsis) {text-decoration:none;}:where(.snowui-link)[data-underline="always"] > .snowui-link-content > .snowui-link-label > .snowui-link-label-text,\n :where(.snowui-link)[data-underline="always"] > .snowui-link-content > .snowui-link-label > .snowui-link-label-visible,\n :where(.snowui-link)[data-underline="until-hover"] > .snowui-link-content > .snowui-link-label > .snowui-link-label-text,\n :where(.snowui-link)[data-underline="until-hover"] > .snowui-link-content > .snowui-link-label > .snowui-link-label-visible,\n :where(.snowui-link)[data-underline="hover"]:hover:not(.snowui-disabled) > .snowui-link-content > .snowui-link-label > .snowui-link-label-text,\n :where(.snowui-link)[data-underline="hover"]:hover:not(.snowui-disabled) > .snowui-link-content > .snowui-link-label > .snowui-link-label-visible {text-decoration-line:underline;}:where(.snowui-link)[data-underline="until-hover"]:hover:not(.snowui-disabled) > .snowui-link-content > .snowui-link-label > .snowui-link-label-text,\n :where(.snowui-link)[data-underline="until-hover"]:hover:not(.snowui-disabled) > .snowui-link-content > .snowui-link-label > .snowui-link-label-visible {text-decoration-line:none;}:where(.snowui-link > [data-as="leading"]),\n :where(.snowui-link > [data-as="trailing"]) {display:inline-flex;align-items:inherit;text-decoration:none;}:where(.snowui-link > [data-as="trailing"]:not(.snowui-link-default-trailing)) {color:currentColor;opacity:var(\n --snowui-link-decoration-opacity-override,\n var(--snowui-link-decoration-opacity)\n );text-decoration:none;transition:opacity var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}:where(.snowui-link-default-trailing) {display:inline-flex;flex-shrink:0;color:currentColor;opacity:var(\n --snowui-link-decoration-opacity-override,\n var(--snowui-link-decoration-opacity)\n );text-decoration:none;transition:opacity var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}:where(.snowui-link):hover:not(.snowui-disabled) > .snowui-link-default-trailing,\n :where(.snowui-link):active:not(.snowui-disabled) > .snowui-link-default-trailing,\n :where(.snowui-link):hover:not(.snowui-disabled) > [data-as="trailing"]:not(.snowui-link-default-trailing),\n :where(.snowui-link):active:not(.snowui-disabled) > [data-as="trailing"]:not(.snowui-link-default-trailing) {opacity:var(\n --snowui-link-decoration-hover-opacity-override,\n var(--snowui-link-decoration-hover-opacity)\n );}:where(.snowui-link-default-icon) {--snowui-icon-size-override: var(\n --snowui-link-icon-size-override,\n var(--snowui-link-icon-size)\n );}'
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
export default function Link($$anchor, $$props) {
|
|
@@ -78,6 +79,7 @@ export default function Link($$anchor, $$props) {
|
|
|
78
79
|
|
|
79
80
|
let hostElement = $.state(void 0);
|
|
80
81
|
let contentElement = $.state(void 0);
|
|
82
|
+
let hasCustomLeading = $.state(false);
|
|
81
83
|
let hasCustomTrailing = $.state(false);
|
|
82
84
|
const truncation = new TruncationController(undefined, () => $.get(contentElement));
|
|
83
85
|
const resolvedLines = $.derived(() => lines() === false ? undefined : lines());
|
|
@@ -172,6 +174,7 @@ export default function Link($$anchor, $$props) {
|
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
|
|
177
|
+
$.set(hasCustomLeading, !!host.querySelector(':scope > [data-as="leading"]'));
|
|
175
178
|
$.set(hasCustomTrailing, !!host.querySelector(':scope > [data-as="trailing"]:not(.snowui-link-default-trailing)'));
|
|
176
179
|
};
|
|
177
180
|
|
|
@@ -213,11 +216,12 @@ export default function Link($$anchor, $$props) {
|
|
|
213
216
|
}
|
|
214
217
|
|
|
215
218
|
{
|
|
216
|
-
let $0 = $.derived(() =>
|
|
217
|
-
let $1 = $.derived(() =>
|
|
218
|
-
let $2 = $.derived(() =>
|
|
219
|
+
let $0 = $.derived(() => $.get(resolvedLines) === 1 || variant() !== "default" || $.get(hasCustomLeading) || $.get(hasCustomTrailing));
|
|
220
|
+
let $1 = $.derived(() => disabled() || undefined);
|
|
221
|
+
let $2 = $.derived(() => $.get(resolvedLines) === 1 ? truncation.isTruncated ? "true" : "false" : undefined);
|
|
222
|
+
let $3 = $.derived(() => ["snowui-link", `snowui-link-${variant()}`, userClass()].filter(Boolean).join(" "));
|
|
219
223
|
|
|
220
|
-
let $
|
|
224
|
+
let $4 = $.derived(() => ({
|
|
221
225
|
variant: userRenderHints()?.variant ?? "line",
|
|
222
226
|
width: userRenderHints()?.width ?? "4rem",
|
|
223
227
|
height: userRenderHints()?.height ?? "var(--leading-14)",
|
|
@@ -228,6 +232,10 @@ export default function Link($$anchor, $$props) {
|
|
|
228
232
|
{
|
|
229
233
|
tag: 'a',
|
|
230
234
|
row: true,
|
|
235
|
+
get singleLine() {
|
|
236
|
+
return $.get($0);
|
|
237
|
+
},
|
|
238
|
+
|
|
231
239
|
get href() {
|
|
232
240
|
return href();
|
|
233
241
|
},
|
|
@@ -245,7 +253,7 @@ export default function Link($$anchor, $$props) {
|
|
|
245
253
|
},
|
|
246
254
|
|
|
247
255
|
get 'aria-disabled'() {
|
|
248
|
-
return $.get($
|
|
256
|
+
return $.get($1);
|
|
249
257
|
},
|
|
250
258
|
|
|
251
259
|
get 'data-variant'() {
|
|
@@ -261,7 +269,7 @@ export default function Link($$anchor, $$props) {
|
|
|
261
269
|
},
|
|
262
270
|
|
|
263
271
|
get 'data-truncated'() {
|
|
264
|
-
return $.get($
|
|
272
|
+
return $.get($2);
|
|
265
273
|
},
|
|
266
274
|
|
|
267
275
|
get componentParts() {
|
|
@@ -269,7 +277,7 @@ export default function Link($$anchor, $$props) {
|
|
|
269
277
|
},
|
|
270
278
|
|
|
271
279
|
get class() {
|
|
272
|
-
return $.get($
|
|
280
|
+
return $.get($3);
|
|
273
281
|
},
|
|
274
282
|
|
|
275
283
|
get style() {
|
|
@@ -297,7 +305,7 @@ export default function Link($$anchor, $$props) {
|
|
|
297
305
|
},
|
|
298
306
|
|
|
299
307
|
get renderHints() {
|
|
300
|
-
return $.get($
|
|
308
|
+
return $.get($4);
|
|
301
309
|
}
|
|
302
310
|
},
|
|
303
311
|
() => rest,
|
|
@@ -322,13 +330,23 @@ export default function Link($$anchor, $$props) {
|
|
|
322
330
|
var span_2 = $.first_child(fragment_2);
|
|
323
331
|
var node_1 = $.child(span_2);
|
|
324
332
|
|
|
325
|
-
|
|
333
|
+
ComponentPartsBoundary(node_1, {
|
|
334
|
+
children: ($$anchor, $$slotProps) => {
|
|
335
|
+
var fragment_3 = $.comment();
|
|
336
|
+
var node_2 = $.first_child(fragment_3);
|
|
337
|
+
|
|
338
|
+
$.snippet(node_2, () => $$props.children ?? $.noop);
|
|
339
|
+
$.append($$anchor, fragment_3);
|
|
340
|
+
},
|
|
341
|
+
$$slots: { default: true }
|
|
342
|
+
});
|
|
343
|
+
|
|
326
344
|
$.reset(span_2);
|
|
327
345
|
$.bind_this(span_2, ($$value) => $.set(contentElement, $$value), () => $.get(contentElement));
|
|
328
346
|
|
|
329
347
|
var span_3 = $.sibling(span_2, 2);
|
|
330
348
|
var text = $.child(span_3, true);
|
|
331
|
-
var
|
|
349
|
+
var node_3 = $.sibling(text);
|
|
332
350
|
|
|
333
351
|
{
|
|
334
352
|
var consequent = ($$anchor) => {
|
|
@@ -337,7 +355,7 @@ export default function Link($$anchor, $$props) {
|
|
|
337
355
|
$.append($$anchor, span_4);
|
|
338
356
|
};
|
|
339
357
|
|
|
340
|
-
$.if(
|
|
358
|
+
$.if(node_3, ($$render) => {
|
|
341
359
|
if (truncation.isTruncated) $$render(consequent);
|
|
342
360
|
});
|
|
343
361
|
}
|
|
@@ -349,9 +367,19 @@ export default function Link($$anchor, $$props) {
|
|
|
349
367
|
|
|
350
368
|
var alternate = ($$anchor) => {
|
|
351
369
|
var span_5 = root_2();
|
|
352
|
-
var
|
|
370
|
+
var node_4 = $.child(span_5);
|
|
371
|
+
|
|
372
|
+
ComponentPartsBoundary(node_4, {
|
|
373
|
+
children: ($$anchor, $$slotProps) => {
|
|
374
|
+
var fragment_4 = $.comment();
|
|
375
|
+
var node_5 = $.first_child(fragment_4);
|
|
376
|
+
|
|
377
|
+
$.snippet(node_5, () => $$props.children ?? $.noop);
|
|
378
|
+
$.append($$anchor, fragment_4);
|
|
379
|
+
},
|
|
380
|
+
$$slots: { default: true }
|
|
381
|
+
});
|
|
353
382
|
|
|
354
|
-
$.snippet(node_3, () => $$props.children ?? $.noop);
|
|
355
383
|
$.reset(span_5);
|
|
356
384
|
$.bind_this(span_5, ($$value) => $.set(contentElement, $$value), () => $.get(contentElement));
|
|
357
385
|
$.append($$anchor, span_5);
|
|
@@ -364,14 +392,14 @@ export default function Link($$anchor, $$props) {
|
|
|
364
392
|
|
|
365
393
|
$.reset(span_1);
|
|
366
394
|
|
|
367
|
-
var
|
|
395
|
+
var node_6 = $.sibling(span_1, 2);
|
|
368
396
|
|
|
369
397
|
{
|
|
370
398
|
var consequent_4 = ($$anchor) => {
|
|
371
399
|
Tooltip($$anchor, $.spread_props(() => $.get(tooltipConfig), {
|
|
372
400
|
children: ($$anchor, $$slotProps) => {
|
|
373
|
-
var
|
|
374
|
-
var
|
|
401
|
+
var fragment_6 = $.comment();
|
|
402
|
+
var node_7 = $.first_child(fragment_6);
|
|
375
403
|
|
|
376
404
|
{
|
|
377
405
|
var consequent_2 = ($$anchor) => {
|
|
@@ -382,39 +410,39 @@ export default function Link($$anchor, $$props) {
|
|
|
382
410
|
};
|
|
383
411
|
|
|
384
412
|
var consequent_3 = ($$anchor) => {
|
|
385
|
-
var
|
|
386
|
-
var
|
|
413
|
+
var fragment_8 = $.comment();
|
|
414
|
+
var node_8 = $.first_child(fragment_8);
|
|
387
415
|
|
|
388
|
-
$.snippet(
|
|
389
|
-
$.append($$anchor,
|
|
416
|
+
$.snippet(node_8, () => $.get(tooltipContent));
|
|
417
|
+
$.append($$anchor, fragment_8);
|
|
390
418
|
};
|
|
391
419
|
|
|
392
|
-
$.if(
|
|
420
|
+
$.if(node_7, ($$render) => {
|
|
393
421
|
if (typeof $.get(tooltipContent) === "string") $$render(consequent_2); else if (typeof $.get(tooltipContent) === "function") $$render(consequent_3, 1);
|
|
394
422
|
});
|
|
395
423
|
}
|
|
396
424
|
|
|
397
|
-
$.append($$anchor,
|
|
425
|
+
$.append($$anchor, fragment_6);
|
|
398
426
|
},
|
|
399
427
|
$$slots: { default: true }
|
|
400
428
|
}));
|
|
401
429
|
};
|
|
402
430
|
|
|
403
|
-
$.if(
|
|
431
|
+
$.if(node_6, ($$render) => {
|
|
404
432
|
if ($.get(needTooltip)) $$render(consequent_4);
|
|
405
433
|
});
|
|
406
434
|
}
|
|
407
435
|
|
|
408
436
|
$.reset(span);
|
|
409
437
|
|
|
410
|
-
var
|
|
438
|
+
var node_9 = $.sibling(span, 2);
|
|
411
439
|
|
|
412
440
|
{
|
|
413
441
|
var consequent_5 = ($$anchor) => {
|
|
414
442
|
var span_6 = root_3();
|
|
415
|
-
var
|
|
443
|
+
var node_10 = $.child(span_6);
|
|
416
444
|
|
|
417
|
-
ComponentIcon(
|
|
445
|
+
ComponentIcon(node_10, {
|
|
418
446
|
name: 'arrow-up-right',
|
|
419
447
|
class: 'snowui-link-default-icon',
|
|
420
448
|
size: 'var(--snowui-link-icon-size-override, var(--snowui-link-icon-size))',
|
|
@@ -427,9 +455,9 @@ export default function Link($$anchor, $$props) {
|
|
|
427
455
|
|
|
428
456
|
var consequent_6 = ($$anchor) => {
|
|
429
457
|
var span_7 = root_3();
|
|
430
|
-
var
|
|
458
|
+
var node_11 = $.child(span_7);
|
|
431
459
|
|
|
432
|
-
ComponentIcon(
|
|
460
|
+
ComponentIcon(node_11, {
|
|
433
461
|
name: 'arrow-square-out',
|
|
434
462
|
class: 'snowui-link-default-icon',
|
|
435
463
|
size: 'var(--snowui-link-icon-size-override, var(--snowui-link-icon-size))',
|
|
@@ -440,7 +468,7 @@ export default function Link($$anchor, $$props) {
|
|
|
440
468
|
$.append($$anchor, span_7);
|
|
441
469
|
};
|
|
442
470
|
|
|
443
|
-
$.if(
|
|
471
|
+
$.if(node_9, ($$render) => {
|
|
444
472
|
if (variant() === "arrow" && !$.get(hasCustomTrailing)) $$render(consequent_5); else if (variant() === "external" && !$.get(hasCustomTrailing)) $$render(consequent_6, 1);
|
|
445
473
|
});
|
|
446
474
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import { type FrameProps } from "./Frame.js";
|
|
3
3
|
import Input from "./Input.js";
|
|
4
|
+
import Text from "./Text.js";
|
|
4
5
|
import MenuItem from "./MenuItem.js";
|
|
5
6
|
import { type ComponentPartsOf } from "../logic/component-parts.js";
|
|
6
7
|
export interface ListboxItem {
|
|
@@ -17,6 +18,7 @@ interface Props extends Omit<FrameProps, "children" | "tag"> {
|
|
|
17
18
|
parts?: ComponentPartsOf<{
|
|
18
19
|
Input: typeof Input;
|
|
19
20
|
MenuItem: typeof MenuItem;
|
|
21
|
+
Text: typeof Text;
|
|
20
22
|
}>;
|
|
21
23
|
/** 默认内置模式是否生成固定在顶部的搜索框。 */
|
|
22
24
|
search?: boolean;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import 'svelte/internal/disclose-version';
|
|
2
2
|
import * as $ from 'svelte/internal/client';
|
|
3
|
+
import { useLocale } from "../i18n/locale.js";
|
|
3
4
|
import { tick, setContext } from "svelte";
|
|
4
5
|
import Frame from "./Frame.js";
|
|
5
6
|
import Input from "./Input.js";
|
|
7
|
+
import Text from "./Text.js";
|
|
6
8
|
import MenuItem from "./MenuItem.js";
|
|
7
9
|
import { getListboxOwner, LISTBOX_HEADER_PORTAL_KEY } from "../context.js";
|
|
8
10
|
import { FIELD_CONTEXT_KEY } from "../keys.js";
|
|
@@ -18,6 +20,7 @@ import {
|
|
|
18
20
|
|
|
19
21
|
import { getMotionTotalDurationMs } from "../motion/presets/utils.js";
|
|
20
22
|
import { mergeComponentPartProps, useComponentPart } from "../logic/component-parts.js";
|
|
23
|
+
import ComponentPartsBoundary from "../logic/ComponentPartsBoundary.js";
|
|
21
24
|
import { ContinuousHoverController } from "../logic/continuous-hover.js";
|
|
22
25
|
import { CONTINUOUS_HOVER_MOTION_STYLE } from "../motion/presets/continuous-hover.js";
|
|
23
26
|
|
|
@@ -50,8 +53,9 @@ export default function Listbox($$anchor, $$props) {
|
|
|
50
53
|
/** 浮层相对锚点的水平对齐方式。 */
|
|
51
54
|
/** 是否为选中项预留并显示勾选图标。 */
|
|
52
55
|
/** 选项间是否使用容器级连续 hover 背景。 */
|
|
53
|
-
const
|
|
56
|
+
const localeContext = useLocale();
|
|
54
57
|
|
|
58
|
+
const inheritedListboxPart = useComponentPart("Listbox");
|
|
55
59
|
let explicitProps = $.rest_props($$props, rest_excludes);
|
|
56
60
|
|
|
57
61
|
let $$d = $.derived(() => mergeComponentPartProps(inheritedListboxPart.current, explicitProps)),
|
|
@@ -98,7 +102,7 @@ export default function Listbox($$anchor, $$props) {
|
|
|
98
102
|
|
|
99
103
|
const resolvedParts = $.derived(() => ({
|
|
100
104
|
...$.get(parts),
|
|
101
|
-
Input: {
|
|
105
|
+
Input: { ...$.get(parts)?.Input },
|
|
102
106
|
MenuItem: { showCheck: $.get(showCheck), ...$.get(parts)?.MenuItem }
|
|
103
107
|
}));
|
|
104
108
|
|
|
@@ -458,9 +462,30 @@ export default function Listbox($$anchor, $$props) {
|
|
|
458
462
|
return () => document.removeEventListener("pointerdown", handler, true);
|
|
459
463
|
});
|
|
460
464
|
|
|
465
|
+
// 搜索头与列表共享关闭键;搜索头的其他按键继续交给原生输入框。
|
|
466
|
+
function handleDismissKeydown(e) {
|
|
467
|
+
if (!owner || e.defaultPrevented) return false;
|
|
468
|
+
|
|
469
|
+
if (e.key === "Escape") {
|
|
470
|
+
e.preventDefault();
|
|
471
|
+
owner.setOpen(false);
|
|
472
|
+
owner.triggerEl?.focus();
|
|
473
|
+
|
|
474
|
+
return true;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if (e.key === "Tab") {
|
|
478
|
+
owner.setOpen(false);
|
|
479
|
+
|
|
480
|
+
return true;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
return false;
|
|
484
|
+
}
|
|
485
|
+
|
|
461
486
|
// 键盘导航
|
|
462
487
|
function handleKeydown(e) {
|
|
463
|
-
if (!owner) return;
|
|
488
|
+
if (handleDismissKeydown(e) || !owner) return;
|
|
464
489
|
|
|
465
490
|
const opts = [...owner.options, ...owner.customOptions];
|
|
466
491
|
const len = opts.length;
|
|
@@ -496,16 +521,6 @@ export default function Listbox($$anchor, $$props) {
|
|
|
496
521
|
owner.selectOption(opts[owner.activeIndex].value);
|
|
497
522
|
}
|
|
498
523
|
break;
|
|
499
|
-
|
|
500
|
-
case "Escape":
|
|
501
|
-
e.preventDefault();
|
|
502
|
-
owner.setOpen(false);
|
|
503
|
-
owner.triggerEl?.focus();
|
|
504
|
-
break;
|
|
505
|
-
|
|
506
|
-
case "Tab":
|
|
507
|
-
owner.setOpen(false);
|
|
508
|
-
break;
|
|
509
524
|
}
|
|
510
525
|
}
|
|
511
526
|
|
|
@@ -546,7 +561,7 @@ export default function Listbox($$anchor, $$props) {
|
|
|
546
561
|
return $.get($2);
|
|
547
562
|
},
|
|
548
563
|
class: 'snowui-listbox-portal snowui-quick-action-panel snowui-rounded-rectangle',
|
|
549
|
-
style: 'width: max-content; min-width: 100%; max-height: inherit;',
|
|
564
|
+
style: 'width: max-content; min-width: 100%; max-width: 100%; max-height: inherit;',
|
|
550
565
|
contentFill: true,
|
|
551
566
|
get enableAutoLayout() {
|
|
552
567
|
return $.get(enableAutoLayout);
|
|
@@ -573,7 +588,19 @@ export default function Listbox($$anchor, $$props) {
|
|
|
573
588
|
|
|
574
589
|
{
|
|
575
590
|
var consequent = ($$anchor) => {
|
|
576
|
-
|
|
591
|
+
{
|
|
592
|
+
let $0 = $.derived(() => localeContext.t("listbox.search"));
|
|
593
|
+
|
|
594
|
+
Input($$anchor, $.spread_props(
|
|
595
|
+
{
|
|
596
|
+
get placeholder() {
|
|
597
|
+
return $.get($0);
|
|
598
|
+
}
|
|
599
|
+
},
|
|
600
|
+
() => $.get(resolvedParts).Input,
|
|
601
|
+
{ as: 'search' }
|
|
602
|
+
));
|
|
603
|
+
}
|
|
577
604
|
};
|
|
578
605
|
|
|
579
606
|
$.if(node_3, ($$render) => {
|
|
@@ -660,16 +687,21 @@ export default function Listbox($$anchor, $$props) {
|
|
|
660
687
|
|
|
661
688
|
{
|
|
662
689
|
var consequent_1 = ($$anchor) => {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
690
|
+
ComponentPartsBoundary($$anchor, {
|
|
691
|
+
children: ($$anchor, $$slotProps) => {
|
|
692
|
+
var fragment_5 = $.comment();
|
|
693
|
+
var node_6 = $.first_child(fragment_5);
|
|
694
|
+
|
|
695
|
+
$.snippet(node_6, () => $.get(children));
|
|
696
|
+
$.append($$anchor, fragment_5);
|
|
697
|
+
},
|
|
698
|
+
$$slots: { default: true }
|
|
699
|
+
});
|
|
668
700
|
};
|
|
669
701
|
|
|
670
702
|
var alternate = ($$anchor) => {
|
|
671
|
-
var
|
|
672
|
-
var node_7 = $.first_child(
|
|
703
|
+
var fragment_6 = $.comment();
|
|
704
|
+
var node_7 = $.first_child(fragment_6);
|
|
673
705
|
|
|
674
706
|
$.each(node_7, 17, () => $.get(items), (item) => item.value, ($$anchor, item) => {
|
|
675
707
|
MenuItem($$anchor, {
|
|
@@ -683,18 +715,23 @@ export default function Listbox($$anchor, $$props) {
|
|
|
683
715
|
},
|
|
684
716
|
|
|
685
717
|
children: ($$anchor, $$slotProps) => {
|
|
686
|
-
$.
|
|
718
|
+
Text($$anchor, $.spread_props({ lines: 1 }, () => $.get(parts)?.Text, {
|
|
719
|
+
children: ($$anchor, $$slotProps) => {
|
|
720
|
+
$.next();
|
|
687
721
|
|
|
688
|
-
|
|
722
|
+
var text = $.text();
|
|
689
723
|
|
|
690
|
-
|
|
691
|
-
|
|
724
|
+
$.template_effect(() => $.set_text(text, $.get(item).label));
|
|
725
|
+
$.append($$anchor, text);
|
|
726
|
+
},
|
|
727
|
+
$$slots: { default: true }
|
|
728
|
+
}));
|
|
692
729
|
},
|
|
693
730
|
$$slots: { default: true }
|
|
694
731
|
});
|
|
695
732
|
});
|
|
696
733
|
|
|
697
|
-
$.append($$anchor,
|
|
734
|
+
$.append($$anchor, fragment_6);
|
|
698
735
|
};
|
|
699
736
|
|
|
700
737
|
$.if(node_5, ($$render) => {
|
|
@@ -716,12 +753,17 @@ export default function Listbox($$anchor, $$props) {
|
|
|
716
753
|
},
|
|
717
754
|
|
|
718
755
|
children: ($$anchor, $$slotProps) => {
|
|
719
|
-
$.
|
|
756
|
+
Text($$anchor, $.spread_props({ lines: 1 }, () => $.get(parts)?.Text, {
|
|
757
|
+
children: ($$anchor, $$slotProps) => {
|
|
758
|
+
$.next();
|
|
720
759
|
|
|
721
|
-
|
|
760
|
+
var text_1 = $.text();
|
|
722
761
|
|
|
723
|
-
|
|
724
|
-
|
|
762
|
+
$.template_effect(() => $.set_text(text_1, $.get(item).label));
|
|
763
|
+
$.append($$anchor, text_1);
|
|
764
|
+
},
|
|
765
|
+
$$slots: { default: true }
|
|
766
|
+
}));
|
|
725
767
|
},
|
|
726
768
|
$$slots: { default: true }
|
|
727
769
|
});
|
|
@@ -757,6 +799,7 @@ export default function Listbox($$anchor, $$props) {
|
|
|
757
799
|
}
|
|
758
800
|
|
|
759
801
|
$.reset(div_2);
|
|
802
|
+
$.delegated('keydown', div_1, handleDismissKeydown);
|
|
760
803
|
$.append($$anchor, fragment_1);
|
|
761
804
|
},
|
|
762
805
|
$$slots: { default: true }
|
|
@@ -788,16 +831,21 @@ export default function Listbox($$anchor, $$props) {
|
|
|
788
831
|
|
|
789
832
|
{
|
|
790
833
|
var consequent_4 = ($$anchor) => {
|
|
791
|
-
|
|
792
|
-
|
|
834
|
+
ComponentPartsBoundary($$anchor, {
|
|
835
|
+
children: ($$anchor, $$slotProps) => {
|
|
836
|
+
var fragment_14 = $.comment();
|
|
837
|
+
var node_11 = $.first_child(fragment_14);
|
|
793
838
|
|
|
794
|
-
|
|
795
|
-
|
|
839
|
+
$.snippet(node_11, () => $.get(children));
|
|
840
|
+
$.append($$anchor, fragment_14);
|
|
841
|
+
},
|
|
842
|
+
$$slots: { default: true }
|
|
843
|
+
});
|
|
796
844
|
};
|
|
797
845
|
|
|
798
846
|
var alternate_1 = ($$anchor) => {
|
|
799
|
-
var
|
|
800
|
-
var node_12 = $.first_child(
|
|
847
|
+
var fragment_15 = $.comment();
|
|
848
|
+
var node_12 = $.first_child(fragment_15);
|
|
801
849
|
|
|
802
850
|
$.each(node_12, 17, () => $.get(items), (item) => item.value, ($$anchor, item) => {
|
|
803
851
|
MenuItem($$anchor, {
|
|
@@ -811,18 +859,23 @@ export default function Listbox($$anchor, $$props) {
|
|
|
811
859
|
},
|
|
812
860
|
|
|
813
861
|
children: ($$anchor, $$slotProps) => {
|
|
814
|
-
$.
|
|
862
|
+
Text($$anchor, $.spread_props({ lines: 1 }, () => $.get(parts)?.Text, {
|
|
863
|
+
children: ($$anchor, $$slotProps) => {
|
|
864
|
+
$.next();
|
|
815
865
|
|
|
816
|
-
|
|
866
|
+
var text_2 = $.text();
|
|
817
867
|
|
|
818
|
-
|
|
819
|
-
|
|
868
|
+
$.template_effect(() => $.set_text(text_2, $.get(item).label));
|
|
869
|
+
$.append($$anchor, text_2);
|
|
870
|
+
},
|
|
871
|
+
$$slots: { default: true }
|
|
872
|
+
}));
|
|
820
873
|
},
|
|
821
874
|
$$slots: { default: true }
|
|
822
875
|
});
|
|
823
876
|
});
|
|
824
877
|
|
|
825
|
-
$.append($$anchor,
|
|
878
|
+
$.append($$anchor, fragment_15);
|
|
826
879
|
};
|
|
827
880
|
|
|
828
881
|
$.if(node_10, ($$render) => {
|
|
@@ -841,4 +894,6 @@ export default function Listbox($$anchor, $$props) {
|
|
|
841
894
|
|
|
842
895
|
$.append($$anchor, fragment);
|
|
843
896
|
$.pop();
|
|
844
|
-
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
$.delegate(['keydown']);
|
|
@@ -9,6 +9,8 @@ interface Props extends Omit<FrameProps, "children" | "tag"> {
|
|
|
9
9
|
}>;
|
|
10
10
|
/** 选项值(在 Listbox 内使用时必填,同一 Listbox 内必须唯一) */
|
|
11
11
|
value?: string;
|
|
12
|
+
/** 普通标签使用单行共享预设;复杂多行children显式关闭。 */
|
|
13
|
+
singleLine?: boolean;
|
|
12
14
|
/** 是否选中(独立使用时有效;Listbox 内由 context 覆盖) */
|
|
13
15
|
selected?: boolean;
|
|
14
16
|
/** 是否高亮(独立使用时有效;Listbox 内由 context 覆盖) */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import 'svelte/internal/disclose-version';
|
|
2
2
|
import * as $ from 'svelte/internal/client';
|
|
3
|
+
import { useLocale } from "../i18n/locale.js";
|
|
3
4
|
import Button from "./Button.js";
|
|
4
5
|
import { onMount } from "svelte";
|
|
5
6
|
import { ComponentIcon } from "../internal/component-icon/index.js";
|
|
@@ -14,7 +15,7 @@ var root_1 = $.from_html(`<!> <!>`, 1);
|
|
|
14
15
|
|
|
15
16
|
const $$css = {
|
|
16
17
|
hash: 'svelte-1uvvfgo',
|
|
17
|
-
code: '\n /* ── 操作项基础样式 ── */:where(.snowui-menu-item) {--snowui-menu-item-gap: var(--gap-2, 0.5rem);--snowui-menu-item-slot-gap: var(--snowui-menu-item-gap);padding:var(--snowui-menu-item-padding-override, var(--padding-2, 0.5rem));gap:var(--snowui-menu-item-gap);border-radius:var(--snowui-menu-item-radius-override, var(--radius-3, 0.75rem));font-size:var(--text-14);line-height:var(--leading-14);cursor:pointer;box-sizing:border-box;}\n\n /* Label 槽位(Content / Fill) */:where(.snowui-menu-item-label) {display:flex;align-items:center;gap:var(--snowui-menu-item-slot-gap);flex-wrap:nowrap;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}\n\n /* 直系复合 Leading / Trailing 槽位 */:where(.snowui-menu-item > [data-as="leading"]),\n :where(.snowui-menu-item > [data-as="trailing"]:not(.snowui-menu-item-check):not(.snowui-menu-item-delete)) {display:inline-flex;align-items:inherit;gap:var(--snowui-menu-item-slot-gap);min-width:0;white-space:nowrap;}:where(.snowui-menu-item > [data-as="trailing"]) {flex-shrink:0;}:where(.snowui-menu-item:has(> [data-as="trailing"]:not(.snowui-menu-item-check):not(.snowui-menu-item-delete)) > .snowui-menu-item-check) {display:none;}\n\n /* Check 图标槽位(Trailing / Hug),默认隐藏 */:where(.snowui-menu-item-check:not(.snowui-menu-item-delete)) {width:var(--size-4, 1rem);height:var(--size-4, 1rem);flex-shrink:0;opacity:0;color:currentColor;}:where(.snowui-menu-item:hover) {background-color:var(--black-4, #0000000a);}:where([data-continuous-hover-enabled="true"] > .snowui-menu-item:hover) {background-color:transparent;}\n\n /* 选中态 */:where(.snowui-menu-item[aria-selected="true"]) {color:var(--black-100, #000000ff);}:where(.snowui-menu-item[aria-selected="true"] .snowui-menu-item-check) {opacity:1;}\n\n /* 活跃态(键盘导航高亮) */:where(.snowui-menu-item[data-active="true"]) {background-color:var(--black-4, #0000000a);}:where(.snowui-listbox[data-continuous-hover-enabled="true"] > .snowui-menu-item[data-active="true"]) {background-color:transparent;}\n\n /* 禁用态 */:where(.snowui-menu-item[aria-disabled="true"]) {opacity:0.2;cursor:not-allowed;pointer-events:none;}\n\n /* 过滤隐藏(Listbox 搜索过滤) */:where(.snowui-menu-item[data-filtered="true"]) {display:none;}\n\n /* 删除按钮(Listbox 自定义项 hover 时替换 ✔ 的位置) */:where(.snowui-menu-item-delete) {flex-shrink:0;}\n\n /* Listbox 选项始终保持自然高度,不参与外层剩余空间分配。 */:where(.snowui-listbox > .snowui-menu-item) {flex:0 0 auto;width:100%;}'
|
|
18
|
+
code: '\n /* ── 操作项基础样式 ── */:where(.snowui-menu-item) {--snowui-menu-item-gap: var(--gap-2, 0.5rem);--snowui-menu-item-slot-gap: max(4px, var(--snowui-menu-item-gap));padding:var(--snowui-menu-item-padding-override, var(--padding-2, 0.5rem));gap:var(--snowui-menu-item-slot-gap);border-radius:var(--snowui-menu-item-radius-override, var(--radius-3, 0.75rem));font-size:var(--text-14);line-height:var(--leading-14);cursor:pointer;box-sizing:border-box;}\n\n /* Label 槽位(Content / Fill) */:where(.snowui-menu-item-label) {display:flex;align-items:center;gap:var(--snowui-menu-item-slot-gap);flex-wrap:nowrap;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}\n\n /* 直系复合 Leading / Trailing 槽位 */:where(.snowui-menu-item > [data-as="leading"]),\n :where(.snowui-menu-item > [data-as="trailing"]:not(.snowui-menu-item-check):not(.snowui-menu-item-delete)) {display:inline-flex;align-items:inherit;gap:var(--snowui-menu-item-slot-gap);min-width:0;white-space:nowrap;}:where(.snowui-menu-item > [data-as="trailing"]) {flex-shrink:0;}:where(.snowui-menu-item:has(> [data-as="trailing"]:not(.snowui-menu-item-check):not(.snowui-menu-item-delete)) > .snowui-menu-item-check) {display:none;}\n\n /* Check 图标槽位(Trailing / Hug),默认隐藏 */:where(.snowui-menu-item-check:not(.snowui-menu-item-delete)) {width:var(--size-4, 1rem);height:var(--size-4, 1rem);flex-shrink:0;opacity:0;color:currentColor;}:where(.snowui-menu-item:hover) {background-color:var(--black-4, #0000000a);}:where([data-continuous-hover-enabled="true"] > .snowui-menu-item:hover) {background-color:transparent;}\n\n /* 选中态 */:where(.snowui-menu-item[aria-selected="true"]) {color:var(--black-100, #000000ff);}:where(.snowui-menu-item[aria-selected="true"] .snowui-menu-item-check) {opacity:1;}\n\n /* 活跃态(键盘导航高亮) */:where(.snowui-menu-item[data-active="true"]) {background-color:var(--black-4, #0000000a);}:where(.snowui-listbox[data-continuous-hover-enabled="true"] > .snowui-menu-item[data-active="true"]) {background-color:transparent;}\n\n /* 禁用态 */:where(.snowui-menu-item[aria-disabled="true"]) {opacity:0.2;cursor:not-allowed;pointer-events:none;}\n\n /* 过滤隐藏(Listbox 搜索过滤) */:where(.snowui-menu-item[data-filtered="true"]) {display:none;}\n\n /* 删除按钮(Listbox 自定义项 hover 时替换 ✔ 的位置) */:where(.snowui-menu-item-delete) {flex-shrink:0;}\n\n /* Listbox 选项始终保持自然高度,不参与外层剩余空间分配。 */:where(.snowui-listbox > .snowui-menu-item) {flex:0 0 auto;width:100%;}'
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export default function MenuItem($$anchor, $$props) {
|
|
@@ -22,8 +23,11 @@ export default function MenuItem($$anchor, $$props) {
|
|
|
22
23
|
$.append_styles($$anchor, $$css);
|
|
23
24
|
|
|
24
25
|
// SnowUI 许可入口:首次阅读源码请先读 ../../LICENSE;访问文件不代表获得修改或移植权,官方维护授权及同任务去重见该文件。
|
|
26
|
+
const localeContext = useLocale();
|
|
27
|
+
|
|
25
28
|
/** 内置图标按钮配置;事件与角色由所属组件控制。 */
|
|
26
29
|
/** 选项值(在 Listbox 内使用时必填,同一 Listbox 内必须唯一) */
|
|
30
|
+
/** 普通标签使用单行共享预设;复杂多行children显式关闭。 */
|
|
27
31
|
/** 是否选中(独立使用时有效;Listbox 内由 context 覆盖) */
|
|
28
32
|
/** 是否高亮(独立使用时有效;Listbox 内由 context 覆盖) */
|
|
29
33
|
/** 是否禁用 */
|
|
@@ -36,6 +40,7 @@ export default function MenuItem($$anchor, $$props) {
|
|
|
36
40
|
|
|
37
41
|
let $$d = $.derived(() => mergeComponentPartProps(inheritedMenuItemPart.current, explicitProps)),
|
|
38
42
|
value = $.derived(() => $.get($$d).value),
|
|
43
|
+
singleLine = $.derived(() => $.fallback($.get($$d).singleLine, true)),
|
|
39
44
|
selectedProp = $.derived(() => $.fallback($.get($$d).selected, false)),
|
|
40
45
|
activeProp = $.derived(() => $.fallback($.get($$d).active, false)),
|
|
41
46
|
disabled = $.derived(() => $.fallback($.get($$d).disabled, false)),
|
|
@@ -52,6 +57,7 @@ export default function MenuItem($$anchor, $$props) {
|
|
|
52
57
|
onclick = $.derived(() => $.get($$d).onclick),
|
|
53
58
|
rest = $.derived(() => $.exclude_from_object($.get($$d), [
|
|
54
59
|
'value',
|
|
60
|
+
'singleLine',
|
|
55
61
|
'selected',
|
|
56
62
|
'active',
|
|
57
63
|
'disabled',
|
|
@@ -204,6 +210,10 @@ export default function MenuItem($$anchor, $$props) {
|
|
|
204
210
|
return $.get(as);
|
|
205
211
|
},
|
|
206
212
|
row: true,
|
|
213
|
+
get singleLine() {
|
|
214
|
+
return $.get(singleLine);
|
|
215
|
+
},
|
|
216
|
+
|
|
207
217
|
get id() {
|
|
208
218
|
return $.get(optionId);
|
|
209
219
|
},
|
|
@@ -303,6 +313,7 @@ export default function MenuItem($$anchor, $$props) {
|
|
|
303
313
|
var consequent_2 = ($$anchor) => {
|
|
304
314
|
{
|
|
305
315
|
let $0 = $.derived(() => `snowui-clear-icon-btn snowui-menu-item-delete snowui-menu-item-check${$.get(parts)?.Button?.class ? ` ${$.get(parts).Button.class}` : ""}`);
|
|
316
|
+
let $1 = $.derived(() => localeContext.t("menuItem.deleteCustom"));
|
|
306
317
|
|
|
307
318
|
Button($$anchor, $.spread_props({ bare: true, emphasis: 'muted', size: 'sm' }, () => $.get(parts)?.Button, {
|
|
308
319
|
type: 'button',
|
|
@@ -310,7 +321,9 @@ export default function MenuItem($$anchor, $$props) {
|
|
|
310
321
|
return $.get($0);
|
|
311
322
|
},
|
|
312
323
|
as: 'trailing',
|
|
313
|
-
'aria-label'
|
|
324
|
+
get 'aria-label'() {
|
|
325
|
+
return $.get($1);
|
|
326
|
+
},
|
|
314
327
|
onclick: handleDelete,
|
|
315
328
|
onmousedown: handleMousedown,
|
|
316
329
|
tabindex: -1,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Snippet } from "svelte";
|
|
2
|
+
import { type FrameProps } from "./Frame.js";
|
|
3
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
4
|
+
export type OTPLength = 4 | 5 | 6 | 7 | 8;
|
|
5
|
+
interface Props extends Omit<FrameProps, "tag" | "children" | "enableScaleObserver" | "oninput" | "onchange" | "onfocus" | "onblur" | "onkeydown" | "onpaste"> {
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
length?: OTPLength;
|
|
9
|
+
name?: string;
|
|
10
|
+
form?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
readonly?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
autocomplete?: HTMLInputAttributes["autocomplete"];
|
|
15
|
+
autofocus?: boolean;
|
|
16
|
+
tabindex?: number;
|
|
17
|
+
id?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
invalid?: boolean;
|
|
20
|
+
error?: string | Snippet;
|
|
21
|
+
oncomplete?: (value: string) => void;
|
|
22
|
+
oninput?: (event: Event) => void;
|
|
23
|
+
onchange?: (event: Event) => void;
|
|
24
|
+
onfocus?: (event: FocusEvent) => void;
|
|
25
|
+
onblur?: (event: FocusEvent) => void;
|
|
26
|
+
onkeydown?: (event: KeyboardEvent) => void;
|
|
27
|
+
onpaste?: (event: ClipboardEvent) => void;
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
30
|
+
declare const OTPInput: import("svelte").Component<Props, {}, "value">;
|
|
31
|
+
type OTPInput = ReturnType<typeof OTPInput>;
|
|
32
|
+
export default OTPInput;
|