@human-kit/ui 1.0.0-beta.1 → 1.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +459 -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
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
shouldShowFocusVisible,
|
|
22
22
|
trackInteractionModality
|
|
23
23
|
} from '../../primitives/input-modality';
|
|
24
|
+
import { watchFocusVisible } from '../../primitives/focus-visible.svelte';
|
|
24
25
|
import { visuallyHiddenStyle } from '../utils/visually-hidden-style';
|
|
25
26
|
import type { TableRootProps } from '../types.js';
|
|
26
27
|
import {
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
|
|
34
35
|
let {
|
|
35
36
|
selectionMode = 'none',
|
|
37
|
+
keyboardNavigation = 'grid',
|
|
36
38
|
selectionBehavior = 'toggle',
|
|
37
39
|
disabledBehavior = 'all',
|
|
38
40
|
disallowEmptySelection = false,
|
|
@@ -83,6 +85,7 @@
|
|
|
83
85
|
const ctx = setTableContext(
|
|
84
86
|
createTableContext({
|
|
85
87
|
selectionMode: (() => selectionMode)(),
|
|
88
|
+
keyboardNavigation: (() => keyboardNavigation)(),
|
|
86
89
|
selectionBehavior: (() => selectionBehavior)(),
|
|
87
90
|
disabledBehavior: (() => disabledBehavior)(),
|
|
88
91
|
disallowEmptySelection: (() => disallowEmptySelection)(),
|
|
@@ -374,6 +377,10 @@
|
|
|
374
377
|
ctx.setSelectionMode(selectionMode);
|
|
375
378
|
});
|
|
376
379
|
|
|
380
|
+
$effect(() => {
|
|
381
|
+
ctx.setKeyboardNavigation(keyboardNavigation);
|
|
382
|
+
});
|
|
383
|
+
|
|
377
384
|
$effect(() => {
|
|
378
385
|
if (hiddenColumns !== undefined) {
|
|
379
386
|
const nextHiddenColumns = parseHiddenColumns(hiddenColumns);
|
|
@@ -493,30 +500,52 @@
|
|
|
493
500
|
focusWithin =
|
|
494
501
|
!!tableElement && !!document.activeElement && tableElement.contains(document.activeElement);
|
|
495
502
|
if (!focusWithin) {
|
|
496
|
-
|
|
503
|
+
setFocusVisible(false);
|
|
497
504
|
ctx.setFocusedCell(null);
|
|
498
505
|
}
|
|
499
506
|
}
|
|
500
507
|
|
|
501
508
|
function handleFocusIn(event: FocusEvent) {
|
|
502
509
|
focusWithin = true;
|
|
503
|
-
|
|
510
|
+
setFocusVisible(shouldShowFocusVisible(event.target as HTMLElement | null));
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// Every part of the table reads one focus-visible value, and each writes it from its own
|
|
514
|
+
// focus handler. One watch on the focused descendant therefore serves them all: a key press
|
|
515
|
+
// that follows a pointer press brings the ring back on the cell, the row and the checkbox
|
|
516
|
+
// at once.
|
|
517
|
+
function getFocusedDescendant() {
|
|
518
|
+
if (!tableElement) return null;
|
|
519
|
+
const active = tableElement.ownerDocument.activeElement;
|
|
520
|
+
if (!(active instanceof HTMLElement)) return null;
|
|
521
|
+
return tableElement.contains(active) ? active : null;
|
|
504
522
|
}
|
|
505
523
|
|
|
524
|
+
function setFocusVisible(visible: boolean) {
|
|
525
|
+
focusVisible = visible;
|
|
526
|
+
ctx.setFocusVisible(visible);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
watchFocusVisible({
|
|
530
|
+
isFocused: () => focusWithin,
|
|
531
|
+
element: getFocusedDescendant,
|
|
532
|
+
set: setFocusVisible
|
|
533
|
+
});
|
|
534
|
+
|
|
506
535
|
function handleFocusOut() {
|
|
507
536
|
queueMicrotask(syncFocusWithin);
|
|
508
537
|
}
|
|
509
538
|
|
|
510
539
|
function handleMouseDown(event: MouseEvent) {
|
|
511
540
|
trackInteractionModality(event, event.target as HTMLElement | null);
|
|
512
|
-
|
|
541
|
+
setFocusVisible(false);
|
|
513
542
|
}
|
|
514
543
|
|
|
544
|
+
// No focus-visible write here: `trackInteractionModality` reports the key to the modality,
|
|
545
|
+
// and the watch above answers. A key that carries a modifier is not a modality change, and
|
|
546
|
+
// must leave the ring as the pointer left it.
|
|
515
547
|
function handleKeyDown(event: KeyboardEvent) {
|
|
516
548
|
trackInteractionModality(event, event.target as HTMLElement | null);
|
|
517
|
-
if (focusWithin) {
|
|
518
|
-
focusVisible = true;
|
|
519
|
-
}
|
|
520
549
|
}
|
|
521
550
|
</script>
|
|
522
551
|
|
|
@@ -547,6 +576,7 @@
|
|
|
547
576
|
aria-rowcount={ariaRowCount}
|
|
548
577
|
aria-multiselectable={selectionMode === 'multiple' ? true : undefined}
|
|
549
578
|
data-selection-mode={selectionMode}
|
|
579
|
+
data-keyboard-navigation={keyboardNavigation}
|
|
550
580
|
data-selection-behavior={selectionBehavior}
|
|
551
581
|
data-disabled-behavior={disabledBehavior}
|
|
552
582
|
data-focus-within={focusWithin || undefined}
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
|
|
52
52
|
function handleKeyDown(event: KeyboardEvent) {
|
|
53
53
|
if (section.section !== 'body') return;
|
|
54
|
+
if (table.keyboardNavigation === 'none') return;
|
|
54
55
|
if (event.target !== rowElement) return;
|
|
55
56
|
handleTableBodyKeydown({
|
|
56
57
|
event,
|
|
@@ -275,6 +276,11 @@
|
|
|
275
276
|
const isAriaDisabled = $derived(
|
|
276
277
|
section.section === 'body' ? table.isRowDisabled(id, disabled) : disabled
|
|
277
278
|
);
|
|
279
|
+
// The row is a focus target under `'grid'` (as the row-edge stop) and under
|
|
280
|
+
// `'row'` (as the only stop in the body); `'none'` leaves the body inert.
|
|
281
|
+
const isRowFocusTarget = $derived(
|
|
282
|
+
section.section === 'body' && !isAriaDisabled && table.keyboardNavigation !== 'none'
|
|
283
|
+
);
|
|
278
284
|
const isSelectionDisabled = $derived(
|
|
279
285
|
section.section === 'body' ? table.isRowSelectionDisabled(id, disabled) : disabled
|
|
280
286
|
);
|
|
@@ -286,13 +292,7 @@
|
|
|
286
292
|
<tr
|
|
287
293
|
bind:this={rowElement}
|
|
288
294
|
class={className}
|
|
289
|
-
tabindex={
|
|
290
|
-
? !isAriaDisabled
|
|
291
|
-
? table.isRowTabStop(rowToken)
|
|
292
|
-
? 0
|
|
293
|
-
: -1
|
|
294
|
-
: undefined
|
|
295
|
-
: undefined}
|
|
295
|
+
tabindex={isRowFocusTarget ? (table.isRowTabStop(rowToken) ? 0 : -1) : undefined}
|
|
296
296
|
data-focused={isFocused ? 'true' : undefined}
|
|
297
297
|
data-focus-visible={isFocusVisible ? 'true' : undefined}
|
|
298
298
|
data-focus-within={isFocusWithin ? 'true' : undefined}
|
|
@@ -13,7 +13,7 @@ Public prop type: `TableSortTriggerProps`
|
|
|
13
13
|
|
|
14
14
|
| Prop | Type | Default | Description |
|
|
15
15
|
| -------------- | --------------------------------------------------- | ----------- | --------------------------------------------------------------------------------- |
|
|
16
|
-
| `children` | `Snippet<[TableSortTriggerRenderState]> \| Snippet` | `undefined` |
|
|
16
|
+
| `children` | `Snippet<[TableSortTriggerRenderState]> \| Snippet` | `undefined` | The content of the button. The snippet receives the current `sortDirection`. |
|
|
17
17
|
| `class` | `string` | `''` | CSS class names for the button. |
|
|
18
18
|
| `...restProps` | `HTMLButtonAttributes` | `-` | Additional native button attributes, excluding reserved trigger button semantics. |
|
|
19
19
|
|
package/dist/table/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Component, Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
-
import type { TableColumnPin, TableColumnWidth, TableContext, TableDisabledBehavior, TableRowActionHandler, TableRowItem, TableSelectionBehavior, TableSelectionKey, TableSelectionMode, TableSortDirection, TableSortDescriptor } from './root/context.svelte';
|
|
3
|
+
import type { TableColumnPin, TableColumnWidth, TableContext, TableDisabledBehavior, TableKeyboardNavigation, TableRowActionHandler, TableRowItem, TableSelectionBehavior, TableSelectionKey, TableSelectionMode, TableSortDirection, TableSortDescriptor } from './root/context.svelte';
|
|
4
4
|
export type { TableColumnPin } from './root/context.svelte';
|
|
5
5
|
export type TableColumnProps = {
|
|
6
6
|
id: string;
|
|
@@ -11,10 +11,10 @@ export type TableColumnProps = {
|
|
|
11
11
|
minWidth?: number;
|
|
12
12
|
maxWidth?: number;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* the
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* Keeps the column at an edge of the horizontal scroll: `'left'` at the start, and `'right'` at
|
|
15
|
+
* the end. More than one column can go to the same side. They go in the sequence of the document.
|
|
16
|
+
* The table calculates the position of each one from the widths of the columns already at that
|
|
17
|
+
* side.
|
|
18
18
|
*/
|
|
19
19
|
pin?: TableColumnPin;
|
|
20
20
|
children?: Snippet;
|
|
@@ -89,6 +89,19 @@ export type TableFooterProps = Omit<HTMLAttributes<HTMLTableSectionElement>, 'ch
|
|
|
89
89
|
};
|
|
90
90
|
export type TableRootProps = Omit<HTMLAttributes<HTMLTableElement>, 'children'> & {
|
|
91
91
|
selectionMode?: TableSelectionMode;
|
|
92
|
+
/**
|
|
93
|
+
* How far the roving tab stop goes into the body. The default is `'grid'`.
|
|
94
|
+
*
|
|
95
|
+
* The cell navigation has a cost. Each body cell registers itself and calculates its own focus
|
|
96
|
+
* state. A virtualized table does this again for each block of rows that it makes while the user
|
|
97
|
+
* scrolls.
|
|
98
|
+
*
|
|
99
|
+
* With `'row'`, the keyboard still reaches the body, at one focus target for each row. With
|
|
100
|
+
* `'none'`, the body takes no focus. Use `'none'` only when nothing in the body does an action.
|
|
101
|
+
* In each mode, the header keeps its own navigation, and with it the sort control and the width
|
|
102
|
+
* control.
|
|
103
|
+
*/
|
|
104
|
+
keyboardNavigation?: TableKeyboardNavigation;
|
|
92
105
|
selectionBehavior?: TableSelectionBehavior;
|
|
93
106
|
disabledBehavior?: TableDisabledBehavior;
|
|
94
107
|
disallowEmptySelection?: boolean;
|
|
@@ -101,16 +114,15 @@ export type TableRootProps = Omit<HTMLAttributes<HTMLTableElement>, 'children'>
|
|
|
101
114
|
columnWidths?: Map<string, TableColumnWidth>;
|
|
102
115
|
defaultColumnWidths?: Iterable<readonly [string, TableColumnWidth]>;
|
|
103
116
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
117
|
+
* The width that the table keeps with `min-width` on the server, in px, before the columns
|
|
118
|
+
* register their own widths.
|
|
119
|
+
*
|
|
120
|
+
* On the server, the `<table>` element goes to the output before the column children register.
|
|
121
|
+
* Thus the table does not know its own minimum width, and it takes the width of its container. At
|
|
122
|
+
* the hydration, the column widths can make the table wider, and the layout moves.
|
|
106
123
|
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* minimum width yet and renders at the container width. On hydration the
|
|
110
|
-
* resolved column widths can push the table wider, producing a layout
|
|
111
|
-
* shift. Set this to the sum of the columns' resolved widths to reserve
|
|
112
|
-
* that space up-front and avoid the jump. Ignored once the real columns
|
|
113
|
-
* register on the client.
|
|
124
|
+
* Set this prop to the sum of the column widths to keep that space from the start. On the client,
|
|
125
|
+
* the component ignores it after the columns register.
|
|
114
126
|
*/
|
|
115
127
|
ssrMinTableWidth?: number;
|
|
116
128
|
disabledKeys?: Iterable<TableSelectionKey>;
|
package/dist/tabs/types.d.ts
CHANGED
|
@@ -6,15 +6,15 @@ export type TabsRootProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'c
|
|
|
6
6
|
keyboardActivation?: TabsKeyboardActivation;
|
|
7
7
|
orientation?: TabsOrientation;
|
|
8
8
|
disabled?: boolean;
|
|
9
|
-
/**
|
|
9
|
+
/** The value of the selected tab. By default it goes in the two directions: use `bind:value`. */
|
|
10
10
|
value?: TabsValue | null;
|
|
11
|
-
/**
|
|
11
|
+
/** The selected value at the start, for when you give no `value`. */
|
|
12
12
|
defaultValue?: TabsValue | null;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* the new value
|
|
17
|
-
* needs the write-back
|
|
14
|
+
* Give your own code full control of the state. The component stops to write back to `value`, and
|
|
15
|
+
* it reports only through `onChange`. Thus the parent can refuse a change: the parent does not
|
|
16
|
+
* send the new value down. The default is off, because `bind:value` is the usual case and it
|
|
17
|
+
* needs the write-back.
|
|
18
18
|
*/
|
|
19
19
|
controlledValue?: boolean;
|
|
20
20
|
disabledKeys?: Iterable<TabsValue>;
|
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
- `defaultOpen?: boolean`
|
|
64
64
|
- `onOpenChange?: (open: boolean, details: { reason, event?, cancel(), isCanceled }) => void`
|
|
65
65
|
- Null-first empty contract: when `value` and `defaultValue` are omitted, the empty state is `null`.
|
|
66
|
-
- `TimePicker.Input` exposes `aria-invalid` and `data-invalid` when the current segment draft is not committeable
|
|
66
|
+
- `TimePicker.Input` exposes `aria-invalid` and `data-invalid` when the current segment draft is not committeable, or when the consumer passes `aria-invalid`.
|
|
67
|
+
- `TimePicker.Input` accepts `id` and `name`. Either one renders a hidden but focusable proxy input that carries them. Thus a `<label for>` reaches the segments, and a native form submit reads the committed value. The group keeps `${id}-group`. Autofill is not supported on the proxy (`autocomplete="off"`).
|
|
67
68
|
|
|
68
69
|
## Popover API
|
|
69
70
|
|
|
@@ -83,7 +84,7 @@
|
|
|
83
84
|
|
|
84
85
|
- `TimePicker.Clock` resolves visible wheel columns from root state (`granularity`, `hourCycle`) in stable order: `hour → minute? → second? → dayPeriod?`.
|
|
85
86
|
- `class?: string` uses default layout (`flex gap-2`) when omitted.
|
|
86
|
-
- `column?: Snippet<[ClockColumnInfo]>`
|
|
87
|
+
- `column?: Snippet<[ClockColumnInfo]>` lets you make your own content for each column.
|
|
87
88
|
- `ClockColumnInfo` shape:
|
|
88
89
|
- `type: 'hour' | 'minute' | 'second' | 'dayPeriod'`
|
|
89
90
|
- `label?: string`
|
|
@@ -11,5 +11,5 @@ Description: Group wrapper for rendered time segments; manages focus entry and s
|
|
|
11
11
|
| -------------- | ---------------------------------- | ----------- | ----------------------------------------------------- |
|
|
12
12
|
| `children` | `Snippet<[TimePickerSegmentPart]>` | `undefined` | Optional custom renderer for each segment part. |
|
|
13
13
|
| `class` | `string` | `''` | CSS class names for the group element. |
|
|
14
|
-
| `aria-label` | `string` | `undefined` |
|
|
14
|
+
| `aria-label` | `string` | `undefined` | The accessible name of the input. group. |
|
|
15
15
|
| `...restProps` | `HTMLAttributes<HTMLDivElement>` | `-` | Additional attributes forwarded to the group element. |
|
|
@@ -12,17 +12,37 @@
|
|
|
12
12
|
|
|
13
13
|
type TimePickerInputProps = Omit<
|
|
14
14
|
HTMLAttributes<HTMLDivElement>,
|
|
15
|
-
'children' | 'class' | 'id' | 'role' | 'tabindex'
|
|
15
|
+
'children' | 'class' | 'id' | 'role' | 'tabindex' | 'aria-invalid'
|
|
16
16
|
> & {
|
|
17
|
+
/**
|
|
18
|
+
* The id of the hidden proxy input. A `<label for>` points to it, and the segmented group
|
|
19
|
+
* then takes a derived id.
|
|
20
|
+
*/
|
|
21
|
+
id?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Name of the hidden proxy input for form submission. The proxy shows only the committed
|
|
24
|
+
* value. It does not support autofill: it renders with `autocomplete="off"`, thus browsers
|
|
25
|
+
* and password managers do not write into it. The user gives the time through the editable
|
|
26
|
+
* segments.
|
|
27
|
+
*/
|
|
28
|
+
name?: string;
|
|
17
29
|
children?: Snippet<[TimePickerSegmentPart]>;
|
|
18
30
|
class?: string;
|
|
19
31
|
'aria-label'?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Marks the input as invalid. The group is also invalid while a segment draft is not
|
|
34
|
+
* committable.
|
|
35
|
+
*/
|
|
36
|
+
'aria-invalid'?: HTMLAttributes<HTMLDivElement>['aria-invalid'];
|
|
20
37
|
};
|
|
21
38
|
|
|
22
39
|
let {
|
|
40
|
+
id,
|
|
41
|
+
name,
|
|
23
42
|
children,
|
|
24
43
|
class: className = '',
|
|
25
44
|
'aria-label': ariaLabel,
|
|
45
|
+
'aria-invalid': ariaInvalid,
|
|
26
46
|
onmousedown: onMouseDownExternal,
|
|
27
47
|
onfocus: onFocusExternal,
|
|
28
48
|
onblur: onBlurExternal,
|
|
@@ -32,7 +52,28 @@
|
|
|
32
52
|
|
|
33
53
|
const timePicker = useTimePickerContext();
|
|
34
54
|
const segments = $derived(timePicker.getSegments());
|
|
35
|
-
|
|
55
|
+
// With an `id` the group keeps a derived one: the id itself belongs to the proxy input, so
|
|
56
|
+
// a `<label for>` points at something focusable. Mirrors `DatePicker.Input`.
|
|
57
|
+
const groupId = $derived(id ? `${id}-group` : `${timePicker.id}-input`);
|
|
58
|
+
const proxyValue = $derived(timePicker.value ?? '');
|
|
59
|
+
// Invalid is either half: the consumer's (a form rule) or an uncommittable segment draft.
|
|
60
|
+
const isInvalid = $derived(
|
|
61
|
+
ariaInvalid === true || ariaInvalid === 'true' || timePicker.isInvalidDraft
|
|
62
|
+
);
|
|
63
|
+
const shouldRenderProxyInput = $derived(Boolean(id || name));
|
|
64
|
+
const proxyInputStyle =
|
|
65
|
+
'position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;';
|
|
66
|
+
|
|
67
|
+
function handleProxyFocus(event: FocusEvent) {
|
|
68
|
+
if (timePicker.isDisabled) {
|
|
69
|
+
(event.currentTarget as HTMLElement | null)?.blur();
|
|
70
|
+
timePicker.syncFocusWithin();
|
|
71
|
+
timePicker.setFocusVisible(false);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
timePicker.setFocusVisible(shouldShowFocusVisible(event.currentTarget as HTMLElement));
|
|
75
|
+
timePicker.focusNextPlaceholderOrLastSegment();
|
|
76
|
+
}
|
|
36
77
|
|
|
37
78
|
function handleMouseDown(event: MouseEvent) {
|
|
38
79
|
if (timePicker.isDisabled) return;
|
|
@@ -83,15 +124,35 @@
|
|
|
83
124
|
}
|
|
84
125
|
</script>
|
|
85
126
|
|
|
127
|
+
{#if shouldRenderProxyInput}
|
|
128
|
+
<!--
|
|
129
|
+
A focusable stand-in for the segmented group: it carries the `id` a `<label for>` points
|
|
130
|
+
at and the `name` a native form submit reads, and hands focus straight to the segments.
|
|
131
|
+
-->
|
|
132
|
+
<input
|
|
133
|
+
{id}
|
|
134
|
+
{name}
|
|
135
|
+
value={proxyValue}
|
|
136
|
+
readonly
|
|
137
|
+
tabindex="-1"
|
|
138
|
+
autocomplete="off"
|
|
139
|
+
disabled={timePicker.isDisabled || undefined}
|
|
140
|
+
aria-hidden="true"
|
|
141
|
+
aria-invalid={ariaInvalid}
|
|
142
|
+
style={proxyInputStyle}
|
|
143
|
+
onfocus={handleProxyFocus}
|
|
144
|
+
/>
|
|
145
|
+
{/if}
|
|
146
|
+
|
|
86
147
|
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
87
148
|
<!-- svelte-ignore a11y_role_supports_aria_props -->
|
|
88
149
|
<div
|
|
89
|
-
id={
|
|
150
|
+
id={groupId}
|
|
90
151
|
class={className}
|
|
91
152
|
{...restProps}
|
|
92
153
|
role="group"
|
|
93
154
|
aria-label={ariaLabel}
|
|
94
|
-
aria-invalid={
|
|
155
|
+
aria-invalid={isInvalid || undefined}
|
|
95
156
|
aria-required={timePicker.isRequired || undefined}
|
|
96
157
|
tabindex={timePicker.isDisabled || timePicker.focusWithin ? -1 : 0}
|
|
97
158
|
data-disabled={timePicker.isDisabled || undefined}
|
|
@@ -99,7 +160,7 @@
|
|
|
99
160
|
data-open={timePicker.open || undefined}
|
|
100
161
|
data-focus-visible={timePicker.focusVisible || undefined}
|
|
101
162
|
data-focus-within={timePicker.focusWithin || undefined}
|
|
102
|
-
data-invalid={
|
|
163
|
+
data-invalid={isInvalid || undefined}
|
|
103
164
|
onmousedown={composeEventHandlers(handleMouseDown, onMouseDownExternal ?? undefined)}
|
|
104
165
|
onfocus={composeEventHandlers(handleFocus, onFocusExternal ?? undefined)}
|
|
105
166
|
onblur={composeEventHandlers(handleBlur, onBlurExternal ?? undefined)}
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import { type TimePickerSegmentPart } from '../root/context';
|
|
4
|
-
type TimePickerInputProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class' | 'id' | 'role' | 'tabindex'> & {
|
|
4
|
+
type TimePickerInputProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class' | 'id' | 'role' | 'tabindex' | 'aria-invalid'> & {
|
|
5
|
+
/**
|
|
6
|
+
* The id of the hidden proxy input. A `<label for>` points to it, and the segmented group
|
|
7
|
+
* then takes a derived id.
|
|
8
|
+
*/
|
|
9
|
+
id?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Name of the hidden proxy input for form submission. The proxy shows only the committed
|
|
12
|
+
* value. It does not support autofill: it renders with `autocomplete="off"`, thus browsers
|
|
13
|
+
* and password managers do not write into it. The user gives the time through the editable
|
|
14
|
+
* segments.
|
|
15
|
+
*/
|
|
16
|
+
name?: string;
|
|
5
17
|
children?: Snippet<[TimePickerSegmentPart]>;
|
|
6
18
|
class?: string;
|
|
7
19
|
'aria-label'?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Marks the input as invalid. The group is also invalid while a segment draft is not
|
|
22
|
+
* committable.
|
|
23
|
+
*/
|
|
24
|
+
'aria-invalid'?: HTMLAttributes<HTMLDivElement>['aria-invalid'];
|
|
8
25
|
};
|
|
9
26
|
declare const TimePickerInput: import("svelte").Component<TimePickerInputProps, {}, "">;
|
|
10
27
|
type TimePickerInput = ReturnType<typeof TimePickerInput>;
|
|
@@ -26,7 +26,7 @@ Description: State container for segmented time input, popover lifecycle, wheel
|
|
|
26
26
|
| `readonly` | `boolean` | `false` | Prevents value changes while keeping focus/navigation. |
|
|
27
27
|
| `required` | `boolean` | `false` | Propagates required state to input accessibility attributes. |
|
|
28
28
|
| `children` | `Snippet` | `undefined` | Composed `TimePicker` parts. |
|
|
29
|
-
| `class` | `string` | `''` | CSS class names
|
|
29
|
+
| `class` | `string` | `''` | The CSS class names of the root element. |
|
|
30
30
|
| `element` | `HTMLDivElement \| null` | `bindable` | Reference to the root DOM element. |
|
|
31
31
|
| `aria-label` | `string` | `undefined` | Accessible label for the root wrapper. |
|
|
32
32
|
|
|
@@ -10,5 +10,5 @@ Description: Button part that toggles `TimePicker.Popover` and synchronizes focu
|
|
|
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. |
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Toast
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
`Toast` shows a short message about an event, for a time, without a stop of the work. The provider holds the list, and the viewport is the landmark where the toasts land. A screen reader hears each message from a live region beside them.
|
|
6
|
+
|
|
7
|
+
## Anatomy
|
|
8
|
+
|
|
9
|
+
- `Toast.Provider`
|
|
10
|
+
- `Toast.Viewport`
|
|
11
|
+
- `Toast.Positioner`
|
|
12
|
+
- `Toast.Root`
|
|
13
|
+
- `Toast.Content`
|
|
14
|
+
- `Toast.Title`
|
|
15
|
+
- `Toast.Description`
|
|
16
|
+
- `Toast.Action`
|
|
17
|
+
- `Toast.Close`
|
|
18
|
+
|
|
19
|
+
```svelte
|
|
20
|
+
<Toast.Provider>
|
|
21
|
+
<App />
|
|
22
|
+
<Toast.Viewport>
|
|
23
|
+
{#snippet children(toast)}
|
|
24
|
+
<Toast.Root {toast}>
|
|
25
|
+
<Toast.Content>
|
|
26
|
+
<Toast.Title />
|
|
27
|
+
<Toast.Description />
|
|
28
|
+
</Toast.Content>
|
|
29
|
+
<Toast.Close aria-label="Close">x</Toast.Close>
|
|
30
|
+
</Toast.Root>
|
|
31
|
+
{/snippet}
|
|
32
|
+
</Toast.Viewport>
|
|
33
|
+
</Toast.Provider>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage guidelines
|
|
37
|
+
|
|
38
|
+
- Put one `Toast.Provider` around the app, and one `Toast.Viewport` in it.
|
|
39
|
+
- Call `useToastManager()` in a component under the provider, or `bind:manager` on the provider, to `add`, `update`, `close` and `promise`.
|
|
40
|
+
- Give `title` and `description` as text: that text is the announcement. The parts show it without children.
|
|
41
|
+
- Keep the buttons out of `Toast.Content`, thus the announcement does not read them.
|
|
42
|
+
- Use `priority: 'high'` only for a message that cannot wait. It interrupts the screen reader.
|
|
43
|
+
- Keep the default `timeout` at 5 seconds or more. A user who reads slowly needs the time.
|
|
44
|
+
- Give `anchor` to `add`, and put `Toast.Positioner` around the root, for a toast against an element.
|
|
45
|
+
- Style the stack with `--toast-index`, `--toast-offset-y`, `--toast-height`, `--toast-frontmost-height`, `data-front` and `data-expanded`. Move the toast with `--toast-swipe-movement-x` and `--toast-swipe-movement-y`.
|
|
46
|
+
- A toast that closes is out of the stack at once, and it keeps the place it had for its exit. It drops `data-front`, thus a rule that hides the toasts behind needs `:not([data-ending])`.
|
|
47
|
+
- Move the enter motion with `translate`, and leave `transform` to the place in the stack. A toast pushed back mid-enter then slides.
|
|
48
|
+
- A toast past the limit waits in the place behind the stack, and it comes forward one step when a place frees.
|
|
49
|
+
- Cover the gap between two spread toasts with a pseudo-element, or the pointer leaves the viewport between them.
|
|
50
|
+
|
|
51
|
+
## API reference
|
|
52
|
+
|
|
53
|
+
- `Toast.Provider`
|
|
54
|
+
- `timeout?: number` (5000), `limit?: number` (3)
|
|
55
|
+
- `manager?: ToastManager` (bindable)
|
|
56
|
+
- `Toast.Viewport`
|
|
57
|
+
- `children: Snippet<[ToastItem]>`, `portal?: boolean` (true)
|
|
58
|
+
- `Toast.Positioner`
|
|
59
|
+
- `toast: ToastItem`
|
|
60
|
+
- `Toast.Root`
|
|
61
|
+
- `toast: ToastItem`, `swipeDirection?: SwipeSide[]` (`['bottom', 'right']`)
|
|
62
|
+
- `Toast.Action`
|
|
63
|
+
- `keepOpen?: boolean`
|
|
64
|
+
- `ToastManager`
|
|
65
|
+
- `add({ title, description, type, timeout, priority, data, anchor, placement, offset }) => id`, `update(id, options | (toast) => options)`, `close(id?)`, `promise(promise, { loading, success, error })`
|
|
66
|
+
- `pauseTimers()`, `resumeTimers()`, `toasts`, `visibleToasts`
|
|
67
|
+
|
|
68
|
+
## Accessibility
|
|
69
|
+
|
|
70
|
+
- `Toast.Viewport` is a `role="region"` landmark, named with the count of toasts. `F6` moves the focus into it from anywhere on the page, and back.
|
|
71
|
+
- Two live regions beside the viewport announce each toast: `role="status"` for the normal priority, and `role="alert"` for the high priority. The message is the title and the description.
|
|
72
|
+
- `Toast.Root` is a `role="dialog"` that is not modal, or an `alertdialog` for the high priority. It has `aria-labelledby` from the title and `aria-describedby` from the description, and it is a tab stop.
|
|
73
|
+
- `Escape` closes the focused toast, and the focus moves to the next toast, or back to where it was.
|
|
74
|
+
- The timers stop while the pointer rests on the viewport, and while the focus is in it. A tap on a toast, not a swipe, holds the stack open, and the timers with it, until a touch outside the viewport. They also stop while the tab is hidden.
|
|
75
|
+
- The viewport stays reachable behind a modal dialog, with `F6` and `Tab`.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ButtonRoot } from '../../button/index.js';
|
|
3
|
+
import { SWIPE_IGNORE_ATTRIBUTE } from '../../primitives/swipe-gesture';
|
|
4
|
+
import { useToastContext } from '../root/context';
|
|
5
|
+
import type { ToastActionProps } from '../types.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Toast.Action — a button that does the one thing the toast offers, such as `Undo`.
|
|
9
|
+
*
|
|
10
|
+
* The press closes the toast, because the offer is taken. `keepOpen` holds it for an action
|
|
11
|
+
* that changes the toast instead. A swipe never starts on it.
|
|
12
|
+
*/
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
class: className = '',
|
|
16
|
+
keepOpen = false,
|
|
17
|
+
element = $bindable<HTMLButtonElement | null>(null),
|
|
18
|
+
onclick,
|
|
19
|
+
...restProps
|
|
20
|
+
}: ToastActionProps = $props();
|
|
21
|
+
|
|
22
|
+
const ctx = useToastContext('Toast.Action');
|
|
23
|
+
const swipeIgnore = { [SWIPE_IGNORE_ATTRIBUTE]: '' };
|
|
24
|
+
|
|
25
|
+
function handleClick(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) {
|
|
26
|
+
onclick?.(event);
|
|
27
|
+
if (event.defaultPrevented || keepOpen) return;
|
|
28
|
+
ctx.close();
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<ButtonRoot
|
|
33
|
+
{...restProps}
|
|
34
|
+
{...swipeIgnore}
|
|
35
|
+
bind:element
|
|
36
|
+
class={className}
|
|
37
|
+
type="button"
|
|
38
|
+
data-toast-action="true"
|
|
39
|
+
onclick={handleClick}
|
|
40
|
+
>
|
|
41
|
+
{@render children?.()}
|
|
42
|
+
</ButtonRoot>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ButtonRoot } from '../../button/index.js';
|
|
3
|
+
import { SWIPE_IGNORE_ATTRIBUTE } from '../../primitives/swipe-gesture';
|
|
4
|
+
import { useToastContext } from '../root/context';
|
|
5
|
+
import type { ToastCloseProps } from '../types.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Toast.Close — a button that closes the toast.
|
|
9
|
+
*
|
|
10
|
+
* Put it outside `Toast.Content`, thus the announcement of the toast does not read it. Give
|
|
11
|
+
* it a name, in its text or in `aria-label`. A swipe never starts on it.
|
|
12
|
+
*/
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
class: className = '',
|
|
16
|
+
element = $bindable<HTMLButtonElement | null>(null),
|
|
17
|
+
onclick,
|
|
18
|
+
...restProps
|
|
19
|
+
}: ToastCloseProps = $props();
|
|
20
|
+
|
|
21
|
+
const ctx = useToastContext('Toast.Close');
|
|
22
|
+
const swipeIgnore = { [SWIPE_IGNORE_ATTRIBUTE]: '' };
|
|
23
|
+
|
|
24
|
+
function handleClick(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) {
|
|
25
|
+
onclick?.(event);
|
|
26
|
+
if (event.defaultPrevented) return;
|
|
27
|
+
ctx.close();
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<ButtonRoot
|
|
32
|
+
{...restProps}
|
|
33
|
+
{...swipeIgnore}
|
|
34
|
+
bind:element
|
|
35
|
+
class={className}
|
|
36
|
+
type="button"
|
|
37
|
+
data-toast-close="true"
|
|
38
|
+
onclick={handleClick}
|
|
39
|
+
>
|
|
40
|
+
{@render children?.()}
|
|
41
|
+
</ButtonRoot>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useToastContext } from '../root/context';
|
|
3
|
+
import type { ToastContentProps } from '../types.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Toast.Content — the message: the title and the description.
|
|
7
|
+
*
|
|
8
|
+
* Keep the buttons out of it. The message is what the viewport announces, and the buttons
|
|
9
|
+
* are what the user presses after it.
|
|
10
|
+
*/
|
|
11
|
+
let { children, class: className = '', ...restProps }: ToastContentProps = $props();
|
|
12
|
+
|
|
13
|
+
const ctx = useToastContext('Toast.Content');
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div
|
|
17
|
+
{...restProps}
|
|
18
|
+
class={className}
|
|
19
|
+
data-toast-content="true"
|
|
20
|
+
data-type={ctx.toast.type}
|
|
21
|
+
data-priority={ctx.toast.priority}
|
|
22
|
+
>
|
|
23
|
+
{@render children?.()}
|
|
24
|
+
</div>
|