bits-ui 2.10.0 → 2.11.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 +9 -7
- package/dist/bits/accordion/accordion.svelte.js +36 -13
- package/dist/bits/accordion/components/accordion-content.svelte +15 -7
- package/dist/bits/accordion/components/accordion-header.svelte +4 -4
- package/dist/bits/accordion/components/accordion-item.svelte +5 -5
- package/dist/bits/accordion/components/accordion-trigger.svelte +4 -4
- package/dist/bits/accordion/components/accordion.svelte +7 -7
- package/dist/bits/accordion/components/accordion.svelte.d.ts +1 -1
- package/dist/bits/accordion/types.d.ts +17 -8
- package/dist/bits/alert-dialog/components/alert-dialog-action.svelte +3 -3
- package/dist/bits/alert-dialog/components/alert-dialog-cancel.svelte +4 -4
- package/dist/bits/alert-dialog/components/alert-dialog-content.svelte +3 -3
- package/dist/bits/alert-dialog/components/alert-dialog.svelte +4 -4
- package/dist/bits/aspect-ratio/components/aspect-ratio.svelte +4 -4
- package/dist/bits/avatar/components/avatar-fallback.svelte +3 -3
- package/dist/bits/avatar/components/avatar-image.svelte +6 -6
- package/dist/bits/avatar/components/avatar.svelte +5 -5
- package/dist/bits/calendar/calendar.svelte.js +30 -30
- package/dist/bits/calendar/components/calendar-cell.svelte +5 -5
- package/dist/bits/calendar/components/calendar-day.svelte +3 -3
- package/dist/bits/calendar/components/calendar-grid-body.svelte +3 -3
- package/dist/bits/calendar/components/calendar-grid-head.svelte +3 -3
- package/dist/bits/calendar/components/calendar-grid-row.svelte +3 -3
- package/dist/bits/calendar/components/calendar-grid.svelte +3 -3
- package/dist/bits/calendar/components/calendar-head-cell.svelte +3 -3
- package/dist/bits/calendar/components/calendar-header.svelte +3 -3
- package/dist/bits/calendar/components/calendar-heading.svelte +3 -3
- package/dist/bits/calendar/components/calendar-month-select.svelte +6 -6
- package/dist/bits/calendar/components/calendar-next-button.svelte +3 -3
- package/dist/bits/calendar/components/calendar-prev-button.svelte +3 -3
- package/dist/bits/calendar/components/calendar-year-select.svelte +6 -6
- package/dist/bits/calendar/components/calendar.svelte +24 -24
- package/dist/bits/calendar/components/calendar.svelte.d.ts +1 -1
- package/dist/bits/checkbox/checkbox.svelte.d.ts +1 -1
- package/dist/bits/checkbox/checkbox.svelte.js +7 -7
- package/dist/bits/checkbox/components/checkbox-group-label.svelte +3 -3
- package/dist/bits/checkbox/components/checkbox-group.svelte +9 -9
- package/dist/bits/checkbox/components/checkbox-group.svelte.d.ts +1 -1
- package/dist/bits/checkbox/components/checkbox.svelte +11 -11
- package/dist/bits/checkbox/components/checkbox.svelte.d.ts +1 -1
- package/dist/bits/collapsible/collapsible.svelte.d.ts +2 -0
- package/dist/bits/collapsible/collapsible.svelte.js +31 -8
- package/dist/bits/collapsible/components/collapsible-content.svelte +15 -7
- package/dist/bits/collapsible/components/collapsible-trigger.svelte +4 -4
- package/dist/bits/collapsible/components/collapsible.svelte +6 -6
- package/dist/bits/collapsible/types.d.ts +12 -3
- package/dist/bits/combobox/components/combobox-input.svelte +4 -4
- package/dist/bits/combobox/components/combobox-trigger.svelte +3 -3
- package/dist/bits/combobox/components/combobox.svelte +12 -12
- package/dist/bits/command/command.svelte.js +6 -6
- package/dist/bits/command/components/_command-label.svelte +3 -3
- package/dist/bits/command/components/command-empty.svelte +4 -4
- package/dist/bits/command/components/command-group-heading.svelte +3 -3
- package/dist/bits/command/components/command-group-items.svelte +3 -3
- package/dist/bits/command/components/command-group.svelte +5 -5
- package/dist/bits/command/components/command-input.svelte +5 -5
- package/dist/bits/command/components/command-input.svelte.d.ts +1 -1
- package/dist/bits/command/components/command-item.svelte +8 -8
- package/dist/bits/command/components/command-link-item.svelte +8 -8
- package/dist/bits/command/components/command-list.svelte +4 -4
- package/dist/bits/command/components/command-loading.svelte +4 -4
- package/dist/bits/command/components/command-separator.svelte +4 -4
- package/dist/bits/command/components/command-viewport.svelte +3 -3
- package/dist/bits/command/components/command.svelte +12 -12
- package/dist/bits/command/components/command.svelte.d.ts +1 -1
- package/dist/bits/context-menu/components/context-menu-content-static.svelte +5 -5
- package/dist/bits/context-menu/components/context-menu-content.svelte +5 -5
- package/dist/bits/context-menu/components/context-menu-trigger.svelte +4 -4
- package/dist/bits/context-menu/components/context-menu.svelte +5 -5
- package/dist/bits/date-field/components/date-field-input.svelte +4 -4
- package/dist/bits/date-field/components/date-field-label.svelte +3 -3
- package/dist/bits/date-field/components/date-field-segment.svelte +3 -3
- package/dist/bits/date-field/components/date-field.svelte +16 -16
- package/dist/bits/date-field/date-field.svelte.js +17 -17
- package/dist/bits/date-picker/components/date-picker-calendar.svelte +5 -5
- package/dist/bits/date-picker/components/date-picker.svelte +32 -32
- package/dist/bits/date-range-field/components/date-range-field-input.svelte +4 -4
- package/dist/bits/date-range-field/components/date-range-field-label.svelte +3 -3
- package/dist/bits/date-range-field/components/date-range-field.svelte +19 -19
- package/dist/bits/date-range-field/components/date-range-field.svelte.d.ts +1 -1
- package/dist/bits/date-range-field/date-range-field.svelte.js +9 -9
- package/dist/bits/date-range-picker/components/date-range-picker-calendar.svelte +3 -3
- package/dist/bits/date-range-picker/components/date-range-picker.svelte +37 -37
- package/dist/bits/date-range-picker/components/date-range-picker.svelte.d.ts +1 -1
- package/dist/bits/dialog/components/dialog-close.svelte +5 -5
- package/dist/bits/dialog/components/dialog-content.svelte +3 -3
- package/dist/bits/dialog/components/dialog-description.svelte +3 -3
- package/dist/bits/dialog/components/dialog-overlay.svelte +3 -3
- package/dist/bits/dialog/components/dialog-title.svelte +4 -4
- package/dist/bits/dialog/components/dialog-trigger.svelte +4 -4
- package/dist/bits/dialog/components/dialog.svelte +4 -4
- package/dist/bits/dialog/dialog.svelte.d.ts +1 -1
- package/dist/bits/dialog/dialog.svelte.js +4 -4
- package/dist/bits/dropdown-menu/components/dropdown-menu-content-static.svelte +5 -5
- package/dist/bits/dropdown-menu/components/dropdown-menu-content.svelte +5 -5
- package/dist/bits/label/components/label.svelte +3 -3
- package/dist/bits/link-preview/components/link-preview-content-static.svelte +5 -5
- package/dist/bits/link-preview/components/link-preview-content.svelte +5 -5
- package/dist/bits/link-preview/components/link-preview-trigger.svelte +3 -3
- package/dist/bits/link-preview/components/link-preview.svelte +6 -6
- package/dist/bits/link-preview/link-preview.svelte.js +4 -4
- package/dist/bits/menu/components/menu-checkbox-group.svelte +5 -5
- package/dist/bits/menu/components/menu-checkbox-group.svelte.d.ts +1 -1
- package/dist/bits/menu/components/menu-checkbox-item.svelte +9 -9
- package/dist/bits/menu/components/menu-checkbox-item.svelte.d.ts +1 -1
- package/dist/bits/menu/components/menu-content-static.svelte +5 -5
- package/dist/bits/menu/components/menu-content.svelte +5 -5
- package/dist/bits/menu/components/menu-group-heading.svelte +3 -3
- package/dist/bits/menu/components/menu-group.svelte +3 -3
- package/dist/bits/menu/components/menu-item.svelte +6 -6
- package/dist/bits/menu/components/menu-radio-group.svelte +4 -4
- package/dist/bits/menu/components/menu-radio-group.svelte.d.ts +1 -1
- package/dist/bits/menu/components/menu-radio-item.svelte +7 -7
- package/dist/bits/menu/components/menu-separator.svelte +3 -3
- package/dist/bits/menu/components/menu-sub-content-static.svelte +5 -5
- package/dist/bits/menu/components/menu-sub-content.svelte +5 -5
- package/dist/bits/menu/components/menu-sub-trigger.svelte +5 -5
- package/dist/bits/menu/components/menu-sub.svelte +3 -3
- package/dist/bits/menu/components/menu-trigger.svelte +4 -4
- package/dist/bits/menu/components/menu.svelte +5 -5
- package/dist/bits/menu/menu.svelte.d.ts +1 -1
- package/dist/bits/menu/menu.svelte.js +14 -14
- package/dist/bits/menubar/components/menubar-content-static.svelte +8 -8
- package/dist/bits/menubar/components/menubar-content.svelte +8 -8
- package/dist/bits/menubar/components/menubar-menu.svelte +3 -3
- package/dist/bits/menubar/components/menubar-trigger.svelte +4 -4
- package/dist/bits/menubar/components/menubar.svelte +6 -6
- package/dist/bits/menubar/menubar.svelte.js +5 -5
- package/dist/bits/meter/components/meter.svelte +6 -6
- package/dist/bits/navigation-menu/components/navigation-menu-content-impl.svelte +3 -3
- package/dist/bits/navigation-menu/components/navigation-menu-content.svelte +3 -3
- package/dist/bits/navigation-menu/components/navigation-menu-indicator-impl.svelte +3 -3
- package/dist/bits/navigation-menu/components/navigation-menu-indicator.svelte +2 -2
- package/dist/bits/navigation-menu/components/navigation-menu-item.svelte +5 -5
- package/dist/bits/navigation-menu/components/navigation-menu-link.svelte +5 -5
- package/dist/bits/navigation-menu/components/navigation-menu-list.svelte +3 -3
- package/dist/bits/navigation-menu/components/navigation-menu-sub.svelte +5 -5
- package/dist/bits/navigation-menu/components/navigation-menu-sub.svelte.d.ts +1 -1
- package/dist/bits/navigation-menu/components/navigation-menu-trigger.svelte +4 -4
- package/dist/bits/navigation-menu/components/navigation-menu-viewport.svelte +3 -3
- package/dist/bits/navigation-menu/components/navigation-menu.svelte +8 -8
- package/dist/bits/navigation-menu/components/navigation-menu.svelte.d.ts +1 -1
- package/dist/bits/navigation-menu/navigation-menu.svelte.d.ts +6 -6
- package/dist/bits/navigation-menu/navigation-menu.svelte.js +23 -23
- package/dist/bits/pagination/components/pagination-next-button.svelte +4 -4
- package/dist/bits/pagination/components/pagination-page.svelte +5 -5
- package/dist/bits/pagination/components/pagination-prev-button.svelte +4 -4
- package/dist/bits/pagination/components/pagination.svelte +9 -9
- package/dist/bits/pagination/pagination.svelte.d.ts +1 -1
- package/dist/bits/pagination/pagination.svelte.js +2 -2
- package/dist/bits/pin-input/components/pin-input-cell.svelte +4 -4
- package/dist/bits/pin-input/components/pin-input.svelte +14 -14
- package/dist/bits/pin-input/components/pin-input.svelte.d.ts +1 -1
- package/dist/bits/pin-input/pin-input.svelte.d.ts +2 -2
- package/dist/bits/pin-input/pin-input.svelte.js +5 -5
- package/dist/bits/popover/components/popover-close.svelte +3 -3
- package/dist/bits/popover/components/popover-content-static.svelte +6 -6
- package/dist/bits/popover/components/popover-content.svelte +6 -6
- package/dist/bits/popover/components/popover-trigger.svelte +4 -4
- package/dist/bits/popover/components/popover.svelte +3 -3
- package/dist/bits/popover/popover.svelte.js +4 -4
- package/dist/bits/progress/components/progress.svelte +6 -6
- package/dist/bits/radio-group/components/radio-group-item.svelte +5 -5
- package/dist/bits/radio-group/components/radio-group.svelte +10 -10
- package/dist/bits/radio-group/components/radio-group.svelte.d.ts +1 -1
- package/dist/bits/radio-group/radio-group.svelte.js +7 -7
- package/dist/bits/range-calendar/components/range-calendar-cell.svelte +5 -5
- package/dist/bits/range-calendar/components/range-calendar-day.svelte +3 -3
- package/dist/bits/range-calendar/components/range-calendar.svelte +26 -26
- package/dist/bits/range-calendar/components/range-calendar.svelte.d.ts +1 -1
- package/dist/bits/range-calendar/range-calendar.svelte.js +7 -7
- package/dist/bits/rating-group/components/rating-group-item.svelte +5 -5
- package/dist/bits/rating-group/components/rating-group.svelte +14 -14
- package/dist/bits/rating-group/components/rating-group.svelte.d.ts +1 -1
- package/dist/bits/rating-group/rating-group.svelte.js +4 -4
- package/dist/bits/scroll-area/components/scroll-area-corner-impl.svelte +3 -3
- 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 +4 -4
- package/dist/bits/scroll-area/components/scroll-area-thumb-impl.svelte +4 -4
- package/dist/bits/scroll-area/components/scroll-area-viewport.svelte +3 -3
- package/dist/bits/scroll-area/components/scroll-area.svelte +6 -6
- package/dist/bits/scroll-area/scroll-area.svelte.d.ts +2 -2
- package/dist/bits/scroll-area/scroll-area.svelte.js +6 -7
- package/dist/bits/select/components/select-content-static.svelte +5 -5
- package/dist/bits/select/components/select-content.svelte +5 -5
- package/dist/bits/select/components/select-group-heading.svelte +3 -3
- package/dist/bits/select/components/select-group.svelte +3 -3
- package/dist/bits/select/components/select-hidden-input.svelte +2 -2
- package/dist/bits/select/components/select-item.svelte +8 -8
- package/dist/bits/select/components/select-scroll-down-button.svelte +4 -4
- package/dist/bits/select/components/select-scroll-up-button.svelte +4 -4
- package/dist/bits/select/components/select-trigger.svelte +3 -3
- package/dist/bits/select/components/select-viewport.svelte +3 -3
- package/dist/bits/select/components/select.svelte +12 -12
- package/dist/bits/select/select.svelte.js +12 -12
- package/dist/bits/separator/components/separator.svelte +5 -5
- package/dist/bits/separator/separator.svelte.d.ts +2 -2
- package/dist/bits/separator/separator.svelte.js +4 -4
- package/dist/bits/slider/components/slider-range.svelte +3 -3
- package/dist/bits/slider/components/slider-thumb-label.svelte +5 -5
- package/dist/bits/slider/components/slider-thumb.svelte +5 -5
- package/dist/bits/slider/components/slider-tick-label.svelte +5 -5
- package/dist/bits/slider/components/slider-tick.svelte +4 -4
- package/dist/bits/slider/components/slider.svelte +14 -14
- package/dist/bits/slider/components/slider.svelte.d.ts +1 -1
- package/dist/bits/slider/slider.svelte.d.ts +16 -16
- package/dist/bits/slider/slider.svelte.js +20 -20
- package/dist/bits/switch/components/switch-thumb.svelte +3 -3
- package/dist/bits/switch/components/switch.svelte +8 -8
- package/dist/bits/switch/components/switch.svelte.d.ts +1 -1
- package/dist/bits/switch/switch.svelte.js +5 -5
- package/dist/bits/tabs/components/tabs-content.svelte +4 -4
- package/dist/bits/tabs/components/tabs-list.svelte +3 -3
- package/dist/bits/tabs/components/tabs-trigger.svelte +5 -5
- package/dist/bits/tabs/components/tabs.svelte +8 -8
- package/dist/bits/tabs/components/tabs.svelte.d.ts +1 -1
- package/dist/bits/tabs/tabs.svelte.d.ts +5 -5
- package/dist/bits/tabs/tabs.svelte.js +11 -11
- package/dist/bits/time-field/components/time-field-input.svelte +4 -4
- package/dist/bits/time-field/components/time-field-label.svelte +3 -3
- package/dist/bits/time-field/components/time-field-segment.svelte +3 -3
- package/dist/bits/time-field/components/time-field.svelte +16 -16
- package/dist/bits/time-field/time-field.svelte.js +15 -15
- package/dist/bits/time-range-field/components/time-range-field-input.svelte +4 -4
- package/dist/bits/time-range-field/components/time-range-field-label.svelte +3 -3
- package/dist/bits/time-range-field/components/time-range-field.svelte +19 -19
- package/dist/bits/time-range-field/components/time-range-field.svelte.d.ts +1 -1
- package/dist/bits/time-range-field/time-range-field.svelte.js +7 -7
- package/dist/bits/toggle/components/toggle.svelte +5 -5
- package/dist/bits/toggle/toggle.svelte.d.ts +0 -1
- package/dist/bits/toggle/toggle.svelte.js +5 -10
- package/dist/bits/toggle-group/components/toggle-group-item.svelte +5 -5
- package/dist/bits/toggle-group/components/toggle-group.svelte +8 -8
- package/dist/bits/toggle-group/components/toggle-group.svelte.d.ts +1 -1
- package/dist/bits/toggle-group/toggle-group.svelte.d.ts +2 -2
- package/dist/bits/toggle-group/toggle-group.svelte.js +7 -7
- package/dist/bits/toolbar/components/toolbar-button.svelte +4 -4
- package/dist/bits/toolbar/components/toolbar-group-item.svelte +5 -5
- package/dist/bits/toolbar/components/toolbar-group.svelte +5 -5
- package/dist/bits/toolbar/components/toolbar-group.svelte.d.ts +1 -1
- package/dist/bits/toolbar/components/toolbar-link.svelte +3 -3
- package/dist/bits/toolbar/components/toolbar.svelte +5 -5
- package/dist/bits/toolbar/toolbar.svelte.d.ts +4 -4
- package/dist/bits/toolbar/toolbar.svelte.js +11 -11
- package/dist/bits/tooltip/components/tooltip-content-static.svelte +5 -5
- package/dist/bits/tooltip/components/tooltip-content.svelte +7 -5
- package/dist/bits/tooltip/components/tooltip-provider.svelte +7 -7
- package/dist/bits/tooltip/components/tooltip-trigger.svelte +4 -4
- package/dist/bits/tooltip/components/tooltip.svelte +8 -8
- package/dist/bits/tooltip/tooltip.svelte.js +7 -7
- package/dist/bits/tooltip/types.d.ts +1 -1
- package/dist/bits/utilities/config/bits-config.js +2 -2
- package/dist/bits/utilities/config/components/bits-config.svelte +3 -3
- package/dist/bits/utilities/config/prop-resolvers.js +2 -2
- package/dist/bits/utilities/dismissible-layer/dismissible-layer.svelte +7 -7
- package/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.js +4 -3
- package/dist/bits/utilities/escape-layer/escape-layer.svelte +4 -4
- package/dist/bits/utilities/floating-layer/components/floating-layer-anchor.svelte +3 -3
- package/dist/bits/utilities/floating-layer/components/floating-layer-arrow.svelte +3 -3
- package/dist/bits/utilities/floating-layer/components/floating-layer-content.svelte +20 -20
- package/dist/bits/utilities/floating-layer/use-floating-layer.svelte.d.ts +3 -3
- package/dist/bits/utilities/floating-layer/use-floating-layer.svelte.js +9 -9
- package/dist/bits/utilities/focus-scope/focus-scope-manager.js +2 -2
- package/dist/bits/utilities/focus-scope/focus-scope.svelte +5 -5
- package/dist/bits/utilities/presence-layer/presence-layer.svelte +2 -2
- package/dist/bits/utilities/text-selection-layer/text-selection-layer.svelte +5 -5
- package/dist/internal/attrs.d.ts +4 -19
- package/dist/internal/attrs.js +11 -56
- package/dist/internal/body-scroll-lock.svelte.js +5 -5
- package/dist/internal/box-auto-reset.svelte.js +2 -2
- package/dist/internal/date-time/calendar-helpers.svelte.js +4 -4
- package/dist/internal/events.d.ts +0 -6
- package/dist/internal/events.js +0 -17
- package/dist/internal/floating-svelte/use-floating.svelte.js +2 -2
- package/dist/internal/state-machine.js +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { SwitchThumbProps } from "../types.js";
|
|
4
4
|
import { SwitchThumbState } from "../switch.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
}: SwitchThumbProps = $props();
|
|
16
16
|
|
|
17
17
|
const thumbState = SwitchThumbState.create({
|
|
18
|
-
id:
|
|
19
|
-
ref:
|
|
18
|
+
id: boxWith(() => id),
|
|
19
|
+
ref: boxWith(
|
|
20
20
|
() => ref,
|
|
21
21
|
(v) => (ref = v)
|
|
22
22
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { SwitchRootProps } from "../types.js";
|
|
4
4
|
import { SwitchRootState } from "../switch.svelte.js";
|
|
5
5
|
import SwitchInput from "./switch-input.svelte";
|
|
@@ -24,19 +24,19 @@
|
|
|
24
24
|
}: SwitchRootProps = $props();
|
|
25
25
|
|
|
26
26
|
const rootState = SwitchRootState.create({
|
|
27
|
-
checked:
|
|
27
|
+
checked: boxWith(
|
|
28
28
|
() => checked,
|
|
29
29
|
(v) => {
|
|
30
30
|
checked = v;
|
|
31
31
|
onCheckedChange?.(v);
|
|
32
32
|
}
|
|
33
33
|
),
|
|
34
|
-
disabled:
|
|
35
|
-
required:
|
|
36
|
-
value:
|
|
37
|
-
name:
|
|
38
|
-
id:
|
|
39
|
-
ref:
|
|
34
|
+
disabled: boxWith(() => disabled ?? false),
|
|
35
|
+
required: boxWith(() => required),
|
|
36
|
+
value: boxWith(() => value),
|
|
37
|
+
name: boxWith(() => name),
|
|
38
|
+
id: boxWith(() => id),
|
|
39
|
+
ref: boxWith(
|
|
40
40
|
() => ref,
|
|
41
41
|
(v) => (ref = v)
|
|
42
42
|
),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { SwitchRootProps } from "../types.js";
|
|
2
|
-
declare const Switch: import("svelte").Component<SwitchRootProps, {}, "
|
|
2
|
+
declare const Switch: import("svelte").Component<SwitchRootProps, {}, "ref" | "checked">;
|
|
3
3
|
type Switch = ReturnType<typeof Switch>;
|
|
4
4
|
export default Switch;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { attachRef } from "svelte-toolbelt";
|
|
2
2
|
import { Context } from "runed";
|
|
3
|
-
import { getAriaChecked,
|
|
3
|
+
import { getAriaChecked, boolToStr, getDataChecked, boolToTrueOrUndef, createBitsAttrs, boolToEmptyStrOrUndef, } from "../../internal/attrs.js";
|
|
4
4
|
import { kbd } from "../../internal/kbd.js";
|
|
5
5
|
const switchAttrs = createBitsAttrs({
|
|
6
6
|
component: "switch",
|
|
@@ -34,9 +34,9 @@ export class SwitchRootState {
|
|
|
34
34
|
this.#toggle();
|
|
35
35
|
}
|
|
36
36
|
sharedProps = $derived.by(() => ({
|
|
37
|
-
"data-disabled":
|
|
37
|
+
"data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current),
|
|
38
38
|
"data-state": getDataChecked(this.opts.checked.current),
|
|
39
|
-
"data-required":
|
|
39
|
+
"data-required": boolToEmptyStrOrUndef(this.opts.required.current),
|
|
40
40
|
}));
|
|
41
41
|
snippetProps = $derived.by(() => ({
|
|
42
42
|
checked: this.opts.checked.current,
|
|
@@ -45,9 +45,9 @@ export class SwitchRootState {
|
|
|
45
45
|
...this.sharedProps,
|
|
46
46
|
id: this.opts.id.current,
|
|
47
47
|
role: "switch",
|
|
48
|
-
disabled:
|
|
48
|
+
disabled: boolToTrueOrUndef(this.opts.disabled.current),
|
|
49
49
|
"aria-checked": getAriaChecked(this.opts.checked.current, false),
|
|
50
|
-
"aria-required":
|
|
50
|
+
"aria-required": boolToStr(this.opts.required.current),
|
|
51
51
|
[switchAttrs.root]: "",
|
|
52
52
|
//
|
|
53
53
|
onclick: this.onclick,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { TabsContentProps } from "../types.js";
|
|
4
4
|
import { TabsContentState } from "../tabs.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
}: TabsContentProps = $props();
|
|
17
17
|
|
|
18
18
|
const contentState = TabsContentState.create({
|
|
19
|
-
value:
|
|
20
|
-
id:
|
|
21
|
-
ref:
|
|
19
|
+
value: boxWith(() => value),
|
|
20
|
+
id: boxWith(() => id),
|
|
21
|
+
ref: boxWith(
|
|
22
22
|
() => ref,
|
|
23
23
|
(v) => (ref = v)
|
|
24
24
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { TabsListProps } from "../types.js";
|
|
4
4
|
import { TabsListState } from "../tabs.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
}: TabsListProps = $props();
|
|
16
16
|
|
|
17
17
|
const listState = TabsListState.create({
|
|
18
|
-
id:
|
|
19
|
-
ref:
|
|
18
|
+
id: boxWith(() => id),
|
|
19
|
+
ref: boxWith(
|
|
20
20
|
() => ref,
|
|
21
21
|
(v) => (ref = v)
|
|
22
22
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { TabsTriggerProps } from "../types.js";
|
|
4
4
|
import { TabsTriggerState } from "../tabs.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
}: TabsTriggerProps = $props();
|
|
19
19
|
|
|
20
20
|
const triggerState = TabsTriggerState.create({
|
|
21
|
-
id:
|
|
22
|
-
disabled:
|
|
23
|
-
value:
|
|
24
|
-
ref:
|
|
21
|
+
id: boxWith(() => id),
|
|
22
|
+
disabled: boxWith(() => disabled ?? false),
|
|
23
|
+
value: boxWith(() => value),
|
|
24
|
+
ref: boxWith(
|
|
25
25
|
() => ref,
|
|
26
26
|
(v) => (ref = v)
|
|
27
27
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { TabsRootProps } from "../types.js";
|
|
4
4
|
import { TabsRootState } from "../tabs.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
}: TabsRootProps = $props();
|
|
23
23
|
|
|
24
24
|
const rootState = TabsRootState.create({
|
|
25
|
-
id:
|
|
26
|
-
value:
|
|
25
|
+
id: boxWith(() => id),
|
|
26
|
+
value: boxWith(
|
|
27
27
|
() => value,
|
|
28
28
|
(v) => {
|
|
29
29
|
value = v;
|
|
30
30
|
onValueChange(v);
|
|
31
31
|
}
|
|
32
32
|
),
|
|
33
|
-
orientation:
|
|
34
|
-
loop:
|
|
35
|
-
activationMode:
|
|
36
|
-
disabled:
|
|
37
|
-
ref:
|
|
33
|
+
orientation: boxWith(() => orientation),
|
|
34
|
+
loop: boxWith(() => loop),
|
|
35
|
+
activationMode: boxWith(() => activationMode),
|
|
36
|
+
disabled: boxWith(() => disabled),
|
|
37
|
+
ref: boxWith(
|
|
38
38
|
() => ref,
|
|
39
39
|
(v) => (ref = v)
|
|
40
40
|
),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { TabsRootProps } from "../types.js";
|
|
2
|
-
declare const Tabs: import("svelte").Component<TabsRootProps, {}, "
|
|
2
|
+
declare const Tabs: import("svelte").Component<TabsRootProps, {}, "ref" | "value">;
|
|
3
3
|
type Tabs = ReturnType<typeof Tabs>;
|
|
4
4
|
export default Tabs;
|
|
@@ -27,7 +27,7 @@ export declare class TabsRootState {
|
|
|
27
27
|
setValue(v: string): void;
|
|
28
28
|
readonly props: {
|
|
29
29
|
readonly id: string;
|
|
30
|
-
readonly "data-orientation":
|
|
30
|
+
readonly "data-orientation": Orientation;
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
interface TabsListStateOpts extends WithRefOpts {
|
|
@@ -42,8 +42,8 @@ export declare class TabsListState {
|
|
|
42
42
|
readonly props: {
|
|
43
43
|
readonly id: string;
|
|
44
44
|
readonly role: "tablist";
|
|
45
|
-
readonly "aria-orientation":
|
|
46
|
-
readonly "data-orientation":
|
|
45
|
+
readonly "aria-orientation": Orientation;
|
|
46
|
+
readonly "data-orientation": Orientation;
|
|
47
47
|
readonly "data-disabled": "" | undefined;
|
|
48
48
|
};
|
|
49
49
|
}
|
|
@@ -67,7 +67,7 @@ export declare class TabsTriggerState {
|
|
|
67
67
|
readonly role: "tab";
|
|
68
68
|
readonly "data-state": "active" | "inactive";
|
|
69
69
|
readonly "data-value": string;
|
|
70
|
-
readonly "data-orientation":
|
|
70
|
+
readonly "data-orientation": Orientation;
|
|
71
71
|
readonly "data-disabled": "" | undefined;
|
|
72
72
|
readonly "aria-selected": "true" | "false";
|
|
73
73
|
readonly "aria-controls": string | undefined;
|
|
@@ -97,7 +97,7 @@ export declare class TabsContentState {
|
|
|
97
97
|
readonly "data-value": string;
|
|
98
98
|
readonly "data-state": "active" | "inactive";
|
|
99
99
|
readonly "aria-labelledby": string | undefined;
|
|
100
|
-
readonly "data-orientation":
|
|
100
|
+
readonly "data-orientation": Orientation;
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SvelteMap } from "svelte/reactivity";
|
|
2
2
|
import { attachRef } from "svelte-toolbelt";
|
|
3
3
|
import { Context, watch } from "runed";
|
|
4
|
-
import { createBitsAttrs,
|
|
4
|
+
import { createBitsAttrs, boolToStr, boolToEmptyStrOrUndef, boolToTrueOrUndef, } from "../../internal/attrs.js";
|
|
5
5
|
import { kbd } from "../../internal/kbd.js";
|
|
6
6
|
import { RovingFocusGroup } from "../../internal/roving-focus-group.js";
|
|
7
7
|
const tabsAttrs = createBitsAttrs({
|
|
@@ -52,7 +52,7 @@ export class TabsRootState {
|
|
|
52
52
|
}
|
|
53
53
|
props = $derived.by(() => ({
|
|
54
54
|
id: this.opts.id.current,
|
|
55
|
-
"data-orientation":
|
|
55
|
+
"data-orientation": this.opts.orientation.current,
|
|
56
56
|
[tabsAttrs.root]: "",
|
|
57
57
|
...this.attachment,
|
|
58
58
|
}));
|
|
@@ -73,10 +73,10 @@ export class TabsListState {
|
|
|
73
73
|
props = $derived.by(() => ({
|
|
74
74
|
id: this.opts.id.current,
|
|
75
75
|
role: "tablist",
|
|
76
|
-
"aria-orientation":
|
|
77
|
-
"data-orientation":
|
|
76
|
+
"aria-orientation": this.root.opts.orientation.current,
|
|
77
|
+
"data-orientation": this.root.opts.orientation.current,
|
|
78
78
|
[tabsAttrs.list]: "",
|
|
79
|
-
"data-disabled":
|
|
79
|
+
"data-disabled": boolToEmptyStrOrUndef(this.#isDisabled),
|
|
80
80
|
...this.attachment,
|
|
81
81
|
}));
|
|
82
82
|
}
|
|
@@ -141,12 +141,12 @@ export class TabsTriggerState {
|
|
|
141
141
|
role: "tab",
|
|
142
142
|
"data-state": getTabDataState(this.#isActive),
|
|
143
143
|
"data-value": this.opts.value.current,
|
|
144
|
-
"data-orientation":
|
|
145
|
-
"data-disabled":
|
|
146
|
-
"aria-selected":
|
|
144
|
+
"data-orientation": this.root.opts.orientation.current,
|
|
145
|
+
"data-disabled": boolToEmptyStrOrUndef(this.#isDisabled),
|
|
146
|
+
"aria-selected": boolToStr(this.#isActive),
|
|
147
147
|
"aria-controls": this.#ariaControls,
|
|
148
148
|
[tabsAttrs.trigger]: "",
|
|
149
|
-
disabled:
|
|
149
|
+
disabled: boolToTrueOrUndef(this.#isDisabled),
|
|
150
150
|
tabindex: this.#tabIndex,
|
|
151
151
|
//
|
|
152
152
|
onclick: this.onclick,
|
|
@@ -175,12 +175,12 @@ export class TabsContentState {
|
|
|
175
175
|
props = $derived.by(() => ({
|
|
176
176
|
id: this.opts.id.current,
|
|
177
177
|
role: "tabpanel",
|
|
178
|
-
hidden:
|
|
178
|
+
hidden: boolToTrueOrUndef(!this.#isActive),
|
|
179
179
|
tabindex: 0,
|
|
180
180
|
"data-value": this.opts.value.current,
|
|
181
181
|
"data-state": getTabDataState(this.#isActive),
|
|
182
182
|
"aria-labelledby": this.#ariaLabelledBy,
|
|
183
|
-
"data-orientation":
|
|
183
|
+
"data-orientation": this.root.opts.orientation.current,
|
|
184
184
|
[tabsAttrs.content]: "",
|
|
185
185
|
...this.attachment,
|
|
186
186
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import { TimeFieldInputState } from "../time-field.svelte.js";
|
|
4
4
|
import type { TimeFieldInputProps } from "../types.js";
|
|
5
5
|
import DateFieldHiddenInput from "./time-field-hidden-input.svelte";
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
}: TimeFieldInputProps = $props();
|
|
18
18
|
|
|
19
19
|
const inputState = TimeFieldInputState.create({
|
|
20
|
-
id:
|
|
21
|
-
ref:
|
|
20
|
+
id: boxWith(() => id),
|
|
21
|
+
ref: boxWith(
|
|
22
22
|
() => ref,
|
|
23
23
|
(v) => (ref = v)
|
|
24
24
|
),
|
|
25
|
-
name:
|
|
25
|
+
name: boxWith(() => name),
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const mergedProps = $derived(mergeProps(restProps, inputState.props));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import { TimeFieldLabelState } from "../time-field.svelte.js";
|
|
4
4
|
import type { TimeFieldLabelProps } from "../types.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
}: TimeFieldLabelProps = $props();
|
|
16
16
|
|
|
17
17
|
const labelState = TimeFieldLabelState.create({
|
|
18
|
-
id:
|
|
19
|
-
ref:
|
|
18
|
+
id: boxWith(() => id),
|
|
19
|
+
ref: boxWith(
|
|
20
20
|
() => ref,
|
|
21
21
|
(v) => (ref = v)
|
|
22
22
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import { DateFieldSegmentState } from "../time-field.svelte.js";
|
|
4
4
|
import type { TimeFieldSegmentProps } from "../types.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
}: TimeFieldSegmentProps = $props();
|
|
17
17
|
|
|
18
18
|
const segmentState = DateFieldSegmentState.create(part, {
|
|
19
|
-
id:
|
|
20
|
-
ref:
|
|
19
|
+
id: boxWith(() => id),
|
|
20
|
+
ref: boxWith(
|
|
21
21
|
() => ref,
|
|
22
22
|
(v) => (ref = v)
|
|
23
23
|
),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<script lang="ts" generics="T extends TimeValue = Time">
|
|
8
8
|
import { watch } from "runed";
|
|
9
|
-
import {
|
|
9
|
+
import { boxWith } from "svelte-toolbelt";
|
|
10
10
|
import { TimeFieldRootState } from "../time-field.svelte.js";
|
|
11
11
|
import type { TimeFieldRootProps } from "../types.js";
|
|
12
12
|
import { noop } from "../../../internal/noop.js";
|
|
@@ -61,34 +61,34 @@
|
|
|
61
61
|
);
|
|
62
62
|
|
|
63
63
|
TimeFieldRootState.create({
|
|
64
|
-
value:
|
|
64
|
+
value: boxWith(
|
|
65
65
|
() => value,
|
|
66
66
|
(v) => {
|
|
67
67
|
value = v;
|
|
68
68
|
onValueChange(v);
|
|
69
69
|
}
|
|
70
70
|
),
|
|
71
|
-
placeholder:
|
|
71
|
+
placeholder: boxWith(
|
|
72
72
|
() => placeholder as TimeValue,
|
|
73
73
|
(v) => {
|
|
74
74
|
placeholder = v;
|
|
75
75
|
onPlaceholderChange(v);
|
|
76
76
|
}
|
|
77
77
|
),
|
|
78
|
-
disabled:
|
|
79
|
-
granularity:
|
|
80
|
-
hideTimeZone:
|
|
81
|
-
hourCycle:
|
|
78
|
+
disabled: boxWith(() => disabled),
|
|
79
|
+
granularity: boxWith(() => granularity),
|
|
80
|
+
hideTimeZone: boxWith(() => hideTimeZone),
|
|
81
|
+
hourCycle: boxWith(() => hourCycle),
|
|
82
82
|
locale: resolveLocaleProp(() => locale),
|
|
83
|
-
maxValue:
|
|
84
|
-
minValue:
|
|
85
|
-
validate:
|
|
86
|
-
readonly:
|
|
87
|
-
readonlySegments:
|
|
88
|
-
required:
|
|
89
|
-
onInvalid:
|
|
90
|
-
errorMessageId:
|
|
91
|
-
isInvalidProp:
|
|
83
|
+
maxValue: boxWith(() => maxValue),
|
|
84
|
+
minValue: boxWith(() => minValue),
|
|
85
|
+
validate: boxWith(() => validate),
|
|
86
|
+
readonly: boxWith(() => readonly),
|
|
87
|
+
readonlySegments: boxWith(() => readonlySegments),
|
|
88
|
+
required: boxWith(() => required),
|
|
89
|
+
onInvalid: boxWith(() => onInvalid),
|
|
90
|
+
errorMessageId: boxWith(() => errorMessageId),
|
|
91
|
+
isInvalidProp: boxWith(() => undefined),
|
|
92
92
|
});
|
|
93
93
|
</script>
|
|
94
94
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CalendarDateTime, Time, ZonedDateTime } from "@internationalized/date";
|
|
2
|
-
import { onDestroyEffect, attachRef,
|
|
2
|
+
import { onDestroyEffect, attachRef, DOMContext, simpleBox, } from "svelte-toolbelt";
|
|
3
3
|
import { onMount, untrack } from "svelte";
|
|
4
4
|
import { Context, watch } from "runed";
|
|
5
|
-
import { createBitsAttrs,
|
|
5
|
+
import { createBitsAttrs, boolToStr, boolToStrTrueOrUndef, boolToEmptyStrOrUndef, } from "../../internal/attrs.js";
|
|
6
6
|
import { isBrowser, isNumberString } from "../../internal/is.js";
|
|
7
7
|
import { kbd } from "../../internal/kbd.js";
|
|
8
8
|
import { useId } from "../../internal/use-id.js";
|
|
@@ -112,7 +112,7 @@ export class TimeFieldRootState {
|
|
|
112
112
|
*/
|
|
113
113
|
this.value = props.value;
|
|
114
114
|
this.placeholder = rangeRoot ? rangeRoot.opts.placeholder : props.placeholder;
|
|
115
|
-
this.validate = rangeRoot ?
|
|
115
|
+
this.validate = rangeRoot ? simpleBox(undefined) : props.validate;
|
|
116
116
|
this.minValue = rangeRoot ? rangeRoot.opts.minValue : props.minValue;
|
|
117
117
|
this.maxValue = rangeRoot ? rangeRoot.opts.maxValue : props.maxValue;
|
|
118
118
|
this.disabled = rangeRoot ? rangeRoot.opts.disabled : props.disabled;
|
|
@@ -427,12 +427,12 @@ export class TimeFieldRootState {
|
|
|
427
427
|
getBaseSegmentAttrs(part, segmentId) {
|
|
428
428
|
const inReadonlySegments = this.readonlySegmentsSet.has(part);
|
|
429
429
|
const defaultAttrs = {
|
|
430
|
-
"aria-invalid":
|
|
431
|
-
"aria-disabled":
|
|
432
|
-
"aria-readonly":
|
|
433
|
-
"data-invalid":
|
|
434
|
-
"data-disabled":
|
|
435
|
-
"data-readonly":
|
|
430
|
+
"aria-invalid": boolToStrTrueOrUndef(this.isInvalid),
|
|
431
|
+
"aria-disabled": boolToStr(this.disabled.current),
|
|
432
|
+
"aria-readonly": boolToStr(this.readonly.current || inReadonlySegments),
|
|
433
|
+
"data-invalid": boolToEmptyStrOrUndef(this.isInvalid),
|
|
434
|
+
"data-disabled": boolToEmptyStrOrUndef(this.disabled.current),
|
|
435
|
+
"data-readonly": boolToEmptyStrOrUndef(this.readonly.current || inReadonlySegments),
|
|
436
436
|
"data-segment": `${part}`,
|
|
437
437
|
};
|
|
438
438
|
if (part === "literal")
|
|
@@ -486,9 +486,9 @@ export class TimeFieldInputState {
|
|
|
486
486
|
role: "group",
|
|
487
487
|
"aria-labelledby": this.root.getLabelNode()?.id ?? undefined,
|
|
488
488
|
"aria-describedby": this.#ariaDescribedBy,
|
|
489
|
-
"aria-disabled":
|
|
489
|
+
"aria-disabled": boolToStr(this.root.disabled.current),
|
|
490
490
|
"data-invalid": this.root.isInvalid ? "" : undefined,
|
|
491
|
-
"data-disabled":
|
|
491
|
+
"data-disabled": boolToEmptyStrOrUndef(this.root.disabled.current),
|
|
492
492
|
[timeFieldAttrs.input]: "",
|
|
493
493
|
...this.attachment,
|
|
494
494
|
}));
|
|
@@ -532,8 +532,8 @@ export class TimeFieldLabelState {
|
|
|
532
532
|
}
|
|
533
533
|
props = $derived.by(() => ({
|
|
534
534
|
id: this.opts.id.current,
|
|
535
|
-
"data-invalid":
|
|
536
|
-
"data-disabled":
|
|
535
|
+
"data-invalid": boolToEmptyStrOrUndef(this.root.isInvalid),
|
|
536
|
+
"data-disabled": boolToEmptyStrOrUndef(this.root.disabled.current),
|
|
537
537
|
[timeFieldAttrs.label]: "",
|
|
538
538
|
onclick: this.onclick,
|
|
539
539
|
...this.attachment,
|
|
@@ -911,7 +911,7 @@ class TimeFieldLiteralSegmentState {
|
|
|
911
911
|
}
|
|
912
912
|
props = $derived.by(() => ({
|
|
913
913
|
id: this.opts.id.current,
|
|
914
|
-
"aria-hidden":
|
|
914
|
+
"aria-hidden": boolToStrTrueOrUndef(true),
|
|
915
915
|
...this.root.getBaseSegmentAttrs("literal", this.opts.id.current),
|
|
916
916
|
...this.attachment,
|
|
917
917
|
}));
|
|
@@ -945,7 +945,7 @@ class TimeFieldTimeZoneSegmentState {
|
|
|
945
945
|
onkeydown: this.onkeydown,
|
|
946
946
|
tabindex: 0,
|
|
947
947
|
...this.root.getBaseSegmentAttrs("timeZoneName", this.opts.id.current),
|
|
948
|
-
"data-readonly":
|
|
948
|
+
"data-readonly": boolToEmptyStrOrUndef(true),
|
|
949
949
|
...this.attachment,
|
|
950
950
|
}));
|
|
951
951
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { TimeRangeFieldInputProps } from "../types.js";
|
|
4
4
|
import { TimeRangeFieldInputState } from "../time-range-field.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
|
|
20
20
|
const inputState = TimeRangeFieldInputState.create(
|
|
21
21
|
{
|
|
22
|
-
id:
|
|
23
|
-
ref:
|
|
22
|
+
id: boxWith(() => id),
|
|
23
|
+
ref: boxWith(
|
|
24
24
|
() => ref,
|
|
25
25
|
(v) => (ref = v)
|
|
26
26
|
),
|
|
27
|
-
name:
|
|
27
|
+
name: boxWith(() => name),
|
|
28
28
|
},
|
|
29
29
|
type
|
|
30
30
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import { TimeRangeFieldLabelState } from "../time-range-field.svelte.js";
|
|
4
4
|
import type { TimeRangeFieldLabelProps } from "../types.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
}: TimeRangeFieldLabelProps = $props();
|
|
16
16
|
|
|
17
17
|
const labelState = TimeRangeFieldLabelState.create({
|
|
18
|
-
id:
|
|
19
|
-
ref:
|
|
18
|
+
id: boxWith(() => id),
|
|
19
|
+
ref: boxWith(
|
|
20
20
|
() => ref,
|
|
21
21
|
(v) => (ref = v)
|
|
22
22
|
),
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<script lang="ts" generics="T extends TimeValue = Time">
|
|
9
9
|
import { watch } from "runed";
|
|
10
|
-
import {
|
|
10
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
11
11
|
import { TimeRangeFieldRootState } from "../time-range-field.svelte.js";
|
|
12
12
|
import type { TimeRangeFieldRootProps } from "../types.js";
|
|
13
13
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -85,52 +85,52 @@
|
|
|
85
85
|
);
|
|
86
86
|
|
|
87
87
|
const rootState = TimeRangeFieldRootState.create({
|
|
88
|
-
id:
|
|
89
|
-
ref:
|
|
88
|
+
id: boxWith(() => id),
|
|
89
|
+
ref: boxWith(
|
|
90
90
|
() => ref,
|
|
91
91
|
(v) => (ref = v)
|
|
92
92
|
),
|
|
93
|
-
disabled:
|
|
94
|
-
readonly:
|
|
95
|
-
required:
|
|
96
|
-
hourCycle:
|
|
97
|
-
granularity:
|
|
93
|
+
disabled: boxWith(() => disabled),
|
|
94
|
+
readonly: boxWith(() => readonly),
|
|
95
|
+
required: boxWith(() => required),
|
|
96
|
+
hourCycle: boxWith(() => hourCycle),
|
|
97
|
+
granularity: boxWith(() => granularity),
|
|
98
98
|
locale: resolveLocaleProp(() => locale),
|
|
99
|
-
hideTimeZone:
|
|
100
|
-
validate:
|
|
101
|
-
maxValue:
|
|
102
|
-
minValue:
|
|
103
|
-
placeholder:
|
|
99
|
+
hideTimeZone: boxWith(() => hideTimeZone),
|
|
100
|
+
validate: boxWith(() => validate),
|
|
101
|
+
maxValue: boxWith(() => maxValue),
|
|
102
|
+
minValue: boxWith(() => minValue),
|
|
103
|
+
placeholder: boxWith(
|
|
104
104
|
() => placeholder as TimeValue,
|
|
105
105
|
(v) => {
|
|
106
106
|
placeholder = v;
|
|
107
107
|
onPlaceholderChange(v);
|
|
108
108
|
}
|
|
109
109
|
),
|
|
110
|
-
readonlySegments:
|
|
111
|
-
value:
|
|
110
|
+
readonlySegments: boxWith(() => readonlySegments),
|
|
111
|
+
value: boxWith(
|
|
112
112
|
() => value as TimeRange<T>,
|
|
113
113
|
(v) => {
|
|
114
114
|
value = v;
|
|
115
115
|
onValueChange(v);
|
|
116
116
|
}
|
|
117
117
|
),
|
|
118
|
-
startValue:
|
|
118
|
+
startValue: boxWith(
|
|
119
119
|
() => startValue,
|
|
120
120
|
(v) => {
|
|
121
121
|
startValue = v;
|
|
122
122
|
onStartValueChange(v);
|
|
123
123
|
}
|
|
124
124
|
),
|
|
125
|
-
endValue:
|
|
125
|
+
endValue: boxWith(
|
|
126
126
|
() => endValue,
|
|
127
127
|
(v) => {
|
|
128
128
|
endValue = v;
|
|
129
129
|
onEndValueChange(v);
|
|
130
130
|
}
|
|
131
131
|
),
|
|
132
|
-
onInvalid:
|
|
133
|
-
errorMessageId:
|
|
132
|
+
onInvalid: boxWith(() => onInvalid),
|
|
133
|
+
errorMessageId: boxWith(() => errorMessageId),
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
const mergedProps = $derived(mergeProps(restProps, rootState.props));
|
|
@@ -5,7 +5,7 @@ declare class __sveltets_Render<T extends TimeValue = Time> {
|
|
|
5
5
|
props(): TimeRangeFieldRootProps<T>;
|
|
6
6
|
events(): {};
|
|
7
7
|
slots(): {};
|
|
8
|
-
bindings(): "
|
|
8
|
+
bindings(): "ref" | "value" | "placeholder";
|
|
9
9
|
exports(): {};
|
|
10
10
|
}
|
|
11
11
|
interface $$IsomorphicComponent {
|