@box-kite/react 2.2.17 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/rules/box-kite-rules.md +6 -4
- package/.claude/skills/box-kite/SKILL.md +6 -4
- package/.claude/skills/box-kite/references/components.md +1 -1
- package/.claude/skills/box-kite/references/patterns.md +1 -1
- package/.claude/skills/box-kite/references/styling.md +2 -2
- package/.cursor/rules/box-kite.mdc +6 -4
- package/AGENTS.md +6 -4
- package/BOX_AI_CONTEXT.md +40 -3
- package/BOX_KITE_AI_CONTEXT.md +40 -3
- package/behavior.cjs +1 -1
- package/behavior.mjs +62 -62
- package/box.cjs +1 -1
- package/box.d.ts +1 -0
- package/box.mjs +1 -1
- package/catalog.cjs +1 -1
- package/catalog.mjs +4 -4
- package/client.cjs +1 -1
- package/client.mjs +11 -11
- package/components/accordion.cjs +1 -1
- package/components/accordion.mjs +1 -1
- package/components/calendar.cjs +1 -1
- package/components/calendar.mjs +21 -20
- package/components/combobox.cjs +1 -1
- package/components/combobox.mjs +1 -1
- package/components/dashboard.cjs +1 -1
- package/components/dashboard.mjs +12 -12
- package/components/dataGrid.cjs +2 -2
- package/components/dataGrid.mjs +5 -5
- package/components/dateField.cjs +1 -1
- package/components/dateField.mjs +6 -6
- package/components/datePicker.cjs +1 -1
- package/components/datePicker.mjs +118 -116
- package/components/dialog.cjs +1 -1
- package/components/dialog.d.ts +1 -1
- package/components/dialog.mjs +108 -101
- package/components/dropdown.cjs +1 -1
- package/components/dropdown.mjs +8 -3
- package/components/form.cjs +1 -1
- package/components/form.mjs +1 -1
- package/components/menu.cjs +1 -1
- package/components/menu.mjs +10 -10
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +5 -5
- package/components/popover.cjs +1 -1
- package/components/popover.d.ts +8 -2
- package/components/popover.mjs +58 -55
- package/components/radioGroup.cjs +1 -1
- package/components/radioGroup.mjs +1 -1
- package/components/slider.cjs +1 -1
- package/components/slider.mjs +8 -8
- package/components/sortableList.cjs +1 -1
- package/components/sortableList.mjs +1 -1
- package/components/swipeItem.cjs +1 -1
- package/components/swipeItem.mjs +10 -10
- package/components/tabs.cjs +1 -1
- package/components/tabs.mjs +9 -9
- package/components/toaster.cjs +1 -1
- package/components/toaster.mjs +133 -115
- package/components/tooltip.cjs +1 -1
- package/components/tooltip.mjs +1 -1
- package/components/virtualList.cjs +1 -1
- package/components/virtualList.mjs +1 -1
- package/docs/props.md +6 -6
- package/interactionListening.cjs +1 -1
- package/interactionListening.mjs +1 -1
- package/layer.cjs +1 -1
- package/layer.mjs +17 -14
- package/package.json +2 -2
- package/placement.cjs +1 -1
- package/placement.mjs +10 -10
- package/platform.cjs +1 -1
- package/platform.mjs +23 -11
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +1 -1
- package/rsc.cjs +1 -1
- package/rsc.d.ts +1 -0
- package/rsc.mjs +1 -1
- package/scrolling.cjs +1 -1
- package/scrolling.mjs +1 -1
- package/utils/dom/domUtils.d.ts +9 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { f as e } from "../react-shared.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { d as t } from "../platform.mjs";
|
|
4
4
|
import n from "../box.mjs";
|
|
5
5
|
import { a as r, t as i } from "../behavior.mjs";
|
|
6
6
|
import { t as a } from "../placement.mjs";
|
|
@@ -18,7 +18,7 @@ import te from "./dateField.mjs";
|
|
|
18
18
|
import { useCallback as T, useEffect as E, useMemo as D, useRef as ne, useState as re } from "react";
|
|
19
19
|
import { Fragment as ie, jsx as O, jsxs as k } from "react/jsx-runtime";
|
|
20
20
|
//#region src/components/datePicker.tsx
|
|
21
|
-
function
|
|
21
|
+
function ae() {
|
|
22
22
|
return /* @__PURE__ */ O(b, {
|
|
23
23
|
viewBox: "0 0 16 16",
|
|
24
24
|
width: "1rem",
|
|
@@ -32,7 +32,7 @@ function A() {
|
|
|
32
32
|
})
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function A() {
|
|
36
36
|
return /* @__PURE__ */ O(b, {
|
|
37
37
|
viewBox: "0 0 16 16",
|
|
38
38
|
width: "1rem",
|
|
@@ -47,7 +47,7 @@ function j() {
|
|
|
47
47
|
})
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function oe() {
|
|
51
51
|
return /* @__PURE__ */ O(b, {
|
|
52
52
|
viewBox: "0 0 16 16",
|
|
53
53
|
width: "0.875rem",
|
|
@@ -61,7 +61,7 @@ function ae() {
|
|
|
61
61
|
})
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function se(e) {
|
|
65
65
|
let [i, o] = re(null), s = e.ref, c = T((e) => {
|
|
66
66
|
o(e), t(s, e);
|
|
67
67
|
}, [s]), l = (e) => {
|
|
@@ -82,10 +82,7 @@ function oe(e) {
|
|
|
82
82
|
component: "datePicker",
|
|
83
83
|
type: "openChange"
|
|
84
84
|
},
|
|
85
|
-
onOpened: u
|
|
86
|
-
onClosing: (e, t) => {
|
|
87
|
-
e && t?.focus();
|
|
88
|
-
}
|
|
85
|
+
onOpened: u
|
|
89
86
|
}), y = a({
|
|
90
87
|
side: e.side,
|
|
91
88
|
align: e.align,
|
|
@@ -119,7 +116,7 @@ function oe(e) {
|
|
|
119
116
|
return d ? /* @__PURE__ */ O(n, {
|
|
120
117
|
ref: m,
|
|
121
118
|
component: "popover",
|
|
122
|
-
variant: { topLayer: !0 },
|
|
119
|
+
variant: [e.variant, { topLayer: !0 }],
|
|
123
120
|
p: 3,
|
|
124
121
|
...y.layerProps,
|
|
125
122
|
id: p,
|
|
@@ -136,6 +133,7 @@ function oe(e) {
|
|
|
136
133
|
offset: 1,
|
|
137
134
|
matchWidth: e.matchWidth,
|
|
138
135
|
component: "popover",
|
|
136
|
+
variant: e.variant,
|
|
139
137
|
p: 3,
|
|
140
138
|
id: p,
|
|
141
139
|
props: r,
|
|
@@ -144,7 +142,7 @@ function oe(e) {
|
|
|
144
142
|
}
|
|
145
143
|
};
|
|
146
144
|
}
|
|
147
|
-
function
|
|
145
|
+
function ce(e) {
|
|
148
146
|
let { value: t, step: r, locale: a, hourCycle: o, onSelect: s, label: l, min: u, max: d, emptyLabel: f, separated: p } = e, m = D(() => h(r, {
|
|
149
147
|
min: u,
|
|
150
148
|
max: d
|
|
@@ -189,10 +187,11 @@ function se(e) {
|
|
|
189
187
|
children: m.map((e, t) => /* @__PURE__ */ O(n, {
|
|
190
188
|
component: "datePicker.time",
|
|
191
189
|
variant: { selected: e === _ },
|
|
190
|
+
minHeight: "control",
|
|
192
191
|
px: 3,
|
|
193
192
|
py: 1.5,
|
|
194
193
|
borderRadius: 2,
|
|
195
|
-
fontSize:
|
|
194
|
+
fontSize: "control",
|
|
196
195
|
textAlign: "start",
|
|
197
196
|
whiteSpace: "nowrap",
|
|
198
197
|
css: { fontVariantNumeric: "tabular-nums" },
|
|
@@ -211,7 +210,7 @@ function se(e) {
|
|
|
211
210
|
}, e))
|
|
212
211
|
});
|
|
213
212
|
}
|
|
214
|
-
function
|
|
213
|
+
function le(e) {
|
|
215
214
|
return /* @__PURE__ */ O(n, {
|
|
216
215
|
component: "datePicker.presets",
|
|
217
216
|
display: "flex",
|
|
@@ -224,10 +223,11 @@ function ce(e) {
|
|
|
224
223
|
tag: "button",
|
|
225
224
|
component: "datePicker.preset",
|
|
226
225
|
variant: { selected: e.isSelected(t.value) },
|
|
226
|
+
minHeight: "control",
|
|
227
227
|
px: 3,
|
|
228
228
|
py: 1.5,
|
|
229
229
|
borderRadius: 2,
|
|
230
|
-
fontSize:
|
|
230
|
+
fontSize: "control",
|
|
231
231
|
textAlign: "start",
|
|
232
232
|
whiteSpace: "nowrap",
|
|
233
233
|
props: {
|
|
@@ -238,7 +238,7 @@ function ce(e) {
|
|
|
238
238
|
}, t.label))
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function ue(e) {
|
|
242
242
|
let { frame: t, attachField: i, attachTrigger: a, triggerAttributes: o, triggerElement: s, id: c, label: l, labelledBy: u, describedBy: d } = e, { text: f, placeholder: p, icon: m, clear: h, disabled: g, invalid: _, required: v = !1, tabIndex: y, inputs: b, onReset: ee } = e, x = ne(null), S = l === void 0 ? void 0 : `${c}-label`, C = `${c}-value`, w = r(ee);
|
|
243
243
|
return E(() => {
|
|
244
244
|
let e = x.current?.form;
|
|
@@ -338,8 +338,8 @@ function le(e) {
|
|
|
338
338
|
]
|
|
339
339
|
})] });
|
|
340
340
|
}
|
|
341
|
-
function
|
|
342
|
-
let { type: r = "date", value: i, defaultValue: a = null, onValueChange: o, zone: h, locale: g, hourCycle: y, granularity: b, disambiguation: S, min: C, max: w, isDateUnavailable: T, disabled: E = !1, readOnly: D = !1, required: ne, invalid: re, name:
|
|
341
|
+
function j(e, t) {
|
|
342
|
+
let { type: r = "date", value: i, defaultValue: a = null, onValueChange: o, zone: h, locale: g, hourCycle: y, granularity: b, disambiguation: S, min: C, max: w, isDateUnavailable: T, disabled: E = !1, readOnly: D = !1, required: ne, invalid: re, name: j, label: M, labelledBy: N, describedBy: P, open: de, defaultOpen: fe, onOpenChange: pe, closeOnSelect: me = !0, firstDayOfWeek: F, weekNumbers: he, side: I = "bottom", align: ge = "start", matchWidth: _e = r === "time", emptyTimesLabel: L = "No times available", clearable: ve = !1, pickOnly: R = !1, triggerLabel: ye, clearLabel: be = "Clear", tabIndex: z, step: B = 30, defaultTime: V = "00:00", presets: H, showZone: U, ...W } = e, G = ee({
|
|
343
343
|
locale: g,
|
|
344
344
|
zone: h === "none" ? void 0 : h
|
|
345
345
|
}), { locale: K } = G, q = r === "datetime" && h !== "none" ? G.zone : null, J = q ?? G.zone, [Y, X] = _({
|
|
@@ -354,15 +354,16 @@ function M(e, t) {
|
|
|
354
354
|
type: "valueChange",
|
|
355
355
|
content: ["value"]
|
|
356
356
|
}
|
|
357
|
-
}), Z =
|
|
357
|
+
}), Z = ye ?? (r === "time" ? "Choose time" : "Choose date"), xe = typeof M == "string" ? M : Z, { attachTrigger: Q, triggerAttributes: Se, triggerElement: Ce, closeOnChoice: we, id: Te, attachField: Ee, panel: De } = se({
|
|
358
358
|
ref: t,
|
|
359
|
-
open:
|
|
360
|
-
defaultOpen:
|
|
361
|
-
onOpenChange:
|
|
362
|
-
side:
|
|
363
|
-
align:
|
|
364
|
-
matchWidth:
|
|
365
|
-
label: xe
|
|
359
|
+
open: de,
|
|
360
|
+
defaultOpen: fe,
|
|
361
|
+
onOpenChange: pe,
|
|
362
|
+
side: I,
|
|
363
|
+
align: ge,
|
|
364
|
+
matchWidth: _e,
|
|
365
|
+
label: xe,
|
|
366
|
+
variant: W.variant
|
|
366
367
|
}), $ = Y && r !== "time" ? d(Y, { zone: J }) : null, Oe = Y && r !== "date" ? l(Y, { zone: J }) : null, ke = r === "datetime" ? $ ?? u(J) : null, Ae = (e) => e && (ke === null || d(e, { zone: J }) === ke) ? l(e, { zone: J }) : null, je = Y ? c(Y, {
|
|
367
368
|
locale: K,
|
|
368
369
|
zone: J,
|
|
@@ -371,7 +372,7 @@ function M(e, t) {
|
|
|
371
372
|
dateStyle: "medium",
|
|
372
373
|
timeStyle: "short"
|
|
373
374
|
}
|
|
374
|
-
}) : "", Me =
|
|
375
|
+
}) : "", Me = R && Y && q && (U ?? q !== G.readerZone) ? s(q, {
|
|
375
376
|
locale: K,
|
|
376
377
|
style: "short",
|
|
377
378
|
at: Y
|
|
@@ -382,7 +383,7 @@ function M(e, t) {
|
|
|
382
383
|
e && (r === "date" ? (X(e, {
|
|
383
384
|
reason: "select",
|
|
384
385
|
event: t
|
|
385
|
-
}),
|
|
386
|
+
}), me && Ne(t)) : X(Pe(e, Oe ?? V), {
|
|
386
387
|
reason: "select",
|
|
387
388
|
event: t
|
|
388
389
|
}));
|
|
@@ -390,7 +391,7 @@ function M(e, t) {
|
|
|
390
391
|
X(r === "time" ? e : Pe($ ?? u(J), e), {
|
|
391
392
|
reason: "select",
|
|
392
393
|
event: t
|
|
393
|
-
}),
|
|
394
|
+
}), me && Ne(t);
|
|
394
395
|
}, Le = /* @__PURE__ */ O(n, {
|
|
395
396
|
tag: "button",
|
|
396
397
|
ref: Q,
|
|
@@ -407,11 +408,11 @@ function M(e, t) {
|
|
|
407
408
|
props: {
|
|
408
409
|
type: "button",
|
|
409
410
|
"aria-label": je ? `${Z}, ${je}` : Z,
|
|
410
|
-
tabIndex:
|
|
411
|
+
tabIndex: z,
|
|
411
412
|
...Se
|
|
412
413
|
},
|
|
413
|
-
children: O(r === "time" ?
|
|
414
|
-
}), Re =
|
|
414
|
+
children: O(r === "time" ? A : ae, {})
|
|
415
|
+
}), Re = ve && Y && !E && !D && /* @__PURE__ */ O(n, {
|
|
415
416
|
tag: "button",
|
|
416
417
|
component: "datePicker.clear",
|
|
417
418
|
display: "inline-flex",
|
|
@@ -425,34 +426,34 @@ function M(e, t) {
|
|
|
425
426
|
zIndex: 1,
|
|
426
427
|
props: {
|
|
427
428
|
type: "button",
|
|
428
|
-
"aria-label":
|
|
429
|
-
tabIndex:
|
|
429
|
+
"aria-label": be,
|
|
430
|
+
tabIndex: z,
|
|
430
431
|
onClick: (e) => X(null, {
|
|
431
432
|
reason: "clear",
|
|
432
433
|
event: e
|
|
433
434
|
})
|
|
434
435
|
},
|
|
435
|
-
children: /* @__PURE__ */ O(
|
|
436
|
-
}), ze = Y !== null && (C != null && f(Y, C) < 0 || w != null && f(Y, w) > 0), Be =
|
|
437
|
-
frame:
|
|
436
|
+
children: /* @__PURE__ */ O(oe, {})
|
|
437
|
+
}), ze = Y !== null && (C != null && f(Y, C) < 0 || w != null && f(Y, w) > 0), Be = R ? /* @__PURE__ */ O(ue, {
|
|
438
|
+
frame: W,
|
|
438
439
|
attachField: Ee,
|
|
439
440
|
attachTrigger: D ? void 0 : Q,
|
|
440
441
|
triggerAttributes: D ? void 0 : Se,
|
|
441
442
|
triggerElement: Ce,
|
|
442
443
|
id: Te,
|
|
443
|
-
label:
|
|
444
|
-
labelledBy:
|
|
445
|
-
describedBy:
|
|
444
|
+
label: M,
|
|
445
|
+
labelledBy: N,
|
|
446
|
+
describedBy: P,
|
|
446
447
|
text: Me ? `${je} ${Me}` : je,
|
|
447
448
|
placeholder: Z,
|
|
448
|
-
icon: O(r === "time" ?
|
|
449
|
+
icon: O(r === "time" ? A : ae, {}),
|
|
449
450
|
clear: Re,
|
|
450
451
|
disabled: E,
|
|
451
452
|
invalid: re ?? (ze || $ !== null && !!T?.($)),
|
|
452
453
|
required: ne,
|
|
453
|
-
tabIndex:
|
|
454
|
+
tabIndex: z,
|
|
454
455
|
inputs: [{
|
|
455
|
-
name:
|
|
456
|
+
name: j,
|
|
456
457
|
value: Y ?? ""
|
|
457
458
|
}],
|
|
458
459
|
onReset: (e) => X(a, {
|
|
@@ -461,7 +462,7 @@ function M(e, t) {
|
|
|
461
462
|
})
|
|
462
463
|
}) : /* @__PURE__ */ O(te, {
|
|
463
464
|
ref: Ee,
|
|
464
|
-
...
|
|
465
|
+
...W,
|
|
465
466
|
type: r,
|
|
466
467
|
value: Y,
|
|
467
468
|
onValueChange: (e, t) => X(e, {
|
|
@@ -480,12 +481,12 @@ function M(e, t) {
|
|
|
480
481
|
readOnly: D,
|
|
481
482
|
required: ne,
|
|
482
483
|
invalid: re,
|
|
483
|
-
name:
|
|
484
|
-
label:
|
|
485
|
-
labelledBy:
|
|
486
|
-
describedBy:
|
|
487
|
-
showZone:
|
|
488
|
-
tabIndex:
|
|
484
|
+
name: j,
|
|
485
|
+
label: M,
|
|
486
|
+
labelledBy: N,
|
|
487
|
+
describedBy: P,
|
|
488
|
+
showZone: U,
|
|
489
|
+
tabIndex: z,
|
|
489
490
|
end: /* @__PURE__ */ k(ie, { children: [Re, Le] })
|
|
490
491
|
});
|
|
491
492
|
return /* @__PURE__ */ k(v, { children: [Be, De(/* @__PURE__ */ k(n, {
|
|
@@ -493,14 +494,14 @@ function M(e, t) {
|
|
|
493
494
|
gap: 3,
|
|
494
495
|
ai: "stretch",
|
|
495
496
|
children: [
|
|
496
|
-
|
|
497
|
-
presets:
|
|
497
|
+
H && H.length > 0 && /* @__PURE__ */ O(le, {
|
|
498
|
+
presets: H,
|
|
498
499
|
isSelected: (e) => Y !== null && f(e, Y, { zone: J }) === 0,
|
|
499
500
|
onSelect: (e, t) => {
|
|
500
501
|
X(e, {
|
|
501
502
|
reason: "preset",
|
|
502
503
|
event: t
|
|
503
|
-
}),
|
|
504
|
+
}), me && Ne(t);
|
|
504
505
|
}
|
|
505
506
|
}),
|
|
506
507
|
r !== "time" && /* @__PURE__ */ O(x, {
|
|
@@ -511,26 +512,26 @@ function M(e, t) {
|
|
|
511
512
|
isDateUnavailable: T,
|
|
512
513
|
locale: g,
|
|
513
514
|
zone: h === "none" ? void 0 : h,
|
|
514
|
-
firstDayOfWeek:
|
|
515
|
-
weekNumbers:
|
|
515
|
+
firstDayOfWeek: F,
|
|
516
|
+
weekNumbers: he
|
|
516
517
|
}),
|
|
517
|
-
r !== "date" && /* @__PURE__ */ O(
|
|
518
|
+
r !== "date" && /* @__PURE__ */ O(ce, {
|
|
518
519
|
value: Oe,
|
|
519
|
-
step:
|
|
520
|
+
step: B,
|
|
520
521
|
locale: K,
|
|
521
522
|
hourCycle: y,
|
|
522
523
|
label: r === "time" ? xe : "Time",
|
|
523
524
|
min: Ae(C),
|
|
524
525
|
max: Ae(w),
|
|
525
|
-
emptyLabel:
|
|
526
|
+
emptyLabel: L,
|
|
526
527
|
separated: r === "datetime",
|
|
527
528
|
onSelect: Ie
|
|
528
529
|
})
|
|
529
530
|
]
|
|
530
531
|
}))] });
|
|
531
532
|
}
|
|
532
|
-
function
|
|
533
|
-
let { value: r, defaultValue: i = null, onValueChange: a, locale: s, min: c, max: l, isDateUnavailable: u, disabled: d = !1, readOnly: p = !1, required: m, invalid: h, startName: g, endName: y, label: b, labelledBy: S, describedBy: C, startLabel: w = "Start date", endLabel: T = "End date", open: E, defaultOpen: D, onOpenChange: ne, closeOnSelect:
|
|
533
|
+
function M(e, t) {
|
|
534
|
+
let { value: r, defaultValue: i = null, onValueChange: a, locale: s, min: c, max: l, isDateUnavailable: u, disabled: d = !1, readOnly: p = !1, required: m, invalid: h, startName: g, endName: y, label: b, labelledBy: S, describedBy: C, startLabel: w = "Start date", endLabel: T = "End date", open: E, defaultOpen: D, onOpenChange: ne, closeOnSelect: A = !0, firstDayOfWeek: ce, weekNumbers: j, months: M = 2, side: N = "bottom", align: P = "start", matchWidth: de = !1, emptyTimesLabel: fe, clearable: pe = !1, pickOnly: me = !1, triggerLabel: F = "Choose dates", clearLabel: he = "Clear", tabIndex: I, presets: ge, props: _e, ...L } = e, { locale: ve } = ee({ locale: s }), [R, ye] = _({
|
|
534
535
|
value: r,
|
|
535
536
|
defaultValue: i,
|
|
536
537
|
onChange: a,
|
|
@@ -539,35 +540,36 @@ function N(e, t) {
|
|
|
539
540
|
type: "valueChange",
|
|
540
541
|
content: ["value"]
|
|
541
542
|
}
|
|
542
|
-
}), [
|
|
543
|
-
start:
|
|
544
|
-
end:
|
|
545
|
-
source:
|
|
546
|
-
}), { start:
|
|
547
|
-
|
|
548
|
-
start:
|
|
549
|
-
end:
|
|
550
|
-
source:
|
|
543
|
+
}), [be, z] = re({
|
|
544
|
+
start: R?.start ?? null,
|
|
545
|
+
end: R?.end ?? null,
|
|
546
|
+
source: R
|
|
547
|
+
}), { start: B, end: V } = be;
|
|
548
|
+
be.source !== R && (B = R?.start ?? null, V = R?.end ?? null, z({
|
|
549
|
+
start: B,
|
|
550
|
+
end: V,
|
|
551
|
+
source: R
|
|
551
552
|
}));
|
|
552
|
-
let { attachTrigger:
|
|
553
|
+
let { attachTrigger: H, triggerAttributes: U, triggerElement: W, closeOnChoice: G, id: K, attachField: q, panel: J } = se({
|
|
553
554
|
ref: t,
|
|
554
555
|
open: E,
|
|
555
556
|
defaultOpen: D,
|
|
556
557
|
onOpenChange: ne,
|
|
557
|
-
side:
|
|
558
|
-
align:
|
|
559
|
-
matchWidth:
|
|
560
|
-
label: typeof b == "string" ? b :
|
|
561
|
-
|
|
558
|
+
side: N,
|
|
559
|
+
align: P,
|
|
560
|
+
matchWidth: de,
|
|
561
|
+
label: typeof b == "string" ? b : F,
|
|
562
|
+
variant: L.variant
|
|
563
|
+
}), Y = R ? o(R.start, R.end, { locale: ve }) : "", X = B !== null && V !== null && f(B, V) > 0, Z = (e, t, n, r) => {
|
|
562
564
|
let i = e && t && f(e, t) <= 0 ? {
|
|
563
565
|
start: e,
|
|
564
566
|
end: t
|
|
565
567
|
} : null;
|
|
566
|
-
|
|
568
|
+
z({
|
|
567
569
|
start: e,
|
|
568
570
|
end: t,
|
|
569
571
|
source: i
|
|
570
|
-
}),
|
|
572
|
+
}), ye(i, {
|
|
571
573
|
reason: n,
|
|
572
574
|
event: r
|
|
573
575
|
});
|
|
@@ -582,8 +584,8 @@ function N(e, t) {
|
|
|
582
584
|
component: "datePicker.part",
|
|
583
585
|
px: 0,
|
|
584
586
|
py: 0,
|
|
585
|
-
tabIndex:
|
|
586
|
-
}, Se =
|
|
587
|
+
tabIndex: I
|
|
588
|
+
}, Se = pe && R && !d && !p && /* @__PURE__ */ O(n, {
|
|
587
589
|
tag: "button",
|
|
588
590
|
component: "datePicker.clear",
|
|
589
591
|
display: "inline-flex",
|
|
@@ -596,38 +598,38 @@ function N(e, t) {
|
|
|
596
598
|
zIndex: 1,
|
|
597
599
|
props: {
|
|
598
600
|
type: "button",
|
|
599
|
-
"aria-label":
|
|
600
|
-
tabIndex:
|
|
601
|
+
"aria-label": he,
|
|
602
|
+
tabIndex: I,
|
|
601
603
|
onClick: (e) => Z(null, null, "clear", e)
|
|
602
604
|
},
|
|
603
|
-
children: /* @__PURE__ */ O(
|
|
604
|
-
}), Ce =
|
|
605
|
+
children: /* @__PURE__ */ O(oe, {})
|
|
606
|
+
}), Ce = R !== null && (c != null && f(R.start, c) < 0 || l != null && f(R.end, l) > 0), we = me ? /* @__PURE__ */ O(ue, {
|
|
605
607
|
frame: {
|
|
606
|
-
...
|
|
607
|
-
props:
|
|
608
|
+
...L,
|
|
609
|
+
props: _e
|
|
608
610
|
},
|
|
609
611
|
attachField: q,
|
|
610
|
-
attachTrigger: p ? void 0 :
|
|
611
|
-
triggerAttributes: p ? void 0 :
|
|
612
|
-
triggerElement:
|
|
612
|
+
attachTrigger: p ? void 0 : H,
|
|
613
|
+
triggerAttributes: p ? void 0 : U,
|
|
614
|
+
triggerElement: W,
|
|
613
615
|
id: K,
|
|
614
616
|
label: b,
|
|
615
617
|
labelledBy: S,
|
|
616
618
|
describedBy: C,
|
|
617
619
|
text: Y,
|
|
618
|
-
placeholder:
|
|
619
|
-
icon: /* @__PURE__ */ O(
|
|
620
|
+
placeholder: F,
|
|
621
|
+
icon: /* @__PURE__ */ O(ae, {}),
|
|
620
622
|
clear: Se,
|
|
621
623
|
disabled: d,
|
|
622
624
|
invalid: h ?? Ce,
|
|
623
625
|
required: m,
|
|
624
|
-
tabIndex:
|
|
626
|
+
tabIndex: I,
|
|
625
627
|
inputs: [{
|
|
626
628
|
name: g,
|
|
627
|
-
value:
|
|
629
|
+
value: R?.start ?? ""
|
|
628
630
|
}, {
|
|
629
631
|
name: y,
|
|
630
|
-
value:
|
|
632
|
+
value: R?.end ?? ""
|
|
631
633
|
}],
|
|
632
634
|
onReset: (e) => Z(i?.start ?? null, i?.end ?? null, "reset", e)
|
|
633
635
|
}) : /* @__PURE__ */ k(ie, { children: [b !== void 0 && /* @__PURE__ */ O(n, {
|
|
@@ -645,8 +647,8 @@ function N(e, t) {
|
|
|
645
647
|
gap: 2,
|
|
646
648
|
px: 3,
|
|
647
649
|
py: 2,
|
|
648
|
-
...
|
|
649
|
-
variant: [
|
|
650
|
+
...L,
|
|
651
|
+
variant: [L.variant, {
|
|
650
652
|
disabled: d,
|
|
651
653
|
invalid: h ?? X
|
|
652
654
|
}],
|
|
@@ -655,13 +657,13 @@ function N(e, t) {
|
|
|
655
657
|
"aria-labelledby": [b === void 0 ? void 0 : `${K}-label`, S].filter(Boolean).join(" ") || void 0,
|
|
656
658
|
"aria-invalid": (h ?? X) || void 0,
|
|
657
659
|
"aria-describedby": C,
|
|
658
|
-
...
|
|
660
|
+
..._e
|
|
659
661
|
},
|
|
660
662
|
children: [
|
|
661
663
|
/* @__PURE__ */ O(te, {
|
|
662
664
|
...Q,
|
|
663
|
-
value:
|
|
664
|
-
onValueChange: (e, t) => Z(e,
|
|
665
|
+
value: B,
|
|
666
|
+
onValueChange: (e, t) => Z(e, V, t.reason, t.event),
|
|
665
667
|
name: g,
|
|
666
668
|
props: { "aria-label": w },
|
|
667
669
|
invalid: h ?? X
|
|
@@ -673,8 +675,8 @@ function N(e, t) {
|
|
|
673
675
|
}),
|
|
674
676
|
/* @__PURE__ */ O(te, {
|
|
675
677
|
...Q,
|
|
676
|
-
value:
|
|
677
|
-
onValueChange: (e, t) => Z(
|
|
678
|
+
value: V,
|
|
679
|
+
onValueChange: (e, t) => Z(B, e, t.reason, t.event),
|
|
678
680
|
name: y,
|
|
679
681
|
props: { "aria-label": T },
|
|
680
682
|
invalid: h ?? X
|
|
@@ -686,7 +688,7 @@ function N(e, t) {
|
|
|
686
688
|
ms: "auto",
|
|
687
689
|
children: [Se, /* @__PURE__ */ O(n, {
|
|
688
690
|
tag: "button",
|
|
689
|
-
ref:
|
|
691
|
+
ref: H,
|
|
690
692
|
component: "datePicker.trigger",
|
|
691
693
|
display: "inline-flex",
|
|
692
694
|
ai: "center",
|
|
@@ -698,11 +700,11 @@ function N(e, t) {
|
|
|
698
700
|
disabled: d || p,
|
|
699
701
|
props: {
|
|
700
702
|
type: "button",
|
|
701
|
-
"aria-label": Y ? `${
|
|
702
|
-
tabIndex:
|
|
703
|
-
...
|
|
703
|
+
"aria-label": Y ? `${F}, ${Y}` : F,
|
|
704
|
+
tabIndex: I,
|
|
705
|
+
...U
|
|
704
706
|
},
|
|
705
|
-
children: /* @__PURE__ */ O(
|
|
707
|
+
children: /* @__PURE__ */ O(ae, {})
|
|
706
708
|
})]
|
|
707
709
|
})
|
|
708
710
|
]
|
|
@@ -711,29 +713,29 @@ function N(e, t) {
|
|
|
711
713
|
display: "flex",
|
|
712
714
|
gap: 3,
|
|
713
715
|
ai: "stretch",
|
|
714
|
-
children: [
|
|
715
|
-
presets:
|
|
716
|
-
isSelected: (e) =>
|
|
716
|
+
children: [ge && ge.length > 0 && /* @__PURE__ */ O(le, {
|
|
717
|
+
presets: ge,
|
|
718
|
+
isSelected: (e) => R !== null && e.start === R.start && e.end === R.end,
|
|
717
719
|
onSelect: (e, t) => {
|
|
718
|
-
Z(e.start, e.end, "preset", t),
|
|
720
|
+
Z(e.start, e.end, "preset", t), A && xe(t);
|
|
719
721
|
}
|
|
720
722
|
}), /* @__PURE__ */ O(x, {
|
|
721
723
|
mode: "range",
|
|
722
|
-
months:
|
|
723
|
-
value:
|
|
724
|
-
defaultFocusedDate:
|
|
724
|
+
months: M,
|
|
725
|
+
value: R,
|
|
726
|
+
defaultFocusedDate: B ?? void 0,
|
|
725
727
|
onValueChange: (e, t) => {
|
|
726
|
-
Z(e?.start ?? null, e?.end ?? null, "select", t.event),
|
|
728
|
+
Z(e?.start ?? null, e?.end ?? null, "select", t.event), A && e && t.event && xe(t.event);
|
|
727
729
|
},
|
|
728
730
|
min: c,
|
|
729
731
|
max: l,
|
|
730
732
|
isDateUnavailable: u,
|
|
731
733
|
locale: s,
|
|
732
|
-
firstDayOfWeek:
|
|
733
|
-
weekNumbers:
|
|
734
|
+
firstDayOfWeek: ce,
|
|
735
|
+
weekNumbers: j
|
|
734
736
|
})]
|
|
735
737
|
}))] });
|
|
736
738
|
}
|
|
737
|
-
var
|
|
739
|
+
var N = e(j, "DatePicker"), P = e(M, "DateRangePicker");
|
|
738
740
|
//#endregion
|
|
739
|
-
export {
|
|
741
|
+
export { P as DateRangePicker, N as default };
|
package/components/dialog.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../react-shared.cjs"),t=require("../platform.cjs"),n=require("../client.cjs"),r=require("../effects.cjs"),i=require("../box.cjs"),a=require("../behavior.cjs"),o=require("../identity.cjs"),s=require("../reporting.cjs"),c=require("../motion.cjs"),l=require("./semantics.cjs");let u=require("react"),d=require("react/jsx-runtime");var f=0;function p(e){let{classNames:i,styleElements:a}=n.i({overflow:`hidden`},!1),o=i.slice(1).join(` `);return r.n(()=>{let n=t.n();if(!(!e||!n||!o))return f+=1,n.classList.add(o),()=>{--f,f===0&&n.classList.remove(o)}},[e,o]),a}var m=(0,u.createContext)(null);function h(e){let t=(0,u.useContext)(m);if(!t)throw Error(`<${e}> must be rendered inside a <Dialog>.`);return t}function g(e,t){return(0,d.jsx)(v,{role:`dialog`,...e,elementRef:t})}function _(e,t){return(0,d.jsx)(v,{role:`alertdialog`,...e,modal:!0,dismissible:!1,elementRef:t})}function v(e){let{role:n,trigger:l,children:f,open:h,defaultOpen:g=!1,onOpenChange:_,label:v,labelledBy:b,describedBy:x,modal:S=!0,dismissible:C=!0,lockScroll:w=S,initialFocus:T,elementRef:E,props:D,...O}=e,k=o.t(`dialog`),A=O.id??k,[j,M]=s.a({value:h,defaultValue:g,onChange:_,interaction:{component:n===`alertdialog`?`alertDialog`:`dialog`,type:`openChange`}}),[N,P]=(0,u.useState)(null),F=(0,u.useCallback)(e=>{P(e),t.
|
|
1
|
+
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../react-shared.cjs"),t=require("../platform.cjs"),n=require("../client.cjs"),r=require("../effects.cjs"),i=require("../box.cjs"),a=require("../behavior.cjs"),o=require("../identity.cjs"),s=require("../reporting.cjs"),c=require("../motion.cjs"),l=require("./semantics.cjs");let u=require("react"),d=require("react/jsx-runtime");var f=0;function p(e){let{classNames:i,styleElements:a}=n.i({overflow:`hidden`},!1),o=i.slice(1).join(` `);return r.n(()=>{let n=t.n();if(!(!e||!n||!o))return f+=1,n.classList.add(o),()=>{--f,f===0&&n.classList.remove(o)}},[e,o]),a}var m=(0,u.createContext)(null);function h(e){let t=(0,u.useContext)(m);if(!t)throw Error(`<${e}> must be rendered inside a <Dialog>.`);return t}function g(e,t){return(0,d.jsx)(v,{role:`dialog`,...e,elementRef:t})}function _(e,t){return(0,d.jsx)(v,{role:`alertdialog`,...e,modal:!0,dismissible:!1,elementRef:t})}function v(e){let{role:n,trigger:l,children:f,open:h,defaultOpen:g=!1,onOpenChange:_,label:v,labelledBy:b,describedBy:x,modal:S=!0,dismissible:C=!0,lockScroll:w=S,initialFocus:T,elementRef:E,props:D,...O}=e,k=o.t(`dialog`),A=O.id??k,[j,M]=s.a({value:h,defaultValue:g,onChange:_,interaction:{component:n===`alertdialog`?`alertDialog`:`dialog`,type:`openChange`}}),[N,P]=(0,u.useState)(null),F=(0,u.useCallback)(e=>{P(e),t.d(E,e)},[E]),[I,L]=(0,u.useState)(null),[R,z]=(0,u.useState)(!1),[B,V]=(0,u.useState)({title:0,description:0}),H=p(j&&w);a.n({enabled:j,returnTo:I});let U=c.t(f,j,N),W=(0,u.useCallback)(e=>(V(t=>({...t,[e]:t[e]+1})),()=>V(t=>({...t,[e]:t[e]-1}))),[]),G=(0,u.useMemo)(()=>({titleId:`${A}-title`,descriptionId:`${A}-description`,register:W}),[A,W]);y({dialog:N,isOpen:j,domOpen:R,setDomOpen:z,setOpen:M,modal:S,dismissible:C,triggerElement:I}),r.n(()=>{let e=t.h(T);!j||!e||e.focus()},[j,T]);let K=a.a(e=>{M(e=>!e,{reason:`trigger`,event:e})}),q=(0,u.useMemo)(()=>({ref:L,props:{"aria-expanded":j,"aria-haspopup":`dialog`,"aria-controls":j?A:void 0,onClick:K}}),[A,K,j]),J=O;return(0,d.jsxs)(d.Fragment,{children:[H,l?.(q),(0,d.jsx)(m.Provider,{value:G,children:(0,d.jsx)(i.default,{ref:F,tag:`dialog`,component:`dialog`,...J,id:A,props:{role:n,"aria-label":B.title||b?void 0:v,"aria-labelledby":b??(B.title?G.titleId:void 0),"aria-describedby":x??(B.description?G.descriptionId:void 0),...D},children:U})})]})}function y(e){let{dialog:n,isOpen:i,domOpen:o,setDomOpen:s,setOpen:c,modal:l,dismissible:d,triggerElement:f}=e,p=(0,u.useRef)(`imperative`),m=t.s(),h=d?`any`:`closerequest`;r.n(()=>{!n||i===o||(s(i),i?l?n.showModal():n.show():n.close())},[n,i,o,l,s]),r.n(()=>{if(!(!n||!i||!l))return t.u(n,!0),()=>t.u(n,!1)},[n,i,l]),r.n(()=>{if(!n)return;let e=new AbortController;return n.addEventListener(`close`,e=>{s(!1),c(!1,{reason:p.current,event:e}),p.current=`imperative`},{signal:e.signal}),()=>e.abort()},[n,s,c]),r.n(()=>{if(!(!n||!m))return n.setAttribute(`closedby`,h),()=>n.removeAttribute(`closedby`)},[n,m,h]),r.n(()=>{if(!i||!n)return;let e=new AbortController,r=(t,n)=>document.addEventListener(t,n,{signal:e.signal,capture:!0});return r(`keydown`,e=>{e.key===`Escape`&&(p.current=`escape`)}),r(`pointerdown`,e=>{t.g(e,[f])?p.current=`trigger`:!t.g(e,[n])||b(n,e)?p.current=`outside-pointer`:p.current=`imperative`}),()=>e.abort()},[i,n,f]),a.r({enabled:i&&!l&&!m,inside:[n],escapeKey:!0,outsidePointer:!1,onDismiss:(e,t)=>c(!1,{reason:`escape`,event:t})}),r.n(()=>{if(!n||!i||!d||m)return;let e=new AbortController;return document.addEventListener(`pointerdown`,e=>{t.g(e,[f])||t.g(e,[n])&&!b(n,e)||c(!1,{reason:`outside-pointer`,event:e})},{signal:e.signal,capture:!0}),()=>e.abort()},[n,i,d,m,f,c])}function b(e,t){if(t.target!==e)return!1;let n=e.getBoundingClientRect();return t.clientX<n.left||t.clientX>n.right||t.clientY<n.top||t.clientY>n.bottom}function x(e){let t=h(`Dialog.Title`);return r.n(()=>t.register(`title`),[t]),(0,d.jsx)(l.H2,{id:t.titleId,component:`dialog.title`,...e})}function S(e){let t=h(`Dialog.Description`);return r.n(()=>t.register(`description`),[t]),(0,d.jsx)(l.P,{id:t.descriptionId,component:`dialog.description`,...e})}x.displayName=`Dialog.Title`,S.displayName=`Dialog.Description`;var C={Title:x,Description:S},w=Object.assign(e.f(g,`Dialog`),C),T=Object.assign(e.f(_,`AlertDialog`),C);exports.AlertDialog=T,exports.default=w;
|
package/components/dialog.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export interface DialogProps<TKey extends keyof ComponentsAndVariants = 'dialog'
|
|
|
60
60
|
/**
|
|
61
61
|
* Where focus lands on open, instead of the first focusable thing inside. An **alert dialog owes this to
|
|
62
62
|
* its least destructive action** — APG's rule, so that a keyboard user cannot confirm a deletion by
|
|
63
|
-
* reflex.
|
|
63
|
+
* reflex. React's `autoFocus` is no substitute: it writes no attribute, and focuses while the dialog is closed.
|
|
64
64
|
*/
|
|
65
65
|
initialFocus?: ElementLike;
|
|
66
66
|
}
|