Brunobkr commited on
Commit
f47da7a
·
verified ·
1 Parent(s): cb207f0

Upload folder using huggingface_hub (part 26)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. tools/ui/node_modules/bits-ui/dist/bits/popover/popover.svelte.d.ts +148 -0
  2. tools/ui/node_modules/bits-ui/dist/bits/popover/popover.svelte.js +404 -0
  3. tools/ui/node_modules/bits-ui/dist/bits/popover/types.d.ts +57 -0
  4. tools/ui/node_modules/bits-ui/dist/bits/popover/types.js +1 -0
  5. tools/ui/node_modules/bits-ui/dist/bits/progress/components/progress.svelte +40 -0
  6. tools/ui/node_modules/bits-ui/dist/bits/progress/components/progress.svelte.d.ts +4 -0
  7. tools/ui/node_modules/bits-ui/dist/bits/progress/exports.d.ts +2 -0
  8. tools/ui/node_modules/bits-ui/dist/bits/progress/exports.js +1 -0
  9. tools/ui/node_modules/bits-ui/dist/bits/progress/index.d.ts +1 -0
  10. tools/ui/node_modules/bits-ui/dist/bits/progress/index.js +1 -0
  11. tools/ui/node_modules/bits-ui/dist/bits/progress/progress.svelte.d.ts +27 -0
  12. tools/ui/node_modules/bits-ui/dist/bits/progress/progress.svelte.js +36 -0
  13. tools/ui/node_modules/bits-ui/dist/bits/progress/types.d.ts +24 -0
  14. tools/ui/node_modules/bits-ui/dist/bits/progress/types.js +1 -0
  15. tools/ui/node_modules/bits-ui/dist/bits/radio-group/components/radio-group-input.svelte +10 -0
  16. tools/ui/node_modules/bits-ui/dist/bits/radio-group/components/radio-group-input.svelte.d.ts +18 -0
  17. tools/ui/node_modules/bits-ui/dist/bits/radio-group/components/radio-group-item.svelte +38 -0
  18. tools/ui/node_modules/bits-ui/dist/bits/radio-group/components/radio-group-item.svelte.d.ts +4 -0
  19. tools/ui/node_modules/bits-ui/dist/bits/radio-group/components/radio-group.svelte +60 -0
  20. tools/ui/node_modules/bits-ui/dist/bits/radio-group/components/radio-group.svelte.d.ts +4 -0
  21. tools/ui/node_modules/bits-ui/dist/bits/radio-group/exports.d.ts +3 -0
  22. tools/ui/node_modules/bits-ui/dist/bits/radio-group/exports.js +2 -0
  23. tools/ui/node_modules/bits-ui/dist/bits/radio-group/index.d.ts +1 -0
  24. tools/ui/node_modules/bits-ui/dist/bits/radio-group/index.js +1 -0
  25. tools/ui/node_modules/bits-ui/dist/bits/radio-group/radio-group.svelte.d.ts +86 -0
  26. tools/ui/node_modules/bits-ui/dist/bits/radio-group/radio-group.svelte.js +147 -0
  27. tools/ui/node_modules/bits-ui/dist/bits/radio-group/types.d.ts +73 -0
  28. tools/ui/node_modules/bits-ui/dist/bits/radio-group/types.js +1 -0
  29. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/components/range-calendar-cell.svelte +38 -0
  30. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/components/range-calendar-cell.svelte.d.ts +4 -0
  31. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/components/range-calendar-day.svelte +38 -0
  32. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/components/range-calendar-day.svelte.d.ts +4 -0
  33. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/components/range-calendar.svelte +153 -0
  34. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/components/range-calendar.svelte.d.ts +4 -0
  35. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/exports.d.ts +15 -0
  36. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/exports.js +14 -0
  37. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/index.d.ts +1 -0
  38. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/index.js +1 -0
  39. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/range-calendar.svelte.d.ts +232 -0
  40. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/range-calendar.svelte.js +672 -0
  41. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/types.d.ts +212 -0
  42. tools/ui/node_modules/bits-ui/dist/bits/range-calendar/types.js +1 -0
  43. tools/ui/node_modules/bits-ui/dist/bits/rating-group/components/rating-group-input.svelte +10 -0
  44. tools/ui/node_modules/bits-ui/dist/bits/rating-group/components/rating-group-input.svelte.d.ts +18 -0
  45. tools/ui/node_modules/bits-ui/dist/bits/rating-group/components/rating-group-item.svelte +38 -0
  46. tools/ui/node_modules/bits-ui/dist/bits/rating-group/components/rating-group-item.svelte.d.ts +4 -0
  47. tools/ui/node_modules/bits-ui/dist/bits/rating-group/components/rating-group.svelte +80 -0
  48. tools/ui/node_modules/bits-ui/dist/bits/rating-group/components/rating-group.svelte.d.ts +4 -0
  49. tools/ui/node_modules/bits-ui/dist/bits/rating-group/exports.d.ts +3 -0
  50. tools/ui/node_modules/bits-ui/dist/bits/rating-group/exports.js +2 -0
