@human-kit/ui 1.0.0-beta.1 → 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 +27 -16
- package/dist/FOCUS_STATE_CONTRACT.md +17 -4
- package/dist/FOCUS_STATE_REVIEW_TEMPLATE.md +8 -8
- package/dist/accordion/README.md +3 -3
- package/dist/accordion/types.d.ts +37 -23
- 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 +5 -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/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 +118 -40
- package/dist/checkbox/root/checkbox-root.svelte.d.ts +17 -10
- 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/wheel-column/clock-wheel-column.svelte +1 -1
- package/dist/clock/wheel-column/clock-wheel-column.svelte.d.ts +1 -1
- package/dist/collapsible/README.md +3 -3
- package/dist/collapsible/types.d.ts +10 -7
- 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 +3 -3
- 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 +11 -8
- package/dist/combobox/list/combobox-listbox.svelte.d.ts +14 -9
- 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 +26 -17
- package/dist/combobox/root/combobox.svelte.d.ts +26 -17
- package/dist/combobox/status/README.md +1 -1
- 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 +4 -5
- package/dist/combobox/tag-remove/combobox-tag-remove.svelte.d.ts +4 -5
- package/dist/combobox/tags/README.md +1 -1
- package/dist/combobox/tags/combobox-tags.svelte +11 -11
- package/dist/combobox/tags/combobox-tags.svelte.d.ts +11 -11
- package/dist/combobox/trigger/README.md +7 -7
- package/dist/datepicker/README.md +4 -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 +1 -1
- 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/dialog/README.md +1 -1
- package/dist/dialog/close/dialog-close.svelte +3 -3
- package/dist/dialog/close/dialog-close.svelte.d.ts +3 -3
- package/dist/dialog/content/dialog-content.svelte +4 -4
- package/dist/dialog/content/dialog-content.svelte.d.ts +4 -4
- package/dist/dialog/description/dialog-description.svelte +3 -3
- package/dist/dialog/description/dialog-description.svelte.d.ts +3 -3
- 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/dialog-root.svelte +49 -11
- package/dist/dialog/root/dialog-root.svelte.d.ts +11 -9
- package/dist/dialog/title/dialog-title.svelte +3 -3
- package/dist/dialog/title/dialog-title.svelte.d.ts +3 -3
- package/dist/dialog/trigger/README.md +1 -1
- package/dist/drawer/README.md +3 -3
- package/dist/drawer/body/drawer-body.svelte +2 -2
- package/dist/drawer/body/drawer-body.svelte.d.ts +2 -2
- package/dist/drawer/close/drawer-close.svelte +3 -3
- package/dist/drawer/close/drawer-close.svelte.d.ts +3 -3
- package/dist/drawer/content/drawer-content.svelte +12 -9
- package/dist/drawer/content/drawer-content.svelte.d.ts +12 -9
- package/dist/drawer/description/drawer-description.svelte +3 -3
- package/dist/drawer/description/drawer-description.svelte.d.ts +3 -3
- package/dist/drawer/indent/drawer-indent-background.svelte +1 -1
- package/dist/drawer/indent/drawer-indent-background.svelte.d.ts +1 -1
- package/dist/drawer/indent/drawer-indent.svelte +2 -2
- package/dist/drawer/indent/drawer-indent.svelte.d.ts +2 -2
- package/dist/drawer/overlay/drawer-overlay.svelte +1 -1
- package/dist/drawer/overlay/drawer-overlay.svelte.d.ts +1 -1
- package/dist/drawer/portal/drawer-portal.svelte +1 -1
- package/dist/drawer/portal/drawer-portal.svelte.d.ts +1 -1
- package/dist/drawer/root/context.d.ts +1 -1
- package/dist/drawer/root/drawer-root.svelte +40 -25
- package/dist/drawer/root/drawer-root.svelte.d.ts +25 -23
- package/dist/drawer/swipe-area/drawer-swipe-area.svelte +3 -3
- package/dist/drawer/swipe-area/drawer-swipe-area.svelte.d.ts +3 -3
- package/dist/drawer/title/drawer-title.svelte +3 -3
- package/dist/drawer/title/drawer-title.svelte.d.ts +3 -3
- package/dist/drawer/trigger/drawer-trigger.svelte +6 -6
- package/dist/drawer/trigger/drawer-trigger.svelte.d.ts +6 -6
- package/dist/drawer/viewport/drawer-viewport.svelte +2 -2
- package/dist/drawer/viewport/drawer-viewport.svelte.d.ts +2 -2
- package/dist/drawer/virtual-keyboard/drawer-virtual-keyboard-provider.svelte +1 -1
- package/dist/drawer/virtual-keyboard/drawer-virtual-keyboard-provider.svelte.d.ts +1 -1
- package/dist/dropzone/README.md +4 -6
- package/dist/index.d.ts +22 -0
- package/dist/index.js +21 -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 +35 -17
- 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 +26 -1
- package/dist/listbox/root/context.js +108 -1
- package/dist/listbox/root/listbox.svelte +129 -39
- package/dist/listbox/root/listbox.svelte.d.ts +57 -33
- package/dist/locale-provider/README.md +1 -6
- package/dist/menu/README.md +41 -4
- package/dist/menu/content/menu-content.svelte +28 -13
- 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 +1 -1
- 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-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 +21 -15
- package/dist/popover/content/popover-content.svelte.d.ts +19 -14
- package/dist/popover/overlay/popover-overlay.svelte +1 -1
- 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 +13 -10
- package/dist/popover/root/popover-root.svelte.d.ts +13 -10
- 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 +42 -8
- package/dist/primitives/floating.js +70 -6
- 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 +2 -0
- package/dist/primitives/index.js +2 -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 +24 -16
- 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 +24 -0
- package/dist/primitives/scroll-lock.js +75 -6
- 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 +32 -18
- package/dist/switch/root/switch-root.svelte.d.ts +23 -18
- 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/cell/table-cell.svelte +27 -8
- package/dist/table/checkbox/table-checkbox.svelte +3 -0
- package/dist/table/checkbox-indicator/README.md +1 -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/index.d.ts +1 -1
- package/dist/table/index.js +1 -1
- package/dist/table/interactive-cell/table-interactive-cell.svelte +26 -8
- 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 +113 -17
- package/dist/table/root/table-root.svelte +36 -6
- package/dist/table/row/table-row.svelte +7 -7
- package/dist/table/sort-trigger/README.md +1 -1
- package/dist/table/types.d.ts +26 -14
- package/dist/tabs/types.d.ts +6 -6
- 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/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 +20 -11
- package/dist/toggle-group/root/toggle-group-root.svelte +20 -15
- 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 -9
- 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/types.d.ts +19 -10
- package/package.json +56 -1
|
@@ -9,16 +9,31 @@ export type ButtonRenderState = {
|
|
|
9
9
|
pending: boolean;
|
|
10
10
|
};
|
|
11
11
|
type ButtonRootProps = Omit<HTMLButtonAttributes, 'children' | 'class' | 'disabled' | 'aria-disabled'> & {
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* The content. As a snippet with one argument, it receives the live render state: hovered,
|
|
14
|
+
* pressed, focused, and pending.
|
|
15
|
+
*/
|
|
13
16
|
children?: Snippet<[ButtonRenderState]> | Snippet;
|
|
14
17
|
class?: string;
|
|
15
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Keeps the button focusable, but stops the activation. It announces the pending state politely.
|
|
20
|
+
*/
|
|
16
21
|
pending?: boolean | null;
|
|
17
22
|
/** Disables the button natively. */
|
|
18
23
|
disabled?: boolean | null;
|
|
19
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Keeps a disabled button in the tab order. The button gets `aria-disabled` and not the native
|
|
26
|
+
* attribute. The component still stops the activation.
|
|
27
|
+
*
|
|
28
|
+
* Use it for a control that is unavailable more often than available. The move buttons of a
|
|
29
|
+
* transfer list are one example, and a toolbar that obeys a selection is another. If you disable
|
|
30
|
+
* those natively, a keyboard user does not find them, and the tab order changes while the user
|
|
31
|
+
* works. `pending` says "busy". This says "not applicable".
|
|
32
|
+
*/
|
|
33
|
+
focusableWhenDisabled?: boolean | null;
|
|
34
|
+
/** A bindable reference to the button element. */
|
|
20
35
|
element?: HTMLButtonElement | null;
|
|
21
|
-
/**
|
|
36
|
+
/** Replaces the pressed state that the component holds. */
|
|
22
37
|
pressed?: boolean;
|
|
23
38
|
};
|
|
24
39
|
declare const ButtonRoot: import("svelte").Component<ButtonRootProps, {}, "element">;
|
package/dist/calendar/README.md
CHANGED
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
- In controlled mode, use `value` with `onChange`; in uncontrolled mode, use `defaultValue`.
|
|
12
12
|
- In `single` mode, `value/defaultValue` is `YYYY-MM-DD`.
|
|
13
13
|
- In `range` mode, `value/defaultValue` is `{ start?: 'YYYY-MM-DD', end?: 'YYYY-MM-DD' }`.
|
|
14
|
-
- `visibleMonths`
|
|
14
|
+
- `visibleMonths` sets the number of the months, and it changes how far the triggers move.
|
|
15
15
|
- `showOutsideDays` controls whether days outside the current month are shown; default is `false`.
|
|
16
16
|
- `isDateUnavailable` marks specific days as non-focusable and non-selectable.
|
|
17
17
|
- Use `LocaleProvider` to localize month/day labels and first day of week.
|
|
18
18
|
- Use `firstDayOfWeek` to override the locale-specified first day of the week.
|
|
19
|
-
- Use `monthHeadingStyle="month-year"` on `Calendar.Root` to
|
|
19
|
+
- Use `monthHeadingStyle="month-year"` on `Calendar.Root` to make the heading in two parts: the month and the year. An example is `May 2026`, in place of one string from the locale.
|
|
20
20
|
- Use `weekdayStyle="narrow" | "short" | "long"` on `Calendar.Grid` to control weekday header labels.
|
|
21
21
|
- Keyboard navigation uses `Arrow` keys for day/week movement and `Home/End` for month edges.
|
|
22
22
|
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
## Internal Notes
|
|
40
40
|
|
|
41
|
-
- `PageUp
|
|
41
|
+
- The `PageUp` key and the `PageDown` key keep the day number when they cross a month. The new month can have no day that takes the focus, while a range is not complete. The focus then goes to the last available day of the current month. The `Home` key and the `End` key do the same.
|
|
42
42
|
- In `selectionMode="range"`, the first click starts the range (`start`) and the second click confirms it (`end`), with automatic normalization for reversed selection order.
|
|
43
43
|
- In `selectionMode="range"`, hover updates a live preview before confirmation.
|
|
44
44
|
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
shouldShowFocusVisible,
|
|
59
59
|
trackInteractionModality
|
|
60
60
|
} from '../../primitives/input-modality';
|
|
61
|
+
import { watchFocusVisible } from '../../primitives/focus-visible.svelte';
|
|
61
62
|
|
|
62
63
|
type CalendarBodyCellProps = Omit<HTMLAttributes<HTMLTableCellElement>, 'children'> & {
|
|
63
64
|
date: string;
|
|
@@ -154,6 +155,12 @@
|
|
|
154
155
|
calendar.setFocusVisible(shouldShowFocusVisible(buttonElement ?? null));
|
|
155
156
|
}
|
|
156
157
|
|
|
158
|
+
watchFocusVisible({
|
|
159
|
+
isFocused: () => hasDomFocus,
|
|
160
|
+
element: () => buttonElement ?? null,
|
|
161
|
+
set: (visible) => calendar.setFocusVisible(visible)
|
|
162
|
+
});
|
|
163
|
+
|
|
157
164
|
function handleBlur() {
|
|
158
165
|
hasDomFocus = false;
|
|
159
166
|
isHovered = false;
|
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
type CalendarGridHeaderProps = {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* `weekdayStyle
|
|
11
|
-
*
|
|
12
|
-
* Wednesday in some locales).
|
|
9
|
+
* Your own content for a header cell. It receives the weekday name in the length of
|
|
10
|
+
* `weekdayStyle`, and also the long weekday name. Use the long name as the accessible name when
|
|
11
|
+
* the short one is narrow. In some locales, "M" is the narrow name of Monday and of Wednesday.
|
|
13
12
|
*/
|
|
14
13
|
children?: Snippet<[string, string]>;
|
|
15
14
|
class?: string;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
type CalendarGridHeaderProps = {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* `weekdayStyle
|
|
6
|
-
*
|
|
7
|
-
* Wednesday in some locales).
|
|
4
|
+
* Your own content for a header cell. It receives the weekday name in the length of
|
|
5
|
+
* `weekdayStyle`, and also the long weekday name. Use the long name as the accessible name when
|
|
6
|
+
* the short one is narrow. In some locales, "M" is the narrow name of Monday and of Wednesday.
|
|
8
7
|
*/
|
|
9
8
|
children?: Snippet<[string, string]>;
|
|
10
9
|
class?: string;
|
|
@@ -42,9 +42,15 @@
|
|
|
42
42
|
showOutsideDays?: boolean;
|
|
43
43
|
firstDayOfWeek?: CalendarFirstDayOfWeek;
|
|
44
44
|
monthHeadingStyle?: CalendarMonthHeadingStyle;
|
|
45
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* The first date that the user can select (`YYYY-MM-DD`). A date before it is unavailable, and
|
|
47
|
+
* the triggers and the focus stop at this limit.
|
|
48
|
+
*/
|
|
46
49
|
minValue?: CalendarDateValue;
|
|
47
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* The last date that the user can select (`YYYY-MM-DD`). A date after it is unavailable, and the
|
|
52
|
+
* triggers and the focus stop at this limit.
|
|
53
|
+
*/
|
|
48
54
|
maxValue?: CalendarDateValue;
|
|
49
55
|
isDateUnavailable?: (date: string) => boolean;
|
|
50
56
|
disabled?: boolean;
|
|
@@ -7,9 +7,15 @@ type CalendarRootProps = {
|
|
|
7
7
|
showOutsideDays?: boolean;
|
|
8
8
|
firstDayOfWeek?: CalendarFirstDayOfWeek;
|
|
9
9
|
monthHeadingStyle?: CalendarMonthHeadingStyle;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* The first date that the user can select (`YYYY-MM-DD`). A date before it is unavailable, and
|
|
12
|
+
* the triggers and the focus stop at this limit.
|
|
13
|
+
*/
|
|
11
14
|
minValue?: CalendarDateValue;
|
|
12
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* The last date that the user can select (`YYYY-MM-DD`). A date after it is unavailable, and the
|
|
17
|
+
* triggers and the focus stop at this limit.
|
|
18
|
+
*/
|
|
13
19
|
maxValue?: CalendarDateValue;
|
|
14
20
|
isDateUnavailable?: (date: string) => boolean;
|
|
15
21
|
disabled?: boolean;
|
|
@@ -10,5 +10,5 @@ Description: Button part that advances the visible calendar period.
|
|
|
10
10
|
| Prop | Type | Default | Description |
|
|
11
11
|
| -------------- | ---------------------- | ----------- | ------------------------------------------------------ |
|
|
12
12
|
| `children` | `Snippet` | `undefined` | Optional trigger content. |
|
|
13
|
-
| `class` | `string` | `''` | CSS class names
|
|
13
|
+
| `class` | `string` | `''` | The CSS class names of the trigger button. |
|
|
14
14
|
| `...restProps` | `HTMLButtonAttributes` | `-` | Additional button attributes forwarded to the trigger. |
|
|
@@ -10,5 +10,5 @@ Description: Button part that moves the visible calendar period backward.
|
|
|
10
10
|
| Prop | Type | Default | Description |
|
|
11
11
|
| -------------- | ---------------------- | ----------- | ------------------------------------------------------ |
|
|
12
12
|
| `children` | `Snippet` | `undefined` | Optional trigger content. |
|
|
13
|
-
| `class` | `string` | `''` | CSS class names
|
|
13
|
+
| `class` | `string` | `''` | The CSS class names of the trigger button. |
|
|
14
14
|
| `...restProps` | `HTMLButtonAttributes` | `-` | Additional button attributes forwarded to the trigger. |
|
package/dist/checkbox/README.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
## Usage guidelines
|
|
21
21
|
|
|
22
22
|
- Use `checked` / `defaultChecked` for the checked state and `indeterminate` / `defaultIndeterminate` for the mixed state.
|
|
23
|
-
- `indeterminate`
|
|
23
|
+
- `indeterminate` has more importance than `checked`. If both are `true`, the checkbox is indeterminate.
|
|
24
24
|
- Use `value` only for form submission through the hidden native input; it does not represent the visual state.
|
|
25
25
|
- Wrap the checkbox in a native `<label>` for the simplest accessible labeling pattern.
|
|
26
26
|
|
|
@@ -11,7 +11,7 @@ Description: Headless presence wrapper for checkbox indicator content. It render
|
|
|
11
11
|
| -------------- | --------------------------------- | ----------- | ------------------------------------------------------------------------ |
|
|
12
12
|
| `forceMount` | `boolean` | `false` | Keeps the indicator mounted while hidden when the checkbox is unchecked. |
|
|
13
13
|
| `children` | `Snippet` | `undefined` | Rendered indicator content, such as a check or dash icon. |
|
|
14
|
-
| `class` | `string` | `''` | CSS class names
|
|
14
|
+
| `class` | `string` | `''` | The CSS class names of the indicator container. |
|
|
15
15
|
| `...restProps` | `HTMLAttributes<HTMLSpanElement>` | `-` | Additional attributes forwarded to the indicator span. |
|
|
16
16
|
|
|
17
17
|
```svelte
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { useCheckboxContext } from '../root/context';
|
|
5
5
|
|
|
6
6
|
type CheckboxIndicatorProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'class'> & {
|
|
7
|
+
/** Keeps the indicator in the DOM even while the checkbox is unchecked. */
|
|
7
8
|
forceMount?: boolean;
|
|
8
9
|
children?: Snippet;
|
|
9
10
|
class?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
type CheckboxIndicatorProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'class'> & {
|
|
4
|
+
/** Keeps the indicator in the DOM even while the checkbox is unchecked. */
|
|
4
5
|
forceMount?: boolean;
|
|
5
6
|
children?: Snippet;
|
|
6
7
|
class?: string;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
### Checkbox.Root
|
|
6
6
|
|
|
7
7
|
Name: `Checkbox.Root`
|
|
8
|
-
Description:
|
|
8
|
+
Description: The root of a checkbox with three states. It holds the checked state, the indeterminate state, and the focus, and it keeps the hidden input correct.
|
|
9
9
|
|
|
10
10
|
| Prop | Type | Default | Description |
|
|
11
11
|
| ----------------------- | ---------------------------------- | ------------- | --------------------------------------------------------------- |
|
|
@@ -23,7 +23,7 @@ Description: Interactive tri-state checkbox root that owns checked, indeterminat
|
|
|
23
23
|
| `readonly` | `boolean` | `false` | Allows focus but blocks user-driven state changes. |
|
|
24
24
|
| `required` | `boolean` | `false` | Marks the hidden input as required and exposes `data-required`. |
|
|
25
25
|
| `children` | `Snippet` | `undefined` | Composed checkbox parts such as `Checkbox.Indicator`. |
|
|
26
|
-
| `class` | `string` | `''` | CSS class names
|
|
26
|
+
| `class` | `string` | `''` | The CSS class names of the root element. |
|
|
27
27
|
| `...restProps` | `HTMLAttributes<HTMLSpanElement>` | `-` | Additional attributes forwarded to the checkbox root span. |
|
|
28
28
|
|
|
29
29
|
### Context utilities
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { untrack, type Snippet } from 'svelte';
|
|
2
|
+
import { onDestroy, untrack, type Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
4
|
import {
|
|
5
5
|
shouldShowFocusVisible,
|
|
6
6
|
trackInteractionModality
|
|
7
7
|
} from '../../primitives/input-modality';
|
|
8
|
+
import { watchFocusVisible } from '../../primitives/focus-visible.svelte';
|
|
9
|
+
import { getCheckboxGroupContext } from '../../checkbox-group/root/context.svelte';
|
|
8
10
|
import { setCheckboxContext, type CheckboxContext, type CheckboxState } from './context';
|
|
9
11
|
|
|
10
12
|
type CheckboxRootProps = Omit<
|
|
@@ -25,34 +27,41 @@
|
|
|
25
27
|
element?: HTMLSpanElement | null;
|
|
26
28
|
name?: string;
|
|
27
29
|
value?: string;
|
|
28
|
-
/**
|
|
30
|
+
/** The id of the form of the hidden input. */
|
|
29
31
|
form?: string;
|
|
30
|
-
/**
|
|
32
|
+
/** The checked state. By default it goes in the two directions: use `bind:checked`. */
|
|
31
33
|
checked?: boolean;
|
|
32
|
-
/**
|
|
34
|
+
/** The checked state at the start, for when you give no `checked`. */
|
|
33
35
|
defaultChecked?: boolean;
|
|
34
36
|
/**
|
|
35
|
-
*
|
|
36
|
-
* and
|
|
37
|
-
* not
|
|
38
|
-
*
|
|
37
|
+
* Give your own code full control of `checked`. The component stops to write back to the prop,
|
|
38
|
+
* and it reports only through `onCheckedChange`. Thus the parent can refuse a change: the parent
|
|
39
|
+
* does not send the new value down. The default is off, because `bind:checked` is the usual case
|
|
40
|
+
* and it needs the write-back.
|
|
39
41
|
*/
|
|
40
42
|
controlledChecked?: boolean;
|
|
41
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* The indeterminate state. By default it goes in the two directions: use `bind:indeterminate`.
|
|
45
|
+
*/
|
|
42
46
|
indeterminate?: boolean;
|
|
43
|
-
/**
|
|
47
|
+
/** The indeterminate state at the start, for when you give no `indeterminate`. */
|
|
44
48
|
defaultIndeterminate?: boolean;
|
|
45
|
-
/**
|
|
49
|
+
/** Give your own code full control of `indeterminate`. Read `controlledChecked`. */
|
|
46
50
|
controlledIndeterminate?: boolean;
|
|
51
|
+
/** The component calls it when the user changes the checked state. */
|
|
47
52
|
onCheckedChange?: (checked: boolean) => void;
|
|
53
|
+
/** The component calls it when the user changes the indeterminate state. From the indeterminate state, the first user action makes the checkbox checked. */
|
|
48
54
|
onIndeterminateChange?: (indeterminate: boolean) => void;
|
|
49
55
|
disabled?: boolean;
|
|
50
56
|
readonly?: boolean;
|
|
51
57
|
required?: boolean;
|
|
52
58
|
children?: Snippet;
|
|
53
59
|
class?: string;
|
|
60
|
+
/** The accessible name, for when the user sees no name. */
|
|
54
61
|
'aria-label'?: string;
|
|
62
|
+
/** The id of the element that gives the checkbox its name. */
|
|
55
63
|
'aria-labelledby'?: string;
|
|
64
|
+
/** Replaces the default position in the tab order. */
|
|
56
65
|
tabindex?: number;
|
|
57
66
|
onclick?: HTMLAttributes<HTMLSpanElement>['onclick'];
|
|
58
67
|
onkeydown?: HTMLAttributes<HTMLSpanElement>['onkeydown'];
|
|
@@ -136,6 +145,13 @@
|
|
|
136
145
|
const inputId = instanceId;
|
|
137
146
|
const rootId = `${instanceId}-root`;
|
|
138
147
|
|
|
148
|
+
// Inside a `CheckboxGroup.Root` the group owns the checked state, and this checkbox becomes
|
|
149
|
+
// one entry of its `value` array. Outside one the context is undefined and every path below
|
|
150
|
+
// keeps the standalone behavior.
|
|
151
|
+
const checkboxGroup = getCheckboxGroupContext();
|
|
152
|
+
const registrationOwner = Symbol('checkbox-root');
|
|
153
|
+
let registeredValue = untrack(() => value);
|
|
154
|
+
|
|
139
155
|
const initialChecked = untrack(() => checked ?? defaultChecked);
|
|
140
156
|
const initialIndeterminate = untrack(() => indeterminate ?? defaultIndeterminate);
|
|
141
157
|
const initialState = resolveState(initialChecked, initialIndeterminate);
|
|
@@ -149,6 +165,35 @@
|
|
|
149
165
|
let rootRef: HTMLSpanElement | null = $state(null);
|
|
150
166
|
let inputRef: HTMLInputElement | null = $state(null);
|
|
151
167
|
|
|
168
|
+
// Registered while the script runs, before the element exists, so the group knows the
|
|
169
|
+
// checkbox at its first render. The effect below repeats it with the element attached,
|
|
170
|
+
// which is what gives the group its DOM order.
|
|
171
|
+
untrack(() => {
|
|
172
|
+
checkboxGroup?.registerCheckbox(registeredValue, {
|
|
173
|
+
isDisabled: disabled,
|
|
174
|
+
owner: registrationOwner
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
$effect(() => {
|
|
179
|
+
if (!checkboxGroup) return;
|
|
180
|
+
|
|
181
|
+
if (registeredValue !== value) {
|
|
182
|
+
checkboxGroup.unregisterCheckbox(registeredValue);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
registeredValue = value;
|
|
186
|
+
checkboxGroup.registerCheckbox(value, {
|
|
187
|
+
isDisabled: disabled,
|
|
188
|
+
element: rootRef,
|
|
189
|
+
owner: registrationOwner
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
onDestroy(() => {
|
|
194
|
+
checkboxGroup?.unregisterCheckbox(registeredValue);
|
|
195
|
+
});
|
|
196
|
+
|
|
152
197
|
$effect(() => {
|
|
153
198
|
element = rootRef;
|
|
154
199
|
return () => {
|
|
@@ -156,10 +201,21 @@
|
|
|
156
201
|
};
|
|
157
202
|
});
|
|
158
203
|
|
|
204
|
+
// A grouped checkbox adds the disabled and read-only state of the group to its own.
|
|
205
|
+
// `required` is NOT among them: native `required` on a checkbox demands THAT box, so
|
|
206
|
+
// spreading it would turn "at least one" into "every one". The group carries that
|
|
207
|
+
// meaning itself, with `aria-required` on its own element.
|
|
208
|
+
const renderedDisabled = $derived(
|
|
209
|
+
checkboxGroup ? checkboxGroup.isCheckboxDisabled(value) : disabled
|
|
210
|
+
);
|
|
211
|
+
const renderedReadOnly = $derived(readonly || Boolean(checkboxGroup?.isReadOnly));
|
|
212
|
+
const renderedRequired = $derived(required);
|
|
213
|
+
const renderedName = $derived(name ?? checkboxGroup?.name);
|
|
214
|
+
|
|
159
215
|
$effect(() => {
|
|
160
|
-
if (!
|
|
216
|
+
if (!renderedDisabled && !renderedReadOnly) return;
|
|
161
217
|
clearPressState();
|
|
162
|
-
if (
|
|
218
|
+
if (renderedDisabled) {
|
|
163
219
|
focusVisible = false;
|
|
164
220
|
}
|
|
165
221
|
});
|
|
@@ -169,7 +225,9 @@
|
|
|
169
225
|
// broke every `bind:checked` seeded with `false`. It is opt-in per prop instead.
|
|
170
226
|
// Write the initial state back so `bind:` parents see the resolved default. Read
|
|
171
227
|
// untracked: this is a deliberate one-time seed at init, not a reactive mirror.
|
|
172
|
-
|
|
228
|
+
// Skipped when grouped: there the group holds the checked state, and seeding the prop would
|
|
229
|
+
// report a value the group never agreed to.
|
|
230
|
+
if (!checkboxGroup && !untrack(() => controlledChecked)) {
|
|
173
231
|
checked = initialState === 'checked';
|
|
174
232
|
}
|
|
175
233
|
|
|
@@ -178,10 +236,15 @@
|
|
|
178
236
|
}
|
|
179
237
|
|
|
180
238
|
// The prop wins whenever it is supplied — that covers both `bind:` and a plain
|
|
181
|
-
// value — and the internal state only carries the fully uncontrolled case.
|
|
239
|
+
// value — and the internal state only carries the fully uncontrolled case. A group
|
|
240
|
+
// outranks all of it.
|
|
182
241
|
const currentState = $derived.by(() =>
|
|
183
242
|
resolveState(
|
|
184
|
-
|
|
243
|
+
checkboxGroup
|
|
244
|
+
? checkboxGroup.isSelected(value)
|
|
245
|
+
: controlledChecked
|
|
246
|
+
? Boolean(checked)
|
|
247
|
+
: (checked ?? checkedInternal),
|
|
185
248
|
controlledIndeterminate ? Boolean(indeterminate) : (indeterminate ?? indeterminateInternal)
|
|
186
249
|
)
|
|
187
250
|
);
|
|
@@ -190,6 +253,14 @@
|
|
|
190
253
|
const currentIndeterminate = $derived(currentState === 'indeterminate');
|
|
191
254
|
const currentUnchecked = $derived(currentState === 'unchecked');
|
|
192
255
|
|
|
256
|
+
// The focus ring must appear when a pointer press is followed by a key press, and the modality
|
|
257
|
+
// alone changes there — no focus event fires to re-read it.
|
|
258
|
+
watchFocusVisible({
|
|
259
|
+
isFocused: () => focused,
|
|
260
|
+
element: () => rootRef,
|
|
261
|
+
set: (visible) => (focusVisible = visible)
|
|
262
|
+
});
|
|
263
|
+
|
|
193
264
|
function clearPressState() {
|
|
194
265
|
pressed = false;
|
|
195
266
|
pressedKey = null;
|
|
@@ -200,8 +271,15 @@
|
|
|
200
271
|
const nextIndeterminate = nextState === 'indeterminate';
|
|
201
272
|
const previousChecked = currentChecked;
|
|
202
273
|
const previousIndeterminate = currentIndeterminate;
|
|
203
|
-
|
|
204
|
-
|
|
274
|
+
let didChangeChecked = nextChecked !== previousChecked;
|
|
275
|
+
|
|
276
|
+
if (checkboxGroup) {
|
|
277
|
+
// The group owns the checked state, so the standalone `checked` prop is not written
|
|
278
|
+
// back. The group reports the whole selection through its own `value` and `onChange`,
|
|
279
|
+
// and it answers whether it took the change — a group that refuses one must not make
|
|
280
|
+
// this checkbox announce it.
|
|
281
|
+
didChangeChecked = checkboxGroup.setValueSelected(value, nextChecked) !== null;
|
|
282
|
+
} else if (!controlledChecked) {
|
|
205
283
|
checkedInternal = nextChecked;
|
|
206
284
|
checked = nextChecked;
|
|
207
285
|
}
|
|
@@ -211,7 +289,7 @@
|
|
|
211
289
|
indeterminate = nextIndeterminate;
|
|
212
290
|
}
|
|
213
291
|
|
|
214
|
-
if (
|
|
292
|
+
if (didChangeChecked) {
|
|
215
293
|
onCheckedChange?.(nextChecked);
|
|
216
294
|
}
|
|
217
295
|
|
|
@@ -225,7 +303,7 @@
|
|
|
225
303
|
}
|
|
226
304
|
|
|
227
305
|
function setState(nextState: CheckboxState, event?: Event) {
|
|
228
|
-
if (
|
|
306
|
+
if (renderedDisabled || renderedReadOnly) return;
|
|
229
307
|
publishState(nextState, event);
|
|
230
308
|
}
|
|
231
309
|
|
|
@@ -234,7 +312,7 @@
|
|
|
234
312
|
}
|
|
235
313
|
|
|
236
314
|
function requestNativeToggle(event?: Event) {
|
|
237
|
-
if (
|
|
315
|
+
if (renderedDisabled || renderedReadOnly) return;
|
|
238
316
|
if (!inputRef) {
|
|
239
317
|
toggle(event);
|
|
240
318
|
return;
|
|
@@ -247,7 +325,7 @@
|
|
|
247
325
|
trackInteractionModality(event, rootRef);
|
|
248
326
|
|
|
249
327
|
if (event.defaultPrevented) return;
|
|
250
|
-
if (
|
|
328
|
+
if (renderedDisabled || renderedReadOnly) {
|
|
251
329
|
event.preventDefault();
|
|
252
330
|
return;
|
|
253
331
|
}
|
|
@@ -305,7 +383,7 @@
|
|
|
305
383
|
trackInteractionModality(event, rootRef);
|
|
306
384
|
focusVisible = false;
|
|
307
385
|
|
|
308
|
-
if (
|
|
386
|
+
if (renderedDisabled || renderedReadOnly) {
|
|
309
387
|
event.preventDefault();
|
|
310
388
|
clearPressState();
|
|
311
389
|
return;
|
|
@@ -328,7 +406,7 @@
|
|
|
328
406
|
}
|
|
329
407
|
|
|
330
408
|
function handlePointerEnter(event: PointerEvent) {
|
|
331
|
-
if (
|
|
409
|
+
if (renderedDisabled || renderedReadOnly) return;
|
|
332
410
|
|
|
333
411
|
if ((event.buttons & 1) === 1 && pressedKey === null) {
|
|
334
412
|
pressed = true;
|
|
@@ -345,7 +423,7 @@
|
|
|
345
423
|
trackInteractionModality(event, rootRef);
|
|
346
424
|
focusVisible = false;
|
|
347
425
|
|
|
348
|
-
if (
|
|
426
|
+
if (renderedDisabled || renderedReadOnly) {
|
|
349
427
|
event.preventDefault();
|
|
350
428
|
clearPressState();
|
|
351
429
|
return;
|
|
@@ -384,7 +462,7 @@
|
|
|
384
462
|
const target = event.currentTarget;
|
|
385
463
|
if (!(target instanceof HTMLInputElement)) return;
|
|
386
464
|
|
|
387
|
-
if (
|
|
465
|
+
if (renderedDisabled || renderedReadOnly) {
|
|
388
466
|
target.checked = currentChecked;
|
|
389
467
|
target.indeterminate = currentIndeterminate;
|
|
390
468
|
return;
|
|
@@ -457,13 +535,13 @@
|
|
|
457
535
|
return currentIndeterminate;
|
|
458
536
|
},
|
|
459
537
|
get isDisabled() {
|
|
460
|
-
return
|
|
538
|
+
return renderedDisabled;
|
|
461
539
|
},
|
|
462
540
|
get isReadOnly() {
|
|
463
|
-
return
|
|
541
|
+
return renderedReadOnly;
|
|
464
542
|
},
|
|
465
543
|
get required() {
|
|
466
|
-
return
|
|
544
|
+
return renderedRequired;
|
|
467
545
|
},
|
|
468
546
|
get focused() {
|
|
469
547
|
return focused;
|
|
@@ -481,11 +559,11 @@
|
|
|
481
559
|
bind:this={rootRef}
|
|
482
560
|
id={rootId}
|
|
483
561
|
role="checkbox"
|
|
484
|
-
tabindex={
|
|
562
|
+
tabindex={renderedDisabled ? undefined : (tabindex ?? 0)}
|
|
485
563
|
aria-checked={currentIndeterminate ? 'mixed' : currentChecked ? 'true' : 'false'}
|
|
486
|
-
aria-disabled={
|
|
487
|
-
aria-readonly={
|
|
488
|
-
aria-required={
|
|
564
|
+
aria-disabled={renderedDisabled || undefined}
|
|
565
|
+
aria-readonly={renderedReadOnly || undefined}
|
|
566
|
+
aria-required={renderedRequired || undefined}
|
|
489
567
|
aria-label={ariaLabel}
|
|
490
568
|
aria-labelledby={ariaLabelledby}
|
|
491
569
|
data-checkbox-root="true"
|
|
@@ -493,9 +571,9 @@
|
|
|
493
571
|
data-unchecked={currentUnchecked || undefined}
|
|
494
572
|
data-indeterminate={currentIndeterminate || undefined}
|
|
495
573
|
data-pressed={pressed || undefined}
|
|
496
|
-
data-disabled={
|
|
497
|
-
data-readonly={
|
|
498
|
-
data-required={
|
|
574
|
+
data-disabled={renderedDisabled || undefined}
|
|
575
|
+
data-readonly={renderedReadOnly || undefined}
|
|
576
|
+
data-required={renderedRequired || undefined}
|
|
499
577
|
data-focused={focused || undefined}
|
|
500
578
|
data-focus-visible={focusVisible || undefined}
|
|
501
579
|
onclick={composeEventHandlers(onClickExternal ?? undefined, handleClick)}
|
|
@@ -520,13 +598,13 @@
|
|
|
520
598
|
id={inputId}
|
|
521
599
|
tabindex={-1}
|
|
522
600
|
type="checkbox"
|
|
523
|
-
{
|
|
601
|
+
name={renderedName}
|
|
524
602
|
{value}
|
|
525
603
|
{form}
|
|
526
604
|
checked={currentChecked}
|
|
527
|
-
{
|
|
528
|
-
{
|
|
529
|
-
{
|
|
605
|
+
disabled={renderedDisabled}
|
|
606
|
+
required={renderedRequired}
|
|
607
|
+
readonly={renderedReadOnly}
|
|
530
608
|
aria-hidden="true"
|
|
531
609
|
data-checkbox-input="true"
|
|
532
610
|
onclick={handleInputClick}
|
|
@@ -5,34 +5,41 @@ type CheckboxRootProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'cla
|
|
|
5
5
|
element?: HTMLSpanElement | null;
|
|
6
6
|
name?: string;
|
|
7
7
|
value?: string;
|
|
8
|
-
/**
|
|
8
|
+
/** The id of the form of the hidden input. */
|
|
9
9
|
form?: string;
|
|
10
|
-
/**
|
|
10
|
+
/** The checked state. By default it goes in the two directions: use `bind:checked`. */
|
|
11
11
|
checked?: boolean;
|
|
12
|
-
/**
|
|
12
|
+
/** The checked state at the start, for when you give no `checked`. */
|
|
13
13
|
defaultChecked?: boolean;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* and
|
|
17
|
-
* not
|
|
18
|
-
*
|
|
15
|
+
* Give your own code full control of `checked`. The component stops to write back to the prop,
|
|
16
|
+
* and it reports only through `onCheckedChange`. Thus the parent can refuse a change: the parent
|
|
17
|
+
* does not send the new value down. The default is off, because `bind:checked` is the usual case
|
|
18
|
+
* and it needs the write-back.
|
|
19
19
|
*/
|
|
20
20
|
controlledChecked?: boolean;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* The indeterminate state. By default it goes in the two directions: use `bind:indeterminate`.
|
|
23
|
+
*/
|
|
22
24
|
indeterminate?: boolean;
|
|
23
|
-
/**
|
|
25
|
+
/** The indeterminate state at the start, for when you give no `indeterminate`. */
|
|
24
26
|
defaultIndeterminate?: boolean;
|
|
25
|
-
/**
|
|
27
|
+
/** Give your own code full control of `indeterminate`. Read `controlledChecked`. */
|
|
26
28
|
controlledIndeterminate?: boolean;
|
|
29
|
+
/** The component calls it when the user changes the checked state. */
|
|
27
30
|
onCheckedChange?: (checked: boolean) => void;
|
|
31
|
+
/** The component calls it when the user changes the indeterminate state. From the indeterminate state, the first user action makes the checkbox checked. */
|
|
28
32
|
onIndeterminateChange?: (indeterminate: boolean) => void;
|
|
29
33
|
disabled?: boolean;
|
|
30
34
|
readonly?: boolean;
|
|
31
35
|
required?: boolean;
|
|
32
36
|
children?: Snippet;
|
|
33
37
|
class?: string;
|
|
38
|
+
/** The accessible name, for when the user sees no name. */
|
|
34
39
|
'aria-label'?: string;
|
|
40
|
+
/** The id of the element that gives the checkbox its name. */
|
|
35
41
|
'aria-labelledby'?: string;
|
|
42
|
+
/** Replaces the default position in the tab order. */
|
|
36
43
|
tabindex?: number;
|
|
37
44
|
onclick?: HTMLAttributes<HTMLSpanElement>['onclick'];
|
|
38
45
|
onkeydown?: HTMLAttributes<HTMLSpanElement>['onkeydown'];
|