@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
|
@@ -9,7 +9,7 @@ Description: Dialog state container for open state, trigger ref, and root-level
|
|
|
9
9
|
|
|
10
10
|
| Prop | Type | Default | Description |
|
|
11
11
|
| -------------- | ------------------------------- | ----------- | ------------------------------------------------------- |
|
|
12
|
-
| `open` | `boolean` | `undefined` |
|
|
12
|
+
| `open` | `boolean` | `undefined` | The open state. Supports `bind:open`. |
|
|
13
13
|
| `defaultOpen` | `boolean` | `false` | Initial open state in uncontrolled mode. |
|
|
14
14
|
| `onOpenChange` | `(open: boolean) => void` | `undefined` | Called whenever open state changes. |
|
|
15
15
|
| `triggerRef` | `HTMLElement \| null` | `null` | Trigger reference. Supports `bind:triggerRef`. |
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { untrack, type Snippet } from 'svelte';
|
|
2
|
+
import { tick, untrack, type Snippet } from 'svelte';
|
|
3
3
|
import { setDialogContext, type DialogContext } from './context';
|
|
4
4
|
import type { DialogStateHelpers } from './types';
|
|
5
|
+
import { focusFellToBody } from '../../primitives/trigger-focus-state';
|
|
5
6
|
import {
|
|
6
7
|
focusWithModality,
|
|
7
8
|
resolveCloseInteractionModality
|
|
@@ -13,22 +14,24 @@
|
|
|
13
14
|
* Provides context for Trigger and Content children.
|
|
14
15
|
*/
|
|
15
16
|
type DialogRootProps = {
|
|
16
|
-
/**
|
|
17
|
+
/** The open state. By default it goes in the two directions: use `bind:open`. */
|
|
17
18
|
open?: boolean;
|
|
18
|
-
/**
|
|
19
|
+
/** The open state at the start, for when you give no `open`. */
|
|
19
20
|
defaultOpen?: boolean;
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* Give your own code full control of the open state. The component stops to write back to
|
|
23
|
+
* `open`, and it reports only through `onOpenChange`. Thus the parent can refuse a change: the
|
|
24
|
+
* parent does not send the new value down. The default is off, because `bind:open` is the usual
|
|
25
|
+
* case and it needs the write-back.
|
|
25
26
|
*/
|
|
26
27
|
controlledOpen?: boolean;
|
|
27
|
-
/**
|
|
28
|
+
/** The component calls it when the open state changes. */
|
|
28
29
|
onOpenChange?: (open: boolean) => void;
|
|
29
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* The reference to the trigger element. Set it in your own code, or let Dialog.Trigger set it.
|
|
32
|
+
*/
|
|
30
33
|
triggerRef?: HTMLElement | null;
|
|
31
|
-
/**
|
|
34
|
+
/** The children snippet. It receives the state functions: { close, open, toggle, isOpen }. */
|
|
32
35
|
children?: Snippet<[DialogStateHelpers]>;
|
|
33
36
|
};
|
|
34
37
|
|
|
@@ -81,6 +84,41 @@
|
|
|
81
84
|
setOpen(true);
|
|
82
85
|
}
|
|
83
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Focuses `target`, and tries once more after the update this close kicks off.
|
|
89
|
+
*
|
|
90
|
+
* While a modal dialog is open, `ariaHideOutside` marks everything outside the
|
|
91
|
+
* panel `inert` — the trigger included — and `focus()` on an inert element is a
|
|
92
|
+
* no-op. The attribute is only lifted during that update, so the first attempt
|
|
93
|
+
* can silently land on `<body>`. It does exactly that whenever the panel has an
|
|
94
|
+
* exit animation, which keeps the content (and the `inert` with it) alive past
|
|
95
|
+
* the state change. The retry costs nothing when the first attempt worked.
|
|
96
|
+
*/
|
|
97
|
+
function restoreFocusTo(
|
|
98
|
+
target: HTMLElement,
|
|
99
|
+
modality: ReturnType<typeof resolveCloseInteractionModality>,
|
|
100
|
+
reason: string = 'imperative-action'
|
|
101
|
+
) {
|
|
102
|
+
// An outside press moves the focus after this runs: the browser sends it to the
|
|
103
|
+
// pressed element, and to the body when that element takes no focus — which is every
|
|
104
|
+
// element outside a modal, since the page is inert. A restore made now is undone a
|
|
105
|
+
// moment later, so it waits a frame and then fills the gap the press left.
|
|
106
|
+
if (reason === 'outside-press') {
|
|
107
|
+
requestAnimationFrame(() => {
|
|
108
|
+
if (!target.isConnected || !focusFellToBody()) return;
|
|
109
|
+
focusWithModality(target, modality);
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
focusWithModality(target, modality);
|
|
114
|
+
if (document.activeElement === target) return;
|
|
115
|
+
|
|
116
|
+
void tick().then(() => {
|
|
117
|
+
if (!target.isConnected || document.activeElement === target) return;
|
|
118
|
+
focusWithModality(target, modality);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
84
122
|
function closeDialog(reason: DialogCloseReason = 'imperative-action', event?: Event) {
|
|
85
123
|
const wasOpen = isOpen;
|
|
86
124
|
setOpen(false);
|
|
@@ -88,7 +126,7 @@
|
|
|
88
126
|
// back down) — don't steal focus while the dialog is still open.
|
|
89
127
|
if (!wasOpen || isOpen) return;
|
|
90
128
|
if (triggerRef) {
|
|
91
|
-
|
|
129
|
+
restoreFocusTo(triggerRef, resolveCloseInteractionModality(reason, event), reason);
|
|
92
130
|
}
|
|
93
131
|
}
|
|
94
132
|
|
|
@@ -5,22 +5,24 @@ import type { DialogStateHelpers } from './types';
|
|
|
5
5
|
* Provides context for Trigger and Content children.
|
|
6
6
|
*/
|
|
7
7
|
type DialogRootProps = {
|
|
8
|
-
/**
|
|
8
|
+
/** The open state. By default it goes in the two directions: use `bind:open`. */
|
|
9
9
|
open?: boolean;
|
|
10
|
-
/**
|
|
10
|
+
/** The open state at the start, for when you give no `open`. */
|
|
11
11
|
defaultOpen?: boolean;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* Give your own code full control of the open state. The component stops to write back to
|
|
14
|
+
* `open`, and it reports only through `onOpenChange`. Thus the parent can refuse a change: the
|
|
15
|
+
* parent does not send the new value down. The default is off, because `bind:open` is the usual
|
|
16
|
+
* case and it needs the write-back.
|
|
17
17
|
*/
|
|
18
18
|
controlledOpen?: boolean;
|
|
19
|
-
/**
|
|
19
|
+
/** The component calls it when the open state changes. */
|
|
20
20
|
onOpenChange?: (open: boolean) => void;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* The reference to the trigger element. Set it in your own code, or let Dialog.Trigger set it.
|
|
23
|
+
*/
|
|
22
24
|
triggerRef?: HTMLElement | null;
|
|
23
|
-
/**
|
|
25
|
+
/** The children snippet. It receives the state functions: { close, open, toggle, isOpen }. */
|
|
24
26
|
children?: Snippet<[DialogStateHelpers]>;
|
|
25
27
|
};
|
|
26
28
|
declare const DialogRoot: import("svelte").Component<DialogRootProps, {}, "open" | "triggerRef">;
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
* the text inside it.
|
|
13
13
|
*/
|
|
14
14
|
type DialogTitleProps = {
|
|
15
|
-
/** The dialog
|
|
15
|
+
/** The name of the dialog. */
|
|
16
16
|
children?: Snippet;
|
|
17
|
-
/** CSS class
|
|
17
|
+
/** The CSS class names of the heading. */
|
|
18
18
|
class?: string;
|
|
19
|
-
/**
|
|
19
|
+
/** Replaces the id that the component makes. */
|
|
20
20
|
id?: string;
|
|
21
21
|
} & Omit<HTMLAttributes<HTMLHeadingElement>, 'class' | 'children' | 'id'>;
|
|
22
22
|
|
|
@@ -9,11 +9,11 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
9
9
|
* the text inside it.
|
|
10
10
|
*/
|
|
11
11
|
type DialogTitleProps = {
|
|
12
|
-
/** The dialog
|
|
12
|
+
/** The name of the dialog. */
|
|
13
13
|
children?: Snippet;
|
|
14
|
-
/** CSS class
|
|
14
|
+
/** The CSS class names of the heading. */
|
|
15
15
|
class?: string;
|
|
16
|
-
/**
|
|
16
|
+
/** Replaces the id that the component makes. */
|
|
17
17
|
id?: string;
|
|
18
18
|
} & Omit<HTMLAttributes<HTMLHeadingElement>, 'class' | 'children' | 'id'>;
|
|
19
19
|
declare const DialogTitle: import("svelte").Component<DialogTitleProps, {}, "">;
|
|
@@ -9,6 +9,6 @@ Description: Button trigger part that wires itself as the trigger and toggles th
|
|
|
9
9
|
|
|
10
10
|
| Prop | Type | Default | Description |
|
|
11
11
|
| -------------- | ---------------------- | ----------- | -------------------------------------------------------------------------- |
|
|
12
|
-
| `children` | `Snippet` | `undefined` |
|
|
12
|
+
| `children` | `Snippet` | `undefined` | The content of the button. |
|
|
13
13
|
| `class` | `string` | `''` | CSS class names for the button. |
|
|
14
14
|
| `...restProps` | `HTMLButtonAttributes` | `-` | Additional native button attributes, excluding reserved trigger semantics. |
|
package/dist/drawer/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Description
|
|
4
4
|
|
|
5
|
-
`Drawer` is a panel anchored to an edge of the viewport that can be dismissed by swiping it away. It
|
|
5
|
+
`Drawer` is a panel anchored to an edge of the viewport that can be dismissed by swiping it away. It behaves like a modal dialog: the focus stays in the panel and the page does not scroll. The `Escape` key and a press outside it close it. It adds what a sheet needs on a telephone: the drag, the snap points, the stack, and a knowledge of the keyboard.
|
|
6
6
|
|
|
7
7
|
## Usage guidelines
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
- Render `Drawer.Overlay` and the panel inside `Drawer.Portal`.
|
|
11
11
|
- Always give the drawer a `Drawer.Title`. A `role="dialog"` takes its name from `aria-labelledby`, not from the text inside it.
|
|
12
12
|
- Always give a dismissible drawer a `Drawer.Close`. A swipe has no keyboard or screen-reader equivalent, so a drawer that can only be swiped away is unreachable for some users.
|
|
13
|
-
-
|
|
13
|
+
- Put the content in `Drawer.Body`. Thus a scroll that gets to its end does not continue on the page behind. A mouse drag in it also selects the text, and does not move the panel. Leave the grab bar outside it, as the surface a mouse can still drag by.
|
|
14
14
|
- Mark any control with a drag of its own — a slider, a carousel — with `data-hk-swipe-ignore`. Valueless opts it out for every input type; `="mouse"` opts it out for a mouse only.
|
|
15
15
|
- Put `Drawer.SwipeArea` OUTSIDE `Drawer.Portal` — it has to exist while the drawer is closed.
|
|
16
16
|
- Wrap `Drawer.Root` in `Drawer.VirtualKeyboardProvider` when the panel contains form fields.
|
|
@@ -107,5 +107,5 @@ The resting transform is the sum of the snap point and the drag:
|
|
|
107
107
|
|
|
108
108
|
This drawer is modelled on Base UI's, with two deliberate differences:
|
|
109
109
|
|
|
110
|
-
- The panel part is `Drawer.Content
|
|
110
|
+
- The panel part is `Drawer.Content`, and Base UI calls it `Popup`. The region that scrolls is `Drawer.Body`, and Base UI calls that one `Content`. Thus the names agree with `Dialog` and `Popover` in this library.
|
|
111
111
|
- There is no `Drawer.Provider`. The drawer stack is module-global here, so a provider would have nothing left to coordinate; `Drawer.Indent` reads the stack directly.
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
* forcing it here would fight consumers whose panel sizes to its content.
|
|
26
26
|
*/
|
|
27
27
|
type DrawerBodyProps = {
|
|
28
|
-
/**
|
|
28
|
+
/** The content of the body region. */
|
|
29
29
|
children?: Snippet;
|
|
30
|
-
/** CSS class
|
|
30
|
+
/** The CSS class names of the body. */
|
|
31
31
|
class?: string;
|
|
32
32
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'>;
|
|
33
33
|
|
|
@@ -22,9 +22,9 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
22
22
|
* forcing it here would fight consumers whose panel sizes to its content.
|
|
23
23
|
*/
|
|
24
24
|
type DrawerBodyProps = {
|
|
25
|
-
/**
|
|
25
|
+
/** The content of the body region. */
|
|
26
26
|
children?: Snippet;
|
|
27
|
-
/** CSS class
|
|
27
|
+
/** The CSS class names of the body. */
|
|
28
28
|
class?: string;
|
|
29
29
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'>;
|
|
30
30
|
declare const DrawerBody: import("svelte").Component<DrawerBodyProps, {}, "">;
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
* unreachable for some users. Every dismissible drawer wants one of these.
|
|
13
13
|
*/
|
|
14
14
|
export type DrawerCloseProps = Omit<HTMLButtonAttributes, 'type' | 'class' | 'children'> & {
|
|
15
|
-
/**
|
|
15
|
+
/** The name on the button. */
|
|
16
16
|
children?: Snippet;
|
|
17
|
-
/** CSS class
|
|
17
|
+
/** The CSS class names of the button. */
|
|
18
18
|
class?: string;
|
|
19
|
-
/**
|
|
19
|
+
/** A bindable reference to the button element. */
|
|
20
20
|
element?: HTMLButtonElement | null;
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -8,11 +8,11 @@ import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
|
8
8
|
* unreachable for some users. Every dismissible drawer wants one of these.
|
|
9
9
|
*/
|
|
10
10
|
export type DrawerCloseProps = Omit<HTMLButtonAttributes, 'type' | 'class' | 'children'> & {
|
|
11
|
-
/**
|
|
11
|
+
/** The name on the button. */
|
|
12
12
|
children?: Snippet;
|
|
13
|
-
/** CSS class
|
|
13
|
+
/** The CSS class names of the button. */
|
|
14
14
|
class?: string;
|
|
15
|
-
/**
|
|
15
|
+
/** A bindable reference to the button element. */
|
|
16
16
|
element?: HTMLButtonElement | null;
|
|
17
17
|
};
|
|
18
18
|
declare const DrawerClose: import("svelte").Component<DrawerCloseProps, {}, "element">;
|
|
@@ -51,21 +51,24 @@
|
|
|
51
51
|
* Belongs inside a Drawer.Portal, optionally wrapped in a Drawer.Viewport.
|
|
52
52
|
*/
|
|
53
53
|
type DrawerContentProps = {
|
|
54
|
-
/**
|
|
54
|
+
/** The content of the panel. */
|
|
55
55
|
children?: Snippet;
|
|
56
|
-
/** CSS class
|
|
56
|
+
/** The CSS class names of the panel. */
|
|
57
57
|
class?: string;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
59
|
+
* The element that gets the focus when the drawer opens. The default is the first element in the
|
|
60
|
+
* panel that can take the focus.
|
|
61
61
|
*/
|
|
62
62
|
initialFocus?: HTMLElement | string | (() => HTMLElement | null | undefined);
|
|
63
63
|
/**
|
|
64
|
-
* `touch-action`
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* axis
|
|
68
|
-
*
|
|
64
|
+
* The `touch-action` value of the panel.
|
|
65
|
+
*
|
|
66
|
+
* For a left drawer or a right drawer, the default is `pan-y`. The children still scroll on the
|
|
67
|
+
* vertical axis, and the horizontal axis belongs to the drag.
|
|
68
|
+
*
|
|
69
|
+
* For a top drawer or a bottom drawer, there is no default. A reservation of the vertical axis
|
|
70
|
+
* would break each region in the panel that scrolls. `touch-action` applies down the chain of
|
|
71
|
+
* the parents, and a child cannot cancel it.
|
|
69
72
|
*/
|
|
70
73
|
touchAction?: string | null;
|
|
71
74
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'>;
|
|
@@ -5,21 +5,24 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
5
5
|
* Belongs inside a Drawer.Portal, optionally wrapped in a Drawer.Viewport.
|
|
6
6
|
*/
|
|
7
7
|
type DrawerContentProps = {
|
|
8
|
-
/**
|
|
8
|
+
/** The content of the panel. */
|
|
9
9
|
children?: Snippet;
|
|
10
|
-
/** CSS class
|
|
10
|
+
/** The CSS class names of the panel. */
|
|
11
11
|
class?: string;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* The element that gets the focus when the drawer opens. The default is the first element in the
|
|
14
|
+
* panel that can take the focus.
|
|
15
15
|
*/
|
|
16
16
|
initialFocus?: HTMLElement | string | (() => HTMLElement | null | undefined);
|
|
17
17
|
/**
|
|
18
|
-
* `touch-action`
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* axis
|
|
22
|
-
*
|
|
18
|
+
* The `touch-action` value of the panel.
|
|
19
|
+
*
|
|
20
|
+
* For a left drawer or a right drawer, the default is `pan-y`. The children still scroll on the
|
|
21
|
+
* vertical axis, and the horizontal axis belongs to the drag.
|
|
22
|
+
*
|
|
23
|
+
* For a top drawer or a bottom drawer, there is no default. A reservation of the vertical axis
|
|
24
|
+
* would break each region in the panel that scrolls. `touch-action` applies down the chain of
|
|
25
|
+
* the parents, and a child cannot cancel it.
|
|
23
26
|
*/
|
|
24
27
|
touchAction?: string | null;
|
|
25
28
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'>;
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
* than only when the user happens to arrow onto it.
|
|
12
12
|
*/
|
|
13
13
|
type DrawerDescriptionProps = {
|
|
14
|
-
/**
|
|
14
|
+
/** The text that a screen reader announces after the title. */
|
|
15
15
|
children?: Snippet;
|
|
16
|
-
/** CSS class
|
|
16
|
+
/** The CSS class names of the paragraph. */
|
|
17
17
|
class?: string;
|
|
18
|
-
/**
|
|
18
|
+
/** Replaces the id that the component makes. */
|
|
19
19
|
id?: string;
|
|
20
20
|
} & Omit<HTMLAttributes<HTMLParagraphElement>, 'class' | 'children' | 'id'>;
|
|
21
21
|
|
|
@@ -8,11 +8,11 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
8
8
|
* than only when the user happens to arrow onto it.
|
|
9
9
|
*/
|
|
10
10
|
type DrawerDescriptionProps = {
|
|
11
|
-
/**
|
|
11
|
+
/** The text that a screen reader announces after the title. */
|
|
12
12
|
children?: Snippet;
|
|
13
|
-
/** CSS class
|
|
13
|
+
/** The CSS class names of the paragraph. */
|
|
14
14
|
class?: string;
|
|
15
|
-
/**
|
|
15
|
+
/** Replaces the id that the component makes. */
|
|
16
16
|
id?: string;
|
|
17
17
|
} & Omit<HTMLAttributes<HTMLParagraphElement>, 'class' | 'children' | 'id'>;
|
|
18
18
|
declare const DrawerDescription: import("svelte").Component<DrawerDescriptionProps, {}, "">;
|
|
@@ -9,7 +9,7 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
9
9
|
* normally the same colour as the app.
|
|
10
10
|
*/
|
|
11
11
|
type DrawerIndentBackgroundProps = {
|
|
12
|
-
/** CSS class
|
|
12
|
+
/** The CSS class names of the layer. */
|
|
13
13
|
class?: string;
|
|
14
14
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'class'>;
|
|
15
15
|
declare const DrawerIndentBackground: import("svelte").Component<DrawerIndentBackgroundProps, {}, "">;
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
* module-global, so there is nothing left for one to coordinate.
|
|
26
26
|
*/
|
|
27
27
|
type DrawerIndentProps = {
|
|
28
|
-
/** The
|
|
28
|
+
/** The application UI that moves back while a drawer is open. */
|
|
29
29
|
children?: Snippet;
|
|
30
|
-
/** CSS class
|
|
30
|
+
/** The CSS class names of the container element. */
|
|
31
31
|
class?: string;
|
|
32
32
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'>;
|
|
33
33
|
|
|
@@ -22,9 +22,9 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
22
22
|
* module-global, so there is nothing left for one to coordinate.
|
|
23
23
|
*/
|
|
24
24
|
type DrawerIndentProps = {
|
|
25
|
-
/** The
|
|
25
|
+
/** The application UI that moves back while a drawer is open. */
|
|
26
26
|
children?: Snippet;
|
|
27
|
-
/** CSS class
|
|
27
|
+
/** The CSS class names of the container element. */
|
|
28
28
|
class?: string;
|
|
29
29
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'>;
|
|
30
30
|
declare const DrawerIndent: import("svelte").Component<DrawerIndentProps, {}, "">;
|
|
@@ -4,7 +4,7 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
4
4
|
* Belongs inside a Drawer.Portal.
|
|
5
5
|
*/
|
|
6
6
|
type DrawerOverlayProps = {
|
|
7
|
-
/** CSS class
|
|
7
|
+
/** The CSS class names of the overlay. */
|
|
8
8
|
class?: string;
|
|
9
9
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'class'>;
|
|
10
10
|
declare const DrawerOverlay: import("svelte").Component<DrawerOverlayProps, {}, "">;
|
|
@@ -5,7 +5,7 @@ import type { Snippet } from 'svelte';
|
|
|
5
5
|
* it can play before they leave.
|
|
6
6
|
*/
|
|
7
7
|
type DrawerPortalProps = {
|
|
8
|
-
/** The layers
|
|
8
|
+
/** The layers for the portal: the Overlay, and the Viewport or the Content. */
|
|
9
9
|
children?: Snippet;
|
|
10
10
|
};
|
|
11
11
|
declare const DrawerPortal: import("svelte").Component<DrawerPortalProps, {}, "">;
|
|
@@ -9,7 +9,7 @@ import type { DrawerModal, DrawerSide, DrawerCloseReason, DrawerSnapPoint } from
|
|
|
9
9
|
export type DrawerContext = {
|
|
10
10
|
/** Whether the drawer is open. */
|
|
11
11
|
readonly isOpen: boolean;
|
|
12
|
-
/**
|
|
12
|
+
/** The edge of the panel. */
|
|
13
13
|
readonly side: DrawerSide;
|
|
14
14
|
/** Focus/scroll behaviour: `true`, `'trap-focus'`, or `false`. */
|
|
15
15
|
readonly modal: DrawerModal;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
DrawerStateHelpers
|
|
15
15
|
} from './types';
|
|
16
16
|
import type { DrawerHandle } from './handle.svelte';
|
|
17
|
+
import { focusFellToBody } from '../../primitives/trigger-focus-state';
|
|
17
18
|
import {
|
|
18
19
|
focusWithModality,
|
|
19
20
|
resolveCloseInteractionModality
|
|
@@ -24,54 +25,56 @@
|
|
|
24
25
|
* Renders no element of its own; it provides the context every other part reads.
|
|
25
26
|
*/
|
|
26
27
|
type DrawerRootProps = {
|
|
27
|
-
/**
|
|
28
|
+
/** The open state. By default it goes in the two directions: use `bind:open`. */
|
|
28
29
|
open?: boolean;
|
|
29
|
-
/**
|
|
30
|
+
/** The open state at the start, for when you give no `open`. */
|
|
30
31
|
defaultOpen?: boolean;
|
|
31
32
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* Give your own code full control of the open state. The component stops to write back to
|
|
34
|
+
* `open`, and it reports only through `onOpenChange`. Thus the parent can refuse a change: the
|
|
35
|
+
* parent does not send the new value down. The default is off, because `bind:open` is the usual
|
|
36
|
+
* case and it needs the write-back.
|
|
36
37
|
*/
|
|
37
38
|
controlledOpen?: boolean;
|
|
38
39
|
/** Callback when the open state changes. */
|
|
39
40
|
onOpenChange?: (open: boolean) => void;
|
|
40
|
-
/**
|
|
41
|
+
/** The edge of the panel. */
|
|
41
42
|
side?: DrawerSide;
|
|
42
|
-
/**
|
|
43
|
+
/** How the drawer holds the focus and stops the page scroll. Read `DrawerModal`. */
|
|
43
44
|
modal?: DrawerModal;
|
|
44
|
-
/**
|
|
45
|
+
/** Lets a swipe toward the anchored edge dismiss the drawer. */
|
|
45
46
|
dismissible?: boolean;
|
|
46
|
-
/**
|
|
47
|
+
/** Closes the drawer when the user pushes the `Escape` key. */
|
|
47
48
|
shouldCloseOnEscape?: boolean;
|
|
48
|
-
/**
|
|
49
|
+
/** Closes the panel when the user presses outside it. */
|
|
49
50
|
shouldCloseOnInteractOutside?: boolean;
|
|
50
51
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
52
|
+
* The rest positions of the panel. They can be in any sequence, because the component sorts
|
|
53
|
+
* them. `DrawerSnapPoint` gives the value forms that the prop accepts. Without this prop, the
|
|
54
|
+
* drawer is open or closed, and nothing between.
|
|
54
55
|
*/
|
|
55
56
|
snapPoints?: readonly DrawerSnapPoint[];
|
|
56
|
-
/**
|
|
57
|
+
/** The current snap point. By default it goes in the two directions: use `bind:snapPoint`. */
|
|
57
58
|
snapPoint?: DrawerSnapPoint | null;
|
|
58
|
-
/**
|
|
59
|
+
/** The snap point at the start, for when you give no `snapPoint`. */
|
|
59
60
|
defaultSnapPoint?: DrawerSnapPoint | null;
|
|
60
|
-
/**
|
|
61
|
+
/** The component calls it when the current snap point changes. */
|
|
61
62
|
onSnapPointChange?: (snapPoint: DrawerSnapPoint | null, event?: Event) => void;
|
|
62
63
|
/**
|
|
63
|
-
* Stops a fast flick
|
|
64
|
-
*
|
|
64
|
+
* Stops a fast flick at the next snap point. Use it when each step has a meaning, and a jump of
|
|
65
|
+
* two steps would confuse the user.
|
|
65
66
|
*/
|
|
66
67
|
snapToSequentialPoints?: boolean;
|
|
67
68
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
69
|
+
* Controls the drawer from a separate object, and not from the `open` prop. Thus a trigger can
|
|
70
|
+
* be at any position in the tree. Read `createDrawerHandle`.
|
|
70
71
|
*/
|
|
71
72
|
handle?: DrawerHandle<Payload>;
|
|
72
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* The reference to the trigger element. Set it in your own code, or let Drawer.Trigger set it.
|
|
75
|
+
*/
|
|
73
76
|
triggerRef?: HTMLElement | null;
|
|
74
|
-
/**
|
|
77
|
+
/** The children snippet. It receives the state functions. */
|
|
75
78
|
children?: Snippet<[DrawerStateHelpers<Payload>]>;
|
|
76
79
|
};
|
|
77
80
|
|
|
@@ -182,8 +185,20 @@
|
|
|
182
185
|
*/
|
|
183
186
|
function restoreFocusTo(
|
|
184
187
|
target: HTMLElement,
|
|
185
|
-
modality: ReturnType<typeof resolveCloseInteractionModality
|
|
188
|
+
modality: ReturnType<typeof resolveCloseInteractionModality>,
|
|
189
|
+
reason: string = 'imperative-action'
|
|
186
190
|
) {
|
|
191
|
+
// An outside press moves the focus after this runs: the browser sends it to the
|
|
192
|
+
// pressed element, and to the body when that element takes no focus — which is every
|
|
193
|
+
// element outside a modal, since the page is inert. A restore made now is undone a
|
|
194
|
+
// moment later, so it waits a frame and then fills the gap the press left.
|
|
195
|
+
if (reason === 'outside-press') {
|
|
196
|
+
requestAnimationFrame(() => {
|
|
197
|
+
if (!target.isConnected || !focusFellToBody()) return;
|
|
198
|
+
focusWithModality(target, modality);
|
|
199
|
+
});
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
187
202
|
focusWithModality(target, modality);
|
|
188
203
|
if (document.activeElement === target) return;
|
|
189
204
|
|
|
@@ -203,7 +218,7 @@
|
|
|
203
218
|
// whichever one happened to register itself last.
|
|
204
219
|
const restoreTarget = handle?.trigger ?? triggerRef;
|
|
205
220
|
if (restoreTarget) {
|
|
206
|
-
restoreFocusTo(restoreTarget, resolveCloseInteractionModality(reason, event));
|
|
221
|
+
restoreFocusTo(restoreTarget, resolveCloseInteractionModality(reason, event), reason);
|
|
207
222
|
}
|
|
208
223
|
}
|
|
209
224
|
|