@human-kit/ui 1.0.0-beta.0 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -16
- package/dist/FOCUS_STATE_CONTRACT.md +18 -4
- package/dist/FOCUS_STATE_REVIEW_TEMPLATE.md +8 -8
- package/dist/accordion/README.md +3 -3
- package/dist/accordion/root/accordion-root.svelte +15 -3
- package/dist/accordion/root/context.svelte.js +4 -4
- package/dist/accordion/types.d.ts +40 -19
- package/dist/autocomplete/README.md +6 -7
- package/dist/autocomplete/empty/autocomplete-empty.svelte +1 -1
- package/dist/autocomplete/empty/autocomplete-empty.svelte.d.ts +1 -1
- package/dist/autocomplete/input/autocomplete-input.svelte +3 -3
- package/dist/autocomplete/input/autocomplete-input.svelte.d.ts +3 -3
- package/dist/autocomplete/item/autocomplete-item.svelte +10 -0
- package/dist/autocomplete/item-indicator/autocomplete-item-indicator.svelte +2 -2
- package/dist/autocomplete/item-indicator/autocomplete-item-indicator.svelte.d.ts +2 -2
- package/dist/autocomplete/list/autocomplete-list.svelte +2 -2
- package/dist/autocomplete/list/autocomplete-list.svelte.d.ts +11 -3
- package/dist/autocomplete/root/autocomplete.svelte +7 -7
- package/dist/autocomplete/root/autocomplete.svelte.d.ts +7 -7
- package/dist/autocomplete/status/autocomplete-status.svelte +1 -1
- package/dist/autocomplete/status/autocomplete-status.svelte.d.ts +1 -1
- package/dist/avatar/README.md +52 -0
- package/dist/avatar/count/avatar-count.svelte +56 -0
- package/dist/avatar/count/avatar-count.svelte.d.ts +4 -0
- package/dist/avatar/fallback/avatar-fallback.svelte +67 -0
- package/dist/avatar/fallback/avatar-fallback.svelte.d.ts +4 -0
- package/dist/avatar/group/avatar-group.svelte +65 -0
- package/dist/avatar/group/avatar-group.svelte.d.ts +4 -0
- package/dist/avatar/group/context.d.ts +15 -0
- package/dist/avatar/group/context.js +15 -0
- package/dist/avatar/image/avatar-image.svelte +104 -0
- package/dist/avatar/image/avatar-image.svelte.d.ts +4 -0
- package/dist/avatar/index.d.ts +22 -0
- package/dist/avatar/index.js +10 -0
- package/dist/avatar/index.parts.d.ts +5 -0
- package/dist/avatar/index.parts.js +5 -0
- package/dist/avatar/root/avatar-root.svelte +79 -0
- package/dist/avatar/root/avatar-root.svelte.d.ts +4 -0
- package/dist/avatar/root/context.d.ts +14 -0
- package/dist/avatar/root/context.js +15 -0
- package/dist/avatar/types.d.ts +84 -0
- package/dist/avatar/types.js +1 -0
- package/dist/breadcrumbs/README.md +65 -0
- package/dist/breadcrumbs/ellipsis/breadcrumbs-ellipsis.svelte +62 -0
- package/dist/breadcrumbs/ellipsis/breadcrumbs-ellipsis.svelte.d.ts +4 -0
- package/dist/breadcrumbs/index.d.ts +23 -0
- package/dist/breadcrumbs/index.js +10 -0
- package/dist/breadcrumbs/index.parts.d.ts +6 -0
- package/dist/breadcrumbs/index.parts.js +6 -0
- package/dist/breadcrumbs/item/breadcrumbs-item.svelte +42 -0
- package/dist/breadcrumbs/item/breadcrumbs-item.svelte.d.ts +4 -0
- package/dist/breadcrumbs/link/breadcrumbs-link.svelte +47 -0
- package/dist/breadcrumbs/link/breadcrumbs-link.svelte.d.ts +4 -0
- package/dist/breadcrumbs/list/breadcrumbs-list.svelte +31 -0
- package/dist/breadcrumbs/list/breadcrumbs-list.svelte.d.ts +4 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.svelte +112 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.svelte.d.ts +4 -0
- package/dist/breadcrumbs/root/context.d.ts +19 -0
- package/dist/breadcrumbs/root/context.js +15 -0
- package/dist/breadcrumbs/separator/breadcrumbs-separator.svelte +35 -0
- package/dist/breadcrumbs/separator/breadcrumbs-separator.svelte.d.ts +4 -0
- package/dist/breadcrumbs/types.d.ts +80 -0
- package/dist/breadcrumbs/types.js +1 -0
- package/dist/button/README.md +1 -1
- package/dist/button/root/button-root.svelte +37 -7
- package/dist/button/root/button-root.svelte.d.ts +19 -4
- package/dist/calendar/README.md +3 -3
- package/dist/calendar/body-cell/calendar-body-cell.svelte +7 -0
- package/dist/calendar/grid-header/calendar-grid-header.svelte +3 -4
- package/dist/calendar/grid-header/calendar-grid-header.svelte.d.ts +3 -4
- package/dist/calendar/root/calendar-root.svelte +8 -2
- package/dist/calendar/root/calendar-root.svelte.d.ts +8 -2
- package/dist/calendar/root/context.svelte.js +8 -2
- package/dist/calendar/trigger-next/README.md +1 -1
- package/dist/calendar/trigger-previous/README.md +1 -1
- package/dist/checkbox/README.md +1 -1
- package/dist/checkbox/indicator/README.md +1 -1
- package/dist/checkbox/indicator/checkbox-indicator.svelte +1 -0
- package/dist/checkbox/indicator/checkbox-indicator.svelte.d.ts +1 -0
- package/dist/checkbox/root/README.md +2 -2
- package/dist/checkbox/root/checkbox-root.svelte +133 -38
- package/dist/checkbox/root/checkbox-root.svelte.d.ts +21 -1
- package/dist/checkbox-group/README.md +95 -0
- package/dist/checkbox-group/index.d.ts +15 -0
- package/dist/checkbox-group/index.js +6 -0
- package/dist/checkbox-group/index.parts.d.ts +4 -0
- package/dist/checkbox-group/index.parts.js +7 -0
- package/dist/checkbox-group/label/checkbox-group-label.svelte +36 -0
- package/dist/checkbox-group/label/checkbox-group-label.svelte.d.ts +4 -0
- package/dist/checkbox-group/root/checkbox-group-root.svelte +118 -0
- package/dist/checkbox-group/root/checkbox-group-root.svelte.d.ts +4 -0
- package/dist/checkbox-group/root/context.svelte.d.ts +52 -0
- package/dist/checkbox-group/root/context.svelte.js +251 -0
- package/dist/checkbox-group/types.d.ts +57 -0
- package/dist/checkbox-group/types.js +1 -0
- package/dist/clock/README.md +3 -3
- package/dist/clock/axis/README.md +1 -1
- package/dist/clock/root/README.md +1 -1
- package/dist/clock/root/create-time-selection-state.svelte.d.ts +5 -0
- package/dist/clock/root/create-time-selection-state.svelte.js +113 -10
- package/dist/clock/root/wheel-options.d.ts +7 -3
- package/dist/clock/root/wheel-options.js +7 -15
- package/dist/clock/wheel-column/clock-wheel-column.svelte +10 -2
- package/dist/clock/wheel-column/clock-wheel-column.svelte.d.ts +2 -1
- package/dist/collapsible/README.md +3 -3
- package/dist/collapsible/root/collapsible-root.svelte +9 -4
- package/dist/collapsible/types.d.ts +13 -1
- package/dist/combobox/README.md +2 -2
- package/dist/combobox/button/README.md +6 -6
- package/dist/combobox/input/README.md +1 -1
- package/dist/combobox/input/combobox-input.svelte +15 -4
- package/dist/combobox/input/combobox-input.svelte.d.ts +3 -3
- package/dist/combobox/item/combobox-listboxitem.svelte +4 -2
- package/dist/combobox/item/combobox-listboxitem.svelte.d.ts +4 -2
- package/dist/combobox/item-indicator/README.md +1 -1
- package/dist/combobox/item-indicator/combobox-item-indicator.svelte +2 -2
- package/dist/combobox/item-indicator/combobox-item-indicator.svelte.d.ts +2 -2
- package/dist/combobox/list/combobox-listbox.svelte +98 -3
- package/dist/combobox/list/combobox-listbox.svelte.d.ts +28 -3
- package/dist/combobox/popover/README.md +1 -1
- package/dist/combobox/popover/combobox-popover.svelte +4 -56
- package/dist/combobox/root/README.md +24 -24
- package/dist/combobox/root/combobox.svelte +138 -56
- package/dist/combobox/root/combobox.svelte.d.ts +31 -11
- package/dist/combobox/root/context.d.ts +12 -0
- package/dist/combobox/status/README.md +3 -3
- package/dist/combobox/status/combobox-status.svelte +1 -1
- package/dist/combobox/status/combobox-status.svelte.d.ts +1 -1
- package/dist/combobox/tag/README.md +1 -1
- package/dist/combobox/tag/combobox-tag.svelte +1 -1
- package/dist/combobox/tag/combobox-tag.svelte.d.ts +1 -1
- package/dist/combobox/tag-remove/README.md +1 -1
- package/dist/combobox/tag-remove/combobox-tag-remove.svelte +14 -3
- package/dist/combobox/tag-remove/combobox-tag-remove.svelte.d.ts +7 -1
- package/dist/combobox/tags/README.md +1 -1
- package/dist/combobox/tags/combobox-tags.svelte +15 -12
- package/dist/combobox/tags/combobox-tags.svelte.d.ts +12 -10
- package/dist/combobox/trigger/README.md +7 -7
- package/dist/combobox/trigger/combobox-trigger.svelte +4 -1
- package/dist/datepicker/README.md +5 -4
- package/dist/datepicker/input/date-picker-input.svelte +3 -4
- package/dist/datepicker/input/date-picker-input.svelte.d.ts +3 -4
- package/dist/datepicker/root/date-picker-root.svelte +38 -2
- package/dist/datepicker/root/date-picker-root.svelte.d.ts +2 -0
- package/dist/datepicker/root/draft-evaluation.d.ts +7 -0
- package/dist/datepicker/root/draft-evaluation.js +2 -2
- package/dist/datepicker/trigger/README.md +1 -1
- package/dist/daterangepicker/README.md +3 -3
- package/dist/daterangepicker/input/date-range-picker-input.svelte +3 -4
- package/dist/daterangepicker/input/date-range-picker-input.svelte.d.ts +3 -4
- package/dist/daterangepicker/root/date-range-picker-root.svelte +19 -1
- package/dist/daterangepicker/root/date-range-picker-root.svelte.d.ts +2 -0
- package/dist/dialog/README.md +10 -2
- package/dist/dialog/close/dialog-close.svelte +57 -0
- package/dist/dialog/close/dialog-close.svelte.d.ts +19 -0
- package/dist/dialog/content/dialog-content.svelte +6 -4
- package/dist/dialog/content/dialog-content.svelte.d.ts +4 -4
- package/dist/dialog/description/dialog-description.svelte +46 -0
- package/dist/dialog/description/dialog-description.svelte.d.ts +20 -0
- package/dist/dialog/index.d.ts +9 -0
- package/dist/dialog/index.js +3 -0
- package/dist/dialog/index.parts.d.ts +3 -0
- package/dist/dialog/index.parts.js +3 -0
- package/dist/dialog/overlay/dialog-overlay.svelte +1 -1
- package/dist/dialog/overlay/dialog-overlay.svelte.d.ts +1 -1
- package/dist/dialog/portal/dialog-portal.svelte +1 -1
- package/dist/dialog/portal/dialog-portal.svelte.d.ts +1 -1
- package/dist/dialog/root/README.md +1 -1
- package/dist/dialog/root/context.d.ts +8 -0
- package/dist/dialog/root/dialog-root.svelte +100 -20
- package/dist/dialog/root/dialog-root.svelte.d.ts +15 -6
- package/dist/dialog/root/dialog-stack.d.ts +6 -22
- package/dist/dialog/root/dialog-stack.js +4 -33
- package/dist/dialog/title/dialog-title.svelte +43 -0
- package/dist/dialog/title/dialog-title.svelte.d.ts +21 -0
- package/dist/dialog/trigger/README.md +1 -1
- package/dist/drawer/README.md +111 -0
- package/dist/drawer/body/drawer-body.svelte +47 -0
- package/dist/drawer/body/drawer-body.svelte.d.ts +32 -0
- package/dist/drawer/close/drawer-close.svelte +52 -0
- package/dist/drawer/close/drawer-close.svelte.d.ts +20 -0
- package/dist/drawer/content/drawer-content.svelte +600 -0
- package/dist/drawer/content/drawer-content.svelte.d.ts +31 -0
- package/dist/drawer/description/drawer-description.svelte +40 -0
- package/dist/drawer/description/drawer-description.svelte.d.ts +20 -0
- package/dist/drawer/indent/drawer-indent-background.svelte +36 -0
- package/dist/drawer/indent/drawer-indent-background.svelte.d.ts +17 -0
- package/dist/drawer/indent/drawer-indent.svelte +59 -0
- package/dist/drawer/indent/drawer-indent.svelte.d.ts +32 -0
- package/dist/drawer/index.d.ts +49 -0
- package/dist/drawer/index.js +25 -0
- package/dist/drawer/index.parts.d.ts +14 -0
- package/dist/drawer/index.parts.js +15 -0
- package/dist/drawer/overlay/drawer-overlay.svelte +67 -0
- package/dist/drawer/overlay/drawer-overlay.svelte.d.ts +12 -0
- package/dist/drawer/portal/drawer-portal.svelte +57 -0
- package/dist/drawer/portal/drawer-portal.svelte.d.ts +13 -0
- package/dist/drawer/root/context.d.ts +81 -0
- package/dist/drawer/root/context.js +20 -0
- package/dist/drawer/root/drawer-root.svelte +348 -0
- package/dist/drawer/root/drawer-root.svelte.d.ts +79 -0
- package/dist/drawer/root/drawer-stack.svelte.d.ts +73 -0
- package/dist/drawer/root/drawer-stack.svelte.js +113 -0
- package/dist/drawer/root/handle.svelte.d.ts +39 -0
- package/dist/drawer/root/handle.svelte.js +64 -0
- package/dist/drawer/root/keyboard-context.d.ts +13 -0
- package/dist/drawer/root/keyboard-context.js +8 -0
- package/dist/drawer/root/presence-context.d.ts +22 -0
- package/dist/drawer/root/presence-context.js +8 -0
- package/dist/drawer/root/snap-points.d.ts +68 -0
- package/dist/drawer/root/snap-points.js +120 -0
- package/dist/drawer/root/starting-style.svelte.d.ts +18 -0
- package/dist/drawer/root/starting-style.svelte.js +38 -0
- package/dist/drawer/root/types.d.ts +36 -0
- package/dist/drawer/root/types.js +1 -0
- package/dist/drawer/root/viewport-context.d.ts +2 -0
- package/dist/drawer/root/viewport-context.js +16 -0
- package/dist/drawer/swipe-area/drawer-swipe-area.svelte +143 -0
- package/dist/drawer/swipe-area/drawer-swipe-area.svelte.d.ts +22 -0
- package/dist/drawer/title/drawer-title.svelte +37 -0
- package/dist/drawer/title/drawer-title.svelte.d.ts +21 -0
- package/dist/drawer/trigger/drawer-trigger.svelte +90 -0
- package/dist/drawer/trigger/drawer-trigger.svelte.d.ts +41 -0
- package/dist/drawer/viewport/drawer-viewport.svelte +69 -0
- package/dist/drawer/viewport/drawer-viewport.svelte.d.ts +15 -0
- package/dist/drawer/virtual-keyboard/drawer-virtual-keyboard-provider.svelte +88 -0
- package/dist/drawer/virtual-keyboard/drawer-virtual-keyboard-provider.svelte.d.ts +29 -0
- package/dist/dropzone/README.md +4 -6
- package/dist/hooks/use-virtual-focus.svelte.d.ts +9 -0
- package/dist/hooks/use-virtual-focus.svelte.js +7 -1
- package/dist/index.d.ts +24 -0
- package/dist/index.js +23 -0
- package/dist/input/input.svelte +6 -6
- package/dist/input/input.svelte.d.ts +6 -6
- package/dist/internal/environment.d.ts +11 -0
- package/dist/internal/environment.js +14 -0
- package/dist/internal/localized-strings.d.ts +152 -0
- package/dist/internal/localized-strings.js +152 -0
- package/dist/internal/number-precision.d.ts +9 -0
- package/dist/internal/number-precision.js +27 -0
- package/dist/listbox/README.md +20 -1
- package/dist/listbox/item/listbox-item.svelte +43 -18
- package/dist/listbox/item/listbox-item.svelte.d.ts +24 -15
- package/dist/listbox/root/README.md +1 -1
- package/dist/listbox/root/context.d.ts +56 -1
- package/dist/listbox/root/context.js +118 -1
- package/dist/listbox/root/listbox.svelte +400 -27
- package/dist/listbox/root/listbox.svelte.d.ts +73 -16
- package/dist/locale-provider/README.md +1 -6
- package/dist/menu/README.md +41 -4
- package/dist/menu/content/menu-content.svelte +31 -14
- package/dist/menu/content/menu-content.svelte.d.ts +14 -9
- package/dist/menu/context-trigger/menu-context-trigger.svelte +194 -0
- package/dist/menu/context-trigger/menu-context-trigger.svelte.d.ts +35 -0
- package/dist/menu/group/menu-group-label.svelte +1 -1
- package/dist/menu/group/menu-group-label.svelte.d.ts +1 -1
- package/dist/menu/index.d.ts +4 -1
- package/dist/menu/index.js +1 -0
- package/dist/menu/index.parts.d.ts +1 -0
- package/dist/menu/index.parts.js +1 -0
- package/dist/menu/item/menu-item.svelte +11 -8
- package/dist/menu/item/menu-item.svelte.d.ts +11 -8
- package/dist/menu/overlay/menu-overlay.svelte +2 -2
- package/dist/menu/overlay/menu-overlay.svelte.d.ts +1 -1
- package/dist/menu/root/context.d.ts +24 -3
- package/dist/menu/root/focus-state.d.ts +2 -2
- package/dist/menu/root/focus-state.js +8 -32
- package/dist/menu/root/menu-root.svelte +14 -8
- package/dist/menu/root/menu-root.svelte.d.ts +14 -8
- package/dist/menu/root/menu-state.svelte.d.ts +1 -1
- package/dist/menu/root/menu-state.svelte.js +24 -1
- package/dist/menu/separator/menu-separator.svelte +1 -1
- package/dist/menu/separator/menu-separator.svelte.d.ts +1 -1
- package/dist/menu/submenu/menu-submenu-root.svelte +10 -7
- package/dist/menu/submenu/menu-submenu-root.svelte.d.ts +10 -7
- package/dist/numberfield/root/README.md +1 -1
- package/dist/numberfield/root/number-field-root.svelte +2 -1
- package/dist/numberfield/root/number-utils.js +1 -20
- package/dist/numberfield/scrub-area-cursor/README.md +1 -1
- package/dist/popover/README.md +1 -1
- package/dist/popover/content/popover-content.svelte +22 -16
- package/dist/popover/content/popover-content.svelte.d.ts +19 -14
- package/dist/popover/overlay/popover-overlay.svelte +2 -2
- package/dist/popover/overlay/popover-overlay.svelte.d.ts +1 -1
- package/dist/popover/root/README.md +1 -1
- package/dist/popover/root/focus-state.d.ts +2 -2
- package/dist/popover/root/focus-state.js +7 -34
- package/dist/popover/root/popover-root.svelte +29 -14
- package/dist/popover/root/popover-root.svelte.d.ts +16 -5
- package/dist/popover/trigger/README.md +1 -1
- package/dist/primitives/aria-hide-outside.d.ts +13 -0
- package/dist/primitives/aria-hide-outside.js +7 -1
- package/dist/primitives/contain-wheel.d.ts +9 -0
- package/dist/primitives/contain-wheel.js +41 -0
- package/dist/primitives/floating.d.ts +49 -8
- package/dist/primitives/floating.js +75 -7
- package/dist/primitives/focus-trap.d.ts +2 -0
- package/dist/primitives/focus-trap.js +7 -1
- package/dist/primitives/focus-visible.svelte.d.ts +14 -0
- package/dist/primitives/focus-visible.svelte.js +19 -0
- package/dist/primitives/index.d.ts +3 -0
- package/dist/primitives/index.js +3 -0
- package/dist/primitives/input-modality.d.ts +7 -0
- package/dist/primitives/input-modality.js +32 -5
- package/dist/primitives/keyboard-navigation.d.ts +29 -5
- package/dist/primitives/keyboard-navigation.js +27 -17
- package/dist/primitives/layer-stack.d.ts +29 -0
- package/dist/primitives/layer-stack.js +35 -0
- package/dist/primitives/list-virtualizer.d.ts +75 -0
- package/dist/primitives/list-virtualizer.js +59 -0
- package/dist/primitives/long-press.d.ts +59 -0
- package/dist/primitives/long-press.js +142 -0
- package/dist/primitives/presence.svelte.js +6 -1
- package/dist/primitives/scroll-lock.d.ts +47 -3
- package/dist/primitives/scroll-lock.js +191 -9
- package/dist/primitives/swipe-gesture.d.ts +126 -0
- package/dist/primitives/swipe-gesture.js +351 -0
- package/dist/primitives/text.d.ts +8 -0
- package/dist/primitives/text.js +13 -0
- package/dist/primitives/trigger-focus-state.d.ts +29 -0
- package/dist/primitives/trigger-focus-state.js +57 -0
- package/dist/progress/README.md +54 -0
- package/dist/progress/index.d.ts +21 -0
- package/dist/progress/index.js +9 -0
- package/dist/progress/index.parts.d.ts +5 -0
- package/dist/progress/index.parts.js +5 -0
- package/dist/progress/indicator/progress-indicator.svelte +37 -0
- package/dist/progress/indicator/progress-indicator.svelte.d.ts +4 -0
- package/dist/progress/label/progress-label.svelte +34 -0
- package/dist/progress/label/progress-label.svelte.d.ts +4 -0
- package/dist/progress/root/context.d.ts +26 -0
- package/dist/progress/root/context.js +15 -0
- package/dist/progress/root/progress-root.svelte +136 -0
- package/dist/progress/root/progress-root.svelte.d.ts +4 -0
- package/dist/progress/root/progress-utils.d.ts +12 -0
- package/dist/progress/root/progress-utils.js +41 -0
- package/dist/progress/track/progress-track.svelte +27 -0
- package/dist/progress/track/progress-track.svelte.d.ts +4 -0
- package/dist/progress/types.d.ts +81 -0
- package/dist/progress/types.js +1 -0
- package/dist/progress/value/progress-value.svelte +36 -0
- package/dist/progress/value/progress-value.svelte.d.ts +4 -0
- package/dist/radio-group/README.md +103 -0
- package/dist/radio-group/index.d.ts +18 -0
- package/dist/radio-group/index.js +9 -0
- package/dist/radio-group/index.parts.d.ts +4 -0
- package/dist/radio-group/index.parts.js +4 -0
- package/dist/radio-group/indicator/radio-group-indicator.svelte +43 -0
- package/dist/radio-group/indicator/radio-group-indicator.svelte.d.ts +12 -0
- package/dist/radio-group/item/context.d.ts +18 -0
- package/dist/radio-group/item/context.js +15 -0
- package/dist/radio-group/item/radio-group-item.svelte +377 -0
- package/dist/radio-group/item/radio-group-item.svelte.d.ts +35 -0
- package/dist/radio-group/label/radio-group-label.svelte +37 -0
- package/dist/radio-group/label/radio-group-label.svelte.d.ts +4 -0
- package/dist/radio-group/root/context.svelte.d.ts +57 -0
- package/dist/radio-group/root/context.svelte.js +284 -0
- package/dist/radio-group/root/radio-group-root.svelte +193 -0
- package/dist/radio-group/root/radio-group-root.svelte.d.ts +4 -0
- package/dist/radio-group/types.d.ts +50 -0
- package/dist/radio-group/types.js +1 -0
- package/dist/select/README.md +129 -0
- package/dist/select/index.d.ts +30 -0
- package/dist/select/index.js +16 -0
- package/dist/select/index.parts.d.ts +8 -0
- package/dist/select/index.parts.js +9 -0
- package/dist/select/item/select-item.svelte +68 -0
- package/dist/select/item/select-item.svelte.d.ts +10 -0
- package/dist/select/item-indicator/select-item-indicator.svelte +55 -0
- package/dist/select/item-indicator/select-item-indicator.svelte.d.ts +4 -0
- package/dist/select/label/select-label.svelte +46 -0
- package/dist/select/label/select-label.svelte.d.ts +4 -0
- package/dist/select/list/select-list.svelte +241 -0
- package/dist/select/list/select-list.svelte.d.ts +62 -0
- package/dist/select/popover/select-popover.svelte +80 -0
- package/dist/select/popover/select-popover.svelte.d.ts +9 -0
- package/dist/select/root/context.d.ts +106 -0
- package/dist/select/root/context.js +22 -0
- package/dist/select/root/select-root.svelte +544 -0
- package/dist/select/root/select-root.svelte.d.ts +25 -0
- package/dist/select/trigger/select-trigger.svelte +192 -0
- package/dist/select/trigger/select-trigger.svelte.d.ts +4 -0
- package/dist/select/types.d.ts +133 -0
- package/dist/select/types.js +1 -0
- package/dist/select/value/select-value.svelte +61 -0
- package/dist/select/value/select-value.svelte.d.ts +4 -0
- package/dist/separator/README.md +35 -0
- package/dist/separator/index.d.ts +7 -0
- package/dist/separator/index.js +3 -0
- package/dist/separator/separator.svelte +254 -0
- package/dist/separator/separator.svelte.d.ts +45 -0
- package/dist/separator/types.d.ts +1 -0
- package/dist/separator/types.js +1 -0
- package/dist/slider/README.md +61 -0
- package/dist/slider/fill/slider-fill.svelte +40 -0
- package/dist/slider/fill/slider-fill.svelte.d.ts +4 -0
- package/dist/slider/index.d.ts +9 -0
- package/dist/slider/index.js +8 -0
- package/dist/slider/index.parts.d.ts +6 -0
- package/dist/slider/index.parts.js +6 -0
- package/dist/slider/label/slider-label.svelte +44 -0
- package/dist/slider/label/slider-label.svelte.d.ts +4 -0
- package/dist/slider/output/slider-output.svelte +46 -0
- package/dist/slider/output/slider-output.svelte.d.ts +4 -0
- package/dist/slider/root/context.d.ts +106 -0
- package/dist/slider/root/context.js +15 -0
- package/dist/slider/root/slider-root.svelte +545 -0
- package/dist/slider/root/slider-root.svelte.d.ts +4 -0
- package/dist/slider/root/slider-utils.d.ts +57 -0
- package/dist/slider/root/slider-utils.js +88 -0
- package/dist/slider/thumb/slider-thumb.svelte +276 -0
- package/dist/slider/thumb/slider-thumb.svelte.d.ts +4 -0
- package/dist/slider/track/slider-track.svelte +60 -0
- package/dist/slider/track/slider-track.svelte.d.ts +4 -0
- package/dist/slider/types.d.ts +144 -0
- package/dist/slider/types.js +1 -0
- package/dist/switch/root/README.md +2 -2
- package/dist/switch/root/switch-root.svelte +49 -21
- package/dist/switch/root/switch-root.svelte.d.ts +26 -14
- package/dist/switch/thumb/switch-thumb.svelte +1 -1
- package/dist/switch/thumb/switch-thumb.svelte.d.ts +1 -1
- package/dist/table/README.md +16 -9
- package/dist/table/body/table-body.svelte +84 -9
- package/dist/table/cell/table-cell.svelte +27 -10
- package/dist/table/checkbox/table-checkbox.svelte +3 -0
- package/dist/table/checkbox-indicator/README.md +1 -1
- package/dist/table/column/table-column.svelte +5 -1
- package/dist/table/column-header-cell/table-column-header-cell.svelte +24 -0
- package/dist/table/column-resizer/README.md +2 -2
- package/dist/table/column-resizer/table-column-resizer.svelte +1 -5
- package/dist/table/index.d.ts +1 -1
- package/dist/table/index.js +1 -1
- package/dist/table/interactive-cell/table-interactive-cell.svelte +26 -10
- package/dist/table/root/README.md +1 -1
- package/dist/table/root/context.svelte.d.ts +17 -0
- package/dist/table/root/context.svelte.js +212 -66
- package/dist/table/root/table-root.svelte +36 -6
- package/dist/table/row/table-row.svelte +14 -14
- package/dist/table/sort-trigger/README.md +1 -1
- package/dist/table/sort-trigger/table-sort-trigger.svelte +5 -1
- package/dist/table/types.d.ts +32 -14
- package/dist/tabs/root/tabs-root.svelte +20 -6
- package/dist/tabs/types.d.ts +9 -0
- package/dist/timepicker/README.md +3 -2
- package/dist/timepicker/input/README.md +1 -1
- package/dist/timepicker/input/time-picker-input.svelte +66 -5
- package/dist/timepicker/input/time-picker-input.svelte.d.ts +18 -1
- package/dist/timepicker/root/README.md +1 -1
- package/dist/timepicker/root/time-picker-root.svelte +11 -0
- package/dist/timepicker/root/time-picker-root.svelte.d.ts +2 -0
- package/dist/timepicker/trigger/README.md +1 -1
- package/dist/toast/README.md +75 -0
- package/dist/toast/action/toast-action.svelte +42 -0
- package/dist/toast/action/toast-action.svelte.d.ts +4 -0
- package/dist/toast/close/toast-close.svelte +41 -0
- package/dist/toast/close/toast-close.svelte.d.ts +4 -0
- package/dist/toast/content/toast-content.svelte +24 -0
- package/dist/toast/content/toast-content.svelte.d.ts +4 -0
- package/dist/toast/description/toast-description.svelte +41 -0
- package/dist/toast/description/toast-description.svelte.d.ts +4 -0
- package/dist/toast/index.d.ts +34 -0
- package/dist/toast/index.js +15 -0
- package/dist/toast/index.parts.d.ts +9 -0
- package/dist/toast/index.parts.js +9 -0
- package/dist/toast/positioner/toast-positioner.svelte +75 -0
- package/dist/toast/positioner/toast-positioner.svelte.d.ts +4 -0
- package/dist/toast/provider/context.d.ts +36 -0
- package/dist/toast/provider/context.js +22 -0
- package/dist/toast/provider/toast-manager.svelte.d.ts +113 -0
- package/dist/toast/provider/toast-manager.svelte.js +210 -0
- package/dist/toast/provider/toast-provider.svelte +98 -0
- package/dist/toast/provider/toast-provider.svelte.d.ts +4 -0
- package/dist/toast/root/context.d.ts +18 -0
- package/dist/toast/root/context.js +15 -0
- package/dist/toast/root/toast-root.svelte +296 -0
- package/dist/toast/root/toast-root.svelte.d.ts +4 -0
- package/dist/toast/title/toast-title.svelte +38 -0
- package/dist/toast/title/toast-title.svelte.d.ts +4 -0
- package/dist/toast/types.d.ts +100 -0
- package/dist/toast/types.js +1 -0
- package/dist/toast/viewport/toast-viewport.svelte +389 -0
- package/dist/toast/viewport/toast-viewport.svelte.d.ts +4 -0
- package/dist/toggle/README.md +1 -1
- package/dist/toggle/root/toggle-root.svelte +28 -0
- package/dist/toggle/root/toggle-root.svelte.d.ts +19 -0
- package/dist/toggle-group/README.md +12 -4
- package/dist/toggle-group/index.d.ts +2 -0
- package/dist/toggle-group/index.parts.d.ts +1 -0
- package/dist/toggle-group/index.parts.js +4 -0
- package/dist/toggle-group/root/context.svelte.d.ts +1 -1
- package/dist/toggle-group/root/context.svelte.js +24 -8
- package/dist/toggle-group/root/toggle-group-root.svelte +24 -4
- package/dist/toggle-group/root/toggle-group-teardown-order-child.svelte +13 -0
- package/dist/toggle-group/root/toggle-group-teardown-order-child.svelte.d.ts +7 -0
- package/dist/toggle-group/types.d.ts +9 -0
- package/dist/tooltip/README.md +53 -0
- package/dist/tooltip/arrow/tooltip-arrow.svelte +36 -0
- package/dist/tooltip/arrow/tooltip-arrow.svelte.d.ts +4 -0
- package/dist/tooltip/content/tooltip-content.svelte +148 -0
- package/dist/tooltip/content/tooltip-content.svelte.d.ts +4 -0
- package/dist/tooltip/index.d.ts +8 -0
- package/dist/tooltip/index.js +7 -0
- package/dist/tooltip/index.parts.d.ts +5 -0
- package/dist/tooltip/index.parts.js +5 -0
- package/dist/tooltip/provider/tooltip-provider.svelte +36 -0
- package/dist/tooltip/provider/tooltip-provider.svelte.d.ts +4 -0
- package/dist/tooltip/root/context.d.ts +46 -0
- package/dist/tooltip/root/context.js +22 -0
- package/dist/tooltip/root/safe-polygon.d.ts +26 -0
- package/dist/tooltip/root/safe-polygon.js +66 -0
- package/dist/tooltip/root/tooltip-group.d.ts +26 -0
- package/dist/tooltip/root/tooltip-group.js +41 -0
- package/dist/tooltip/root/tooltip-root.svelte +461 -0
- package/dist/tooltip/root/tooltip-root.svelte.d.ts +4 -0
- package/dist/tooltip/trigger/tooltip-trigger.svelte +52 -0
- package/dist/tooltip/trigger/tooltip-trigger.svelte.d.ts +4 -0
- package/dist/tooltip/types.d.ts +105 -0
- package/dist/tooltip/types.js +1 -0
- package/dist/transfer-list/README.md +110 -0
- package/dist/transfer-list/index.d.ts +33 -0
- package/dist/transfer-list/index.js +18 -0
- package/dist/transfer-list/index.parts.d.ts +9 -0
- package/dist/transfer-list/index.parts.js +10 -0
- package/dist/transfer-list/item/transfer-list-item.svelte +74 -0
- package/dist/transfer-list/item/transfer-list-item.svelte.d.ts +35 -0
- package/dist/transfer-list/list/transfer-list-list.svelte +162 -0
- package/dist/transfer-list/list/transfer-list-list.svelte.d.ts +56 -0
- package/dist/transfer-list/list/transfer-list-source.svelte +13 -0
- package/dist/transfer-list/list/transfer-list-source.svelte.d.ts +36 -0
- package/dist/transfer-list/list/transfer-list-target.svelte +14 -0
- package/dist/transfer-list/list/transfer-list-target.svelte.d.ts +36 -0
- package/dist/transfer-list/move/transfer-list-move-all.svelte +14 -0
- package/dist/transfer-list/move/transfer-list-move-all.svelte.d.ts +10 -0
- package/dist/transfer-list/move/transfer-list-move-button.svelte +103 -0
- package/dist/transfer-list/move/transfer-list-move-button.svelte.d.ts +25 -0
- package/dist/transfer-list/move/transfer-list-move-down.svelte +14 -0
- package/dist/transfer-list/move/transfer-list-move-down.svelte.d.ts +10 -0
- package/dist/transfer-list/move/transfer-list-move-selected.svelte +14 -0
- package/dist/transfer-list/move/transfer-list-move-selected.svelte.d.ts +10 -0
- package/dist/transfer-list/move/transfer-list-move-up.svelte +14 -0
- package/dist/transfer-list/move/transfer-list-move-up.svelte.d.ts +10 -0
- package/dist/transfer-list/move/transfer-list-reorder-button.svelte +83 -0
- package/dist/transfer-list/move/transfer-list-reorder-button.svelte.d.ts +21 -0
- package/dist/transfer-list/root/context.d.ts +70 -0
- package/dist/transfer-list/root/context.js +24 -0
- package/dist/transfer-list/root/transfer-list-root.svelte +345 -0
- package/dist/transfer-list/root/transfer-list-root.svelte.d.ts +68 -0
- package/dist/transfer-list/root/types.d.ts +22 -0
- package/dist/transfer-list/root/types.js +4 -0
- package/dist/transfer-list/status/transfer-list-status.svelte +70 -0
- package/dist/transfer-list/status/transfer-list-status.svelte.d.ts +15 -0
- package/dist/tree/README.md +3 -3
- package/dist/tree/checkbox-indicator/README.md +1 -1
- package/dist/tree/root/README.md +1 -1
- package/dist/tree/root/context.svelte.js +6 -0
- package/dist/tree/root/tree-root.svelte +22 -8
- package/dist/tree/types.d.ts +23 -1
- package/package.json +282 -224
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { untrack, type Snippet } from 'svelte';
|
|
3
3
|
import { SvelteMap, SvelteSet } from 'svelte/reactivity';
|
|
4
4
|
import { dev } from '../../internal/environment';
|
|
5
|
+
import { foldForSearch } from '../../primitives/text';
|
|
5
6
|
import {
|
|
6
7
|
setComboBoxContext,
|
|
7
8
|
type ComboBoxContext,
|
|
@@ -17,39 +18,59 @@
|
|
|
17
18
|
} from '../../primitives/input-modality';
|
|
18
19
|
|
|
19
20
|
type ComboBoxProps<T> = {
|
|
20
|
-
/**
|
|
21
|
+
/** A stable id, from which the component makes its internal ARIA ids. Give one on a server. */
|
|
21
22
|
id?: string;
|
|
22
23
|
disabled?: boolean;
|
|
23
24
|
pending?: boolean;
|
|
24
25
|
readonly?: boolean;
|
|
25
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* The selected value or values: one value in the single mode, and an array in the multiple mode.
|
|
28
|
+
* You can bind it with `bind:value`.
|
|
29
|
+
*/
|
|
26
30
|
value?: string | number | null | (string | number)[];
|
|
27
31
|
defaultValue?: string | number | null | (string | number)[];
|
|
28
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Give your own code full control of the selection. The component stops to write back to
|
|
34
|
+
* `value`, and it reports only through `onChange`. Thus the parent can refuse a change: the
|
|
35
|
+
* parent does not send the new value down. The default is off, because `bind:value` is the usual
|
|
36
|
+
* case and it needs the write-back.
|
|
37
|
+
*/
|
|
38
|
+
controlledValue?: boolean;
|
|
39
|
+
/** The text in the input. You can bind it with `bind:inputValue`. */
|
|
29
40
|
inputValue?: string;
|
|
30
41
|
defaultInputValue?: string;
|
|
42
|
+
/** Give your own code full control of the input text. Read `controlledValue`. */
|
|
43
|
+
controlledInputValue?: boolean;
|
|
31
44
|
selectionBehavior?: 'toggle' | 'replace';
|
|
32
45
|
selectionMode?: 'single' | 'multiple';
|
|
33
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Closes the popover after a selection. The default is true in the single mode, and false in the
|
|
48
|
+
* multiple mode.
|
|
49
|
+
*/
|
|
34
50
|
closeOnSelect?: boolean;
|
|
35
|
-
/**
|
|
51
|
+
/** The open state of the popover. You can bind it with `bind:open`. */
|
|
36
52
|
open?: boolean;
|
|
37
|
-
/**
|
|
53
|
+
/** Give your own code full control of the open state. Read `controlledValue`. */
|
|
54
|
+
controlledOpen?: boolean;
|
|
55
|
+
/** What opens the popover: 'focus', 'input', or 'press'. The default is 'press'. */
|
|
38
56
|
trigger?: 'focus' | 'input' | 'press';
|
|
39
|
-
/**
|
|
57
|
+
/** The function that filters the items locally. Set it to null to stop the local filter. */
|
|
40
58
|
filter?: ComboBoxFilter | null;
|
|
41
|
-
/**
|
|
59
|
+
/** Puts the items that have an `onAction` function into the local filter. */
|
|
42
60
|
filterActionItems?: boolean;
|
|
43
61
|
onInputChange?: (value: string) => void;
|
|
44
62
|
onOpenChange?: (open: boolean) => void;
|
|
45
63
|
onChange?: (value: string | number | null | (string | number)[]) => void;
|
|
46
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* The array of the items. The component uses it to find the names of the selected values before
|
|
66
|
+
* the options go into the DOM.
|
|
67
|
+
*/
|
|
47
68
|
items?: T[];
|
|
48
69
|
children?: Snippet;
|
|
49
70
|
class?: string;
|
|
50
|
-
/**
|
|
71
|
+
/** The accessible name of the combobox group. */
|
|
51
72
|
'aria-label'?: string;
|
|
52
|
-
/**
|
|
73
|
+
/** The id of the element that gives this combobox group its name. */
|
|
53
74
|
'aria-labelledby'?: string;
|
|
54
75
|
};
|
|
55
76
|
|
|
@@ -62,12 +83,15 @@
|
|
|
62
83
|
readonly = false,
|
|
63
84
|
value = $bindable(),
|
|
64
85
|
defaultValue,
|
|
86
|
+
controlledValue = false,
|
|
65
87
|
inputValue = $bindable(),
|
|
66
88
|
defaultInputValue = '',
|
|
89
|
+
controlledInputValue = false,
|
|
67
90
|
selectionBehavior,
|
|
68
91
|
selectionMode = 'single',
|
|
69
92
|
closeOnSelect,
|
|
70
93
|
open: openProp = $bindable(),
|
|
94
|
+
controlledOpen = false,
|
|
71
95
|
trigger = 'press',
|
|
72
96
|
filter = defaultComboBoxFilter,
|
|
73
97
|
filterActionItems = true,
|
|
@@ -81,8 +105,16 @@
|
|
|
81
105
|
'aria-labelledby': ariaLabelledby
|
|
82
106
|
}: ComboBoxProps<T> = $props();
|
|
83
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Substring match, blind to case *and* to accents: typing `tulua` finds `TULUÁ` and
|
|
110
|
+
* `medellin` finds `MEDELLÍN`.
|
|
111
|
+
*
|
|
112
|
+
* Folding the diacritics is not a nicety in a language that has them — a list of Colombian
|
|
113
|
+
* municipalities is unusable when the user has to reproduce every accent to find a row,
|
|
114
|
+
* and nobody types them into a search box.
|
|
115
|
+
*/
|
|
84
116
|
function defaultComboBoxFilter(textValue: string, inputValue: string) {
|
|
85
|
-
return textValue
|
|
117
|
+
return foldForSearch(textValue).includes(foldForSearch(inputValue.trim()));
|
|
86
118
|
}
|
|
87
119
|
|
|
88
120
|
const instanceId = untrack(() => rootId) ?? generatedInstanceId;
|
|
@@ -101,11 +133,21 @@
|
|
|
101
133
|
let listboxRef: HTMLElement | null = $state(null);
|
|
102
134
|
|
|
103
135
|
let isOpenInternal = $state(false);
|
|
104
|
-
|
|
105
|
-
//
|
|
136
|
+
// Set by ComboBox.List when it virtualizes. Only then is the DOM an incomplete picture of
|
|
137
|
+
// the list, so only then does navigation switch to the item array.
|
|
138
|
+
let isListVirtualized = $state(false);
|
|
139
|
+
|
|
140
|
+
// Use virtual focus hook for navigation.
|
|
141
|
+
//
|
|
142
|
+
// `orderedIds` matters for a virtualized list: without it the hook reads the order off
|
|
143
|
+
// the DOM, and a virtualized listbox only has the rows near the viewport mounted — so
|
|
144
|
+
// End would land on the last *rendered* option and ArrowDown would stop at the edge of
|
|
145
|
+
// the window. When `items` is given, the array is the authority on order and length,
|
|
146
|
+
// mounted or not.
|
|
106
147
|
const navigation = useVirtualFocus({
|
|
107
148
|
instanceId,
|
|
108
|
-
containerRef: () => listboxRef
|
|
149
|
+
containerRef: () => listboxRef,
|
|
150
|
+
orderedIds: () => (isListVirtualized && items ? filteredItemIds : undefined)
|
|
109
151
|
});
|
|
110
152
|
|
|
111
153
|
// Persistent label of the selected item (for restore on blur/escape)
|
|
@@ -233,26 +275,63 @@
|
|
|
233
275
|
let inputValueInternal = $state(getInitialInputValue());
|
|
234
276
|
let selectedInternal = $state<Set<string | number>>((() => parseSelection(defaultValue))());
|
|
235
277
|
|
|
236
|
-
//
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
const
|
|
278
|
+
// Controlled-ness is opt-in per prop, not inferred from the prop being defined:
|
|
279
|
+
// `bind:value` and `value={...}` are indistinguishable at runtime. These used to be
|
|
280
|
+
// inferred, and every write below ignored the result anyway — so a controlled parent
|
|
281
|
+
// could not reject anything; the combobox moved regardless of what `onChange` decided.
|
|
282
|
+
const isOpenControlled = $derived(controlledOpen);
|
|
283
|
+
const isInputControlled = $derived(controlledInputValue);
|
|
284
|
+
const isSelectionControlled = $derived(controlledValue);
|
|
285
|
+
|
|
286
|
+
// The prop wins whenever it is supplied — that covers both `bind:` and a plain
|
|
287
|
+
// value — and the internal state only carries the fully uncontrolled case.
|
|
288
|
+
const currentIsOpen = $derived(
|
|
289
|
+
isOpenControlled ? Boolean(openProp) : (openProp ?? isOpenInternal)
|
|
290
|
+
);
|
|
291
|
+
const currentInputValue = $derived(
|
|
292
|
+
isInputControlled ? inputValue! : (inputValue ?? inputValueInternal)
|
|
293
|
+
);
|
|
243
294
|
const currentSelection = $derived(
|
|
244
|
-
isSelectionControlled ? parseSelection(value) : selectedInternal
|
|
295
|
+
isSelectionControlled || value !== undefined ? parseSelection(value) : selectedInternal
|
|
245
296
|
);
|
|
246
297
|
|
|
247
298
|
// Input value used for filtering - empty when shouldFilter is false
|
|
248
299
|
const filterValue = $derived(shouldFilter ? currentInputValue : '');
|
|
249
300
|
|
|
301
|
+
/**
|
|
302
|
+
* The items that pass the local filter, in order.
|
|
303
|
+
*
|
|
304
|
+
* Filtering normally happens per item (each `ComboBox.Item` hides itself), which cannot
|
|
305
|
+
* work when the list is virtualized: an item that was never rendered can neither hide nor
|
|
306
|
+
* count itself. Resolving it here — the same predicate, applied to the array — gives the
|
|
307
|
+
* listbox something to slice and the navigation something to walk.
|
|
308
|
+
*/
|
|
309
|
+
const filteredItems = $derived.by(() => {
|
|
310
|
+
if (!items) return [];
|
|
311
|
+
|
|
312
|
+
const search = filterValue.trim();
|
|
313
|
+
if (!search || filter === null) return items;
|
|
314
|
+
|
|
315
|
+
return items.filter((item) => {
|
|
316
|
+
const textValue = getInternalItemTextValue(item);
|
|
317
|
+
return textValue === undefined ? true : filter(textValue, filterValue);
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
const filteredItemIds = $derived(
|
|
322
|
+
filteredItems
|
|
323
|
+
.map((item) => getInternalItemValue(item))
|
|
324
|
+
.filter((id): id is string | number => id !== undefined)
|
|
325
|
+
);
|
|
326
|
+
|
|
250
327
|
function setIsOpen(open: boolean) {
|
|
251
328
|
// No-op guard: prevents duplicate onOpenChange notifications when close
|
|
252
329
|
// is requested twice (e.g. Escape closing and then blur handling).
|
|
253
330
|
if (open === currentIsOpen) return;
|
|
254
|
-
|
|
255
|
-
|
|
331
|
+
if (!isOpenControlled) {
|
|
332
|
+
isOpenInternal = open;
|
|
333
|
+
openProp = open; // Update bindable prop
|
|
334
|
+
}
|
|
256
335
|
onOpenChange?.(open);
|
|
257
336
|
// Reset focus and pending when closing
|
|
258
337
|
if (!open) {
|
|
@@ -264,8 +343,10 @@
|
|
|
264
343
|
function setInputValueHandler(val: string) {
|
|
265
344
|
// Clear tag virtual focus when typing
|
|
266
345
|
focusedTagId = null;
|
|
267
|
-
|
|
268
|
-
|
|
346
|
+
if (!isInputControlled) {
|
|
347
|
+
inputValueInternal = val;
|
|
348
|
+
inputValue = val; // Update bindable prop
|
|
349
|
+
}
|
|
269
350
|
onInputChange?.(val); // Notify parent of input change
|
|
270
351
|
// Reset focus when filter changes (user typing)
|
|
271
352
|
navigation.setFocused(null);
|
|
@@ -279,21 +360,20 @@
|
|
|
279
360
|
// In multiple mode, selections are managed via tags, not input
|
|
280
361
|
if (selectionMode === 'single' && val.trim() === '' && currentSelection.size > 0) {
|
|
281
362
|
const emptySelection = new Set<string | number>();
|
|
282
|
-
|
|
283
|
-
if (isSelectionControlled) {
|
|
284
|
-
onChange?.(toExternalValue(emptySelection));
|
|
285
|
-
} else {
|
|
363
|
+
if (!isSelectionControlled) {
|
|
286
364
|
selectedInternal = emptySelection;
|
|
287
|
-
|
|
365
|
+
value = toExternalValue(emptySelection);
|
|
288
366
|
}
|
|
289
|
-
|
|
367
|
+
onChange?.(toExternalValue(emptySelection));
|
|
290
368
|
selectedLabel = '';
|
|
291
369
|
}
|
|
292
370
|
}
|
|
293
371
|
|
|
294
372
|
function syncInputValue(val: string, options?: { notifyInputChange?: boolean }) {
|
|
295
|
-
|
|
296
|
-
|
|
373
|
+
if (!isInputControlled) {
|
|
374
|
+
inputValueInternal = val;
|
|
375
|
+
inputValue = val;
|
|
376
|
+
}
|
|
297
377
|
|
|
298
378
|
if (options?.notifyInputChange ?? true) {
|
|
299
379
|
onInputChange?.(val);
|
|
@@ -381,15 +461,12 @@
|
|
|
381
461
|
}
|
|
382
462
|
}
|
|
383
463
|
|
|
384
|
-
|
|
385
|
-
if (isSelectionControlled) {
|
|
386
|
-
onChange?.(toExternalValue(newSelection));
|
|
387
|
-
} else {
|
|
464
|
+
if (!isSelectionControlled) {
|
|
388
465
|
selectedInternal = newSelection;
|
|
389
|
-
|
|
466
|
+
// Update bindable value
|
|
467
|
+
value = toExternalValue(newSelection);
|
|
390
468
|
}
|
|
391
|
-
|
|
392
|
-
value = toExternalValue(newSelection);
|
|
469
|
+
onChange?.(toExternalValue(newSelection));
|
|
393
470
|
}
|
|
394
471
|
|
|
395
472
|
function removeItem(id: string | number) {
|
|
@@ -403,14 +480,11 @@
|
|
|
403
480
|
// Remove from persistent labels
|
|
404
481
|
selectedLabels.delete(id);
|
|
405
482
|
|
|
406
|
-
|
|
407
|
-
if (isSelectionControlled) {
|
|
408
|
-
onChange?.(toExternalValue(newSelection));
|
|
409
|
-
} else {
|
|
483
|
+
if (!isSelectionControlled) {
|
|
410
484
|
selectedInternal = newSelection;
|
|
411
|
-
|
|
485
|
+
value = toExternalValue(newSelection);
|
|
412
486
|
}
|
|
413
|
-
|
|
487
|
+
onChange?.(toExternalValue(newSelection));
|
|
414
488
|
|
|
415
489
|
// Clear selectedLabel if we removed the last item
|
|
416
490
|
if (newSelection.size === 0) {
|
|
@@ -421,19 +495,18 @@
|
|
|
421
495
|
function clearSelection() {
|
|
422
496
|
const emptySelection = new Set<string | number>();
|
|
423
497
|
|
|
424
|
-
|
|
425
|
-
if (isSelectionControlled) {
|
|
426
|
-
onChange?.(toExternalValue(emptySelection));
|
|
427
|
-
} else {
|
|
498
|
+
if (!isSelectionControlled) {
|
|
428
499
|
selectedInternal = emptySelection;
|
|
429
|
-
|
|
500
|
+
value = toExternalValue(emptySelection);
|
|
430
501
|
}
|
|
431
|
-
|
|
502
|
+
onChange?.(toExternalValue(emptySelection));
|
|
432
503
|
selectedLabel = '';
|
|
433
504
|
|
|
434
505
|
// Also clear the input
|
|
435
|
-
|
|
436
|
-
|
|
506
|
+
if (!isInputControlled) {
|
|
507
|
+
inputValueInternal = '';
|
|
508
|
+
inputValue = '';
|
|
509
|
+
}
|
|
437
510
|
onInputChange?.('');
|
|
438
511
|
}
|
|
439
512
|
|
|
@@ -907,6 +980,15 @@
|
|
|
907
980
|
get items() {
|
|
908
981
|
return items;
|
|
909
982
|
},
|
|
983
|
+
get filteredItems() {
|
|
984
|
+
return filteredItems;
|
|
985
|
+
},
|
|
986
|
+
get filteredItemIds() {
|
|
987
|
+
return filteredItemIds;
|
|
988
|
+
},
|
|
989
|
+
setVirtualized: (virtualized) => {
|
|
990
|
+
isListVirtualized = virtualized;
|
|
991
|
+
},
|
|
910
992
|
setInputRef: (el) => {
|
|
911
993
|
inputRef = el;
|
|
912
994
|
},
|
|
@@ -1,39 +1,59 @@
|
|
|
1
1
|
import { type Snippet } from 'svelte';
|
|
2
2
|
import { type ComboBoxFilter } from './context';
|
|
3
3
|
type ComboBoxProps<T> = {
|
|
4
|
-
/**
|
|
4
|
+
/** A stable id, from which the component makes its internal ARIA ids. Give one on a server. */
|
|
5
5
|
id?: string;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
pending?: boolean;
|
|
8
8
|
readonly?: boolean;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* The selected value or values: one value in the single mode, and an array in the multiple mode.
|
|
11
|
+
* You can bind it with `bind:value`.
|
|
12
|
+
*/
|
|
10
13
|
value?: string | number | null | (string | number)[];
|
|
11
14
|
defaultValue?: string | number | null | (string | number)[];
|
|
12
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Give your own code full control of the selection. The component stops to write back to
|
|
17
|
+
* `value`, and it reports only through `onChange`. Thus the parent can refuse a change: the
|
|
18
|
+
* parent does not send the new value down. The default is off, because `bind:value` is the usual
|
|
19
|
+
* case and it needs the write-back.
|
|
20
|
+
*/
|
|
21
|
+
controlledValue?: boolean;
|
|
22
|
+
/** The text in the input. You can bind it with `bind:inputValue`. */
|
|
13
23
|
inputValue?: string;
|
|
14
24
|
defaultInputValue?: string;
|
|
25
|
+
/** Give your own code full control of the input text. Read `controlledValue`. */
|
|
26
|
+
controlledInputValue?: boolean;
|
|
15
27
|
selectionBehavior?: 'toggle' | 'replace';
|
|
16
28
|
selectionMode?: 'single' | 'multiple';
|
|
17
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Closes the popover after a selection. The default is true in the single mode, and false in the
|
|
31
|
+
* multiple mode.
|
|
32
|
+
*/
|
|
18
33
|
closeOnSelect?: boolean;
|
|
19
|
-
/**
|
|
34
|
+
/** The open state of the popover. You can bind it with `bind:open`. */
|
|
20
35
|
open?: boolean;
|
|
21
|
-
/**
|
|
36
|
+
/** Give your own code full control of the open state. Read `controlledValue`. */
|
|
37
|
+
controlledOpen?: boolean;
|
|
38
|
+
/** What opens the popover: 'focus', 'input', or 'press'. The default is 'press'. */
|
|
22
39
|
trigger?: 'focus' | 'input' | 'press';
|
|
23
|
-
/**
|
|
40
|
+
/** The function that filters the items locally. Set it to null to stop the local filter. */
|
|
24
41
|
filter?: ComboBoxFilter | null;
|
|
25
|
-
/**
|
|
42
|
+
/** Puts the items that have an `onAction` function into the local filter. */
|
|
26
43
|
filterActionItems?: boolean;
|
|
27
44
|
onInputChange?: (value: string) => void;
|
|
28
45
|
onOpenChange?: (open: boolean) => void;
|
|
29
46
|
onChange?: (value: string | number | null | (string | number)[]) => void;
|
|
30
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* The array of the items. The component uses it to find the names of the selected values before
|
|
49
|
+
* the options go into the DOM.
|
|
50
|
+
*/
|
|
31
51
|
items?: T[];
|
|
32
52
|
children?: Snippet;
|
|
33
53
|
class?: string;
|
|
34
|
-
/**
|
|
54
|
+
/** The accessible name of the combobox group. */
|
|
35
55
|
'aria-label'?: string;
|
|
36
|
-
/**
|
|
56
|
+
/** The id of the element that gives this combobox group its name. */
|
|
37
57
|
'aria-labelledby'?: string;
|
|
38
58
|
};
|
|
39
59
|
declare function $$render<T extends object = object>(): {
|
|
@@ -71,6 +71,18 @@ export type ComboBoxContext<T extends object = object> = {
|
|
|
71
71
|
listboxRef: HTMLElement | null;
|
|
72
72
|
/** Optional: Array of items for dynamic rendering */
|
|
73
73
|
items?: T[];
|
|
74
|
+
/**
|
|
75
|
+
* `items` narrowed by the local filter, in order. Empty when the ComboBox was given no
|
|
76
|
+
* `items` (a list written as static children filters itself, item by item).
|
|
77
|
+
*/
|
|
78
|
+
filteredItems: T[];
|
|
79
|
+
/** The ids of {@link filteredItems}, in the same order — the list navigation walks. */
|
|
80
|
+
filteredItemIds: (string | number)[];
|
|
81
|
+
/**
|
|
82
|
+
* Told by ComboBox.List whether it renders only a window of the options. Navigation reads
|
|
83
|
+
* the DOM order otherwise, which is the same thing only while every option is mounted.
|
|
84
|
+
*/
|
|
85
|
+
setVirtualized: (virtualized: boolean) => void;
|
|
74
86
|
/** Set the input ref */
|
|
75
87
|
setInputRef: (el: HTMLElement | null) => void;
|
|
76
88
|
/** Set the trigger ref (wrapper) */
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
Name: `ComboBox.Status`
|
|
8
8
|
Description: Visually-hidden `aria-live="polite"` region that announces the number of results visible in the popover as the filter changes.
|
|
9
9
|
|
|
10
|
-
| Prop | Type | Default | Description
|
|
11
|
-
| --------------- | --------------------------- | ----------- |
|
|
10
|
+
| Prop | Type | Default | Description |
|
|
11
|
+
| --------------- | --------------------------- | ----------- | ------------------------------------------------------------------------------------------ |
|
|
12
12
|
| `formatMessage` | `(count: number) => string` | `undefined` | Builds the announced message from the visible item count. Defaults to a localized message. |
|
|
13
13
|
|
|
14
14
|
## Notes
|
|
15
15
|
|
|
16
|
-
- The count includes disabled
|
|
16
|
+
- The count includes a disabled item that the user sees. Thus it agrees with the list on the screen.
|
|
17
17
|
- The default message is localized through `LocaleProvider` (`combobox.noResults`, `combobox.oneResult`, `combobox.multipleResults`).
|
|
18
18
|
- The region only announces while the popover is open; when closed it renders an empty message, so closing never announces "no results".
|
|
19
19
|
- Mirrors `Autocomplete.Status`.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* closed combobox would otherwise incorrectly announce "no results".
|
|
14
14
|
*/
|
|
15
15
|
type ComboBoxStatusProps = {
|
|
16
|
-
/**
|
|
16
|
+
/** Makes the announced message from the number of the items that the user sees. */
|
|
17
17
|
formatMessage?: (count: number) => string;
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* closed combobox would otherwise incorrectly announce "no results".
|
|
8
8
|
*/
|
|
9
9
|
type ComboBoxStatusProps = {
|
|
10
|
-
/**
|
|
10
|
+
/** Makes the announced message from the number of the items that the user sees. */
|
|
11
11
|
formatMessage?: (count: number) => string;
|
|
12
12
|
};
|
|
13
13
|
declare const ComboboxStatus: import("svelte").Component<ComboBoxStatusProps, {}, "">;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
### ComboBox.Tag
|
|
6
6
|
|
|
7
7
|
Name: `ComboBox.Tag`
|
|
8
|
-
Description:
|
|
8
|
+
Description: One tag, for one selected value, in the multiple selection mode.
|
|
9
9
|
|
|
10
10
|
| Prop | Type | Default | Description |
|
|
11
11
|
| -------------- | --------------------------------- | ----------- | ------------------------------------ |
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Supports keyboard navigation: ArrowLeft/Right to navigate, Delete/Backspace to remove, ArrowDown to focus input.
|
|
22
22
|
*/
|
|
23
23
|
type ComboBoxTagProps = {
|
|
24
|
-
/**
|
|
24
|
+
/** The content of the tag. For the remove button, use ComboBox.TagRemove. */
|
|
25
25
|
children: Snippet;
|
|
26
26
|
class?: string;
|
|
27
27
|
} & Omit<HTMLAttributes<HTMLSpanElement>, 'class' | 'children'>;
|
|
@@ -13,7 +13,7 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
13
13
|
* Supports keyboard navigation: ArrowLeft/Right to navigate, Delete/Backspace to remove, ArrowDown to focus input.
|
|
14
14
|
*/
|
|
15
15
|
type ComboBoxTagProps = {
|
|
16
|
-
/**
|
|
16
|
+
/** The content of the tag. For the remove button, use ComboBox.TagRemove. */
|
|
17
17
|
children: Snippet;
|
|
18
18
|
class?: string;
|
|
19
19
|
} & Omit<HTMLAttributes<HTMLSpanElement>, 'class' | 'children'>;
|
|
@@ -10,5 +10,5 @@ Description: Remove action button for a selected tag.
|
|
|
10
10
|
| Prop | Type | Default | Description |
|
|
11
11
|
| -------------- | ---------------------- | ----------- | --------------------------------------------------------------- |
|
|
12
12
|
| `children` | `Snippet` | `X icon` | Custom button content. |
|
|
13
|
-
| `class` | `string` | `undefined` | CSS class names
|
|
13
|
+
| `class` | `string` | `undefined` | The CSS class names of the remove button. |
|
|
14
14
|
| `...restProps` | `HTMLButtonAttributes` | `-` | Additional button attributes, excluding reserved trigger props. |
|
|
@@ -10,12 +10,23 @@
|
|
|
10
10
|
* Must be used inside ComboBox.Tag.
|
|
11
11
|
*/
|
|
12
12
|
type ComboBoxTagRemoveProps = {
|
|
13
|
-
/**
|
|
13
|
+
/** The content of the button. The default is an X icon. */
|
|
14
14
|
children?: Snippet;
|
|
15
15
|
class?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The accessible name of the button. The default is `Remove <tag label>`. Replace it to
|
|
18
|
+
* translate the verb, or to name the tag with a different text. The default label is the raw
|
|
19
|
+
* value when your code sets the selection and the option never goes into the DOM.
|
|
20
|
+
*/
|
|
21
|
+
'aria-label'?: string;
|
|
16
22
|
} & Omit<HTMLButtonAttributes, 'class' | 'children' | 'type' | 'onclick' | 'aria-label'>;
|
|
17
23
|
|
|
18
|
-
let {
|
|
24
|
+
let {
|
|
25
|
+
children,
|
|
26
|
+
class: className,
|
|
27
|
+
'aria-label': ariaLabel,
|
|
28
|
+
...restProps
|
|
29
|
+
}: ComboBoxTagRemoveProps = $props();
|
|
19
30
|
|
|
20
31
|
const maybeTagCtx = getContext<TagContext | undefined>(TAG_CONTEXT_KEY);
|
|
21
32
|
|
|
@@ -37,7 +48,7 @@
|
|
|
37
48
|
<ButtonRoot
|
|
38
49
|
type="button"
|
|
39
50
|
onclick={handleClick}
|
|
40
|
-
aria-label={`Remove ${tagCtx.label}`}
|
|
51
|
+
aria-label={ariaLabel ?? `Remove ${tagCtx.label}`}
|
|
41
52
|
tabindex={-1}
|
|
42
53
|
class={className}
|
|
43
54
|
{...restProps}
|
|
@@ -5,9 +5,15 @@ import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
|
5
5
|
* Must be used inside ComboBox.Tag.
|
|
6
6
|
*/
|
|
7
7
|
type ComboBoxTagRemoveProps = {
|
|
8
|
-
/**
|
|
8
|
+
/** The content of the button. The default is an X icon. */
|
|
9
9
|
children?: Snippet;
|
|
10
10
|
class?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The accessible name of the button. The default is `Remove <tag label>`. Replace it to
|
|
13
|
+
* translate the verb, or to name the tag with a different text. The default label is the raw
|
|
14
|
+
* value when your code sets the selection and the option never goes into the DOM.
|
|
15
|
+
*/
|
|
16
|
+
'aria-label'?: string;
|
|
11
17
|
} & Omit<HTMLButtonAttributes, 'class' | 'children' | 'type' | 'onclick' | 'aria-label'>;
|
|
12
18
|
declare const ComboboxTagRemove: import("svelte").Component<ComboBoxTagRemoveProps, {}, "">;
|
|
13
19
|
type ComboboxTagRemove = ReturnType<typeof ComboboxTagRemove>;
|
|
@@ -10,7 +10,7 @@ Description: Container that renders selected values as tags in multiple mode.
|
|
|
10
10
|
| Prop | Type | Default | Description |
|
|
11
11
|
| ---------- | ------------------------------ | ---------- | --------------------------------------------------------------------------------- |
|
|
12
12
|
| `children` | `Snippet<[{ item: TagItem }]>` | `required` | Render function that receives each selected item as `{ item: { value, label } }`. |
|
|
13
|
-
| `class` | `string` | `''` | CSS class names
|
|
13
|
+
| `class` | `string` | `''` | The CSS class names of the tags container. |
|
|
14
14
|
|
|
15
15
|
### TagItem type
|
|
16
16
|
|
|
@@ -22,24 +22,26 @@
|
|
|
22
22
|
* component only adapts it to the combobox (selection -> items, per-tag context).
|
|
23
23
|
*/
|
|
24
24
|
type ComboBoxTagsProps = {
|
|
25
|
-
/**
|
|
25
|
+
/** The snippet that makes each tag. It receives { item: { value, label } }. */
|
|
26
26
|
children: Snippet<[{ item: TagItem }]>;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
28
|
+
* An optional indicator for the tags that do not fit. With it, the tag row stays on one line.
|
|
29
|
+
* The component makes no tag that does not fit, and it puts this snippet at the end with the
|
|
30
|
+
* number of the hidden tags. The snippet also receives `visible` and `total`, thus you can show
|
|
31
|
+
* a summary when no tag fits. Make one element in it.
|
|
32
|
+
*
|
|
33
|
+
* Without `overflow`, the component makes each tag, and your styles decide how the row wraps.
|
|
34
34
|
*/
|
|
35
35
|
overflow?: Snippet<[TagsOverflow]>;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
* the search input
|
|
39
|
-
*
|
|
37
|
+
* The horizontal space to keep free in the parent, in px, for an element beside the tags such as
|
|
38
|
+
* the search input. Thus the calculation does not take the full row. The component uses it only
|
|
39
|
+
* with `overflow`.
|
|
40
40
|
*/
|
|
41
41
|
reserve?: number;
|
|
42
42
|
class?: string;
|
|
43
|
+
/** The accessible name of the tag row. The default is `Selected values`. */
|
|
44
|
+
'aria-label'?: string;
|
|
43
45
|
};
|
|
44
46
|
|
|
45
47
|
// Renamed locally: the snippet we hand to `OverflowRow` must itself be named
|
|
@@ -49,7 +51,8 @@
|
|
|
49
51
|
children: renderTag,
|
|
50
52
|
overflow,
|
|
51
53
|
reserve = 0,
|
|
52
|
-
class: className = ''
|
|
54
|
+
class: className = '',
|
|
55
|
+
'aria-label': ariaLabel = 'Selected values'
|
|
53
56
|
}: ComboBoxTagsProps = $props();
|
|
54
57
|
|
|
55
58
|
const ctx = useComboBoxContext();
|
|
@@ -73,7 +76,7 @@
|
|
|
73
76
|
{reserve}
|
|
74
77
|
class={cn(className)}
|
|
75
78
|
role="list"
|
|
76
|
-
aria-label=
|
|
79
|
+
aria-label={ariaLabel}
|
|
77
80
|
>
|
|
78
81
|
{#snippet children({ item: selected })}
|
|
79
82
|
<TagContextProvider
|