tools/ui/node_modules/bits-ui/dist/bits/popover/popover.svelte.d.ts ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { type ReadableBoxedValues, type WritableBoxedValues, DOMContext } from "svelte-toolbelt";
2
+ import type { BitsFocusEvent, BitsKeyboardEvent, BitsMouseEvent, BitsPointerEvent, OnChangeFn, RefAttachment, WithRefOpts } from "../../internal/types.js";
3
+ import type { Measurable } from "../../internal/floating-svelte/types.js";
4
+ import { PresenceManager } from "../../internal/presence-manager.svelte.js";
5
+ interface PopoverRootStateOpts extends WritableBoxedValues<{
6
+ open: boolean;
7
+ }>, ReadableBoxedValues<{
8
+ onOpenChangeComplete: OnChangeFn<boolean>;
9
+ }> {
10
+ }
11
+ export declare class PopoverRootState {
12
+ #private;
13
+ static create(opts: PopoverRootStateOpts): PopoverRootState;
14
+ readonly opts: PopoverRootStateOpts;
15
+ contentNode: HTMLElement | null;
16
+ contentPresence: PresenceManager;
17
+ triggerNode: HTMLElement | null;
18
+ overlayNode: HTMLElement | null;
19
+ overlayPresence: PresenceManager;
20
+ openedViaHover: boolean;
21
+ hasInteractedWithContent: boolean;
22
+ hoverCooldown: boolean;
23
+ closeDelay: number;
24
+ constructor(opts: PopoverRootStateOpts);
25
+ setDomContext(ctx: DOMContext): void;
26
+ toggleOpen(): void;
27
+ handleClose(): void;
28
+ handleHoverOpen(): void;
29
+ handleHoverClose(): void;
30
+ handleDelayedHoverClose(): void;
31
+ cancelDelayedClose(): void;
32
+ markInteraction(): void;
33
+ }
34
+ interface PopoverTriggerStateOpts extends WithRefOpts, ReadableBoxedValues<{
35
+ disabled: boolean;
36
+ openOnHover: boolean;
37
+ openDelay: number;
38
+ closeDelay: number;
39
+ }> {
40
+ }
41
+ export declare class PopoverTriggerState {
42
+ #private;
43
+ static create(opts: PopoverTriggerStateOpts): PopoverTriggerState;
44
+ readonly opts: PopoverTriggerStateOpts;
45
+ readonly root: PopoverRootState;
46
+ readonly attachment: RefAttachment;
47
+ readonly domContext: DOMContext;
48
+ constructor(opts: PopoverTriggerStateOpts, root: PopoverRootState);
49
+ onpointerenter(e: BitsPointerEvent): void;
50
+ onpointerleave(e: BitsPointerEvent): void;
51
+ onclick(e: BitsMouseEvent): void;
52
+ onkeydown(e: BitsKeyboardEvent): void;
53
+ readonly props: {
54
+ readonly id: string;
55
+ readonly "aria-haspopup": "dialog";
56
+ readonly "aria-expanded": "true" | "false";
57
+ readonly "data-state": "open" | "closed";
58
+ readonly "aria-controls": string | undefined;
59
+ readonly disabled: boolean;
60
+ readonly onkeydown: (e: BitsKeyboardEvent) => void;
61
+ readonly onclick: (e: BitsMouseEvent) => void;
62
+ readonly onpointerenter: (e: BitsPointerEvent) => void;
63
+ readonly onpointerleave: (e: BitsPointerEvent) => void;
64
+ };
65
+ }
66
+ interface PopoverContentStateOpts extends WithRefOpts, ReadableBoxedValues<{
67
+ onInteractOutside: (e: PointerEvent) => void;
68
+ onEscapeKeydown: (e: KeyboardEvent) => void;
69
+ customAnchor: string | HTMLElement | null | Measurable;
70
+ }> {
71
+ }
72
+ export declare class PopoverContentState {
73
+ static create(opts: PopoverContentStateOpts): PopoverContentState;
74
+ readonly opts: PopoverContentStateOpts;
75
+ readonly root: PopoverRootState;
76
+ readonly attachment: RefAttachment;
77
+ constructor(opts: PopoverContentStateOpts, root: PopoverRootState);
78
+ onpointerdown(_: BitsPointerEvent): void;
79
+ onfocusin(e: BitsFocusEvent): void;
80
+ onpointerenter(e: BitsPointerEvent): void;
81
+ onpointerleave(e: BitsPointerEvent): void;
82
+ onInteractOutside: (e: PointerEvent) => void;
83
+ onEscapeKeydown: (e: KeyboardEvent) => void;
84
+ get shouldRender(): boolean;
85
+ get shouldTrapFocus(): boolean;
86
+ readonly snippetProps: {
87
+ open: boolean;
88
+ };
89
+ readonly props: {
90
+ readonly style: {
91
+ readonly pointerEvents: "auto";
92
+ readonly contain: "layout style";
93
+ };
94
+ readonly onpointerdown: (_: BitsPointerEvent) => void;
95
+ readonly onfocusin: (e: BitsFocusEvent) => void;
96
+ readonly onpointerenter: (e: BitsPointerEvent) => void;
97
+ readonly onpointerleave: (e: BitsPointerEvent) => void;
98
+ readonly "data-starting-style"?: "";
99
+ readonly "data-ending-style"?: "";
100
+ readonly id: string;
101
+ readonly tabindex: -1;
102
+ readonly "data-state": "open" | "closed";
103
+ };
104
+ readonly popperProps: {
105
+ onInteractOutside: (e: PointerEvent) => void;
106
+ onEscapeKeydown: (e: KeyboardEvent) => void;
107
+ };
108
+ }
109
+ interface PopoverCloseStateOpts extends WithRefOpts {
110
+ }
111
+ export declare class PopoverCloseState {
112
+ static create(opts: PopoverCloseStateOpts): PopoverCloseState;
113
+ readonly opts: PopoverCloseStateOpts;
114
+ readonly root: PopoverRootState;
115
+ readonly attachment: RefAttachment;
116
+ constructor(opts: PopoverCloseStateOpts, root: PopoverRootState);
117
+ onclick(_: BitsPointerEvent): void;
118
+ onkeydown(e: BitsKeyboardEvent): void;
119
+ readonly props: {
120
+ readonly id: string;
121
+ readonly onclick: (_: BitsPointerEvent) => void;
122
+ readonly onkeydown: (e: BitsKeyboardEvent) => void;
123
+ readonly type: "button";
124
+ };
125
+ }
126
+ interface PopoverOverlayStateOpts extends WithRefOpts {
127
+ }
128
+ export declare class PopoverOverlayState {
129
+ static create(opts: PopoverOverlayStateOpts): PopoverOverlayState;
130
+ readonly opts: PopoverOverlayStateOpts;
131
+ readonly root: PopoverRootState;
132
+ readonly attachment: RefAttachment;
133
+ constructor(opts: PopoverOverlayStateOpts, root: PopoverRootState);
134
+ get shouldRender(): boolean;
135
+ readonly snippetProps: {
136
+ open: boolean;
137
+ };
138
+ readonly props: {
139
+ readonly "data-starting-style"?: "";
140
+ readonly "data-ending-style"?: "";
141
+ readonly id: string;
142
+ readonly style: {
143
+ readonly pointerEvents: "auto";
144
+ };
145
+ readonly "data-state": "open" | "closed";
146
+ };
147
+ }
148
+ export {};
tools/ui/node_modules/bits-ui/dist/bits/popover/popover.svelte.js ADDED
@@ -0,0 +1,404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { attachRef, boxWith, DOMContext, } from "svelte-toolbelt";
2
+ import { Context, watch } from "runed";
3
+ import { kbd } from "../../internal/kbd.js";
4
+ import { createBitsAttrs, boolToStr, getDataOpenClosed, getDataTransitionAttrs, } from "../../internal/attrs.js";
5
+ import { isElement, isTouch } from "../../internal/is.js";
6
+ import { PresenceManager } from "../../internal/presence-manager.svelte.js";
7
+ import { SafePolygon } from "../../internal/safe-polygon.svelte.js";
8
+ import { isTabbable } from "tabbable";
9
+ const popoverAttrs = createBitsAttrs({
10
+ component: "popover",
11
+ parts: ["root", "trigger", "content", "close", "overlay"],
12
+ });
13
+ const PopoverRootContext = new Context("Popover.Root");
14
+ export class PopoverRootState {
15
+ static create(opts) {
16
+ return PopoverRootContext.set(new PopoverRootState(opts));
17
+ }
18
+ opts;
19
+ contentNode = $state(null);
20
+ contentPresence;
21
+ triggerNode = $state(null);
22
+ overlayNode = $state(null);
23
+ overlayPresence;
24
+ // hover tracking state
25
+ openedViaHover = $state(false);
26
+ hasInteractedWithContent = $state(false);
27
+ hoverCooldown = $state(false);
28
+ closeDelay = $state(0);
29
+ #closeTimeout = null;
30
+ #domContext = null;
31
+ constructor(opts) {
32
+ this.opts = opts;
33
+ this.contentPresence = new PresenceManager({
34
+ ref: boxWith(() => this.contentNode),
35
+ open: this.opts.open,
36
+ onComplete: () => {
37
+ this.opts.onOpenChangeComplete.current(this.opts.open.current);
38
+ },
39
+ });
40
+ this.overlayPresence = new PresenceManager({
41
+ ref: boxWith(() => this.overlayNode),
42
+ open: this.opts.open,
43
+ });
44
+ watch(() => this.opts.open.current, (isOpen) => {
45
+ if (!isOpen) {
46
+ this.openedViaHover = false;
47
+ this.hasInteractedWithContent = false;
48
+ this.#clearCloseTimeout();
49
+ }
50
+ });
51
+ }
52
+ setDomContext(ctx) {
53
+ this.#domContext = ctx;
54
+ }
55
+ #clearCloseTimeout() {
56
+ if (this.#closeTimeout !== null && this.#domContext) {
57
+ this.#domContext.clearTimeout(this.#closeTimeout);
58
+ this.#closeTimeout = null;
59
+ }
60
+ }
61
+ toggleOpen() {
62
+ this.#clearCloseTimeout();
63
+ this.opts.open.current = !this.opts.open.current;
64
+ }
65
+ handleClose() {
66
+ this.#clearCloseTimeout();
67
+ if (!this.opts.open.current)
68
+ return;
69
+ this.opts.open.current = false;
70
+ }
71
+ handleHoverOpen() {
72
+ this.#clearCloseTimeout();
73
+ if (this.opts.open.current)
74
+ return;
75
+ this.openedViaHover = true;
76
+ this.opts.open.current = true;
77
+ }
78
+ handleHoverClose() {
79
+ if (!this.opts.open.current)
80
+ return;
81
+ // only close if opened via hover and user hasn't interacted with content
82
+ if (this.openedViaHover && !this.hasInteractedWithContent) {
83
+ this.opts.open.current = false;
84
+ }
85
+ }
86
+ handleDelayedHoverClose() {
87
+ if (!this.opts.open.current)
88
+ return;
89
+ if (!this.openedViaHover || this.hasInteractedWithContent)
90
+ return;
91
+ this.#clearCloseTimeout();
92
+ if (this.closeDelay <= 0) {
93
+ this.opts.open.current = false;
94
+ }
95
+ else if (this.#domContext) {
96
+ this.#closeTimeout = this.#domContext.setTimeout(() => {
97
+ if (this.openedViaHover && !this.hasInteractedWithContent) {
98
+ this.opts.open.current = false;
99
+ }
100
+ this.#closeTimeout = null;
101
+ }, this.closeDelay);
102
+ }
103
+ }
104
+ cancelDelayedClose() {
105
+ this.#clearCloseTimeout();
106
+ }
107
+ markInteraction() {
108
+ this.hasInteractedWithContent = true;
109
+ this.#clearCloseTimeout();
110
+ }
111
+ }
112
+ export class PopoverTriggerState {
113
+ static create(opts) {
114
+ return new PopoverTriggerState(opts, PopoverRootContext.get());
115
+ }
116
+ opts;
117
+ root;
118
+ attachment;
119
+ domContext;
120
+ #openTimeout = null;
121
+ #closeTimeout = null;
122
+ #isHovering = $state(false);
123
+ constructor(opts, root) {
124
+ this.opts = opts;
125
+ this.root = root;
126
+ this.attachment = attachRef(this.opts.ref, (v) => (this.root.triggerNode = v));
127
+ this.domContext = new DOMContext(opts.ref);
128
+ this.root.setDomContext(this.domContext);
129
+ this.onclick = this.onclick.bind(this);
130
+ this.onkeydown = this.onkeydown.bind(this);
131
+ this.onpointerenter = this.onpointerenter.bind(this);
132
+ this.onpointerleave = this.onpointerleave.bind(this);
133
+ watch(() => this.opts.closeDelay.current, (delay) => {
134
+ this.root.closeDelay = delay;
135
+ });
136
+ }
137
+ #clearOpenTimeout() {
138
+ if (this.#openTimeout !== null) {
139
+ this.domContext.clearTimeout(this.#openTimeout);
140
+ this.#openTimeout = null;
141
+ }
142
+ }
143
+ #clearCloseTimeout() {
144
+ if (this.#closeTimeout !== null) {
145
+ this.domContext.clearTimeout(this.#closeTimeout);
146
+ this.#closeTimeout = null;
147
+ }
148
+ }
149
+ #clearAllTimeouts() {
150
+ this.#clearOpenTimeout();
151
+ this.#clearCloseTimeout();
152
+ }
153
+ onpointerenter(e) {
154
+ if (this.opts.disabled.current)
155
+ return;
156
+ if (!this.opts.openOnHover.current)
157
+ return;
158
+ if (isTouch(e))
159
+ return;
160
+ this.#isHovering = true;
161
+ this.#clearCloseTimeout();
162
+ this.root.cancelDelayedClose();
163
+ if (this.root.opts.open.current || this.root.hoverCooldown)
164
+ return;
165
+ const delay = this.opts.openDelay.current;
166
+ if (delay <= 0) {
167
+ this.root.handleHoverOpen();
168
+ }
169
+ else {
170
+ this.#openTimeout = this.domContext.setTimeout(() => {
171
+ this.root.handleHoverOpen();
172
+ this.#openTimeout = null;
173
+ }, delay);
174
+ }
175
+ }
176
+ onpointerleave(e) {
177
+ if (this.opts.disabled.current)
178
+ return;
179
+ if (!this.opts.openOnHover.current)
180
+ return;
181
+ if (isTouch(e))
182
+ return;
183
+ this.#isHovering = false;
184
+ this.#clearOpenTimeout();
185
+ this.root.hoverCooldown = false;
186
+ // let GraceArea handle the close - it will call handleHoverClose via onPointerExit
187
+ // we just need to stop any pending open timer
188
+ }
189
+ onclick(e) {
190
+ if (this.opts.disabled.current)
191
+ return;
192
+ if (e.button !== 0)
193
+ return;
194
+ this.#clearAllTimeouts();
195
+ // if clicked while hovering and popover is open, convert to click-based open
196
+ if (this.#isHovering && this.root.opts.open.current && this.root.openedViaHover) {
197
+ this.root.openedViaHover = false;
198
+ this.root.hasInteractedWithContent = true;
199
+ return;
200
+ }
201
+ // if closing while hovering with openOnHover enabled, set cooldown to prevent
202
+ // immediate re-open via hover
203
+ if (this.#isHovering && this.opts.openOnHover.current && this.root.opts.open.current) {
204
+ this.root.hoverCooldown = true;
205
+ }
206
+ // if clicking to open while in cooldown, reset cooldown (explicit open)
207
+ if (this.root.hoverCooldown && !this.root.opts.open.current) {
208
+ this.root.hoverCooldown = false;
209
+ }
210
+ this.root.toggleOpen();
211
+ }
212
+ onkeydown(e) {
213
+ if (this.opts.disabled.current)
214
+ return;
215
+ if (!(e.key === kbd.ENTER || e.key === kbd.SPACE))
216
+ return;
217
+ e.preventDefault();
218
+ this.#clearAllTimeouts();
219
+ this.root.toggleOpen();
220
+ }
221
+ #getAriaControls() {
222
+ if (this.root.opts.open.current && this.root.contentNode?.id) {
223
+ return this.root.contentNode?.id;
224
+ }
225
+ }
226
+ props = $derived.by(() => ({
227
+ id: this.opts.id.current,
228
+ "aria-haspopup": "dialog",
229
+ "aria-expanded": boolToStr(this.root.opts.open.current),
230
+ "data-state": getDataOpenClosed(this.root.opts.open.current),
231
+ "aria-controls": this.#getAriaControls(),
232
+ [popoverAttrs.trigger]: "",
233
+ disabled: this.opts.disabled.current,
234
+ //
235
+ onkeydown: this.onkeydown,
236
+ onclick: this.onclick,
237
+ onpointerenter: this.onpointerenter,
238
+ onpointerleave: this.onpointerleave,
239
+ ...this.attachment,
240
+ }));
241
+ }
242
+ export class PopoverContentState {
243
+ static create(opts) {
244
+ return new PopoverContentState(opts, PopoverRootContext.get());
245
+ }
246
+ opts;
247
+ root;
248
+ attachment;
249
+ constructor(opts, root) {
250
+ this.opts = opts;
251
+ this.root = root;
252
+ this.attachment = attachRef(this.opts.ref, (v) => (this.root.contentNode = v));
253
+ this.onpointerdown = this.onpointerdown.bind(this);
254
+ this.onfocusin = this.onfocusin.bind(this);
255
+ this.onpointerenter = this.onpointerenter.bind(this);
256
+ this.onpointerleave = this.onpointerleave.bind(this);
257
+ new SafePolygon({
258
+ triggerNode: () => this.root.triggerNode,
259
+ contentNode: () => this.root.contentNode,
260
+ enabled: () => this.root.opts.open.current &&
261
+ this.root.openedViaHover &&
262
+ !this.root.hasInteractedWithContent,
263
+ onPointerExit: () => {
264
+ this.root.handleDelayedHoverClose();
265
+ },
266
+ });
267
+ }
268
+ onpointerdown(_) {
269
+ this.root.markInteraction();
270
+ }
271
+ onfocusin(e) {
272
+ const target = e.target;
273
+ if (isElement(target) && isTabbable(target)) {
274
+ this.root.markInteraction();
275
+ }
276
+ }
277
+ onpointerenter(e) {
278
+ if (isTouch(e))
279
+ return;
280
+ this.root.cancelDelayedClose();
281
+ }
282
+ onpointerleave(e) {
283
+ if (isTouch(e))
284
+ return;
285
+ // handled by grace area
286
+ }
287
+ onInteractOutside = (e) => {
288
+ this.opts.onInteractOutside.current(e);
289
+ if (e.defaultPrevented)
290
+ return;
291
+ if (!isElement(e.target))
292
+ return;
293
+ const closestTrigger = e.target.closest(popoverAttrs.selector("trigger"));
294
+ if (closestTrigger && closestTrigger === this.root.triggerNode)
295
+ return;
296
+ if (this.opts.customAnchor.current) {
297
+ if (isElement(this.opts.customAnchor.current)) {
298
+ if (this.opts.customAnchor.current.contains(e.target))
299
+ return;
300
+ }
301
+ else if (typeof this.opts.customAnchor.current === "string") {
302
+ const el = document.querySelector(this.opts.customAnchor.current);
303
+ if (el && el.contains(e.target))
304
+ return;
305
+ }
306
+ }
307
+ this.root.handleClose();
308
+ };
309
+ onEscapeKeydown = (e) => {
310
+ this.opts.onEscapeKeydown.current(e);
311
+ if (e.defaultPrevented)
312
+ return;
313
+ this.root.handleClose();
314
+ };
315
+ get shouldRender() {
316
+ return this.root.contentPresence.shouldRender;
317
+ }
318
+ get shouldTrapFocus() {
319
+ if (this.root.openedViaHover && !this.root.hasInteractedWithContent)
320
+ return false;
321
+ return true;
322
+ }
323
+ snippetProps = $derived.by(() => ({ open: this.root.opts.open.current }));
324
+ props = $derived.by(() => ({
325
+ id: this.opts.id.current,
326
+ tabindex: -1,
327
+ "data-state": getDataOpenClosed(this.root.opts.open.current),
328
+ ...getDataTransitionAttrs(this.root.contentPresence.transitionStatus),
329
+ [popoverAttrs.content]: "",
330
+ style: {
331
+ pointerEvents: "auto",
332
+ // CSS containment isolates style/layout/paint calculations from the rest of the page
333
+ contain: "layout style",
334
+ },
335
+ onpointerdown: this.onpointerdown,
336
+ onfocusin: this.onfocusin,
337
+ onpointerenter: this.onpointerenter,
338
+ onpointerleave: this.onpointerleave,
339
+ ...this.attachment,
340
+ }));
341
+ popperProps = {
342
+ onInteractOutside: this.onInteractOutside,
343
+ onEscapeKeydown: this.onEscapeKeydown,
344
+ };
345
+ }
346
+ export class PopoverCloseState {
347
+ static create(opts) {
348
+ return new PopoverCloseState(opts, PopoverRootContext.get());
349
+ }
350
+ opts;
351
+ root;
352
+ attachment;
353
+ constructor(opts, root) {
354
+ this.opts = opts;
355
+ this.root = root;
356
+ this.attachment = attachRef(this.opts.ref);
357
+ this.onclick = this.onclick.bind(this);
358
+ this.onkeydown = this.onkeydown.bind(this);
359
+ }
360
+ onclick(_) {
361
+ this.root.handleClose();
362
+ }
363
+ onkeydown(e) {
364
+ if (!(e.key === kbd.ENTER || e.key === kbd.SPACE))
365
+ return;
366
+ e.preventDefault();
367
+ this.root.handleClose();
368
+ }
369
+ props = $derived.by(() => ({
370
+ id: this.opts.id.current,
371
+ onclick: this.onclick,
372
+ onkeydown: this.onkeydown,
373
+ type: "button",
374
+ [popoverAttrs.close]: "",
375
+ ...this.attachment,
376
+ }));
377
+ }
378
+ export class PopoverOverlayState {
379
+ static create(opts) {
380
+ return new PopoverOverlayState(opts, PopoverRootContext.get());
381
+ }
382
+ opts;
383
+ root;
384
+ attachment;
385
+ constructor(opts, root) {
386
+ this.opts = opts;
387
+ this.root = root;
388
+ this.attachment = attachRef(this.opts.ref, (v) => (this.root.overlayNode = v));
389
+ }
390
+ get shouldRender() {
391
+ return this.root.overlayPresence.shouldRender;
392
+ }
393
+ snippetProps = $derived.by(() => ({ open: this.root.opts.open.current }));
394
+ props = $derived.by(() => ({
395
+ id: this.opts.id.current,
396
+ [popoverAttrs.overlay]: "",
397
+ style: {
398
+ pointerEvents: "auto",
399
+ },
400
+ "data-state": getDataOpenClosed(this.root.opts.open.current),
401
+ ...getDataTransitionAttrs(this.root.overlayPresence.transitionStatus),
402
+ ...this.attachment,
403
+ }));
404
+ }
tools/ui/node_modules/bits-ui/dist/bits/popover/types.d.ts ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { ArrowProps, ArrowPropsWithoutHTML } from "../utilities/arrow/types.js";
2
+ import type { PopperLayerProps, PopperLayerStaticProps } from "../utilities/popper-layer/types.js";
3
+ import type { OnChangeFn, WithChild, WithChildNoChildrenSnippetProps, WithChildren, Without } from "../../internal/types.js";
4
+ import type { BitsPrimitiveButtonAttributes, BitsPrimitiveDivAttributes } from "../../shared/attributes.js";
5
+ import type { FloatingContentSnippetProps, StaticContentSnippetProps } from "../../shared/types.js";
6
+ import type { PortalProps } from "../../types.js";
7
+ import type { PresenceLayerProps } from "../utilities/presence-layer/types.js";
8
+ export type PopoverRootPropsWithoutHTML = WithChildren<{
9
+ /**
10
+ * The open state of the popover.
11
+ */
12
+ open?: boolean;
13
+ /**
14
+ * A callback that is called when the popover's open state changes.
15
+ */
16
+ onOpenChange?: OnChangeFn<boolean>;
17
+ /**
18
+ * A callback that is called when the popover's open state changes and the animation is complete.
19
+ */
20
+ onOpenChangeComplete?: OnChangeFn<boolean>;
21
+ }>;
22
+ export type PopoverRootProps = PopoverRootPropsWithoutHTML;
23
+ export type PopoverContentPropsWithoutHTML = WithChildNoChildrenSnippetProps<Omit<PopperLayerProps, "content" | "loop">, FloatingContentSnippetProps>;
24
+ export type PopoverContentProps = PopoverContentPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, PopoverContentPropsWithoutHTML>;
25
+ export type PopoverContentStaticPropsWithoutHTML = WithChildNoChildrenSnippetProps<Omit<PopperLayerStaticProps, "content" | "loop">, StaticContentSnippetProps>;
26
+ export type PopoverContentStaticProps = PopoverContentStaticPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, PopoverContentStaticPropsWithoutHTML>;
27
+ export type PopoverTriggerPropsWithoutHTML = WithChild<{
28
+ /**
29
+ * Whether the popover should open when the trigger is hovered.
30
+ * @default false
31
+ */
32
+ openOnHover?: boolean;
33
+ /**
34
+ * How long to wait before opening the popover on hover (ms).
35
+ * Only applies when `openOnHover` is `true`.
36
+ * @default 700
37
+ */
38
+ openDelay?: number;
39
+ /**
40
+ * How long to wait before closing the popover after hover ends (ms).
41
+ * Only applies when `openOnHover` is `true`.
42
+ * @default 300
43
+ */
44
+ closeDelay?: number;
45
+ }>;
46
+ export type PopoverTriggerProps = PopoverTriggerPropsWithoutHTML & Without<BitsPrimitiveButtonAttributes, PopoverTriggerPropsWithoutHTML>;
47
+ export type PopoverClosePropsWithoutHTML = WithChild;
48
+ export type PopoverCloseProps = PopoverClosePropsWithoutHTML & Without<BitsPrimitiveButtonAttributes, PopoverClosePropsWithoutHTML>;
49
+ export type PopoverArrowPropsWithoutHTML = ArrowPropsWithoutHTML;
50
+ export type PopoverArrowProps = ArrowProps;
51
+ export type PopoverPortalPropsWithoutHTML = PortalProps;
52
+ export type PopoverPortalProps = PortalProps;
53
+ export type PopoverOverlaySnippetProps = {
54
+ open: boolean;
55
+ };
56
+ export type PopoverOverlayPropsWithoutHTML = WithChild<PresenceLayerProps, PopoverOverlaySnippetProps>;
57
+ export type PopoverOverlayProps = PopoverOverlayPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, PopoverOverlayPropsWithoutHTML>;
tools/ui/node_modules/bits-ui/dist/bits/popover/types.js ADDED
@@ -0,0 +1 @@
 
 
1
+ export {};
tools/ui/node_modules/bits-ui/dist/bits/progress/components/progress.svelte ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { boxWith, mergeProps } from "svelte-toolbelt";
3
+ import type { ProgressRootProps } from "../types.js";
4
+ import { ProgressRootState } from "../progress.svelte.js";
5
+ import { createId } from "../../../internal/create-id.js";
6
+
7
+ const uid = $props.id();
8
+
9
+ let {
10
+ child,
11
+ children,
12
+ value = 0,
13
+ max = 100,
14
+ min = 0,
15
+ id = createId(uid),
16
+ ref = $bindable(null),
17
+ ...restProps
18
+ }: ProgressRootProps = $props();
19
+
20
+ const rootState = ProgressRootState.create({
21
+ value: boxWith(() => value),
22
+ max: boxWith(() => max),
23
+ min: boxWith(() => min),
24
+ id: boxWith(() => id),
25
+ ref: boxWith(
26
+ () => ref,
27
+ (v) => (ref = v)
28
+ ),
29
+ });
30
+
31
+ const mergedProps = $derived(mergeProps(restProps, rootState.props));
32
+ </script>
33
+
34
+ {#if child}
35
+ {@render child({ props: mergedProps })}
36
+ {:else}
37
+ <div {...mergedProps}>
38
+ {@render children?.()}
39
+ </div>
40
+ {/if}
tools/ui/node_modules/bits-ui/dist/bits/progress/components/progress.svelte.d.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import type { ProgressRootProps } from "../types.js";
2
+ declare const Progress: import("svelte").Component<ProgressRootProps, {}, "ref">;
3
+ type Progress = ReturnType<typeof Progress>;
4
+ export default Progress;
tools/ui/node_modules/bits-ui/dist/bits/progress/exports.d.ts ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ export { default as Root } from "./components/progress.svelte";
2
+ export type { ProgressRootProps as RootProps } from "./types.js";
tools/ui/node_modules/bits-ui/dist/bits/progress/exports.js ADDED
@@ -0,0 +1 @@
 
 
1
+ export { default as Root } from "./components/progress.svelte";
tools/ui/node_modules/bits-ui/dist/bits/progress/index.d.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ export * as Progress from "./exports.js";
tools/ui/node_modules/bits-ui/dist/bits/progress/index.js ADDED
@@ -0,0 +1 @@
 
 
1
+ export * as Progress from "./exports.js";
tools/ui/node_modules/bits-ui/dist/bits/progress/progress.svelte.d.ts ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { type ReadableBoxedValues } from "svelte-toolbelt";
2
+ import type { RefAttachment, WithRefOpts } from "../../internal/types.js";
3
+ interface ProgressRootStateOpts extends WithRefOpts, ReadableBoxedValues<{
4
+ value: number | null;
5
+ max: number;
6
+ min: number;
7
+ }> {
8
+ }
9
+ export declare class ProgressRootState {
10
+ static create(opts: ProgressRootStateOpts): ProgressRootState;
11
+ readonly opts: ProgressRootStateOpts;
12
+ readonly attachment: RefAttachment;
13
+ constructor(opts: ProgressRootStateOpts);
14
+ readonly props: {
15
+ readonly role: "progressbar";
16
+ readonly value: number | null;
17
+ readonly "aria-valuemin": number;
18
+ readonly "aria-valuemax": number;
19
+ readonly "aria-valuenow": number | undefined;
20
+ readonly "data-value": number | undefined;
21
+ readonly "data-state": "indeterminate" | "loading" | "loaded";
22
+ readonly "data-max": number;
23
+ readonly "data-min": number;
24
+ readonly "data-indeterminate": "" | undefined;
25
+ };
26
+ }
27
+ export {};
tools/ui/node_modules/bits-ui/dist/bits/progress/progress.svelte.js ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { attachRef } from "svelte-toolbelt";
2
+ import { createBitsAttrs } from "../../internal/attrs.js";
3
+ const progressAttrs = createBitsAttrs({
4
+ component: "progress",
5
+ parts: ["root"],
6
+ });
7
+ export class ProgressRootState {
8
+ static create(opts) {
9
+ return new ProgressRootState(opts);
10
+ }
11
+ opts;
12
+ attachment;
13
+ constructor(opts) {
14
+ this.opts = opts;
15
+ this.attachment = attachRef(this.opts.ref);
16
+ }
17
+ props = $derived.by(() => ({
18
+ role: "progressbar",
19
+ value: this.opts.value.current,
20
+ "aria-valuemin": this.opts.min.current,
21
+ "aria-valuemax": this.opts.max.current,
22
+ "aria-valuenow": this.opts.value.current === null ? undefined : this.opts.value.current,
23
+ "data-value": this.opts.value.current === null ? undefined : this.opts.value.current,
24
+ "data-state": getProgressDataState(this.opts.value.current, this.opts.max.current),
25
+ "data-max": this.opts.max.current,
26
+ "data-min": this.opts.min.current,
27
+ "data-indeterminate": this.opts.value.current === null ? "" : undefined,
28
+ [progressAttrs.root]: "",
29
+ ...this.attachment,
30
+ }));
31
+ }
32
+ function getProgressDataState(value, max) {
33
+ if (value === null)
34
+ return "indeterminate";
35
+ return value === max ? "loaded" : "loading";
36
+ }
tools/ui/node_modules/bits-ui/dist/bits/progress/types.d.ts ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { WithChild, Without } from "../../internal/types.js";
2
+ import type { BitsPrimitiveDivAttributes } from "../../shared/attributes.js";
3
+ export type ProgressRootPropsWithoutHTML = WithChild<{
4
+ /**
5
+ * The current value of the progress bar.
6
+ * If `null`, the progress bar will be in an indeterminate state.
7
+ *
8
+ * @default 0
9
+ */
10
+ value?: number | null;
11
+ /**
12
+ * The maximum value of the progress bar.
13
+ *
14
+ * @default 100
15
+ */
16
+ max?: number;
17
+ /**
18
+ * The minimum value of the progress bar.
19
+ *
20
+ * @default 0
21
+ */
22
+ min?: number;
23
+ }>;
24
+ export type ProgressRootProps = ProgressRootPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, ProgressRootPropsWithoutHTML>;
tools/ui/node_modules/bits-ui/dist/bits/progress/types.js ADDED
@@ -0,0 +1 @@
 
 
1
+ export {};
tools/ui/node_modules/bits-ui/dist/bits/radio-group/components/radio-group-input.svelte ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import HiddenInput from "../../utilities/hidden-input.svelte";
3
+ import { RadioGroupInputState } from "../radio-group.svelte.js";
4
+
5
+ const inputState = RadioGroupInputState.create();
6
+ </script>
7
+
8
+ {#if inputState.shouldRender}
9
+ <HiddenInput {...inputState.props} />
10
+ {/if}
tools/ui/node_modules/bits-ui/dist/bits/radio-group/components/radio-group-input.svelte.d.ts ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const RadioGroupInput: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type RadioGroupInput = InstanceType<typeof RadioGroupInput>;
18
+ export default RadioGroupInput;
tools/ui/node_modules/bits-ui/dist/bits/radio-group/components/radio-group-item.svelte ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { boxWith, mergeProps } from "svelte-toolbelt";
3
+ import type { RadioGroupItemProps } from "../types.js";
4
+ import { RadioGroupItemState } from "../radio-group.svelte.js";
5
+ import { createId } from "../../../internal/create-id.js";
6
+
7
+ const uid = $props.id();
8
+
9
+ let {
10
+ id = createId(uid),
11
+ children,
12
+ child,
13
+ value,
14
+ disabled = false,
15
+ ref = $bindable(null),
16
+ ...restProps
17
+ }: RadioGroupItemProps = $props();
18
+
19
+ const itemState = RadioGroupItemState.create({
20
+ value: boxWith(() => value),
21
+ disabled: boxWith(() => disabled ?? false),
22
+ id: boxWith(() => id),
23
+ ref: boxWith(
24
+ () => ref,
25
+ (v) => (ref = v)
26
+ ),
27
+ });
28
+
29
+ const mergedProps = $derived(mergeProps(restProps, itemState.props));
30
+ </script>
31
+
32
+ {#if child}
33
+ {@render child({ props: mergedProps, ...itemState.snippetProps })}
34
+ {:else}
35
+ <button {...mergedProps}>
36
+ {@render children?.(itemState.snippetProps)}
37
+ </button>
38
+ {/if}
tools/ui/node_modules/bits-ui/dist/bits/radio-group/components/radio-group-item.svelte.d.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import type { RadioGroupItemProps } from "../types.js";
2
+ declare const RadioGroupItem: import("svelte").Component<RadioGroupItemProps, {}, "ref">;
3
+ type RadioGroupItem = ReturnType<typeof RadioGroupItem>;
4
+ export default RadioGroupItem;
tools/ui/node_modules/bits-ui/dist/bits/radio-group/components/radio-group.svelte ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { boxWith, mergeProps } from "svelte-toolbelt";
3
+ import type { RadioGroupRootProps } from "../types.js";
4
+ import { RadioGroupRootState } from "../radio-group.svelte.js";
5
+ import RadioGroupInput from "./radio-group-input.svelte";
6
+ import { createId } from "../../../internal/create-id.js";
7
+ import { noop } from "../../../internal/noop.js";
8
+
9
+ const uid = $props.id();
10
+
11
+ let {
12
+ disabled = false,
13
+ children,
14
+ child,
15
+ value = $bindable(""),
16
+ ref = $bindable(null),
17
+ orientation = "vertical",
18
+ loop = true,
19
+ name = undefined,
20
+ required = false,
21
+ readonly = false,
22
+ id = createId(uid),
23
+ onValueChange = noop,
24
+ ...restProps
25
+ }: RadioGroupRootProps = $props();
26
+
27
+ const rootState = RadioGroupRootState.create({
28
+ orientation: boxWith(() => orientation),
29
+ disabled: boxWith(() => disabled),
30
+ loop: boxWith(() => loop),
31
+ name: boxWith(() => name),
32
+ required: boxWith(() => required),
33
+ readonly: boxWith(() => readonly),
34
+ id: boxWith(() => id),
35
+ value: boxWith(
36
+ () => value,
37
+ (v) => {
38
+ if (v === value) return;
39
+ value = v;
40
+ onValueChange?.(v);
41
+ }
42
+ ),
43
+ ref: boxWith(
44
+ () => ref,
45
+ (v) => (ref = v)
46
+ ),
47
+ });
48
+
49
+ const mergedProps = $derived(mergeProps(restProps, rootState.props));
50
+ </script>
51
+
52
+ {#if child}
53
+ {@render child({ props: mergedProps })}
54
+ {:else}
55
+ <div {...mergedProps}>
56
+ {@render children?.()}
57
+ </div>
58
+ {/if}
59
+
60
+ <RadioGroupInput />
tools/ui/node_modules/bits-ui/dist/bits/radio-group/components/radio-group.svelte.d.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import type { RadioGroupRootProps } from "../types.js";
2
+ declare const RadioGroup: import("svelte").Component<RadioGroupRootProps, {}, "value" | "ref">;
3
+ type RadioGroup = ReturnType<typeof RadioGroup>;
4
+ export default RadioGroup;
tools/ui/node_modules/bits-ui/dist/bits/radio-group/exports.d.ts ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ export { default as Root } from "./components/radio-group.svelte";
2
+ export { default as Item } from "./components/radio-group-item.svelte";
3
+ export type { RadioGroupRootProps as RootProps, RadioGroupItemProps as ItemProps, } from "./types.js";
tools/ui/node_modules/bits-ui/dist/bits/radio-group/exports.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ export { default as Root } from "./components/radio-group.svelte";
2
+ export { default as Item } from "./components/radio-group-item.svelte";
tools/ui/node_modules/bits-ui/dist/bits/radio-group/index.d.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ export * as RadioGroup from "./exports.js";
tools/ui/node_modules/bits-ui/dist/bits/radio-group/index.js ADDED
@@ -0,0 +1 @@
 
 
1
+ export * as RadioGroup from "./exports.js";
tools/ui/node_modules/bits-ui/dist/bits/radio-group/radio-group.svelte.d.ts ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { type ReadableBoxedValues, type WritableBoxedValues } from "svelte-toolbelt";
2
+ import type { BitsFocusEvent, BitsKeyboardEvent, BitsMouseEvent, RefAttachment, WithRefOpts } from "../../internal/types.js";
3
+ import type { Orientation } from "../../shared/index.js";
4
+ import { RovingFocusGroup } from "../../internal/roving-focus-group.js";
5
+ interface RadioGroupRootStateOpts extends WithRefOpts, ReadableBoxedValues<{
6
+ disabled: boolean;
7
+ required: boolean;
8
+ loop: boolean;
9
+ orientation: Orientation;
10
+ name: string | undefined;
11
+ readonly: boolean;
12
+ }>, WritableBoxedValues<{
13
+ value: string;
14
+ }> {
15
+ }
16
+ export declare class RadioGroupRootState {
17
+ static create(opts: RadioGroupRootStateOpts): RadioGroupRootState;
18
+ readonly opts: RadioGroupRootStateOpts;
19
+ readonly hasValue: boolean;
20
+ readonly rovingFocusGroup: RovingFocusGroup;
21
+ readonly attachment: RefAttachment;
22
+ constructor(opts: RadioGroupRootStateOpts);
23
+ isChecked(value: string): boolean;
24
+ setValue(value: string): void;
25
+ readonly props: {
26
+ readonly id: string;
27
+ readonly role: "radiogroup";
28
+ readonly "aria-required": "true" | "false";
29
+ readonly "aria-disabled": "true" | "false";
30
+ readonly "aria-readonly": "true" | undefined;
31
+ readonly "data-disabled": "" | undefined;
32
+ readonly "data-readonly": "" | undefined;
33
+ readonly "data-orientation": Orientation;
34
+ };
35
+ }
36
+ interface RadioGroupItemStateOpts extends WithRefOpts, ReadableBoxedValues<{
37
+ disabled: boolean;
38
+ value: string;
39
+ }> {
40
+ }
41
+ export declare class RadioGroupItemState {
42
+ #private;
43
+ static create(opts: RadioGroupItemStateOpts): RadioGroupItemState;
44
+ readonly opts: RadioGroupItemStateOpts;
45
+ readonly root: RadioGroupRootState;
46
+ readonly attachment: RefAttachment;
47
+ readonly checked: boolean;
48
+ constructor(opts: RadioGroupItemStateOpts, root: RadioGroupRootState);
49
+ onclick(_: BitsMouseEvent): void;
50
+ onfocus(_: BitsFocusEvent): void;
51
+ onkeydown(e: BitsKeyboardEvent): void;
52
+ readonly snippetProps: {
53
+ checked: boolean;
54
+ };
55
+ readonly props: {
56
+ readonly id: string;
57
+ readonly disabled: true | undefined;
58
+ readonly "data-value": string;
59
+ readonly "data-orientation": Orientation;
60
+ readonly "data-disabled": "" | undefined;
61
+ readonly "data-readonly": "" | undefined;
62
+ readonly "data-state": "checked" | "unchecked";
63
+ readonly "aria-checked": "true" | "false" | "mixed";
64
+ readonly type: "button";
65
+ readonly role: "radio";
66
+ readonly tabindex: number;
67
+ readonly onkeydown: (e: BitsKeyboardEvent) => void;
68
+ readonly onfocus: (_: BitsFocusEvent) => void;
69
+ readonly onclick: (_: BitsMouseEvent) => void;
70
+ };
71
+ }
72
+ export declare class RadioGroupInputState {
73
+ static create(): RadioGroupInputState;
74
+ readonly root: RadioGroupRootState;
75
+ readonly shouldRender: boolean;
76
+ constructor(root: RadioGroupRootState);
77
+ onfocus(_: BitsFocusEvent): void;
78
+ readonly props: {
79
+ readonly name: string | undefined;
80
+ readonly value: string;
81
+ readonly required: boolean;
82
+ readonly disabled: boolean;
83
+ readonly onfocus: (_: BitsFocusEvent) => void;
84
+ };
85
+ }
86
+ export {};
tools/ui/node_modules/bits-ui/dist/bits/radio-group/radio-group.svelte.js ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { attachRef } from "svelte-toolbelt";
2
+ import { Context, watch } from "runed";
3
+ import { createBitsAttrs, getAriaChecked, boolToEmptyStrOrUndef, boolToStr, } from "../../internal/attrs.js";
4
+ import { kbd } from "../../internal/kbd.js";
5
+ import { RovingFocusGroup } from "../../internal/roving-focus-group.js";
6
+ const radioGroupAttrs = createBitsAttrs({
7
+ component: "radio-group",
8
+ parts: ["root", "item"],
9
+ });
10
+ const RadioGroupRootContext = new Context("RadioGroup.Root");
11
+ export class RadioGroupRootState {
12
+ static create(opts) {
13
+ return RadioGroupRootContext.set(new RadioGroupRootState(opts));
14
+ }
15
+ opts;
16
+ hasValue = $derived.by(() => this.opts.value.current !== "");
17
+ rovingFocusGroup;
18
+ attachment;
19
+ constructor(opts) {
20
+ this.opts = opts;
21
+ this.attachment = attachRef(this.opts.ref);
22
+ this.rovingFocusGroup = new RovingFocusGroup({
23
+ rootNode: this.opts.ref,
24
+ candidateAttr: radioGroupAttrs.item,
25
+ loop: this.opts.loop,
26
+ orientation: this.opts.orientation,
27
+ });
28
+ }
29
+ isChecked(value) {
30
+ return this.opts.value.current === value;
31
+ }
32
+ setValue(value) {
33
+ this.opts.value.current = value;
34
+ }
35
+ props = $derived.by(() => ({
36
+ id: this.opts.id.current,
37
+ role: "radiogroup",
38
+ "aria-required": boolToStr(this.opts.required.current),
39
+ "aria-disabled": boolToStr(this.opts.disabled.current),
40
+ "aria-readonly": this.opts.readonly.current ? "true" : undefined,
41
+ "data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current),
42
+ "data-readonly": boolToEmptyStrOrUndef(this.opts.readonly.current),
43
+ "data-orientation": this.opts.orientation.current,
44
+ [radioGroupAttrs.root]: "",
45
+ ...this.attachment,
46
+ }));
47
+ }
48
+ export class RadioGroupItemState {
49
+ static create(opts) {
50
+ return new RadioGroupItemState(opts, RadioGroupRootContext.get());
51
+ }
52
+ opts;
53
+ root;
54
+ attachment;
55
+ checked = $derived.by(() => this.root.opts.value.current === this.opts.value.current);
56
+ #isDisabled = $derived.by(() => this.opts.disabled.current || this.root.opts.disabled.current);
57
+ #isReadonly = $derived.by(() => this.root.opts.readonly.current);
58
+ #isChecked = $derived.by(() => this.root.isChecked(this.opts.value.current));
59
+ #tabIndex = $state(-1);
60
+ constructor(opts, root) {
61
+ this.opts = opts;
62
+ this.root = root;
63
+ this.attachment = attachRef(this.opts.ref);
64
+ if (this.opts.value.current === this.root.opts.value.current) {
65
+ this.root.rovingFocusGroup.setCurrentTabStopId(this.opts.id.current);
66
+ this.#tabIndex = 0;
67
+ }
68
+ else if (!this.root.opts.value.current) {
69
+ this.#tabIndex = 0;
70
+ }
71
+ $effect(() => {
72
+ this.#tabIndex = this.root.rovingFocusGroup.getTabIndex(this.opts.ref.current);
73
+ });
74
+ watch([() => this.opts.value.current, () => this.root.opts.value.current], () => {
75
+ if (this.opts.value.current === this.root.opts.value.current) {
76
+ this.root.rovingFocusGroup.setCurrentTabStopId(this.opts.id.current);
77
+ this.#tabIndex = 0;
78
+ }
79
+ });
80
+ this.onclick = this.onclick.bind(this);
81
+ this.onkeydown = this.onkeydown.bind(this);
82
+ this.onfocus = this.onfocus.bind(this);
83
+ }
84
+ onclick(_) {
85
+ if (this.opts.disabled.current || this.#isReadonly)
86
+ return;
87
+ this.root.setValue(this.opts.value.current);
88
+ }
89
+ onfocus(_) {
90
+ if (!this.root.hasValue || this.#isReadonly)
91
+ return;
92
+ this.root.setValue(this.opts.value.current);
93
+ }
94
+ onkeydown(e) {
95
+ if (this.#isDisabled)
96
+ return;
97
+ if (e.key === kbd.SPACE) {
98
+ e.preventDefault();
99
+ if (!this.#isReadonly) {
100
+ this.root.setValue(this.opts.value.current);
101
+ }
102
+ return;
103
+ }
104
+ this.root.rovingFocusGroup.handleKeydown(this.opts.ref.current, e, true);
105
+ }
106
+ snippetProps = $derived.by(() => ({ checked: this.#isChecked }));
107
+ props = $derived.by(() => ({
108
+ id: this.opts.id.current,
109
+ disabled: this.#isDisabled ? true : undefined,
110
+ "data-value": this.opts.value.current,
111
+ "data-orientation": this.root.opts.orientation.current,
112
+ "data-disabled": boolToEmptyStrOrUndef(this.#isDisabled),
113
+ "data-readonly": boolToEmptyStrOrUndef(this.#isReadonly),
114
+ "data-state": this.#isChecked ? "checked" : "unchecked",
115
+ "aria-checked": getAriaChecked(this.#isChecked, false),
116
+ [radioGroupAttrs.item]: "",
117
+ type: "button",
118
+ role: "radio",
119
+ tabindex: this.#tabIndex,
120
+ //
121
+ onkeydown: this.onkeydown,
122
+ onfocus: this.onfocus,
123
+ onclick: this.onclick,
124
+ ...this.attachment,
125
+ }));
126
+ }
127
+ export class RadioGroupInputState {
128
+ static create() {
129
+ return new RadioGroupInputState(RadioGroupRootContext.get());
130
+ }
131
+ root;
132
+ shouldRender = $derived.by(() => this.root.opts.name.current !== undefined);
133
+ constructor(root) {
134
+ this.root = root;
135
+ this.onfocus = this.onfocus.bind(this);
136
+ }
137
+ onfocus(_) {
138
+ this.root.rovingFocusGroup.focusCurrentTabStop();
139
+ }
140
+ props = $derived.by(() => ({
141
+ name: this.root.opts.name.current,
142
+ value: this.root.opts.value.current,
143
+ required: this.root.opts.required.current,
144
+ disabled: this.root.opts.disabled.current,
145
+ onfocus: this.onfocus,
146
+ }));
147
+ }
tools/ui/node_modules/bits-ui/dist/bits/radio-group/types.d.ts ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { OnChangeFn, WithChild, Without } from "../../internal/types.js";
2
+ import type { Orientation } from "../../index.js";
3
+ import type { BitsPrimitiveButtonAttributes, BitsPrimitiveDivAttributes } from "../../shared/attributes.js";
4
+ export type RadioGroupRootPropsWithoutHTML = WithChild<{
5
+ /**
6
+ * The orientation of the radio group. Used to determine
7
+ * how keyboard navigation should work.
8
+ *
9
+ * @default "vertical"
10
+ */
11
+ orientation?: Orientation;
12
+ /**
13
+ * Whether to loop around the radio items when navigating
14
+ * with the keyboard.
15
+ *
16
+ * @default true
17
+ */
18
+ loop?: boolean;
19
+ /**
20
+ * The value of the selected radio item.
21
+ *
22
+ * @default ""
23
+ */
24
+ value?: string;
25
+ /**
26
+ * The callback to call when the selected radio item changes.
27
+ */
28
+ onValueChange?: OnChangeFn<string>;
29
+ /**
30
+ * The name to apply to the radio group's input element for
31
+ * form submission. If not provided, a hidden input will not
32
+ * be rendered and the radio group will not be part of a form.
33
+ *
34
+ * @default undefined
35
+ */
36
+ name?: string;
37
+ /**
38
+ * Whether the radio group is disabled.
39
+ *
40
+ * @default false
41
+ */
42
+ disabled?: boolean;
43
+ /**
44
+ * Whether the radio group is required for form submission.
45
+ * If `true`, ensure you provide a `name` prop so the hidden
46
+ * input is rendered.
47
+ */
48
+ required?: boolean;
49
+ /**
50
+ * Whether the radio group is readonly. When readonly, users can
51
+ * focus and navigate through items but cannot change the value.
52
+ *
53
+ * @default false
54
+ */
55
+ readonly?: boolean;
56
+ }>;
57
+ export type RadioGroupRootProps = RadioGroupRootPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, RadioGroupRootPropsWithoutHTML>;
58
+ export type RadioGroupItemSnippetProps = {
59
+ checked: boolean;
60
+ };
61
+ export type RadioGroupItemPropsWithoutHTML = WithChild<{
62
+ /**
63
+ * The value of the radio item.
64
+ */
65
+ value: string;
66
+ /**
67
+ * Whether the radio item is disabled.
68
+ *
69
+ * @default false
70
+ */
71
+ disabled?: boolean | null | undefined;
72
+ }, RadioGroupItemSnippetProps>;
73
+ export type RadioGroupItemProps = RadioGroupItemPropsWithoutHTML & Without<BitsPrimitiveButtonAttributes, RadioGroupItemPropsWithoutHTML>;
tools/ui/node_modules/bits-ui/dist/bits/radio-group/types.js ADDED
@@ -0,0 +1 @@
 
 
1
+ export {};
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/components/range-calendar-cell.svelte ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { boxWith, mergeProps } from "svelte-toolbelt";
3
+ import type { RangeCalendarCellProps } from "../types.js";
4
+ import { RangeCalendarCellState } from "../range-calendar.svelte.js";
5
+ import { createId } from "../../../internal/create-id.js";
6
+
7
+ const uid = $props.id();
8
+
9
+ let {
10
+ children,
11
+ child,
12
+ id = createId(uid),
13
+ ref = $bindable(null),
14
+ date,
15
+ month,
16
+ ...restProps
17
+ }: RangeCalendarCellProps = $props();
18
+
19
+ const cellState = RangeCalendarCellState.create({
20
+ id: boxWith(() => id),
21
+ ref: boxWith(
22
+ () => ref,
23
+ (v) => (ref = v)
24
+ ),
25
+ date: boxWith(() => date),
26
+ month: boxWith(() => month),
27
+ });
28
+
29
+ const mergedProps = $derived(mergeProps(restProps, cellState.props));
30
+ </script>
31
+
32
+ {#if child}
33
+ {@render child({ props: mergedProps, ...cellState.snippetProps })}
34
+ {:else}
35
+ <td {...mergedProps}>
36
+ {@render children?.(cellState.snippetProps)}
37
+ </td>
38
+ {/if}
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/components/range-calendar-cell.svelte.d.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import type { RangeCalendarCellProps } from "../types.js";
2
+ declare const RangeCalendarCell: import("svelte").Component<RangeCalendarCellProps, {}, "ref">;
3
+ type RangeCalendarCell = ReturnType<typeof RangeCalendarCell>;
4
+ export default RangeCalendarCell;
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/components/range-calendar-day.svelte ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { boxWith, mergeProps } from "svelte-toolbelt";
3
+ import type { RangeCalendarDayProps } from "../types.js";
4
+ import { RangeCalendarDayState } from "../range-calendar.svelte.js";
5
+ import { createId } from "../../../internal/create-id.js";
6
+
7
+ const uid = $props.id();
8
+
9
+ let {
10
+ children,
11
+ child,
12
+ id = createId(uid),
13
+ ref = $bindable(null),
14
+ ...restProps
15
+ }: RangeCalendarDayProps = $props();
16
+
17
+ const dayState = RangeCalendarDayState.create({
18
+ id: boxWith(() => id),
19
+ ref: boxWith(
20
+ () => ref,
21
+ (v) => (ref = v)
22
+ ),
23
+ });
24
+
25
+ const mergedProps = $derived(mergeProps(restProps, dayState.props));
26
+ </script>
27
+
28
+ {#if child}
29
+ {@render child({ props: mergedProps, ...dayState.snippetProps })}
30
+ {:else}
31
+ <div {...mergedProps}>
32
+ {#if children}
33
+ {@render children?.(dayState.snippetProps)}
34
+ {:else}
35
+ {dayState.cell.opts.date.current.day}
36
+ {/if}
37
+ </div>
38
+ {/if}
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/components/range-calendar-day.svelte.d.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import type { RangeCalendarDayProps } from "../types.js";
2
+ declare const RangeCalendarDay: import("svelte").Component<RangeCalendarDayProps, {}, "ref">;
3
+ type RangeCalendarDay = ReturnType<typeof RangeCalendarDay>;
4
+ export default RangeCalendarDay;
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/components/range-calendar.svelte ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { watch } from "runed";
3
+ import { boxWith, mergeProps } from "svelte-toolbelt";
4
+ import { type DateValue } from "@internationalized/date";
5
+ import type { RangeCalendarRootProps } from "../types.js";
6
+ import { RangeCalendarRootState } from "../range-calendar.svelte.js";
7
+ import { noop } from "../../../internal/noop.js";
8
+ import { createId } from "../../../internal/create-id.js";
9
+ import { getDefaultDate } from "../../../internal/date-time/utils.js";
10
+ import { resolveLocaleProp } from "../../utilities/config/prop-resolvers.js";
11
+
12
+ const uid = $props.id();
13
+
14
+ let {
15
+ children,
16
+ child,
17
+ id = createId(uid),
18
+ ref = $bindable(null),
19
+ value = $bindable(),
20
+ onValueChange = noop,
21
+ placeholder = $bindable(),
22
+ onPlaceholderChange = noop,
23
+ weekdayFormat = "narrow",
24
+ weekStartsOn,
25
+ pagedNavigation = false,
26
+ isDateDisabled = () => false,
27
+ isDateUnavailable = () => false,
28
+ fixedWeeks = false,
29
+ numberOfMonths = 1,
30
+ locale,
31
+ calendarLabel = "Event",
32
+ disabled = false,
33
+ readonly = false,
34
+ minValue = undefined,
35
+ maxValue = undefined,
36
+ preventDeselect = false,
37
+ disableDaysOutsideMonth = true,
38
+ minDays,
39
+ maxDays,
40
+ onStartValueChange = noop,
41
+ onEndValueChange = noop,
42
+ excludeDisabled = false,
43
+ monthFormat = "long",
44
+ yearFormat = "numeric",
45
+ ...restProps
46
+ }: RangeCalendarRootProps = $props();
47
+
48
+ let startValue = $state<DateValue | undefined>(value?.start);
49
+ let endValue = $state<DateValue | undefined>(value?.end);
50
+
51
+ const defaultPlaceholder = getDefaultDate({
52
+ defaultValue: value?.start,
53
+ minValue,
54
+ maxValue,
55
+ });
56
+
57
+ function handleDefaultPlaceholder() {
58
+ if (placeholder !== undefined) return;
59
+ placeholder = defaultPlaceholder;
60
+ }
61
+
62
+ // SSR
63
+ handleDefaultPlaceholder();
64
+
65
+ watch.pre(
66
+ () => placeholder,
67
+ () => {
68
+ handleDefaultPlaceholder();
69
+ }
70
+ );
71
+
72
+ function handleDefaultValue() {
73
+ if (value !== undefined) return;
74
+ value = { start: undefined, end: undefined };
75
+ }
76
+
77
+ // SSR
78
+ handleDefaultValue();
79
+
80
+ watch.pre(
81
+ () => value,
82
+ () => {
83
+ handleDefaultValue();
84
+ }
85
+ );
86
+
87
+ const rootState = RangeCalendarRootState.create({
88
+ id: boxWith(() => id),
89
+ ref: boxWith(
90
+ () => ref,
91
+ (v) => (ref = v)
92
+ ),
93
+ value: boxWith(
94
+ () => value!,
95
+ (v) => {
96
+ value = v;
97
+ onValueChange(v);
98
+ }
99
+ ),
100
+ placeholder: boxWith(
101
+ () => placeholder!,
102
+ (v) => {
103
+ placeholder = v;
104
+ onPlaceholderChange(v);
105
+ }
106
+ ),
107
+ disabled: boxWith(() => disabled),
108
+ readonly: boxWith(() => readonly),
109
+ preventDeselect: boxWith(() => preventDeselect),
110
+ minValue: boxWith(() => minValue),
111
+ maxValue: boxWith(() => maxValue),
112
+ isDateUnavailable: boxWith(() => isDateUnavailable),
113
+ isDateDisabled: boxWith(() => isDateDisabled),
114
+ pagedNavigation: boxWith(() => pagedNavigation),
115
+ weekStartsOn: boxWith(() => weekStartsOn),
116
+ weekdayFormat: boxWith(() => weekdayFormat),
117
+ numberOfMonths: boxWith(() => numberOfMonths),
118
+ locale: resolveLocaleProp(() => locale),
119
+ calendarLabel: boxWith(() => calendarLabel),
120
+ fixedWeeks: boxWith(() => fixedWeeks),
121
+ disableDaysOutsideMonth: boxWith(() => disableDaysOutsideMonth),
122
+ minDays: boxWith(() => minDays),
123
+ maxDays: boxWith(() => maxDays),
124
+ excludeDisabled: boxWith(() => excludeDisabled),
125
+ startValue: boxWith(
126
+ () => startValue,
127
+ (v) => {
128
+ startValue = v;
129
+ onStartValueChange(v);
130
+ }
131
+ ),
132
+ endValue: boxWith(
133
+ () => endValue,
134
+ (v) => {
135
+ endValue = v;
136
+ onEndValueChange(v);
137
+ }
138
+ ),
139
+ monthFormat: boxWith(() => monthFormat),
140
+ yearFormat: boxWith(() => yearFormat),
141
+ defaultPlaceholder,
142
+ });
143
+
144
+ const mergedProps = $derived(mergeProps(restProps, rootState.props));
145
+ </script>
146
+
147
+ {#if child}
148
+ {@render child({ props: mergedProps, ...rootState.snippetProps })}
149
+ {:else}
150
+ <div {...mergedProps}>
151
+ {@render children?.(rootState.snippetProps)}
152
+ </div>
153
+ {/if}
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/components/range-calendar.svelte.d.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import type { RangeCalendarRootProps } from "../types.js";
2
+ declare const RangeCalendar: import("svelte").Component<RangeCalendarRootProps, {}, "value" | "placeholder" | "ref">;
3
+ type RangeCalendar = ReturnType<typeof RangeCalendar>;
4
+ export default RangeCalendar;
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/exports.d.ts ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export { default as Root } from "./components/range-calendar.svelte";
2
+ export { default as Day } from "./components/range-calendar-day.svelte";
3
+ export { default as Cell } from "./components/range-calendar-cell.svelte";
4
+ export { default as Grid } from "../calendar/components/calendar-grid.svelte";
5
+ export { default as GridBody } from "../calendar/components/calendar-grid-body.svelte";
6
+ export { default as GridHead } from "../calendar/components/calendar-grid-head.svelte";
7
+ export { default as HeadCell } from "../calendar/components/calendar-head-cell.svelte";
8
+ export { default as GridRow } from "../calendar/components/calendar-grid-row.svelte";
9
+ export { default as Header } from "../calendar/components/calendar-header.svelte";
10
+ export { default as Heading } from "../calendar/components/calendar-heading.svelte";
11
+ export { default as NextButton } from "../calendar/components/calendar-next-button.svelte";
12
+ export { default as PrevButton } from "../calendar/components/calendar-prev-button.svelte";
13
+ export { default as MonthSelect } from "../calendar/components/calendar-month-select.svelte";
14
+ export { default as YearSelect } from "../calendar/components/calendar-year-select.svelte";
15
+ export type { RangeCalendarRootProps as RootProps, RangeCalendarPrevButtonProps as PrevButtonProps, RangeCalendarNextButtonProps as NextButtonProps, RangeCalendarHeadingProps as HeadingProps, RangeCalendarHeaderProps as HeaderProps, RangeCalendarGridProps as GridProps, RangeCalendarGridHeadProps as GridHeadProps, RangeCalendarHeadCellProps as HeadCellProps, RangeCalendarGridBodyProps as GridBodyProps, RangeCalendarCellProps as CellProps, RangeCalendarGridRowProps as GridRowProps, RangeCalendarDayProps as DayProps, RangeCalendarMonthSelectProps as MonthSelectProps, RangeCalendarYearSelectProps as YearSelectProps, } from "./types.js";
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/exports.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export { default as Root } from "./components/range-calendar.svelte";
2
+ export { default as Day } from "./components/range-calendar-day.svelte";
3
+ export { default as Cell } from "./components/range-calendar-cell.svelte";
4
+ export { default as Grid } from "../calendar/components/calendar-grid.svelte";
5
+ export { default as GridBody } from "../calendar/components/calendar-grid-body.svelte";
6
+ export { default as GridHead } from "../calendar/components/calendar-grid-head.svelte";
7
+ export { default as HeadCell } from "../calendar/components/calendar-head-cell.svelte";
8
+ export { default as GridRow } from "../calendar/components/calendar-grid-row.svelte";
9
+ export { default as Header } from "../calendar/components/calendar-header.svelte";
10
+ export { default as Heading } from "../calendar/components/calendar-heading.svelte";
11
+ export { default as NextButton } from "../calendar/components/calendar-next-button.svelte";
12
+ export { default as PrevButton } from "../calendar/components/calendar-prev-button.svelte";
13
+ export { default as MonthSelect } from "../calendar/components/calendar-month-select.svelte";
14
+ export { default as YearSelect } from "../calendar/components/calendar-year-select.svelte";
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/index.d.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ export * as RangeCalendar from "./exports.js";
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/index.js ADDED
@@ -0,0 +1 @@
 
 
1
+ export * as RangeCalendar from "./exports.js";
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/range-calendar.svelte.d.ts ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { type DateValue } from "@internationalized/date";
2
+ import { DOMContext, type ReadableBoxedValues, type WritableBoxedValues } from "svelte-toolbelt";
3
+ import type { DateRange, Month } from "../../shared/index.js";
4
+ import type { BitsFocusEvent, BitsKeyboardEvent, BitsMouseEvent, RefAttachment, WithRefOpts } from "../../internal/types.js";
5
+ import { type Announcer } from "../../internal/date-time/announcer.js";
6
+ import { type Formatter } from "../../internal/date-time/formatter.js";
7
+ import { calendarAttrs } from "../../internal/date-time/calendar-helpers.svelte.js";
8
+ import type { WeekStartsOn } from "../../shared/date/types.js";
9
+ interface RangeCalendarRootStateOpts extends WithRefOpts, WritableBoxedValues<{
10
+ value: DateRange;
11
+ placeholder: DateValue;
12
+ startValue: DateValue | undefined;
13
+ endValue: DateValue | undefined;
14
+ }>, ReadableBoxedValues<{
15
+ preventDeselect: boolean;
16
+ minValue: DateValue | undefined;
17
+ maxValue: DateValue | undefined;
18
+ disabled: boolean;
19
+ pagedNavigation: boolean;
20
+ weekStartsOn: WeekStartsOn | undefined;
21
+ weekdayFormat: Intl.DateTimeFormatOptions["weekday"];
22
+ isDateDisabled: (date: DateValue) => boolean;
23
+ isDateUnavailable: (date: DateValue) => boolean;
24
+ fixedWeeks: boolean;
25
+ numberOfMonths: number;
26
+ locale: string;
27
+ calendarLabel: string;
28
+ readonly: boolean;
29
+ disableDaysOutsideMonth: boolean;
30
+ excludeDisabled: boolean;
31
+ minDays: number | undefined;
32
+ maxDays: number | undefined;
33
+ /**
34
+ * This is strictly used by the `DateRangePicker` component to close the popover when a date range
35
+ * is selected. It is not intended to be used by the user.
36
+ */
37
+ onRangeSelect?: () => void;
38
+ monthFormat: Intl.DateTimeFormatOptions["month"] | ((month: number) => string);
39
+ yearFormat: Intl.DateTimeFormatOptions["year"] | ((year: number) => string);
40
+ }> {
41
+ defaultPlaceholder: DateValue;
42
+ }
43
+ export declare class RangeCalendarRootState {
44
+ #private;
45
+ static create(opts: RangeCalendarRootStateOpts): RangeCalendarRootState | import("../calendar/calendar.svelte.js").CalendarRootState;
46
+ readonly opts: RangeCalendarRootStateOpts;
47
+ readonly attachment: RefAttachment;
48
+ readonly visibleMonths: DateValue[];
49
+ months: Month<DateValue>[];
50
+ announcer: Announcer;
51
+ formatter: Formatter;
52
+ accessibleHeadingId: string;
53
+ focusedValue: DateValue | undefined;
54
+ lastPressedDateValue: DateValue | undefined;
55
+ domContext: DOMContext;
56
+ /**
57
+ * This derived state holds an array of localized day names for the current
58
+ * locale and calendar view. It dynamically syncs with the 'weekStartsOn' option,
59
+ * updating its content when the option changes. Using this state to render the
60
+ * calendar's days of the week is strongly recommended, as it guarantees that
61
+ * the days are correctly formatted for the current locale and calendar view.
62
+ */
63
+ readonly weekdays: string[];
64
+ readonly isStartInvalid: boolean;
65
+ readonly isEndInvalid: boolean;
66
+ readonly isInvalid: boolean;
67
+ readonly isNextButtonDisabled: boolean;
68
+ readonly isPrevButtonDisabled: boolean;
69
+ readonly headingValue: string;
70
+ readonly fullCalendarLabel: string;
71
+ readonly highlightedRange: {
72
+ start: DateValue;
73
+ end: DateValue;
74
+ } | null;
75
+ readonly initialPlaceholderYear: number;
76
+ readonly defaultYears: number[];
77
+ constructor(opts: RangeCalendarRootStateOpts);
78
+ setMonths: (months: Month<DateValue>[]) => void;
79
+ isOutsideVisibleMonths(date: DateValue): boolean;
80
+ isDateDisabled(date: DateValue): boolean;
81
+ isDateUnavailable(date: DateValue): boolean;
82
+ isSelectionStart(date: DateValue): boolean;
83
+ isSelectionEnd(date: DateValue): boolean;
84
+ isSelected(date: DateValue): boolean;
85
+ shiftFocus(node: HTMLElement, add: number): void;
86
+ handleCellClick(e: Event, date: DateValue): void;
87
+ onkeydown(event: BitsKeyboardEvent): void;
88
+ /**
89
+ * Navigates to the next page of the calendar.
90
+ */
91
+ nextPage(): void;
92
+ /**
93
+ * Navigates to the previous page of the calendar.
94
+ */
95
+ prevPage(): void;
96
+ nextYear(): void;
97
+ prevYear(): void;
98
+ setYear(year: number): void;
99
+ setMonth(month: number): void;
100
+ getBitsAttr: (typeof calendarAttrs)["getAttr"];
101
+ readonly snippetProps: {
102
+ months: Month<DateValue>[];
103
+ weekdays: string[];
104
+ };
105
+ readonly props: {
106
+ readonly onkeydown: (event: BitsKeyboardEvent) => void;
107
+ readonly id: string;
108
+ readonly role: "application";
109
+ readonly "aria-label": string;
110
+ readonly "data-invalid": "" | undefined;
111
+ readonly "data-disabled": "" | undefined;
112
+ readonly "data-readonly": "" | undefined;
113
+ };
114
+ }
115
+ interface RangeCalendarCellStateOpts extends WithRefOpts, ReadableBoxedValues<{
116
+ date: DateValue;
117
+ month: DateValue;
118
+ }> {
119
+ }
120
+ export declare class RangeCalendarCellState {
121
+ static create(opts: RangeCalendarCellStateOpts): RangeCalendarCellState;
122
+ readonly opts: RangeCalendarCellStateOpts;
123
+ readonly root: RangeCalendarRootState;
124
+ readonly attachment: RefAttachment;
125
+ readonly cellDate: Date;
126
+ readonly isOutsideMonth: boolean;
127
+ readonly isDisabled: boolean;
128
+ readonly isUnavailable: boolean;
129
+ readonly isDateToday: boolean;
130
+ readonly isOutsideVisibleMonths: boolean;
131
+ readonly isFocusedDate: boolean;
132
+ readonly isSelectedDate: boolean;
133
+ readonly isSelectionStart: boolean;
134
+ readonly isRangeStart: boolean;
135
+ readonly isRangeEnd: boolean;
136
+ readonly isRangeMiddle: boolean;
137
+ readonly isSelectionMiddle: boolean;
138
+ readonly isSelectionEnd: boolean;
139
+ readonly isHighlighted: boolean;
140
+ readonly labelText: string;
141
+ constructor(opts: RangeCalendarCellStateOpts, root: RangeCalendarRootState);
142
+ readonly snippetProps: {
143
+ disabled: boolean;
144
+ unavailable: boolean;
145
+ selected: boolean;
146
+ };
147
+ readonly ariaDisabled: boolean;
148
+ readonly sharedDataAttrs: {
149
+ readonly "data-unavailable": "" | undefined;
150
+ readonly "data-today": "" | undefined;
151
+ readonly "data-outside-month": "" | undefined;
152
+ readonly "data-outside-visible-months": "" | undefined;
153
+ readonly "data-focused": "" | undefined;
154
+ readonly "data-selection-start": "" | undefined;
155
+ readonly "data-selection-end": "" | undefined;
156
+ readonly "data-range-start": "" | undefined;
157
+ readonly "data-range-end": "" | undefined;
158
+ readonly "data-range-middle": "" | undefined;
159
+ readonly "data-highlighted": "" | undefined;
160
+ readonly "data-selected": "" | undefined;
161
+ readonly "data-value": string;
162
+ readonly "data-type": string;
163
+ readonly "data-disabled": "" | undefined;
164
+ };
165
+ readonly props: {
166
+ readonly "data-unavailable": "" | undefined;
167
+ readonly "data-today": "" | undefined;
168
+ readonly "data-outside-month": "" | undefined;
169
+ readonly "data-outside-visible-months": "" | undefined;
170
+ readonly "data-focused": "" | undefined;
171
+ readonly "data-selection-start": "" | undefined;
172
+ readonly "data-selection-end": "" | undefined;
173
+ readonly "data-range-start": "" | undefined;
174
+ readonly "data-range-end": "" | undefined;
175
+ readonly "data-range-middle": "" | undefined;
176
+ readonly "data-highlighted": "" | undefined;
177
+ readonly "data-selected": "" | undefined;
178
+ readonly "data-value": string;
179
+ readonly "data-type": string;
180
+ readonly "data-disabled": "" | undefined;
181
+ readonly id: string;
182
+ readonly role: "gridcell";
183
+ readonly "aria-selected": "true" | "false";
184
+ readonly "aria-disabled": "true" | "false";
185
+ };
186
+ }
187
+ interface RangeCalendarDayStateOpts extends WithRefOpts {
188
+ }
189
+ export declare class RangeCalendarDayState {
190
+ #private;
191
+ static create(opts: RangeCalendarDayStateOpts): RangeCalendarDayState;
192
+ readonly opts: RangeCalendarDayStateOpts;
193
+ readonly cell: RangeCalendarCellState;
194
+ readonly attachment: RefAttachment;
195
+ constructor(opts: RangeCalendarDayStateOpts, cell: RangeCalendarCellState);
196
+ onclick(e: BitsMouseEvent): void;
197
+ onmouseenter(_: BitsMouseEvent): void;
198
+ onfocusin(_: BitsFocusEvent): void;
199
+ readonly snippetProps: {
200
+ disabled: boolean;
201
+ unavailable: boolean;
202
+ selected: boolean;
203
+ day: string;
204
+ };
205
+ readonly props: {
206
+ readonly tabindex: 0 | -1 | undefined;
207
+ readonly "data-bits-day": "";
208
+ readonly onclick: (e: BitsMouseEvent) => void;
209
+ readonly onmouseenter: (_: BitsMouseEvent) => void;
210
+ readonly onfocusin: (_: BitsFocusEvent) => void;
211
+ readonly "data-unavailable": "" | undefined;
212
+ readonly "data-today": "" | undefined;
213
+ readonly "data-outside-month": "" | undefined;
214
+ readonly "data-outside-visible-months": "" | undefined;
215
+ readonly "data-focused": "" | undefined;
216
+ readonly "data-selection-start": "" | undefined;
217
+ readonly "data-selection-end": "" | undefined;
218
+ readonly "data-range-start": "" | undefined;
219
+ readonly "data-range-end": "" | undefined;
220
+ readonly "data-range-middle": "" | undefined;
221
+ readonly "data-highlighted": "" | undefined;
222
+ readonly "data-selected": "" | undefined;
223
+ readonly "data-value": string;
224
+ readonly "data-type": string;
225
+ readonly "data-disabled": "" | undefined;
226
+ readonly id: string;
227
+ readonly role: "button";
228
+ readonly "aria-label": string;
229
+ readonly "aria-disabled": "true" | "false";
230
+ };
231
+ }
232
+ export {};
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/range-calendar.svelte.js ADDED
@@ -0,0 +1,672 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { getLocalTimeZone, isSameDay, isSameMonth, isToday, } from "@internationalized/date";
2
+ import { attachRef, DOMContext, } from "svelte-toolbelt";
3
+ import { Context, watch } from "runed";
4
+ import { CalendarRootContext } from "../calendar/calendar.svelte.js";
5
+ import { useId } from "../../internal/use-id.js";
6
+ import { boolToStr, boolToEmptyStrOrUndef } from "../../internal/attrs.js";
7
+ import { getAnnouncer } from "../../internal/date-time/announcer.js";
8
+ import { createFormatter } from "../../internal/date-time/formatter.js";
9
+ import { calendarAttrs, createMonths, getCalendarElementProps, getCalendarHeadingValue, getDefaultYears, getIsNextButtonDisabled, getIsPrevButtonDisabled, getWeekdays, handleCalendarKeydown, handleCalendarNextPage, handleCalendarPrevPage, shiftCalendarFocus, useEnsureNonDisabledPlaceholder, useMonthViewOptionsSync, useMonthViewPlaceholderSync, } from "../../internal/date-time/calendar-helpers.svelte.js";
10
+ import { areAllDaysBetweenValid, getDateValueType, isAfter, isBefore, isBetweenInclusive, toDate, } from "../../internal/date-time/utils.js";
11
+ import { onMount, untrack } from "svelte";
12
+ const RangeCalendarCellContext = new Context("RangeCalendar.Cell");
13
+ export class RangeCalendarRootState {
14
+ static create(opts) {
15
+ return CalendarRootContext.set(new RangeCalendarRootState(opts));
16
+ }
17
+ opts;
18
+ attachment;
19
+ visibleMonths = $derived.by(() => this.months.map((month) => month.value));
20
+ months = $state([]);
21
+ announcer;
22
+ formatter;
23
+ accessibleHeadingId = useId();
24
+ focusedValue = $state(undefined);
25
+ lastPressedDateValue = undefined;
26
+ domContext;
27
+ /**
28
+ * This derived state holds an array of localized day names for the current
29
+ * locale and calendar view. It dynamically syncs with the 'weekStartsOn' option,
30
+ * updating its content when the option changes. Using this state to render the
31
+ * calendar's days of the week is strongly recommended, as it guarantees that
32
+ * the days are correctly formatted for the current locale and calendar view.
33
+ */
34
+ weekdays = $derived.by(() => {
35
+ return getWeekdays({
36
+ months: this.months,
37
+ formatter: this.formatter,
38
+ weekdayFormat: this.opts.weekdayFormat.current,
39
+ });
40
+ });
41
+ isStartInvalid = $derived.by(() => {
42
+ if (!this.opts.startValue.current)
43
+ return false;
44
+ return (this.isDateUnavailable(this.opts.startValue.current) ||
45
+ this.isDateDisabled(this.opts.startValue.current));
46
+ });
47
+ isEndInvalid = $derived.by(() => {
48
+ if (!this.opts.endValue.current)
49
+ return false;
50
+ return (this.isDateUnavailable(this.opts.endValue.current) ||
51
+ this.isDateDisabled(this.opts.endValue.current));
52
+ });
53
+ isInvalid = $derived.by(() => {
54
+ if (this.isStartInvalid || this.isEndInvalid)
55
+ return true;
56
+ if (this.opts.endValue.current &&
57
+ this.opts.startValue.current &&
58
+ isBefore(this.opts.endValue.current, this.opts.startValue.current))
59
+ return true;
60
+ return false;
61
+ });
62
+ isNextButtonDisabled = $derived.by(() => {
63
+ return getIsNextButtonDisabled({
64
+ maxValue: this.opts.maxValue.current,
65
+ months: this.months,
66
+ disabled: this.opts.disabled.current,
67
+ });
68
+ });
69
+ isPrevButtonDisabled = $derived.by(() => {
70
+ return getIsPrevButtonDisabled({
71
+ minValue: this.opts.minValue.current,
72
+ months: this.months,
73
+ disabled: this.opts.disabled.current,
74
+ });
75
+ });
76
+ headingValue = $derived.by(() => {
77
+ this.opts.monthFormat.current;
78
+ this.opts.yearFormat.current;
79
+ return getCalendarHeadingValue({
80
+ months: this.months,
81
+ formatter: this.formatter,
82
+ locale: this.opts.locale.current,
83
+ });
84
+ });
85
+ fullCalendarLabel = $derived.by(() => `${this.opts.calendarLabel.current} ${this.headingValue}`);
86
+ highlightedRange = $derived.by(() => {
87
+ if (this.opts.startValue.current && this.opts.endValue.current)
88
+ return null;
89
+ if (!this.opts.startValue.current || !this.focusedValue)
90
+ return null;
91
+ const isStartBeforeFocused = isBefore(this.opts.startValue.current, this.focusedValue);
92
+ const start = isStartBeforeFocused ? this.opts.startValue.current : this.focusedValue;
93
+ const end = isStartBeforeFocused ? this.focusedValue : this.opts.startValue.current;
94
+ const range = { start, end };
95
+ if (isSameDay(start.add({ days: 1 }), end) || isSameDay(start, end)) {
96
+ return range;
97
+ }
98
+ const isValid = areAllDaysBetweenValid(start, end, this.isDateUnavailable, this.isDateDisabled);
99
+ if (isValid)
100
+ return range;
101
+ return null;
102
+ });
103
+ initialPlaceholderYear = $derived.by(() => untrack(() => this.opts.placeholder.current.year));
104
+ defaultYears = $derived.by(() => {
105
+ return getDefaultYears({
106
+ minValue: this.opts.minValue.current,
107
+ maxValue: this.opts.maxValue.current,
108
+ placeholderYear: this.initialPlaceholderYear,
109
+ });
110
+ });
111
+ constructor(opts) {
112
+ this.opts = opts;
113
+ this.attachment = attachRef(opts.ref);
114
+ this.domContext = new DOMContext(opts.ref);
115
+ this.announcer = getAnnouncer(null);
116
+ this.formatter = createFormatter({
117
+ initialLocale: this.opts.locale.current,
118
+ monthFormat: this.opts.monthFormat,
119
+ yearFormat: this.opts.yearFormat,
120
+ });
121
+ this.months = createMonths({
122
+ dateObj: this.opts.placeholder.current,
123
+ weekStartsOn: this.opts.weekStartsOn.current,
124
+ locale: this.opts.locale.current,
125
+ fixedWeeks: this.opts.fixedWeeks.current,
126
+ numberOfMonths: this.opts.numberOfMonths.current,
127
+ });
128
+ $effect.pre(() => {
129
+ if (this.formatter.getLocale() === this.opts.locale.current)
130
+ return;
131
+ this.formatter.setLocale(this.opts.locale.current);
132
+ });
133
+ onMount(() => {
134
+ this.announcer = getAnnouncer(this.domContext.getDocument());
135
+ });
136
+ /**
137
+ * Updates the displayed months based on changes in the placeholder values,
138
+ * which determines the month to show in the calendar.
139
+ */
140
+ useMonthViewPlaceholderSync({
141
+ placeholder: this.opts.placeholder,
142
+ getVisibleMonths: () => this.visibleMonths,
143
+ weekStartsOn: this.opts.weekStartsOn,
144
+ locale: this.opts.locale,
145
+ fixedWeeks: this.opts.fixedWeeks,
146
+ numberOfMonths: this.opts.numberOfMonths,
147
+ setMonths: this.setMonths,
148
+ });
149
+ /**
150
+ * Updates the displayed months based on changes in the options values,
151
+ * which determines the month to show in the calendar.
152
+ */
153
+ useMonthViewOptionsSync({
154
+ fixedWeeks: this.opts.fixedWeeks,
155
+ locale: this.opts.locale,
156
+ numberOfMonths: this.opts.numberOfMonths,
157
+ placeholder: this.opts.placeholder,
158
+ setMonths: this.setMonths,
159
+ weekStartsOn: this.opts.weekStartsOn,
160
+ });
161
+ /**
162
+ * Update the accessible heading's text content when the `fullCalendarLabel`
163
+ * changes.
164
+ */
165
+ $effect(() => {
166
+ const node = this.domContext.getElementById(this.accessibleHeadingId);
167
+ if (!node)
168
+ return;
169
+ node.textContent = this.fullCalendarLabel;
170
+ });
171
+ /**
172
+ * Synchronize the start and end values with the `value` in case
173
+ * it is updated externally.
174
+ */
175
+ watch(() => this.opts.value.current, (value) => {
176
+ if (value.start && value.end) {
177
+ this.opts.startValue.current = value.start;
178
+ this.opts.endValue.current = value.end;
179
+ }
180
+ else if (value.start) {
181
+ this.opts.startValue.current = value.start;
182
+ this.opts.endValue.current = undefined;
183
+ }
184
+ else if (value.start === undefined && value.end === undefined) {
185
+ this.opts.startValue.current = undefined;
186
+ this.opts.endValue.current = undefined;
187
+ }
188
+ });
189
+ /**
190
+ * Synchronize the placeholder value with the current start value
191
+ */
192
+ watch(() => this.opts.value.current, (value) => {
193
+ const startValue = value.start;
194
+ if (startValue && this.opts.placeholder.current !== startValue) {
195
+ this.opts.placeholder.current = startValue;
196
+ }
197
+ });
198
+ /**
199
+ * Check for disabled dates in the selected range when excludeDisabled is enabled
200
+ */
201
+ watch([
202
+ () => this.opts.startValue.current,
203
+ () => this.opts.endValue.current,
204
+ () => this.opts.excludeDisabled.current,
205
+ ], ([startValue, endValue, excludeDisabled]) => {
206
+ if (!excludeDisabled || !startValue || !endValue)
207
+ return;
208
+ if (this.#hasDisabledDatesInRange(startValue, endValue)) {
209
+ this.#setStartValue(undefined);
210
+ this.#setEndValue(undefined);
211
+ this.#announceEmpty();
212
+ }
213
+ });
214
+ watch([() => this.opts.startValue.current, () => this.opts.endValue.current], ([startValue, endValue]) => {
215
+ if (this.opts.value.current &&
216
+ this.opts.value.current.start === startValue &&
217
+ this.opts.value.current.end === endValue) {
218
+ return;
219
+ }
220
+ if (startValue && endValue) {
221
+ this.#updateValue((prev) => {
222
+ if (prev.start === startValue && prev.end === endValue) {
223
+ return prev;
224
+ }
225
+ if (isBefore(endValue, startValue)) {
226
+ const start = startValue;
227
+ const end = endValue;
228
+ this.#setStartValue(end);
229
+ this.#setEndValue(start);
230
+ if (!this.#isRangeValid(endValue, startValue)) {
231
+ this.#setStartValue(startValue);
232
+ this.#setEndValue(undefined);
233
+ return { start: startValue, end: undefined };
234
+ }
235
+ return { start: endValue, end: startValue };
236
+ }
237
+ else {
238
+ if (!this.#isRangeValid(startValue, endValue)) {
239
+ this.#setStartValue(endValue);
240
+ this.#setEndValue(undefined);
241
+ return { start: endValue, end: undefined };
242
+ }
243
+ return {
244
+ start: startValue,
245
+ end: endValue,
246
+ };
247
+ }
248
+ });
249
+ }
250
+ else if (this.opts.value.current &&
251
+ this.opts.value.current.start &&
252
+ this.opts.value.current.end) {
253
+ this.opts.value.current.start = undefined;
254
+ this.opts.value.current.end = undefined;
255
+ }
256
+ });
257
+ this.shiftFocus = this.shiftFocus.bind(this);
258
+ this.handleCellClick = this.handleCellClick.bind(this);
259
+ this.onkeydown = this.onkeydown.bind(this);
260
+ this.nextPage = this.nextPage.bind(this);
261
+ this.prevPage = this.prevPage.bind(this);
262
+ this.nextYear = this.nextYear.bind(this);
263
+ this.prevYear = this.prevYear.bind(this);
264
+ this.setYear = this.setYear.bind(this);
265
+ this.setMonth = this.setMonth.bind(this);
266
+ this.isDateDisabled = this.isDateDisabled.bind(this);
267
+ this.isDateUnavailable = this.isDateUnavailable.bind(this);
268
+ this.isOutsideVisibleMonths = this.isOutsideVisibleMonths.bind(this);
269
+ this.isSelected = this.isSelected.bind(this);
270
+ useEnsureNonDisabledPlaceholder({
271
+ placeholder: opts.placeholder,
272
+ defaultPlaceholder: opts.defaultPlaceholder,
273
+ isDateDisabled: opts.isDateDisabled,
274
+ maxValue: opts.maxValue,
275
+ minValue: opts.minValue,
276
+ ref: opts.ref,
277
+ });
278
+ }
279
+ #updateValue(cb) {
280
+ const value = this.opts.value.current;
281
+ const newValue = cb(value);
282
+ this.opts.value.current = newValue;
283
+ if (newValue.start && newValue.end) {
284
+ this.opts.onRangeSelect?.current?.();
285
+ }
286
+ }
287
+ #setStartValue(value) {
288
+ this.opts.startValue.current = value;
289
+ // update the main value prop immediately for external consumers
290
+ this.#updateValue((prev) => ({
291
+ ...prev,
292
+ start: value,
293
+ }));
294
+ }
295
+ #setEndValue(value) {
296
+ this.opts.endValue.current = value;
297
+ // update the main value prop immediately for external consumers
298
+ this.#updateValue((prev) => ({
299
+ ...prev,
300
+ end: value,
301
+ }));
302
+ }
303
+ setMonths = (months) => {
304
+ this.months = months;
305
+ };
306
+ isOutsideVisibleMonths(date) {
307
+ return !this.visibleMonths.some((month) => isSameMonth(date, month));
308
+ }
309
+ isDateDisabled(date) {
310
+ if (this.opts.isDateDisabled.current(date) || this.opts.disabled.current)
311
+ return true;
312
+ const minValue = this.opts.minValue.current;
313
+ const maxValue = this.opts.maxValue.current;
314
+ if (minValue && isBefore(date, minValue))
315
+ return true;
316
+ if (maxValue && isAfter(date, maxValue))
317
+ return true;
318
+ return false;
319
+ }
320
+ isDateUnavailable(date) {
321
+ if (this.opts.isDateUnavailable.current(date))
322
+ return true;
323
+ return false;
324
+ }
325
+ isSelectionStart(date) {
326
+ if (!this.opts.startValue.current)
327
+ return false;
328
+ return isSameDay(date, this.opts.startValue.current);
329
+ }
330
+ isSelectionEnd(date) {
331
+ if (!this.opts.endValue.current)
332
+ return false;
333
+ return isSameDay(date, this.opts.endValue.current);
334
+ }
335
+ isSelected(date) {
336
+ if (this.opts.startValue.current && isSameDay(this.opts.startValue.current, date))
337
+ return true;
338
+ if (this.opts.endValue.current && isSameDay(this.opts.endValue.current, date))
339
+ return true;
340
+ if (this.opts.startValue.current && this.opts.endValue.current) {
341
+ return isBetweenInclusive(date, this.opts.startValue.current, this.opts.endValue.current);
342
+ }
343
+ return false;
344
+ }
345
+ #isRangeValid(start, end) {
346
+ // ensure we always use the correct order for calculation
347
+ const orderedStart = isBefore(end, start) ? end : start;
348
+ const orderedEnd = isBefore(end, start) ? start : end;
349
+ const startDate = orderedStart.toDate(getLocalTimeZone());
350
+ const endDate = orderedEnd.toDate(getLocalTimeZone());
351
+ const timeDifference = endDate.getTime() - startDate.getTime();
352
+ const daysDifference = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
353
+ const daysInRange = daysDifference + 1; // +1 to include both start and end days
354
+ if (this.opts.minDays.current && daysInRange < this.opts.minDays.current)
355
+ return false;
356
+ if (this.opts.maxDays.current && daysInRange > this.opts.maxDays.current)
357
+ return false;
358
+ // check for disabled dates in range if excludeDisabled is enabled
359
+ if (this.opts.excludeDisabled.current &&
360
+ this.#hasDisabledDatesInRange(orderedStart, orderedEnd)) {
361
+ return false;
362
+ }
363
+ return true;
364
+ }
365
+ shiftFocus(node, add) {
366
+ return shiftCalendarFocus({
367
+ node,
368
+ add,
369
+ placeholder: this.opts.placeholder,
370
+ calendarNode: this.opts.ref.current,
371
+ isPrevButtonDisabled: this.isPrevButtonDisabled,
372
+ isNextButtonDisabled: this.isNextButtonDisabled,
373
+ months: this.months,
374
+ numberOfMonths: this.opts.numberOfMonths.current,
375
+ });
376
+ }
377
+ #announceEmpty() {
378
+ this.announcer.announce("Selected date is now empty.", "polite");
379
+ }
380
+ #announceSelectedDate(date) {
381
+ this.announcer.announce(`Selected Date: ${this.formatter.selectedDate(date, false)}`, "polite");
382
+ }
383
+ #announceSelectedRange(start, end) {
384
+ this.announcer.announce(`Selected Dates: ${this.formatter.selectedDate(start, false)} to ${this.formatter.selectedDate(end, false)}`, "polite");
385
+ }
386
+ handleCellClick(e, date) {
387
+ if (this.isDateDisabled(date) || this.isDateUnavailable(date))
388
+ return;
389
+ const prevLastPressedDate = this.lastPressedDateValue;
390
+ this.lastPressedDateValue = date;
391
+ if (this.opts.startValue.current && this.highlightedRange === null) {
392
+ if (isSameDay(this.opts.startValue.current, date) &&
393
+ !this.opts.preventDeselect.current &&
394
+ !this.opts.endValue.current) {
395
+ this.#setStartValue(undefined);
396
+ this.opts.placeholder.current = date;
397
+ this.#announceEmpty();
398
+ return;
399
+ }
400
+ else if (!this.opts.endValue.current) {
401
+ e.preventDefault();
402
+ if (prevLastPressedDate && isSameDay(prevLastPressedDate, date)) {
403
+ this.#setStartValue(date);
404
+ this.#announceSelectedDate(date);
405
+ }
406
+ }
407
+ }
408
+ if (this.opts.startValue.current &&
409
+ this.opts.endValue.current &&
410
+ isSameDay(this.opts.endValue.current, date) &&
411
+ !this.opts.preventDeselect.current) {
412
+ this.#setStartValue(undefined);
413
+ this.#setEndValue(undefined);
414
+ this.opts.placeholder.current = date;
415
+ this.#announceEmpty();
416
+ return;
417
+ }
418
+ if (!this.opts.startValue.current) {
419
+ this.#announceSelectedDate(date);
420
+ this.#setStartValue(date);
421
+ }
422
+ else if (!this.opts.endValue.current) {
423
+ // determine the start and end dates for validation
424
+ const startDate = this.opts.startValue.current;
425
+ const endDate = date;
426
+ const orderedStart = isBefore(endDate, startDate) ? endDate : startDate;
427
+ const orderedEnd = isBefore(endDate, startDate) ? startDate : endDate;
428
+ // check if the range violates constraints
429
+ if (!this.#isRangeValid(orderedStart, orderedEnd)) {
430
+ // reset to just the clicked date
431
+ this.#setStartValue(date);
432
+ this.#setEndValue(undefined);
433
+ this.#announceSelectedDate(date);
434
+ }
435
+ else {
436
+ // ensure start and end are properly ordered
437
+ if (isBefore(endDate, startDate)) {
438
+ // backward selection - reorder the values
439
+ this.#setStartValue(endDate);
440
+ this.#setEndValue(startDate);
441
+ this.#announceSelectedRange(endDate, startDate);
442
+ }
443
+ else {
444
+ // forward selection - keep original order
445
+ this.#setEndValue(date);
446
+ this.#announceSelectedRange(this.opts.startValue.current, date);
447
+ }
448
+ }
449
+ }
450
+ else if (this.opts.endValue.current && this.opts.startValue.current) {
451
+ this.#setEndValue(undefined);
452
+ this.#announceSelectedDate(date);
453
+ this.#setStartValue(date);
454
+ }
455
+ }
456
+ onkeydown(event) {
457
+ return handleCalendarKeydown({
458
+ event,
459
+ handleCellClick: this.handleCellClick,
460
+ placeholderValue: this.opts.placeholder.current,
461
+ shiftFocus: this.shiftFocus,
462
+ });
463
+ }
464
+ /**
465
+ * Navigates to the next page of the calendar.
466
+ */
467
+ nextPage() {
468
+ handleCalendarNextPage({
469
+ fixedWeeks: this.opts.fixedWeeks.current,
470
+ locale: this.opts.locale.current,
471
+ numberOfMonths: this.opts.numberOfMonths.current,
472
+ pagedNavigation: this.opts.pagedNavigation.current,
473
+ setMonths: this.setMonths,
474
+ setPlaceholder: (date) => (this.opts.placeholder.current = date),
475
+ weekStartsOn: this.opts.weekStartsOn.current,
476
+ months: this.months,
477
+ });
478
+ }
479
+ /**
480
+ * Navigates to the previous page of the calendar.
481
+ */
482
+ prevPage() {
483
+ handleCalendarPrevPage({
484
+ fixedWeeks: this.opts.fixedWeeks.current,
485
+ locale: this.opts.locale.current,
486
+ numberOfMonths: this.opts.numberOfMonths.current,
487
+ pagedNavigation: this.opts.pagedNavigation.current,
488
+ setMonths: this.setMonths,
489
+ setPlaceholder: (date) => (this.opts.placeholder.current = date),
490
+ weekStartsOn: this.opts.weekStartsOn.current,
491
+ months: this.months,
492
+ });
493
+ }
494
+ nextYear() {
495
+ this.opts.placeholder.current = this.opts.placeholder.current.add({ years: 1 });
496
+ }
497
+ prevYear() {
498
+ this.opts.placeholder.current = this.opts.placeholder.current.subtract({ years: 1 });
499
+ }
500
+ setYear(year) {
501
+ this.opts.placeholder.current = this.opts.placeholder.current.set({ year });
502
+ }
503
+ setMonth(month) {
504
+ this.opts.placeholder.current = this.opts.placeholder.current.set({ month });
505
+ }
506
+ getBitsAttr = (part) => {
507
+ return calendarAttrs.getAttr(part, "range-calendar");
508
+ };
509
+ snippetProps = $derived.by(() => ({
510
+ months: this.months,
511
+ weekdays: this.weekdays,
512
+ }));
513
+ props = $derived.by(() => ({
514
+ ...getCalendarElementProps({
515
+ fullCalendarLabel: this.fullCalendarLabel,
516
+ id: this.opts.id.current,
517
+ isInvalid: this.isInvalid,
518
+ disabled: this.opts.disabled.current,
519
+ readonly: this.opts.readonly.current,
520
+ }),
521
+ [this.getBitsAttr("root")]: "",
522
+ //
523
+ onkeydown: this.onkeydown,
524
+ ...this.attachment,
525
+ }));
526
+ #hasDisabledDatesInRange(start, end) {
527
+ for (let date = start; isBefore(date, end) || isSameDay(date, end); date = date.add({ days: 1 })) {
528
+ if (this.isDateDisabled(date))
529
+ return true;
530
+ }
531
+ return false;
532
+ }
533
+ }
534
+ export class RangeCalendarCellState {
535
+ static create(opts) {
536
+ return RangeCalendarCellContext.set(new RangeCalendarCellState(opts, CalendarRootContext.get()));
537
+ }
538
+ opts;
539
+ root;
540
+ attachment;
541
+ cellDate = $derived.by(() => toDate(this.opts.date.current));
542
+ isOutsideMonth = $derived.by(() => !isSameMonth(this.opts.date.current, this.opts.month.current));
543
+ isDisabled = $derived.by(() => this.root.isDateDisabled(this.opts.date.current) ||
544
+ (this.isOutsideMonth && this.root.opts.disableDaysOutsideMonth.current));
545
+ isUnavailable = $derived.by(() => this.root.opts.isDateUnavailable.current(this.opts.date.current));
546
+ isDateToday = $derived.by(() => isToday(this.opts.date.current, getLocalTimeZone()));
547
+ isOutsideVisibleMonths = $derived.by(() => this.root.isOutsideVisibleMonths(this.opts.date.current));
548
+ isFocusedDate = $derived.by(() => isSameDay(this.opts.date.current, this.root.opts.placeholder.current));
549
+ isSelectedDate = $derived.by(() => this.root.isSelected(this.opts.date.current));
550
+ isSelectionStart = $derived.by(() => this.root.isSelectionStart(this.opts.date.current));
551
+ isRangeStart = $derived.by(() => this.root.isSelectionStart(this.opts.date.current));
552
+ isRangeEnd = $derived.by(() => {
553
+ if (!this.root.opts.endValue.current)
554
+ return this.root.isSelectionStart(this.opts.date.current);
555
+ return this.root.isSelectionEnd(this.opts.date.current);
556
+ });
557
+ isRangeMiddle = $derived.by(() => this.isSelectionMiddle);
558
+ isSelectionMiddle = $derived.by(() => {
559
+ return this.isSelectedDate && !this.isSelectionStart && !this.isSelectionEnd;
560
+ });
561
+ isSelectionEnd = $derived.by(() => this.root.isSelectionEnd(this.opts.date.current));
562
+ isHighlighted = $derived.by(() => this.root.highlightedRange
563
+ ? isBetweenInclusive(this.opts.date.current, this.root.highlightedRange.start, this.root.highlightedRange.end)
564
+ : false);
565
+ labelText = $derived.by(() => this.root.formatter.custom(this.cellDate, {
566
+ weekday: "long",
567
+ month: "long",
568
+ day: "numeric",
569
+ year: "numeric",
570
+ }));
571
+ constructor(opts, root) {
572
+ this.opts = opts;
573
+ this.root = root;
574
+ this.attachment = attachRef(opts.ref);
575
+ }
576
+ snippetProps = $derived.by(() => ({
577
+ disabled: this.isDisabled,
578
+ unavailable: this.isUnavailable,
579
+ selected: this.isSelectedDate,
580
+ }));
581
+ ariaDisabled = $derived.by(() => {
582
+ return (this.isDisabled ||
583
+ (this.isOutsideMonth && this.root.opts.disableDaysOutsideMonth.current) ||
584
+ this.isUnavailable);
585
+ });
586
+ sharedDataAttrs = $derived.by(() => ({
587
+ "data-unavailable": boolToEmptyStrOrUndef(this.isUnavailable),
588
+ "data-today": this.isDateToday ? "" : undefined,
589
+ "data-outside-month": this.isOutsideMonth ? "" : undefined,
590
+ "data-outside-visible-months": this.isOutsideVisibleMonths ? "" : undefined,
591
+ "data-focused": this.isFocusedDate ? "" : undefined,
592
+ "data-selection-start": this.isSelectionStart ? "" : undefined,
593
+ "data-selection-end": this.isSelectionEnd ? "" : undefined,
594
+ "data-range-start": this.isRangeStart ? "" : undefined,
595
+ "data-range-end": this.isRangeEnd ? "" : undefined,
596
+ "data-range-middle": this.isRangeMiddle ? "" : undefined,
597
+ "data-highlighted": this.isHighlighted ? "" : undefined,
598
+ "data-selected": boolToEmptyStrOrUndef(this.isSelectedDate),
599
+ "data-value": this.opts.date.current.toString(),
600
+ "data-type": getDateValueType(this.opts.date.current),
601
+ "data-disabled": boolToEmptyStrOrUndef(this.isDisabled ||
602
+ (this.isOutsideMonth && this.root.opts.disableDaysOutsideMonth.current)),
603
+ }));
604
+ props = $derived.by(() => ({
605
+ id: this.opts.id.current,
606
+ role: "gridcell",
607
+ "aria-selected": boolToStr(this.isSelectedDate),
608
+ "aria-disabled": boolToStr(this.ariaDisabled),
609
+ ...this.sharedDataAttrs,
610
+ [this.root.getBitsAttr("cell")]: "",
611
+ ...this.attachment,
612
+ }));
613
+ }
614
+ export class RangeCalendarDayState {
615
+ static create(opts) {
616
+ return new RangeCalendarDayState(opts, RangeCalendarCellContext.get());
617
+ }
618
+ opts;
619
+ cell;
620
+ attachment;
621
+ constructor(opts, cell) {
622
+ this.opts = opts;
623
+ this.cell = cell;
624
+ this.attachment = attachRef(opts.ref);
625
+ this.onclick = this.onclick.bind(this);
626
+ this.onmouseenter = this.onmouseenter.bind(this);
627
+ this.onfocusin = this.onfocusin.bind(this);
628
+ }
629
+ #tabindex = $derived.by(() => (this.cell.isOutsideMonth && this.cell.root.opts.disableDaysOutsideMonth.current) ||
630
+ this.cell.isDisabled
631
+ ? undefined
632
+ : this.cell.isFocusedDate
633
+ ? 0
634
+ : -1);
635
+ onclick(e) {
636
+ if (this.cell.isDisabled)
637
+ return;
638
+ this.cell.root.handleCellClick(e, this.cell.opts.date.current);
639
+ }
640
+ onmouseenter(_) {
641
+ if (this.cell.isDisabled)
642
+ return;
643
+ this.cell.root.focusedValue = this.cell.opts.date.current;
644
+ }
645
+ onfocusin(_) {
646
+ if (this.cell.isDisabled)
647
+ return;
648
+ this.cell.root.focusedValue = this.cell.opts.date.current;
649
+ }
650
+ snippetProps = $derived.by(() => ({
651
+ disabled: this.cell.isDisabled,
652
+ unavailable: this.cell.isUnavailable,
653
+ selected: this.cell.isSelectedDate,
654
+ day: `${this.cell.opts.date.current.day}`,
655
+ }));
656
+ props = $derived.by(() => ({
657
+ id: this.opts.id.current,
658
+ role: "button",
659
+ "aria-label": this.cell.labelText,
660
+ "aria-disabled": boolToStr(this.cell.ariaDisabled),
661
+ ...this.cell.sharedDataAttrs,
662
+ tabindex: this.#tabindex,
663
+ [this.cell.root.getBitsAttr("day")]: "",
664
+ // Shared logic for range calendar and calendar
665
+ "data-bits-day": "",
666
+ //
667
+ onclick: this.onclick,
668
+ onmouseenter: this.onmouseenter,
669
+ onfocusin: this.onfocusin,
670
+ ...this.attachment,
671
+ }));
672
+ }
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/types.d.ts ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { DateValue } from "@internationalized/date";
2
+ import type { OnChangeFn, WithChild, Without } from "../../internal/types.js";
3
+ import type { DateMatcher, DateRange, Month } from "../../shared/index.js";
4
+ import type { BitsPrimitiveDivAttributes } from "../../shared/attributes.js";
5
+ export type RangeCalendarRootSnippetProps = {
6
+ months: Month<DateValue>[];
7
+ weekdays: string[];
8
+ };
9
+ export type RangeCalendarRootPropsWithoutHTML = WithChild<{
10
+ /**
11
+ * The value of the selected date range.
12
+ * @bindable
13
+ */
14
+ value?: DateRange;
15
+ /**
16
+ * A callback function called when the value changes.
17
+ */
18
+ onValueChange?: OnChangeFn<DateRange>;
19
+ /**
20
+ * The placeholder date, used to control the view of the
21
+ * calendar when no value is present.
22
+ *
23
+ * @default the current date
24
+ */
25
+ placeholder?: DateValue;
26
+ /**
27
+ * A callback function called when the placeholder value
28
+ * changes.
29
+ */
30
+ onPlaceholderChange?: OnChangeFn<DateValue>;
31
+ /**
32
+ * The minimum number of days that can be selected in a range.
33
+ *
34
+ * @default undefined
35
+ */
36
+ minDays?: number;
37
+ /**
38
+ * The maximum number of days that can be selected in a range.
39
+ *
40
+ * @default undefined
41
+ */
42
+ maxDays?: number;
43
+ /**
44
+ * Whether or not users can deselect a date once selected
45
+ * without selecting another date.
46
+ *
47
+ * @default false
48
+ */
49
+ preventDeselect?: boolean;
50
+ /**
51
+ * The minimum date that can be selected in the calendar.
52
+ */
53
+ minValue?: DateValue;
54
+ /**
55
+ * The maximum date that can be selected in the calendar.
56
+ */
57
+ maxValue?: DateValue;
58
+ /**
59
+ * Whether or not the calendar is disabled.
60
+ *
61
+ * @default false
62
+ */
63
+ disabled?: boolean;
64
+ /**
65
+ * Applicable only when `numberOfMonths` is greater than 1.
66
+ *
67
+ * Controls whether to use paged navigation for the next and previous buttons in the
68
+ * date picker. With paged navigation set to `true`, clicking the next/prev buttons
69
+ * changes all months in view. When set to `false`, it shifts the view by a single month.
70
+ *
71
+ * For example, with `pagedNavigation` set to `true` and 2 months displayed (January and
72
+ * February), clicking the next button changes the view to March and April. If `pagedNavigation`
73
+ * is `false`, the view shifts to February and March.
74
+ *
75
+ * @default false
76
+ */
77
+ pagedNavigation?: boolean;
78
+ /**
79
+ * The day of the week to start the calendar on, which must
80
+ * be a number between 0 and 6, where 0 is Sunday and 6 is
81
+ * Saturday.
82
+ *
83
+ * @default 0 (Sunday)
84
+ */
85
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
86
+ /**
87
+ * How the string representation of the weekdays provided via the `weekdays` state store
88
+ * should be formatted.
89
+ *
90
+ * ```md
91
+ * - "long": "Sunday", "Monday", "Tuesday", etc.
92
+ * - "short": "Sun", "Mon", "Tue", etc.
93
+ * - "narrow": "S", "M", "T", etc.
94
+ *```
95
+ *
96
+ * @default "narrow"
97
+ *
98
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#weekday
99
+ */
100
+ weekdayFormat?: Intl.DateTimeFormatOptions["weekday"];
101
+ /**
102
+ * A function that receives a date and returns `true` or `false` to indicate whether
103
+ * the date is disabled.
104
+ *
105
+ * @remarks
106
+ * Disabled dates cannot be focused or selected. Additionally, they are tagged
107
+ * with a data attribute to enable custom styling.
108
+ *
109
+ * `[data-disabled]` - applied to disabled dates
110
+ *
111
+ */
112
+ isDateDisabled?: DateMatcher;
113
+ /**
114
+ * Dates matching the provided matchers are marked as "unavailable." Unlike disabled dates,
115
+ * users can still focus and select unavailable dates. However, selecting an unavailable date
116
+ * renders the date picker as invalid.
117
+ *
118
+ * For example, in a calendar for booking appointments, you might mark already booked dates as
119
+ * unavailable. These dates could become available again before the appointment date, allowing
120
+ * users to select them to learn more about the appointment.
121
+ *
122
+ * `[data-unavailable]` - applied to unavailable dates
123
+ *
124
+ */
125
+ isDateUnavailable?: DateMatcher;
126
+ /**
127
+ * Display 6 weeks per month, regardless the month's number of weeks.
128
+ * This is useful for displaying a consistent calendar, where the size
129
+ * of the calendar doesn't change month to month.
130
+ *
131
+ * To display 6 weeks per month, you will need to render out the previous
132
+ * and next month's dates in the calendar as well.
133
+ *
134
+ * @default false
135
+ */
136
+ fixedWeeks?: boolean;
137
+ /**
138
+ * Determines the number of months to display on the calendar simultaneously.
139
+ * For navigation between months, refer to the `pagedNavigation` prop.
140
+ *
141
+ * @default 1
142
+ */
143
+ numberOfMonths?: number;
144
+ /**
145
+ * This label is exclusively used for accessibility, remaining hidden from the page.
146
+ * It's read by screen readers when the calendar is opened. The current month and year
147
+ * are automatically appended to the label, so you only need to provide the base label.
148
+ *
149
+ * For instance:
150
+ * - 'Date of birth' will be read as 'Date of birth, January 2021' if the current month is January 2021.
151
+ * - 'Appointment date' will be read as 'Appointment date, January 2021' if the current month is January 2021.
152
+ * - 'Booking date' will be read as 'Booking date, January 2021' if the current month is January 2021.
153
+ */
154
+ calendarLabel?: string;
155
+ /**
156
+ * The default locale setting.
157
+ *
158
+ * @default 'en'
159
+ */
160
+ locale?: string;
161
+ /**
162
+ * Whether the calendar is readonly. When true, the user will be able
163
+ * to focus and navigate the calendar, but will not be able to select
164
+ * dates. @see disabled for a similar prop that prevents focusing
165
+ * and selecting dates.
166
+ *
167
+ * @default false
168
+ */
169
+ readonly?: boolean;
170
+ /**
171
+ * Whether to disable the selection of days outside the current month. By default,
172
+ * days outside the current month are rendered to fill the calendar grid, but they
173
+ * are not selectable. Setting this prop to `true` will disable this behavior.
174
+ *
175
+ * @default false
176
+ */
177
+ disableDaysOutsideMonth?: boolean;
178
+ /**
179
+ * Whether to automatically reset the range if any date within the selected range
180
+ * becomes disabled. When true, the entire range will be cleared if a disabled
181
+ * date is found between the start and end dates.
182
+ *
183
+ * @default false
184
+ */
185
+ excludeDisabled?: boolean;
186
+ /**
187
+ * A callback function called when the start value changes. This doesn't necessarily mean
188
+ * the `value` has updated and should be used to apply cosmetic changes to the calendar when
189
+ * only part of the value is changed/completed.
190
+ */
191
+ onStartValueChange?: OnChangeFn<DateValue | undefined>;
192
+ /**
193
+ * A callback function called when the end value changes. This doesn't necessarily mean
194
+ * the `value` has updated and should be used to apply cosmetic changes to the calendar when
195
+ * only part of the value is changed/completed.
196
+ */
197
+ onEndValueChange?: OnChangeFn<DateValue | undefined>;
198
+ /**
199
+ * The format of the month names in the calendar.
200
+ *
201
+ * @default "long"
202
+ */
203
+ monthFormat?: Intl.DateTimeFormatOptions["month"] | ((month: number) => string);
204
+ /**
205
+ * The format of the year names in the calendar.
206
+ *
207
+ * @default "numeric"
208
+ */
209
+ yearFormat?: Intl.DateTimeFormatOptions["year"] | ((year: number) => string);
210
+ }, RangeCalendarRootSnippetProps>;
211
+ export type RangeCalendarRootProps = RangeCalendarRootPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, RangeCalendarRootPropsWithoutHTML>;
212
+ export type { CalendarPrevButtonProps as RangeCalendarPrevButtonProps, CalendarPrevButtonPropsWithoutHTML as RangeCalendarPrevButtonPropsWithoutHTML, CalendarNextButtonProps as RangeCalendarNextButtonProps, CalendarNextButtonPropsWithoutHTML as RangeCalendarNextButtonPropsWithoutHTML, CalendarHeadingProps as RangeCalendarHeadingProps, CalendarHeadingPropsWithoutHTML as RangeCalendarHeadingPropsWithoutHTML, CalendarGridProps as RangeCalendarGridProps, CalendarGridPropsWithoutHTML as RangeCalendarGridPropsWithoutHTML, CalendarCellProps as RangeCalendarCellProps, CalendarCellPropsWithoutHTML as RangeCalendarCellPropsWithoutHTML, CalendarDayProps as RangeCalendarDayProps, CalendarDayPropsWithoutHTML as RangeCalendarDayPropsWithoutHTML, CalendarGridBodyProps as RangeCalendarGridBodyProps, CalendarGridBodyPropsWithoutHTML as RangeCalendarGridBodyPropsWithoutHTML, CalendarGridHeadProps as RangeCalendarGridHeadProps, CalendarGridHeadPropsWithoutHTML as RangeCalendarGridHeadPropsWithoutHTML, CalendarGridRowProps as RangeCalendarGridRowProps, CalendarGridRowPropsWithoutHTML as RangeCalendarGridRowPropsWithoutHTML, CalendarHeadCellProps as RangeCalendarHeadCellProps, CalendarHeadCellPropsWithoutHTML as RangeCalendarHeadCellPropsWithoutHTML, CalendarHeaderProps as RangeCalendarHeaderProps, CalendarHeaderPropsWithoutHTML as RangeCalendarHeaderPropsWithoutHTML, CalendarMonthSelectProps as RangeCalendarMonthSelectProps, CalendarMonthSelectPropsWithoutHTML as RangeCalendarMonthSelectPropsWithoutHTML, CalendarYearSelectProps as RangeCalendarYearSelectProps, CalendarYearSelectPropsWithoutHTML as RangeCalendarYearSelectPropsWithoutHTML, } from "../calendar/types.js";
tools/ui/node_modules/bits-ui/dist/bits/range-calendar/types.js ADDED
@@ -0,0 +1 @@
 
 
1
+ export {};
tools/ui/node_modules/bits-ui/dist/bits/rating-group/components/rating-group-input.svelte ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { RatingGroupHiddenInputState } from "../rating-group.svelte.js";
3
+ import HiddenInput from "../../utilities/hidden-input.svelte";
4
+
5
+ const inputState = RatingGroupHiddenInputState.create();
6
+ </script>
7
+
8
+ {#if inputState.shouldRender}
9
+ <HiddenInput {...inputState.props} />
10
+ {/if}
tools/ui/node_modules/bits-ui/dist/bits/rating-group/components/rating-group-input.svelte.d.ts ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const RatingGroupInput: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type RatingGroupInput = InstanceType<typeof RatingGroupInput>;
18
+ export default RatingGroupInput;
tools/ui/node_modules/bits-ui/dist/bits/rating-group/components/rating-group-item.svelte ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { boxWith, mergeProps } from "svelte-toolbelt";
3
+ import type { RatingGroupItemProps } from "../types.js";
4
+ import { RatingGroupItemState } from "../rating-group.svelte.js";
5
+ import { createId } from "../../../internal/create-id.js";
6
+
7
+ const uid = $props.id();
8
+
9
+ let {
10
+ disabled = false,
11
+ index,
12
+ children,
13
+ child,
14
+ ref = $bindable(null),
15
+ id = createId(uid),
16
+ ...restProps
17
+ }: RatingGroupItemProps = $props();
18
+
19
+ const itemState = RatingGroupItemState.create({
20
+ disabled: boxWith(() => Boolean(disabled)),
21
+ index: boxWith(() => index),
22
+ id: boxWith(() => id),
23
+ ref: boxWith(
24
+ () => ref,
25
+ (v) => (ref = v)
26
+ ),
27
+ });
28
+
29
+ const mergedProps = $derived(mergeProps(restProps, itemState.props));
30
+ </script>
31
+
32
+ {#if child}
33
+ {@render child({ props: mergedProps, ...itemState.snippetProps })}
34
+ {:else}
35
+ <div {...mergedProps}>
36
+ {@render children?.(itemState.snippetProps)}
37
+ </div>
38
+ {/if}
tools/ui/node_modules/bits-ui/dist/bits/rating-group/components/rating-group-item.svelte.d.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import type { RatingGroupItemProps } from "../types.js";
2
+ declare const RatingGroupItem: import("svelte").Component<RatingGroupItemProps, {}, "ref">;
3
+ type RatingGroupItem = ReturnType<typeof RatingGroupItem>;
4
+ export default RatingGroupItem;
tools/ui/node_modules/bits-ui/dist/bits/rating-group/components/rating-group.svelte ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { boxWith, mergeProps } from "svelte-toolbelt";
3
+ import type { RatingGroupRootProps } from "../types.js";
4
+ import { RatingGroupRootState } from "../rating-group.svelte.js";
5
+ import RatingGroupInput from "./rating-group-input.svelte";
6
+ import { createId } from "../../../internal/create-id.js";
7
+ import { noop } from "../../../internal/noop.js";
8
+
9
+ const uid = $props.id();
10
+
11
+ let {
12
+ disabled = false,
13
+ children,
14
+ child,
15
+ value = $bindable(0),
16
+ ref = $bindable(null),
17
+ orientation = "horizontal",
18
+ name = undefined,
19
+ required = false,
20
+ min = 0,
21
+ max = 5,
22
+ allowHalf = false,
23
+ readonly = false,
24
+ id = createId(uid),
25
+ onValueChange = noop,
26
+ "aria-label": ariaLabel,
27
+ "aria-valuetext": ariaValuetextProp,
28
+ hoverPreview = true,
29
+ ...restProps
30
+ }: RatingGroupRootProps = $props();
31
+
32
+ if (value < min || value > max) {
33
+ value = Math.max(min, Math.min(max, value));
34
+ }
35
+
36
+ const ariaValuetext: NonNullable<RatingGroupRootProps["aria-valuetext"]> = $derived.by(() => {
37
+ if (ariaValuetextProp) return ariaValuetextProp;
38
+ return (value: number, max: number) => `${value} out of ${max}`;
39
+ });
40
+
41
+ const rootState = RatingGroupRootState.create({
42
+ orientation: boxWith(() => orientation),
43
+ disabled: boxWith(() => disabled),
44
+ name: boxWith(() => name),
45
+ required: boxWith(() => required),
46
+ min: boxWith(() => min),
47
+ max: boxWith(() => max),
48
+ allowHalf: boxWith(() => allowHalf),
49
+ readonly: boxWith(() => readonly),
50
+ id: boxWith(() => id),
51
+ value: boxWith(
52
+ () => value,
53
+ (v) => {
54
+ if (v === value) return;
55
+ value = v;
56
+ onValueChange?.(v);
57
+ }
58
+ ),
59
+ ref: boxWith(
60
+ () => ref,
61
+ (v) => (ref = v)
62
+ ),
63
+ ariaValuetext: boxWith(() => ariaValuetext),
64
+ hoverPreview: boxWith(() => hoverPreview),
65
+ });
66
+
67
+ const mergedProps = $derived(
68
+ mergeProps(restProps, rootState.props, { "aria-label": ariaLabel })
69
+ );
70
+ </script>
71
+
72
+ {#if child}
73
+ {@render child({ props: mergedProps, ...rootState.snippetProps })}
74
+ {:else}
75
+ <div {...mergedProps}>
76
+ {@render children?.(rootState.snippetProps)}
77
+ </div>
78
+ {/if}
79
+
80
+ <RatingGroupInput />
tools/ui/node_modules/bits-ui/dist/bits/rating-group/components/rating-group.svelte.d.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import type { RatingGroupRootProps } from "../types.js";
2
+ declare const RatingGroup: import("svelte").Component<RatingGroupRootProps, {}, "value" | "ref">;
3
+ type RatingGroup = ReturnType<typeof RatingGroup>;
4
+ export default RatingGroup;
tools/ui/node_modules/bits-ui/dist/bits/rating-group/exports.d.ts ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ export { default as Root } from "./components/rating-group.svelte";
2
+ export { default as Item } from "./components/rating-group-item.svelte";
3
+ export type { RatingGroupRootProps as RootProps, RatingGroupItemProps as ItemProps, } from "./types.js";
tools/ui/node_modules/bits-ui/dist/bits/rating-group/exports.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ export { default as Root } from "./components/rating-group.svelte";
2
+ export { default as Item } from "./components/rating-group-item.svelte";