bits-ui 2.6.2 → 2.8.0
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 +4 -4
- package/dist/bits/accordion/accordion.svelte.d.ts +66 -58
- package/dist/bits/accordion/accordion.svelte.js +56 -51
- package/dist/bits/accordion/components/accordion-content.svelte +4 -4
- package/dist/bits/accordion/components/accordion-header.svelte +2 -2
- package/dist/bits/accordion/components/accordion-item.svelte +2 -2
- package/dist/bits/accordion/components/accordion-trigger.svelte +2 -2
- package/dist/bits/accordion/components/accordion.svelte +2 -2
- package/dist/bits/alert-dialog/components/alert-dialog-action.svelte +2 -2
- package/dist/bits/alert-dialog/components/alert-dialog-cancel.svelte +2 -2
- package/dist/bits/alert-dialog/components/alert-dialog-content.svelte +3 -3
- package/dist/bits/alert-dialog/components/alert-dialog.svelte +9 -3
- package/dist/bits/aspect-ratio/aspect-ratio.svelte.d.ts +10 -16
- package/dist/bits/aspect-ratio/aspect-ratio.svelte.js +4 -11
- package/dist/bits/aspect-ratio/components/aspect-ratio.svelte +2 -2
- package/dist/bits/avatar/avatar.svelte.d.ts +25 -33
- package/dist/bits/avatar/avatar.svelte.js +20 -21
- package/dist/bits/avatar/components/avatar-fallback.svelte +2 -2
- package/dist/bits/avatar/components/avatar-image.svelte +2 -2
- package/dist/bits/avatar/components/avatar.svelte +2 -2
- package/dist/bits/calendar/calendar.svelte.d.ts +117 -106
- package/dist/bits/calendar/calendar.svelte.js +51 -52
- package/dist/bits/calendar/components/calendar-cell.svelte +2 -2
- package/dist/bits/calendar/components/calendar-day.svelte +2 -2
- package/dist/bits/calendar/components/calendar-grid-body.svelte +2 -2
- package/dist/bits/calendar/components/calendar-grid-head.svelte +2 -2
- package/dist/bits/calendar/components/calendar-grid-row.svelte +2 -2
- package/dist/bits/calendar/components/calendar-grid.svelte +2 -2
- package/dist/bits/calendar/components/calendar-head-cell.svelte +2 -2
- package/dist/bits/calendar/components/calendar-header.svelte +2 -2
- package/dist/bits/calendar/components/calendar-heading.svelte +5 -5
- package/dist/bits/calendar/components/calendar-month-select.svelte +2 -2
- package/dist/bits/calendar/components/calendar-next-button.svelte +2 -2
- package/dist/bits/calendar/components/calendar-prev-button.svelte +2 -2
- package/dist/bits/calendar/components/calendar-year-select.svelte +2 -2
- package/dist/bits/calendar/components/calendar.svelte +2 -2
- package/dist/bits/checkbox/checkbox.svelte.d.ts +37 -34
- package/dist/bits/checkbox/checkbox.svelte.js +19 -22
- package/dist/bits/checkbox/components/checkbox-group-label.svelte +2 -2
- package/dist/bits/checkbox/components/checkbox-group.svelte +2 -2
- package/dist/bits/checkbox/components/checkbox-input.svelte +2 -2
- package/dist/bits/checkbox/components/checkbox.svelte +2 -2
- package/dist/bits/collapsible/collapsible.svelte.d.ts +30 -27
- package/dist/bits/collapsible/collapsible.svelte.js +23 -15
- package/dist/bits/collapsible/components/collapsible-content.svelte +5 -5
- package/dist/bits/collapsible/components/collapsible-content.svelte.d.ts +1 -4
- package/dist/bits/collapsible/components/collapsible-trigger.svelte +2 -2
- package/dist/bits/collapsible/components/collapsible.svelte +4 -2
- package/dist/bits/collapsible/types.d.ts +4 -0
- package/dist/bits/combobox/components/combobox-input.svelte +2 -2
- package/dist/bits/combobox/components/combobox-trigger.svelte +2 -2
- package/dist/bits/combobox/components/combobox.svelte +4 -2
- package/dist/bits/command/command.svelte.d.ts +103 -92
- package/dist/bits/command/command.svelte.js +55 -57
- package/dist/bits/command/components/_command-label.svelte +2 -2
- package/dist/bits/command/components/command-empty.svelte +2 -2
- package/dist/bits/command/components/command-group-heading.svelte +2 -2
- package/dist/bits/command/components/command-group-items.svelte +2 -2
- package/dist/bits/command/components/command-group.svelte +2 -2
- package/dist/bits/command/components/command-input.svelte +2 -2
- package/dist/bits/command/components/command-item.svelte +2 -2
- package/dist/bits/command/components/command-link-item.svelte +2 -2
- package/dist/bits/command/components/command-list.svelte +2 -2
- package/dist/bits/command/components/command-loading.svelte +2 -2
- package/dist/bits/command/components/command-separator.svelte +2 -2
- package/dist/bits/command/components/command-viewport.svelte +2 -2
- package/dist/bits/command/components/command.svelte +2 -2
- package/dist/bits/context-menu/components/context-menu-content-static.svelte +3 -3
- package/dist/bits/context-menu/components/context-menu-content.svelte +3 -3
- package/dist/bits/context-menu/components/context-menu-trigger.svelte +2 -2
- package/dist/bits/context-menu/components/context-menu.svelte +16 -11
- package/dist/bits/date-field/components/date-field-hidden-input.svelte +2 -2
- package/dist/bits/date-field/components/date-field-input.svelte +2 -2
- package/dist/bits/date-field/components/date-field-label.svelte +2 -2
- package/dist/bits/date-field/components/date-field-segment.svelte +2 -2
- package/dist/bits/date-field/components/date-field.svelte +2 -2
- package/dist/bits/date-field/date-field.svelte.d.ts +85 -74
- package/dist/bits/date-field/date-field.svelte.js +55 -53
- package/dist/bits/date-picker/components/date-picker-calendar.svelte +2 -2
- package/dist/bits/date-picker/components/date-picker.svelte +8 -6
- package/dist/bits/date-picker/date-picker.svelte.d.ts +10 -10
- package/dist/bits/date-picker/date-picker.svelte.js +6 -5
- package/dist/bits/date-picker/types.d.ts +4 -0
- package/dist/bits/date-range-field/components/date-range-field-input.svelte +2 -2
- package/dist/bits/date-range-field/components/date-range-field-label.svelte +2 -2
- package/dist/bits/date-range-field/components/date-range-field.svelte +2 -2
- package/dist/bits/date-range-field/date-range-field.svelte.d.ts +32 -29
- package/dist/bits/date-range-field/date-range-field.svelte.js +33 -32
- package/dist/bits/date-range-picker/components/date-range-picker-calendar.svelte +2 -2
- package/dist/bits/date-range-picker/components/date-range-picker.svelte +8 -6
- package/dist/bits/date-range-picker/date-range-picker.svelte.d.ts +10 -10
- package/dist/bits/date-range-picker/date-range-picker.svelte.js +6 -5
- package/dist/bits/date-range-picker/types.d.ts +4 -0
- package/dist/bits/dialog/components/dialog-close.svelte +2 -2
- package/dist/bits/dialog/components/dialog-content.svelte +3 -3
- package/dist/bits/dialog/components/dialog-description.svelte +2 -2
- package/dist/bits/dialog/components/dialog-overlay.svelte +3 -6
- package/dist/bits/dialog/components/dialog-title.svelte +2 -2
- package/dist/bits/dialog/components/dialog-trigger.svelte +2 -2
- package/dist/bits/dialog/components/dialog.svelte +9 -3
- package/dist/bits/dialog/dialog.svelte.d.ts +75 -65
- package/dist/bits/dialog/dialog.svelte.js +47 -38
- package/dist/bits/dialog/types.d.ts +4 -0
- package/dist/bits/dropdown-menu/components/dropdown-menu-content-static.svelte +3 -3
- package/dist/bits/dropdown-menu/components/dropdown-menu-content.svelte +3 -3
- package/dist/bits/label/components/label.svelte +2 -2
- package/dist/bits/label/label.svelte.d.ts +8 -7
- package/dist/bits/label/label.svelte.js +4 -4
- package/dist/bits/link-preview/components/link-preview-content-static.svelte +3 -3
- package/dist/bits/link-preview/components/link-preview-content.svelte +3 -3
- package/dist/bits/link-preview/components/link-preview-trigger.svelte +2 -2
- package/dist/bits/link-preview/components/link-preview.svelte +4 -2
- package/dist/bits/link-preview/link-preview.svelte.d.ts +28 -25
- package/dist/bits/link-preview/link-preview.svelte.js +24 -16
- package/dist/bits/link-preview/types.d.ts +4 -0
- package/dist/bits/menu/components/menu-arrow.svelte +2 -2
- package/dist/bits/menu/components/menu-checkbox-group.svelte +2 -2
- package/dist/bits/menu/components/menu-checkbox-item.svelte +2 -2
- package/dist/bits/menu/components/menu-content-static.svelte +3 -3
- package/dist/bits/menu/components/menu-content.svelte +3 -3
- package/dist/bits/menu/components/menu-group-heading.svelte +2 -2
- package/dist/bits/menu/components/menu-group.svelte +2 -2
- package/dist/bits/menu/components/menu-item.svelte +2 -2
- package/dist/bits/menu/components/menu-radio-group.svelte +2 -2
- package/dist/bits/menu/components/menu-radio-item.svelte +2 -2
- package/dist/bits/menu/components/menu-separator.svelte +2 -2
- package/dist/bits/menu/components/menu-sub-content-static.svelte +3 -3
- package/dist/bits/menu/components/menu-sub-content.svelte +3 -3
- package/dist/bits/menu/components/menu-sub-trigger.svelte +2 -2
- package/dist/bits/menu/components/menu-sub.svelte +9 -3
- package/dist/bits/menu/components/menu-trigger.svelte +2 -2
- package/dist/bits/menu/components/menu.svelte +16 -11
- package/dist/bits/menu/menu.svelte.d.ts +136 -119
- package/dist/bits/menu/menu.svelte.js +106 -96
- package/dist/bits/menu/types.d.ts +8 -0
- package/dist/bits/menubar/components/menubar-content-static.svelte +2 -2
- package/dist/bits/menubar/components/menubar-content.svelte +2 -2
- package/dist/bits/menubar/components/menubar-menu.svelte +2 -2
- package/dist/bits/menubar/components/menubar-trigger.svelte +4 -4
- package/dist/bits/menubar/components/menubar.svelte +2 -2
- package/dist/bits/menubar/menubar.svelte.d.ts +37 -34
- package/dist/bits/menubar/menubar.svelte.js +21 -21
- package/dist/bits/meter/components/meter.svelte +2 -2
- package/dist/bits/meter/meter.svelte.d.ts +10 -9
- package/dist/bits/meter/meter.svelte.js +4 -4
- package/dist/bits/navigation-menu/components/navigation-menu-content-impl.svelte +2 -2
- package/dist/bits/navigation-menu/components/navigation-menu-content.svelte +3 -3
- package/dist/bits/navigation-menu/components/navigation-menu-indicator-impl.svelte +2 -2
- package/dist/bits/navigation-menu/components/navigation-menu-indicator.svelte +3 -3
- package/dist/bits/navigation-menu/components/navigation-menu-item.svelte +2 -2
- package/dist/bits/navigation-menu/components/navigation-menu-link.svelte +2 -2
- package/dist/bits/navigation-menu/components/navigation-menu-list.svelte +2 -2
- package/dist/bits/navigation-menu/components/navigation-menu-sub.svelte +2 -2
- package/dist/bits/navigation-menu/components/navigation-menu-trigger.svelte +2 -2
- package/dist/bits/navigation-menu/components/navigation-menu-viewport.svelte +3 -3
- package/dist/bits/navigation-menu/components/navigation-menu.svelte +2 -2
- package/dist/bits/navigation-menu/navigation-menu.svelte.d.ts +116 -109
- package/dist/bits/navigation-menu/navigation-menu.svelte.js +78 -81
- package/dist/bits/pagination/components/pagination-next-button.svelte +2 -2
- package/dist/bits/pagination/components/pagination-page.svelte +2 -2
- package/dist/bits/pagination/components/pagination-prev-button.svelte +2 -2
- package/dist/bits/pagination/components/pagination.svelte +2 -2
- package/dist/bits/pagination/pagination.svelte.d.ts +34 -32
- package/dist/bits/pagination/pagination.svelte.js +15 -15
- package/dist/bits/pin-input/components/pin-input-cell.svelte +2 -2
- package/dist/bits/pin-input/components/pin-input.svelte +2 -2
- package/dist/bits/pin-input/pin-input.svelte.d.ts +22 -21
- package/dist/bits/pin-input/pin-input.svelte.js +9 -9
- package/dist/bits/popover/components/popover-close.svelte +2 -2
- package/dist/bits/popover/components/popover-content-static.svelte +3 -3
- package/dist/bits/popover/components/popover-content.svelte +3 -3
- package/dist/bits/popover/components/popover-trigger.svelte +2 -2
- package/dist/bits/popover/components/popover.svelte +9 -3
- package/dist/bits/popover/popover.svelte.d.ts +36 -31
- package/dist/bits/popover/popover.svelte.js +26 -21
- package/dist/bits/popover/types.d.ts +4 -0
- package/dist/bits/progress/components/progress.svelte +2 -2
- package/dist/bits/progress/progress.svelte.d.ts +10 -9
- package/dist/bits/progress/progress.svelte.js +4 -4
- package/dist/bits/radio-group/components/radio-group-input.svelte +2 -2
- package/dist/bits/radio-group/components/radio-group-item.svelte +2 -2
- package/dist/bits/radio-group/components/radio-group.svelte +4 -2
- package/dist/bits/radio-group/radio-group.svelte.d.ts +26 -19
- package/dist/bits/radio-group/radio-group.svelte.js +26 -19
- package/dist/bits/radio-group/types.d.ts +13 -6
- package/dist/bits/range-calendar/components/range-calendar-cell.svelte +2 -2
- package/dist/bits/range-calendar/components/range-calendar-day.svelte +2 -2
- package/dist/bits/range-calendar/components/range-calendar.svelte +2 -2
- package/dist/bits/range-calendar/range-calendar.svelte.d.ts +21 -20
- package/dist/bits/range-calendar/range-calendar.svelte.js +12 -12
- package/dist/bits/rating-group/components/rating-group-input.svelte +2 -2
- package/dist/bits/rating-group/components/rating-group-item.svelte +2 -2
- package/dist/bits/rating-group/components/rating-group.svelte +2 -2
- package/dist/bits/rating-group/rating-group.svelte.d.ts +19 -18
- package/dist/bits/rating-group/rating-group.svelte.js +16 -17
- package/dist/bits/scroll-area/components/scroll-area-corner-impl.svelte +2 -2
- package/dist/bits/scroll-area/components/scroll-area-scrollbar-auto.svelte +3 -3
- package/dist/bits/scroll-area/components/scroll-area-scrollbar-hover.svelte +6 -6
- package/dist/bits/scroll-area/components/scroll-area-scrollbar-scroll.svelte +3 -3
- package/dist/bits/scroll-area/components/scroll-area-scrollbar-shared.svelte +2 -2
- package/dist/bits/scroll-area/components/scroll-area-scrollbar-visible.svelte +2 -2
- package/dist/bits/scroll-area/components/scroll-area-scrollbar-x.svelte +2 -2
- package/dist/bits/scroll-area/components/scroll-area-scrollbar-y.svelte +2 -2
- package/dist/bits/scroll-area/components/scroll-area-scrollbar.svelte +2 -2
- package/dist/bits/scroll-area/components/scroll-area-thumb-impl.svelte +2 -2
- package/dist/bits/scroll-area/components/scroll-area-thumb.svelte +2 -5
- package/dist/bits/scroll-area/components/scroll-area-viewport.svelte +2 -2
- package/dist/bits/scroll-area/components/scroll-area.svelte +2 -2
- package/dist/bits/scroll-area/scroll-area.svelte.d.ts +98 -78
- package/dist/bits/scroll-area/scroll-area.svelte.js +78 -74
- package/dist/bits/select/components/select-content-static.svelte +3 -3
- package/dist/bits/select/components/select-content.svelte +3 -3
- package/dist/bits/select/components/select-group-heading.svelte +2 -2
- package/dist/bits/select/components/select-group.svelte +2 -2
- package/dist/bits/select/components/select-hidden-input.svelte +2 -2
- package/dist/bits/select/components/select-item.svelte +2 -2
- package/dist/bits/select/components/select-scroll-down-button.svelte +2 -2
- package/dist/bits/select/components/select-scroll-up-button.svelte +2 -2
- package/dist/bits/select/components/select-trigger.svelte +2 -2
- package/dist/bits/select/components/select-viewport.svelte +2 -2
- package/dist/bits/select/components/select.svelte +4 -2
- package/dist/bits/select/select.svelte.d.ts +127 -113
- package/dist/bits/select/select.svelte.js +74 -62
- package/dist/bits/select/types.d.ts +4 -0
- package/dist/bits/separator/components/separator.svelte +2 -2
- package/dist/bits/separator/separator.svelte.d.ts +9 -8
- package/dist/bits/separator/separator.svelte.js +4 -4
- package/dist/bits/slider/components/slider-range.svelte +2 -2
- package/dist/bits/slider/components/slider-thumb-label.svelte +2 -2
- package/dist/bits/slider/components/slider-thumb.svelte +2 -2
- package/dist/bits/slider/components/slider-tick-label.svelte +2 -2
- package/dist/bits/slider/components/slider-tick.svelte +2 -2
- package/dist/bits/slider/components/slider.svelte +2 -2
- package/dist/bits/slider/slider.svelte.d.ts +82 -73
- package/dist/bits/slider/slider.svelte.js +30 -28
- package/dist/bits/switch/components/switch-input.svelte +2 -2
- package/dist/bits/switch/components/switch-thumb.svelte +2 -2
- package/dist/bits/switch/components/switch.svelte +2 -2
- package/dist/bits/switch/switch.svelte.d.ts +19 -17
- package/dist/bits/switch/switch.svelte.js +13 -13
- package/dist/bits/tabs/components/tabs-content.svelte +2 -2
- package/dist/bits/tabs/components/tabs-list.svelte +2 -2
- package/dist/bits/tabs/components/tabs-trigger.svelte +2 -2
- package/dist/bits/tabs/components/tabs.svelte +2 -2
- package/dist/bits/tabs/tabs.svelte.d.ts +33 -29
- package/dist/bits/tabs/tabs.svelte.js +19 -19
- package/dist/bits/time-field/components/time-field-hidden-input.svelte +2 -2
- package/dist/bits/time-field/components/time-field-input.svelte +2 -2
- package/dist/bits/time-field/components/time-field-label.svelte +2 -2
- package/dist/bits/time-field/components/time-field-segment.svelte +2 -2
- package/dist/bits/time-field/components/time-field.svelte +2 -2
- package/dist/bits/time-field/time-field.svelte.d.ts +72 -66
- package/dist/bits/time-field/time-field.svelte.js +37 -42
- package/dist/bits/time-range-field/components/time-range-field-input.svelte +2 -2
- package/dist/bits/time-range-field/components/time-range-field-label.svelte +2 -2
- package/dist/bits/time-range-field/components/time-range-field.svelte +2 -2
- package/dist/bits/time-range-field/time-range-field.svelte.d.ts +35 -31
- package/dist/bits/time-range-field/time-range-field.svelte.js +34 -32
- package/dist/bits/toggle/components/toggle.svelte +2 -2
- package/dist/bits/toggle/toggle.svelte.d.ts +11 -10
- package/dist/bits/toggle/toggle.svelte.js +4 -4
- package/dist/bits/toggle-group/components/toggle-group-item.svelte +2 -2
- package/dist/bits/toggle-group/components/toggle-group.svelte +2 -2
- package/dist/bits/toggle-group/toggle-group.svelte.d.ts +48 -43
- package/dist/bits/toggle-group/toggle-group.svelte.js +24 -25
- package/dist/bits/toolbar/components/toolbar-button.svelte +2 -2
- package/dist/bits/toolbar/components/toolbar-group-item.svelte +2 -2
- package/dist/bits/toolbar/components/toolbar-group.svelte +2 -2
- package/dist/bits/toolbar/components/toolbar-link.svelte +2 -2
- package/dist/bits/toolbar/components/toolbar.svelte +2 -2
- package/dist/bits/toolbar/toolbar.svelte.d.ts +59 -51
- package/dist/bits/toolbar/toolbar.svelte.js +32 -30
- package/dist/bits/tooltip/components/tooltip-content-static.svelte +3 -3
- package/dist/bits/tooltip/components/tooltip-content.svelte +3 -3
- package/dist/bits/tooltip/components/tooltip-provider.svelte +2 -2
- package/dist/bits/tooltip/components/tooltip-trigger.svelte +2 -2
- package/dist/bits/tooltip/components/tooltip.svelte +4 -2
- package/dist/bits/tooltip/tooltip.svelte.d.ts +33 -29
- package/dist/bits/tooltip/tooltip.svelte.js +33 -28
- package/dist/bits/tooltip/types.d.ts +4 -0
- package/dist/bits/utilities/config/bits-config.d.ts +1 -1
- package/dist/bits/utilities/dismissible-layer/dismissible-layer.svelte +2 -2
- package/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.d.ts +6 -7
- package/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.js +3 -3
- package/dist/bits/utilities/escape-layer/escape-layer.svelte +2 -2
- package/dist/bits/utilities/escape-layer/use-escape-layer.svelte.d.ts +6 -7
- package/dist/bits/utilities/escape-layer/use-escape-layer.svelte.js +3 -3
- package/dist/bits/utilities/floating-layer/components/floating-layer-anchor.svelte +2 -2
- package/dist/bits/utilities/floating-layer/components/floating-layer-arrow.svelte +2 -2
- package/dist/bits/utilities/floating-layer/components/floating-layer-content.svelte +2 -2
- package/dist/bits/utilities/floating-layer/components/floating-layer.svelte +2 -2
- package/dist/bits/utilities/floating-layer/use-floating-layer.svelte.d.ts +25 -23
- package/dist/bits/utilities/floating-layer/use-floating-layer.svelte.js +25 -25
- package/dist/bits/utilities/focus-scope/use-focus-scope.svelte.d.ts +1 -1
- package/dist/bits/utilities/focus-scope/use-focus-scope.svelte.js +1 -1
- package/dist/bits/utilities/popper-layer/popper-layer-force-mount.svelte +1 -1
- package/dist/bits/utilities/popper-layer/popper-layer-force-mount.svelte.d.ts +1 -1
- package/dist/bits/utilities/popper-layer/popper-layer-inner.svelte +1 -1
- package/dist/bits/utilities/popper-layer/popper-layer-inner.svelte.d.ts +1 -1
- package/dist/bits/utilities/popper-layer/popper-layer.svelte +3 -3
- package/dist/bits/utilities/presence-layer/presence-layer.svelte +8 -8
- package/dist/bits/utilities/presence-layer/presence.svelte.d.ts +42 -0
- package/dist/bits/utilities/presence-layer/presence.svelte.js +116 -0
- package/dist/bits/utilities/presence-layer/types.d.ts +3 -5
- package/dist/bits/utilities/scroll-lock/scroll-lock.svelte +2 -2
- package/dist/bits/utilities/text-selection-layer/text-selection-layer.svelte +2 -2
- package/dist/bits/utilities/text-selection-layer/use-text-selection-layer.svelte.d.ts +7 -7
- package/dist/bits/utilities/text-selection-layer/use-text-selection-layer.svelte.js +3 -3
- package/dist/internal/animations-complete.d.ts +12 -0
- package/dist/internal/animations-complete.js +55 -0
- package/dist/internal/arrays.js +20 -36
- package/dist/internal/attrs.d.ts +9 -2
- package/dist/internal/attrs.js +21 -11
- package/dist/internal/body-scroll-lock.svelte.d.ts +10 -0
- package/dist/internal/body-scroll-lock.svelte.js +106 -0
- package/dist/internal/data-typeahead.svelte.d.ts +15 -0
- package/dist/internal/data-typeahead.svelte.js +33 -0
- package/dist/internal/date-time/calendar-helpers.svelte.d.ts +1 -1
- package/dist/internal/dom-typeahead.svelte.d.ts +14 -0
- package/dist/internal/dom-typeahead.svelte.js +44 -0
- package/dist/internal/dom.d.ts +0 -2
- package/dist/internal/dom.js +0 -15
- package/dist/internal/{use-grace-area.svelte.d.ts → grace-area.svelte.d.ts} +5 -4
- package/dist/internal/{use-grace-area.svelte.js → grace-area.svelte.js} +60 -56
- package/dist/internal/open-change-complete.d.ts +13 -0
- package/dist/internal/open-change-complete.js +24 -0
- package/dist/internal/{use-roving-focus.svelte.d.ts → roving-focus-group.d.ts} +9 -8
- package/dist/internal/{use-roving-focus.svelte.js → roving-focus-group.js} +30 -34
- package/dist/internal/shared-state.svelte.d.ts +6 -0
- package/dist/internal/shared-state.svelte.js +31 -0
- package/dist/internal/should-trap-focus.js +1 -2
- package/dist/internal/state-machine.d.ts +16 -0
- package/dist/internal/state-machine.js +18 -0
- package/dist/internal/svelte-resize-observer.svelte.d.ts +6 -0
- package/dist/internal/svelte-resize-observer.svelte.js +25 -0
- package/dist/internal/tabbable.d.ts +0 -1
- package/dist/internal/tabbable.js +0 -11
- package/dist/internal/timeout-fn.d.ts +16 -0
- package/dist/internal/timeout-fn.js +38 -0
- package/dist/internal/types.d.ts +2 -2
- package/package.json +1 -1
- package/dist/bits/utilities/presence-layer/use-presence.svelte.d.ts +0 -4
- package/dist/bits/utilities/presence-layer/use-presence.svelte.js +0 -97
- package/dist/internal/box.svelte.d.ts +0 -21
- package/dist/internal/box.svelte.js +0 -26
- package/dist/internal/create-event-hook.svelte.d.ts +0 -18
- package/dist/internal/create-event-hook.svelte.js +0 -29
- package/dist/internal/create-shared-hook.svelte.d.ts +0 -2
- package/dist/internal/create-shared-hook.svelte.js +0 -27
- package/dist/internal/sleep.d.ts +0 -1
- package/dist/internal/sleep.js +0 -3
- package/dist/internal/use-after-animations.svelte.d.ts +0 -5
- package/dist/internal/use-after-animations.svelte.js +0 -27
- package/dist/internal/use-body-scroll-lock.svelte.d.ts +0 -6
- package/dist/internal/use-body-scroll-lock.svelte.js +0 -106
- package/dist/internal/use-data-typeahead.svelte.d.ts +0 -15
- package/dist/internal/use-data-typeahead.svelte.js +0 -34
- package/dist/internal/use-dom-typeahead.svelte.d.ts +0 -13
- package/dist/internal/use-dom-typeahead.svelte.js +0 -32
- package/dist/internal/use-form-control.svelte.d.ts +0 -4
- package/dist/internal/use-form-control.svelte.js +0 -16
- package/dist/internal/use-resize-observer.svelte.d.ts +0 -2
- package/dist/internal/use-resize-observer.svelte.js +0 -17
- package/dist/internal/use-state-machine.svelte.d.ts +0 -24
- package/dist/internal/use-state-machine.svelte.js +0 -28
- package/dist/internal/use-timeout-fn.svelte.d.ts +0 -25
- package/dist/internal/use-timeout-fn.svelte.js +0 -39
|
@@ -1,41 +1,49 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { BitsFocusEvent, BitsKeyboardEvent, BitsMouseEvent,
|
|
1
|
+
import { type ReadableBoxedValues, type WritableBoxedValues } from "svelte-toolbelt";
|
|
2
|
+
import type { BitsFocusEvent, BitsKeyboardEvent, BitsMouseEvent, WithRefOpts } from "../../internal/types.js";
|
|
3
3
|
import type { Orientation } from "../../shared/index.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { RovingFocusGroup } from "../../internal/roving-focus-group.js";
|
|
5
|
+
interface RadioGroupRootStateOpts extends WithRefOpts, ReadableBoxedValues<{
|
|
6
6
|
disabled: boolean;
|
|
7
7
|
required: boolean;
|
|
8
8
|
loop: boolean;
|
|
9
9
|
orientation: Orientation;
|
|
10
10
|
name: string | undefined;
|
|
11
|
-
|
|
11
|
+
readonly: boolean;
|
|
12
|
+
}>, WritableBoxedValues<{
|
|
12
13
|
value: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
}> {
|
|
15
|
+
}
|
|
16
|
+
export declare class RadioGroupRootState {
|
|
17
|
+
static create(opts: RadioGroupRootStateOpts): RadioGroupRootState;
|
|
18
|
+
readonly opts: RadioGroupRootStateOpts;
|
|
16
19
|
readonly hasValue: boolean;
|
|
17
|
-
rovingFocusGroup:
|
|
18
|
-
constructor(opts:
|
|
20
|
+
readonly rovingFocusGroup: RovingFocusGroup;
|
|
21
|
+
constructor(opts: RadioGroupRootStateOpts);
|
|
19
22
|
isChecked(value: string): boolean;
|
|
20
23
|
setValue(value: string): void;
|
|
21
24
|
readonly props: {
|
|
22
25
|
readonly id: string;
|
|
23
26
|
readonly role: "radiogroup";
|
|
24
27
|
readonly "aria-required": "true" | "false";
|
|
28
|
+
readonly "aria-disabled": "true" | "false";
|
|
29
|
+
readonly "aria-readonly": "true" | undefined;
|
|
25
30
|
readonly "data-disabled": "" | undefined;
|
|
31
|
+
readonly "data-readonly": "" | undefined;
|
|
26
32
|
readonly "data-orientation": Orientation;
|
|
27
33
|
};
|
|
28
34
|
}
|
|
29
|
-
|
|
35
|
+
interface RadioGroupItemStateOpts extends WithRefOpts, ReadableBoxedValues<{
|
|
30
36
|
disabled: boolean;
|
|
31
37
|
value: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
38
|
+
}> {
|
|
39
|
+
}
|
|
40
|
+
export declare class RadioGroupItemState {
|
|
34
41
|
#private;
|
|
35
|
-
|
|
42
|
+
static create(opts: RadioGroupItemStateOpts): RadioGroupItemState;
|
|
43
|
+
readonly opts: RadioGroupItemStateOpts;
|
|
36
44
|
readonly root: RadioGroupRootState;
|
|
37
45
|
readonly checked: boolean;
|
|
38
|
-
constructor(opts:
|
|
46
|
+
constructor(opts: RadioGroupItemStateOpts, root: RadioGroupRootState);
|
|
39
47
|
onclick(_: BitsMouseEvent): void;
|
|
40
48
|
onfocus(_: BitsFocusEvent): void;
|
|
41
49
|
onkeydown(e: BitsKeyboardEvent): void;
|
|
@@ -48,6 +56,7 @@ declare class RadioGroupItemState {
|
|
|
48
56
|
readonly "data-value": string;
|
|
49
57
|
readonly "data-orientation": Orientation;
|
|
50
58
|
readonly "data-disabled": "" | undefined;
|
|
59
|
+
readonly "data-readonly": "" | undefined;
|
|
51
60
|
readonly "data-state": "checked" | "unchecked";
|
|
52
61
|
readonly "aria-checked": "true" | "false" | "mixed";
|
|
53
62
|
readonly type: "button";
|
|
@@ -58,7 +67,8 @@ declare class RadioGroupItemState {
|
|
|
58
67
|
readonly onclick: (_: BitsMouseEvent) => void;
|
|
59
68
|
};
|
|
60
69
|
}
|
|
61
|
-
declare class RadioGroupInputState {
|
|
70
|
+
export declare class RadioGroupInputState {
|
|
71
|
+
static create(): RadioGroupInputState;
|
|
62
72
|
readonly root: RadioGroupRootState;
|
|
63
73
|
readonly shouldRender: boolean;
|
|
64
74
|
readonly props: {
|
|
@@ -69,7 +79,4 @@ declare class RadioGroupInputState {
|
|
|
69
79
|
};
|
|
70
80
|
constructor(root: RadioGroupRootState);
|
|
71
81
|
}
|
|
72
|
-
export declare function useRadioGroupRoot(props: RadioGroupRootStateProps): RadioGroupRootState;
|
|
73
|
-
export declare function useRadioGroupItem(props: RadioGroupItemStateProps): RadioGroupItemState;
|
|
74
|
-
export declare function useRadioGroupInput(): RadioGroupInputState;
|
|
75
82
|
export {};
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { attachRef } from "svelte-toolbelt";
|
|
2
2
|
import { Context, watch } from "runed";
|
|
3
|
-
import { createBitsAttrs, getAriaChecked, getAriaRequired, getDataDisabled, } from "../../internal/attrs.js";
|
|
4
|
-
import { useRovingFocus, } from "../../internal/use-roving-focus.svelte.js";
|
|
3
|
+
import { createBitsAttrs, getAriaChecked, getAriaRequired, getDataDisabled, getDataReadonly, getAriaDisabled, } from "../../internal/attrs.js";
|
|
5
4
|
import { kbd } from "../../internal/kbd.js";
|
|
5
|
+
import { RovingFocusGroup } from "../../internal/roving-focus-group.js";
|
|
6
6
|
const radioGroupAttrs = createBitsAttrs({
|
|
7
7
|
component: "radio-group",
|
|
8
8
|
parts: ["root", "item"],
|
|
9
9
|
});
|
|
10
|
-
|
|
10
|
+
const RadioGroupRootContext = new Context("RadioGroup.Root");
|
|
11
|
+
export class RadioGroupRootState {
|
|
12
|
+
static create(opts) {
|
|
13
|
+
return RadioGroupRootContext.set(new RadioGroupRootState(opts));
|
|
14
|
+
}
|
|
11
15
|
opts;
|
|
12
16
|
hasValue = $derived.by(() => this.opts.value.current !== "");
|
|
13
17
|
rovingFocusGroup;
|
|
14
18
|
constructor(opts) {
|
|
15
19
|
this.opts = opts;
|
|
16
|
-
this.rovingFocusGroup =
|
|
20
|
+
this.rovingFocusGroup = new RovingFocusGroup({
|
|
17
21
|
rootNode: this.opts.ref,
|
|
18
22
|
candidateAttr: radioGroupAttrs.item,
|
|
19
23
|
loop: this.opts.loop,
|
|
@@ -30,17 +34,24 @@ class RadioGroupRootState {
|
|
|
30
34
|
id: this.opts.id.current,
|
|
31
35
|
role: "radiogroup",
|
|
32
36
|
"aria-required": getAriaRequired(this.opts.required.current),
|
|
37
|
+
"aria-disabled": getAriaDisabled(this.opts.disabled.current),
|
|
38
|
+
"aria-readonly": this.opts.readonly.current ? "true" : undefined,
|
|
33
39
|
"data-disabled": getDataDisabled(this.opts.disabled.current),
|
|
40
|
+
"data-readonly": getDataReadonly(this.opts.readonly.current),
|
|
34
41
|
"data-orientation": this.opts.orientation.current,
|
|
35
42
|
[radioGroupAttrs.root]: "",
|
|
36
43
|
...attachRef(this.opts.ref),
|
|
37
44
|
}));
|
|
38
45
|
}
|
|
39
|
-
class RadioGroupItemState {
|
|
46
|
+
export class RadioGroupItemState {
|
|
47
|
+
static create(opts) {
|
|
48
|
+
return new RadioGroupItemState(opts, RadioGroupRootContext.get());
|
|
49
|
+
}
|
|
40
50
|
opts;
|
|
41
51
|
root;
|
|
42
52
|
checked = $derived.by(() => this.root.opts.value.current === this.opts.value.current);
|
|
43
53
|
#isDisabled = $derived.by(() => this.opts.disabled.current || this.root.opts.disabled.current);
|
|
54
|
+
#isReadonly = $derived.by(() => this.root.opts.readonly.current);
|
|
44
55
|
#isChecked = $derived.by(() => this.root.isChecked(this.opts.value.current));
|
|
45
56
|
#tabIndex = $state(-1);
|
|
46
57
|
constructor(opts, root) {
|
|
@@ -67,12 +78,12 @@ class RadioGroupItemState {
|
|
|
67
78
|
this.onfocus = this.onfocus.bind(this);
|
|
68
79
|
}
|
|
69
80
|
onclick(_) {
|
|
70
|
-
if (this.opts.disabled.current)
|
|
81
|
+
if (this.opts.disabled.current || this.#isReadonly)
|
|
71
82
|
return;
|
|
72
83
|
this.root.setValue(this.opts.value.current);
|
|
73
84
|
}
|
|
74
85
|
onfocus(_) {
|
|
75
|
-
if (!this.root.hasValue)
|
|
86
|
+
if (!this.root.hasValue || this.#isReadonly)
|
|
76
87
|
return;
|
|
77
88
|
this.root.setValue(this.opts.value.current);
|
|
78
89
|
}
|
|
@@ -81,7 +92,9 @@ class RadioGroupItemState {
|
|
|
81
92
|
return;
|
|
82
93
|
if (e.key === kbd.SPACE) {
|
|
83
94
|
e.preventDefault();
|
|
84
|
-
|
|
95
|
+
if (!this.#isReadonly) {
|
|
96
|
+
this.root.setValue(this.opts.value.current);
|
|
97
|
+
}
|
|
85
98
|
return;
|
|
86
99
|
}
|
|
87
100
|
this.root.rovingFocusGroup.handleKeydown(this.opts.ref.current, e, true);
|
|
@@ -93,6 +106,7 @@ class RadioGroupItemState {
|
|
|
93
106
|
"data-value": this.opts.value.current,
|
|
94
107
|
"data-orientation": this.root.opts.orientation.current,
|
|
95
108
|
"data-disabled": getDataDisabled(this.#isDisabled),
|
|
109
|
+
"data-readonly": getDataReadonly(this.#isReadonly),
|
|
96
110
|
"data-state": this.#isChecked ? "checked" : "unchecked",
|
|
97
111
|
"aria-checked": getAriaChecked(this.#isChecked, false),
|
|
98
112
|
[radioGroupAttrs.item]: "",
|
|
@@ -106,7 +120,10 @@ class RadioGroupItemState {
|
|
|
106
120
|
...attachRef(this.opts.ref),
|
|
107
121
|
}));
|
|
108
122
|
}
|
|
109
|
-
class RadioGroupInputState {
|
|
123
|
+
export class RadioGroupInputState {
|
|
124
|
+
static create() {
|
|
125
|
+
return new RadioGroupInputState(RadioGroupRootContext.get());
|
|
126
|
+
}
|
|
110
127
|
root;
|
|
111
128
|
shouldRender = $derived.by(() => this.root.opts.name.current !== undefined);
|
|
112
129
|
props = $derived.by(() => ({
|
|
@@ -119,13 +136,3 @@ class RadioGroupInputState {
|
|
|
119
136
|
this.root = root;
|
|
120
137
|
}
|
|
121
138
|
}
|
|
122
|
-
const RadioGroupRootContext = new Context("RadioGroup.Root");
|
|
123
|
-
export function useRadioGroupRoot(props) {
|
|
124
|
-
return RadioGroupRootContext.set(new RadioGroupRootState(props));
|
|
125
|
-
}
|
|
126
|
-
export function useRadioGroupItem(props) {
|
|
127
|
-
return new RadioGroupItemState(props, RadioGroupRootContext.get());
|
|
128
|
-
}
|
|
129
|
-
export function useRadioGroupInput() {
|
|
130
|
-
return new RadioGroupInputState(RadioGroupRootContext.get());
|
|
131
|
-
}
|
|
@@ -6,20 +6,20 @@ export type RadioGroupRootPropsWithoutHTML = WithChild<{
|
|
|
6
6
|
* The orientation of the radio group. Used to determine
|
|
7
7
|
* how keyboard navigation should work.
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
9
|
+
* @default "vertical"
|
|
10
10
|
*/
|
|
11
11
|
orientation?: Orientation;
|
|
12
12
|
/**
|
|
13
13
|
* Whether to loop around the radio items when navigating
|
|
14
14
|
* with the keyboard.
|
|
15
15
|
*
|
|
16
|
-
* @
|
|
16
|
+
* @default true
|
|
17
17
|
*/
|
|
18
18
|
loop?: boolean;
|
|
19
19
|
/**
|
|
20
20
|
* The value of the selected radio item.
|
|
21
21
|
*
|
|
22
|
-
* @
|
|
22
|
+
* @default ""
|
|
23
23
|
*/
|
|
24
24
|
value?: string;
|
|
25
25
|
/**
|
|
@@ -31,13 +31,13 @@ export type RadioGroupRootPropsWithoutHTML = WithChild<{
|
|
|
31
31
|
* form submission. If not provided, a hidden input will not
|
|
32
32
|
* be rendered and the radio group will not be part of a form.
|
|
33
33
|
*
|
|
34
|
-
* @
|
|
34
|
+
* @default undefined
|
|
35
35
|
*/
|
|
36
36
|
name?: string;
|
|
37
37
|
/**
|
|
38
38
|
* Whether the radio group is disabled.
|
|
39
39
|
*
|
|
40
|
-
* @
|
|
40
|
+
* @default false
|
|
41
41
|
*/
|
|
42
42
|
disabled?: boolean;
|
|
43
43
|
/**
|
|
@@ -46,6 +46,13 @@ export type RadioGroupRootPropsWithoutHTML = WithChild<{
|
|
|
46
46
|
* input is rendered.
|
|
47
47
|
*/
|
|
48
48
|
required?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the radio group is readonly. When readonly, users can
|
|
51
|
+
* focus and navigate through items but cannot change the value.
|
|
52
|
+
*
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
readonly?: boolean;
|
|
49
56
|
}>;
|
|
50
57
|
export type RadioGroupRootProps = RadioGroupRootPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, RadioGroupRootPropsWithoutHTML>;
|
|
51
58
|
export type RadioGroupItemSnippetProps = {
|
|
@@ -59,7 +66,7 @@ export type RadioGroupItemPropsWithoutHTML = WithChild<{
|
|
|
59
66
|
/**
|
|
60
67
|
* Whether the radio item is disabled.
|
|
61
68
|
*
|
|
62
|
-
* @
|
|
69
|
+
* @default false
|
|
63
70
|
*/
|
|
64
71
|
disabled?: boolean | null | undefined;
|
|
65
72
|
}, RadioGroupItemSnippetProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { RangeCalendarCellProps } from "../types.js";
|
|
4
|
-
import {
|
|
4
|
+
import { RangeCalendarCellState } from "../range-calendar.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
6
6
|
|
|
7
7
|
const uid = $props.id();
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
...restProps
|
|
17
17
|
}: RangeCalendarCellProps = $props();
|
|
18
18
|
|
|
19
|
-
const cellState =
|
|
19
|
+
const cellState = RangeCalendarCellState.create({
|
|
20
20
|
id: box.with(() => id),
|
|
21
21
|
ref: box.with(
|
|
22
22
|
() => ref,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { RangeCalendarDayProps } from "../types.js";
|
|
4
|
-
import {
|
|
4
|
+
import { RangeCalendarDayState } from "../range-calendar.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
6
6
|
|
|
7
7
|
const uid = $props.id();
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
...restProps
|
|
15
15
|
}: RangeCalendarDayProps = $props();
|
|
16
16
|
|
|
17
|
-
const dayState =
|
|
17
|
+
const dayState = RangeCalendarDayState.create({
|
|
18
18
|
id: box.with(() => id),
|
|
19
19
|
ref: box.with(
|
|
20
20
|
() => ref,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
4
4
|
import { type DateValue } from "@internationalized/date";
|
|
5
5
|
import type { RangeCalendarRootProps } from "../types.js";
|
|
6
|
-
import {
|
|
6
|
+
import { RangeCalendarRootState } from "../range-calendar.svelte.js";
|
|
7
7
|
import { noop } from "../../../internal/noop.js";
|
|
8
8
|
import { createId } from "../../../internal/create-id.js";
|
|
9
9
|
import { getDefaultDate } from "../../../internal/date-time/utils.js";
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
}
|
|
83
83
|
);
|
|
84
84
|
|
|
85
|
-
const rootState =
|
|
85
|
+
const rootState = RangeCalendarRootState.create({
|
|
86
86
|
id: box.with(() => id),
|
|
87
87
|
ref: box.with(
|
|
88
88
|
() => ref,
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { type DateValue } from "@internationalized/date";
|
|
2
|
-
import { DOMContext } from "svelte-toolbelt";
|
|
2
|
+
import { DOMContext, type ReadableBoxedValues, type WritableBoxedValues } from "svelte-toolbelt";
|
|
3
3
|
import type { DateRange, Month } from "../../shared/index.js";
|
|
4
|
-
import type {
|
|
5
|
-
import type { BitsFocusEvent, BitsKeyboardEvent, BitsMouseEvent, WithRefProps } from "../../internal/types.js";
|
|
4
|
+
import type { BitsFocusEvent, BitsKeyboardEvent, BitsMouseEvent, WithRefOpts } from "../../internal/types.js";
|
|
6
5
|
import { type Announcer } from "../../internal/date-time/announcer.js";
|
|
7
6
|
import { type Formatter } from "../../internal/date-time/formatter.js";
|
|
8
7
|
import { calendarAttrs } from "../../internal/date-time/calendar-helpers.svelte.js";
|
|
9
8
|
import type { WeekStartsOn } from "../../shared/date/types.js";
|
|
10
|
-
|
|
9
|
+
interface RangeCalendarRootStateOpts extends WithRefOpts, WritableBoxedValues<{
|
|
11
10
|
value: DateRange;
|
|
12
11
|
placeholder: DateValue;
|
|
13
12
|
startValue: DateValue | undefined;
|
|
14
13
|
endValue: DateValue | undefined;
|
|
15
|
-
}
|
|
14
|
+
}>, ReadableBoxedValues<{
|
|
16
15
|
preventDeselect: boolean;
|
|
17
16
|
minValue: DateValue | undefined;
|
|
18
17
|
maxValue: DateValue | undefined;
|
|
@@ -38,12 +37,13 @@ type RangeCalendarRootStateProps = WithRefProps<WritableBoxedValues<{
|
|
|
38
37
|
onRangeSelect?: () => void;
|
|
39
38
|
monthFormat: Intl.DateTimeFormatOptions["month"] | ((month: number) => string);
|
|
40
39
|
yearFormat: Intl.DateTimeFormatOptions["year"] | ((year: number) => string);
|
|
41
|
-
}>
|
|
40
|
+
}> {
|
|
42
41
|
defaultPlaceholder: DateValue;
|
|
43
|
-
}
|
|
42
|
+
}
|
|
44
43
|
export declare class RangeCalendarRootState {
|
|
45
44
|
#private;
|
|
46
|
-
|
|
45
|
+
static create(opts: RangeCalendarRootStateOpts): RangeCalendarRootState | import("../calendar/calendar.svelte.js").CalendarRootState;
|
|
46
|
+
readonly opts: RangeCalendarRootStateOpts;
|
|
47
47
|
readonly visibleMonths: DateValue[];
|
|
48
48
|
months: Month<DateValue>[];
|
|
49
49
|
announcer: Announcer;
|
|
@@ -73,7 +73,7 @@ export declare class RangeCalendarRootState {
|
|
|
73
73
|
} | null;
|
|
74
74
|
readonly initialPlaceholderYear: number;
|
|
75
75
|
readonly defaultYears: number[];
|
|
76
|
-
constructor(opts:
|
|
76
|
+
constructor(opts: RangeCalendarRootStateOpts);
|
|
77
77
|
setMonths: (months: Month<DateValue>[]) => void;
|
|
78
78
|
isOutsideVisibleMonths(date: DateValue): boolean;
|
|
79
79
|
isDateDisabled(date: DateValue): boolean;
|
|
@@ -111,12 +111,14 @@ export declare class RangeCalendarRootState {
|
|
|
111
111
|
readonly "data-readonly": "" | undefined;
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
interface RangeCalendarCellStateOpts extends WithRefOpts, ReadableBoxedValues<{
|
|
115
115
|
date: DateValue;
|
|
116
116
|
month: DateValue;
|
|
117
|
-
}
|
|
117
|
+
}> {
|
|
118
|
+
}
|
|
118
119
|
export declare class RangeCalendarCellState {
|
|
119
|
-
|
|
120
|
+
static create(opts: RangeCalendarCellStateOpts): RangeCalendarCellState;
|
|
121
|
+
readonly opts: RangeCalendarCellStateOpts;
|
|
120
122
|
readonly root: RangeCalendarRootState;
|
|
121
123
|
readonly cellDate: Date;
|
|
122
124
|
readonly isDisabled: boolean;
|
|
@@ -134,7 +136,7 @@ export declare class RangeCalendarCellState {
|
|
|
134
136
|
readonly isSelectionEnd: boolean;
|
|
135
137
|
readonly isHighlighted: boolean;
|
|
136
138
|
readonly labelText: string;
|
|
137
|
-
constructor(opts:
|
|
139
|
+
constructor(opts: RangeCalendarCellStateOpts, root: RangeCalendarRootState);
|
|
138
140
|
readonly snippetProps: {
|
|
139
141
|
disabled: boolean;
|
|
140
142
|
unavailable: boolean;
|
|
@@ -180,12 +182,14 @@ export declare class RangeCalendarCellState {
|
|
|
180
182
|
readonly "aria-disabled": "true" | "false";
|
|
181
183
|
};
|
|
182
184
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
interface RangeCalendarDayStateOpts extends WithRefOpts {
|
|
186
|
+
}
|
|
187
|
+
export declare class RangeCalendarDayState {
|
|
185
188
|
#private;
|
|
186
|
-
|
|
189
|
+
static create(opts: RangeCalendarDayStateOpts): RangeCalendarDayState;
|
|
190
|
+
readonly opts: RangeCalendarDayStateOpts;
|
|
187
191
|
readonly cell: RangeCalendarCellState;
|
|
188
|
-
constructor(opts:
|
|
192
|
+
constructor(opts: RangeCalendarDayStateOpts, cell: RangeCalendarCellState);
|
|
189
193
|
onclick(e: BitsMouseEvent): void;
|
|
190
194
|
onmouseenter(_: BitsMouseEvent): void;
|
|
191
195
|
onfocusin(_: BitsFocusEvent): void;
|
|
@@ -222,7 +226,4 @@ declare class RangeCalendarDayState {
|
|
|
222
226
|
readonly "aria-disabled": "true" | "false";
|
|
223
227
|
};
|
|
224
228
|
}
|
|
225
|
-
export declare function useRangeCalendarRoot(props: RangeCalendarRootStateProps): RangeCalendarRootState | import("../calendar/calendar.svelte.js").CalendarRootState;
|
|
226
|
-
export declare function useRangeCalendarCell(props: RangeCalendarCellStateProps): RangeCalendarCellState;
|
|
227
|
-
export declare function useRangeCalendarDay(props: RangeCalendarDayStateProps): RangeCalendarDayState;
|
|
228
229
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getLocalTimeZone, isSameDay, isSameMonth, isToday, } from "@internationalized/date";
|
|
2
|
-
import { attachRef, DOMContext } from "svelte-toolbelt";
|
|
2
|
+
import { attachRef, DOMContext, } from "svelte-toolbelt";
|
|
3
3
|
import { Context, watch } from "runed";
|
|
4
4
|
import { CalendarRootContext } from "../calendar/calendar.svelte.js";
|
|
5
5
|
import { useId } from "../../internal/use-id.js";
|
|
@@ -9,7 +9,11 @@ import { createFormatter } from "../../internal/date-time/formatter.js";
|
|
|
9
9
|
import { calendarAttrs, createMonths, getCalendarElementProps, getCalendarHeadingValue, getDefaultYears, getIsNextButtonDisabled, getIsPrevButtonDisabled, getWeekdays, handleCalendarKeydown, handleCalendarNextPage, handleCalendarPrevPage, shiftCalendarFocus, useEnsureNonDisabledPlaceholder, useMonthViewOptionsSync, useMonthViewPlaceholderSync, } from "../../internal/date-time/calendar-helpers.svelte.js";
|
|
10
10
|
import { areAllDaysBetweenValid, getDateValueType, isAfter, isBefore, isBetweenInclusive, toDate, } from "../../internal/date-time/utils.js";
|
|
11
11
|
import { onMount, untrack } from "svelte";
|
|
12
|
+
const RangeCalendarCellContext = new Context("RangeCalendar.Cell");
|
|
12
13
|
export class RangeCalendarRootState {
|
|
14
|
+
static create(opts) {
|
|
15
|
+
return CalendarRootContext.set(new RangeCalendarRootState(opts));
|
|
16
|
+
}
|
|
13
17
|
opts;
|
|
14
18
|
visibleMonths = $derived.by(() => this.months.map((month) => month.value));
|
|
15
19
|
months = $state([]);
|
|
@@ -526,6 +530,9 @@ export class RangeCalendarRootState {
|
|
|
526
530
|
}
|
|
527
531
|
}
|
|
528
532
|
export class RangeCalendarCellState {
|
|
533
|
+
static create(opts) {
|
|
534
|
+
return RangeCalendarCellContext.set(new RangeCalendarCellState(opts, CalendarRootContext.get()));
|
|
535
|
+
}
|
|
529
536
|
opts;
|
|
530
537
|
root;
|
|
531
538
|
cellDate = $derived.by(() => toDate(this.opts.date.current));
|
|
@@ -599,7 +606,10 @@ export class RangeCalendarCellState {
|
|
|
599
606
|
...attachRef(this.opts.ref),
|
|
600
607
|
}));
|
|
601
608
|
}
|
|
602
|
-
class RangeCalendarDayState {
|
|
609
|
+
export class RangeCalendarDayState {
|
|
610
|
+
static create(opts) {
|
|
611
|
+
return new RangeCalendarDayState(opts, RangeCalendarCellContext.get());
|
|
612
|
+
}
|
|
603
613
|
opts;
|
|
604
614
|
cell;
|
|
605
615
|
constructor(opts, cell) {
|
|
@@ -653,13 +663,3 @@ class RangeCalendarDayState {
|
|
|
653
663
|
...attachRef(this.opts.ref),
|
|
654
664
|
}));
|
|
655
665
|
}
|
|
656
|
-
const RangeCalendarCellContext = new Context("RangeCalendar.Cell");
|
|
657
|
-
export function useRangeCalendarRoot(props) {
|
|
658
|
-
return CalendarRootContext.set(new RangeCalendarRootState(props));
|
|
659
|
-
}
|
|
660
|
-
export function useRangeCalendarCell(props) {
|
|
661
|
-
return RangeCalendarCellContext.set(new RangeCalendarCellState(props, CalendarRootContext.get()));
|
|
662
|
-
}
|
|
663
|
-
export function useRangeCalendarDay(props) {
|
|
664
|
-
return new RangeCalendarDayState(props, RangeCalendarCellContext.get());
|
|
665
|
-
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { RatingGroupHiddenInputState } from "../rating-group.svelte.js";
|
|
3
3
|
import HiddenInput from "../../utilities/hidden-input.svelte";
|
|
4
4
|
|
|
5
|
-
const inputState =
|
|
5
|
+
const inputState = RatingGroupHiddenInputState.create();
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
{#if inputState.shouldRender}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { RatingGroupItemProps } from "../types.js";
|
|
4
|
-
import {
|
|
4
|
+
import { RatingGroupItemState } from "../rating-group.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
6
6
|
|
|
7
7
|
const uid = $props.id();
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
...restProps
|
|
17
17
|
}: RatingGroupItemProps = $props();
|
|
18
18
|
|
|
19
|
-
const itemState =
|
|
19
|
+
const itemState = RatingGroupItemState.create({
|
|
20
20
|
disabled: box.with(() => Boolean(disabled)),
|
|
21
21
|
index: box.with(() => index),
|
|
22
22
|
id: box.with(() => id),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { RatingGroupRootProps } from "../types.js";
|
|
4
|
-
import {
|
|
4
|
+
import { RatingGroupRootState } from "../rating-group.svelte.js";
|
|
5
5
|
import RatingGroupInput from "./rating-group-input.svelte";
|
|
6
6
|
import { createId } from "../../../internal/create-id.js";
|
|
7
7
|
import { noop } from "../../../internal/noop.js";
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
return (value: number, max: number) => `${value} out of ${max}`;
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
const rootState =
|
|
41
|
+
const rootState = RatingGroupRootState.create({
|
|
42
42
|
orientation: box.with(() => orientation),
|
|
43
43
|
disabled: box.with(() => disabled),
|
|
44
44
|
name: box.with(() => name),
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { DOMContext } from "svelte-toolbelt";
|
|
2
|
-
import type {
|
|
3
|
-
import type { BitsKeyboardEvent, BitsMouseEvent, BitsPointerEvent, WithRefProps } from "../../internal/types.js";
|
|
1
|
+
import { DOMContext, type ReadableBoxedValues, type WritableBoxedValues } from "svelte-toolbelt";
|
|
2
|
+
import type { BitsKeyboardEvent, BitsMouseEvent, BitsPointerEvent, WithRefOpts } from "../../internal/types.js";
|
|
4
3
|
import type { RatingGroupAriaValuetext, RatingGroupItemState as RatingGroupItemStateType } from "./types.js";
|
|
5
4
|
import type { Orientation } from "../../shared/index.js";
|
|
6
|
-
|
|
5
|
+
interface RatingGroupRootStateOpts extends WithRefOpts, ReadableBoxedValues<{
|
|
7
6
|
disabled: boolean;
|
|
8
7
|
required: boolean;
|
|
9
8
|
orientation: Orientation;
|
|
@@ -14,12 +13,14 @@ type RatingGroupRootStateProps = WithRefProps<ReadableBoxedValues<{
|
|
|
14
13
|
readonly: boolean;
|
|
15
14
|
hoverPreview: boolean;
|
|
16
15
|
ariaValuetext: NonNullable<RatingGroupAriaValuetext>;
|
|
17
|
-
}
|
|
16
|
+
}>, WritableBoxedValues<{
|
|
18
17
|
value: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
18
|
+
}> {
|
|
19
|
+
}
|
|
20
|
+
export declare class RatingGroupRootState {
|
|
21
21
|
#private;
|
|
22
|
-
|
|
22
|
+
static create(opts: RatingGroupRootStateOpts): RatingGroupRootState;
|
|
23
|
+
readonly opts: RatingGroupRootStateOpts;
|
|
23
24
|
domContext: DOMContext;
|
|
24
25
|
readonly hasValue: boolean;
|
|
25
26
|
readonly valueToUse: number;
|
|
@@ -29,7 +30,7 @@ declare class RatingGroupRootState {
|
|
|
29
30
|
index: number;
|
|
30
31
|
state: RatingGroupItemStateType;
|
|
31
32
|
}[];
|
|
32
|
-
constructor(opts:
|
|
33
|
+
constructor(opts: RatingGroupRootStateOpts);
|
|
33
34
|
isActive(itemIndex: number): boolean;
|
|
34
35
|
isPartial(itemIndex: number): boolean;
|
|
35
36
|
setHoverValue(value: number | null): void;
|
|
@@ -69,15 +70,17 @@ declare class RatingGroupRootState {
|
|
|
69
70
|
readonly onpointerleave: () => void;
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
interface RatingGroupItemStateOpts extends WithRefOpts, ReadableBoxedValues<{
|
|
73
74
|
disabled: boolean;
|
|
74
75
|
index: number;
|
|
75
|
-
}
|
|
76
|
-
|
|
76
|
+
}> {
|
|
77
|
+
}
|
|
78
|
+
export declare class RatingGroupItemState {
|
|
77
79
|
#private;
|
|
78
|
-
|
|
80
|
+
static create(opts: RatingGroupItemStateOpts): RatingGroupItemState;
|
|
81
|
+
readonly opts: RatingGroupItemStateOpts;
|
|
79
82
|
readonly root: RatingGroupRootState;
|
|
80
|
-
constructor(opts:
|
|
83
|
+
constructor(opts: RatingGroupItemStateOpts, root: RatingGroupRootState);
|
|
81
84
|
onclick(e: BitsMouseEvent): void;
|
|
82
85
|
onpointermove(e: BitsPointerEvent): void;
|
|
83
86
|
readonly snippetProps: {
|
|
@@ -95,7 +98,8 @@ declare class RatingGroupItemState {
|
|
|
95
98
|
readonly onpointermove: (e: BitsPointerEvent) => void;
|
|
96
99
|
};
|
|
97
100
|
}
|
|
98
|
-
declare class RatingGroupHiddenInputState {
|
|
101
|
+
export declare class RatingGroupHiddenInputState {
|
|
102
|
+
static create(): RatingGroupHiddenInputState;
|
|
99
103
|
readonly root: RatingGroupRootState;
|
|
100
104
|
readonly shouldRender: boolean;
|
|
101
105
|
readonly props: {
|
|
@@ -106,7 +110,4 @@ declare class RatingGroupHiddenInputState {
|
|
|
106
110
|
};
|
|
107
111
|
constructor(root: RatingGroupRootState);
|
|
108
112
|
}
|
|
109
|
-
export declare function useRatingGroupRoot(props: RatingGroupRootStateProps): RatingGroupRootState;
|
|
110
|
-
export declare function useRatingGroupItem(props: RatingGroupItemStateProps): RatingGroupItemState;
|
|
111
|
-
export declare function useRatingGroupHiddenInput(): RatingGroupHiddenInputState;
|
|
112
113
|
export {};
|