bits-ui 1.8.0 → 2.2.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/dist/bits/accordion/accordion.svelte.d.ts +56 -53
- package/dist/bits/accordion/accordion.svelte.js +78 -89
- package/dist/bits/accordion/components/accordion-content.svelte +5 -3
- package/dist/bits/accordion/components/accordion-header.svelte +4 -2
- package/dist/bits/accordion/components/accordion-item.svelte +6 -3
- package/dist/bits/accordion/components/accordion-trigger.svelte +4 -2
- package/dist/bits/accordion/components/accordion.svelte +4 -2
- package/dist/bits/alert-dialog/components/alert-dialog-action.svelte +4 -2
- package/dist/bits/alert-dialog/components/alert-dialog-cancel.svelte +4 -2
- package/dist/bits/alert-dialog/components/alert-dialog-content.svelte +8 -3
- package/dist/bits/aspect-ratio/aspect-ratio.svelte.js +2 -2
- package/dist/bits/aspect-ratio/components/aspect-ratio.svelte +4 -2
- package/dist/bits/avatar/avatar.svelte.d.ts +2 -1
- package/dist/bits/avatar/avatar.svelte.js +8 -6
- package/dist/bits/avatar/components/avatar-fallback.svelte +4 -2
- package/dist/bits/avatar/components/avatar-image.svelte +4 -2
- package/dist/bits/avatar/components/avatar.svelte +4 -2
- package/dist/bits/button/components/button.svelte +1 -1
- package/dist/bits/calendar/calendar.svelte.d.ts +3 -9
- package/dist/bits/calendar/calendar.svelte.js +55 -41
- package/dist/bits/calendar/components/calendar-cell.svelte +4 -2
- package/dist/bits/calendar/components/calendar-day.svelte +4 -2
- package/dist/bits/calendar/components/calendar-grid-body.svelte +4 -2
- package/dist/bits/calendar/components/calendar-grid-head.svelte +4 -2
- package/dist/bits/calendar/components/calendar-grid-row.svelte +4 -2
- package/dist/bits/calendar/components/calendar-grid.svelte +4 -2
- package/dist/bits/calendar/components/calendar-head-cell.svelte +4 -2
- package/dist/bits/calendar/components/calendar-header.svelte +4 -2
- package/dist/bits/calendar/components/calendar-heading.svelte +4 -2
- package/dist/bits/calendar/components/calendar-next-button.svelte +4 -2
- package/dist/bits/calendar/components/calendar-prev-button.svelte +4 -2
- package/dist/bits/checkbox/checkbox.svelte.js +4 -14
- package/dist/bits/checkbox/components/checkbox-group-label.svelte +4 -2
- package/dist/bits/checkbox/components/checkbox-group.svelte +4 -2
- package/dist/bits/checkbox/components/checkbox.svelte +4 -2
- package/dist/bits/collapsible/collapsible.svelte.js +4 -10
- package/dist/bits/collapsible/components/collapsible-content.svelte +5 -3
- package/dist/bits/collapsible/components/collapsible-trigger.svelte +4 -2
- package/dist/bits/collapsible/components/collapsible.svelte +4 -2
- package/dist/bits/combobox/components/combobox-input.svelte +3 -3
- package/dist/bits/combobox/components/combobox.svelte +6 -1
- package/dist/bits/combobox/types.d.ts +18 -1
- package/dist/bits/command/command.svelte.js +13 -45
- package/dist/bits/command/components/_command-label.svelte +6 -7
- package/dist/bits/command/components/_command-label.svelte.d.ts +1 -1
- package/dist/bits/command/components/command-empty.svelte +4 -2
- package/dist/bits/command/components/command-group-heading.svelte +4 -2
- package/dist/bits/command/components/command-group-items.svelte +4 -2
- package/dist/bits/command/components/command-group.svelte +4 -2
- package/dist/bits/command/components/command-input.svelte +4 -2
- package/dist/bits/command/components/command-item.svelte +4 -2
- package/dist/bits/command/components/command-link-item.svelte +4 -2
- package/dist/bits/command/components/command-list.svelte +4 -2
- package/dist/bits/command/components/command-loading.svelte +4 -2
- package/dist/bits/command/components/command-separator.svelte +4 -2
- package/dist/bits/command/components/command-viewport.svelte +4 -2
- package/dist/bits/command/components/command.svelte +4 -2
- package/dist/bits/context-menu/components/context-menu-content-static.svelte +2 -3
- package/dist/bits/context-menu/components/context-menu-content.svelte +2 -3
- package/dist/bits/context-menu/components/context-menu-trigger.svelte +1 -1
- package/dist/bits/date-field/components/date-field-input.svelte +4 -2
- package/dist/bits/date-field/components/date-field-label.svelte +4 -2
- package/dist/bits/date-field/components/date-field-segment.svelte +4 -2
- package/dist/bits/date-field/date-field.svelte.d.ts +7 -5
- package/dist/bits/date-field/date-field.svelte.js +29 -38
- package/dist/bits/date-picker/components/date-picker-calendar.svelte +4 -2
- package/dist/bits/date-range-field/components/date-range-field-input.svelte +4 -2
- package/dist/bits/date-range-field/components/date-range-field-label.svelte +4 -2
- package/dist/bits/date-range-field/components/date-range-field.svelte +4 -2
- package/dist/bits/date-range-field/date-range-field.svelte.d.ts +2 -0
- package/dist/bits/date-range-field/date-range-field.svelte.js +6 -14
- package/dist/bits/date-range-picker/components/date-range-picker-calendar.svelte +4 -2
- package/dist/bits/dialog/components/dialog-close.svelte +4 -2
- package/dist/bits/dialog/components/dialog-content.svelte +8 -2
- package/dist/bits/dialog/components/dialog-description.svelte +4 -2
- package/dist/bits/dialog/components/dialog-overlay.svelte +8 -3
- package/dist/bits/dialog/components/dialog-title.svelte +4 -2
- package/dist/bits/dialog/components/dialog-trigger.svelte +4 -2
- package/dist/bits/dialog/dialog.svelte.d.ts +1 -1
- package/dist/bits/dialog/dialog.svelte.js +19 -47
- package/dist/bits/dropdown-menu/components/dropdown-menu-content-static.svelte +6 -5
- package/dist/bits/dropdown-menu/components/dropdown-menu-content.svelte +6 -5
- package/dist/bits/index.d.ts +2 -0
- package/dist/bits/index.js +2 -0
- package/dist/bits/label/components/label.svelte +4 -2
- package/dist/bits/label/label.svelte.js +2 -2
- package/dist/bits/link-preview/components/link-preview-content-static.svelte +6 -2
- package/dist/bits/link-preview/components/link-preview-content.svelte +6 -2
- package/dist/bits/link-preview/components/link-preview-trigger.svelte +5 -3
- package/dist/bits/link-preview/link-preview.svelte.d.ts +2 -0
- package/dist/bits/link-preview/link-preview.svelte.js +13 -19
- package/dist/bits/menu/components/menu-checkbox-group.svelte +4 -2
- package/dist/bits/menu/components/menu-checkbox-item.svelte +6 -4
- package/dist/bits/menu/components/menu-content-static.svelte +6 -5
- package/dist/bits/menu/components/menu-content.svelte +6 -5
- package/dist/bits/menu/components/menu-group-heading.svelte +4 -2
- package/dist/bits/menu/components/menu-group.svelte +4 -2
- package/dist/bits/menu/components/menu-item.svelte +4 -2
- package/dist/bits/menu/components/menu-radio-group.svelte +4 -2
- package/dist/bits/menu/components/menu-radio-item.svelte +4 -2
- package/dist/bits/menu/components/menu-separator.svelte +4 -2
- package/dist/bits/menu/components/menu-sub-content-static.svelte +6 -5
- package/dist/bits/menu/components/menu-sub-content.svelte +6 -5
- package/dist/bits/menu/components/menu-sub-trigger.svelte +6 -3
- package/dist/bits/menu/components/menu-trigger.svelte +5 -3
- package/dist/bits/menu/menu.svelte.d.ts +9 -20
- package/dist/bits/menu/menu.svelte.js +40 -63
- package/dist/bits/menubar/components/menubar-content-static.svelte +4 -2
- package/dist/bits/menubar/components/menubar-content.svelte +4 -2
- package/dist/bits/menubar/components/menubar-menu.svelte +4 -2
- package/dist/bits/menubar/components/menubar-trigger.svelte +14 -6
- package/dist/bits/menubar/components/menubar.svelte +4 -2
- package/dist/bits/menubar/menubar.svelte.d.ts +24 -20
- package/dist/bits/menubar/menubar.svelte.js +40 -56
- package/dist/bits/meter/components/meter.svelte +4 -2
- package/dist/bits/meter/meter.svelte.js +2 -2
- package/dist/bits/navigation-menu/components/navigation-menu-content-impl.svelte +5 -2
- package/dist/bits/navigation-menu/components/navigation-menu-content.svelte +8 -3
- package/dist/bits/navigation-menu/components/navigation-menu-indicator-impl.svelte +4 -2
- package/dist/bits/navigation-menu/components/navigation-menu-indicator.svelte +6 -4
- package/dist/bits/navigation-menu/components/navigation-menu-item.svelte +6 -3
- package/dist/bits/navigation-menu/components/navigation-menu-link.svelte +4 -2
- package/dist/bits/navigation-menu/components/navigation-menu-list.svelte +4 -2
- package/dist/bits/navigation-menu/components/navigation-menu-sub.svelte +4 -2
- package/dist/bits/navigation-menu/components/navigation-menu-trigger.svelte +4 -2
- package/dist/bits/navigation-menu/components/navigation-menu-viewport.svelte +5 -3
- package/dist/bits/navigation-menu/components/navigation-menu.svelte +4 -2
- package/dist/bits/navigation-menu/navigation-menu.svelte.d.ts +3 -1
- package/dist/bits/navigation-menu/navigation-menu.svelte.js +33 -60
- package/dist/bits/pagination/components/pagination-next-button.svelte +4 -2
- package/dist/bits/pagination/components/pagination-page.svelte +4 -2
- package/dist/bits/pagination/components/pagination-prev-button.svelte +4 -2
- package/dist/bits/pagination/components/pagination.svelte +4 -2
- package/dist/bits/pagination/pagination.svelte.js +4 -4
- package/dist/bits/pin-input/components/pin-input-cell.svelte +4 -2
- package/dist/bits/pin-input/components/pin-input.svelte +5 -3
- package/dist/bits/pin-input/pin-input.svelte.d.ts +4 -2
- package/dist/bits/pin-input/pin-input.svelte.js +20 -22
- package/dist/bits/pin-input/usePasswordManager.svelte.d.ts +3 -2
- package/dist/bits/pin-input/usePasswordManager.svelte.js +6 -5
- package/dist/bits/popover/components/popover-close.svelte +4 -2
- package/dist/bits/popover/components/popover-content-static.svelte +6 -2
- package/dist/bits/popover/components/popover-content.svelte +6 -2
- package/dist/bits/popover/components/popover-trigger.svelte +5 -3
- package/dist/bits/popover/popover.svelte.js +4 -18
- package/dist/bits/progress/components/progress.svelte +4 -2
- package/dist/bits/progress/progress.svelte.js +2 -2
- package/dist/bits/radio-group/components/radio-group-item.svelte +4 -2
- package/dist/bits/radio-group/components/radio-group.svelte +4 -2
- package/dist/bits/radio-group/radio-group.svelte.js +4 -7
- package/dist/bits/range-calendar/components/range-calendar-cell.svelte +4 -2
- package/dist/bits/range-calendar/components/range-calendar-day.svelte +4 -2
- package/dist/bits/range-calendar/components/range-calendar.svelte +4 -2
- package/dist/bits/range-calendar/range-calendar.svelte.d.ts +2 -0
- package/dist/bits/range-calendar/range-calendar.svelte.js +12 -6
- package/dist/bits/scroll-area/components/scroll-area-corner.svelte +8 -2
- package/dist/bits/scroll-area/components/scroll-area-scrollbar-auto.svelte +4 -1
- package/dist/bits/scroll-area/components/scroll-area-scrollbar-hover.svelte +1 -1
- package/dist/bits/scroll-area/components/scroll-area-scrollbar-scroll.svelte +5 -1
- package/dist/bits/scroll-area/components/scroll-area-scrollbar.svelte +4 -2
- package/dist/bits/scroll-area/components/scroll-area-thumb.svelte +8 -3
- package/dist/bits/scroll-area/components/scroll-area-viewport.svelte +4 -2
- package/dist/bits/scroll-area/components/scroll-area.svelte +4 -2
- package/dist/bits/scroll-area/scroll-area.svelte.d.ts +2 -0
- package/dist/bits/scroll-area/scroll-area.svelte.js +27 -58
- package/dist/bits/select/components/select-content-static.svelte +6 -2
- package/dist/bits/select/components/select-content.svelte +6 -2
- package/dist/bits/select/components/select-group-heading.svelte +3 -2
- package/dist/bits/select/components/select-group.svelte +4 -2
- package/dist/bits/select/components/select-item.svelte +4 -2
- package/dist/bits/select/components/select-scroll-down-button.svelte +4 -2
- package/dist/bits/select/components/select-scroll-up-button.svelte +4 -2
- package/dist/bits/select/components/select-trigger.svelte +5 -3
- package/dist/bits/select/components/select-viewport.svelte +4 -2
- package/dist/bits/select/components/select.svelte +7 -1
- package/dist/bits/select/select.svelte.d.ts +5 -19
- package/dist/bits/select/select.svelte.js +43 -60
- package/dist/bits/separator/components/separator.svelte +4 -2
- package/dist/bits/separator/separator.svelte.js +2 -2
- package/dist/bits/slider/components/slider-range.svelte +4 -2
- package/dist/bits/slider/components/slider-thumb-label.svelte +50 -0
- package/dist/bits/slider/components/slider-thumb-label.svelte.d.ts +4 -0
- package/dist/bits/slider/components/slider-thumb.svelte +4 -2
- package/dist/bits/slider/components/slider-tick-label.svelte +50 -0
- package/dist/bits/slider/components/slider-tick-label.svelte.d.ts +4 -0
- package/dist/bits/slider/components/slider-tick.svelte +4 -2
- package/dist/bits/slider/components/slider.svelte +24 -5
- package/dist/bits/slider/exports.d.ts +3 -1
- package/dist/bits/slider/exports.js +2 -0
- package/dist/bits/slider/helpers.d.ts +14 -0
- package/dist/bits/slider/helpers.js +122 -0
- package/dist/bits/slider/slider.svelte.d.ts +91 -5
- package/dist/bits/slider/slider.svelte.js +194 -101
- package/dist/bits/slider/types.d.ts +105 -11
- package/dist/bits/switch/components/switch-thumb.svelte +4 -2
- package/dist/bits/switch/components/switch.svelte +4 -2
- package/dist/bits/switch/switch.svelte.js +3 -3
- package/dist/bits/tabs/components/tabs-content.svelte +4 -2
- package/dist/bits/tabs/components/tabs-list.svelte +4 -2
- package/dist/bits/tabs/components/tabs-trigger.svelte +4 -2
- package/dist/bits/tabs/components/tabs.svelte +4 -2
- package/dist/bits/tabs/tabs.svelte.js +6 -6
- package/dist/bits/time-field/components/time-field-hidden-input.svelte +10 -0
- package/dist/bits/{date-field/components/date-field-error.svelte.d.ts → time-field/components/time-field-hidden-input.svelte.d.ts} +6 -14
- package/dist/bits/time-field/components/time-field-input.svelte +39 -0
- package/dist/bits/time-field/components/time-field-input.svelte.d.ts +4 -0
- package/dist/bits/time-field/components/time-field-label.svelte +34 -0
- package/dist/bits/time-field/components/time-field-label.svelte.d.ts +4 -0
- package/dist/bits/time-field/components/time-field-segment.svelte +37 -0
- package/dist/bits/time-field/components/time-field-segment.svelte.d.ts +4 -0
- package/dist/bits/time-field/components/time-field.svelte +94 -0
- package/dist/bits/time-field/components/time-field.svelte.d.ts +20 -0
- package/dist/bits/time-field/exports.d.ts +5 -0
- package/dist/bits/time-field/exports.js +4 -0
- package/dist/bits/time-field/index.d.ts +1 -0
- package/dist/bits/time-field/index.js +1 -0
- package/dist/bits/time-field/time-field.svelte.d.ts +417 -0
- package/dist/bits/time-field/time-field.svelte.js +980 -0
- package/dist/bits/time-field/types.d.ts +137 -0
- package/dist/bits/time-field/types.js +1 -0
- package/dist/bits/time-range-field/components/time-range-field-input.svelte +43 -0
- package/dist/bits/time-range-field/components/time-range-field-input.svelte.d.ts +4 -0
- package/dist/bits/time-range-field/components/time-range-field-label.svelte +34 -0
- package/dist/bits/time-range-field/components/time-range-field-label.svelte.d.ts +4 -0
- package/dist/bits/time-range-field/components/time-range-field.svelte +144 -0
- package/dist/bits/time-range-field/components/time-range-field.svelte.d.ts +20 -0
- package/dist/bits/time-range-field/exports.d.ts +5 -0
- package/dist/bits/time-range-field/exports.js +4 -0
- package/dist/bits/time-range-field/index.d.ts +1 -0
- package/dist/bits/time-range-field/index.js +1 -0
- package/dist/bits/time-range-field/time-range-field.svelte.d.ts +92 -0
- package/dist/bits/time-range-field/time-range-field.svelte.js +212 -0
- package/dist/bits/time-range-field/types.d.ts +150 -0
- package/dist/bits/time-range-field/types.js +1 -0
- package/dist/bits/toggle/components/toggle.svelte +4 -2
- package/dist/bits/toggle/toggle.svelte.js +2 -2
- package/dist/bits/toggle-group/components/toggle-group-item.svelte +4 -2
- package/dist/bits/toggle-group/components/toggle-group.svelte +4 -2
- package/dist/bits/toggle-group/toggle-group.svelte.js +4 -4
- package/dist/bits/toolbar/components/toolbar-button.svelte +4 -2
- package/dist/bits/toolbar/components/toolbar-group-item.svelte +4 -2
- package/dist/bits/toolbar/components/toolbar-group.svelte +4 -2
- package/dist/bits/toolbar/components/toolbar-link.svelte +4 -2
- package/dist/bits/toolbar/components/toolbar.svelte +4 -2
- package/dist/bits/toolbar/toolbar.svelte.js +7 -7
- package/dist/bits/tooltip/components/tooltip-content-static.svelte +6 -2
- package/dist/bits/tooltip/components/tooltip-content.svelte +6 -2
- package/dist/bits/tooltip/components/tooltip-trigger.svelte +5 -3
- package/dist/bits/tooltip/tooltip.svelte.d.ts +2 -0
- package/dist/bits/tooltip/tooltip.svelte.js +6 -15
- package/dist/bits/utilities/dismissible-layer/dismissible-layer.svelte +2 -0
- package/dist/bits/utilities/dismissible-layer/types.d.ts +2 -0
- package/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.d.ts +3 -3
- package/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.js +16 -25
- package/dist/bits/utilities/floating-layer/components/floating-layer-anchor.svelte +2 -1
- package/dist/bits/utilities/floating-layer/types.d.ts +1 -0
- package/dist/bits/utilities/floating-layer/use-floating-layer.svelte.d.ts +3 -2
- package/dist/bits/utilities/floating-layer/use-floating-layer.svelte.js +7 -27
- package/dist/bits/utilities/focus-scope/focus-scope.svelte +2 -0
- package/dist/bits/utilities/focus-scope/types.d.ts +2 -0
- package/dist/bits/utilities/focus-scope/use-focus-scope.svelte.d.ts +2 -1
- package/dist/bits/utilities/focus-scope/use-focus-scope.svelte.js +15 -16
- package/dist/bits/utilities/popper-layer/popper-layer-inner.svelte +4 -0
- package/dist/bits/utilities/popper-layer/popper-layer.svelte +3 -1
- package/dist/bits/utilities/portal/types.d.ts +1 -1
- package/dist/bits/utilities/presence-layer/presence-layer.svelte +2 -2
- package/dist/bits/utilities/presence-layer/types.d.ts +2 -1
- package/dist/bits/utilities/presence-layer/use-presence.svelte.d.ts +1 -1
- package/dist/bits/utilities/presence-layer/use-presence.svelte.js +19 -36
- package/dist/bits/utilities/text-selection-layer/text-selection-layer.svelte +2 -0
- package/dist/bits/utilities/text-selection-layer/types.d.ts +2 -0
- package/dist/bits/utilities/text-selection-layer/use-text-selection-layer.svelte.d.ts +5 -1
- package/dist/bits/utilities/text-selection-layer/use-text-selection-layer.svelte.js +8 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/box-auto-reset.svelte.d.ts +7 -1
- package/dist/internal/box-auto-reset.svelte.js +11 -6
- package/dist/internal/create-id.d.ts +8 -0
- package/dist/internal/create-id.js +5 -0
- package/dist/internal/date-time/announcer.d.ts +1 -1
- package/dist/internal/date-time/announcer.js +20 -20
- package/dist/internal/date-time/calendar-helpers.svelte.js +7 -5
- package/dist/internal/date-time/field/helpers.d.ts +9 -2
- package/dist/internal/date-time/field/helpers.js +16 -9
- package/dist/internal/date-time/field/parts.d.ts +3 -1
- package/dist/internal/date-time/field/parts.js +10 -2
- package/dist/internal/date-time/field/segments.d.ts +9 -0
- package/dist/internal/date-time/field/segments.js +65 -0
- package/dist/internal/date-time/field/time-helpers.d.ts +83 -0
- package/dist/internal/date-time/field/time-helpers.js +301 -0
- package/dist/internal/date-time/field/types.d.ts +2 -2
- package/dist/internal/date-time/formatter.d.ts +11 -1
- package/dist/internal/date-time/formatter.js +56 -0
- package/dist/internal/date-time/utils.d.ts +7 -2
- package/dist/internal/date-time/utils.js +15 -1
- package/dist/internal/dom.d.ts +0 -1
- package/dist/internal/dom.js +0 -3
- package/dist/internal/focus.d.ts +2 -2
- package/dist/internal/focus.js +14 -9
- package/dist/internal/math.d.ts +0 -4
- package/dist/internal/math.js +0 -28
- package/dist/internal/tabbable.d.ts +0 -2
- package/dist/internal/tabbable.js +10 -14
- package/dist/internal/use-data-typeahead.svelte.d.ts +1 -0
- package/dist/internal/use-data-typeahead.svelte.js +4 -1
- package/dist/internal/use-dom-typeahead.svelte.d.ts +3 -1
- package/dist/internal/use-dom-typeahead.svelte.js +5 -2
- package/dist/internal/use-grace-area.svelte.js +9 -5
- package/dist/internal/use-roving-focus.svelte.d.ts +3 -3
- package/dist/internal/use-roving-focus.svelte.js +10 -11
- package/dist/shared/date/types.d.ts +27 -4
- package/dist/shared/index.d.ts +2 -2
- package/dist/types.d.ts +2 -0
- package/package.json +18 -16
- package/dist/bits/date-field/components/date-field-error.svelte +0 -0
- package/dist/internal/use-size.svelte.d.ts +0 -7
- package/dist/internal/use-size.svelte.js +0 -54
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { AspectRatioRootProps } from "../types.js";
|
|
4
4
|
import { useAspectRatioRoot } from "../aspect-ratio.svelte.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createId } from "../../../internal/create-id.js";
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
6
8
|
|
|
7
9
|
let {
|
|
8
10
|
ref = $bindable(null),
|
|
9
|
-
id =
|
|
11
|
+
id = createId(uid),
|
|
10
12
|
ratio = 1,
|
|
11
13
|
children,
|
|
12
14
|
child,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReadableBox, type WritableBox } from "svelte-toolbelt";
|
|
1
|
+
import { DOMContext, type ReadableBox, type WritableBox } from "svelte-toolbelt";
|
|
2
2
|
import type { HTMLImgAttributes } from "svelte/elements";
|
|
3
3
|
import type { AvatarImageLoadingStatus } from "./types.js";
|
|
4
4
|
import type { ReadableBoxedValues } from "../../internal/box.svelte.js";
|
|
@@ -15,6 +15,7 @@ type AvatarRootStateProps = WithRefProps<{
|
|
|
15
15
|
type AvatarImageSrc = string | null | undefined;
|
|
16
16
|
declare class AvatarRootState {
|
|
17
17
|
readonly opts: AvatarRootStateProps;
|
|
18
|
+
readonly domContext: DOMContext;
|
|
18
19
|
constructor(opts: AvatarRootStateProps);
|
|
19
20
|
loadImage(src: string, crossorigin?: CrossOrigin, referrerPolicy?: ReferrerPolicy): (() => void) | undefined;
|
|
20
21
|
props: {
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { untrack } from "svelte";
|
|
2
|
-
import {
|
|
2
|
+
import { DOMContext, attachRef } from "svelte-toolbelt";
|
|
3
3
|
import { Context } from "runed";
|
|
4
4
|
const AVATAR_ROOT_ATTR = "data-avatar-root";
|
|
5
5
|
const AVATAR_IMAGE_ATTR = "data-avatar-image";
|
|
6
6
|
const AVATAR_FALLBACK_ATTR = "data-avatar-fallback";
|
|
7
7
|
class AvatarRootState {
|
|
8
8
|
opts;
|
|
9
|
+
domContext;
|
|
9
10
|
constructor(opts) {
|
|
10
11
|
this.opts = opts;
|
|
12
|
+
this.domContext = new DOMContext(this.opts.ref);
|
|
11
13
|
this.loadImage = this.loadImage.bind(this);
|
|
12
|
-
useRefById(opts);
|
|
13
14
|
}
|
|
14
15
|
loadImage(src, crossorigin, referrerPolicy) {
|
|
15
16
|
if (this.opts.loadingStatus.current === "loaded")
|
|
@@ -23,7 +24,7 @@ class AvatarRootState {
|
|
|
23
24
|
image.referrerPolicy = referrerPolicy;
|
|
24
25
|
this.opts.loadingStatus.current = "loading";
|
|
25
26
|
image.onload = () => {
|
|
26
|
-
imageTimerId =
|
|
27
|
+
imageTimerId = this.domContext.setTimeout(() => {
|
|
27
28
|
this.opts.loadingStatus.current = "loaded";
|
|
28
29
|
}, this.opts.delayMs.current);
|
|
29
30
|
};
|
|
@@ -31,13 +32,14 @@ class AvatarRootState {
|
|
|
31
32
|
this.opts.loadingStatus.current = "error";
|
|
32
33
|
};
|
|
33
34
|
return () => {
|
|
34
|
-
|
|
35
|
+
this.domContext.clearTimeout(imageTimerId);
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
38
|
props = $derived.by(() => ({
|
|
38
39
|
id: this.opts.id.current,
|
|
39
40
|
[AVATAR_ROOT_ATTR]: "",
|
|
40
41
|
"data-status": this.opts.loadingStatus.current,
|
|
42
|
+
...attachRef(this.opts.ref),
|
|
41
43
|
}));
|
|
42
44
|
}
|
|
43
45
|
class AvatarImageState {
|
|
@@ -46,7 +48,6 @@ class AvatarImageState {
|
|
|
46
48
|
constructor(opts, root) {
|
|
47
49
|
this.opts = opts;
|
|
48
50
|
this.root = root;
|
|
49
|
-
useRefById(opts);
|
|
50
51
|
$effect.pre(() => {
|
|
51
52
|
if (!this.opts.src.current) {
|
|
52
53
|
this.root.opts.loadingStatus.current = "error";
|
|
@@ -67,6 +68,7 @@ class AvatarImageState {
|
|
|
67
68
|
src: this.opts.src.current,
|
|
68
69
|
crossorigin: this.opts.crossOrigin.current,
|
|
69
70
|
referrerpolicy: this.opts.referrerPolicy.current,
|
|
71
|
+
...attachRef(this.opts.ref),
|
|
70
72
|
}));
|
|
71
73
|
}
|
|
72
74
|
class AvatarFallbackState {
|
|
@@ -75,13 +77,13 @@ class AvatarFallbackState {
|
|
|
75
77
|
constructor(opts, root) {
|
|
76
78
|
this.opts = opts;
|
|
77
79
|
this.root = root;
|
|
78
|
-
useRefById(opts);
|
|
79
80
|
}
|
|
80
81
|
style = $derived.by(() => this.root.opts.loadingStatus.current === "loaded" ? { display: "none" } : undefined);
|
|
81
82
|
props = $derived.by(() => ({
|
|
82
83
|
style: this.style,
|
|
83
84
|
"data-status": this.root.opts.loadingStatus.current,
|
|
84
85
|
[AVATAR_FALLBACK_ATTR]: "",
|
|
86
|
+
...attachRef(this.opts.ref),
|
|
85
87
|
}));
|
|
86
88
|
}
|
|
87
89
|
const AvatarRootContext = new Context("Avatar.Root");
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { AvatarFallbackProps } from "../types.js";
|
|
4
4
|
import { useAvatarFallback } from "../avatar.svelte.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createId } from "../../../internal/create-id.js";
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
6
8
|
|
|
7
9
|
let {
|
|
8
10
|
children,
|
|
9
11
|
child,
|
|
10
|
-
id =
|
|
12
|
+
id = createId(uid),
|
|
11
13
|
ref = $bindable(null),
|
|
12
14
|
...restProps
|
|
13
15
|
}: AvatarFallbackProps = $props();
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { AvatarImageProps } from "../types.js";
|
|
4
4
|
import { useAvatarImage } from "../avatar.svelte.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createId } from "../../../internal/create-id.js";
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
6
8
|
|
|
7
9
|
let {
|
|
8
10
|
src,
|
|
9
11
|
child,
|
|
10
|
-
id =
|
|
12
|
+
id = createId(uid),
|
|
11
13
|
ref = $bindable(null),
|
|
12
14
|
crossorigin = undefined,
|
|
13
15
|
referrerpolicy = undefined,
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { AvatarRootProps } from "../types.js";
|
|
4
4
|
import { useAvatarRoot } from "../avatar.svelte.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createId } from "../../../internal/create-id.js";
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
6
8
|
|
|
7
9
|
let {
|
|
8
10
|
delayMs = 0,
|
|
@@ -10,7 +12,7 @@
|
|
|
10
12
|
onLoadingStatusChange,
|
|
11
13
|
child,
|
|
12
14
|
children,
|
|
13
|
-
id =
|
|
15
|
+
id = createId(uid),
|
|
14
16
|
ref = $bindable(null),
|
|
15
17
|
...restProps
|
|
16
18
|
}: AvatarRootProps = $props();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type DateValue } from "@internationalized/date";
|
|
2
|
+
import { DOMContext } from "svelte-toolbelt";
|
|
2
3
|
import { Context } from "runed";
|
|
3
4
|
import type { RangeCalendarRootState } from "../range-calendar/range-calendar.svelte.js";
|
|
4
5
|
import type { ReadableBoxedValues, WritableBoxedValues } from "../../internal/box.svelte.js";
|
|
@@ -38,12 +39,14 @@ type CalendarRootStateProps = WithRefProps<WritableBoxedValues<{
|
|
|
38
39
|
defaultPlaceholder: DateValue;
|
|
39
40
|
}>;
|
|
40
41
|
export declare class CalendarRootState {
|
|
42
|
+
#private;
|
|
41
43
|
readonly opts: CalendarRootStateProps;
|
|
42
44
|
months: Month<DateValue>[];
|
|
43
45
|
visibleMonths: DateValue[];
|
|
44
46
|
announcer: Announcer;
|
|
45
47
|
formatter: Formatter;
|
|
46
48
|
accessibleHeadingId: string;
|
|
49
|
+
domContext: DOMContext;
|
|
47
50
|
constructor(opts: CalendarRootStateProps);
|
|
48
51
|
setMonths(months: Month<DateValue>[]): void;
|
|
49
52
|
/**
|
|
@@ -101,7 +104,6 @@ export declare class CalendarHeadingState {
|
|
|
101
104
|
headingValue: string;
|
|
102
105
|
constructor(opts: CalendarHeadingStateProps, root: CalendarRootState | RangeCalendarRootState);
|
|
103
106
|
props: {
|
|
104
|
-
readonly [x: string]: string | undefined;
|
|
105
107
|
readonly id: string;
|
|
106
108
|
readonly "aria-hidden": "true" | undefined;
|
|
107
109
|
readonly "data-disabled": "" | undefined;
|
|
@@ -198,7 +200,6 @@ export declare class CalendarNextButtonState {
|
|
|
198
200
|
constructor(opts: CalendarNextButtonStateProps, root: CalendarRootState | RangeCalendarRootState);
|
|
199
201
|
onclick(_: BitsMouseEvent): void;
|
|
200
202
|
props: {
|
|
201
|
-
readonly [x: string]: string | boolean | ((_: BitsMouseEvent) => void) | undefined;
|
|
202
203
|
readonly id: string;
|
|
203
204
|
readonly role: "button";
|
|
204
205
|
readonly type: "button";
|
|
@@ -217,7 +218,6 @@ export declare class CalendarPrevButtonState {
|
|
|
217
218
|
constructor(opts: CalendarPrevButtonStateProps, root: CalendarRootState | RangeCalendarRootState);
|
|
218
219
|
onclick(_: BitsMouseEvent): void;
|
|
219
220
|
props: {
|
|
220
|
-
readonly [x: string]: string | boolean | ((_: BitsMouseEvent) => void) | undefined;
|
|
221
221
|
readonly id: string;
|
|
222
222
|
readonly role: "button";
|
|
223
223
|
readonly type: "button";
|
|
@@ -234,7 +234,6 @@ export declare class CalendarGridState {
|
|
|
234
234
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
235
235
|
constructor(opts: CalendarGridStateProps, root: CalendarRootState | RangeCalendarRootState);
|
|
236
236
|
props: {
|
|
237
|
-
readonly [x: string]: string | -1 | undefined;
|
|
238
237
|
readonly id: string;
|
|
239
238
|
readonly tabindex: -1;
|
|
240
239
|
readonly role: "grid";
|
|
@@ -250,7 +249,6 @@ export declare class CalendarGridBodyState {
|
|
|
250
249
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
251
250
|
constructor(opts: CalendarGridBodyStateProps, root: CalendarRootState | RangeCalendarRootState);
|
|
252
251
|
props: {
|
|
253
|
-
readonly [x: string]: string | undefined;
|
|
254
252
|
readonly id: string;
|
|
255
253
|
readonly "data-disabled": "" | undefined;
|
|
256
254
|
readonly "data-readonly": "" | undefined;
|
|
@@ -262,7 +260,6 @@ export declare class CalendarGridHeadState {
|
|
|
262
260
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
263
261
|
constructor(opts: CalendarGridHeadStateProps, root: CalendarRootState | RangeCalendarRootState);
|
|
264
262
|
props: {
|
|
265
|
-
readonly [x: string]: string | undefined;
|
|
266
263
|
readonly id: string;
|
|
267
264
|
readonly "data-disabled": "" | undefined;
|
|
268
265
|
readonly "data-readonly": "" | undefined;
|
|
@@ -274,7 +271,6 @@ export declare class CalendarGridRowState {
|
|
|
274
271
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
275
272
|
constructor(opts: CalendarGridRowStateProps, root: CalendarRootState | RangeCalendarRootState);
|
|
276
273
|
props: {
|
|
277
|
-
readonly [x: string]: string | undefined;
|
|
278
274
|
readonly id: string;
|
|
279
275
|
readonly "data-disabled": "" | undefined;
|
|
280
276
|
readonly "data-readonly": "" | undefined;
|
|
@@ -286,7 +282,6 @@ export declare class CalendarHeadCellState {
|
|
|
286
282
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
287
283
|
constructor(opts: CalendarHeadCellStateProps, root: CalendarRootState | RangeCalendarRootState);
|
|
288
284
|
props: {
|
|
289
|
-
readonly [x: string]: string | undefined;
|
|
290
285
|
readonly id: string;
|
|
291
286
|
readonly "data-disabled": "" | undefined;
|
|
292
287
|
readonly "data-readonly": "" | undefined;
|
|
@@ -298,7 +293,6 @@ export declare class CalendarHeaderState {
|
|
|
298
293
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
299
294
|
constructor(opts: CalendarHeaderStateProps, root: CalendarRootState | RangeCalendarRootState);
|
|
300
295
|
props: {
|
|
301
|
-
readonly [x: string]: string | undefined;
|
|
302
296
|
readonly id: string;
|
|
303
297
|
readonly "data-disabled": "" | undefined;
|
|
304
298
|
readonly "data-readonly": "" | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getLocalTimeZone, isSameDay, isSameMonth, isToday, } from "@internationalized/date";
|
|
2
2
|
import { DEV } from "esm-env";
|
|
3
|
-
import { untrack } from "svelte";
|
|
4
|
-
import {
|
|
3
|
+
import { onMount, untrack } from "svelte";
|
|
4
|
+
import { attachRef, DOMContext } from "svelte-toolbelt";
|
|
5
5
|
import { Context, watch } from "runed";
|
|
6
6
|
import { getAriaDisabled, getAriaHidden, getAriaReadonly, getAriaSelected, getDataDisabled, getDataReadonly, getDataSelected, getDataUnavailable, } from "../../internal/attrs.js";
|
|
7
7
|
import { useId } from "../../internal/use-id.js";
|
|
@@ -16,9 +16,11 @@ export class CalendarRootState {
|
|
|
16
16
|
announcer;
|
|
17
17
|
formatter;
|
|
18
18
|
accessibleHeadingId = useId();
|
|
19
|
+
domContext;
|
|
19
20
|
constructor(opts) {
|
|
20
21
|
this.opts = opts;
|
|
21
|
-
this.
|
|
22
|
+
this.domContext = new DOMContext(opts.ref);
|
|
23
|
+
this.announcer = getAnnouncer(null);
|
|
22
24
|
this.formatter = createFormatter(this.opts.locale.current);
|
|
23
25
|
this.setMonths = this.setMonths.bind(this);
|
|
24
26
|
this.nextPage = this.nextPage.bind(this);
|
|
@@ -36,7 +38,9 @@ export class CalendarRootState {
|
|
|
36
38
|
this.handleSingleUpdate = this.handleSingleUpdate.bind(this);
|
|
37
39
|
this.onkeydown = this.onkeydown.bind(this);
|
|
38
40
|
this.getBitsAttr = this.getBitsAttr.bind(this);
|
|
39
|
-
|
|
41
|
+
onMount(() => {
|
|
42
|
+
this.announcer = getAnnouncer(this.domContext.getDocument());
|
|
43
|
+
});
|
|
40
44
|
this.months = createMonths({
|
|
41
45
|
dateObj: this.opts.placeholder.current,
|
|
42
46
|
weekStartsOn: this.opts.weekStartsOn.current,
|
|
@@ -44,31 +48,9 @@ export class CalendarRootState {
|
|
|
44
48
|
fixedWeeks: this.opts.fixedWeeks.current,
|
|
45
49
|
numberOfMonths: this.opts.numberOfMonths.current,
|
|
46
50
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// focus the first `data-focused` day node
|
|
51
|
-
const firstFocusedDay = this.opts.ref.current?.querySelector(`[data-focused]`);
|
|
52
|
-
if (firstFocusedDay) {
|
|
53
|
-
firstFocusedDay.focus();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
$effect(() => {
|
|
58
|
-
if (!this.opts.ref.current)
|
|
59
|
-
return;
|
|
60
|
-
const removeHeading = createAccessibleHeading({
|
|
61
|
-
calendarNode: this.opts.ref.current,
|
|
62
|
-
label: this.fullCalendarLabel,
|
|
63
|
-
accessibleHeadingId: this.accessibleHeadingId,
|
|
64
|
-
});
|
|
65
|
-
return removeHeading;
|
|
66
|
-
});
|
|
67
|
-
$effect(() => {
|
|
68
|
-
if (this.formatter.getLocale() === this.opts.locale.current)
|
|
69
|
-
return;
|
|
70
|
-
this.formatter.setLocale(this.opts.locale.current);
|
|
71
|
-
});
|
|
51
|
+
this.#setupInitialFocusEffect();
|
|
52
|
+
this.#setupAccessibleHeadingEffect();
|
|
53
|
+
this.#setupFormatterEffect();
|
|
72
54
|
/**
|
|
73
55
|
* Updates the displayed months based on changes in the placeholder value.
|
|
74
56
|
*/
|
|
@@ -98,7 +80,7 @@ export class CalendarRootState {
|
|
|
98
80
|
* changes.
|
|
99
81
|
*/
|
|
100
82
|
$effect(() => {
|
|
101
|
-
const node =
|
|
83
|
+
const node = this.domContext.getElementById(this.accessibleHeadingId);
|
|
102
84
|
if (!node)
|
|
103
85
|
return;
|
|
104
86
|
node.textContent = this.fullCalendarLabel;
|
|
@@ -146,6 +128,37 @@ export class CalendarRootState {
|
|
|
146
128
|
weekdayFormat: this.opts.weekdayFormat.current,
|
|
147
129
|
});
|
|
148
130
|
});
|
|
131
|
+
#setupInitialFocusEffect() {
|
|
132
|
+
$effect(() => {
|
|
133
|
+
const initialFocus = untrack(() => this.opts.initialFocus.current);
|
|
134
|
+
if (initialFocus) {
|
|
135
|
+
// focus the first `data-focused` day node
|
|
136
|
+
const firstFocusedDay = this.opts.ref.current?.querySelector(`[data-focused]`);
|
|
137
|
+
if (firstFocusedDay) {
|
|
138
|
+
firstFocusedDay.focus();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
#setupAccessibleHeadingEffect() {
|
|
144
|
+
$effect(() => {
|
|
145
|
+
if (!this.opts.ref.current)
|
|
146
|
+
return;
|
|
147
|
+
const removeHeading = createAccessibleHeading({
|
|
148
|
+
calendarNode: this.opts.ref.current,
|
|
149
|
+
label: this.fullCalendarLabel,
|
|
150
|
+
accessibleHeadingId: this.accessibleHeadingId,
|
|
151
|
+
});
|
|
152
|
+
return removeHeading;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
#setupFormatterEffect() {
|
|
156
|
+
$effect(() => {
|
|
157
|
+
if (this.formatter.getLocale() === this.opts.locale.current)
|
|
158
|
+
return;
|
|
159
|
+
this.formatter.setLocale(this.opts.locale.current);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
149
162
|
/**
|
|
150
163
|
* Navigates to the next page of the calendar.
|
|
151
164
|
*/
|
|
@@ -365,6 +378,7 @@ export class CalendarRootState {
|
|
|
365
378
|
[this.getBitsAttr("root")]: "",
|
|
366
379
|
//
|
|
367
380
|
onkeydown: this.onkeydown,
|
|
381
|
+
...attachRef(this.opts.ref),
|
|
368
382
|
}));
|
|
369
383
|
}
|
|
370
384
|
export class CalendarHeadingState {
|
|
@@ -374,7 +388,6 @@ export class CalendarHeadingState {
|
|
|
374
388
|
constructor(opts, root) {
|
|
375
389
|
this.opts = opts;
|
|
376
390
|
this.root = root;
|
|
377
|
-
useRefById(opts);
|
|
378
391
|
}
|
|
379
392
|
props = $derived.by(() => ({
|
|
380
393
|
id: this.opts.id.current,
|
|
@@ -382,6 +395,7 @@ export class CalendarHeadingState {
|
|
|
382
395
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
383
396
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
384
397
|
[this.root.getBitsAttr("heading")]: "",
|
|
398
|
+
...attachRef(this.opts.ref),
|
|
385
399
|
}));
|
|
386
400
|
}
|
|
387
401
|
class CalendarCellState {
|
|
@@ -404,7 +418,6 @@ class CalendarCellState {
|
|
|
404
418
|
constructor(opts, root) {
|
|
405
419
|
this.opts = opts;
|
|
406
420
|
this.root = root;
|
|
407
|
-
useRefById(opts);
|
|
408
421
|
}
|
|
409
422
|
snippetProps = $derived.by(() => ({
|
|
410
423
|
disabled: this.isDisabled,
|
|
@@ -435,6 +448,7 @@ class CalendarCellState {
|
|
|
435
448
|
"aria-disabled": getAriaDisabled(this.ariaDisabled),
|
|
436
449
|
...this.sharedDataAttrs,
|
|
437
450
|
[this.root.getBitsAttr("cell")]: "",
|
|
451
|
+
...attachRef(this.opts.ref),
|
|
438
452
|
}));
|
|
439
453
|
}
|
|
440
454
|
class CalendarDayState {
|
|
@@ -444,7 +458,6 @@ class CalendarDayState {
|
|
|
444
458
|
this.opts = opts;
|
|
445
459
|
this.cell = cell;
|
|
446
460
|
this.onclick = this.onclick.bind(this);
|
|
447
|
-
useRefById(opts);
|
|
448
461
|
}
|
|
449
462
|
#tabindex = $derived.by(() => (this.cell.isOutsideMonth && this.cell.root.opts.disableDaysOutsideMonth.current) ||
|
|
450
463
|
this.cell.isDisabled
|
|
@@ -475,6 +488,7 @@ class CalendarDayState {
|
|
|
475
488
|
"data-bits-day": "",
|
|
476
489
|
//
|
|
477
490
|
onclick: this.onclick,
|
|
491
|
+
...attachRef(this.opts.ref),
|
|
478
492
|
}));
|
|
479
493
|
}
|
|
480
494
|
export class CalendarNextButtonState {
|
|
@@ -485,7 +499,6 @@ export class CalendarNextButtonState {
|
|
|
485
499
|
this.opts = opts;
|
|
486
500
|
this.root = root;
|
|
487
501
|
this.onclick = this.onclick.bind(this);
|
|
488
|
-
useRefById(opts);
|
|
489
502
|
}
|
|
490
503
|
onclick(_) {
|
|
491
504
|
if (this.isDisabled)
|
|
@@ -503,6 +516,7 @@ export class CalendarNextButtonState {
|
|
|
503
516
|
[this.root.getBitsAttr("next-button")]: "",
|
|
504
517
|
//
|
|
505
518
|
onclick: this.onclick,
|
|
519
|
+
...attachRef(this.opts.ref),
|
|
506
520
|
}));
|
|
507
521
|
}
|
|
508
522
|
export class CalendarPrevButtonState {
|
|
@@ -513,7 +527,6 @@ export class CalendarPrevButtonState {
|
|
|
513
527
|
this.opts = opts;
|
|
514
528
|
this.root = root;
|
|
515
529
|
this.onclick = this.onclick.bind(this);
|
|
516
|
-
useRefById(opts);
|
|
517
530
|
}
|
|
518
531
|
onclick(_) {
|
|
519
532
|
if (this.isDisabled)
|
|
@@ -531,6 +544,7 @@ export class CalendarPrevButtonState {
|
|
|
531
544
|
[this.root.getBitsAttr("prev-button")]: "",
|
|
532
545
|
//
|
|
533
546
|
onclick: this.onclick,
|
|
547
|
+
...attachRef(this.opts.ref),
|
|
534
548
|
}));
|
|
535
549
|
}
|
|
536
550
|
export class CalendarGridState {
|
|
@@ -539,7 +553,6 @@ export class CalendarGridState {
|
|
|
539
553
|
constructor(opts, root) {
|
|
540
554
|
this.opts = opts;
|
|
541
555
|
this.root = root;
|
|
542
|
-
useRefById(opts);
|
|
543
556
|
}
|
|
544
557
|
props = $derived.by(() => ({
|
|
545
558
|
id: this.opts.id.current,
|
|
@@ -550,6 +563,7 @@ export class CalendarGridState {
|
|
|
550
563
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
551
564
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
552
565
|
[this.root.getBitsAttr("grid")]: "",
|
|
566
|
+
...attachRef(this.opts.ref),
|
|
553
567
|
}));
|
|
554
568
|
}
|
|
555
569
|
export class CalendarGridBodyState {
|
|
@@ -558,13 +572,13 @@ export class CalendarGridBodyState {
|
|
|
558
572
|
constructor(opts, root) {
|
|
559
573
|
this.opts = opts;
|
|
560
574
|
this.root = root;
|
|
561
|
-
useRefById(opts);
|
|
562
575
|
}
|
|
563
576
|
props = $derived.by(() => ({
|
|
564
577
|
id: this.opts.id.current,
|
|
565
578
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
566
579
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
567
580
|
[this.root.getBitsAttr("grid-body")]: "",
|
|
581
|
+
...attachRef(this.opts.ref),
|
|
568
582
|
}));
|
|
569
583
|
}
|
|
570
584
|
export class CalendarGridHeadState {
|
|
@@ -573,13 +587,13 @@ export class CalendarGridHeadState {
|
|
|
573
587
|
constructor(opts, root) {
|
|
574
588
|
this.opts = opts;
|
|
575
589
|
this.root = root;
|
|
576
|
-
useRefById(opts);
|
|
577
590
|
}
|
|
578
591
|
props = $derived.by(() => ({
|
|
579
592
|
id: this.opts.id.current,
|
|
580
593
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
581
594
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
582
595
|
[this.root.getBitsAttr("grid-head")]: "",
|
|
596
|
+
...attachRef(this.opts.ref),
|
|
583
597
|
}));
|
|
584
598
|
}
|
|
585
599
|
export class CalendarGridRowState {
|
|
@@ -588,13 +602,13 @@ export class CalendarGridRowState {
|
|
|
588
602
|
constructor(opts, root) {
|
|
589
603
|
this.opts = opts;
|
|
590
604
|
this.root = root;
|
|
591
|
-
useRefById(opts);
|
|
592
605
|
}
|
|
593
606
|
props = $derived.by(() => ({
|
|
594
607
|
id: this.opts.id.current,
|
|
595
608
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
596
609
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
597
610
|
[this.root.getBitsAttr("grid-row")]: "",
|
|
611
|
+
...attachRef(this.opts.ref),
|
|
598
612
|
}));
|
|
599
613
|
}
|
|
600
614
|
export class CalendarHeadCellState {
|
|
@@ -603,13 +617,13 @@ export class CalendarHeadCellState {
|
|
|
603
617
|
constructor(opts, root) {
|
|
604
618
|
this.opts = opts;
|
|
605
619
|
this.root = root;
|
|
606
|
-
useRefById(opts);
|
|
607
620
|
}
|
|
608
621
|
props = $derived.by(() => ({
|
|
609
622
|
id: this.opts.id.current,
|
|
610
623
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
611
624
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
612
625
|
[this.root.getBitsAttr("head-cell")]: "",
|
|
626
|
+
...attachRef(this.opts.ref),
|
|
613
627
|
}));
|
|
614
628
|
}
|
|
615
629
|
export class CalendarHeaderState {
|
|
@@ -618,13 +632,13 @@ export class CalendarHeaderState {
|
|
|
618
632
|
constructor(opts, root) {
|
|
619
633
|
this.opts = opts;
|
|
620
634
|
this.root = root;
|
|
621
|
-
useRefById(opts);
|
|
622
635
|
}
|
|
623
636
|
props = $derived.by(() => ({
|
|
624
637
|
id: this.opts.id.current,
|
|
625
638
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
626
639
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
627
640
|
[this.root.getBitsAttr("header")]: "",
|
|
641
|
+
...attachRef(this.opts.ref),
|
|
628
642
|
}));
|
|
629
643
|
}
|
|
630
644
|
export const CalendarRootContext = new Context("Calendar.Root | RangeCalender.Root");
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import { useCalendarCell } from "../calendar.svelte.js";
|
|
4
4
|
import type { CalendarCellProps } from "../types.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createId } from "../../../internal/create-id.js";
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
6
8
|
|
|
7
9
|
let {
|
|
8
10
|
children,
|
|
9
11
|
child,
|
|
10
12
|
ref = $bindable(null),
|
|
11
|
-
id =
|
|
13
|
+
id = createId(uid),
|
|
12
14
|
date,
|
|
13
15
|
month,
|
|
14
16
|
...restProps
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import { useCalendarDay } from "../calendar.svelte.js";
|
|
4
4
|
import type { CalendarDayProps } from "../types.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createId } from "../../../internal/create-id.js";
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
6
8
|
|
|
7
9
|
let {
|
|
8
10
|
children,
|
|
9
11
|
child,
|
|
10
12
|
ref = $bindable(null),
|
|
11
|
-
id =
|
|
13
|
+
id = createId(uid),
|
|
12
14
|
...restProps
|
|
13
15
|
}: CalendarDayProps = $props();
|
|
14
16
|
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { CalendarGridBodyProps } from "../types.js";
|
|
4
4
|
import { useCalendarGridBody } from "../calendar.svelte.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createId } from "../../../internal/create-id.js";
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
6
8
|
|
|
7
9
|
let {
|
|
8
10
|
children,
|
|
9
11
|
child,
|
|
10
12
|
ref = $bindable(null),
|
|
11
|
-
id =
|
|
13
|
+
id = createId(uid),
|
|
12
14
|
...restProps
|
|
13
15
|
}: CalendarGridBodyProps = $props();
|
|
14
16
|
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import { useCalendarGridHead } from "../calendar.svelte.js";
|
|
4
4
|
import type { CalendarGridHeadProps } from "../types.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createId } from "../../../internal/create-id.js";
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
6
8
|
|
|
7
9
|
let {
|
|
8
10
|
children,
|
|
9
11
|
child,
|
|
10
12
|
ref = $bindable(null),
|
|
11
|
-
id =
|
|
13
|
+
id = createId(uid),
|
|
12
14
|
...restProps
|
|
13
15
|
}: CalendarGridHeadProps = $props();
|
|
14
16
|
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import { useCalendarGridRow } from "../calendar.svelte.js";
|
|
4
4
|
import type { CalendarGridRowProps } from "../types.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createId } from "../../../internal/create-id.js";
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
6
8
|
|
|
7
9
|
let {
|
|
8
10
|
children,
|
|
9
11
|
child,
|
|
10
12
|
ref = $bindable(null),
|
|
11
|
-
id =
|
|
13
|
+
id = createId(uid),
|
|
12
14
|
...restProps
|
|
13
15
|
}: CalendarGridRowProps = $props();
|
|
14
16
|
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import { useCalendarGrid } from "../calendar.svelte.js";
|
|
4
4
|
import type { CalendarGridProps } from "../types.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createId } from "../../../internal/create-id.js";
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
6
8
|
|
|
7
9
|
let {
|
|
8
10
|
children,
|
|
9
11
|
child,
|
|
10
12
|
ref = $bindable(null),
|
|
11
|
-
id =
|
|
13
|
+
id = createId(uid),
|
|
12
14
|
...restProps
|
|
13
15
|
}: CalendarGridProps = $props();
|
|
14
16
|
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import { box, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import { useCalendarHeadCell } from "../calendar.svelte.js";
|
|
4
4
|
import type { CalendarHeadCellProps } from "../types.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createId } from "../../../internal/create-id.js";
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
6
8
|
|
|
7
9
|
let {
|
|
8
10
|
children,
|
|
9
11
|
child,
|
|
10
12
|
ref = $bindable(null),
|
|
11
|
-
id =
|
|
13
|
+
id = createId(uid),
|
|
12
14
|
...restProps
|
|
13
15
|
}: CalendarHeadCellProps = $props();
|
|
14
16
|
|