@human-kit/ui 1.0.0-beta.0 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -16
- package/dist/FOCUS_STATE_CONTRACT.md +18 -4
- package/dist/FOCUS_STATE_REVIEW_TEMPLATE.md +8 -8
- package/dist/accordion/README.md +3 -3
- package/dist/accordion/root/accordion-root.svelte +15 -3
- package/dist/accordion/root/context.svelte.js +4 -4
- package/dist/accordion/types.d.ts +40 -19
- package/dist/autocomplete/README.md +6 -7
- package/dist/autocomplete/empty/autocomplete-empty.svelte +1 -1
- package/dist/autocomplete/empty/autocomplete-empty.svelte.d.ts +1 -1
- package/dist/autocomplete/input/autocomplete-input.svelte +3 -3
- package/dist/autocomplete/input/autocomplete-input.svelte.d.ts +3 -3
- package/dist/autocomplete/item/autocomplete-item.svelte +10 -0
- package/dist/autocomplete/item-indicator/autocomplete-item-indicator.svelte +2 -2
- package/dist/autocomplete/item-indicator/autocomplete-item-indicator.svelte.d.ts +2 -2
- package/dist/autocomplete/list/autocomplete-list.svelte +2 -2
- package/dist/autocomplete/list/autocomplete-list.svelte.d.ts +11 -3
- package/dist/autocomplete/root/autocomplete.svelte +7 -7
- package/dist/autocomplete/root/autocomplete.svelte.d.ts +7 -7
- package/dist/autocomplete/status/autocomplete-status.svelte +1 -1
- package/dist/autocomplete/status/autocomplete-status.svelte.d.ts +1 -1
- package/dist/avatar/README.md +52 -0
- package/dist/avatar/count/avatar-count.svelte +56 -0
- package/dist/avatar/count/avatar-count.svelte.d.ts +4 -0
- package/dist/avatar/fallback/avatar-fallback.svelte +67 -0
- package/dist/avatar/fallback/avatar-fallback.svelte.d.ts +4 -0
- package/dist/avatar/group/avatar-group.svelte +65 -0
- package/dist/avatar/group/avatar-group.svelte.d.ts +4 -0
- package/dist/avatar/group/context.d.ts +15 -0
- package/dist/avatar/group/context.js +15 -0
- package/dist/avatar/image/avatar-image.svelte +104 -0
- package/dist/avatar/image/avatar-image.svelte.d.ts +4 -0
- package/dist/avatar/index.d.ts +22 -0
- package/dist/avatar/index.js +10 -0
- package/dist/avatar/index.parts.d.ts +5 -0
- package/dist/avatar/index.parts.js +5 -0
- package/dist/avatar/root/avatar-root.svelte +79 -0
- package/dist/avatar/root/avatar-root.svelte.d.ts +4 -0
- package/dist/avatar/root/context.d.ts +14 -0
- package/dist/avatar/root/context.js +15 -0
- package/dist/avatar/types.d.ts +84 -0
- package/dist/avatar/types.js +1 -0
- package/dist/breadcrumbs/README.md +65 -0
- package/dist/breadcrumbs/ellipsis/breadcrumbs-ellipsis.svelte +62 -0
- package/dist/breadcrumbs/ellipsis/breadcrumbs-ellipsis.svelte.d.ts +4 -0
- package/dist/breadcrumbs/index.d.ts +23 -0
- package/dist/breadcrumbs/index.js +10 -0
- package/dist/breadcrumbs/index.parts.d.ts +6 -0
- package/dist/breadcrumbs/index.parts.js +6 -0
- package/dist/breadcrumbs/item/breadcrumbs-item.svelte +42 -0
- package/dist/breadcrumbs/item/breadcrumbs-item.svelte.d.ts +4 -0
- package/dist/breadcrumbs/link/breadcrumbs-link.svelte +47 -0
- package/dist/breadcrumbs/link/breadcrumbs-link.svelte.d.ts +4 -0
- package/dist/breadcrumbs/list/breadcrumbs-list.svelte +31 -0
- package/dist/breadcrumbs/list/breadcrumbs-list.svelte.d.ts +4 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.svelte +112 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.svelte.d.ts +4 -0
- package/dist/breadcrumbs/root/context.d.ts +19 -0
- package/dist/breadcrumbs/root/context.js +15 -0
- package/dist/breadcrumbs/separator/breadcrumbs-separator.svelte +35 -0
- package/dist/breadcrumbs/separator/breadcrumbs-separator.svelte.d.ts +4 -0
- package/dist/breadcrumbs/types.d.ts +80 -0
- package/dist/breadcrumbs/types.js +1 -0
- package/dist/button/README.md +1 -1
- package/dist/button/root/button-root.svelte +37 -7
- package/dist/button/root/button-root.svelte.d.ts +19 -4
- package/dist/calendar/README.md +3 -3
- package/dist/calendar/body-cell/calendar-body-cell.svelte +7 -0
- package/dist/calendar/grid-header/calendar-grid-header.svelte +3 -4
- package/dist/calendar/grid-header/calendar-grid-header.svelte.d.ts +3 -4
- package/dist/calendar/root/calendar-root.svelte +8 -2
- package/dist/calendar/root/calendar-root.svelte.d.ts +8 -2
- package/dist/calendar/root/context.svelte.js +8 -2
- package/dist/calendar/trigger-next/README.md +1 -1
- package/dist/calendar/trigger-previous/README.md +1 -1
- package/dist/checkbox/README.md +1 -1
- package/dist/checkbox/indicator/README.md +1 -1
- package/dist/checkbox/indicator/checkbox-indicator.svelte +1 -0
- package/dist/checkbox/indicator/checkbox-indicator.svelte.d.ts +1 -0
- package/dist/checkbox/root/README.md +2 -2
- package/dist/checkbox/root/checkbox-root.svelte +133 -38
- package/dist/checkbox/root/checkbox-root.svelte.d.ts +21 -1
- package/dist/checkbox-group/README.md +95 -0
- package/dist/checkbox-group/index.d.ts +15 -0
- package/dist/checkbox-group/index.js +6 -0
- package/dist/checkbox-group/index.parts.d.ts +4 -0
- package/dist/checkbox-group/index.parts.js +7 -0
- package/dist/checkbox-group/label/checkbox-group-label.svelte +36 -0
- package/dist/checkbox-group/label/checkbox-group-label.svelte.d.ts +4 -0
- package/dist/checkbox-group/root/checkbox-group-root.svelte +118 -0
- package/dist/checkbox-group/root/checkbox-group-root.svelte.d.ts +4 -0
- package/dist/checkbox-group/root/context.svelte.d.ts +52 -0
- package/dist/checkbox-group/root/context.svelte.js +251 -0
- package/dist/checkbox-group/types.d.ts +57 -0
- package/dist/checkbox-group/types.js +1 -0
- package/dist/clock/README.md +3 -3
- package/dist/clock/axis/README.md +1 -1
- package/dist/clock/root/README.md +1 -1
- package/dist/clock/root/create-time-selection-state.svelte.d.ts +5 -0
- package/dist/clock/root/create-time-selection-state.svelte.js +113 -10
- package/dist/clock/root/wheel-options.d.ts +7 -3
- package/dist/clock/root/wheel-options.js +7 -15
- package/dist/clock/wheel-column/clock-wheel-column.svelte +10 -2
- package/dist/clock/wheel-column/clock-wheel-column.svelte.d.ts +2 -1
- package/dist/collapsible/README.md +3 -3
- package/dist/collapsible/root/collapsible-root.svelte +9 -4
- package/dist/collapsible/types.d.ts +13 -1
- package/dist/combobox/README.md +2 -2
- package/dist/combobox/button/README.md +6 -6
- package/dist/combobox/input/README.md +1 -1
- package/dist/combobox/input/combobox-input.svelte +15 -4
- package/dist/combobox/input/combobox-input.svelte.d.ts +3 -3
- package/dist/combobox/item/combobox-listboxitem.svelte +4 -2
- package/dist/combobox/item/combobox-listboxitem.svelte.d.ts +4 -2
- package/dist/combobox/item-indicator/README.md +1 -1
- package/dist/combobox/item-indicator/combobox-item-indicator.svelte +2 -2
- package/dist/combobox/item-indicator/combobox-item-indicator.svelte.d.ts +2 -2
- package/dist/combobox/list/combobox-listbox.svelte +98 -3
- package/dist/combobox/list/combobox-listbox.svelte.d.ts +28 -3
- package/dist/combobox/popover/README.md +1 -1
- package/dist/combobox/popover/combobox-popover.svelte +4 -56
- package/dist/combobox/root/README.md +24 -24
- package/dist/combobox/root/combobox.svelte +138 -56
- package/dist/combobox/root/combobox.svelte.d.ts +31 -11
- package/dist/combobox/root/context.d.ts +12 -0
- package/dist/combobox/status/README.md +3 -3
- package/dist/combobox/status/combobox-status.svelte +1 -1
- package/dist/combobox/status/combobox-status.svelte.d.ts +1 -1
- package/dist/combobox/tag/README.md +1 -1
- package/dist/combobox/tag/combobox-tag.svelte +1 -1
- package/dist/combobox/tag/combobox-tag.svelte.d.ts +1 -1
- package/dist/combobox/tag-remove/README.md +1 -1
- package/dist/combobox/tag-remove/combobox-tag-remove.svelte +14 -3
- package/dist/combobox/tag-remove/combobox-tag-remove.svelte.d.ts +7 -1
- package/dist/combobox/tags/README.md +1 -1
- package/dist/combobox/tags/combobox-tags.svelte +15 -12
- package/dist/combobox/tags/combobox-tags.svelte.d.ts +12 -10
- package/dist/combobox/trigger/README.md +7 -7
- package/dist/combobox/trigger/combobox-trigger.svelte +4 -1
- package/dist/datepicker/README.md +5 -4
- package/dist/datepicker/input/date-picker-input.svelte +3 -4
- package/dist/datepicker/input/date-picker-input.svelte.d.ts +3 -4
- package/dist/datepicker/root/date-picker-root.svelte +38 -2
- package/dist/datepicker/root/date-picker-root.svelte.d.ts +2 -0
- package/dist/datepicker/root/draft-evaluation.d.ts +7 -0
- package/dist/datepicker/root/draft-evaluation.js +2 -2
- package/dist/datepicker/trigger/README.md +1 -1
- package/dist/daterangepicker/README.md +3 -3
- package/dist/daterangepicker/input/date-range-picker-input.svelte +3 -4
- package/dist/daterangepicker/input/date-range-picker-input.svelte.d.ts +3 -4
- package/dist/daterangepicker/root/date-range-picker-root.svelte +19 -1
- package/dist/daterangepicker/root/date-range-picker-root.svelte.d.ts +2 -0
- package/dist/dialog/README.md +10 -2
- package/dist/dialog/close/dialog-close.svelte +57 -0
- package/dist/dialog/close/dialog-close.svelte.d.ts +19 -0
- package/dist/dialog/content/dialog-content.svelte +6 -4
- package/dist/dialog/content/dialog-content.svelte.d.ts +4 -4
- package/dist/dialog/description/dialog-description.svelte +46 -0
- package/dist/dialog/description/dialog-description.svelte.d.ts +20 -0
- package/dist/dialog/index.d.ts +9 -0
- package/dist/dialog/index.js +3 -0
- package/dist/dialog/index.parts.d.ts +3 -0
- package/dist/dialog/index.parts.js +3 -0
- package/dist/dialog/overlay/dialog-overlay.svelte +1 -1
- package/dist/dialog/overlay/dialog-overlay.svelte.d.ts +1 -1
- package/dist/dialog/portal/dialog-portal.svelte +1 -1
- package/dist/dialog/portal/dialog-portal.svelte.d.ts +1 -1
- package/dist/dialog/root/README.md +1 -1
- package/dist/dialog/root/context.d.ts +8 -0
- package/dist/dialog/root/dialog-root.svelte +100 -20
- package/dist/dialog/root/dialog-root.svelte.d.ts +15 -6
- package/dist/dialog/root/dialog-stack.d.ts +6 -22
- package/dist/dialog/root/dialog-stack.js +4 -33
- package/dist/dialog/title/dialog-title.svelte +43 -0
- package/dist/dialog/title/dialog-title.svelte.d.ts +21 -0
- package/dist/dialog/trigger/README.md +1 -1
- package/dist/drawer/README.md +111 -0
- package/dist/drawer/body/drawer-body.svelte +47 -0
- package/dist/drawer/body/drawer-body.svelte.d.ts +32 -0
- package/dist/drawer/close/drawer-close.svelte +52 -0
- package/dist/drawer/close/drawer-close.svelte.d.ts +20 -0
- package/dist/drawer/content/drawer-content.svelte +600 -0
- package/dist/drawer/content/drawer-content.svelte.d.ts +31 -0
- package/dist/drawer/description/drawer-description.svelte +40 -0
- package/dist/drawer/description/drawer-description.svelte.d.ts +20 -0
- package/dist/drawer/indent/drawer-indent-background.svelte +36 -0
- package/dist/drawer/indent/drawer-indent-background.svelte.d.ts +17 -0
- package/dist/drawer/indent/drawer-indent.svelte +59 -0
- package/dist/drawer/indent/drawer-indent.svelte.d.ts +32 -0
- package/dist/drawer/index.d.ts +49 -0
- package/dist/drawer/index.js +25 -0
- package/dist/drawer/index.parts.d.ts +14 -0
- package/dist/drawer/index.parts.js +15 -0
- package/dist/drawer/overlay/drawer-overlay.svelte +67 -0
- package/dist/drawer/overlay/drawer-overlay.svelte.d.ts +12 -0
- package/dist/drawer/portal/drawer-portal.svelte +57 -0
- package/dist/drawer/portal/drawer-portal.svelte.d.ts +13 -0
- package/dist/drawer/root/context.d.ts +81 -0
- package/dist/drawer/root/context.js +20 -0
- package/dist/drawer/root/drawer-root.svelte +348 -0
- package/dist/drawer/root/drawer-root.svelte.d.ts +79 -0
- package/dist/drawer/root/drawer-stack.svelte.d.ts +73 -0
- package/dist/drawer/root/drawer-stack.svelte.js +113 -0
- package/dist/drawer/root/handle.svelte.d.ts +39 -0
- package/dist/drawer/root/handle.svelte.js +64 -0
- package/dist/drawer/root/keyboard-context.d.ts +13 -0
- package/dist/drawer/root/keyboard-context.js +8 -0
- package/dist/drawer/root/presence-context.d.ts +22 -0
- package/dist/drawer/root/presence-context.js +8 -0
- package/dist/drawer/root/snap-points.d.ts +68 -0
- package/dist/drawer/root/snap-points.js +120 -0
- package/dist/drawer/root/starting-style.svelte.d.ts +18 -0
- package/dist/drawer/root/starting-style.svelte.js +38 -0
- package/dist/drawer/root/types.d.ts +36 -0
- package/dist/drawer/root/types.js +1 -0
- package/dist/drawer/root/viewport-context.d.ts +2 -0
- package/dist/drawer/root/viewport-context.js +16 -0
- package/dist/drawer/swipe-area/drawer-swipe-area.svelte +143 -0
- package/dist/drawer/swipe-area/drawer-swipe-area.svelte.d.ts +22 -0
- package/dist/drawer/title/drawer-title.svelte +37 -0
- package/dist/drawer/title/drawer-title.svelte.d.ts +21 -0
- package/dist/drawer/trigger/drawer-trigger.svelte +90 -0
- package/dist/drawer/trigger/drawer-trigger.svelte.d.ts +41 -0
- package/dist/drawer/viewport/drawer-viewport.svelte +69 -0
- package/dist/drawer/viewport/drawer-viewport.svelte.d.ts +15 -0
- package/dist/drawer/virtual-keyboard/drawer-virtual-keyboard-provider.svelte +88 -0
- package/dist/drawer/virtual-keyboard/drawer-virtual-keyboard-provider.svelte.d.ts +29 -0
- package/dist/dropzone/README.md +4 -6
- package/dist/hooks/use-virtual-focus.svelte.d.ts +9 -0
- package/dist/hooks/use-virtual-focus.svelte.js +7 -1
- package/dist/index.d.ts +24 -0
- package/dist/index.js +23 -0
- package/dist/input/input.svelte +6 -6
- package/dist/input/input.svelte.d.ts +6 -6
- package/dist/internal/environment.d.ts +11 -0
- package/dist/internal/environment.js +14 -0
- package/dist/internal/localized-strings.d.ts +152 -0
- package/dist/internal/localized-strings.js +152 -0
- package/dist/internal/number-precision.d.ts +9 -0
- package/dist/internal/number-precision.js +27 -0
- package/dist/listbox/README.md +20 -1
- package/dist/listbox/item/listbox-item.svelte +43 -18
- package/dist/listbox/item/listbox-item.svelte.d.ts +24 -15
- package/dist/listbox/root/README.md +1 -1
- package/dist/listbox/root/context.d.ts +56 -1
- package/dist/listbox/root/context.js +118 -1
- package/dist/listbox/root/listbox.svelte +400 -27
- package/dist/listbox/root/listbox.svelte.d.ts +73 -16
- package/dist/locale-provider/README.md +1 -6
- package/dist/menu/README.md +41 -4
- package/dist/menu/content/menu-content.svelte +31 -14
- package/dist/menu/content/menu-content.svelte.d.ts +14 -9
- package/dist/menu/context-trigger/menu-context-trigger.svelte +194 -0
- package/dist/menu/context-trigger/menu-context-trigger.svelte.d.ts +35 -0
- package/dist/menu/group/menu-group-label.svelte +1 -1
- package/dist/menu/group/menu-group-label.svelte.d.ts +1 -1
- package/dist/menu/index.d.ts +4 -1
- package/dist/menu/index.js +1 -0
- package/dist/menu/index.parts.d.ts +1 -0
- package/dist/menu/index.parts.js +1 -0
- package/dist/menu/item/menu-item.svelte +11 -8
- package/dist/menu/item/menu-item.svelte.d.ts +11 -8
- package/dist/menu/overlay/menu-overlay.svelte +2 -2
- package/dist/menu/overlay/menu-overlay.svelte.d.ts +1 -1
- package/dist/menu/root/context.d.ts +24 -3
- package/dist/menu/root/focus-state.d.ts +2 -2
- package/dist/menu/root/focus-state.js +8 -32
- package/dist/menu/root/menu-root.svelte +14 -8
- package/dist/menu/root/menu-root.svelte.d.ts +14 -8
- package/dist/menu/root/menu-state.svelte.d.ts +1 -1
- package/dist/menu/root/menu-state.svelte.js +24 -1
- package/dist/menu/separator/menu-separator.svelte +1 -1
- package/dist/menu/separator/menu-separator.svelte.d.ts +1 -1
- package/dist/menu/submenu/menu-submenu-root.svelte +10 -7
- package/dist/menu/submenu/menu-submenu-root.svelte.d.ts +10 -7
- package/dist/numberfield/root/README.md +1 -1
- package/dist/numberfield/root/number-field-root.svelte +2 -1
- package/dist/numberfield/root/number-utils.js +1 -20
- package/dist/numberfield/scrub-area-cursor/README.md +1 -1
- package/dist/popover/README.md +1 -1
- package/dist/popover/content/popover-content.svelte +22 -16
- package/dist/popover/content/popover-content.svelte.d.ts +19 -14
- package/dist/popover/overlay/popover-overlay.svelte +2 -2
- package/dist/popover/overlay/popover-overlay.svelte.d.ts +1 -1
- package/dist/popover/root/README.md +1 -1
- package/dist/popover/root/focus-state.d.ts +2 -2
- package/dist/popover/root/focus-state.js +7 -34
- package/dist/popover/root/popover-root.svelte +29 -14
- package/dist/popover/root/popover-root.svelte.d.ts +16 -5
- package/dist/popover/trigger/README.md +1 -1
- package/dist/primitives/aria-hide-outside.d.ts +13 -0
- package/dist/primitives/aria-hide-outside.js +7 -1
- package/dist/primitives/contain-wheel.d.ts +9 -0
- package/dist/primitives/contain-wheel.js +41 -0
- package/dist/primitives/floating.d.ts +49 -8
- package/dist/primitives/floating.js +75 -7
- package/dist/primitives/focus-trap.d.ts +2 -0
- package/dist/primitives/focus-trap.js +7 -1
- package/dist/primitives/focus-visible.svelte.d.ts +14 -0
- package/dist/primitives/focus-visible.svelte.js +19 -0
- package/dist/primitives/index.d.ts +3 -0
- package/dist/primitives/index.js +3 -0
- package/dist/primitives/input-modality.d.ts +7 -0
- package/dist/primitives/input-modality.js +32 -5
- package/dist/primitives/keyboard-navigation.d.ts +29 -5
- package/dist/primitives/keyboard-navigation.js +27 -17
- package/dist/primitives/layer-stack.d.ts +29 -0
- package/dist/primitives/layer-stack.js +35 -0
- package/dist/primitives/list-virtualizer.d.ts +75 -0
- package/dist/primitives/list-virtualizer.js +59 -0
- package/dist/primitives/long-press.d.ts +59 -0
- package/dist/primitives/long-press.js +142 -0
- package/dist/primitives/presence.svelte.js +6 -1
- package/dist/primitives/scroll-lock.d.ts +47 -3
- package/dist/primitives/scroll-lock.js +191 -9
- package/dist/primitives/swipe-gesture.d.ts +126 -0
- package/dist/primitives/swipe-gesture.js +351 -0
- package/dist/primitives/text.d.ts +8 -0
- package/dist/primitives/text.js +13 -0
- package/dist/primitives/trigger-focus-state.d.ts +29 -0
- package/dist/primitives/trigger-focus-state.js +57 -0
- package/dist/progress/README.md +54 -0
- package/dist/progress/index.d.ts +21 -0
- package/dist/progress/index.js +9 -0
- package/dist/progress/index.parts.d.ts +5 -0
- package/dist/progress/index.parts.js +5 -0
- package/dist/progress/indicator/progress-indicator.svelte +37 -0
- package/dist/progress/indicator/progress-indicator.svelte.d.ts +4 -0
- package/dist/progress/label/progress-label.svelte +34 -0
- package/dist/progress/label/progress-label.svelte.d.ts +4 -0
- package/dist/progress/root/context.d.ts +26 -0
- package/dist/progress/root/context.js +15 -0
- package/dist/progress/root/progress-root.svelte +136 -0
- package/dist/progress/root/progress-root.svelte.d.ts +4 -0
- package/dist/progress/root/progress-utils.d.ts +12 -0
- package/dist/progress/root/progress-utils.js +41 -0
- package/dist/progress/track/progress-track.svelte +27 -0
- package/dist/progress/track/progress-track.svelte.d.ts +4 -0
- package/dist/progress/types.d.ts +81 -0
- package/dist/progress/types.js +1 -0
- package/dist/progress/value/progress-value.svelte +36 -0
- package/dist/progress/value/progress-value.svelte.d.ts +4 -0
- package/dist/radio-group/README.md +103 -0
- package/dist/radio-group/index.d.ts +18 -0
- package/dist/radio-group/index.js +9 -0
- package/dist/radio-group/index.parts.d.ts +4 -0
- package/dist/radio-group/index.parts.js +4 -0
- package/dist/radio-group/indicator/radio-group-indicator.svelte +43 -0
- package/dist/radio-group/indicator/radio-group-indicator.svelte.d.ts +12 -0
- package/dist/radio-group/item/context.d.ts +18 -0
- package/dist/radio-group/item/context.js +15 -0
- package/dist/radio-group/item/radio-group-item.svelte +377 -0
- package/dist/radio-group/item/radio-group-item.svelte.d.ts +35 -0
- package/dist/radio-group/label/radio-group-label.svelte +37 -0
- package/dist/radio-group/label/radio-group-label.svelte.d.ts +4 -0
- package/dist/radio-group/root/context.svelte.d.ts +57 -0
- package/dist/radio-group/root/context.svelte.js +284 -0
- package/dist/radio-group/root/radio-group-root.svelte +193 -0
- package/dist/radio-group/root/radio-group-root.svelte.d.ts +4 -0
- package/dist/radio-group/types.d.ts +50 -0
- package/dist/radio-group/types.js +1 -0
- package/dist/select/README.md +129 -0
- package/dist/select/index.d.ts +30 -0
- package/dist/select/index.js +16 -0
- package/dist/select/index.parts.d.ts +8 -0
- package/dist/select/index.parts.js +9 -0
- package/dist/select/item/select-item.svelte +68 -0
- package/dist/select/item/select-item.svelte.d.ts +10 -0
- package/dist/select/item-indicator/select-item-indicator.svelte +55 -0
- package/dist/select/item-indicator/select-item-indicator.svelte.d.ts +4 -0
- package/dist/select/label/select-label.svelte +46 -0
- package/dist/select/label/select-label.svelte.d.ts +4 -0
- package/dist/select/list/select-list.svelte +241 -0
- package/dist/select/list/select-list.svelte.d.ts +62 -0
- package/dist/select/popover/select-popover.svelte +80 -0
- package/dist/select/popover/select-popover.svelte.d.ts +9 -0
- package/dist/select/root/context.d.ts +106 -0
- package/dist/select/root/context.js +22 -0
- package/dist/select/root/select-root.svelte +544 -0
- package/dist/select/root/select-root.svelte.d.ts +25 -0
- package/dist/select/trigger/select-trigger.svelte +192 -0
- package/dist/select/trigger/select-trigger.svelte.d.ts +4 -0
- package/dist/select/types.d.ts +133 -0
- package/dist/select/types.js +1 -0
- package/dist/select/value/select-value.svelte +61 -0
- package/dist/select/value/select-value.svelte.d.ts +4 -0
- package/dist/separator/README.md +35 -0
- package/dist/separator/index.d.ts +7 -0
- package/dist/separator/index.js +3 -0
- package/dist/separator/separator.svelte +254 -0
- package/dist/separator/separator.svelte.d.ts +45 -0
- package/dist/separator/types.d.ts +1 -0
- package/dist/separator/types.js +1 -0
- package/dist/slider/README.md +61 -0
- package/dist/slider/fill/slider-fill.svelte +40 -0
- package/dist/slider/fill/slider-fill.svelte.d.ts +4 -0
- package/dist/slider/index.d.ts +9 -0
- package/dist/slider/index.js +8 -0
- package/dist/slider/index.parts.d.ts +6 -0
- package/dist/slider/index.parts.js +6 -0
- package/dist/slider/label/slider-label.svelte +44 -0
- package/dist/slider/label/slider-label.svelte.d.ts +4 -0
- package/dist/slider/output/slider-output.svelte +46 -0
- package/dist/slider/output/slider-output.svelte.d.ts +4 -0
- package/dist/slider/root/context.d.ts +106 -0
- package/dist/slider/root/context.js +15 -0
- package/dist/slider/root/slider-root.svelte +545 -0
- package/dist/slider/root/slider-root.svelte.d.ts +4 -0
- package/dist/slider/root/slider-utils.d.ts +57 -0
- package/dist/slider/root/slider-utils.js +88 -0
- package/dist/slider/thumb/slider-thumb.svelte +276 -0
- package/dist/slider/thumb/slider-thumb.svelte.d.ts +4 -0
- package/dist/slider/track/slider-track.svelte +60 -0
- package/dist/slider/track/slider-track.svelte.d.ts +4 -0
- package/dist/slider/types.d.ts +144 -0
- package/dist/slider/types.js +1 -0
- package/dist/switch/root/README.md +2 -2
- package/dist/switch/root/switch-root.svelte +49 -21
- package/dist/switch/root/switch-root.svelte.d.ts +26 -14
- package/dist/switch/thumb/switch-thumb.svelte +1 -1
- package/dist/switch/thumb/switch-thumb.svelte.d.ts +1 -1
- package/dist/table/README.md +16 -9
- package/dist/table/body/table-body.svelte +84 -9
- package/dist/table/cell/table-cell.svelte +27 -10
- package/dist/table/checkbox/table-checkbox.svelte +3 -0
- package/dist/table/checkbox-indicator/README.md +1 -1
- package/dist/table/column/table-column.svelte +5 -1
- package/dist/table/column-header-cell/table-column-header-cell.svelte +24 -0
- package/dist/table/column-resizer/README.md +2 -2
- package/dist/table/column-resizer/table-column-resizer.svelte +1 -5
- package/dist/table/index.d.ts +1 -1
- package/dist/table/index.js +1 -1
- package/dist/table/interactive-cell/table-interactive-cell.svelte +26 -10
- package/dist/table/root/README.md +1 -1
- package/dist/table/root/context.svelte.d.ts +17 -0
- package/dist/table/root/context.svelte.js +212 -66
- package/dist/table/root/table-root.svelte +36 -6
- package/dist/table/row/table-row.svelte +14 -14
- package/dist/table/sort-trigger/README.md +1 -1
- package/dist/table/sort-trigger/table-sort-trigger.svelte +5 -1
- package/dist/table/types.d.ts +32 -14
- package/dist/tabs/root/tabs-root.svelte +20 -6
- package/dist/tabs/types.d.ts +9 -0
- package/dist/timepicker/README.md +3 -2
- package/dist/timepicker/input/README.md +1 -1
- package/dist/timepicker/input/time-picker-input.svelte +66 -5
- package/dist/timepicker/input/time-picker-input.svelte.d.ts +18 -1
- package/dist/timepicker/root/README.md +1 -1
- package/dist/timepicker/root/time-picker-root.svelte +11 -0
- package/dist/timepicker/root/time-picker-root.svelte.d.ts +2 -0
- package/dist/timepicker/trigger/README.md +1 -1
- package/dist/toast/README.md +75 -0
- package/dist/toast/action/toast-action.svelte +42 -0
- package/dist/toast/action/toast-action.svelte.d.ts +4 -0
- package/dist/toast/close/toast-close.svelte +41 -0
- package/dist/toast/close/toast-close.svelte.d.ts +4 -0
- package/dist/toast/content/toast-content.svelte +24 -0
- package/dist/toast/content/toast-content.svelte.d.ts +4 -0
- package/dist/toast/description/toast-description.svelte +41 -0
- package/dist/toast/description/toast-description.svelte.d.ts +4 -0
- package/dist/toast/index.d.ts +34 -0
- package/dist/toast/index.js +15 -0
- package/dist/toast/index.parts.d.ts +9 -0
- package/dist/toast/index.parts.js +9 -0
- package/dist/toast/positioner/toast-positioner.svelte +75 -0
- package/dist/toast/positioner/toast-positioner.svelte.d.ts +4 -0
- package/dist/toast/provider/context.d.ts +36 -0
- package/dist/toast/provider/context.js +22 -0
- package/dist/toast/provider/toast-manager.svelte.d.ts +113 -0
- package/dist/toast/provider/toast-manager.svelte.js +210 -0
- package/dist/toast/provider/toast-provider.svelte +98 -0
- package/dist/toast/provider/toast-provider.svelte.d.ts +4 -0
- package/dist/toast/root/context.d.ts +18 -0
- package/dist/toast/root/context.js +15 -0
- package/dist/toast/root/toast-root.svelte +296 -0
- package/dist/toast/root/toast-root.svelte.d.ts +4 -0
- package/dist/toast/title/toast-title.svelte +38 -0
- package/dist/toast/title/toast-title.svelte.d.ts +4 -0
- package/dist/toast/types.d.ts +100 -0
- package/dist/toast/types.js +1 -0
- package/dist/toast/viewport/toast-viewport.svelte +389 -0
- package/dist/toast/viewport/toast-viewport.svelte.d.ts +4 -0
- package/dist/toggle/README.md +1 -1
- package/dist/toggle/root/toggle-root.svelte +28 -0
- package/dist/toggle/root/toggle-root.svelte.d.ts +19 -0
- package/dist/toggle-group/README.md +12 -4
- package/dist/toggle-group/index.d.ts +2 -0
- package/dist/toggle-group/index.parts.d.ts +1 -0
- package/dist/toggle-group/index.parts.js +4 -0
- package/dist/toggle-group/root/context.svelte.d.ts +1 -1
- package/dist/toggle-group/root/context.svelte.js +24 -8
- package/dist/toggle-group/root/toggle-group-root.svelte +24 -4
- package/dist/toggle-group/root/toggle-group-teardown-order-child.svelte +13 -0
- package/dist/toggle-group/root/toggle-group-teardown-order-child.svelte.d.ts +7 -0
- package/dist/toggle-group/types.d.ts +9 -0
- package/dist/tooltip/README.md +53 -0
- package/dist/tooltip/arrow/tooltip-arrow.svelte +36 -0
- package/dist/tooltip/arrow/tooltip-arrow.svelte.d.ts +4 -0
- package/dist/tooltip/content/tooltip-content.svelte +148 -0
- package/dist/tooltip/content/tooltip-content.svelte.d.ts +4 -0
- package/dist/tooltip/index.d.ts +8 -0
- package/dist/tooltip/index.js +7 -0
- package/dist/tooltip/index.parts.d.ts +5 -0
- package/dist/tooltip/index.parts.js +5 -0
- package/dist/tooltip/provider/tooltip-provider.svelte +36 -0
- package/dist/tooltip/provider/tooltip-provider.svelte.d.ts +4 -0
- package/dist/tooltip/root/context.d.ts +46 -0
- package/dist/tooltip/root/context.js +22 -0
- package/dist/tooltip/root/safe-polygon.d.ts +26 -0
- package/dist/tooltip/root/safe-polygon.js +66 -0
- package/dist/tooltip/root/tooltip-group.d.ts +26 -0
- package/dist/tooltip/root/tooltip-group.js +41 -0
- package/dist/tooltip/root/tooltip-root.svelte +461 -0
- package/dist/tooltip/root/tooltip-root.svelte.d.ts +4 -0
- package/dist/tooltip/trigger/tooltip-trigger.svelte +52 -0
- package/dist/tooltip/trigger/tooltip-trigger.svelte.d.ts +4 -0
- package/dist/tooltip/types.d.ts +105 -0
- package/dist/tooltip/types.js +1 -0
- package/dist/transfer-list/README.md +110 -0
- package/dist/transfer-list/index.d.ts +33 -0
- package/dist/transfer-list/index.js +18 -0
- package/dist/transfer-list/index.parts.d.ts +9 -0
- package/dist/transfer-list/index.parts.js +10 -0
- package/dist/transfer-list/item/transfer-list-item.svelte +74 -0
- package/dist/transfer-list/item/transfer-list-item.svelte.d.ts +35 -0
- package/dist/transfer-list/list/transfer-list-list.svelte +162 -0
- package/dist/transfer-list/list/transfer-list-list.svelte.d.ts +56 -0
- package/dist/transfer-list/list/transfer-list-source.svelte +13 -0
- package/dist/transfer-list/list/transfer-list-source.svelte.d.ts +36 -0
- package/dist/transfer-list/list/transfer-list-target.svelte +14 -0
- package/dist/transfer-list/list/transfer-list-target.svelte.d.ts +36 -0
- package/dist/transfer-list/move/transfer-list-move-all.svelte +14 -0
- package/dist/transfer-list/move/transfer-list-move-all.svelte.d.ts +10 -0
- package/dist/transfer-list/move/transfer-list-move-button.svelte +103 -0
- package/dist/transfer-list/move/transfer-list-move-button.svelte.d.ts +25 -0
- package/dist/transfer-list/move/transfer-list-move-down.svelte +14 -0
- package/dist/transfer-list/move/transfer-list-move-down.svelte.d.ts +10 -0
- package/dist/transfer-list/move/transfer-list-move-selected.svelte +14 -0
- package/dist/transfer-list/move/transfer-list-move-selected.svelte.d.ts +10 -0
- package/dist/transfer-list/move/transfer-list-move-up.svelte +14 -0
- package/dist/transfer-list/move/transfer-list-move-up.svelte.d.ts +10 -0
- package/dist/transfer-list/move/transfer-list-reorder-button.svelte +83 -0
- package/dist/transfer-list/move/transfer-list-reorder-button.svelte.d.ts +21 -0
- package/dist/transfer-list/root/context.d.ts +70 -0
- package/dist/transfer-list/root/context.js +24 -0
- package/dist/transfer-list/root/transfer-list-root.svelte +345 -0
- package/dist/transfer-list/root/transfer-list-root.svelte.d.ts +68 -0
- package/dist/transfer-list/root/types.d.ts +22 -0
- package/dist/transfer-list/root/types.js +4 -0
- package/dist/transfer-list/status/transfer-list-status.svelte +70 -0
- package/dist/transfer-list/status/transfer-list-status.svelte.d.ts +15 -0
- package/dist/tree/README.md +3 -3
- package/dist/tree/checkbox-indicator/README.md +1 -1
- package/dist/tree/root/README.md +1 -1
- package/dist/tree/root/context.svelte.js +6 -0
- package/dist/tree/root/tree-root.svelte +22 -8
- package/dist/tree/types.d.ts +23 -1
- package/package.json +282 -224
|
@@ -1,35 +1,47 @@
|
|
|
1
1
|
import { type Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
type SwitchRootProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'class' | 'id' | 'role' | 'aria-checked' | 'aria-disabled' | 'aria-readonly' | 'aria-required' | 'onclick' | 'onkeydown' | 'value'> & {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* The id of the hidden input, thus a `label[for]` element can point at the switch. If you give
|
|
6
|
+
* none, the component makes one.
|
|
7
|
+
*/
|
|
5
8
|
id?: string;
|
|
6
|
-
/**
|
|
9
|
+
/** A bindable reference to the root element. */
|
|
7
10
|
element?: HTMLSpanElement | null;
|
|
8
|
-
/**
|
|
11
|
+
/** The name that the form submits while the switch is on. */
|
|
9
12
|
name?: string;
|
|
10
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The value that the form submits while the switch is on. It does not change the visual state.
|
|
15
|
+
*/
|
|
11
16
|
value?: string;
|
|
12
|
-
/**
|
|
17
|
+
/** The id of the form of the hidden input. */
|
|
13
18
|
form?: string;
|
|
14
|
-
/**
|
|
19
|
+
/** The checked state. By default it goes in the two directions: use `bind:checked`. */
|
|
15
20
|
checked?: boolean;
|
|
16
|
-
/**
|
|
21
|
+
/** The checked state at the start, for when you give no `checked`. */
|
|
17
22
|
defaultChecked?: boolean;
|
|
18
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Give your own code full control of the state. The component stops to write back to `checked`,
|
|
25
|
+
* and it reports only through `onCheckedChange`. Thus the parent can refuse a change: the parent
|
|
26
|
+
* does not send the new value down. The default is off, because `bind:checked` is the usual case
|
|
27
|
+
* and it needs the write-back.
|
|
28
|
+
*/
|
|
29
|
+
controlledChecked?: boolean;
|
|
30
|
+
/** The component calls it when the user changes the switch. */
|
|
19
31
|
onCheckedChange?: (checked: boolean) => void;
|
|
20
|
-
/**
|
|
32
|
+
/** Stops the interaction with the switch and removes it from the focus order. */
|
|
21
33
|
disabled?: boolean;
|
|
22
|
-
/** Keeps the switch focusable
|
|
34
|
+
/** Keeps the switch focusable, but stops the changes of the state. */
|
|
23
35
|
readonly?: boolean;
|
|
24
|
-
/**
|
|
36
|
+
/** Makes the hidden input required for the form validation. */
|
|
25
37
|
required?: boolean;
|
|
26
38
|
children?: Snippet;
|
|
27
39
|
class?: string;
|
|
28
|
-
/**
|
|
40
|
+
/** The accessible name, for when the user sees no name. */
|
|
29
41
|
'aria-label'?: string;
|
|
30
|
-
/**
|
|
42
|
+
/** The id of the element that gives the switch its name. */
|
|
31
43
|
'aria-labelledby'?: string;
|
|
32
|
-
/**
|
|
44
|
+
/** Replaces the default position in the tab order. */
|
|
33
45
|
tabindex?: number;
|
|
34
46
|
onclick?: HTMLAttributes<HTMLSpanElement>['onclick'];
|
|
35
47
|
onkeydown?: HTMLAttributes<HTMLSpanElement>['onkeydown'];
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { useSwitchContext } from '../root/context';
|
|
5
5
|
|
|
6
6
|
type SwitchThumbProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'class'> & {
|
|
7
|
-
/**
|
|
7
|
+
/** The content of the thumb. */
|
|
8
8
|
children?: Snippet;
|
|
9
9
|
class?: string;
|
|
10
10
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
type SwitchThumbProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'class'> & {
|
|
4
|
-
/**
|
|
4
|
+
/** The content of the thumb. */
|
|
5
5
|
children?: Snippet;
|
|
6
6
|
class?: string;
|
|
7
7
|
};
|
package/dist/table/README.md
CHANGED
|
@@ -6,7 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
`Table` is a headless interactive table primitive with grid-style keyboard navigation, row selection, explicit sortable header triggers, and a composable part-based API.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The table barrel exports the prop types of each public Table part.
|
|
10
|
+
|
|
11
|
+
These are `TableRootProps`, `TableColumnProps`, `TableHeaderProps`, `TableBodyProps`,
|
|
12
|
+
`TableFooterProps`, `TableRowProps`, `TableColumnHeaderCellProps`, `TableSortTriggerProps`,
|
|
13
|
+
`TableColumnResizerProps`, `TableCellProps`, `TableEmptyStateProps`, `TableCheckboxProps`,
|
|
14
|
+
and `TableCheckboxIndicatorProps`.
|
|
10
15
|
|
|
11
16
|
## Anatomy
|
|
12
17
|
|
|
@@ -88,7 +93,8 @@ All public Table part prop types are exported from the table barrel, including `
|
|
|
88
93
|
## Usage guidelines
|
|
89
94
|
|
|
90
95
|
- Use `Table.Root` as the stateful container for focus, selection, and sorting state.
|
|
91
|
-
- Use `
|
|
96
|
+
- Use `keyboardNavigation` to choose how far the roving tab stop reaches into the body: `'grid'` (default) makes every body cell a focus target, `'row'` makes the row the only one, and `'none'` leaves the body inert. The cell navigation has a cost: one focus registration and one focus state for each cell. A virtualized table does this again for each row that it makes. Use `'row'` when the body is a list, and not a surface where the user works. Use `'none'` only when nothing in the body does an action. The header keeps its own navigation in every mode.
|
|
97
|
+
- Use `selectionBehavior="toggle"` to let the user remove the selection of a selected row. Use `selectionBehavior="replace"` to keep a selected row selected when the user presses it again.
|
|
92
98
|
- `Table.Column` is a logical-only wrapper for column metadata; it does not render DOM by itself and should wrap a single `Table.ColumnHeaderCell`.
|
|
93
99
|
- Wrap each header cell in `Table.Column` so the table can register stable column metadata.
|
|
94
100
|
- Add `Table.ColumnResizer` inside `Table.ColumnHeaderCell` to make the owning `Table.Column` resizable.
|
|
@@ -101,16 +107,16 @@ All public Table part prop types are exported from the table barrel, including `
|
|
|
101
107
|
- Use `defaultHiddenColumns` for uncontrolled initial column visibility.
|
|
102
108
|
- Use `columnWidths` / `onColumnWidthsChange` for controlled column width state. Width specs can be px, `%`, or `fr`.
|
|
103
109
|
- Use `defaultColumnWidths` and `Table.Column.defaultWidth` to seed uncontrolled initial widths that can still be resized by the user.
|
|
104
|
-
- Use `Table.Column.width` when a column
|
|
105
|
-
- In resizable tables, unspecified columns behave like an implicit `1fr` width before interaction.
|
|
110
|
+
- Use `Table.Column.width` when a column must keep an exact width. A column with a fixed width does not change its width, also with a `Table.ColumnResizer` in it.
|
|
111
|
+
- In resizable tables, unspecified columns behave like an implicit `1fr` width before interaction. At the first width change, the component sets each visible column in px. The last column takes the difference, down to its minimum width. After that, the table becomes wider than its container.
|
|
106
112
|
- Setting `sortDescriptor` back to `undefined` clears the controlled sort state, matching React Aria Table semantics.
|
|
107
113
|
- Set `Table.Column.textValue` when the spoken column label should differ from the column id; `Table.Root` uses it for polite sort announcements.
|
|
108
114
|
- Use `Table.EmptyState` inside `Table.Body` instead of conditionally rendering freeform body content.
|
|
109
115
|
- Use `Table.Checkbox` when you need explicit selection UI inside cells instead of relying only on row or cell presses.
|
|
110
|
-
- Use `Table.CheckboxIndicator` to
|
|
111
|
-
- Use `Table.InteractiveCell` for body
|
|
116
|
+
- Use `Table.CheckboxIndicator` to make your own marks for the checked state and the indeterminate state.
|
|
117
|
+
- Use `Table.InteractiveCell` for a body cell that has its own controls. While the focus is on the cell, the grid keyboard operation is the same as in `Table.Cell`. While the focus is on a control in the cell, that control gets the keys and the pointer.
|
|
112
118
|
- `Table.Checkbox` auto-hides in header cells unless `selectionMode="multiple"`, and auto-hides everywhere when `selectionMode="none"`.
|
|
113
|
-
-
|
|
119
|
+
- A hidden column is not in the grid navigation, not in the column count, and not in the width changes. It keeps its width, thus you can show it again with that width.
|
|
114
120
|
- Dedicated utility columns like selection checkboxes should usually set an explicit `width`, `minWidth`, and `maxWidth` on `Table.Column` so sibling resizes do not redistribute their space.
|
|
115
121
|
- When `selectionMode` changes to `none`, the component clears any existing row selection internally.
|
|
116
122
|
- v1 leaves text selection and `Ctrl+C` behavior browser-native; the table does not implement custom copy handling or force a text-selection policy.
|
|
@@ -132,10 +138,11 @@ All public Table part prop types are exported from the table barrel, including `
|
|
|
132
138
|
|
|
133
139
|
- `Table.Root` renders an interactive `grid` over native table markup.
|
|
134
140
|
- Keyboard navigation uses roving `tabindex` across header and body cells.
|
|
135
|
-
-
|
|
141
|
+
- Under `keyboardNavigation="row"` the body's roving tab stop sits on the rows: arrows walk rows, `Enter` presses one and `Space` toggles its selection. Focusable content inside body cells becomes a regular tab stop instead, since no roving focus reaches it there.
|
|
142
|
+
- A body row can also take the focus when the horizontal navigation goes past the start or the end of the row. If the user continues to push the left key or the right key, the focus goes to the cell at the opposite edge.
|
|
136
143
|
- `Table.Checkbox` can receive DOM focus directly while still participating in the table's roving-focus grid.
|
|
137
144
|
- First-column body cells become `rowheader` when their associated column has `rowHeader`.
|
|
138
145
|
- Disabled rows remain rendered and non-selectable, but are skipped by focus navigation.
|
|
139
146
|
- `Table.SortTrigger` renders the trigger button, while the header cell remains the roving-focus target for arrow-key grid navigation.
|
|
140
147
|
- Sort changes are mirrored into a polite live region so screen readers announce direction changes more reliably than `aria-sort` alone.
|
|
141
|
-
- Column resize handles are keyboard accessible separators.
|
|
148
|
+
- Column resize handles are keyboard accessible separators. Push `Enter` to start the resize mode. Use the horizontal arrow keys to change the width. Push `Home` for the minimum width, and `End` for the width of the content. Push `Enter` again to leave the resize mode. The focus stays on the handle.
|
|
@@ -47,11 +47,41 @@
|
|
|
47
47
|
if (!virtualizer || !virtualizerEnabled || itemList.length === 0) return 0;
|
|
48
48
|
return Math.max(1, Math.ceil(effectiveViewportHeight / virtualizer.rowHeight));
|
|
49
49
|
});
|
|
50
|
+
/**
|
|
51
|
+
* Rows rendered beyond each edge of the viewport.
|
|
52
|
+
*
|
|
53
|
+
* This is a buffer against how long a row takes to render: while the main
|
|
54
|
+
* thread is busy building rows, the compositor keeps scrolling the layer, and
|
|
55
|
+
* anything past the last rendered row shows as blank.
|
|
56
|
+
*
|
|
57
|
+
* Lowering it makes every frame measurably cheaper (18 -> 8 cut resize p50 by
|
|
58
|
+
* 41% and fast-scroll p50 by 30%) — but that is the buffer being spent, not
|
|
59
|
+
* the cost being fixed, and fast scrolling then shows the blank band the
|
|
60
|
+
* buffer existed to hide. Do NOT lower this to buy frame time; make row
|
|
61
|
+
* rendering cheaper instead.
|
|
62
|
+
*/
|
|
50
63
|
const overscan = $derived.by(() => {
|
|
51
64
|
if (!virtualizer || !virtualizerEnabled) return 0;
|
|
65
|
+
|
|
66
|
+
// Resizing rewrites a column width every drag frame, and each rewrite
|
|
67
|
+
// relayouts the whole table — a cost proportional to how many rows are
|
|
68
|
+
// mounted. The buffer exists to absorb *scrolling*, and the pointer cannot
|
|
69
|
+
// scroll while dragging a resizer, so during a drag those extra rows are
|
|
70
|
+
// laid out repeatedly for nothing. Measured against a control that keeps
|
|
71
|
+
// the buffer (5000 rows x 8 resizable columns, prod, 4x CPU throttle):
|
|
72
|
+
// resize p50 87.7ms -> 48.5ms, p95 109.5ms -> 70.3ms. The rows come back
|
|
73
|
+
// as soon as the drag ends.
|
|
74
|
+
if (table.resizingColumnId !== null) return 0;
|
|
75
|
+
|
|
52
76
|
if (virtualizer.overscan !== undefined) return Math.max(0, virtualizer.overscan);
|
|
53
77
|
return 18;
|
|
54
78
|
});
|
|
79
|
+
|
|
80
|
+
// Plain (non-reactive) memo of the last window, used only to keep the derived
|
|
81
|
+
// value's identity stable across recomputations that produce the same window.
|
|
82
|
+
let lastVisibleRange:
|
|
83
|
+
{ from: number; to: number; topSpacerHeight: number; bottomSpacerHeight: number } | undefined;
|
|
84
|
+
|
|
55
85
|
const visibleRange = $derived.by(() => {
|
|
56
86
|
if (!virtualizer || !virtualizerEnabled || itemList.length === 0) {
|
|
57
87
|
return {
|
|
@@ -66,15 +96,60 @@
|
|
|
66
96
|
const rowCount = itemList.length;
|
|
67
97
|
const startIndex = Math.min(rowCount - 1, Math.floor(Math.max(0, scrollTop) / rowHeight));
|
|
68
98
|
const endIndex = Math.min(rowCount - 1, startIndex + visibleCount - 1);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
99
|
+
|
|
100
|
+
// Snap the window edges to a block boundary so scrolling *within* a block
|
|
101
|
+
// leaves the rendered set identical.
|
|
102
|
+
//
|
|
103
|
+
// Inserting or removing a <tr> forces the browser to lay out the whole
|
|
104
|
+
// table, and that relayout — not the new rows themselves — is the dominant
|
|
105
|
+
// cost of scrolling: ~1.16ms per mounted row, ~62% of a frame that changes
|
|
106
|
+
// the window. Re-slicing on every single row wastes the overscan buffer,
|
|
107
|
+
// which exists precisely so the window need not track the scroll offset
|
|
108
|
+
// exactly. Quantizing spends that buffer on skipping relayouts instead.
|
|
109
|
+
//
|
|
110
|
+
// Safe by construction: `from` only ever rounds *down* and `to` only ever
|
|
111
|
+
// rounds *up*, so the retained margin never drops below `overscan` and this
|
|
112
|
+
// cannot expose a blank band the unquantized window would have covered.
|
|
113
|
+
//
|
|
114
|
+
// Block size swept against a `block = 1` control (which reproduces the
|
|
115
|
+
// unquantized behaviour) within one build, 5000 rows x 8 resizable columns,
|
|
116
|
+
// prod, 4x CPU throttle:
|
|
117
|
+
//
|
|
118
|
+
// block | scroll-fast p50 | scroll-smooth p95 | scroll-wheel p95
|
|
119
|
+
// 1 | 125.0 ms | 128.5 ms | 324.7 ms
|
|
120
|
+
// 5 | 26.5 ms | 61.8 ms | 280.5 ms
|
|
121
|
+
// 9 | 22.8 ms | 46.3 ms | 348.3 ms
|
|
122
|
+
//
|
|
123
|
+
// Bigger blocks skip more relayouts but mount more rows, making each
|
|
124
|
+
// structural change costlier. A wheel flick crosses a block almost every
|
|
125
|
+
// notch, so it pays that cost without collecting the benefit — at
|
|
126
|
+
// overscan/2 its p95 regresses. overscan/4 improves all three.
|
|
127
|
+
const block = Math.max(1, Math.round(overscan / 4));
|
|
128
|
+
const rawFrom = Math.max(0, startIndex - overscan);
|
|
129
|
+
const rawTo = Math.min(rowCount - 1, endIndex + overscan);
|
|
130
|
+
const from = Math.max(0, Math.floor(rawFrom / block) * block);
|
|
131
|
+
const to = Math.max(from, Math.min(rowCount - 1, Math.ceil((rawTo + 1) / block) * block - 1));
|
|
132
|
+
|
|
133
|
+
const topSpacerHeight = from * rowHeight;
|
|
134
|
+
const bottomSpacerHeight = Math.max(0, (rowCount - to - 1) * rowHeight);
|
|
135
|
+
|
|
136
|
+
// Return the *same object* when nothing about the window changed. Scrolling
|
|
137
|
+
// within a block recomputes this on every scroll event, and a fresh object
|
|
138
|
+
// would invalidate `renderedItems`, allocate a new slice and make the keyed
|
|
139
|
+
// each re-diff every mounted row — all to arrive at the identical DOM.
|
|
140
|
+
// Preserving identity makes those frames genuinely free.
|
|
141
|
+
if (
|
|
142
|
+
lastVisibleRange !== undefined &&
|
|
143
|
+
lastVisibleRange.from === from &&
|
|
144
|
+
lastVisibleRange.to === to &&
|
|
145
|
+
lastVisibleRange.topSpacerHeight === topSpacerHeight &&
|
|
146
|
+
lastVisibleRange.bottomSpacerHeight === bottomSpacerHeight
|
|
147
|
+
) {
|
|
148
|
+
return lastVisibleRange;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
lastVisibleRange = { from, to, topSpacerHeight, bottomSpacerHeight };
|
|
152
|
+
return lastVisibleRange;
|
|
78
153
|
});
|
|
79
154
|
const renderedItems = $derived.by(() => {
|
|
80
155
|
if (!virtualizerEnabled) return itemList;
|
|
@@ -26,6 +26,10 @@
|
|
|
26
26
|
void row.cellOrderEpoch;
|
|
27
27
|
return row.getCellIndex(key);
|
|
28
28
|
});
|
|
29
|
+
// Only `'grid'` navigation makes a body cell a focus target. In the other
|
|
30
|
+
// modes it skips the focus registry and the focus-derived state below, which
|
|
31
|
+
// a virtualizer would otherwise pay per cell on every scroll block.
|
|
32
|
+
const isFocusTarget = $derived(row.section === 'body' && table.keyboardNavigation === 'grid');
|
|
29
33
|
|
|
30
34
|
function syncCellRegistration() {
|
|
31
35
|
if (row.section !== 'body') return;
|
|
@@ -54,12 +58,15 @@
|
|
|
54
58
|
});
|
|
55
59
|
|
|
56
60
|
$effect(() => {
|
|
61
|
+
if (!isFocusTarget) return;
|
|
57
62
|
syncCellRegistration();
|
|
58
63
|
});
|
|
59
64
|
|
|
60
65
|
onDestroy(() => {
|
|
61
66
|
row.unregisterCellToken(key);
|
|
62
|
-
|
|
67
|
+
// Mirrors `isFocusTarget` without reading it: a derived is not safe to
|
|
68
|
+
// read while the component tears down.
|
|
69
|
+
if (row.section === 'body' && table.keyboardNavigation === 'grid') {
|
|
63
70
|
table.unregisterCell(key);
|
|
64
71
|
}
|
|
65
72
|
});
|
|
@@ -88,10 +95,8 @@
|
|
|
88
95
|
});
|
|
89
96
|
// Focus/selection/disabled state is fine-grained `$state` in the context —
|
|
90
97
|
// the reads below track it directly, no version counters needed.
|
|
91
|
-
const isFocused = $derived(
|
|
92
|
-
const isFocusVisible = $derived(
|
|
93
|
-
row.section === 'body' ? isFocused && table.focusVisible : false
|
|
94
|
-
);
|
|
98
|
+
const isFocused = $derived(isFocusTarget ? table.isCellFocused(key) : false);
|
|
99
|
+
const isFocusVisible = $derived(isFocusTarget ? isFocused && table.focusVisible : false);
|
|
95
100
|
const isRowSelected = $derived(row.section === 'body' ? row.rowState.isSelected : false);
|
|
96
101
|
const isRowDisabled = $derived(
|
|
97
102
|
row.section === 'body'
|
|
@@ -112,7 +117,7 @@
|
|
|
112
117
|
);
|
|
113
118
|
const isCellFocusable = $derived(row.section !== 'body' || !isRowDisabled);
|
|
114
119
|
const cellTabIndex = $derived.by(() => {
|
|
115
|
-
if (
|
|
120
|
+
if (!isFocusTarget) return undefined;
|
|
116
121
|
if (isColumnHidden) return undefined;
|
|
117
122
|
if (!isCellFocusable) return undefined;
|
|
118
123
|
if (focusDelegate) return undefined;
|
|
@@ -126,10 +131,22 @@
|
|
|
126
131
|
table.setFocusVisible(shouldShowFocusVisible(element ?? null));
|
|
127
132
|
}
|
|
128
133
|
|
|
134
|
+
// A pointer press moves focus to whatever the current mode can focus, so the
|
|
135
|
+
// keyboard carries on from where the pointer left off.
|
|
136
|
+
function focusPressTarget() {
|
|
137
|
+
if (isFocusTarget) {
|
|
138
|
+
table.focusCellByKey(key);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (table.keyboardNavigation === 'row') {
|
|
142
|
+
table.focusRowByToken(row.rowToken, 'start');
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
129
146
|
function handleClick(event: MouseEvent) {
|
|
130
147
|
if (row.section !== 'body') return;
|
|
131
148
|
if (isRowDisabled) return;
|
|
132
|
-
|
|
149
|
+
focusPressTarget();
|
|
133
150
|
table.pressRow(
|
|
134
151
|
row.rowId as TableSelectionKey | undefined,
|
|
135
152
|
'pointer',
|
|
@@ -146,7 +163,7 @@
|
|
|
146
163
|
function handleDoubleClick() {
|
|
147
164
|
if (row.section !== 'body') return;
|
|
148
165
|
if (isRowDisabled) return;
|
|
149
|
-
|
|
166
|
+
focusPressTarget();
|
|
150
167
|
table.pressRow(
|
|
151
168
|
row.rowId as TableSelectionKey | undefined,
|
|
152
169
|
'pointer-double',
|
|
@@ -228,11 +245,11 @@
|
|
|
228
245
|
style:inset-inline-end={pinState?.side === 'right' ? `${pinState.offset}px` : undefined}
|
|
229
246
|
style:z-index={pinState ? 1 : undefined}
|
|
230
247
|
style:display={isColumnHidden ? 'none' : 'table-cell'}
|
|
231
|
-
onfocus={
|
|
248
|
+
onfocus={isFocusTarget ? handleFocus : undefined}
|
|
232
249
|
onclick={row.section === 'body' ? handleClick : undefined}
|
|
233
250
|
ondblclick={row.section === 'body' ? handleDoubleClick : undefined}
|
|
234
251
|
onmousedown={row.section === 'body' ? handleMouseDown : undefined}
|
|
235
|
-
onkeydown={
|
|
252
|
+
onkeydown={isFocusTarget ? handleKeyDown : undefined}
|
|
236
253
|
{...restProps}
|
|
237
254
|
>
|
|
238
255
|
{#if children}
|
|
@@ -75,6 +75,9 @@
|
|
|
75
75
|
|
|
76
76
|
const tabIndex = $derived.by(() => {
|
|
77
77
|
if (!isVisible || isDisabled) return undefined;
|
|
78
|
+
// Without cell navigation no roving tab stop ever reaches a body cell, so
|
|
79
|
+
// the checkbox has to be a tab stop of its own to stay operable.
|
|
80
|
+
if (section.section === 'body' && table.keyboardNavigation !== 'grid') return 0;
|
|
78
81
|
return table.isCellTabStop(cell.cellKey) ? 0 : -1;
|
|
79
82
|
});
|
|
80
83
|
|
|
@@ -13,7 +13,7 @@ Public prop type: `TableCheckboxIndicatorProps`
|
|
|
13
13
|
| -------------- | --------------------------------- | ----------- | ------------------------------------------------------------------------------- |
|
|
14
14
|
| `forceMount` | `boolean` | `false` | Keeps the indicator mounted while hidden when the checkbox is unchecked. |
|
|
15
15
|
| `children` | `Snippet` | `undefined` | Rendered indicator content, such as a check icon or dash icon. |
|
|
16
|
-
| `class` | `string` | `''` | CSS class names
|
|
16
|
+
| `class` | `string` | `''` | The CSS class names of the indicator container. |
|
|
17
17
|
| `...restProps` | `HTMLAttributes<HTMLSpanElement>` | `-` | Additional native attributes forwarded to the composed checkbox indicator span. |
|
|
18
18
|
|
|
19
19
|
## Usage notes
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onDestroy } from 'svelte';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
setTableColumnContext,
|
|
5
|
+
useTableContext,
|
|
6
|
+
useTableSectionContext
|
|
7
|
+
} from '../root/context.svelte';
|
|
4
8
|
import type { TableColumnProps } from '../types.js';
|
|
5
9
|
|
|
6
10
|
let {
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
shouldShowFocusVisible,
|
|
12
12
|
trackInteractionModality
|
|
13
13
|
} from '../../primitives/input-modality';
|
|
14
|
+
|
|
15
|
+
import { watchFocusVisible } from '../../primitives/focus-visible.svelte';
|
|
14
16
|
import { isRtl } from '../../internal/rtl';
|
|
15
17
|
|
|
16
18
|
let { children, class: className = '', ...restProps }: TableColumnHeaderCellProps = $props();
|
|
@@ -174,6 +176,28 @@
|
|
|
174
176
|
isFocusVisibleWithin = false;
|
|
175
177
|
}
|
|
176
178
|
|
|
179
|
+
function getFocusedDescendant() {
|
|
180
|
+
if (!element) return null;
|
|
181
|
+
const active = element.ownerDocument.activeElement;
|
|
182
|
+
if (!(active instanceof HTMLElement) || active === element) return null;
|
|
183
|
+
return element.contains(active) ? active : null;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
watchFocusVisible({
|
|
187
|
+
isFocused: () => isElementFocused,
|
|
188
|
+
element: () => element ?? null,
|
|
189
|
+
set: (visible) => {
|
|
190
|
+
isElementFocusVisible = visible;
|
|
191
|
+
table.setFocusVisible(visible);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
watchFocusVisible({
|
|
196
|
+
isFocused: () => isFocusWithin,
|
|
197
|
+
element: getFocusedDescendant,
|
|
198
|
+
set: (visible) => (isFocusVisibleWithin = visible)
|
|
199
|
+
});
|
|
200
|
+
|
|
177
201
|
function handleClick() {
|
|
178
202
|
// A drag-resize that just ended emits a residual click on the header;
|
|
179
203
|
// consume the one-shot suppression flag BEFORE focusing the cell.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
### Table.ColumnResizer
|
|
8
8
|
|
|
9
9
|
Name: `Table.ColumnResizer`
|
|
10
|
-
Description:
|
|
10
|
+
Description: The handle that changes the width of the current `Table.Column`. Put it in a `Table.ColumnHeaderCell`. It changes the width of the column of the `Table.Column` context around it.
|
|
11
11
|
|
|
12
12
|
Public prop type: `TableColumnResizerProps`
|
|
13
13
|
|
|
@@ -25,7 +25,7 @@ Public prop type: `TableColumnResizerProps`
|
|
|
25
25
|
- The handle resolves the active column from `Table.Column` context. It does not accept a separate `columnId` prop.
|
|
26
26
|
- Width state lives in `Table.Root` through `columnWidths` / `defaultColumnWidths`.
|
|
27
27
|
- Pointer resizing uses Pointer Events, so mouse, touch, and pen interactions share the same behavior.
|
|
28
|
-
-
|
|
28
|
+
- The keyboard changes the width in a resize mode. Move the focus to the handle and push `Enter` to start that mode. Use the `ArrowLeft` key and the `ArrowRight` key, with `Shift` for a larger step, to change the width. Push `Home` for the minimum width, and `End` for the width of the content. Push `Enter` again to keep the width. The focus stays on the handle.
|
|
29
29
|
- While keyboard resize mode is active, pressing `Escape` restores the starting width, exits resize mode, and returns focus to the owning header cell.
|
|
30
30
|
- Keyboard resizing uses the same resize lifecycle callbacks as pointer resizing and announces committed widths through a polite live region.
|
|
31
31
|
- During pointer drag, pressing `Escape` restores the starting width and cancels the resize interaction.
|
|
@@ -39,11 +39,7 @@
|
|
|
39
39
|
// The handle sits on the column's inline-end edge and is shifted half of
|
|
40
40
|
// its width outwards; the physical shift direction depends on the layout
|
|
41
41
|
// direction, resolved once the element mounts.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
$effect(() => {
|
|
45
|
-
handleRtl = element ? isRightToLeft() : false;
|
|
46
|
-
});
|
|
42
|
+
const handleRtl = $derived(element ? isRightToLeft() : false);
|
|
47
43
|
|
|
48
44
|
let isFocused = $state(false);
|
|
49
45
|
let isFocusVisible = $state(false);
|
package/dist/table/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export { default as TableCheckbox } from './checkbox/table-checkbox.svelte';
|
|
|
14
14
|
export { default as TableCheckboxIndicator } from './checkbox-indicator/table-checkbox-indicator.svelte';
|
|
15
15
|
export { default as TableCell } from './cell/table-cell.svelte';
|
|
16
16
|
export { default as TableInteractiveCell } from './interactive-cell/table-interactive-cell.svelte';
|
|
17
|
-
export { createTableContext, getTableContext, setTableContext, useTableContext, getTableSectionContext, setTableSectionContext, useTableSectionContext, getTableRowContext, setTableRowContext, useTableRowContext, getTableColumnContext, setTableColumnContext, useTableColumnContext, type TableContext, type TableDisabledBehavior, type TableSelectionBehavior, type TableSelectionCheckboxState, type TableSelectionKey, type TableSelectionMode, type TableRowActionHandler, type TableSortDirection, type TableSortDescriptor, type TableColumnWidth, type TableColumnPin, type TableColumnPinState, type TableGridCoord, type TableSectionKind, type TableSectionContext, type TableRowContext, type TableColumnContext, type CreateTableContextOptions, DEFAULT_TABLE_COLUMN_MIN_WIDTH } from './root/context.svelte';
|
|
17
|
+
export { createTableContext, getTableContext, setTableContext, useTableContext, getTableSectionContext, setTableSectionContext, useTableSectionContext, getTableRowContext, setTableRowContext, useTableRowContext, getTableColumnContext, setTableColumnContext, useTableColumnContext, getTableCellContext, setTableCellContext, useTableCellContext, type TableContext, type TableRowItem, type TableRowFocusEdge, type TableDisabledBehavior, type TableKeyboardNavigation, type TableSelectionBehavior, type TableSelectionCheckboxState, type TableSelectionKey, type TableSelectionMode, type TableRowActionHandler, type TableSortDirection, type TableSortDescriptor, type TableColumnWidth, type TableColumnPin, type TableColumnPinState, type TableGridCoord, type TableSectionKind, type TableSectionContext, type TableRowContext, type TableColumnContext, type TableCellContext, type CreateTableContextOptions, DEFAULT_TABLE_COLUMN_MIN_WIDTH } from './root/context.svelte';
|
|
18
18
|
export { getTableSsrMinWidth, type TableColumnWidthSpec, type GetTableSsrMinWidthOptions } from './utils/ssr-min-width.js';
|
|
19
19
|
import * as TableParts from './index.parts.js';
|
|
20
20
|
export default TableParts;
|
package/dist/table/index.js
CHANGED
|
@@ -13,7 +13,7 @@ export { default as TableCheckbox } from './checkbox/table-checkbox.svelte';
|
|
|
13
13
|
export { default as TableCheckboxIndicator } from './checkbox-indicator/table-checkbox-indicator.svelte';
|
|
14
14
|
export { default as TableCell } from './cell/table-cell.svelte';
|
|
15
15
|
export { default as TableInteractiveCell } from './interactive-cell/table-interactive-cell.svelte';
|
|
16
|
-
export { createTableContext, getTableContext, setTableContext, useTableContext, getTableSectionContext, setTableSectionContext, useTableSectionContext, getTableRowContext, setTableRowContext, useTableRowContext, getTableColumnContext, setTableColumnContext, useTableColumnContext, DEFAULT_TABLE_COLUMN_MIN_WIDTH } from './root/context.svelte';
|
|
16
|
+
export { createTableContext, getTableContext, setTableContext, useTableContext, getTableSectionContext, setTableSectionContext, useTableSectionContext, getTableRowContext, setTableRowContext, useTableRowContext, getTableColumnContext, setTableColumnContext, useTableColumnContext, getTableCellContext, setTableCellContext, useTableCellContext, DEFAULT_TABLE_COLUMN_MIN_WIDTH } from './root/context.svelte';
|
|
17
17
|
export { getTableSsrMinWidth } from './utils/ssr-min-width.js';
|
|
18
18
|
import * as TableParts from './index.parts.js';
|
|
19
19
|
export default TableParts;
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
void row.cellOrderEpoch;
|
|
27
27
|
return row.getCellIndex(key);
|
|
28
28
|
});
|
|
29
|
+
// See `Table.Cell`: outside `'grid'` navigation a body cell is not a focus
|
|
30
|
+
// target, so it skips the focus registry and the focus-derived state below.
|
|
31
|
+
const isFocusTarget = $derived(row.section === 'body' && table.keyboardNavigation === 'grid');
|
|
29
32
|
|
|
30
33
|
function syncCellRegistration() {
|
|
31
34
|
if (row.section !== 'body') return;
|
|
@@ -54,12 +57,15 @@
|
|
|
54
57
|
});
|
|
55
58
|
|
|
56
59
|
$effect(() => {
|
|
60
|
+
if (!isFocusTarget) return;
|
|
57
61
|
syncCellRegistration();
|
|
58
62
|
});
|
|
59
63
|
|
|
60
64
|
onDestroy(() => {
|
|
61
65
|
row.unregisterCellToken(key);
|
|
62
|
-
|
|
66
|
+
// Mirrors `isFocusTarget` without reading it: a derived is not safe to
|
|
67
|
+
// read while the component tears down.
|
|
68
|
+
if (row.section === 'body' && table.keyboardNavigation === 'grid') {
|
|
63
69
|
table.unregisterCell(key);
|
|
64
70
|
}
|
|
65
71
|
});
|
|
@@ -88,10 +94,8 @@
|
|
|
88
94
|
});
|
|
89
95
|
// Focus/selection/disabled state is fine-grained `$state` in the context —
|
|
90
96
|
// the reads below track it directly, no version counters needed.
|
|
91
|
-
const isFocused = $derived(
|
|
92
|
-
const isFocusVisible = $derived(
|
|
93
|
-
row.section === 'body' ? isFocused && table.focusVisible : false
|
|
94
|
-
);
|
|
97
|
+
const isFocused = $derived(isFocusTarget ? table.isCellFocused(key) : false);
|
|
98
|
+
const isFocusVisible = $derived(isFocusTarget ? isFocused && table.focusVisible : false);
|
|
95
99
|
const isRowSelected = $derived(row.section === 'body' ? row.rowState.isSelected : false);
|
|
96
100
|
const isRowDisabled = $derived(
|
|
97
101
|
row.section === 'body'
|
|
@@ -112,7 +116,7 @@
|
|
|
112
116
|
);
|
|
113
117
|
const isCellFocusable = $derived(row.section !== 'body' || !isRowDisabled);
|
|
114
118
|
const cellTabIndex = $derived.by(() => {
|
|
115
|
-
if (
|
|
119
|
+
if (!isFocusTarget) return undefined;
|
|
116
120
|
if (isColumnHidden) return undefined;
|
|
117
121
|
if (!isCellFocusable) return undefined;
|
|
118
122
|
if (focusDelegate) return undefined;
|
|
@@ -130,11 +134,23 @@
|
|
|
130
134
|
table.setFocusVisible(shouldShowFocusVisible(element ?? null));
|
|
131
135
|
}
|
|
132
136
|
|
|
137
|
+
// A pointer press moves focus to whatever the current mode can focus, so the
|
|
138
|
+
// keyboard carries on from where the pointer left off.
|
|
139
|
+
function focusPressTarget() {
|
|
140
|
+
if (isFocusTarget) {
|
|
141
|
+
table.focusCellByKey(key);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (table.keyboardNavigation === 'row') {
|
|
145
|
+
table.focusRowByToken(row.rowToken, 'start');
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
133
149
|
function handleClick(event: MouseEvent) {
|
|
134
150
|
if (!isCellTarget(event)) return;
|
|
135
151
|
if (row.section !== 'body') return;
|
|
136
152
|
if (isRowDisabled) return;
|
|
137
|
-
|
|
153
|
+
focusPressTarget();
|
|
138
154
|
table.pressRow(
|
|
139
155
|
row.rowId as TableSelectionKey | undefined,
|
|
140
156
|
'pointer',
|
|
@@ -152,7 +168,7 @@
|
|
|
152
168
|
if (!isCellTarget(event)) return;
|
|
153
169
|
if (row.section !== 'body') return;
|
|
154
170
|
if (isRowDisabled) return;
|
|
155
|
-
|
|
171
|
+
focusPressTarget();
|
|
156
172
|
table.pressRow(
|
|
157
173
|
row.rowId as TableSelectionKey | undefined,
|
|
158
174
|
'pointer-double',
|
|
@@ -237,11 +253,11 @@
|
|
|
237
253
|
style:inset-inline-end={pinState?.side === 'right' ? `${pinState.offset}px` : undefined}
|
|
238
254
|
style:z-index={pinState ? 1 : undefined}
|
|
239
255
|
style:display={isColumnHidden ? 'none' : 'table-cell'}
|
|
240
|
-
onfocus={
|
|
256
|
+
onfocus={isFocusTarget ? handleFocus : undefined}
|
|
241
257
|
onclick={row.section === 'body' ? handleClick : undefined}
|
|
242
258
|
ondblclick={row.section === 'body' ? handleDoubleClick : undefined}
|
|
243
259
|
onmousedown={row.section === 'body' ? handleMouseDown : undefined}
|
|
244
|
-
onkeydown={
|
|
260
|
+
onkeydown={isFocusTarget ? handleKeyDown : undefined}
|
|
245
261
|
{...restProps}
|
|
246
262
|
>
|
|
247
263
|
{#if children}
|
|
@@ -37,7 +37,7 @@ Public prop type: `TableRootProps`
|
|
|
37
37
|
| `aria-labelledby` | `string` | `undefined` | Id reference for an external label. |
|
|
38
38
|
| `class` | `string` | `''` | Class names for the root table element. |
|
|
39
39
|
| `context` | `TableContext` | `undefined` | Bindable reference to the active internal table context instance. |
|
|
40
|
-
| `element` | `HTMLTableElement` | `undefined` |
|
|
40
|
+
| `element` | `HTMLTableElement` | `undefined` | A bindable reference to the table element. |
|
|
41
41
|
| `children` | `Snippet` | `undefined` | Composed table parts. |
|
|
42
42
|
|
|
43
43
|
### Behavior notes
|