bits-ui 2.10.0 → 2.11.1
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 +12 -5
- 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 +24 -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.d.ts +3 -2
- package/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.js +8 -5
- 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,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 {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { boxWith, onDestroyEffect, attachRef, DOMContext, } from "svelte-toolbelt";
|
|
2
2
|
import { Context, watch } from "runed";
|
|
3
3
|
import { TimeFieldRootState } from "../time-field/time-field.svelte.js";
|
|
4
4
|
import { TimeFieldInputState } from "../time-field/time-field.svelte.js";
|
|
5
5
|
import { useId } from "../../internal/use-id.js";
|
|
6
|
-
import { createBitsAttrs,
|
|
6
|
+
import { createBitsAttrs, boolToEmptyStrOrUndef } from "../../internal/attrs.js";
|
|
7
7
|
import { createTimeFormatter } from "../../internal/date-time/formatter.js";
|
|
8
8
|
import { removeDescriptionElement } from "../../internal/date-time/field/helpers.js";
|
|
9
9
|
import { getFirstSegment } from "../../internal/date-time/field/segments.js";
|
|
@@ -161,7 +161,7 @@ export class TimeRangeFieldRootState {
|
|
|
161
161
|
id: this.opts.id.current,
|
|
162
162
|
role: "group",
|
|
163
163
|
[timeRangeFieldAttrs.root]: "",
|
|
164
|
-
"data-invalid":
|
|
164
|
+
"data-invalid": boolToEmptyStrOrUndef(this.isInvalid),
|
|
165
165
|
...this.attachment,
|
|
166
166
|
}));
|
|
167
167
|
}
|
|
@@ -187,8 +187,8 @@ export class TimeRangeFieldLabelState {
|
|
|
187
187
|
};
|
|
188
188
|
props = $derived.by(() => ({
|
|
189
189
|
id: this.opts.id.current,
|
|
190
|
-
"data-invalid":
|
|
191
|
-
"data-disabled":
|
|
190
|
+
"data-invalid": boolToEmptyStrOrUndef(this.root.isInvalid),
|
|
191
|
+
"data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current),
|
|
192
192
|
[timeRangeFieldAttrs.label]: "",
|
|
193
193
|
onclick: this.#onclick,
|
|
194
194
|
...this.attachment,
|
|
@@ -202,7 +202,7 @@ export class TimeRangeFieldInputState {
|
|
|
202
202
|
disabled: root.opts.disabled,
|
|
203
203
|
readonly: root.opts.readonly,
|
|
204
204
|
readonlySegments: root.opts.readonlySegments,
|
|
205
|
-
validate:
|
|
205
|
+
validate: boxWith(() => undefined),
|
|
206
206
|
minValue: root.opts.minValue,
|
|
207
207
|
maxValue: root.opts.maxValue,
|
|
208
208
|
hourCycle: root.opts.hourCycle,
|
|
@@ -213,7 +213,7 @@ export class TimeRangeFieldInputState {
|
|
|
213
213
|
placeholder: root.opts.placeholder,
|
|
214
214
|
onInvalid: root.opts.onInvalid,
|
|
215
215
|
errorMessageId: root.opts.errorMessageId,
|
|
216
|
-
isInvalidProp:
|
|
216
|
+
isInvalidProp: boxWith(() => root.isInvalid),
|
|
217
217
|
}, root);
|
|
218
218
|
return new TimeFieldInputState({ name: opts.name, id: opts.id, ref: opts.ref }, fieldState);
|
|
219
219
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { ToggleRootProps } from "../types.js";
|
|
4
4
|
import { ToggleRootState } from "../toggle.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
}: ToggleRootProps = $props();
|
|
21
21
|
|
|
22
22
|
const toggleState = ToggleRootState.create({
|
|
23
|
-
pressed:
|
|
23
|
+
pressed: boxWith(
|
|
24
24
|
() => pressed,
|
|
25
25
|
(v) => {
|
|
26
26
|
pressed = v;
|
|
27
27
|
onPressedChange(v);
|
|
28
28
|
}
|
|
29
29
|
),
|
|
30
|
-
disabled:
|
|
31
|
-
id:
|
|
32
|
-
ref:
|
|
30
|
+
disabled: boxWith(() => disabled ?? false),
|
|
31
|
+
id: boxWith(() => id),
|
|
32
|
+
ref: boxWith(
|
|
33
33
|
() => ref,
|
|
34
34
|
(v) => (ref = v)
|
|
35
35
|
),
|
|
@@ -8,7 +8,6 @@ interface ToggleRootStateOpts extends WithRefOpts, ReadableBoxedValues<{
|
|
|
8
8
|
}> {
|
|
9
9
|
}
|
|
10
10
|
export declare class ToggleRootState {
|
|
11
|
-
#private;
|
|
12
11
|
static create(opts: ToggleRootStateOpts): ToggleRootState;
|
|
13
12
|
readonly opts: ToggleRootStateOpts;
|
|
14
13
|
readonly attachment: RefAttachment;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { attachRef } from "svelte-toolbelt";
|
|
2
|
-
import { createBitsAttrs,
|
|
2
|
+
import { createBitsAttrs, boolToStr, boolToEmptyStrOrUndef, boolToTrueOrUndef, } from "../../internal/attrs.js";
|
|
3
3
|
export const toggleAttrs = createBitsAttrs({
|
|
4
4
|
component: "toggle",
|
|
5
5
|
parts: ["root"],
|
|
@@ -15,15 +15,10 @@ export class ToggleRootState {
|
|
|
15
15
|
this.attachment = attachRef(this.opts.ref);
|
|
16
16
|
this.onclick = this.onclick.bind(this);
|
|
17
17
|
}
|
|
18
|
-
#togglePressed() {
|
|
19
|
-
if (!this.opts.disabled.current) {
|
|
20
|
-
this.opts.pressed.current = !this.opts.pressed.current;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
18
|
onclick(_) {
|
|
24
19
|
if (this.opts.disabled.current)
|
|
25
20
|
return;
|
|
26
|
-
this
|
|
21
|
+
this.opts.pressed.current = !this.opts.pressed.current;
|
|
27
22
|
}
|
|
28
23
|
snippetProps = $derived.by(() => ({
|
|
29
24
|
pressed: this.opts.pressed.current,
|
|
@@ -31,10 +26,10 @@ export class ToggleRootState {
|
|
|
31
26
|
props = $derived.by(() => ({
|
|
32
27
|
[toggleAttrs.root]: "",
|
|
33
28
|
id: this.opts.id.current,
|
|
34
|
-
"data-disabled":
|
|
35
|
-
"aria-pressed":
|
|
29
|
+
"data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current),
|
|
30
|
+
"aria-pressed": boolToStr(this.opts.pressed.current),
|
|
36
31
|
"data-state": getToggleDataState(this.opts.pressed.current),
|
|
37
|
-
disabled:
|
|
32
|
+
disabled: boolToTrueOrUndef(this.opts.disabled.current),
|
|
38
33
|
onclick: this.onclick,
|
|
39
34
|
...this.attachment,
|
|
40
35
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { ToggleGroupItemProps } from "../types.js";
|
|
4
4
|
import { ToggleGroupItemState } from "../toggle-group.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
}: ToggleGroupItemProps = $props();
|
|
19
19
|
|
|
20
20
|
const itemState = ToggleGroupItemState.create({
|
|
21
|
-
id:
|
|
22
|
-
value:
|
|
23
|
-
disabled:
|
|
24
|
-
ref:
|
|
21
|
+
id: boxWith(() => id),
|
|
22
|
+
value: boxWith(() => value),
|
|
23
|
+
disabled: boxWith(() => disabled ?? false),
|
|
24
|
+
ref: boxWith(
|
|
25
25
|
() => ref,
|
|
26
26
|
(v) => (ref = v)
|
|
27
27
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { type WritableBox,
|
|
2
|
+
import { type WritableBox, boxWith } from "svelte-toolbelt";
|
|
3
3
|
import { mergeProps } from "svelte-toolbelt";
|
|
4
4
|
import type { ToggleGroupRootProps } from "../types.js";
|
|
5
5
|
import { ToggleGroupRootState } from "../toggle-group.svelte.js";
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
);
|
|
41
41
|
|
|
42
42
|
const rootState = ToggleGroupRootState.create({
|
|
43
|
-
id:
|
|
44
|
-
value:
|
|
43
|
+
id: boxWith(() => id),
|
|
44
|
+
value: boxWith(
|
|
45
45
|
() => value!,
|
|
46
46
|
(v) => {
|
|
47
47
|
value = v;
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
onValueChange(v);
|
|
50
50
|
}
|
|
51
51
|
) as WritableBox<string> | WritableBox<string[]>,
|
|
52
|
-
disabled:
|
|
53
|
-
loop:
|
|
54
|
-
orientation:
|
|
55
|
-
rovingFocus:
|
|
52
|
+
disabled: boxWith(() => disabled),
|
|
53
|
+
loop: boxWith(() => loop),
|
|
54
|
+
orientation: boxWith(() => orientation),
|
|
55
|
+
rovingFocus: boxWith(() => rovingFocus),
|
|
56
56
|
type,
|
|
57
|
-
ref:
|
|
57
|
+
ref: boxWith(
|
|
58
58
|
() => ref,
|
|
59
59
|
(v) => (ref = v)
|
|
60
60
|
),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ToggleGroupRootProps } from "../types.js";
|
|
2
|
-
declare const ToggleGroup: import("svelte").Component<ToggleGroupRootProps, {}, "
|
|
2
|
+
declare const ToggleGroup: import("svelte").Component<ToggleGroupRootProps, {}, "ref" | "value">;
|
|
3
3
|
type ToggleGroup = ReturnType<typeof ToggleGroup>;
|
|
4
4
|
export default ToggleGroup;
|
|
@@ -18,7 +18,7 @@ declare abstract class ToggleGroupBaseState {
|
|
|
18
18
|
readonly props: {
|
|
19
19
|
readonly id: string;
|
|
20
20
|
readonly role: "group";
|
|
21
|
-
readonly "data-orientation":
|
|
21
|
+
readonly "data-orientation": Orientation;
|
|
22
22
|
readonly "data-disabled": "" | undefined;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
@@ -81,7 +81,7 @@ export declare class ToggleGroupItemState {
|
|
|
81
81
|
readonly id: string;
|
|
82
82
|
readonly role: "radio" | undefined;
|
|
83
83
|
readonly tabindex: number;
|
|
84
|
-
readonly "data-orientation":
|
|
84
|
+
readonly "data-orientation": Orientation;
|
|
85
85
|
readonly "data-disabled": "" | undefined;
|
|
86
86
|
readonly "data-state": "off" | "on";
|
|
87
87
|
readonly "data-value": string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { attachRef, } from "svelte-toolbelt";
|
|
2
2
|
import { Context } from "runed";
|
|
3
|
-
import { createBitsAttrs, getAriaChecked,
|
|
3
|
+
import { createBitsAttrs, getAriaChecked, boolToStr, boolToEmptyStrOrUndef, boolToTrueOrUndef, } from "../../internal/attrs.js";
|
|
4
4
|
import { kbd } from "../../internal/kbd.js";
|
|
5
5
|
import { RovingFocusGroup } from "../../internal/roving-focus-group.js";
|
|
6
6
|
export const toggleGroupAttrs = createBitsAttrs({
|
|
@@ -26,8 +26,8 @@ class ToggleGroupBaseState {
|
|
|
26
26
|
id: this.opts.id.current,
|
|
27
27
|
[toggleGroupAttrs.root]: "",
|
|
28
28
|
role: "group",
|
|
29
|
-
"data-orientation":
|
|
30
|
-
"data-disabled":
|
|
29
|
+
"data-orientation": this.opts.orientation.current,
|
|
30
|
+
"data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current),
|
|
31
31
|
...this.attachment,
|
|
32
32
|
}));
|
|
33
33
|
}
|
|
@@ -95,7 +95,7 @@ export class ToggleGroupItemState {
|
|
|
95
95
|
return this.root.isMulti ? undefined : getAriaChecked(this.isPressed, false);
|
|
96
96
|
});
|
|
97
97
|
#ariaPressed = $derived.by(() => {
|
|
98
|
-
return this.root.isMulti ?
|
|
98
|
+
return this.root.isMulti ? boolToStr(this.isPressed) : undefined;
|
|
99
99
|
});
|
|
100
100
|
constructor(opts, root) {
|
|
101
101
|
this.opts = opts;
|
|
@@ -142,13 +142,13 @@ export class ToggleGroupItemState {
|
|
|
142
142
|
id: this.opts.id.current,
|
|
143
143
|
role: this.root.isMulti ? undefined : "radio",
|
|
144
144
|
tabindex: this.#tabIndex,
|
|
145
|
-
"data-orientation":
|
|
146
|
-
"data-disabled":
|
|
145
|
+
"data-orientation": this.root.opts.orientation.current,
|
|
146
|
+
"data-disabled": boolToEmptyStrOrUndef(this.#isDisabled),
|
|
147
147
|
"data-state": getToggleItemDataState(this.isPressed),
|
|
148
148
|
"data-value": this.opts.value.current,
|
|
149
149
|
"aria-pressed": this.#ariaPressed,
|
|
150
150
|
"aria-checked": this.#ariaChecked,
|
|
151
|
-
disabled:
|
|
151
|
+
disabled: boolToTrueOrUndef(this.#isDisabled),
|
|
152
152
|
[toggleGroupAttrs.item]: "",
|
|
153
153
|
//
|
|
154
154
|
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 { ToolbarButtonProps } from "../types.js";
|
|
4
4
|
import { ToolbarButtonState } from "../toolbar.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
}: ToolbarButtonProps = $props();
|
|
18
18
|
|
|
19
19
|
const buttonState = ToolbarButtonState.create({
|
|
20
|
-
id:
|
|
21
|
-
disabled:
|
|
22
|
-
ref:
|
|
20
|
+
id: boxWith(() => id),
|
|
21
|
+
disabled: boxWith(() => disabled ?? false),
|
|
22
|
+
ref: boxWith(
|
|
23
23
|
() => ref,
|
|
24
24
|
(v) => (ref = v)
|
|
25
25
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { ToolbarGroupItemProps } from "../types.js";
|
|
4
4
|
import { ToolbarGroupItemState } from "../toolbar.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
}: ToolbarGroupItemProps = $props();
|
|
19
19
|
|
|
20
20
|
const groupItemState = ToolbarGroupItemState.create({
|
|
21
|
-
id:
|
|
22
|
-
value:
|
|
23
|
-
disabled:
|
|
24
|
-
ref:
|
|
21
|
+
id: boxWith(() => id),
|
|
22
|
+
value: boxWith(() => value),
|
|
23
|
+
disabled: boxWith(() => disabled ?? false),
|
|
24
|
+
ref: boxWith(
|
|
25
25
|
() => ref,
|
|
26
26
|
(v) => (ref = v)
|
|
27
27
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { type WritableBox,
|
|
2
|
+
import { type WritableBox, boxWith } from "svelte-toolbelt";
|
|
3
3
|
import { mergeProps } from "svelte-toolbelt";
|
|
4
4
|
import type { ToolbarGroupProps } from "../types.js";
|
|
5
5
|
import { ToolbarGroupState } from "../toolbar.svelte.js";
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
);
|
|
38
38
|
|
|
39
39
|
const groupState = ToolbarGroupState.create({
|
|
40
|
-
id:
|
|
41
|
-
disabled:
|
|
40
|
+
id: boxWith(() => id),
|
|
41
|
+
disabled: boxWith(() => disabled),
|
|
42
42
|
type,
|
|
43
|
-
value:
|
|
43
|
+
value: boxWith(
|
|
44
44
|
() => value!,
|
|
45
45
|
(v) => {
|
|
46
46
|
value = v;
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
onValueChange(v);
|
|
49
49
|
}
|
|
50
50
|
) as WritableBox<string> | WritableBox<string[]>,
|
|
51
|
-
ref:
|
|
51
|
+
ref: boxWith(
|
|
52
52
|
() => ref,
|
|
53
53
|
(v) => (ref = v)
|
|
54
54
|
),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ToolbarGroupProps } from "../types.js";
|
|
2
|
-
declare const ToolbarGroup: import("svelte").Component<ToolbarGroupProps, {}, "
|
|
2
|
+
declare const ToolbarGroup: import("svelte").Component<ToolbarGroupProps, {}, "ref" | "value">;
|
|
3
3
|
type ToolbarGroup = ReturnType<typeof ToolbarGroup>;
|
|
4
4
|
export default ToolbarGroup;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import { ToolbarLinkState } from "../toolbar.svelte.js";
|
|
4
4
|
import type { ToolbarLinkProps } from "../types.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
}: ToolbarLinkProps = $props();
|
|
17
17
|
|
|
18
18
|
const linkState = ToolbarLinkState.create({
|
|
19
|
-
id:
|
|
20
|
-
ref:
|
|
19
|
+
id: boxWith(() => id),
|
|
20
|
+
ref: boxWith(
|
|
21
21
|
() => ref,
|
|
22
22
|
(v) => (ref = v)
|
|
23
23
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { ToolbarRootProps } from "../types.js";
|
|
4
4
|
import { ToolbarRootState } from "../toolbar.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
}: ToolbarRootProps = $props();
|
|
18
18
|
|
|
19
19
|
const rootState = ToolbarRootState.create({
|
|
20
|
-
id:
|
|
21
|
-
orientation:
|
|
22
|
-
loop:
|
|
23
|
-
ref:
|
|
20
|
+
id: boxWith(() => id),
|
|
21
|
+
orientation: boxWith(() => orientation),
|
|
22
|
+
loop: boxWith(() => loop),
|
|
23
|
+
ref: boxWith(
|
|
24
24
|
() => ref,
|
|
25
25
|
(v) => (ref = v)
|
|
26
26
|
),
|
|
@@ -32,7 +32,7 @@ declare abstract class ToolbarGroupBaseState {
|
|
|
32
32
|
readonly props: {
|
|
33
33
|
readonly id: string;
|
|
34
34
|
readonly role: "group";
|
|
35
|
-
readonly "data-orientation":
|
|
35
|
+
readonly "data-orientation": Orientation;
|
|
36
36
|
readonly "data-disabled": "" | undefined;
|
|
37
37
|
};
|
|
38
38
|
}
|
|
@@ -92,7 +92,7 @@ export declare class ToolbarGroupItemState {
|
|
|
92
92
|
readonly id: string;
|
|
93
93
|
readonly role: "radio" | undefined;
|
|
94
94
|
readonly tabindex: number;
|
|
95
|
-
readonly "data-orientation":
|
|
95
|
+
readonly "data-orientation": Orientation;
|
|
96
96
|
readonly "data-disabled": "" | undefined;
|
|
97
97
|
readonly "data-state": "off" | "on";
|
|
98
98
|
readonly "data-value": string;
|
|
@@ -117,7 +117,7 @@ export declare class ToolbarLinkState {
|
|
|
117
117
|
readonly id: string;
|
|
118
118
|
readonly role: "link" | undefined;
|
|
119
119
|
readonly tabindex: number;
|
|
120
|
-
readonly "data-orientation":
|
|
120
|
+
readonly "data-orientation": Orientation;
|
|
121
121
|
readonly onkeydown: (e: BitsKeyboardEvent) => void;
|
|
122
122
|
};
|
|
123
123
|
}
|
|
@@ -138,7 +138,7 @@ export declare class ToolbarButtonState {
|
|
|
138
138
|
readonly role: "button" | undefined;
|
|
139
139
|
readonly tabindex: number;
|
|
140
140
|
readonly "data-disabled": "" | undefined;
|
|
141
|
-
readonly "data-orientation":
|
|
141
|
+
readonly "data-orientation": Orientation;
|
|
142
142
|
readonly disabled: true | undefined;
|
|
143
143
|
readonly onkeydown: (e: BitsKeyboardEvent) => void;
|
|
144
144
|
};
|