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,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 toolbarAttrs = createBitsAttrs({
|
|
@@ -47,8 +47,8 @@ class ToolbarGroupBaseState {
|
|
|
47
47
|
id: this.opts.id.current,
|
|
48
48
|
[toolbarAttrs.group]: "",
|
|
49
49
|
role: "group",
|
|
50
|
-
"data-orientation":
|
|
51
|
-
"data-disabled":
|
|
50
|
+
"data-orientation": this.root.opts.orientation.current,
|
|
51
|
+
"data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current),
|
|
52
52
|
...this.attachment,
|
|
53
53
|
}));
|
|
54
54
|
}
|
|
@@ -152,22 +152,22 @@ export class ToolbarGroupItemState {
|
|
|
152
152
|
return this.group.isMulti ? undefined : getAriaChecked(this.isPressed, false);
|
|
153
153
|
});
|
|
154
154
|
#ariaPressed = $derived.by(() => {
|
|
155
|
-
return this.group.isMulti ?
|
|
155
|
+
return this.group.isMulti ? boolToStr(this.isPressed) : undefined;
|
|
156
156
|
});
|
|
157
157
|
#tabIndex = $state(0);
|
|
158
158
|
props = $derived.by(() => ({
|
|
159
159
|
id: this.opts.id.current,
|
|
160
160
|
role: this.group.isMulti ? undefined : "radio",
|
|
161
161
|
tabindex: this.#tabIndex,
|
|
162
|
-
"data-orientation":
|
|
163
|
-
"data-disabled":
|
|
162
|
+
"data-orientation": this.root.opts.orientation.current,
|
|
163
|
+
"data-disabled": boolToEmptyStrOrUndef(this.#isDisabled),
|
|
164
164
|
"data-state": getToggleItemDataState(this.isPressed),
|
|
165
165
|
"data-value": this.opts.value.current,
|
|
166
166
|
"aria-pressed": this.#ariaPressed,
|
|
167
167
|
"aria-checked": this.#ariaChecked,
|
|
168
168
|
[toolbarAttrs.item]: "",
|
|
169
169
|
[toolbarAttrs["group-item"]]: "",
|
|
170
|
-
disabled:
|
|
170
|
+
disabled: boolToTrueOrUndef(this.#isDisabled),
|
|
171
171
|
//
|
|
172
172
|
onclick: this.onclick,
|
|
173
173
|
onkeydown: this.onkeydown,
|
|
@@ -208,7 +208,7 @@ export class ToolbarLinkState {
|
|
|
208
208
|
[toolbarAttrs.item]: "",
|
|
209
209
|
role: this.#role,
|
|
210
210
|
tabindex: this.#tabIndex,
|
|
211
|
-
"data-orientation":
|
|
211
|
+
"data-orientation": this.root.opts.orientation.current,
|
|
212
212
|
//
|
|
213
213
|
onkeydown: this.onkeydown,
|
|
214
214
|
...this.attachment,
|
|
@@ -248,9 +248,9 @@ export class ToolbarButtonState {
|
|
|
248
248
|
[toolbarAttrs.button]: "",
|
|
249
249
|
role: this.#role,
|
|
250
250
|
tabindex: this.#tabIndex,
|
|
251
|
-
"data-disabled":
|
|
252
|
-
"data-orientation":
|
|
253
|
-
disabled:
|
|
251
|
+
"data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current),
|
|
252
|
+
"data-orientation": this.root.opts.orientation.current,
|
|
253
|
+
disabled: boolToTrueOrUndef(this.opts.disabled.current),
|
|
254
254
|
//
|
|
255
255
|
onkeydown: this.onkeydown,
|
|
256
256
|
...this.attachment,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { TooltipContentStaticProps } from "../types.js";
|
|
4
4
|
import { TooltipContentState } from "../tooltip.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
}: TooltipContentStaticProps = $props();
|
|
23
23
|
|
|
24
24
|
const contentState = TooltipContentState.create({
|
|
25
|
-
id:
|
|
26
|
-
ref:
|
|
25
|
+
id: boxWith(() => id),
|
|
26
|
+
ref: boxWith(
|
|
27
27
|
() => ref,
|
|
28
28
|
(v) => (ref = v)
|
|
29
29
|
),
|
|
30
|
-
onInteractOutside:
|
|
31
|
-
onEscapeKeydown:
|
|
30
|
+
onInteractOutside: boxWith(() => onInteractOutside),
|
|
31
|
+
onEscapeKeydown: boxWith(() => onEscapeKeydown),
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
const mergedProps = $derived(mergeProps(restProps, contentState.props));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { TooltipContentProps } from "../types.js";
|
|
4
4
|
import { TooltipContentState } from "../tooltip.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
avoidCollisions = true,
|
|
22
22
|
arrowPadding = 0,
|
|
23
23
|
sticky = "partial",
|
|
24
|
+
strategy,
|
|
24
25
|
hideWhenDetached = false,
|
|
25
26
|
collisionPadding = 0,
|
|
26
27
|
onInteractOutside = noop,
|
|
@@ -30,13 +31,13 @@
|
|
|
30
31
|
}: TooltipContentProps = $props();
|
|
31
32
|
|
|
32
33
|
const contentState = TooltipContentState.create({
|
|
33
|
-
id:
|
|
34
|
-
ref:
|
|
34
|
+
id: boxWith(() => id),
|
|
35
|
+
ref: boxWith(
|
|
35
36
|
() => ref,
|
|
36
37
|
(v) => (ref = v)
|
|
37
38
|
),
|
|
38
|
-
onInteractOutside:
|
|
39
|
-
onEscapeKeydown:
|
|
39
|
+
onInteractOutside: boxWith(() => onInteractOutside),
|
|
40
|
+
onEscapeKeydown: boxWith(() => onEscapeKeydown),
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
const floatingProps = $derived({
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
sticky,
|
|
49
50
|
hideWhenDetached,
|
|
50
51
|
collisionPadding,
|
|
52
|
+
strategy,
|
|
51
53
|
});
|
|
52
54
|
|
|
53
55
|
const mergedProps = $derived(mergeProps(restProps, floatingProps, contentState.props));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith } from "svelte-toolbelt";
|
|
3
3
|
import type { TooltipProviderProps } from "../types.js";
|
|
4
4
|
import { TooltipProviderState } from "../tooltip.svelte.js";
|
|
5
5
|
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
}: TooltipProviderProps = $props();
|
|
15
15
|
|
|
16
16
|
TooltipProviderState.create({
|
|
17
|
-
delayDuration:
|
|
18
|
-
disableCloseOnTriggerClick:
|
|
19
|
-
disableHoverableContent:
|
|
20
|
-
disabled:
|
|
21
|
-
ignoreNonKeyboardFocus:
|
|
22
|
-
skipDelayDuration:
|
|
17
|
+
delayDuration: boxWith(() => delayDuration),
|
|
18
|
+
disableCloseOnTriggerClick: boxWith(() => disableCloseOnTriggerClick),
|
|
19
|
+
disableHoverableContent: boxWith(() => disableHoverableContent),
|
|
20
|
+
disabled: boxWith(() => disabled),
|
|
21
|
+
ignoreNonKeyboardFocus: boxWith(() => ignoreNonKeyboardFocus),
|
|
22
|
+
skipDelayDuration: boxWith(() => skipDelayDuration),
|
|
23
23
|
});
|
|
24
24
|
</script>
|
|
25
25
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import type { TooltipTriggerProps } from "../types.js";
|
|
4
4
|
import { TooltipTriggerState } from "../tooltip.svelte.js";
|
|
5
5
|
import { createId } from "../../../internal/create-id.js";
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
}: TooltipTriggerProps = $props();
|
|
19
19
|
|
|
20
20
|
const triggerState = TooltipTriggerState.create({
|
|
21
|
-
id:
|
|
22
|
-
disabled:
|
|
23
|
-
ref:
|
|
21
|
+
id: boxWith(() => id),
|
|
22
|
+
disabled: boxWith(() => disabled ?? false),
|
|
23
|
+
ref: boxWith(
|
|
24
24
|
() => ref,
|
|
25
25
|
(v) => (ref = v)
|
|
26
26
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith } from "svelte-toolbelt";
|
|
3
3
|
import type { TooltipRootProps } from "../types.js";
|
|
4
4
|
import { TooltipRootState } from "../tooltip.svelte.js";
|
|
5
5
|
import FloatingLayer from "../../utilities/floating-layer/components/floating-layer.svelte";
|
|
@@ -18,19 +18,19 @@
|
|
|
18
18
|
}: TooltipRootProps = $props();
|
|
19
19
|
|
|
20
20
|
TooltipRootState.create({
|
|
21
|
-
open:
|
|
21
|
+
open: boxWith(
|
|
22
22
|
() => open,
|
|
23
23
|
(v) => {
|
|
24
24
|
open = v;
|
|
25
25
|
onOpenChange(v);
|
|
26
26
|
}
|
|
27
27
|
),
|
|
28
|
-
delayDuration:
|
|
29
|
-
disableCloseOnTriggerClick:
|
|
30
|
-
disableHoverableContent:
|
|
31
|
-
ignoreNonKeyboardFocus:
|
|
32
|
-
disabled:
|
|
33
|
-
onOpenChangeComplete:
|
|
28
|
+
delayDuration: boxWith(() => delayDuration),
|
|
29
|
+
disableCloseOnTriggerClick: boxWith(() => disableCloseOnTriggerClick),
|
|
30
|
+
disableHoverableContent: boxWith(() => disableHoverableContent),
|
|
31
|
+
ignoreNonKeyboardFocus: boxWith(() => ignoreNonKeyboardFocus),
|
|
32
|
+
disabled: boxWith(() => disabled),
|
|
33
|
+
onOpenChangeComplete: boxWith(() => onOpenChangeComplete),
|
|
34
34
|
});
|
|
35
35
|
</script>
|
|
36
36
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onMountEffect, attachRef, DOMContext, simpleBox, boxWith, } from "svelte-toolbelt";
|
|
2
2
|
import { on } from "svelte/events";
|
|
3
3
|
import { Context, watch } from "runed";
|
|
4
4
|
import { isElement, isFocusVisible } from "../../internal/is.js";
|
|
5
|
-
import { createBitsAttrs,
|
|
5
|
+
import { createBitsAttrs, boolToEmptyStrOrUndef } from "../../internal/attrs.js";
|
|
6
6
|
import { TimeoutFn } from "../../internal/timeout-fn.js";
|
|
7
7
|
import { GraceArea } from "../../internal/grace-area.svelte.js";
|
|
8
8
|
import { OpenChangeComplete } from "../../internal/open-change-complete.js";
|
|
@@ -18,7 +18,7 @@ export class TooltipProviderState {
|
|
|
18
18
|
}
|
|
19
19
|
opts;
|
|
20
20
|
isOpenDelayed = $state(true);
|
|
21
|
-
isPointerInTransit =
|
|
21
|
+
isPointerInTransit = simpleBox(false);
|
|
22
22
|
#timerFn;
|
|
23
23
|
#openTooltip = $state(null);
|
|
24
24
|
constructor(opts) {
|
|
@@ -89,7 +89,7 @@ export class TooltipRootState {
|
|
|
89
89
|
}, this.delayDuration ?? 0, { immediate: false });
|
|
90
90
|
new OpenChangeComplete({
|
|
91
91
|
open: this.opts.open,
|
|
92
|
-
ref:
|
|
92
|
+
ref: boxWith(() => this.contentNode),
|
|
93
93
|
onComplete: () => {
|
|
94
94
|
this.opts.onOpenChangeComplete.current(this.opts.open.current);
|
|
95
95
|
},
|
|
@@ -154,7 +154,7 @@ export class TooltipTriggerState {
|
|
|
154
154
|
opts;
|
|
155
155
|
root;
|
|
156
156
|
attachment;
|
|
157
|
-
#isPointerDown =
|
|
157
|
+
#isPointerDown = simpleBox(false);
|
|
158
158
|
#hasPointerMoveOpened = $state(false);
|
|
159
159
|
#isDisabled = $derived.by(() => this.opts.disabled.current || this.root.disabled);
|
|
160
160
|
domContext;
|
|
@@ -221,7 +221,7 @@ export class TooltipTriggerState {
|
|
|
221
221
|
? this.root.contentNode?.id
|
|
222
222
|
: undefined,
|
|
223
223
|
"data-state": this.root.stateAttr,
|
|
224
|
-
"data-disabled":
|
|
224
|
+
"data-disabled": boolToEmptyStrOrUndef(this.#isDisabled),
|
|
225
225
|
"data-delay-duration": `${this.root.delayDuration}`,
|
|
226
226
|
[tooltipAttrs.trigger]: "",
|
|
227
227
|
tabindex: this.#isDisabled ? undefined : 0,
|
|
@@ -298,7 +298,7 @@ export class TooltipContentState {
|
|
|
298
298
|
props = $derived.by(() => ({
|
|
299
299
|
id: this.opts.id.current,
|
|
300
300
|
"data-state": this.root.stateAttr,
|
|
301
|
-
"data-disabled":
|
|
301
|
+
"data-disabled": boolToEmptyStrOrUndef(this.root.disabled),
|
|
302
302
|
style: {
|
|
303
303
|
pointerEvents: "auto",
|
|
304
304
|
outline: "none",
|
|
@@ -94,7 +94,7 @@ export type TooltipRootPropsWithoutHTML = WithChildren<{
|
|
|
94
94
|
ignoreNonKeyboardFocus?: boolean;
|
|
95
95
|
}>;
|
|
96
96
|
export type TooltipRootProps = TooltipRootPropsWithoutHTML;
|
|
97
|
-
export type TooltipContentPropsWithoutHTML = WithChildNoChildrenSnippetProps<
|
|
97
|
+
export type TooltipContentPropsWithoutHTML = WithChildNoChildrenSnippetProps<Omit<FloatingLayerContentProps, "content" | "preventScroll"> & Omit<DismissibleLayerProps, "onInteractOutsideStart"> & EscapeLayerProps & {
|
|
98
98
|
/**
|
|
99
99
|
* When `true`, the tooltip will be forced to mount in the DOM.
|
|
100
100
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context } from "runed";
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith } from "svelte-toolbelt";
|
|
3
3
|
export const BitsConfigContext = new Context("BitsConfig");
|
|
4
4
|
/**
|
|
5
5
|
* Gets the current Bits UI configuration state from the context.
|
|
@@ -76,7 +76,7 @@ export class BitsConfigState {
|
|
|
76
76
|
*/
|
|
77
77
|
function createConfigResolver(parent, currentOpts) {
|
|
78
78
|
return (getter) => {
|
|
79
|
-
const configOption =
|
|
79
|
+
const configOption = boxWith(() => {
|
|
80
80
|
// try current opts first
|
|
81
81
|
const value = getter(currentOpts)?.current;
|
|
82
82
|
if (value !== undefined)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { BitsConfigProps } from "../types.js";
|
|
3
3
|
import { useBitsConfig } from "../bits-config.js";
|
|
4
|
-
import {
|
|
4
|
+
import { boxWith } from "svelte-toolbelt";
|
|
5
5
|
|
|
6
6
|
let { children, defaultPortalTo, defaultLocale }: BitsConfigProps = $props();
|
|
7
7
|
|
|
8
8
|
useBitsConfig({
|
|
9
|
-
defaultPortalTo:
|
|
10
|
-
defaultLocale:
|
|
9
|
+
defaultPortalTo: boxWith(() => defaultPortalTo),
|
|
10
|
+
defaultLocale: boxWith(() => defaultLocale),
|
|
11
11
|
});
|
|
12
12
|
</script>
|
|
13
13
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { boxWith } from "svelte-toolbelt";
|
|
2
2
|
import { getBitsConfig } from "./bits-config.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a generic prop resolver that follows a standard priority chain:
|
|
@@ -9,7 +9,7 @@ import { getBitsConfig } from "./bits-config.js";
|
|
|
9
9
|
function createPropResolver(configOption, fallback) {
|
|
10
10
|
return (getProp) => {
|
|
11
11
|
const config = getBitsConfig();
|
|
12
|
-
return
|
|
12
|
+
return boxWith(() => {
|
|
13
13
|
// 1. return the prop's value, if provided
|
|
14
14
|
const propValue = getProp();
|
|
15
15
|
if (propValue !== undefined)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith } from "svelte-toolbelt";
|
|
3
3
|
import type { DismissibleLayerImplProps } from "./types.js";
|
|
4
4
|
import { DismissibleLayerState } from "./use-dismissable-layer.svelte.js";
|
|
5
5
|
import { noop } from "../../../internal/noop.js";
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
}: DismissibleLayerImplProps = $props();
|
|
17
17
|
|
|
18
18
|
const dismissibleLayerState = DismissibleLayerState.create({
|
|
19
|
-
id:
|
|
20
|
-
interactOutsideBehavior:
|
|
21
|
-
onInteractOutside:
|
|
22
|
-
enabled:
|
|
23
|
-
onFocusOutside:
|
|
24
|
-
isValidEvent:
|
|
19
|
+
id: boxWith(() => id),
|
|
20
|
+
interactOutsideBehavior: boxWith(() => interactOutsideBehavior),
|
|
21
|
+
onInteractOutside: boxWith(() => onInteractOutside),
|
|
22
|
+
enabled: boxWith(() => enabled),
|
|
23
|
+
onFocusOutside: boxWith(() => onFocusOutside),
|
|
24
|
+
isValidEvent: boxWith(() => isValidEvent),
|
|
25
25
|
ref,
|
|
26
26
|
});
|
|
27
27
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type WritableBox, type ReadableBoxedValues } from "svelte-toolbelt";
|
|
2
|
-
import type { DismissibleLayerImplProps } from "./types.js";
|
|
1
|
+
import { type ReadableBox, type WritableBox, type ReadableBoxedValues } from "svelte-toolbelt";
|
|
2
|
+
import type { DismissibleLayerImplProps, InteractOutsideBehaviorType } from "./types.js";
|
|
3
3
|
interface DismissibleLayerStateOpts extends ReadableBoxedValues<Required<Omit<DismissibleLayerImplProps, "children" | "ref">>> {
|
|
4
4
|
ref: WritableBox<HTMLElement | null>;
|
|
5
5
|
}
|
|
@@ -13,6 +13,7 @@ export declare class DismissibleLayerState {
|
|
|
13
13
|
onblurcapture: () => void;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
+
export declare function getTopMostDismissableLayer(layersArr?: [DismissibleLayerState, ReadableBox<InteractOutsideBehaviorType>][]): [DismissibleLayerState, ReadableBox<InteractOutsideBehaviorType>] | undefined;
|
|
16
17
|
export type FocusOutsideEvent = CustomEvent<{
|
|
17
18
|
originalEvent: FocusEvent;
|
|
18
19
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { afterSleep, afterTick, executeCallbacks, onDestroyEffect, } from "svelte-toolbelt";
|
|
2
2
|
import { watch } from "runed";
|
|
3
3
|
import { on } from "svelte/events";
|
|
4
|
-
import {
|
|
4
|
+
import {} from "../../../internal/events.js";
|
|
5
5
|
import { debounce } from "../../../internal/debounce.js";
|
|
6
6
|
import { noop } from "../../../internal/noop.js";
|
|
7
7
|
import { getOwnerDocument, isOrContainsTarget } from "../../../internal/elements.js";
|
|
@@ -121,8 +121,9 @@ export class DismissibleLayerState {
|
|
|
121
121
|
}
|
|
122
122
|
if (e.pointerType === "touch") {
|
|
123
123
|
this.#unsubClickListener();
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
this.#unsubClickListener = on(this.#documentObj, "click", this.#handleDismiss, {
|
|
125
|
+
once: true,
|
|
126
|
+
});
|
|
126
127
|
}
|
|
127
128
|
else {
|
|
128
129
|
this.#interactOutsideProp.current(event);
|
|
@@ -165,7 +166,9 @@ export class DismissibleLayerState {
|
|
|
165
166
|
onblurcapture: this.#onblurcapture,
|
|
166
167
|
};
|
|
167
168
|
}
|
|
168
|
-
function
|
|
169
|
+
export function getTopMostDismissableLayer(layersArr = [
|
|
170
|
+
...globalThis.bitsDismissableLayers,
|
|
171
|
+
]) {
|
|
169
172
|
return layersArr.findLast(([_, { current: behaviorType }]) => behaviorType === "close" || behaviorType === "ignore");
|
|
170
173
|
}
|
|
171
174
|
function isResponsibleLayer(node) {
|
|
@@ -176,7 +179,7 @@ function isResponsibleLayer(node) {
|
|
|
176
179
|
* responsible for the outside interaction. Otherwise, we know that all layers defer so
|
|
177
180
|
* the first layer is the responsible one.
|
|
178
181
|
*/
|
|
179
|
-
const topMostLayer =
|
|
182
|
+
const topMostLayer = getTopMostDismissableLayer(layersArr);
|
|
180
183
|
if (topMostLayer)
|
|
181
184
|
return topMostLayer[0].opts.ref.current === node;
|
|
182
185
|
const [firstLayerNode] = layersArr[0];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith } from "svelte-toolbelt";
|
|
3
3
|
import type { EscapeLayerImplProps } from "./types.js";
|
|
4
4
|
import { EscapeLayerState } from "./use-escape-layer.svelte.js";
|
|
5
5
|
import { noop } from "../../../internal/noop.js";
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
}: EscapeLayerImplProps = $props();
|
|
14
14
|
|
|
15
15
|
EscapeLayerState.create({
|
|
16
|
-
escapeKeydownBehavior:
|
|
17
|
-
onEscapeKeydown:
|
|
18
|
-
enabled:
|
|
16
|
+
escapeKeydownBehavior: boxWith(() => escapeKeydownBehavior),
|
|
17
|
+
onEscapeKeydown: boxWith(() => onEscapeKeydown),
|
|
18
|
+
enabled: boxWith(() => enabled),
|
|
19
19
|
ref,
|
|
20
20
|
});
|
|
21
21
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith } from "svelte-toolbelt";
|
|
3
3
|
import { FloatingAnchorState } from "../use-floating-layer.svelte.js";
|
|
4
4
|
import type { AnchorProps } from "./index.js";
|
|
5
5
|
import type { Measurable } from "../../../../internal/floating-svelte/types.js";
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
FloatingAnchorState.create(
|
|
10
10
|
{
|
|
11
|
-
id:
|
|
12
|
-
virtualEl:
|
|
11
|
+
id: boxWith(() => id),
|
|
12
|
+
virtualEl: boxWith(() => virtualEl as unknown as Measurable | null),
|
|
13
13
|
ref,
|
|
14
14
|
},
|
|
15
15
|
tooltip
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import { FloatingArrowState } from "../use-floating-layer.svelte.js";
|
|
4
4
|
import { Arrow, type ArrowProps } from "../../arrow/index.js";
|
|
5
5
|
import { useId } from "../../../../internal/use-id.js";
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
let { id = useId(), ref = $bindable(null), ...restProps }: ArrowProps = $props();
|
|
8
8
|
|
|
9
9
|
const arrowState = FloatingArrowState.create({
|
|
10
|
-
id:
|
|
11
|
-
ref:
|
|
10
|
+
id: boxWith(() => id),
|
|
11
|
+
ref: boxWith(
|
|
12
12
|
() => ref,
|
|
13
13
|
(v) => (ref = v)
|
|
14
14
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith, mergeProps } from "svelte-toolbelt";
|
|
3
3
|
import { FloatingContentState } from "../use-floating-layer.svelte.js";
|
|
4
4
|
import type { ContentImplProps } from "./index.js";
|
|
5
5
|
import { useId } from "../../../../internal/use-id.js";
|
|
@@ -30,25 +30,25 @@
|
|
|
30
30
|
|
|
31
31
|
const contentState = FloatingContentState.create(
|
|
32
32
|
{
|
|
33
|
-
side:
|
|
34
|
-
sideOffset:
|
|
35
|
-
align:
|
|
36
|
-
alignOffset:
|
|
37
|
-
id:
|
|
38
|
-
arrowPadding:
|
|
39
|
-
avoidCollisions:
|
|
40
|
-
collisionBoundary:
|
|
41
|
-
collisionPadding:
|
|
42
|
-
hideWhenDetached:
|
|
43
|
-
onPlaced:
|
|
44
|
-
sticky:
|
|
45
|
-
updatePositionStrategy:
|
|
46
|
-
strategy:
|
|
47
|
-
dir:
|
|
48
|
-
style:
|
|
49
|
-
enabled:
|
|
50
|
-
wrapperId:
|
|
51
|
-
customAnchor:
|
|
33
|
+
side: boxWith(() => side),
|
|
34
|
+
sideOffset: boxWith(() => sideOffset),
|
|
35
|
+
align: boxWith(() => align),
|
|
36
|
+
alignOffset: boxWith(() => alignOffset),
|
|
37
|
+
id: boxWith(() => id),
|
|
38
|
+
arrowPadding: boxWith(() => arrowPadding),
|
|
39
|
+
avoidCollisions: boxWith(() => avoidCollisions),
|
|
40
|
+
collisionBoundary: boxWith(() => collisionBoundary),
|
|
41
|
+
collisionPadding: boxWith(() => collisionPadding),
|
|
42
|
+
hideWhenDetached: boxWith(() => hideWhenDetached),
|
|
43
|
+
onPlaced: boxWith(() => onPlaced),
|
|
44
|
+
sticky: boxWith(() => sticky),
|
|
45
|
+
updatePositionStrategy: boxWith(() => updatePositionStrategy),
|
|
46
|
+
strategy: boxWith(() => strategy),
|
|
47
|
+
dir: boxWith(() => dir),
|
|
48
|
+
style: boxWith(() => style),
|
|
49
|
+
enabled: boxWith(() => enabled),
|
|
50
|
+
wrapperId: boxWith(() => wrapperId),
|
|
51
|
+
customAnchor: boxWith(() => customAnchor),
|
|
52
52
|
},
|
|
53
53
|
tooltip
|
|
54
54
|
);
|
|
@@ -64,7 +64,7 @@ export declare class FloatingContentState {
|
|
|
64
64
|
middleware: Middleware[];
|
|
65
65
|
floating: UseFloatingReturn;
|
|
66
66
|
placedSide: "left" | "right" | "top" | "bottom";
|
|
67
|
-
placedAlign: "
|
|
67
|
+
placedAlign: "center" | "end" | "start";
|
|
68
68
|
arrowX: number;
|
|
69
69
|
arrowY: number;
|
|
70
70
|
cannotCenterArrow: boolean;
|
|
@@ -910,7 +910,7 @@ export declare class FloatingContentState {
|
|
|
910
910
|
};
|
|
911
911
|
props: {
|
|
912
912
|
readonly "data-side": "left" | "right" | "top" | "bottom";
|
|
913
|
-
readonly "data-align": "
|
|
913
|
+
readonly "data-align": "center" | "end" | "start";
|
|
914
914
|
readonly style: string;
|
|
915
915
|
};
|
|
916
916
|
arrowStyle: {
|
|
@@ -958,5 +958,5 @@ export declare class FloatingAnchorState {
|
|
|
958
958
|
constructor(opts: FloatingAnchorStateOpts, root: FloatingRootState);
|
|
959
959
|
}
|
|
960
960
|
export declare function getSideFromPlacement(placement: Placement): "left" | "right" | "top" | "bottom";
|
|
961
|
-
export declare function getAlignFromPlacement(placement: Placement): "
|
|
961
|
+
export declare function getAlignFromPlacement(placement: Placement): "center" | "end" | "start";
|
|
962
962
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { arrow, autoUpdate, flip, hide, limitShift, offset, shift, size, } from "@floating-ui/dom";
|
|
2
|
-
import { attachRef,
|
|
2
|
+
import { attachRef, cssToStyleObj, getWindow, styleToString, simpleBox, boxFrom, } from "svelte-toolbelt";
|
|
3
3
|
import { Context, ElementSize, watch } from "runed";
|
|
4
4
|
import { isNotNull } from "../../../internal/is.js";
|
|
5
5
|
import { useId } from "../../../internal/use-id.js";
|
|
@@ -21,9 +21,9 @@ export class FloatingRootState {
|
|
|
21
21
|
? FloatingTooltipRootContext.set(new FloatingRootState())
|
|
22
22
|
: FloatingRootContext.set(new FloatingRootState());
|
|
23
23
|
}
|
|
24
|
-
anchorNode =
|
|
25
|
-
customAnchorNode =
|
|
26
|
-
triggerNode =
|
|
24
|
+
anchorNode = simpleBox(null);
|
|
25
|
+
customAnchorNode = simpleBox(null);
|
|
26
|
+
triggerNode = simpleBox(null);
|
|
27
27
|
constructor() {
|
|
28
28
|
$effect(() => {
|
|
29
29
|
if (this.customAnchorNode.current) {
|
|
@@ -49,14 +49,14 @@ export class FloatingContentState {
|
|
|
49
49
|
opts;
|
|
50
50
|
root;
|
|
51
51
|
// nodes
|
|
52
|
-
contentRef =
|
|
53
|
-
wrapperRef =
|
|
54
|
-
arrowRef =
|
|
52
|
+
contentRef = simpleBox(null);
|
|
53
|
+
wrapperRef = simpleBox(null);
|
|
54
|
+
arrowRef = simpleBox(null);
|
|
55
55
|
contentAttachment = attachRef(this.contentRef);
|
|
56
56
|
wrapperAttachment = attachRef(this.wrapperRef);
|
|
57
57
|
arrowAttachment = attachRef(this.arrowRef);
|
|
58
58
|
// ids
|
|
59
|
-
arrowId =
|
|
59
|
+
arrowId = simpleBox(useId());
|
|
60
60
|
#transformedStyle = $derived.by(() => {
|
|
61
61
|
if (typeof this.opts.style === "string")
|
|
62
62
|
return cssToStyleObj(this.opts.style);
|
|
@@ -247,7 +247,7 @@ export class FloatingAnchorState {
|
|
|
247
247
|
this.opts = opts;
|
|
248
248
|
this.root = root;
|
|
249
249
|
if (opts.virtualEl && opts.virtualEl.current) {
|
|
250
|
-
root.triggerNode =
|
|
250
|
+
root.triggerNode = boxFrom(opts.virtualEl.current);
|
|
251
251
|
}
|
|
252
252
|
else {
|
|
253
253
|
root.triggerNode = opts.ref;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { simpleBox } from "svelte-toolbelt";
|
|
2
2
|
import { FocusScope } from "./focus-scope.svelte.js";
|
|
3
3
|
export class FocusScopeManager {
|
|
4
4
|
static instance;
|
|
5
|
-
#scopeStack =
|
|
5
|
+
#scopeStack = simpleBox([]);
|
|
6
6
|
#focusHistory = new WeakMap();
|
|
7
7
|
#preFocusHistory = new WeakMap();
|
|
8
8
|
static getInstance() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { boxWith } from "svelte-toolbelt";
|
|
3
3
|
import type { FocusScopeImplProps } from "./types.js";
|
|
4
4
|
import { noop } from "../../../internal/noop.js";
|
|
5
5
|
import { FocusScope } from "./focus-scope.svelte.js";
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
}: FocusScopeImplProps = $props();
|
|
16
16
|
|
|
17
17
|
const focusScopeState = FocusScope.use({
|
|
18
|
-
enabled:
|
|
19
|
-
trap:
|
|
18
|
+
enabled: boxWith(() => enabled),
|
|
19
|
+
trap: boxWith(() => trapFocus),
|
|
20
20
|
loop: loop,
|
|
21
|
-
onCloseAutoFocus:
|
|
22
|
-
onOpenAutoFocus:
|
|
21
|
+
onCloseAutoFocus: boxWith(() => onCloseAutoFocus),
|
|
22
|
+
onOpenAutoFocus: boxWith(() => onOpenAutoFocus),
|
|
23
23
|
ref,
|
|
24
24
|
});
|
|
25
25
|
</script>
|