@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
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { readable } from 'svelte/store';
|
|
3
|
+
import { ButtonRoot } from '../../button/index.js';
|
|
4
|
+
import { resolveLocalizedString } from '../../internal/localized-strings';
|
|
5
|
+
import { useLocaleContextOptional } from '../../locale-provider/context';
|
|
6
|
+
import type { BreadcrumbsEllipsisProps } from '../types.js';
|
|
7
|
+
import { useBreadcrumbsContext } from '../root/context';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Breadcrumbs.Ellipsis — the button that stands for the folded middle of a long trail.
|
|
11
|
+
*
|
|
12
|
+
* Put it in the list after the first item. It renders only while the trail is folded, as an
|
|
13
|
+
* `<li>` with a button named "Show N more pages", in the locale of `LocaleProvider`. A press
|
|
14
|
+
* unfolds the trail, and the focus moves to the first page that comes into view: the button
|
|
15
|
+
* is gone, and a focus left on nothing is a focus lost.
|
|
16
|
+
*/
|
|
17
|
+
let {
|
|
18
|
+
children,
|
|
19
|
+
class: className = '',
|
|
20
|
+
itemClass = '',
|
|
21
|
+
separator,
|
|
22
|
+
'aria-label': ariaLabelProp,
|
|
23
|
+
element = $bindable<HTMLButtonElement | null>(null),
|
|
24
|
+
onclick,
|
|
25
|
+
...restProps
|
|
26
|
+
}: BreadcrumbsEllipsisProps = $props();
|
|
27
|
+
|
|
28
|
+
const breadcrumbs = useBreadcrumbsContext('Breadcrumbs.Ellipsis');
|
|
29
|
+
|
|
30
|
+
const localeContext = useLocaleContextOptional();
|
|
31
|
+
const emptyLocaleStore = readable<string | undefined>(undefined);
|
|
32
|
+
const localeStore = localeContext?.locale ?? emptyLocaleStore;
|
|
33
|
+
const ariaLabel = $derived(
|
|
34
|
+
ariaLabelProp ??
|
|
35
|
+
resolveLocalizedString($localeStore, 'breadcrumbs.showMore', {
|
|
36
|
+
count: breadcrumbs.hiddenCount
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
function handleClick(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) {
|
|
41
|
+
onclick?.(event);
|
|
42
|
+
if (event.defaultPrevented) return;
|
|
43
|
+
breadcrumbs.expand();
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
{#if breadcrumbs.collapsed}
|
|
48
|
+
<li class={itemClass} data-breadcrumbs-ellipsis="true">
|
|
49
|
+
<ButtonRoot
|
|
50
|
+
{...restProps}
|
|
51
|
+
bind:element
|
|
52
|
+
class={className}
|
|
53
|
+
type="button"
|
|
54
|
+
aria-label={ariaLabel}
|
|
55
|
+
data-breadcrumbs-ellipsis-button="true"
|
|
56
|
+
onclick={handleClick}
|
|
57
|
+
>
|
|
58
|
+
{#if children}{@render children()}{:else}…{/if}
|
|
59
|
+
</ButtonRoot>
|
|
60
|
+
{@render separator?.()}
|
|
61
|
+
</li>
|
|
62
|
+
{/if}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
2
|
+
import type BreadcrumbsEllipsisComponent from './ellipsis/breadcrumbs-ellipsis.svelte';
|
|
3
|
+
import type BreadcrumbsItemComponent from './item/breadcrumbs-item.svelte';
|
|
4
|
+
import type BreadcrumbsLinkComponent from './link/breadcrumbs-link.svelte';
|
|
5
|
+
import type BreadcrumbsListComponent from './list/breadcrumbs-list.svelte';
|
|
6
|
+
import type BreadcrumbsRootComponent from './root/breadcrumbs-root.svelte';
|
|
7
|
+
import type BreadcrumbsSeparatorComponent from './separator/breadcrumbs-separator.svelte';
|
|
8
|
+
export * as Breadcrumbs from './index.parts.js';
|
|
9
|
+
export { default as BreadcrumbsRoot } from './root/breadcrumbs-root.svelte';
|
|
10
|
+
export { default as BreadcrumbsList } from './list/breadcrumbs-list.svelte';
|
|
11
|
+
export { default as BreadcrumbsItem } from './item/breadcrumbs-item.svelte';
|
|
12
|
+
export { default as BreadcrumbsLink } from './link/breadcrumbs-link.svelte';
|
|
13
|
+
export { default as BreadcrumbsEllipsis } from './ellipsis/breadcrumbs-ellipsis.svelte';
|
|
14
|
+
export { default as BreadcrumbsSeparator } from './separator/breadcrumbs-separator.svelte';
|
|
15
|
+
export type BreadcrumbsRootProps = ComponentProps<typeof BreadcrumbsRootComponent>;
|
|
16
|
+
export type BreadcrumbsListProps = ComponentProps<typeof BreadcrumbsListComponent>;
|
|
17
|
+
export type BreadcrumbsItemProps = ComponentProps<typeof BreadcrumbsItemComponent>;
|
|
18
|
+
export type BreadcrumbsLinkProps = ComponentProps<typeof BreadcrumbsLinkComponent>;
|
|
19
|
+
export type BreadcrumbsEllipsisProps = ComponentProps<typeof BreadcrumbsEllipsisComponent>;
|
|
20
|
+
export { getBreadcrumbsContext, setBreadcrumbsContext, useBreadcrumbsContext, type BreadcrumbsContext } from './root/context.js';
|
|
21
|
+
export type BreadcrumbsSeparatorProps = ComponentProps<typeof BreadcrumbsSeparatorComponent>;
|
|
22
|
+
import * as BreadcrumbsParts from './index.parts.js';
|
|
23
|
+
export default BreadcrumbsParts;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * as Breadcrumbs from './index.parts.js';
|
|
2
|
+
export { default as BreadcrumbsRoot } from './root/breadcrumbs-root.svelte';
|
|
3
|
+
export { default as BreadcrumbsList } from './list/breadcrumbs-list.svelte';
|
|
4
|
+
export { default as BreadcrumbsItem } from './item/breadcrumbs-item.svelte';
|
|
5
|
+
export { default as BreadcrumbsLink } from './link/breadcrumbs-link.svelte';
|
|
6
|
+
export { default as BreadcrumbsEllipsis } from './ellipsis/breadcrumbs-ellipsis.svelte';
|
|
7
|
+
export { default as BreadcrumbsSeparator } from './separator/breadcrumbs-separator.svelte';
|
|
8
|
+
export { getBreadcrumbsContext, setBreadcrumbsContext, useBreadcrumbsContext } from './root/context.js';
|
|
9
|
+
import * as BreadcrumbsParts from './index.parts.js';
|
|
10
|
+
export default BreadcrumbsParts;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Root } from './root/breadcrumbs-root.svelte';
|
|
2
|
+
export { default as List } from './list/breadcrumbs-list.svelte';
|
|
3
|
+
export { default as Item } from './item/breadcrumbs-item.svelte';
|
|
4
|
+
export { default as Link } from './link/breadcrumbs-link.svelte';
|
|
5
|
+
export { default as Ellipsis } from './ellipsis/breadcrumbs-ellipsis.svelte';
|
|
6
|
+
export { default as Separator } from './separator/breadcrumbs-separator.svelte';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Root } from './root/breadcrumbs-root.svelte';
|
|
2
|
+
export { default as List } from './list/breadcrumbs-list.svelte';
|
|
3
|
+
export { default as Item } from './item/breadcrumbs-item.svelte';
|
|
4
|
+
export { default as Link } from './link/breadcrumbs-link.svelte';
|
|
5
|
+
export { default as Ellipsis } from './ellipsis/breadcrumbs-ellipsis.svelte';
|
|
6
|
+
export { default as Separator } from './separator/breadcrumbs-separator.svelte';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { BreadcrumbsItemProps } from '../types.js';
|
|
3
|
+
import { useBreadcrumbsContext } from '../root/context';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Breadcrumbs.Item — one page of the trail.
|
|
7
|
+
*
|
|
8
|
+
* It is an `<li>` with a `Breadcrumbs.Link` in it, and a `Breadcrumbs.Separator` after the
|
|
9
|
+
* link on every item but the last. The separator is in the item, not between two items,
|
|
10
|
+
* thus the list holds items only and its count is the count of pages. In a folded trail, an
|
|
11
|
+
* item of the middle renders nothing until the trail unfolds.
|
|
12
|
+
*/
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
class: className = '',
|
|
16
|
+
element = $bindable<HTMLLIElement | null>(null),
|
|
17
|
+
...restProps
|
|
18
|
+
}: BreadcrumbsItemProps = $props();
|
|
19
|
+
|
|
20
|
+
const breadcrumbs = useBreadcrumbsContext('Breadcrumbs.Item');
|
|
21
|
+
// Registered at creation, not in an effect: the place in the trail must be known before the
|
|
22
|
+
// first render, or a folded item would paint once and go.
|
|
23
|
+
const id = $props.id();
|
|
24
|
+
const unregister = breadcrumbs.register(id);
|
|
25
|
+
$effect(() => unregister);
|
|
26
|
+
const hidden = $derived(breadcrumbs.isHidden(id));
|
|
27
|
+
|
|
28
|
+
let itemRef: HTMLLIElement | null = $state(null);
|
|
29
|
+
|
|
30
|
+
$effect(() => {
|
|
31
|
+
element = itemRef;
|
|
32
|
+
return () => {
|
|
33
|
+
element = null;
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
{#if !hidden}
|
|
39
|
+
<li {...restProps} bind:this={itemRef} class={className} data-breadcrumbs-item="true">
|
|
40
|
+
{@render children?.()}
|
|
41
|
+
</li>
|
|
42
|
+
{/if}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { BreadcrumbsLinkProps } from '../types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Breadcrumbs.Link — the page, as a link.
|
|
6
|
+
*
|
|
7
|
+
* It is an `<a>` with an `href`, and a `<span>` without one. `current` marks the page the
|
|
8
|
+
* user is on with `aria-current="page"`. `disabled` takes the `href` away: a link with no
|
|
9
|
+
* address is out of the tab order on its own, with no `tabindex` to manage.
|
|
10
|
+
*/
|
|
11
|
+
let {
|
|
12
|
+
children,
|
|
13
|
+
class: className = '',
|
|
14
|
+
href,
|
|
15
|
+
current = false,
|
|
16
|
+
disabled = false,
|
|
17
|
+
element = $bindable<HTMLAnchorElement | HTMLSpanElement | null>(null),
|
|
18
|
+
...restProps
|
|
19
|
+
}: BreadcrumbsLinkProps = $props();
|
|
20
|
+
|
|
21
|
+
let linkRef: HTMLAnchorElement | HTMLSpanElement | null = $state(null);
|
|
22
|
+
const isLink = $derived(Boolean(href) && !disabled);
|
|
23
|
+
|
|
24
|
+
$effect(() => {
|
|
25
|
+
element = linkRef;
|
|
26
|
+
return () => {
|
|
27
|
+
element = null;
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<!-- Without an address, the text is not a link: a span says so, where an anchor with no href
|
|
33
|
+
still reads as a link to some screen readers. -->
|
|
34
|
+
<svelte:element
|
|
35
|
+
this={isLink ? 'a' : 'span'}
|
|
36
|
+
{...restProps}
|
|
37
|
+
bind:this={linkRef}
|
|
38
|
+
href={isLink ? href : undefined}
|
|
39
|
+
aria-current={current ? 'page' : undefined}
|
|
40
|
+
aria-disabled={disabled ? 'true' : undefined}
|
|
41
|
+
class={className}
|
|
42
|
+
data-breadcrumbs-link="true"
|
|
43
|
+
data-current={current || undefined}
|
|
44
|
+
data-disabled={disabled || undefined}
|
|
45
|
+
>
|
|
46
|
+
{@render children?.()}
|
|
47
|
+
</svelte:element>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { BreadcrumbsListProps } from '../types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Breadcrumbs.List — the ordered list of the trail.
|
|
6
|
+
*
|
|
7
|
+
* It is an `<ol>`: the order of the items is the order of the pages, from the root of the
|
|
8
|
+
* site to the page the user is on, and a screen reader says how many there are. The role is
|
|
9
|
+
* on it in writing: some browsers drop the list from the accessibility tree when its
|
|
10
|
+
* `list-style` is `none`, which every trail sets.
|
|
11
|
+
*/
|
|
12
|
+
let {
|
|
13
|
+
children,
|
|
14
|
+
class: className = '',
|
|
15
|
+
element = $bindable<HTMLOListElement | null>(null),
|
|
16
|
+
...restProps
|
|
17
|
+
}: BreadcrumbsListProps = $props();
|
|
18
|
+
|
|
19
|
+
let listRef: HTMLOListElement | null = $state(null);
|
|
20
|
+
|
|
21
|
+
$effect(() => {
|
|
22
|
+
element = listRef;
|
|
23
|
+
return () => {
|
|
24
|
+
element = null;
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<ol {...restProps} bind:this={listRef} role="list" class={className} data-breadcrumbs-list="true">
|
|
30
|
+
{@render children?.()}
|
|
31
|
+
</ol>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tick } from 'svelte';
|
|
3
|
+
import { readable } from 'svelte/store';
|
|
4
|
+
import { resolveLocalizedString } from '../../internal/localized-strings';
|
|
5
|
+
import { useLocaleContextOptional } from '../../locale-provider/context';
|
|
6
|
+
import type { BreadcrumbsRootProps } from '../types.js';
|
|
7
|
+
import { setBreadcrumbsContext, type BreadcrumbsContext } from './context';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Breadcrumbs.Root — the trail of pages above the one the user is on.
|
|
11
|
+
*
|
|
12
|
+
* It is a `<nav>` landmark named "Breadcrumb", in the locale of `LocaleProvider`: a screen
|
|
13
|
+
* reader user finds it in the list of landmarks, apart from the main navigation. Put a
|
|
14
|
+
* `Breadcrumbs.List` in it.
|
|
15
|
+
*
|
|
16
|
+
* `maxItems` folds the middle of a long trail: the first item and the last `maxItems - 1`
|
|
17
|
+
* stay in view, and a `Breadcrumbs.Ellipsis` in the list stands for the rest until a press
|
|
18
|
+
* unfolds them.
|
|
19
|
+
*/
|
|
20
|
+
let {
|
|
21
|
+
children,
|
|
22
|
+
class: className = '',
|
|
23
|
+
'aria-label': ariaLabelProp,
|
|
24
|
+
maxItems,
|
|
25
|
+
expanded = $bindable(false),
|
|
26
|
+
onExpandedChange,
|
|
27
|
+
element = $bindable<HTMLElement | null>(null),
|
|
28
|
+
...restProps
|
|
29
|
+
}: BreadcrumbsRootProps = $props();
|
|
30
|
+
|
|
31
|
+
const localeContext = useLocaleContextOptional();
|
|
32
|
+
const emptyLocaleStore = readable<string | undefined>(undefined);
|
|
33
|
+
const localeStore = localeContext?.locale ?? emptyLocaleStore;
|
|
34
|
+
const ariaLabel = $derived(
|
|
35
|
+
ariaLabelProp ?? resolveLocalizedString($localeStore, 'breadcrumbs.label')
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
let navRef: HTMLElement | null = $state(null);
|
|
39
|
+
let ids = $state<string[]>([]);
|
|
40
|
+
|
|
41
|
+
// Fewer than two in view would hide the current page, or the root of the site.
|
|
42
|
+
const limit = $derived(maxItems === undefined ? Infinity : Math.max(2, Math.floor(maxItems)));
|
|
43
|
+
const collapsed = $derived(!expanded && ids.length > limit);
|
|
44
|
+
// The folded middle: after the first item, before the last `limit - 1`.
|
|
45
|
+
const hiddenEnd = $derived(collapsed ? ids.length - (limit - 1) : 0);
|
|
46
|
+
const hiddenCount = $derived(collapsed ? hiddenEnd - 1 : 0);
|
|
47
|
+
|
|
48
|
+
async function expand() {
|
|
49
|
+
if (expanded) return;
|
|
50
|
+
expanded = true;
|
|
51
|
+
onExpandedChange?.(true);
|
|
52
|
+
// The button that had the focus is gone: the first page that came into view takes it.
|
|
53
|
+
await tick();
|
|
54
|
+
const items = Array.from(
|
|
55
|
+
navRef?.querySelectorAll<HTMLElement>('[data-breadcrumbs-item]') ?? []
|
|
56
|
+
).slice(1);
|
|
57
|
+
for (const item of items) {
|
|
58
|
+
const target = item.querySelector<HTMLElement>('a[href], button, [tabindex]');
|
|
59
|
+
if (target) {
|
|
60
|
+
target.focus();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const context: BreadcrumbsContext = {
|
|
67
|
+
get count() {
|
|
68
|
+
return ids.length;
|
|
69
|
+
},
|
|
70
|
+
get maxItems() {
|
|
71
|
+
return limit;
|
|
72
|
+
},
|
|
73
|
+
get collapsed() {
|
|
74
|
+
return collapsed;
|
|
75
|
+
},
|
|
76
|
+
get hiddenCount() {
|
|
77
|
+
return hiddenCount;
|
|
78
|
+
},
|
|
79
|
+
register(id) {
|
|
80
|
+
ids = [...ids, id];
|
|
81
|
+
return () => {
|
|
82
|
+
ids = ids.filter((candidate) => candidate !== id);
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
isHidden(id) {
|
|
86
|
+
if (!collapsed) return false;
|
|
87
|
+
const index = ids.indexOf(id);
|
|
88
|
+
return index > 0 && index < hiddenEnd;
|
|
89
|
+
},
|
|
90
|
+
expand
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
setBreadcrumbsContext(context);
|
|
94
|
+
|
|
95
|
+
$effect(() => {
|
|
96
|
+
element = navRef;
|
|
97
|
+
return () => {
|
|
98
|
+
element = null;
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<nav
|
|
104
|
+
{...restProps}
|
|
105
|
+
bind:this={navRef}
|
|
106
|
+
aria-label={ariaLabel}
|
|
107
|
+
class={className}
|
|
108
|
+
data-breadcrumbs-root="true"
|
|
109
|
+
data-collapsed={collapsed || undefined}
|
|
110
|
+
>
|
|
111
|
+
{@render children?.()}
|
|
112
|
+
</nav>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type BreadcrumbsContext = {
|
|
2
|
+
/** The count of items in the trail, on the screen or not. */
|
|
3
|
+
readonly count: number;
|
|
4
|
+
/** The count of items past which the middle of the trail folds. `Infinity` without a limit. */
|
|
5
|
+
readonly maxItems: number;
|
|
6
|
+
/** True while the middle of the trail is out of view. */
|
|
7
|
+
readonly collapsed: boolean;
|
|
8
|
+
/** The count of items out of view. */
|
|
9
|
+
readonly hiddenCount: number;
|
|
10
|
+
/** Registers an item, and answers a function that unregisters it. */
|
|
11
|
+
register: (id: string) => () => void;
|
|
12
|
+
/** True for an item in the folded middle of the trail. */
|
|
13
|
+
isHidden: (id: string) => boolean;
|
|
14
|
+
/** Unfolds the trail, and moves the focus to the first item that comes into view. */
|
|
15
|
+
expand: () => void;
|
|
16
|
+
};
|
|
17
|
+
export declare function setBreadcrumbsContext(context: BreadcrumbsContext): void;
|
|
18
|
+
export declare function getBreadcrumbsContext(): BreadcrumbsContext | undefined;
|
|
19
|
+
export declare function useBreadcrumbsContext(part?: string): BreadcrumbsContext;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
const KEY = Symbol('breadcrumbs');
|
|
3
|
+
export function setBreadcrumbsContext(context) {
|
|
4
|
+
setContext(KEY, context);
|
|
5
|
+
}
|
|
6
|
+
export function getBreadcrumbsContext() {
|
|
7
|
+
return getContext(KEY);
|
|
8
|
+
}
|
|
9
|
+
export function useBreadcrumbsContext(part = 'Breadcrumbs') {
|
|
10
|
+
const context = getBreadcrumbsContext();
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw new Error(`${part} must be used within Breadcrumbs.Root.`);
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { BreadcrumbsSeparatorProps } from '../types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Breadcrumbs.Separator — the sign between two pages of the trail.
|
|
6
|
+
*
|
|
7
|
+
* It is hidden from the screen reader: the list already separates the items, and a slash
|
|
8
|
+
* read aloud between each two is noise. Put it in the item, after the link.
|
|
9
|
+
*/
|
|
10
|
+
let {
|
|
11
|
+
children,
|
|
12
|
+
class: className = '',
|
|
13
|
+
element = $bindable<HTMLSpanElement | null>(null),
|
|
14
|
+
...restProps
|
|
15
|
+
}: BreadcrumbsSeparatorProps = $props();
|
|
16
|
+
|
|
17
|
+
let separatorRef: HTMLSpanElement | null = $state(null);
|
|
18
|
+
|
|
19
|
+
$effect(() => {
|
|
20
|
+
element = separatorRef;
|
|
21
|
+
return () => {
|
|
22
|
+
element = null;
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<span
|
|
28
|
+
{...restProps}
|
|
29
|
+
bind:this={separatorRef}
|
|
30
|
+
aria-hidden="true"
|
|
31
|
+
class={className}
|
|
32
|
+
data-breadcrumbs-separator="true"
|
|
33
|
+
>
|
|
34
|
+
{#if children}{@render children()}{:else}/{/if}
|
|
35
|
+
</span>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BreadcrumbsSeparatorProps } from '../types.js';
|
|
2
|
+
declare const BreadcrumbsSeparator: import("svelte").Component<BreadcrumbsSeparatorProps, {}, "element">;
|
|
3
|
+
type BreadcrumbsSeparator = ReturnType<typeof BreadcrumbsSeparator>;
|
|
4
|
+
export default BreadcrumbsSeparator;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes, HTMLOlAttributes } from 'svelte/elements';
|
|
3
|
+
export type { BreadcrumbsContext } from './root/context.js';
|
|
4
|
+
export type BreadcrumbsRootProps = Omit<HTMLAttributes<HTMLElement>, 'children' | 'class'> & {
|
|
5
|
+
/** `Breadcrumbs.List`. */
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
/** The CSS class names of the element. */
|
|
8
|
+
class?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The name of the landmark. Without it, the name is "Breadcrumb" in the locale of
|
|
11
|
+
* `LocaleProvider`. Give one when the page has two sets of breadcrumbs.
|
|
12
|
+
*/
|
|
13
|
+
'aria-label'?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The count of items past which the middle of the trail folds behind a `Breadcrumbs.Ellipsis`.
|
|
16
|
+
* The first item and the last `maxItems - 1` stay in view. Without it, every item is in view.
|
|
17
|
+
*/
|
|
18
|
+
maxItems?: number;
|
|
19
|
+
/** True once the user unfolds the trail. Use `bind:expanded` to read it, or to fold it again. */
|
|
20
|
+
expanded?: boolean;
|
|
21
|
+
/** Called when the trail unfolds or folds. */
|
|
22
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
23
|
+
/** The `<nav>` element. Use `bind:element` to read it. */
|
|
24
|
+
element?: HTMLElement | null;
|
|
25
|
+
};
|
|
26
|
+
export type BreadcrumbsListProps = Omit<HTMLOlAttributes, 'children' | 'class' | 'role'> & {
|
|
27
|
+
/** The items. */
|
|
28
|
+
children?: Snippet;
|
|
29
|
+
/** The CSS class names of the element. */
|
|
30
|
+
class?: string;
|
|
31
|
+
/** The `<ol>` element. Use `bind:element` to read it. */
|
|
32
|
+
element?: HTMLOListElement | null;
|
|
33
|
+
};
|
|
34
|
+
export type BreadcrumbsItemProps = Omit<HTMLAttributes<HTMLLIElement>, 'children' | 'class'> & {
|
|
35
|
+
/** `Breadcrumbs.Link`, and a `Breadcrumbs.Separator` after it. */
|
|
36
|
+
children?: Snippet;
|
|
37
|
+
/** The CSS class names of the element. */
|
|
38
|
+
class?: string;
|
|
39
|
+
/** The `<li>` element. Use `bind:element` to read it. */
|
|
40
|
+
element?: HTMLLIElement | null;
|
|
41
|
+
};
|
|
42
|
+
export type BreadcrumbsLinkProps = Omit<HTMLAnchorAttributes, 'children' | 'class' | 'href' | 'aria-current' | 'aria-disabled'> & {
|
|
43
|
+
/** The text of the link. */
|
|
44
|
+
children?: Snippet;
|
|
45
|
+
/** The CSS class names of the element. */
|
|
46
|
+
class?: string;
|
|
47
|
+
/** The address of the page. Without it, the link is plain text. */
|
|
48
|
+
href?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Marks the page the user is on. The link gets `aria-current="page"`. Set it on the last
|
|
51
|
+
* item: a screen reader user then knows where the trail ends.
|
|
52
|
+
*/
|
|
53
|
+
current?: boolean;
|
|
54
|
+
/** Takes the link out of use: it keeps its text, and it loses its `href` and its tab stop. */
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
/** The `<a>` element, or the `<span>` without an `href`. Use `bind:element` to read it. */
|
|
57
|
+
element?: HTMLAnchorElement | HTMLSpanElement | null;
|
|
58
|
+
};
|
|
59
|
+
export type BreadcrumbsEllipsisProps = Omit<HTMLButtonAttributes, 'children' | 'class' | 'type' | 'aria-label'> & {
|
|
60
|
+
/** The content of the button. Three dots without children. */
|
|
61
|
+
children?: Snippet;
|
|
62
|
+
/** The CSS class names of the button. */
|
|
63
|
+
class?: string;
|
|
64
|
+
/** The CSS class names of the `<li>` around the button. */
|
|
65
|
+
itemClass?: string;
|
|
66
|
+
/** The sign after the button, such as a `Breadcrumbs.Separator`. */
|
|
67
|
+
separator?: Snippet;
|
|
68
|
+
/** The name of the button. Without it, "Show N more pages" in the locale of `LocaleProvider`. */
|
|
69
|
+
'aria-label'?: string;
|
|
70
|
+
/** The button element, while the trail is folded. Use `bind:element` to read it. */
|
|
71
|
+
element?: HTMLButtonElement | null;
|
|
72
|
+
};
|
|
73
|
+
export type BreadcrumbsSeparatorProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'class' | 'aria-hidden'> & {
|
|
74
|
+
/** The sign between two items. A slash without children. */
|
|
75
|
+
children?: Snippet;
|
|
76
|
+
/** The CSS class names of the element. */
|
|
77
|
+
class?: string;
|
|
78
|
+
/** The `<span>` element. Use `bind:element` to read it. */
|
|
79
|
+
element?: HTMLSpanElement | null;
|
|
80
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/button/README.md
CHANGED
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
|
|
45
45
|
## Notes
|
|
46
46
|
|
|
47
|
-
-
|
|
47
|
+
- If the type is `submit` and `pending` is true, the component makes the element with the type `button`. Thus the form does not submit.
|
|
48
48
|
- Pending does not serialize `data-disabled`; it is represented by `data-pending`.
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
shouldShowFocusVisible,
|
|
6
6
|
trackInteractionModality
|
|
7
7
|
} from '../../primitives/input-modality';
|
|
8
|
+
import { watchFocusVisible } from '../../primitives/focus-visible.svelte';
|
|
8
9
|
import { cn } from '../../utils/cn';
|
|
9
10
|
|
|
10
11
|
export type ButtonRenderState = {
|
|
@@ -20,16 +21,31 @@
|
|
|
20
21
|
HTMLButtonAttributes,
|
|
21
22
|
'children' | 'class' | 'disabled' | 'aria-disabled'
|
|
22
23
|
> & {
|
|
23
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* The content. As a snippet with one argument, it receives the live render state: hovered,
|
|
26
|
+
* pressed, focused, and pending.
|
|
27
|
+
*/
|
|
24
28
|
children?: Snippet<[ButtonRenderState]> | Snippet;
|
|
25
29
|
class?: string;
|
|
26
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Keeps the button focusable, but stops the activation. It announces the pending state politely.
|
|
32
|
+
*/
|
|
27
33
|
pending?: boolean | null;
|
|
28
34
|
/** Disables the button natively. */
|
|
29
35
|
disabled?: boolean | null;
|
|
30
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Keeps a disabled button in the tab order. The button gets `aria-disabled` and not the native
|
|
38
|
+
* attribute. The component still stops the activation.
|
|
39
|
+
*
|
|
40
|
+
* Use it for a control that is unavailable more often than available. The move buttons of a
|
|
41
|
+
* transfer list are one example, and a toolbar that obeys a selection is another. If you disable
|
|
42
|
+
* those natively, a keyboard user does not find them, and the tab order changes while the user
|
|
43
|
+
* works. `pending` says "busy". This says "not applicable".
|
|
44
|
+
*/
|
|
45
|
+
focusableWhenDisabled?: boolean | null;
|
|
46
|
+
/** A bindable reference to the button element. */
|
|
31
47
|
element?: HTMLButtonElement | null;
|
|
32
|
-
/**
|
|
48
|
+
/** Replaces the pressed state that the component holds. */
|
|
33
49
|
pressed?: boolean;
|
|
34
50
|
};
|
|
35
51
|
|
|
@@ -69,6 +85,7 @@
|
|
|
69
85
|
class: className = '',
|
|
70
86
|
pending: pendingProp = false,
|
|
71
87
|
disabled: disabledProp = false,
|
|
88
|
+
focusableWhenDisabled: focusableWhenDisabledProp = false,
|
|
72
89
|
element = $bindable<HTMLButtonElement | null>(null),
|
|
73
90
|
pressed: pressedOverride,
|
|
74
91
|
onclick: onClickExternal,
|
|
@@ -96,12 +113,22 @@
|
|
|
96
113
|
|
|
97
114
|
const disabled = $derived(Boolean(disabledProp));
|
|
98
115
|
const pending = $derived(Boolean(pendingProp));
|
|
116
|
+
const focusableWhenDisabled = $derived(Boolean(focusableWhenDisabledProp));
|
|
117
|
+
const nativelyDisabled = $derived(disabled && !focusableWhenDisabled);
|
|
99
118
|
|
|
100
119
|
let buttonRef: HTMLButtonElement | null = $state(null);
|
|
101
120
|
let hovered = $state(false);
|
|
102
121
|
let pressed = $state(false);
|
|
103
122
|
let focused = $state(false);
|
|
104
123
|
let focusVisible = $state(false);
|
|
124
|
+
|
|
125
|
+
// The focus ring must appear when a pointer press is followed by a key press, and the
|
|
126
|
+
// modality alone changes there — no focus event fires to re-read it.
|
|
127
|
+
watchFocusVisible({
|
|
128
|
+
isFocused: () => focused,
|
|
129
|
+
element: () => buttonRef,
|
|
130
|
+
set: (visible) => (focusVisible = visible)
|
|
131
|
+
});
|
|
105
132
|
let pressedKey: 'Enter' | 'Space' | null = $state(null);
|
|
106
133
|
let expandedPressed = $state(false);
|
|
107
134
|
|
|
@@ -341,7 +368,10 @@
|
|
|
341
368
|
trackInteractionModality(event, buttonRef);
|
|
342
369
|
}
|
|
343
370
|
|
|
344
|
-
|
|
371
|
+
// `disabled` matters here only in the focusable case: a natively disabled button never
|
|
372
|
+
// dispatches a click at all. Preventing default also stops the consumer's handler,
|
|
373
|
+
// which is what `skipExternalOnDefaultPrevented` is for.
|
|
374
|
+
if (pending || disabled) {
|
|
345
375
|
event.preventDefault();
|
|
346
376
|
clearInteractionState();
|
|
347
377
|
}
|
|
@@ -353,10 +383,10 @@
|
|
|
353
383
|
bind:this={buttonRef}
|
|
354
384
|
id={resolvedId}
|
|
355
385
|
type={renderedType}
|
|
356
|
-
{
|
|
386
|
+
disabled={nativelyDisabled}
|
|
357
387
|
aria-label={ariaLabel}
|
|
358
388
|
aria-labelledby={ariaLabelledby}
|
|
359
|
-
aria-disabled={pending ? 'true' : undefined}
|
|
389
|
+
aria-disabled={pending || (disabled && focusableWhenDisabled) ? 'true' : undefined}
|
|
360
390
|
aria-busy={pending ? 'true' : undefined}
|
|
361
391
|
data-button-root="true"
|
|
362
392
|
data-disabled={disabled || undefined}
|