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,5 +1,5 @@
|
|
|
1
1
|
import { type Box, type ReadableBoxedValues, type WritableBoxedValues } from "svelte-toolbelt";
|
|
2
|
-
import type { BitsKeyboardEvent, BitsMouseEvent, WithRefOpts } from "../../internal/types.js";
|
|
2
|
+
import type { BitsKeyboardEvent, BitsMouseEvent, RefAttachment, WithRefOpts } from "../../internal/types.js";
|
|
3
3
|
import type { Orientation } from "../../shared/index.js";
|
|
4
4
|
import { RovingFocusGroup } from "../../internal/roving-focus-group.js";
|
|
5
5
|
interface AccordionBaseStateOpts extends WithRefOpts, ReadableBoxedValues<{
|
|
@@ -47,6 +47,7 @@ declare abstract class AccordionBaseState {
|
|
|
47
47
|
readonly opts: AccordionBaseStateOpts;
|
|
48
48
|
readonly rovingFocusGroup: RovingFocusGroup;
|
|
49
49
|
abstract readonly isMulti: boolean;
|
|
50
|
+
readonly attachment: RefAttachment;
|
|
50
51
|
constructor(opts: AccordionBaseStateOpts);
|
|
51
52
|
abstract includesItem(item: string): boolean;
|
|
52
53
|
abstract toggleItem(item: string): void;
|
|
@@ -79,6 +80,7 @@ export declare class AccordionItemState {
|
|
|
79
80
|
readonly root: AccordionRoot;
|
|
80
81
|
readonly isActive: boolean;
|
|
81
82
|
readonly isDisabled: boolean;
|
|
83
|
+
readonly attachment: RefAttachment;
|
|
82
84
|
constructor(opts: AccordionItemStateOpts);
|
|
83
85
|
updateValue(): void;
|
|
84
86
|
readonly props: {
|
|
@@ -92,6 +94,7 @@ export declare class AccordionTriggerState {
|
|
|
92
94
|
#private;
|
|
93
95
|
readonly opts: AccordionTriggerStateOpts;
|
|
94
96
|
readonly itemState: AccordionItemState;
|
|
97
|
+
readonly attachment: RefAttachment;
|
|
95
98
|
constructor(opts: AccordionTriggerStateOpts, itemState: AccordionItemState);
|
|
96
99
|
static create(props: AccordionTriggerStateOpts): AccordionTriggerState;
|
|
97
100
|
onclick(e: BitsMouseEvent): void;
|
|
@@ -113,6 +116,7 @@ export declare class AccordionContentState {
|
|
|
113
116
|
#private;
|
|
114
117
|
readonly opts: AccordionContentStateOpts;
|
|
115
118
|
readonly item: AccordionItemState;
|
|
119
|
+
readonly attachment: RefAttachment;
|
|
116
120
|
readonly open: boolean;
|
|
117
121
|
constructor(opts: AccordionContentStateOpts, item: AccordionItemState);
|
|
118
122
|
static create(props: AccordionContentStateOpts): AccordionContentState;
|
|
@@ -133,6 +137,7 @@ export declare class AccordionContentState {
|
|
|
133
137
|
export declare class AccordionHeaderState {
|
|
134
138
|
readonly opts: AccordionHeaderStateOpts;
|
|
135
139
|
readonly item: AccordionItemState;
|
|
140
|
+
readonly attachment: RefAttachment;
|
|
136
141
|
constructor(opts: AccordionHeaderStateOpts, item: AccordionItemState);
|
|
137
142
|
static create(props: AccordionHeaderStateOpts): AccordionHeaderState;
|
|
138
143
|
readonly props: {
|
|
@@ -13,6 +13,7 @@ const AccordionItemContext = new Context("Accordion.Item");
|
|
|
13
13
|
class AccordionBaseState {
|
|
14
14
|
opts;
|
|
15
15
|
rovingFocusGroup;
|
|
16
|
+
attachment;
|
|
16
17
|
constructor(opts) {
|
|
17
18
|
this.opts = opts;
|
|
18
19
|
this.rovingFocusGroup = new RovingFocusGroup({
|
|
@@ -21,13 +22,14 @@ class AccordionBaseState {
|
|
|
21
22
|
loop: this.opts.loop,
|
|
22
23
|
orientation: this.opts.orientation,
|
|
23
24
|
});
|
|
25
|
+
this.attachment = attachRef(this.opts.ref);
|
|
24
26
|
}
|
|
25
27
|
props = $derived.by(() => ({
|
|
26
28
|
id: this.opts.id.current,
|
|
27
29
|
"data-orientation": getDataOrientation(this.opts.orientation.current),
|
|
28
30
|
"data-disabled": getDataDisabled(this.opts.disabled.current),
|
|
29
31
|
[accordionAttrs.root]: "",
|
|
30
|
-
...
|
|
32
|
+
...this.attachment,
|
|
31
33
|
}));
|
|
32
34
|
}
|
|
33
35
|
class AccordionSingleState extends AccordionBaseState {
|
|
@@ -81,10 +83,12 @@ export class AccordionItemState {
|
|
|
81
83
|
root;
|
|
82
84
|
isActive = $derived.by(() => this.root.includesItem(this.opts.value.current));
|
|
83
85
|
isDisabled = $derived.by(() => this.opts.disabled.current || this.root.opts.disabled.current);
|
|
86
|
+
attachment;
|
|
84
87
|
constructor(opts) {
|
|
85
88
|
this.opts = opts;
|
|
86
89
|
this.root = opts.rootState;
|
|
87
90
|
this.updateValue = this.updateValue.bind(this);
|
|
91
|
+
this.attachment = attachRef(this.opts.ref);
|
|
88
92
|
}
|
|
89
93
|
updateValue() {
|
|
90
94
|
this.root.toggleItem(this.opts.value.current);
|
|
@@ -95,7 +99,7 @@ export class AccordionItemState {
|
|
|
95
99
|
"data-disabled": getDataDisabled(this.isDisabled),
|
|
96
100
|
"data-orientation": getDataOrientation(this.root.opts.orientation.current),
|
|
97
101
|
[accordionAttrs.item]: "",
|
|
98
|
-
...
|
|
102
|
+
...this.attachment,
|
|
99
103
|
}));
|
|
100
104
|
}
|
|
101
105
|
export class AccordionTriggerState {
|
|
@@ -105,12 +109,14 @@ export class AccordionTriggerState {
|
|
|
105
109
|
#isDisabled = $derived.by(() => this.opts.disabled.current ||
|
|
106
110
|
this.itemState.opts.disabled.current ||
|
|
107
111
|
this.#root.opts.disabled.current);
|
|
112
|
+
attachment;
|
|
108
113
|
constructor(opts, itemState) {
|
|
109
114
|
this.opts = opts;
|
|
110
115
|
this.itemState = itemState;
|
|
111
116
|
this.#root = itemState.root;
|
|
112
117
|
this.onclick = this.onclick.bind(this);
|
|
113
118
|
this.onkeydown = this.onkeydown.bind(this);
|
|
119
|
+
this.attachment = attachRef(this.opts.ref);
|
|
114
120
|
}
|
|
115
121
|
static create(props) {
|
|
116
122
|
return new AccordionTriggerState(props, AccordionItemContext.get());
|
|
@@ -144,12 +150,13 @@ export class AccordionTriggerState {
|
|
|
144
150
|
tabindex: 0,
|
|
145
151
|
onclick: this.onclick,
|
|
146
152
|
onkeydown: this.onkeydown,
|
|
147
|
-
...
|
|
153
|
+
...this.attachment,
|
|
148
154
|
}));
|
|
149
155
|
}
|
|
150
156
|
export class AccordionContentState {
|
|
151
157
|
opts;
|
|
152
158
|
item;
|
|
159
|
+
attachment;
|
|
153
160
|
#originalStyles = undefined;
|
|
154
161
|
#isMountAnimationPrevented = false;
|
|
155
162
|
#dimensions = $state({ width: 0, height: 0 });
|
|
@@ -158,6 +165,7 @@ export class AccordionContentState {
|
|
|
158
165
|
this.opts = opts;
|
|
159
166
|
this.item = item;
|
|
160
167
|
this.#isMountAnimationPrevented = this.item.isActive;
|
|
168
|
+
this.attachment = attachRef(this.opts.ref);
|
|
161
169
|
// Prevent mount animations on initial render
|
|
162
170
|
$effect(() => {
|
|
163
171
|
const rAF = requestAnimationFrame(() => {
|
|
@@ -206,15 +214,17 @@ export class AccordionContentState {
|
|
|
206
214
|
"--bits-accordion-content-height": `${this.#dimensions.height}px`,
|
|
207
215
|
"--bits-accordion-content-width": `${this.#dimensions.width}px`,
|
|
208
216
|
},
|
|
209
|
-
...
|
|
217
|
+
...this.attachment,
|
|
210
218
|
}));
|
|
211
219
|
}
|
|
212
220
|
export class AccordionHeaderState {
|
|
213
221
|
opts;
|
|
214
222
|
item;
|
|
223
|
+
attachment;
|
|
215
224
|
constructor(opts, item) {
|
|
216
225
|
this.opts = opts;
|
|
217
226
|
this.item = item;
|
|
227
|
+
this.attachment = attachRef(this.opts.ref);
|
|
218
228
|
}
|
|
219
229
|
static create(props) {
|
|
220
230
|
return new AccordionHeaderState(props, AccordionItemContext.get());
|
|
@@ -227,6 +237,6 @@ export class AccordionHeaderState {
|
|
|
227
237
|
"data-state": getDataOpenClosed(this.item.isActive),
|
|
228
238
|
"data-orientation": getDataOrientation(this.item.root.opts.orientation.current),
|
|
229
239
|
[accordionAttrs.header]: "",
|
|
230
|
-
...
|
|
240
|
+
...this.attachment,
|
|
231
241
|
}));
|
|
232
242
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReadableBoxedValues } from "svelte-toolbelt";
|
|
2
|
-
import type { WithRefOpts } from "../../internal/types.js";
|
|
2
|
+
import type { RefAttachment, WithRefOpts } from "../../internal/types.js";
|
|
3
3
|
interface AspectRatioRootStateOpts extends WithRefOpts, ReadableBoxedValues<{
|
|
4
4
|
ratio: number;
|
|
5
5
|
}> {
|
|
@@ -7,6 +7,7 @@ interface AspectRatioRootStateOpts extends WithRefOpts, ReadableBoxedValues<{
|
|
|
7
7
|
export declare class AspectRatioRootState {
|
|
8
8
|
static create(opts: AspectRatioRootStateOpts): AspectRatioRootState;
|
|
9
9
|
readonly opts: AspectRatioRootStateOpts;
|
|
10
|
+
readonly attachment: RefAttachment;
|
|
10
11
|
constructor(opts: AspectRatioRootStateOpts);
|
|
11
12
|
readonly props: {
|
|
12
13
|
readonly id: string;
|
|
@@ -9,8 +9,10 @@ export class AspectRatioRootState {
|
|
|
9
9
|
return new AspectRatioRootState(opts);
|
|
10
10
|
}
|
|
11
11
|
opts;
|
|
12
|
+
attachment;
|
|
12
13
|
constructor(opts) {
|
|
13
14
|
this.opts = opts;
|
|
15
|
+
this.attachment = attachRef(this.opts.ref);
|
|
14
16
|
}
|
|
15
17
|
props = $derived.by(() => ({
|
|
16
18
|
id: this.opts.id.current,
|
|
@@ -22,6 +24,6 @@ export class AspectRatioRootState {
|
|
|
22
24
|
left: 0,
|
|
23
25
|
},
|
|
24
26
|
[aspectRatioAttrs.root]: "",
|
|
25
|
-
...
|
|
27
|
+
...this.attachment,
|
|
26
28
|
}));
|
|
27
29
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DOMContext, type ReadableBox, type WritableBox, type ReadableBoxedValues } from "svelte-toolbelt";
|
|
2
2
|
import type { HTMLImgAttributes } from "svelte/elements";
|
|
3
3
|
import type { AvatarImageLoadingStatus } from "./types.js";
|
|
4
|
-
import type { WithRefOpts } from "../../internal/types.js";
|
|
4
|
+
import type { RefAttachment, WithRefOpts } from "../../internal/types.js";
|
|
5
5
|
type CrossOrigin = HTMLImgAttributes["crossorigin"];
|
|
6
6
|
type ReferrerPolicy = HTMLImgAttributes["referrerpolicy"];
|
|
7
7
|
type AvatarImageSrc = string | null | undefined;
|
|
@@ -13,6 +13,7 @@ export declare class AvatarRootState {
|
|
|
13
13
|
static create(opts: AvatarRootStateOpts): AvatarRootState;
|
|
14
14
|
readonly opts: AvatarRootStateOpts;
|
|
15
15
|
readonly domContext: DOMContext;
|
|
16
|
+
readonly attachment: RefAttachment;
|
|
16
17
|
constructor(opts: AvatarRootStateOpts);
|
|
17
18
|
loadImage(src: string, crossorigin?: CrossOrigin, referrerPolicy?: ReferrerPolicy): (() => void) | undefined;
|
|
18
19
|
props: {
|
|
@@ -30,6 +31,7 @@ export declare class AvatarImageState {
|
|
|
30
31
|
static create(opts: AvatarImageStateOpts): AvatarImageState;
|
|
31
32
|
readonly opts: AvatarImageStateOpts;
|
|
32
33
|
readonly root: AvatarRootState;
|
|
34
|
+
readonly attachment: RefAttachment;
|
|
33
35
|
constructor(opts: AvatarImageStateOpts, root: AvatarRootState);
|
|
34
36
|
readonly props: {
|
|
35
37
|
readonly id: string;
|
|
@@ -48,6 +50,7 @@ export declare class AvatarFallbackState {
|
|
|
48
50
|
static create(opts: AvatarFallbackStateOpts): AvatarFallbackState;
|
|
49
51
|
readonly opts: AvatarFallbackStateOpts;
|
|
50
52
|
readonly root: AvatarRootState;
|
|
53
|
+
readonly attachment: RefAttachment;
|
|
51
54
|
constructor(opts: AvatarFallbackStateOpts, root: AvatarRootState);
|
|
52
55
|
readonly style: {
|
|
53
56
|
display: string;
|
|
@@ -12,10 +12,12 @@ export class AvatarRootState {
|
|
|
12
12
|
}
|
|
13
13
|
opts;
|
|
14
14
|
domContext;
|
|
15
|
+
attachment;
|
|
15
16
|
constructor(opts) {
|
|
16
17
|
this.opts = opts;
|
|
17
18
|
this.domContext = new DOMContext(this.opts.ref);
|
|
18
19
|
this.loadImage = this.loadImage.bind(this);
|
|
20
|
+
this.attachment = attachRef(this.opts.ref);
|
|
19
21
|
}
|
|
20
22
|
loadImage(src, crossorigin, referrerPolicy) {
|
|
21
23
|
if (this.opts.loadingStatus.current === "loaded")
|
|
@@ -46,7 +48,7 @@ export class AvatarRootState {
|
|
|
46
48
|
id: this.opts.id.current,
|
|
47
49
|
[avatarAttrs.root]: "",
|
|
48
50
|
"data-status": this.opts.loadingStatus.current,
|
|
49
|
-
...
|
|
51
|
+
...this.attachment,
|
|
50
52
|
}));
|
|
51
53
|
}
|
|
52
54
|
export class AvatarImageState {
|
|
@@ -55,9 +57,11 @@ export class AvatarImageState {
|
|
|
55
57
|
}
|
|
56
58
|
opts;
|
|
57
59
|
root;
|
|
60
|
+
attachment;
|
|
58
61
|
constructor(opts, root) {
|
|
59
62
|
this.opts = opts;
|
|
60
63
|
this.root = root;
|
|
64
|
+
this.attachment = attachRef(this.opts.ref);
|
|
61
65
|
watch.pre([() => this.opts.src.current, () => this.opts.crossOrigin.current], ([src, crossOrigin]) => {
|
|
62
66
|
if (!src) {
|
|
63
67
|
this.root.opts.loadingStatus.current = "error";
|
|
@@ -76,7 +80,7 @@ export class AvatarImageState {
|
|
|
76
80
|
src: this.opts.src.current,
|
|
77
81
|
crossorigin: this.opts.crossOrigin.current,
|
|
78
82
|
referrerpolicy: this.opts.referrerPolicy.current,
|
|
79
|
-
...
|
|
83
|
+
...this.attachment,
|
|
80
84
|
}));
|
|
81
85
|
}
|
|
82
86
|
export class AvatarFallbackState {
|
|
@@ -85,15 +89,17 @@ export class AvatarFallbackState {
|
|
|
85
89
|
}
|
|
86
90
|
opts;
|
|
87
91
|
root;
|
|
92
|
+
attachment;
|
|
88
93
|
constructor(opts, root) {
|
|
89
94
|
this.opts = opts;
|
|
90
95
|
this.root = root;
|
|
96
|
+
this.attachment = attachRef(this.opts.ref);
|
|
91
97
|
}
|
|
92
98
|
style = $derived.by(() => this.root.opts.loadingStatus.current === "loaded" ? { display: "none" } : undefined);
|
|
93
99
|
props = $derived.by(() => ({
|
|
94
100
|
style: this.style,
|
|
95
101
|
"data-status": this.root.opts.loadingStatus.current,
|
|
96
102
|
[avatarAttrs.fallback]: "",
|
|
97
|
-
...
|
|
103
|
+
...this.attachment,
|
|
98
104
|
}));
|
|
99
105
|
}
|
|
@@ -2,7 +2,7 @@ import { type DateValue } from "@internationalized/date";
|
|
|
2
2
|
import { DOMContext, type ReadableBoxedValues, type WritableBoxedValues } from "svelte-toolbelt";
|
|
3
3
|
import { Context } from "runed";
|
|
4
4
|
import type { RangeCalendarRootState } from "../range-calendar/range-calendar.svelte.js";
|
|
5
|
-
import type { BitsKeyboardEvent, BitsMouseEvent, WithRefOpts } from "../../internal/types.js";
|
|
5
|
+
import type { BitsKeyboardEvent, BitsMouseEvent, RefAttachment, WithRefOpts } from "../../internal/types.js";
|
|
6
6
|
import type { DateMatcher, Month } from "../../shared/index.js";
|
|
7
7
|
import { type Announcer } from "../../internal/date-time/announcer.js";
|
|
8
8
|
import { type Formatter } from "../../internal/date-time/formatter.js";
|
|
@@ -49,6 +49,7 @@ export declare class CalendarRootState {
|
|
|
49
49
|
readonly formatter: Formatter;
|
|
50
50
|
readonly accessibleHeadingId: string;
|
|
51
51
|
readonly domContext: DOMContext;
|
|
52
|
+
readonly attachment: RefAttachment;
|
|
52
53
|
months: Month<DateValue>[];
|
|
53
54
|
announcer: Announcer;
|
|
54
55
|
constructor(opts: CalendarRootStateOpts);
|
|
@@ -109,6 +110,7 @@ export declare class CalendarHeadingState {
|
|
|
109
110
|
static create(opts: CalendarHeadingStateOpts): CalendarHeadingState;
|
|
110
111
|
readonly opts: CalendarHeadingStateOpts;
|
|
111
112
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
113
|
+
readonly attachment: RefAttachment;
|
|
112
114
|
constructor(opts: CalendarHeadingStateOpts, root: CalendarRootState | RangeCalendarRootState);
|
|
113
115
|
readonly props: {
|
|
114
116
|
readonly id: string;
|
|
@@ -135,6 +137,7 @@ export declare class CalendarCellState {
|
|
|
135
137
|
readonly isFocusedDate: boolean;
|
|
136
138
|
readonly isSelectedDate: boolean;
|
|
137
139
|
readonly labelText: string;
|
|
140
|
+
readonly attachment: RefAttachment;
|
|
138
141
|
constructor(opts: CalendarCellStateOpts, root: CalendarRootState);
|
|
139
142
|
readonly snippetProps: {
|
|
140
143
|
disabled: boolean;
|
|
@@ -176,6 +179,7 @@ export declare class CalendarDayState {
|
|
|
176
179
|
static create(opts: CalendarDayStateOpts): CalendarDayState;
|
|
177
180
|
readonly opts: CalendarDayStateOpts;
|
|
178
181
|
readonly cell: CalendarCellState;
|
|
182
|
+
readonly attachment: RefAttachment;
|
|
179
183
|
constructor(opts: CalendarDayStateOpts, cell: CalendarCellState);
|
|
180
184
|
onclick(e: BitsMouseEvent): void;
|
|
181
185
|
readonly snippetProps: {
|
|
@@ -210,6 +214,7 @@ export declare class CalendarNextButtonState {
|
|
|
210
214
|
readonly opts: CalendarNextButtonStateOpts;
|
|
211
215
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
212
216
|
readonly isDisabled: boolean;
|
|
217
|
+
readonly attachment: RefAttachment;
|
|
213
218
|
constructor(opts: CalendarNextButtonStateOpts, root: CalendarRootState | RangeCalendarRootState);
|
|
214
219
|
onclick(_: BitsMouseEvent): void;
|
|
215
220
|
readonly props: {
|
|
@@ -230,6 +235,7 @@ export declare class CalendarPrevButtonState {
|
|
|
230
235
|
readonly opts: CalendarPrevButtonStateOpts;
|
|
231
236
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
232
237
|
readonly isDisabled: boolean;
|
|
238
|
+
readonly attachment: RefAttachment;
|
|
233
239
|
constructor(opts: CalendarPrevButtonStateOpts, root: CalendarRootState | RangeCalendarRootState);
|
|
234
240
|
onclick(_: BitsMouseEvent): void;
|
|
235
241
|
readonly props: {
|
|
@@ -249,6 +255,7 @@ export declare class CalendarGridState {
|
|
|
249
255
|
static create(opts: CalendarGridStateOpts): CalendarGridState;
|
|
250
256
|
readonly opts: CalendarGridStateOpts;
|
|
251
257
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
258
|
+
readonly attachment: RefAttachment;
|
|
252
259
|
constructor(opts: CalendarGridStateOpts, root: CalendarRootState | RangeCalendarRootState);
|
|
253
260
|
readonly props: {
|
|
254
261
|
readonly id: string;
|
|
@@ -266,6 +273,7 @@ export declare class CalendarGridBodyState {
|
|
|
266
273
|
static create(opts: CalendarGridBodyStateOpts): CalendarGridBodyState;
|
|
267
274
|
readonly opts: CalendarGridBodyStateOpts;
|
|
268
275
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
276
|
+
readonly attachment: RefAttachment;
|
|
269
277
|
constructor(opts: CalendarGridBodyStateOpts, root: CalendarRootState | RangeCalendarRootState);
|
|
270
278
|
readonly props: {
|
|
271
279
|
readonly id: string;
|
|
@@ -279,6 +287,7 @@ export declare class CalendarGridHeadState {
|
|
|
279
287
|
static create(opts: CalendarGridHeadStateOpts): CalendarGridHeadState;
|
|
280
288
|
readonly opts: CalendarGridHeadStateOpts;
|
|
281
289
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
290
|
+
readonly attachment: RefAttachment;
|
|
282
291
|
constructor(opts: CalendarGridHeadStateOpts, root: CalendarRootState | RangeCalendarRootState);
|
|
283
292
|
readonly props: {
|
|
284
293
|
readonly id: string;
|
|
@@ -292,6 +301,7 @@ export declare class CalendarGridRowState {
|
|
|
292
301
|
static create(opts: CalendarGridRowStateOpts): CalendarGridRowState;
|
|
293
302
|
readonly opts: CalendarGridRowStateOpts;
|
|
294
303
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
304
|
+
readonly attachment: RefAttachment;
|
|
295
305
|
constructor(opts: CalendarGridRowStateOpts, root: CalendarRootState | RangeCalendarRootState);
|
|
296
306
|
readonly props: {
|
|
297
307
|
readonly id: string;
|
|
@@ -305,6 +315,7 @@ export declare class CalendarHeadCellState {
|
|
|
305
315
|
static create(opts: CalendarHeadCellStateOpts): CalendarHeadCellState;
|
|
306
316
|
readonly opts: CalendarHeadCellStateOpts;
|
|
307
317
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
318
|
+
readonly attachment: RefAttachment;
|
|
308
319
|
constructor(opts: CalendarHeadCellStateOpts, root: CalendarRootState | RangeCalendarRootState);
|
|
309
320
|
readonly props: {
|
|
310
321
|
readonly id: string;
|
|
@@ -318,6 +329,7 @@ export declare class CalendarHeaderState {
|
|
|
318
329
|
static create(opts: CalendarHeaderStateOpts): CalendarHeaderState;
|
|
319
330
|
readonly opts: CalendarHeaderStateOpts;
|
|
320
331
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
332
|
+
readonly attachment: RefAttachment;
|
|
321
333
|
constructor(opts: CalendarHeaderStateOpts, root: CalendarRootState | RangeCalendarRootState);
|
|
322
334
|
readonly props: {
|
|
323
335
|
readonly id: string;
|
|
@@ -335,6 +347,7 @@ export declare class CalendarMonthSelectState {
|
|
|
335
347
|
static create(opts: CalendarMonthSelectStateOpts): CalendarMonthSelectState;
|
|
336
348
|
readonly opts: CalendarMonthSelectStateOpts;
|
|
337
349
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
350
|
+
readonly attachment: RefAttachment;
|
|
338
351
|
constructor(opts: CalendarMonthSelectStateOpts, root: CalendarRootState | RangeCalendarRootState);
|
|
339
352
|
readonly monthItems: {
|
|
340
353
|
value: number;
|
|
@@ -371,6 +384,7 @@ export declare class CalendarYearSelectState {
|
|
|
371
384
|
static create(opts: CalendarYearSelectStateOpts): CalendarYearSelectState;
|
|
372
385
|
readonly opts: CalendarYearSelectStateOpts;
|
|
373
386
|
readonly root: CalendarRootState | RangeCalendarRootState;
|
|
387
|
+
readonly attachment: RefAttachment;
|
|
374
388
|
constructor(opts: CalendarYearSelectStateOpts, root: CalendarRootState | RangeCalendarRootState);
|
|
375
389
|
readonly years: number[];
|
|
376
390
|
readonly yearItems: {
|
|
@@ -19,10 +19,12 @@ export class CalendarRootState {
|
|
|
19
19
|
formatter;
|
|
20
20
|
accessibleHeadingId = useId();
|
|
21
21
|
domContext;
|
|
22
|
+
attachment;
|
|
22
23
|
months = $state([]);
|
|
23
24
|
announcer;
|
|
24
25
|
constructor(opts) {
|
|
25
26
|
this.opts = opts;
|
|
27
|
+
this.attachment = attachRef(this.opts.ref);
|
|
26
28
|
this.domContext = new DOMContext(opts.ref);
|
|
27
29
|
this.announcer = getAnnouncer(null);
|
|
28
30
|
this.formatter = createFormatter({
|
|
@@ -416,7 +418,7 @@ export class CalendarRootState {
|
|
|
416
418
|
[this.getBitsAttr("root")]: "",
|
|
417
419
|
//
|
|
418
420
|
onkeydown: this.onkeydown,
|
|
419
|
-
...
|
|
421
|
+
...this.attachment,
|
|
420
422
|
}));
|
|
421
423
|
}
|
|
422
424
|
export class CalendarHeadingState {
|
|
@@ -425,9 +427,11 @@ export class CalendarHeadingState {
|
|
|
425
427
|
}
|
|
426
428
|
opts;
|
|
427
429
|
root;
|
|
430
|
+
attachment;
|
|
428
431
|
constructor(opts, root) {
|
|
429
432
|
this.opts = opts;
|
|
430
433
|
this.root = root;
|
|
434
|
+
this.attachment = attachRef(this.opts.ref);
|
|
431
435
|
}
|
|
432
436
|
props = $derived.by(() => ({
|
|
433
437
|
id: this.opts.id.current,
|
|
@@ -435,7 +439,7 @@ export class CalendarHeadingState {
|
|
|
435
439
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
436
440
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
437
441
|
[this.root.getBitsAttr("heading")]: "",
|
|
438
|
-
...
|
|
442
|
+
...this.attachment,
|
|
439
443
|
}));
|
|
440
444
|
}
|
|
441
445
|
const CalendarCellContext = new Context("Calendar.Cell | RangeCalendar.Cell");
|
|
@@ -459,9 +463,11 @@ export class CalendarCellState {
|
|
|
459
463
|
day: "numeric",
|
|
460
464
|
year: "numeric",
|
|
461
465
|
}));
|
|
466
|
+
attachment;
|
|
462
467
|
constructor(opts, root) {
|
|
463
468
|
this.opts = opts;
|
|
464
469
|
this.root = root;
|
|
470
|
+
this.attachment = attachRef(this.opts.ref);
|
|
465
471
|
}
|
|
466
472
|
snippetProps = $derived.by(() => ({
|
|
467
473
|
disabled: this.isDisabled,
|
|
@@ -492,7 +498,7 @@ export class CalendarCellState {
|
|
|
492
498
|
"aria-disabled": getAriaDisabled(this.ariaDisabled),
|
|
493
499
|
...this.sharedDataAttrs,
|
|
494
500
|
[this.root.getBitsAttr("cell")]: "",
|
|
495
|
-
...
|
|
501
|
+
...this.attachment,
|
|
496
502
|
}));
|
|
497
503
|
}
|
|
498
504
|
export class CalendarDayState {
|
|
@@ -501,10 +507,12 @@ export class CalendarDayState {
|
|
|
501
507
|
}
|
|
502
508
|
opts;
|
|
503
509
|
cell;
|
|
510
|
+
attachment;
|
|
504
511
|
constructor(opts, cell) {
|
|
505
512
|
this.opts = opts;
|
|
506
513
|
this.cell = cell;
|
|
507
514
|
this.onclick = this.onclick.bind(this);
|
|
515
|
+
this.attachment = attachRef(this.opts.ref);
|
|
508
516
|
}
|
|
509
517
|
#tabindex = $derived.by(() => (this.cell.isOutsideMonth && this.cell.root.opts.disableDaysOutsideMonth.current) ||
|
|
510
518
|
this.cell.isDisabled
|
|
@@ -535,7 +543,7 @@ export class CalendarDayState {
|
|
|
535
543
|
"data-bits-day": "",
|
|
536
544
|
//
|
|
537
545
|
onclick: this.onclick,
|
|
538
|
-
...
|
|
546
|
+
...this.attachment,
|
|
539
547
|
}));
|
|
540
548
|
}
|
|
541
549
|
export class CalendarNextButtonState {
|
|
@@ -545,10 +553,12 @@ export class CalendarNextButtonState {
|
|
|
545
553
|
opts;
|
|
546
554
|
root;
|
|
547
555
|
isDisabled = $derived.by(() => this.root.isNextButtonDisabled);
|
|
556
|
+
attachment;
|
|
548
557
|
constructor(opts, root) {
|
|
549
558
|
this.opts = opts;
|
|
550
559
|
this.root = root;
|
|
551
560
|
this.onclick = this.onclick.bind(this);
|
|
561
|
+
this.attachment = attachRef(this.opts.ref);
|
|
552
562
|
}
|
|
553
563
|
onclick(_) {
|
|
554
564
|
if (this.isDisabled)
|
|
@@ -566,7 +576,7 @@ export class CalendarNextButtonState {
|
|
|
566
576
|
[this.root.getBitsAttr("next-button")]: "",
|
|
567
577
|
//
|
|
568
578
|
onclick: this.onclick,
|
|
569
|
-
...
|
|
579
|
+
...this.attachment,
|
|
570
580
|
}));
|
|
571
581
|
}
|
|
572
582
|
export class CalendarPrevButtonState {
|
|
@@ -576,10 +586,12 @@ export class CalendarPrevButtonState {
|
|
|
576
586
|
opts;
|
|
577
587
|
root;
|
|
578
588
|
isDisabled = $derived.by(() => this.root.isPrevButtonDisabled);
|
|
589
|
+
attachment;
|
|
579
590
|
constructor(opts, root) {
|
|
580
591
|
this.opts = opts;
|
|
581
592
|
this.root = root;
|
|
582
593
|
this.onclick = this.onclick.bind(this);
|
|
594
|
+
this.attachment = attachRef(this.opts.ref);
|
|
583
595
|
}
|
|
584
596
|
onclick(_) {
|
|
585
597
|
if (this.isDisabled)
|
|
@@ -597,7 +609,7 @@ export class CalendarPrevButtonState {
|
|
|
597
609
|
[this.root.getBitsAttr("prev-button")]: "",
|
|
598
610
|
//
|
|
599
611
|
onclick: this.onclick,
|
|
600
|
-
...
|
|
612
|
+
...this.attachment,
|
|
601
613
|
}));
|
|
602
614
|
}
|
|
603
615
|
export class CalendarGridState {
|
|
@@ -606,9 +618,11 @@ export class CalendarGridState {
|
|
|
606
618
|
}
|
|
607
619
|
opts;
|
|
608
620
|
root;
|
|
621
|
+
attachment;
|
|
609
622
|
constructor(opts, root) {
|
|
610
623
|
this.opts = opts;
|
|
611
624
|
this.root = root;
|
|
625
|
+
this.attachment = attachRef(this.opts.ref);
|
|
612
626
|
}
|
|
613
627
|
props = $derived.by(() => ({
|
|
614
628
|
id: this.opts.id.current,
|
|
@@ -619,7 +633,7 @@ export class CalendarGridState {
|
|
|
619
633
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
620
634
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
621
635
|
[this.root.getBitsAttr("grid")]: "",
|
|
622
|
-
...
|
|
636
|
+
...this.attachment,
|
|
623
637
|
}));
|
|
624
638
|
}
|
|
625
639
|
export class CalendarGridBodyState {
|
|
@@ -628,16 +642,18 @@ export class CalendarGridBodyState {
|
|
|
628
642
|
}
|
|
629
643
|
opts;
|
|
630
644
|
root;
|
|
645
|
+
attachment;
|
|
631
646
|
constructor(opts, root) {
|
|
632
647
|
this.opts = opts;
|
|
633
648
|
this.root = root;
|
|
649
|
+
this.attachment = attachRef(this.opts.ref);
|
|
634
650
|
}
|
|
635
651
|
props = $derived.by(() => ({
|
|
636
652
|
id: this.opts.id.current,
|
|
637
653
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
638
654
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
639
655
|
[this.root.getBitsAttr("grid-body")]: "",
|
|
640
|
-
...
|
|
656
|
+
...this.attachment,
|
|
641
657
|
}));
|
|
642
658
|
}
|
|
643
659
|
export class CalendarGridHeadState {
|
|
@@ -646,16 +662,18 @@ export class CalendarGridHeadState {
|
|
|
646
662
|
}
|
|
647
663
|
opts;
|
|
648
664
|
root;
|
|
665
|
+
attachment;
|
|
649
666
|
constructor(opts, root) {
|
|
650
667
|
this.opts = opts;
|
|
651
668
|
this.root = root;
|
|
669
|
+
this.attachment = attachRef(this.opts.ref);
|
|
652
670
|
}
|
|
653
671
|
props = $derived.by(() => ({
|
|
654
672
|
id: this.opts.id.current,
|
|
655
673
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
656
674
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
657
675
|
[this.root.getBitsAttr("grid-head")]: "",
|
|
658
|
-
...
|
|
676
|
+
...this.attachment,
|
|
659
677
|
}));
|
|
660
678
|
}
|
|
661
679
|
export class CalendarGridRowState {
|
|
@@ -664,16 +682,18 @@ export class CalendarGridRowState {
|
|
|
664
682
|
}
|
|
665
683
|
opts;
|
|
666
684
|
root;
|
|
685
|
+
attachment;
|
|
667
686
|
constructor(opts, root) {
|
|
668
687
|
this.opts = opts;
|
|
669
688
|
this.root = root;
|
|
689
|
+
this.attachment = attachRef(this.opts.ref);
|
|
670
690
|
}
|
|
671
691
|
props = $derived.by(() => ({
|
|
672
692
|
id: this.opts.id.current,
|
|
673
693
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
674
694
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
675
695
|
[this.root.getBitsAttr("grid-row")]: "",
|
|
676
|
-
...
|
|
696
|
+
...this.attachment,
|
|
677
697
|
}));
|
|
678
698
|
}
|
|
679
699
|
export class CalendarHeadCellState {
|
|
@@ -682,16 +702,18 @@ export class CalendarHeadCellState {
|
|
|
682
702
|
}
|
|
683
703
|
opts;
|
|
684
704
|
root;
|
|
705
|
+
attachment;
|
|
685
706
|
constructor(opts, root) {
|
|
686
707
|
this.opts = opts;
|
|
687
708
|
this.root = root;
|
|
709
|
+
this.attachment = attachRef(this.opts.ref);
|
|
688
710
|
}
|
|
689
711
|
props = $derived.by(() => ({
|
|
690
712
|
id: this.opts.id.current,
|
|
691
713
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
692
714
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
693
715
|
[this.root.getBitsAttr("head-cell")]: "",
|
|
694
|
-
...
|
|
716
|
+
...this.attachment,
|
|
695
717
|
}));
|
|
696
718
|
}
|
|
697
719
|
export class CalendarHeaderState {
|
|
@@ -700,16 +722,18 @@ export class CalendarHeaderState {
|
|
|
700
722
|
}
|
|
701
723
|
opts;
|
|
702
724
|
root;
|
|
725
|
+
attachment;
|
|
703
726
|
constructor(opts, root) {
|
|
704
727
|
this.opts = opts;
|
|
705
728
|
this.root = root;
|
|
729
|
+
this.attachment = attachRef(this.opts.ref);
|
|
706
730
|
}
|
|
707
731
|
props = $derived.by(() => ({
|
|
708
732
|
id: this.opts.id.current,
|
|
709
733
|
"data-disabled": getDataDisabled(this.root.opts.disabled.current),
|
|
710
734
|
"data-readonly": getDataReadonly(this.root.opts.readonly.current),
|
|
711
735
|
[this.root.getBitsAttr("header")]: "",
|
|
712
|
-
...
|
|
736
|
+
...this.attachment,
|
|
713
737
|
}));
|
|
714
738
|
}
|
|
715
739
|
export class CalendarMonthSelectState {
|
|
@@ -718,10 +742,12 @@ export class CalendarMonthSelectState {
|
|
|
718
742
|
}
|
|
719
743
|
opts;
|
|
720
744
|
root;
|
|
745
|
+
attachment;
|
|
721
746
|
constructor(opts, root) {
|
|
722
747
|
this.opts = opts;
|
|
723
748
|
this.root = root;
|
|
724
749
|
this.onchange = this.onchange.bind(this);
|
|
750
|
+
this.attachment = attachRef(this.opts.ref);
|
|
725
751
|
}
|
|
726
752
|
monthItems = $derived.by(() => {
|
|
727
753
|
this.root.opts.locale.current;
|
|
@@ -770,7 +796,7 @@ export class CalendarMonthSelectState {
|
|
|
770
796
|
[this.root.getBitsAttr("month-select")]: "",
|
|
771
797
|
//
|
|
772
798
|
onchange: this.onchange,
|
|
773
|
-
...
|
|
799
|
+
...this.attachment,
|
|
774
800
|
}));
|
|
775
801
|
}
|
|
776
802
|
export class CalendarYearSelectState {
|
|
@@ -779,10 +805,12 @@ export class CalendarYearSelectState {
|
|
|
779
805
|
}
|
|
780
806
|
opts;
|
|
781
807
|
root;
|
|
808
|
+
attachment;
|
|
782
809
|
constructor(opts, root) {
|
|
783
810
|
this.opts = opts;
|
|
784
811
|
this.root = root;
|
|
785
812
|
this.onchange = this.onchange.bind(this);
|
|
813
|
+
this.attachment = attachRef(this.opts.ref);
|
|
786
814
|
}
|
|
787
815
|
years = $derived.by(() => {
|
|
788
816
|
if (this.opts.years.current && this.opts.years.current.length)
|
|
@@ -835,6 +863,6 @@ export class CalendarYearSelectState {
|
|
|
835
863
|
[this.root.getBitsAttr("year-select")]: "",
|
|
836
864
|
//
|
|
837
865
|
onchange: this.onchange,
|
|
838
|
-
...
|
|
866
|
+
...this.attachment,
|
|
839
867
|
}));
|
|
840
868
|
}
|