bits-ui 2.8.1 → 2.8.3
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 +6 -1
- package/dist/bits/accordion/accordion.svelte.js +15 -5
- package/dist/bits/aspect-ratio/aspect-ratio.svelte.d.ts +2 -1
- package/dist/bits/aspect-ratio/aspect-ratio.svelte.js +3 -1
- package/dist/bits/avatar/avatar.svelte.d.ts +4 -1
- package/dist/bits/avatar/avatar.svelte.js +9 -3
- package/dist/bits/calendar/calendar.svelte.d.ts +15 -1
- package/dist/bits/calendar/calendar.svelte.js +42 -14
- package/dist/bits/checkbox/checkbox.svelte.d.ts +4 -1
- package/dist/bits/checkbox/checkbox.svelte.js +13 -3
- package/dist/bits/collapsible/collapsible.svelte.d.ts +5 -1
- package/dist/bits/collapsible/collapsible.svelte.js +15 -4
- package/dist/bits/command/command.svelte.d.ts +13 -1
- package/dist/bits/command/command.svelte.js +36 -12
- package/dist/bits/date-field/date-field.svelte.d.ts +8 -2
- package/dist/bits/date-field/date-field.svelte.js +18 -6
- package/dist/bits/date-range-field/date-range-field.svelte.d.ts +3 -1
- package/dist/bits/date-range-field/date-range-field.svelte.js +6 -2
- package/dist/bits/dialog/dialog.svelte.d.ts +9 -1
- package/dist/bits/dialog/dialog.svelte.js +41 -19
- package/dist/bits/label/label.svelte.d.ts +2 -1
- package/dist/bits/label/label.svelte.js +3 -1
- package/dist/bits/link-preview/link-preview.svelte.d.ts +3 -1
- package/dist/bits/link-preview/link-preview.svelte.js +6 -2
- package/dist/bits/menu/menu.svelte.d.ts +12 -1
- package/dist/bits/menu/menu.svelte.js +37 -15
- package/dist/bits/menubar/components/menubar-trigger.svelte +4 -3
- package/dist/bits/menubar/menubar.svelte.d.ts +4 -1
- package/dist/bits/menubar/menubar.svelte.js +9 -3
- package/dist/bits/meter/meter.svelte.d.ts +2 -1
- package/dist/bits/meter/meter.svelte.js +3 -1
- package/dist/bits/navigation-menu/navigation-menu.svelte.d.ts +14 -3
- package/dist/bits/navigation-menu/navigation-menu.svelte.js +33 -13
- package/dist/bits/pagination/pagination.svelte.d.ts +4 -1
- package/dist/bits/pagination/pagination.svelte.js +9 -3
- package/dist/bits/pin-input/pin-input.svelte.d.ts +4 -1
- package/dist/bits/pin-input/pin-input.svelte.js +8 -3
- package/dist/bits/popover/popover.svelte.d.ts +4 -1
- package/dist/bits/popover/popover.svelte.js +9 -3
- package/dist/bits/progress/progress.svelte.d.ts +2 -1
- package/dist/bits/progress/progress.svelte.js +3 -1
- package/dist/bits/radio-group/radio-group.svelte.d.ts +3 -1
- package/dist/bits/radio-group/radio-group.svelte.js +6 -2
- package/dist/bits/range-calendar/range-calendar.svelte.d.ts +4 -1
- package/dist/bits/range-calendar/range-calendar.svelte.js +9 -3
- package/dist/bits/rating-group/rating-group.svelte.d.ts +3 -1
- package/dist/bits/rating-group/rating-group.svelte.js +6 -2
- package/dist/bits/scroll-area/scroll-area.svelte.d.ts +8 -1
- package/dist/bits/scroll-area/scroll-area.svelte.js +20 -7
- package/dist/bits/select/select.svelte.d.ts +10 -1
- package/dist/bits/select/select.svelte.js +27 -9
- package/dist/bits/separator/separator.svelte.d.ts +2 -1
- package/dist/bits/separator/separator.svelte.js +3 -1
- package/dist/bits/slider/slider.svelte.d.ts +7 -1
- package/dist/bits/slider/slider.svelte.js +18 -6
- package/dist/bits/switch/switch.svelte.d.ts +3 -1
- package/dist/bits/switch/switch.svelte.js +6 -2
- package/dist/bits/tabs/tabs.svelte.d.ts +5 -1
- package/dist/bits/tabs/tabs.svelte.js +12 -4
- package/dist/bits/time-field/time-field.svelte.d.ts +7 -1
- package/dist/bits/time-field/time-field.svelte.js +18 -6
- package/dist/bits/time-range-field/time-range-field.svelte.d.ts +3 -1
- package/dist/bits/time-range-field/time-range-field.svelte.js +6 -2
- package/dist/bits/toggle/toggle.svelte.d.ts +2 -1
- package/dist/bits/toggle/toggle.svelte.js +3 -1
- package/dist/bits/toggle-group/toggle-group.svelte.d.ts +3 -1
- package/dist/bits/toggle-group/toggle-group.svelte.js +6 -2
- package/dist/bits/toolbar/toolbar.svelte.d.ts +6 -1
- package/dist/bits/toolbar/toolbar.svelte.js +15 -5
- package/dist/bits/tooltip/tooltip.svelte.d.ts +3 -1
- package/dist/bits/tooltip/tooltip.svelte.js +6 -2
- package/dist/bits/utilities/floating-layer/use-floating-layer.svelte.d.ts +9 -0
- package/dist/bits/utilities/floating-layer/use-floating-layer.svelte.js +6 -3
- package/dist/internal/types.d.ts +2 -1
- package/package.json +9 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type WritableBox, type ReadableBoxedValues, type WritableBoxedValues } from "svelte-toolbelt";
|
|
2
2
|
import type { Orientation } from "../../shared/index.js";
|
|
3
|
-
import type { BitsKeyboardEvent, BitsMouseEvent, WithRefOpts } from "../../internal/types.js";
|
|
3
|
+
import type { BitsKeyboardEvent, BitsMouseEvent, RefAttachment, WithRefOpts } from "../../internal/types.js";
|
|
4
4
|
import { RovingFocusGroup } from "../../internal/roving-focus-group.js";
|
|
5
5
|
export declare const toggleGroupAttrs: import("../../internal/attrs.js").CreateBitsAttrsReturn<readonly ["root", "item"]>;
|
|
6
6
|
interface ToggleGroupBaseStateOpts extends WithRefOpts, ReadableBoxedValues<{
|
|
@@ -13,6 +13,7 @@ interface ToggleGroupBaseStateOpts extends WithRefOpts, ReadableBoxedValues<{
|
|
|
13
13
|
declare abstract class ToggleGroupBaseState {
|
|
14
14
|
readonly opts: ToggleGroupBaseStateOpts;
|
|
15
15
|
readonly rovingFocusGroup: RovingFocusGroup;
|
|
16
|
+
readonly attachment: RefAttachment;
|
|
16
17
|
constructor(opts: ToggleGroupBaseStateOpts);
|
|
17
18
|
readonly props: {
|
|
18
19
|
readonly id: string;
|
|
@@ -68,6 +69,7 @@ export declare class ToggleGroupItemState {
|
|
|
68
69
|
static create(opts: ToggleGroupItemStateOpts): ToggleGroupItemState;
|
|
69
70
|
readonly opts: ToggleGroupItemStateOpts;
|
|
70
71
|
readonly root: ToggleGroup;
|
|
72
|
+
readonly attachment: RefAttachment;
|
|
71
73
|
readonly isPressed: boolean;
|
|
72
74
|
constructor(opts: ToggleGroupItemStateOpts, root: ToggleGroup);
|
|
73
75
|
onclick(_: BitsMouseEvent): void;
|
|
@@ -11,8 +11,10 @@ const ToggleGroupRootContext = new Context("ToggleGroup.Root");
|
|
|
11
11
|
class ToggleGroupBaseState {
|
|
12
12
|
opts;
|
|
13
13
|
rovingFocusGroup;
|
|
14
|
+
attachment;
|
|
14
15
|
constructor(opts) {
|
|
15
16
|
this.opts = opts;
|
|
17
|
+
this.attachment = attachRef(this.opts.ref);
|
|
16
18
|
this.rovingFocusGroup = new RovingFocusGroup({
|
|
17
19
|
candidateAttr: toggleGroupAttrs.item,
|
|
18
20
|
rootNode: opts.ref,
|
|
@@ -26,7 +28,7 @@ class ToggleGroupBaseState {
|
|
|
26
28
|
role: "group",
|
|
27
29
|
"data-orientation": getDataOrientation(this.opts.orientation.current),
|
|
28
30
|
"data-disabled": getDataDisabled(this.opts.disabled.current),
|
|
29
|
-
...
|
|
31
|
+
...this.attachment,
|
|
30
32
|
}));
|
|
31
33
|
}
|
|
32
34
|
class ToggleGroupSingleState extends ToggleGroupBaseState {
|
|
@@ -86,6 +88,7 @@ export class ToggleGroupItemState {
|
|
|
86
88
|
}
|
|
87
89
|
opts;
|
|
88
90
|
root;
|
|
91
|
+
attachment;
|
|
89
92
|
#isDisabled = $derived.by(() => this.opts.disabled.current || this.root.opts.disabled.current);
|
|
90
93
|
isPressed = $derived.by(() => this.root.includesItem(this.opts.value.current));
|
|
91
94
|
#ariaChecked = $derived.by(() => {
|
|
@@ -97,6 +100,7 @@ export class ToggleGroupItemState {
|
|
|
97
100
|
constructor(opts, root) {
|
|
98
101
|
this.opts = opts;
|
|
99
102
|
this.root = root;
|
|
103
|
+
this.attachment = attachRef(this.opts.ref);
|
|
100
104
|
$effect(() => {
|
|
101
105
|
if (!this.root.opts.rovingFocus.current) {
|
|
102
106
|
this.#tabIndex = 0;
|
|
@@ -149,7 +153,7 @@ export class ToggleGroupItemState {
|
|
|
149
153
|
//
|
|
150
154
|
onclick: this.onclick,
|
|
151
155
|
onkeydown: this.onkeydown,
|
|
152
|
-
...
|
|
156
|
+
...this.attachment,
|
|
153
157
|
}));
|
|
154
158
|
}
|
|
155
159
|
function getToggleItemDataState(condition) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type WritableBox, type WritableBoxedValues, type ReadableBoxedValues } from "svelte-toolbelt";
|
|
2
2
|
import type { Orientation } from "../../shared/index.js";
|
|
3
|
-
import type { BitsKeyboardEvent, BitsMouseEvent, WithRefOpts } from "../../internal/types.js";
|
|
3
|
+
import type { BitsKeyboardEvent, BitsMouseEvent, RefAttachment, WithRefOpts } from "../../internal/types.js";
|
|
4
4
|
import { RovingFocusGroup } from "../../internal/roving-focus-group.js";
|
|
5
5
|
export declare const toolbarAttrs: import("../../internal/attrs.js").CreateBitsAttrsReturn<readonly ["root", "item", "group", "group-item", "link", "button"]>;
|
|
6
6
|
interface ToolbarRootStateOpts extends WithRefOpts, ReadableBoxedValues<{
|
|
@@ -12,6 +12,7 @@ export declare class ToolbarRootState {
|
|
|
12
12
|
static create(opts: ToolbarRootStateOpts): ToolbarRootState;
|
|
13
13
|
readonly opts: ToolbarRootStateOpts;
|
|
14
14
|
readonly rovingFocusGroup: RovingFocusGroup;
|
|
15
|
+
readonly attachment: RefAttachment;
|
|
15
16
|
constructor(opts: ToolbarRootStateOpts);
|
|
16
17
|
readonly props: {
|
|
17
18
|
readonly id: string;
|
|
@@ -26,6 +27,7 @@ interface ToolbarGroupBaseStateOpts extends WithRefOpts, ReadableBoxedValues<{
|
|
|
26
27
|
declare abstract class ToolbarGroupBaseState {
|
|
27
28
|
readonly opts: ToolbarGroupBaseStateOpts;
|
|
28
29
|
readonly root: ToolbarRootState;
|
|
30
|
+
readonly attachment: RefAttachment;
|
|
29
31
|
constructor(opts: ToolbarGroupBaseStateOpts, root: ToolbarRootState);
|
|
30
32
|
readonly props: {
|
|
31
33
|
readonly id: string;
|
|
@@ -81,6 +83,7 @@ export declare class ToolbarGroupItemState {
|
|
|
81
83
|
readonly opts: ToolbarGroupItemStateOpts;
|
|
82
84
|
readonly group: ToolbarGroup;
|
|
83
85
|
readonly root: ToolbarRootState;
|
|
86
|
+
readonly attachment: RefAttachment;
|
|
84
87
|
constructor(opts: ToolbarGroupItemStateOpts, group: ToolbarGroup, root: ToolbarRootState);
|
|
85
88
|
onclick(_: BitsMouseEvent): void;
|
|
86
89
|
onkeydown(e: BitsKeyboardEvent): void;
|
|
@@ -107,6 +110,7 @@ export declare class ToolbarLinkState {
|
|
|
107
110
|
static create(opts: ToolbarLinkStateOpts): ToolbarLinkState;
|
|
108
111
|
readonly opts: ToolbarLinkStateOpts;
|
|
109
112
|
readonly root: ToolbarRootState;
|
|
113
|
+
readonly attachment: RefAttachment;
|
|
110
114
|
constructor(opts: ToolbarLinkStateOpts, root: ToolbarRootState);
|
|
111
115
|
onkeydown(e: BitsKeyboardEvent): void;
|
|
112
116
|
readonly props: {
|
|
@@ -126,6 +130,7 @@ export declare class ToolbarButtonState {
|
|
|
126
130
|
static create(opts: ToolbarButtonStateOpts): ToolbarButtonState;
|
|
127
131
|
readonly opts: ToolbarButtonStateOpts;
|
|
128
132
|
readonly root: ToolbarRootState;
|
|
133
|
+
readonly attachment: RefAttachment;
|
|
129
134
|
constructor(opts: ToolbarButtonStateOpts, root: ToolbarRootState);
|
|
130
135
|
onkeydown(e: BitsKeyboardEvent): void;
|
|
131
136
|
readonly props: {
|
|
@@ -15,8 +15,10 @@ export class ToolbarRootState {
|
|
|
15
15
|
}
|
|
16
16
|
opts;
|
|
17
17
|
rovingFocusGroup;
|
|
18
|
+
attachment;
|
|
18
19
|
constructor(opts) {
|
|
19
20
|
this.opts = opts;
|
|
21
|
+
this.attachment = attachRef(this.opts.ref);
|
|
20
22
|
this.rovingFocusGroup = new RovingFocusGroup({
|
|
21
23
|
orientation: this.opts.orientation,
|
|
22
24
|
loop: this.opts.loop,
|
|
@@ -29,15 +31,17 @@ export class ToolbarRootState {
|
|
|
29
31
|
role: "toolbar",
|
|
30
32
|
"data-orientation": this.opts.orientation.current,
|
|
31
33
|
[toolbarAttrs.root]: "",
|
|
32
|
-
...
|
|
34
|
+
...this.attachment,
|
|
33
35
|
}));
|
|
34
36
|
}
|
|
35
37
|
class ToolbarGroupBaseState {
|
|
36
38
|
opts;
|
|
37
39
|
root;
|
|
40
|
+
attachment;
|
|
38
41
|
constructor(opts, root) {
|
|
39
42
|
this.opts = opts;
|
|
40
43
|
this.root = root;
|
|
44
|
+
this.attachment = attachRef(this.opts.ref);
|
|
41
45
|
}
|
|
42
46
|
props = $derived.by(() => ({
|
|
43
47
|
id: this.opts.id.current,
|
|
@@ -45,7 +49,7 @@ class ToolbarGroupBaseState {
|
|
|
45
49
|
role: "group",
|
|
46
50
|
"data-orientation": getDataOrientation(this.root.opts.orientation.current),
|
|
47
51
|
"data-disabled": getDataDisabled(this.opts.disabled.current),
|
|
48
|
-
...
|
|
52
|
+
...this.attachment,
|
|
49
53
|
}));
|
|
50
54
|
}
|
|
51
55
|
class ToolbarGroupSingleState extends ToolbarGroupBaseState {
|
|
@@ -110,11 +114,13 @@ export class ToolbarGroupItemState {
|
|
|
110
114
|
opts;
|
|
111
115
|
group;
|
|
112
116
|
root;
|
|
117
|
+
attachment;
|
|
113
118
|
#isDisabled = $derived.by(() => this.opts.disabled.current || this.group.opts.disabled.current);
|
|
114
119
|
constructor(opts, group, root) {
|
|
115
120
|
this.opts = opts;
|
|
116
121
|
this.group = group;
|
|
117
122
|
this.root = root;
|
|
123
|
+
this.attachment = attachRef(this.opts.ref);
|
|
118
124
|
$effect(() => {
|
|
119
125
|
this.#tabIndex = this.root.rovingFocusGroup.getTabIndex(this.opts.ref.current);
|
|
120
126
|
});
|
|
@@ -165,7 +171,7 @@ export class ToolbarGroupItemState {
|
|
|
165
171
|
//
|
|
166
172
|
onclick: this.onclick,
|
|
167
173
|
onkeydown: this.onkeydown,
|
|
168
|
-
...
|
|
174
|
+
...this.attachment,
|
|
169
175
|
}));
|
|
170
176
|
}
|
|
171
177
|
export class ToolbarLinkState {
|
|
@@ -174,9 +180,11 @@ export class ToolbarLinkState {
|
|
|
174
180
|
}
|
|
175
181
|
opts;
|
|
176
182
|
root;
|
|
183
|
+
attachment;
|
|
177
184
|
constructor(opts, root) {
|
|
178
185
|
this.opts = opts;
|
|
179
186
|
this.root = root;
|
|
187
|
+
this.attachment = attachRef(this.opts.ref);
|
|
180
188
|
$effect(() => {
|
|
181
189
|
this.#tabIndex = this.root.rovingFocusGroup.getTabIndex(this.opts.ref.current);
|
|
182
190
|
});
|
|
@@ -203,7 +211,7 @@ export class ToolbarLinkState {
|
|
|
203
211
|
"data-orientation": getDataOrientation(this.root.opts.orientation.current),
|
|
204
212
|
//
|
|
205
213
|
onkeydown: this.onkeydown,
|
|
206
|
-
...
|
|
214
|
+
...this.attachment,
|
|
207
215
|
}));
|
|
208
216
|
}
|
|
209
217
|
export class ToolbarButtonState {
|
|
@@ -212,9 +220,11 @@ export class ToolbarButtonState {
|
|
|
212
220
|
}
|
|
213
221
|
opts;
|
|
214
222
|
root;
|
|
223
|
+
attachment;
|
|
215
224
|
constructor(opts, root) {
|
|
216
225
|
this.opts = opts;
|
|
217
226
|
this.root = root;
|
|
227
|
+
this.attachment = attachRef(this.opts.ref);
|
|
218
228
|
$effect(() => {
|
|
219
229
|
this.#tabIndex = this.root.rovingFocusGroup.getTabIndex(this.opts.ref.current);
|
|
220
230
|
});
|
|
@@ -243,7 +253,7 @@ export class ToolbarButtonState {
|
|
|
243
253
|
disabled: getDisabled(this.opts.disabled.current),
|
|
244
254
|
//
|
|
245
255
|
onkeydown: this.onkeydown,
|
|
246
|
-
...
|
|
256
|
+
...this.attachment,
|
|
247
257
|
}));
|
|
248
258
|
}
|
|
249
259
|
//
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DOMContext, type WritableBoxedValues, type ReadableBoxedValues } from "svelte-toolbelt";
|
|
2
|
-
import type { OnChangeFn, WithRefOpts } from "../../internal/types.js";
|
|
2
|
+
import type { OnChangeFn, RefAttachment, WithRefOpts } from "../../internal/types.js";
|
|
3
3
|
import type { FocusEventHandler, MouseEventHandler, PointerEventHandler } from "svelte/elements";
|
|
4
4
|
export declare const tooltipAttrs: import("../../internal/attrs.js").CreateBitsAttrsReturn<readonly ["content", "trigger"]>;
|
|
5
5
|
interface TooltipProviderStateOpts extends ReadableBoxedValues<{
|
|
@@ -61,6 +61,7 @@ export declare class TooltipTriggerState {
|
|
|
61
61
|
static create(opts: TooltipTriggerStateOpts): TooltipTriggerState;
|
|
62
62
|
readonly opts: TooltipTriggerStateOpts;
|
|
63
63
|
readonly root: TooltipRootState;
|
|
64
|
+
readonly attachment: RefAttachment;
|
|
64
65
|
domContext: DOMContext;
|
|
65
66
|
constructor(opts: TooltipTriggerStateOpts, root: TooltipRootState);
|
|
66
67
|
handlePointerUp: () => void;
|
|
@@ -90,6 +91,7 @@ export declare class TooltipContentState {
|
|
|
90
91
|
static create(opts: TooltipContentStateOpts): TooltipContentState;
|
|
91
92
|
readonly opts: TooltipContentStateOpts;
|
|
92
93
|
readonly root: TooltipRootState;
|
|
94
|
+
readonly attachment: RefAttachment;
|
|
93
95
|
constructor(opts: TooltipContentStateOpts, root: TooltipRootState);
|
|
94
96
|
onInteractOutside: (e: PointerEvent) => void;
|
|
95
97
|
onEscapeKeydown: (e: KeyboardEvent) => void;
|
|
@@ -153,6 +153,7 @@ export class TooltipTriggerState {
|
|
|
153
153
|
}
|
|
154
154
|
opts;
|
|
155
155
|
root;
|
|
156
|
+
attachment;
|
|
156
157
|
#isPointerDown = box(false);
|
|
157
158
|
#hasPointerMoveOpened = $state(false);
|
|
158
159
|
#isDisabled = $derived.by(() => this.opts.disabled.current || this.root.disabled);
|
|
@@ -161,6 +162,7 @@ export class TooltipTriggerState {
|
|
|
161
162
|
this.opts = opts;
|
|
162
163
|
this.root = root;
|
|
163
164
|
this.domContext = new DOMContext(opts.ref);
|
|
165
|
+
this.attachment = attachRef(this.opts.ref, (v) => (this.root.triggerNode = v));
|
|
164
166
|
}
|
|
165
167
|
handlePointerUp = () => {
|
|
166
168
|
this.#isPointerDown.current = false;
|
|
@@ -231,7 +233,7 @@ export class TooltipTriggerState {
|
|
|
231
233
|
onfocus: this.#onfocus,
|
|
232
234
|
onblur: this.#onblur,
|
|
233
235
|
onclick: this.#onclick,
|
|
234
|
-
...
|
|
236
|
+
...this.attachment,
|
|
235
237
|
}));
|
|
236
238
|
}
|
|
237
239
|
export class TooltipContentState {
|
|
@@ -240,9 +242,11 @@ export class TooltipContentState {
|
|
|
240
242
|
}
|
|
241
243
|
opts;
|
|
242
244
|
root;
|
|
245
|
+
attachment;
|
|
243
246
|
constructor(opts, root) {
|
|
244
247
|
this.opts = opts;
|
|
245
248
|
this.root = root;
|
|
249
|
+
this.attachment = attachRef(this.opts.ref, (v) => (this.root.contentNode = v));
|
|
246
250
|
new GraceArea({
|
|
247
251
|
triggerNode: () => this.root.triggerNode,
|
|
248
252
|
contentNode: () => this.root.contentNode,
|
|
@@ -300,7 +304,7 @@ export class TooltipContentState {
|
|
|
300
304
|
outline: "none",
|
|
301
305
|
},
|
|
302
306
|
[tooltipAttrs.content]: "",
|
|
303
|
-
...
|
|
307
|
+
...this.attachment,
|
|
304
308
|
}));
|
|
305
309
|
popperProps = {
|
|
306
310
|
onInteractOutside: this.onInteractOutside,
|
|
@@ -45,6 +45,15 @@ export declare class FloatingContentState {
|
|
|
45
45
|
contentRef: import("svelte-toolbelt").WritableBox<HTMLElement | null>;
|
|
46
46
|
wrapperRef: import("svelte-toolbelt").WritableBox<HTMLElement | null>;
|
|
47
47
|
arrowRef: import("svelte-toolbelt").WritableBox<HTMLElement | null>;
|
|
48
|
+
readonly contentAttachment: {
|
|
49
|
+
[x: symbol]: (node: HTMLElement) => () => void;
|
|
50
|
+
};
|
|
51
|
+
readonly wrapperAttachment: {
|
|
52
|
+
[x: symbol]: (node: HTMLElement) => () => void;
|
|
53
|
+
};
|
|
54
|
+
readonly arrowAttachment: {
|
|
55
|
+
[x: symbol]: (node: HTMLElement) => () => void;
|
|
56
|
+
};
|
|
48
57
|
arrowId: Box<string>;
|
|
49
58
|
hasExplicitBoundaries: boolean;
|
|
50
59
|
detectOverflowOptions: {
|
|
@@ -52,6 +52,9 @@ export class FloatingContentState {
|
|
|
52
52
|
contentRef = box(null);
|
|
53
53
|
wrapperRef = box(null);
|
|
54
54
|
arrowRef = box(null);
|
|
55
|
+
contentAttachment = attachRef(this.contentRef);
|
|
56
|
+
wrapperAttachment = attachRef(this.wrapperRef);
|
|
57
|
+
arrowAttachment = attachRef(this.arrowRef);
|
|
55
58
|
// ids
|
|
56
59
|
arrowId = box(useId());
|
|
57
60
|
#transformedStyle = $derived.by(() => {
|
|
@@ -146,7 +149,7 @@ export class FloatingContentState {
|
|
|
146
149
|
},
|
|
147
150
|
// Floating UI calculates logical alignment based the `dir` attribute
|
|
148
151
|
dir: this.opts.dir.current,
|
|
149
|
-
...
|
|
152
|
+
...this.wrapperAttachment,
|
|
150
153
|
}));
|
|
151
154
|
props = $derived.by(() => ({
|
|
152
155
|
"data-side": this.placedSide,
|
|
@@ -154,7 +157,7 @@ export class FloatingContentState {
|
|
|
154
157
|
style: styleToString({
|
|
155
158
|
...this.#transformedStyle,
|
|
156
159
|
}),
|
|
157
|
-
...
|
|
160
|
+
...this.contentAttachment,
|
|
158
161
|
}));
|
|
159
162
|
arrowStyle = $derived({
|
|
160
163
|
position: "absolute",
|
|
@@ -229,7 +232,7 @@ export class FloatingArrowState {
|
|
|
229
232
|
id: this.opts.id.current,
|
|
230
233
|
style: this.content.arrowStyle,
|
|
231
234
|
"data-side": this.content.placedSide,
|
|
232
|
-
...
|
|
235
|
+
...this.content.arrowAttachment,
|
|
233
236
|
}));
|
|
234
237
|
}
|
|
235
238
|
export class FloatingAnchorState {
|
package/dist/internal/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
-
import type { Box, ReadableBoxedValues, WritableBoxedValues } from "svelte-toolbelt";
|
|
2
|
+
import type { attachRef, Box, ReadableBoxedValues, WritableBoxedValues } from "svelte-toolbelt";
|
|
3
3
|
import type { StyleProperties } from "../shared/index.js";
|
|
4
4
|
export type OnChangeFn<T> = (value: T) => void;
|
|
5
5
|
export type ElementRef = Box<HTMLElement | null>;
|
|
@@ -90,3 +90,4 @@ export type BitsPointerEvent<T extends HTMLElement = HTMLElement> = BitsEvent<Po
|
|
|
90
90
|
export type BitsKeyboardEvent<T extends HTMLElement = HTMLElement> = BitsEvent<KeyboardEvent, T>;
|
|
91
91
|
export type BitsMouseEvent<T extends HTMLElement = HTMLElement> = BitsEvent<MouseEvent, T>;
|
|
92
92
|
export type BitsFocusEvent<T extends HTMLElement = HTMLElement> = BitsEvent<FocusEvent, T>;
|
|
93
|
+
export type RefAttachment<T extends HTMLElement = HTMLElement> = ReturnType<typeof attachRef<T>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bits-ui",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "github:huntabyte/bits-ui",
|
|
6
6
|
"funding": "https://github.com/sponsors/huntabyte",
|
|
@@ -19,30 +19,28 @@
|
|
|
19
19
|
"!dist/**/*.spec.*"
|
|
20
20
|
],
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@internationalized/date": "^3.8.
|
|
23
|
-
"@sveltejs/kit": "^2.21.
|
|
22
|
+
"@internationalized/date": "^3.8.2",
|
|
23
|
+
"@sveltejs/kit": "^2.21.5",
|
|
24
24
|
"@sveltejs/package": "^2.3.11",
|
|
25
|
-
"@sveltejs/vite-plugin-svelte": "5.0
|
|
25
|
+
"@sveltejs/vite-plugin-svelte": "^5.1.0",
|
|
26
26
|
"@types/css.escape": "^1.5.2",
|
|
27
27
|
"@types/node": "^20.17.6",
|
|
28
28
|
"@types/resize-observer-browser": "^0.1.11",
|
|
29
29
|
"csstype": "^3.1.3",
|
|
30
|
-
"jest-axe": "^9.0.0",
|
|
31
30
|
"jsdom": "^24.1.3",
|
|
32
31
|
"publint": "^0.2.12",
|
|
33
|
-
"svelte": "
|
|
34
|
-
"svelte-check": "^4.2.
|
|
35
|
-
"tslib": "^2.8.1",
|
|
32
|
+
"svelte": "5.33.2",
|
|
33
|
+
"svelte-check": "^4.2.2",
|
|
36
34
|
"typescript": "^5.8.3",
|
|
37
35
|
"vite": "^6.3.5",
|
|
38
|
-
"vitest": "
|
|
36
|
+
"vitest": "3.2.3"
|
|
39
37
|
},
|
|
40
38
|
"svelte": "./dist/index.js",
|
|
41
39
|
"types": "./dist/index.d.ts",
|
|
42
40
|
"type": "module",
|
|
43
41
|
"dependencies": {
|
|
44
|
-
"@floating-ui/core": "^1.7.
|
|
45
|
-
"@floating-ui/dom": "^1.7.
|
|
42
|
+
"@floating-ui/core": "^1.7.1",
|
|
43
|
+
"@floating-ui/dom": "^1.7.1",
|
|
46
44
|
"css.escape": "^1.5.1",
|
|
47
45
|
"esm-env": "^1.1.2",
|
|
48
46
|
"runed": "^0.28.0",
|
|
@@ -54,7 +52,6 @@
|
|
|
54
52
|
"svelte": "^5.33.0"
|
|
55
53
|
},
|
|
56
54
|
"engines": {
|
|
57
|
-
"pnpm": ">=8.7.0",
|
|
58
55
|
"node": ">=20"
|
|
59
56
|
},
|
|
60
57
|
"sideEffects": false,
|