@box-kite/react 2.2.9 → 2.2.11
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 +1 -1
- package/.claude/skills/box-kite/SKILL.md +1 -1
- package/.cursor/rules/box-kite.mdc +1 -1
- package/AGENTS.md +1 -1
- package/BOX_AI_CONTEXT.md +9 -9
- package/BOX_KITE_AI_CONTEXT.md +9 -9
- package/catalog.cjs +1 -1
- package/catalog.mjs +24 -0
- package/components/datePicker.cjs +1 -1
- package/components/datePicker.d.ts +6 -0
- package/components/datePicker.mjs +456 -267
- package/components/semantics.d.ts +29 -29
- package/date-input.cjs +1 -1
- package/date-input.mjs +5 -4
- package/docs/props.md +2 -2
- package/package.json +31 -31
- package/spec.cjs +1 -1
- package/spec.mjs +1 -1
- package/utils/date/fieldModel.d.ts +8 -2
|
@@ -3,26 +3,26 @@ import { f as e } from "../react-shared.mjs";
|
|
|
3
3
|
import t from "../box.mjs";
|
|
4
4
|
import { a as n, t as r } from "../behavior.mjs";
|
|
5
5
|
import { t as i } from "../placement.mjs";
|
|
6
|
-
import { n as a,
|
|
7
|
-
import { A as
|
|
8
|
-
import { l as
|
|
9
|
-
import { a as
|
|
10
|
-
import { Path as
|
|
11
|
-
import { n as
|
|
12
|
-
import
|
|
13
|
-
import { t as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { useCallback as
|
|
17
|
-
import { Fragment as
|
|
6
|
+
import { n as a, s as o, t as s } from "../dates.mjs";
|
|
7
|
+
import { A as c, N as l, O as u, i as d, r as f, x as p } from "../date-math.mjs";
|
|
8
|
+
import { l as m, s as h } from "../date-input.mjs";
|
|
9
|
+
import { a as g, t as _ } from "../reporting.mjs";
|
|
10
|
+
import { Path as v, Svg as y } from "./svg.mjs";
|
|
11
|
+
import { n as b } from "../date-environment.mjs";
|
|
12
|
+
import ee from "./calendar.mjs";
|
|
13
|
+
import { t as x } from "../layer.mjs";
|
|
14
|
+
import S from "./overlay.mjs";
|
|
15
|
+
import C from "./dateField.mjs";
|
|
16
|
+
import { useCallback as w, useEffect as T, useMemo as E, useRef as D, useState as O } from "react";
|
|
17
|
+
import { Fragment as te, jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
18
18
|
//#region src/components/datePicker.tsx
|
|
19
|
-
function
|
|
20
|
-
return /* @__PURE__ */
|
|
19
|
+
function ne() {
|
|
20
|
+
return /* @__PURE__ */ k(y, {
|
|
21
21
|
viewBox: "0 0 16 16",
|
|
22
22
|
width: "1rem",
|
|
23
23
|
height: "1rem",
|
|
24
24
|
props: { fill: "none" },
|
|
25
|
-
children: /* @__PURE__ */
|
|
25
|
+
children: /* @__PURE__ */ k(v, {
|
|
26
26
|
d: "M3 3.5h10a1 1 0 0 1 1 1V13a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4.5a1 1 0 0 1 1-1ZM2 7h12M5.5 2v3M10.5 2v3",
|
|
27
27
|
stroke: "currentColor",
|
|
28
28
|
strokeWidth: 1.5,
|
|
@@ -30,13 +30,13 @@ function re() {
|
|
|
30
30
|
})
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return /* @__PURE__ */
|
|
33
|
+
function re() {
|
|
34
|
+
return /* @__PURE__ */ k(y, {
|
|
35
35
|
viewBox: "0 0 16 16",
|
|
36
36
|
width: "1rem",
|
|
37
37
|
height: "1rem",
|
|
38
38
|
props: { fill: "none" },
|
|
39
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ k(v, {
|
|
40
40
|
d: "M8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12ZM8 5v3l2 1.5",
|
|
41
41
|
stroke: "currentColor",
|
|
42
42
|
strokeWidth: 1.5,
|
|
@@ -45,13 +45,13 @@ function ie() {
|
|
|
45
45
|
})
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return /* @__PURE__ */
|
|
48
|
+
function ie() {
|
|
49
|
+
return /* @__PURE__ */ k(y, {
|
|
50
50
|
viewBox: "0 0 16 16",
|
|
51
51
|
width: "0.875rem",
|
|
52
52
|
height: "0.875rem",
|
|
53
53
|
props: { fill: "none" },
|
|
54
|
-
children: /* @__PURE__ */
|
|
54
|
+
children: /* @__PURE__ */ k(v, {
|
|
55
55
|
d: "m4.5 4.5 7 7m0-7-7 7",
|
|
56
56
|
stroke: "currentColor",
|
|
57
57
|
strokeWidth: 1.5,
|
|
@@ -59,12 +59,12 @@ function ae() {
|
|
|
59
59
|
})
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function j(e, t) {
|
|
63
63
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
let [r, a] =
|
|
67
|
-
a(e),
|
|
65
|
+
function ae(e) {
|
|
66
|
+
let [r, a] = O(null), o = e.ref, s = w((e) => {
|
|
67
|
+
a(e), j(o, e);
|
|
68
68
|
}, [o]), c = (e) => {
|
|
69
69
|
if (!e || e.contains(document.activeElement) && document.activeElement !== e) return;
|
|
70
70
|
let t = [
|
|
@@ -73,7 +73,7 @@ function oe(e) {
|
|
|
73
73
|
"button:not([disabled])"
|
|
74
74
|
].map((t) => e.querySelector(t)).find(Boolean), n = e.querySelector("[role=\"listbox\"]"), r = n?.querySelector("[role=\"option\"][tabindex=\"0\"]");
|
|
75
75
|
n && r && (n.scrollTop = r.offsetTop - n.clientHeight / 2 + r.offsetHeight / 2), (t ?? e).focus({ preventScroll: !0 });
|
|
76
|
-
}, l = n((e) => c(e)), { platform: u, isOpen: d, id: f, setPanel: p, setOpen: m, trigger: h, triggerElement: g, panelElement: _ } =
|
|
76
|
+
}, l = n((e) => c(e)), { platform: u, isOpen: d, id: f, setPanel: p, setOpen: m, trigger: h, triggerElement: g, panelElement: _ } = x({
|
|
77
77
|
haspopup: "dialog",
|
|
78
78
|
idPrefix: "date-picker",
|
|
79
79
|
open: e.open,
|
|
@@ -92,13 +92,15 @@ function oe(e) {
|
|
|
92
92
|
align: e.align,
|
|
93
93
|
offset: 1,
|
|
94
94
|
flip: !0,
|
|
95
|
+
matchWidth: e.matchWidth,
|
|
95
96
|
anchor: r
|
|
96
97
|
});
|
|
97
|
-
return
|
|
98
|
+
return T(() => {
|
|
98
99
|
d && c(_);
|
|
99
100
|
}, [d, _]), {
|
|
100
101
|
attachTrigger: h.ref,
|
|
101
102
|
triggerAttributes: h.props,
|
|
103
|
+
triggerElement: g,
|
|
102
104
|
closeOnChoice: (e) => {
|
|
103
105
|
g?.focus(), m(!1, {
|
|
104
106
|
reason: "select",
|
|
@@ -113,7 +115,7 @@ function oe(e) {
|
|
|
113
115
|
"aria-label": e.label,
|
|
114
116
|
tabIndex: -1
|
|
115
117
|
};
|
|
116
|
-
return u ? /* @__PURE__ */
|
|
118
|
+
return u ? /* @__PURE__ */ k(t, {
|
|
117
119
|
ref: p,
|
|
118
120
|
component: "popover",
|
|
119
121
|
variant: { topLayer: !0 },
|
|
@@ -125,12 +127,13 @@ function oe(e) {
|
|
|
125
127
|
...i
|
|
126
128
|
},
|
|
127
129
|
children: d ? n : null
|
|
128
|
-
}) : d && /* @__PURE__ */
|
|
130
|
+
}) : d && /* @__PURE__ */ k(S, {
|
|
129
131
|
contentRef: p,
|
|
130
132
|
anchor: r,
|
|
131
133
|
side: e.side,
|
|
132
134
|
align: e.align,
|
|
133
135
|
offset: 1,
|
|
136
|
+
matchWidth: e.matchWidth,
|
|
134
137
|
component: "popover",
|
|
135
138
|
p: 3,
|
|
136
139
|
id: f,
|
|
@@ -140,31 +143,51 @@ function oe(e) {
|
|
|
140
143
|
}
|
|
141
144
|
};
|
|
142
145
|
}
|
|
143
|
-
function
|
|
144
|
-
let { value: n, step: i, locale: a, hourCycle:
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
function oe(e) {
|
|
147
|
+
let { value: n, step: i, locale: a, hourCycle: o, onSelect: c, label: l, min: u, max: d, emptyLabel: f, separated: p } = e, g = E(() => m(i, {
|
|
148
|
+
min: u,
|
|
149
|
+
max: d
|
|
150
|
+
}), [
|
|
151
|
+
i,
|
|
152
|
+
u,
|
|
153
|
+
d
|
|
154
|
+
]), _ = h(n, i), v = Math.max(0, _ ? g.indexOf(_) : g.indexOf("09:00:00")), y = r({
|
|
155
|
+
count: g.length,
|
|
156
|
+
defaultActiveIndex: v,
|
|
147
157
|
loop: !1,
|
|
148
|
-
onSelect: (e, t) => c(
|
|
149
|
-
})
|
|
150
|
-
|
|
158
|
+
onSelect: (e, t) => c(g[e], t)
|
|
159
|
+
}), b = p ? {
|
|
160
|
+
ps: 2,
|
|
161
|
+
bs: 1
|
|
162
|
+
} : {};
|
|
163
|
+
return g.length === 0 ? /* @__PURE__ */ k(t, {
|
|
164
|
+
component: "datePicker.empty",
|
|
165
|
+
flexGrow: 1,
|
|
166
|
+
px: 3,
|
|
167
|
+
py: 1.5,
|
|
168
|
+
fontSize: 14,
|
|
169
|
+
...b,
|
|
170
|
+
props: { role: "status" },
|
|
171
|
+
children: f
|
|
172
|
+
}) : /* @__PURE__ */ k(t, {
|
|
151
173
|
component: "datePicker.times",
|
|
152
174
|
position: "relative",
|
|
153
175
|
display: "flex",
|
|
154
176
|
d: "column",
|
|
177
|
+
flexGrow: 1,
|
|
155
178
|
gap: .5,
|
|
156
179
|
maxHeight: 72,
|
|
157
180
|
overflowY: "auto",
|
|
158
|
-
|
|
159
|
-
|
|
181
|
+
p: 1,
|
|
182
|
+
...b,
|
|
160
183
|
props: {
|
|
161
184
|
role: "listbox",
|
|
162
185
|
"aria-label": l,
|
|
163
|
-
onKeyDown:
|
|
186
|
+
onKeyDown: y.onKeyDown
|
|
164
187
|
},
|
|
165
|
-
children:
|
|
188
|
+
children: g.map((e, n) => /* @__PURE__ */ k(t, {
|
|
166
189
|
component: "datePicker.time",
|
|
167
|
-
variant: { selected: e ===
|
|
190
|
+
variant: { selected: e === _ },
|
|
168
191
|
px: 3,
|
|
169
192
|
py: 1.5,
|
|
170
193
|
borderRadius: 2,
|
|
@@ -174,21 +197,21 @@ function se(e) {
|
|
|
174
197
|
css: { fontVariantNumeric: "tabular-nums" },
|
|
175
198
|
props: {
|
|
176
199
|
role: "option",
|
|
177
|
-
"aria-selected": e ===
|
|
178
|
-
...
|
|
200
|
+
"aria-selected": e === _,
|
|
201
|
+
...y.itemProps(n),
|
|
179
202
|
onClick: (t) => c(e, t)
|
|
180
203
|
},
|
|
181
|
-
children:
|
|
204
|
+
children: s(e, {
|
|
182
205
|
locale: a,
|
|
183
206
|
hour: "numeric",
|
|
184
207
|
minute: "2-digit",
|
|
185
|
-
hourCycle:
|
|
208
|
+
hourCycle: o === void 0 ? void 0 : o === 12 ? "h12" : "h23"
|
|
186
209
|
})
|
|
187
210
|
}, e))
|
|
188
211
|
});
|
|
189
212
|
}
|
|
190
|
-
function
|
|
191
|
-
return /* @__PURE__ */
|
|
213
|
+
function se(e) {
|
|
214
|
+
return /* @__PURE__ */ k(t, {
|
|
192
215
|
component: "datePicker.presets",
|
|
193
216
|
display: "flex",
|
|
194
217
|
d: "column",
|
|
@@ -196,7 +219,7 @@ function ce(e) {
|
|
|
196
219
|
pe: 2,
|
|
197
220
|
be: 1,
|
|
198
221
|
props: { role: "group" },
|
|
199
|
-
children: e.presets.map((n) => /* @__PURE__ */
|
|
222
|
+
children: e.presets.map((n) => /* @__PURE__ */ k(t, {
|
|
200
223
|
tag: "button",
|
|
201
224
|
component: "datePicker.preset",
|
|
202
225
|
variant: { selected: e.isSelected(n.value) },
|
|
@@ -214,56 +237,162 @@ function ce(e) {
|
|
|
214
237
|
}, n.label))
|
|
215
238
|
});
|
|
216
239
|
}
|
|
217
|
-
function
|
|
218
|
-
let {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
240
|
+
function ce(e) {
|
|
241
|
+
let { frame: r, 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 = D(null), S = l === void 0 ? void 0 : `${c}-label`, C = `${c}-value`, w = n(ee);
|
|
242
|
+
return T(() => {
|
|
243
|
+
let e = x.current?.form;
|
|
244
|
+
if (e) return e.addEventListener("reset", w), () => e.removeEventListener("reset", w);
|
|
245
|
+
}, [w]), /* @__PURE__ */ A(te, { children: [l !== void 0 && /* @__PURE__ */ k(t, {
|
|
246
|
+
component: "dateField.label",
|
|
247
|
+
display: "block",
|
|
248
|
+
mb: 1.5,
|
|
249
|
+
fontSize: 14,
|
|
250
|
+
id: S,
|
|
251
|
+
props: { onClick: () => s?.focus() },
|
|
252
|
+
children: l
|
|
253
|
+
}), /* @__PURE__ */ A(t, {
|
|
254
|
+
ref: i,
|
|
255
|
+
component: "dateField",
|
|
256
|
+
display: "inline-flex",
|
|
257
|
+
ai: "center",
|
|
258
|
+
position: "relative",
|
|
259
|
+
cursor: "pointer",
|
|
260
|
+
css: { fontVariantNumeric: "tabular-nums" },
|
|
261
|
+
...r,
|
|
262
|
+
variant: [r.variant, {
|
|
263
|
+
disabled: g,
|
|
264
|
+
invalid: _
|
|
265
|
+
}],
|
|
266
|
+
children: [
|
|
267
|
+
/* @__PURE__ */ k(t, {
|
|
268
|
+
tag: "button",
|
|
269
|
+
ref: a,
|
|
270
|
+
component: "datePicker.value",
|
|
271
|
+
variant: { placeholder: !f },
|
|
272
|
+
flexGrow: 1,
|
|
273
|
+
textAlign: "start",
|
|
274
|
+
whiteSpace: "nowrap",
|
|
275
|
+
css: { font: "inherit" },
|
|
276
|
+
after: {
|
|
277
|
+
position: "absolute",
|
|
278
|
+
inset: 0
|
|
279
|
+
},
|
|
280
|
+
disabled: g,
|
|
281
|
+
props: {
|
|
282
|
+
type: "button",
|
|
283
|
+
tabIndex: y,
|
|
284
|
+
"aria-labelledby": [
|
|
285
|
+
S,
|
|
286
|
+
u,
|
|
287
|
+
C
|
|
288
|
+
].filter(Boolean).join(" "),
|
|
289
|
+
"aria-describedby": d,
|
|
290
|
+
"aria-invalid": _ || void 0,
|
|
291
|
+
...o
|
|
292
|
+
},
|
|
293
|
+
children: /* @__PURE__ */ k("span", {
|
|
294
|
+
id: C,
|
|
295
|
+
children: f || p
|
|
296
|
+
})
|
|
297
|
+
}),
|
|
298
|
+
/* @__PURE__ */ A(t, {
|
|
299
|
+
display: "inline-flex",
|
|
300
|
+
ai: "center",
|
|
301
|
+
gap: 1,
|
|
302
|
+
ms: 2,
|
|
303
|
+
children: [h, /* @__PURE__ */ k(t, {
|
|
304
|
+
component: "datePicker.icon",
|
|
305
|
+
display: "inline-flex",
|
|
306
|
+
ai: "center",
|
|
307
|
+
jc: "center",
|
|
308
|
+
width: 7,
|
|
309
|
+
height: 7,
|
|
310
|
+
me: -1.5,
|
|
311
|
+
props: { "aria-hidden": !0 },
|
|
312
|
+
children: m
|
|
313
|
+
})]
|
|
314
|
+
}),
|
|
315
|
+
b.map((e, n) => v ? /* @__PURE__ */ k(t, {
|
|
316
|
+
tag: "input",
|
|
317
|
+
ref: n === 0 ? x : void 0,
|
|
318
|
+
component: "dateField.validation",
|
|
319
|
+
required: !0,
|
|
320
|
+
disabled: g,
|
|
321
|
+
props: {
|
|
322
|
+
type: "text",
|
|
323
|
+
name: e.name,
|
|
324
|
+
value: e.value,
|
|
325
|
+
tabIndex: -1,
|
|
326
|
+
"aria-hidden": !0,
|
|
327
|
+
onChange: () => {},
|
|
328
|
+
onFocus: () => s?.focus()
|
|
329
|
+
}
|
|
330
|
+
}, n) : e.name === void 0 ? null : /* @__PURE__ */ k("input", {
|
|
331
|
+
ref: n === 0 ? x : void 0,
|
|
332
|
+
type: "hidden",
|
|
333
|
+
name: e.name,
|
|
334
|
+
value: e.value,
|
|
335
|
+
disabled: g
|
|
336
|
+
}, n))
|
|
337
|
+
]
|
|
338
|
+
})] });
|
|
339
|
+
}
|
|
340
|
+
function M(e, n) {
|
|
341
|
+
let { type: r = "date", value: i, defaultValue: a = null, onValueChange: m, zone: h, locale: v, hourCycle: y, granularity: x, disambiguation: S, min: w, max: T, isDateUnavailable: E, disabled: D = !1, readOnly: O = !1, required: j, invalid: M, name: N, label: P, labelledBy: le, describedBy: ue, open: de, defaultOpen: fe, onOpenChange: pe, closeOnSelect: F = !0, firstDayOfWeek: I, weekNumbers: me, side: L = "bottom", align: R = "start", matchWidth: he = r === "time", emptyTimesLabel: z = "No times available", clearable: ge = !1, pickOnly: B = !1, triggerLabel: _e, clearLabel: ve = "Clear", tabIndex: V, step: H = 30, defaultTime: U = "00:00", presets: W, showZone: G, ...ye } = e, K = b({
|
|
342
|
+
locale: v,
|
|
343
|
+
zone: h === "none" ? void 0 : h
|
|
344
|
+
}), { locale: q } = K, J = r === "datetime" && h !== "none" ? K.zone : null, Y = J ?? K.zone, [X, Z] = g({
|
|
222
345
|
value: i,
|
|
223
346
|
defaultValue: a,
|
|
224
|
-
onChange: (e, t) =>
|
|
347
|
+
onChange: (e, t) => m?.(e, {
|
|
225
348
|
...t,
|
|
226
|
-
...
|
|
349
|
+
...p(e, Y)
|
|
227
350
|
}),
|
|
228
351
|
interaction: {
|
|
229
352
|
component: "datePicker",
|
|
230
353
|
type: "valueChange",
|
|
231
354
|
content: ["value"]
|
|
232
355
|
}
|
|
233
|
-
}),
|
|
356
|
+
}), Q = _e ?? (r === "time" ? "Choose time" : "Choose date"), be = typeof P == "string" ? P : Q, { attachTrigger: xe, triggerAttributes: Se, triggerElement: Ce, closeOnChoice: we, id: Te, attachField: Ee, panel: De } = ae({
|
|
234
357
|
ref: n,
|
|
235
|
-
open:
|
|
236
|
-
defaultOpen:
|
|
237
|
-
onOpenChange:
|
|
358
|
+
open: de,
|
|
359
|
+
defaultOpen: fe,
|
|
360
|
+
onOpenChange: pe,
|
|
238
361
|
side: L,
|
|
239
|
-
align:
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
362
|
+
align: R,
|
|
363
|
+
matchWidth: he,
|
|
364
|
+
label: be
|
|
365
|
+
}), $ = X && r !== "time" ? u(X, { zone: Y }) : null, Oe = X && r !== "date" ? c(X, { zone: Y }) : null, ke = r === "datetime" ? $ ?? l(Y) : null, Ae = (e) => e && (ke === null || u(e, { zone: Y }) === ke) ? c(e, { zone: Y }) : null, je = X ? s(X, {
|
|
366
|
+
locale: q,
|
|
367
|
+
zone: Y,
|
|
368
|
+
hourCycle: y === void 0 ? void 0 : y === 12 ? "h12" : "h23",
|
|
244
369
|
...r === "date" ? { dateStyle: "medium" } : r === "time" ? { timeStyle: "short" } : {
|
|
245
370
|
dateStyle: "medium",
|
|
246
371
|
timeStyle: "short"
|
|
247
372
|
}
|
|
248
|
-
}) : "",
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
373
|
+
}) : "", Me = B && X && J && (G ?? J !== K.readerZone) ? o(J, {
|
|
374
|
+
locale: q,
|
|
375
|
+
style: "short",
|
|
376
|
+
at: X
|
|
377
|
+
}) : null, Ne = we, Pe = (e, t) => f(e, t, J ? {
|
|
378
|
+
zone: J,
|
|
379
|
+
disambiguation: S
|
|
380
|
+
} : {}), Fe = (e, t) => {
|
|
381
|
+
e && (r === "date" ? (Z(e, {
|
|
253
382
|
reason: "select",
|
|
254
383
|
event: t
|
|
255
|
-
}), F &&
|
|
384
|
+
}), F && Ne(t)) : Z(Pe(e, Oe ?? U), {
|
|
256
385
|
reason: "select",
|
|
257
386
|
event: t
|
|
258
387
|
}));
|
|
259
|
-
},
|
|
260
|
-
|
|
388
|
+
}, Ie = (e, t) => {
|
|
389
|
+
Z(r === "time" ? e : Pe($ ?? l(Y), e), {
|
|
261
390
|
reason: "select",
|
|
262
391
|
event: t
|
|
263
|
-
}), F &&
|
|
264
|
-
},
|
|
392
|
+
}), F && Ne(t);
|
|
393
|
+
}, Le = /* @__PURE__ */ k(t, {
|
|
265
394
|
tag: "button",
|
|
266
|
-
ref:
|
|
395
|
+
ref: xe,
|
|
267
396
|
component: "datePicker.trigger",
|
|
268
397
|
display: "inline-flex",
|
|
269
398
|
ai: "center",
|
|
@@ -273,15 +402,15 @@ function k(e, n) {
|
|
|
273
402
|
ms: 2,
|
|
274
403
|
me: -1.5,
|
|
275
404
|
borderRadius: 1.5,
|
|
276
|
-
disabled:
|
|
405
|
+
disabled: D || O,
|
|
277
406
|
props: {
|
|
278
407
|
type: "button",
|
|
279
|
-
"aria-label":
|
|
408
|
+
"aria-label": je ? `${Q}, ${je}` : Q,
|
|
280
409
|
tabIndex: V,
|
|
281
|
-
...
|
|
410
|
+
...Se
|
|
282
411
|
},
|
|
283
|
-
children:
|
|
284
|
-
}),
|
|
412
|
+
children: k(r === "time" ? re : ne, {})
|
|
413
|
+
}), Re = ge && X && !D && !O && /* @__PURE__ */ k(t, {
|
|
285
414
|
tag: "button",
|
|
286
415
|
component: "datePicker.clear",
|
|
287
416
|
display: "inline-flex",
|
|
@@ -291,84 +420,116 @@ function k(e, n) {
|
|
|
291
420
|
height: 6,
|
|
292
421
|
ms: 1,
|
|
293
422
|
borderRadius: 999,
|
|
423
|
+
position: "relative",
|
|
424
|
+
zIndex: 1,
|
|
294
425
|
props: {
|
|
295
426
|
type: "button",
|
|
296
|
-
"aria-label":
|
|
427
|
+
"aria-label": ve,
|
|
297
428
|
tabIndex: V,
|
|
298
|
-
onClick: (e) =>
|
|
429
|
+
onClick: (e) => Z(null, {
|
|
299
430
|
reason: "clear",
|
|
300
431
|
event: e
|
|
301
432
|
})
|
|
302
433
|
},
|
|
303
|
-
children: /* @__PURE__ */
|
|
304
|
-
})
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
434
|
+
children: /* @__PURE__ */ k(ie, {})
|
|
435
|
+
}), ze = X !== null && (w != null && d(X, w) < 0 || T != null && d(X, T) > 0), Be = B ? /* @__PURE__ */ k(ce, {
|
|
436
|
+
frame: ye,
|
|
437
|
+
attachField: Ee,
|
|
438
|
+
attachTrigger: O ? void 0 : xe,
|
|
439
|
+
triggerAttributes: O ? void 0 : Se,
|
|
440
|
+
triggerElement: Ce,
|
|
441
|
+
id: Te,
|
|
442
|
+
label: P,
|
|
443
|
+
labelledBy: le,
|
|
444
|
+
describedBy: ue,
|
|
445
|
+
text: Me ? `${je} ${Me}` : je,
|
|
446
|
+
placeholder: Q,
|
|
447
|
+
icon: k(r === "time" ? re : ne, {}),
|
|
448
|
+
clear: Re,
|
|
449
|
+
disabled: D,
|
|
450
|
+
invalid: M ?? (ze || $ !== null && !!E?.($)),
|
|
451
|
+
required: j,
|
|
452
|
+
tabIndex: V,
|
|
453
|
+
inputs: [{
|
|
454
|
+
name: N,
|
|
455
|
+
value: X ?? ""
|
|
456
|
+
}],
|
|
457
|
+
onReset: (e) => Z(a, {
|
|
458
|
+
reason: "reset",
|
|
459
|
+
event: e
|
|
460
|
+
})
|
|
461
|
+
}) : /* @__PURE__ */ k(C, {
|
|
462
|
+
ref: Ee,
|
|
463
|
+
...ye,
|
|
308
464
|
type: r,
|
|
309
|
-
value:
|
|
310
|
-
onValueChange: (e, t) =>
|
|
465
|
+
value: X,
|
|
466
|
+
onValueChange: (e, t) => Z(e, {
|
|
311
467
|
reason: t.reason,
|
|
312
468
|
event: t.event
|
|
313
469
|
}),
|
|
314
|
-
zone:
|
|
315
|
-
locale:
|
|
316
|
-
hourCycle:
|
|
317
|
-
granularity:
|
|
318
|
-
disambiguation:
|
|
319
|
-
min:
|
|
320
|
-
max:
|
|
321
|
-
isDateUnavailable:
|
|
322
|
-
disabled:
|
|
470
|
+
zone: h,
|
|
471
|
+
locale: v,
|
|
472
|
+
hourCycle: y,
|
|
473
|
+
granularity: x,
|
|
474
|
+
disambiguation: S,
|
|
475
|
+
min: w,
|
|
476
|
+
max: T,
|
|
477
|
+
isDateUnavailable: E,
|
|
478
|
+
disabled: D,
|
|
323
479
|
readOnly: O,
|
|
324
|
-
required:
|
|
325
|
-
invalid:
|
|
326
|
-
name:
|
|
327
|
-
label:
|
|
480
|
+
required: j,
|
|
481
|
+
invalid: M,
|
|
482
|
+
name: N,
|
|
483
|
+
label: P,
|
|
328
484
|
labelledBy: le,
|
|
329
485
|
describedBy: ue,
|
|
330
|
-
showZone:
|
|
486
|
+
showZone: G,
|
|
331
487
|
tabIndex: V,
|
|
332
|
-
end: /* @__PURE__ */
|
|
333
|
-
})
|
|
488
|
+
end: /* @__PURE__ */ A(te, { children: [Re, Le] })
|
|
489
|
+
});
|
|
490
|
+
return /* @__PURE__ */ A(_, { children: [Be, De(/* @__PURE__ */ A(t, {
|
|
334
491
|
display: "flex",
|
|
335
492
|
gap: 3,
|
|
336
493
|
ai: "stretch",
|
|
337
494
|
children: [
|
|
338
|
-
W && W.length > 0 && /* @__PURE__ */
|
|
495
|
+
W && W.length > 0 && /* @__PURE__ */ k(se, {
|
|
339
496
|
presets: W,
|
|
340
|
-
isSelected: (e) =>
|
|
497
|
+
isSelected: (e) => X !== null && d(e, X, { zone: Y }) === 0,
|
|
341
498
|
onSelect: (e, t) => {
|
|
342
|
-
|
|
499
|
+
Z(e, {
|
|
343
500
|
reason: "preset",
|
|
344
501
|
event: t
|
|
345
|
-
}), F &&
|
|
502
|
+
}), F && Ne(t);
|
|
346
503
|
}
|
|
347
504
|
}),
|
|
348
|
-
r !== "time" && /* @__PURE__ */
|
|
349
|
-
value:
|
|
350
|
-
onValueChange: (e, t) =>
|
|
351
|
-
min:
|
|
352
|
-
max:
|
|
353
|
-
isDateUnavailable:
|
|
354
|
-
locale:
|
|
355
|
-
zone:
|
|
505
|
+
r !== "time" && /* @__PURE__ */ k(ee, {
|
|
506
|
+
value: $,
|
|
507
|
+
onValueChange: (e, t) => Fe(e, t.event),
|
|
508
|
+
min: w ? u(w, { zone: Y }) : void 0,
|
|
509
|
+
max: T ? u(T, { zone: Y }) : void 0,
|
|
510
|
+
isDateUnavailable: E,
|
|
511
|
+
locale: v,
|
|
512
|
+
zone: h === "none" ? void 0 : h,
|
|
356
513
|
firstDayOfWeek: I,
|
|
357
|
-
weekNumbers:
|
|
514
|
+
weekNumbers: me
|
|
358
515
|
}),
|
|
359
|
-
r !== "date" && /* @__PURE__ */
|
|
360
|
-
value:
|
|
516
|
+
r !== "date" && /* @__PURE__ */ k(oe, {
|
|
517
|
+
value: Oe,
|
|
361
518
|
step: H,
|
|
362
|
-
locale:
|
|
363
|
-
hourCycle:
|
|
364
|
-
label: r === "time" ?
|
|
365
|
-
|
|
519
|
+
locale: q,
|
|
520
|
+
hourCycle: y,
|
|
521
|
+
label: r === "time" ? be : "Time",
|
|
522
|
+
min: Ae(w),
|
|
523
|
+
max: Ae(T),
|
|
524
|
+
emptyLabel: z,
|
|
525
|
+
separated: r === "datetime",
|
|
526
|
+
onSelect: Ie
|
|
366
527
|
})
|
|
367
528
|
]
|
|
368
529
|
}))] });
|
|
369
530
|
}
|
|
370
|
-
function
|
|
371
|
-
let { value: r, defaultValue: i = null, onValueChange: o, locale: s, min: c, max: l, isDateUnavailable:
|
|
531
|
+
function N(e, n) {
|
|
532
|
+
let { value: r, defaultValue: i = null, onValueChange: o, locale: s, min: c, max: l, isDateUnavailable: u, disabled: f = !1, readOnly: p = !1, required: m, invalid: h, startName: v, endName: y, label: x, labelledBy: S, describedBy: w, startLabel: T = "Start date", endLabel: E = "End date", open: D, defaultOpen: re, onOpenChange: j, closeOnSelect: oe = !0, firstDayOfWeek: M, weekNumbers: N, months: P = 2, side: le = "bottom", align: ue = "start", matchWidth: de = !1, emptyTimesLabel: fe, clearable: pe = !1, pickOnly: F = !1, triggerLabel: I = "Choose dates", clearLabel: me = "Clear", tabIndex: L, presets: R, props: he, ...z } = e, { locale: ge } = b({ locale: s }), [B, _e] = g({
|
|
372
533
|
value: r,
|
|
373
534
|
defaultValue: i,
|
|
374
535
|
onChange: o,
|
|
@@ -377,26 +538,27 @@ function A(e, n) {
|
|
|
377
538
|
type: "valueChange",
|
|
378
539
|
content: ["value"]
|
|
379
540
|
}
|
|
380
|
-
}), [
|
|
381
|
-
start:
|
|
382
|
-
end:
|
|
383
|
-
source:
|
|
384
|
-
}), { start: H, end: U } =
|
|
385
|
-
|
|
541
|
+
}), [ve, V] = O({
|
|
542
|
+
start: B?.start ?? null,
|
|
543
|
+
end: B?.end ?? null,
|
|
544
|
+
source: B
|
|
545
|
+
}), { start: H, end: U } = ve;
|
|
546
|
+
ve.source !== B && (H = B?.start ?? null, U = B?.end ?? null, V({
|
|
386
547
|
start: H,
|
|
387
548
|
end: U,
|
|
388
|
-
source:
|
|
549
|
+
source: B
|
|
389
550
|
}));
|
|
390
|
-
let { attachTrigger: W, triggerAttributes:
|
|
551
|
+
let { attachTrigger: W, triggerAttributes: G, triggerElement: ye, closeOnChoice: K, id: q, attachField: J, panel: Y } = ae({
|
|
391
552
|
ref: n,
|
|
392
|
-
open:
|
|
393
|
-
defaultOpen:
|
|
394
|
-
onOpenChange:
|
|
553
|
+
open: D,
|
|
554
|
+
defaultOpen: re,
|
|
555
|
+
onOpenChange: j,
|
|
395
556
|
side: le,
|
|
396
557
|
align: ue,
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
558
|
+
matchWidth: de,
|
|
559
|
+
label: typeof x == "string" ? x : I
|
|
560
|
+
}), X = B ? a(B.start, B.end, { locale: ge }) : "", Z = H !== null && U !== null && d(H, U) > 0, Q = (e, t, n, r) => {
|
|
561
|
+
let i = e && t && d(e, t) <= 0 ? {
|
|
400
562
|
start: e,
|
|
401
563
|
end: t
|
|
402
564
|
} : null;
|
|
@@ -404,146 +566,173 @@ function A(e, n) {
|
|
|
404
566
|
start: e,
|
|
405
567
|
end: t,
|
|
406
568
|
source: i
|
|
407
|
-
}),
|
|
569
|
+
}), _e(i, {
|
|
408
570
|
reason: n,
|
|
409
571
|
event: r
|
|
410
572
|
});
|
|
411
|
-
},
|
|
573
|
+
}, be = K, xe = {
|
|
412
574
|
locale: s,
|
|
413
575
|
min: c,
|
|
414
576
|
max: l,
|
|
415
|
-
isDateUnavailable:
|
|
577
|
+
isDateUnavailable: u,
|
|
416
578
|
disabled: f,
|
|
417
579
|
readOnly: p,
|
|
418
580
|
required: m,
|
|
419
581
|
component: "datePicker.part",
|
|
420
582
|
px: 0,
|
|
421
583
|
py: 0,
|
|
422
|
-
tabIndex:
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
584
|
+
tabIndex: L
|
|
585
|
+
}, Se = pe && B && !f && !p && /* @__PURE__ */ k(t, {
|
|
586
|
+
tag: "button",
|
|
587
|
+
component: "datePicker.clear",
|
|
588
|
+
display: "inline-flex",
|
|
589
|
+
ai: "center",
|
|
590
|
+
jc: "center",
|
|
591
|
+
width: 6,
|
|
592
|
+
height: 6,
|
|
593
|
+
borderRadius: 999,
|
|
594
|
+
position: "relative",
|
|
595
|
+
zIndex: 1,
|
|
596
|
+
props: {
|
|
597
|
+
type: "button",
|
|
598
|
+
"aria-label": me,
|
|
599
|
+
tabIndex: L,
|
|
600
|
+
onClick: (e) => Q(null, null, "clear", e)
|
|
601
|
+
},
|
|
602
|
+
children: /* @__PURE__ */ k(ie, {})
|
|
603
|
+
}), Ce = B !== null && (c != null && d(B.start, c) < 0 || l != null && d(B.end, l) > 0), we = F ? /* @__PURE__ */ k(ce, {
|
|
604
|
+
frame: {
|
|
605
|
+
...z,
|
|
606
|
+
props: he
|
|
607
|
+
},
|
|
608
|
+
attachField: J,
|
|
609
|
+
attachTrigger: p ? void 0 : W,
|
|
610
|
+
triggerAttributes: p ? void 0 : G,
|
|
611
|
+
triggerElement: ye,
|
|
612
|
+
id: q,
|
|
613
|
+
label: x,
|
|
614
|
+
labelledBy: S,
|
|
615
|
+
describedBy: w,
|
|
616
|
+
text: X,
|
|
617
|
+
placeholder: I,
|
|
618
|
+
icon: /* @__PURE__ */ k(ne, {}),
|
|
619
|
+
clear: Se,
|
|
620
|
+
disabled: f,
|
|
621
|
+
invalid: h ?? Ce,
|
|
622
|
+
required: m,
|
|
623
|
+
tabIndex: L,
|
|
624
|
+
inputs: [{
|
|
625
|
+
name: v,
|
|
626
|
+
value: B?.start ?? ""
|
|
627
|
+
}, {
|
|
628
|
+
name: y,
|
|
629
|
+
value: B?.end ?? ""
|
|
630
|
+
}],
|
|
631
|
+
onReset: (e) => Q(i?.start ?? null, i?.end ?? null, "reset", e)
|
|
632
|
+
}) : /* @__PURE__ */ A(te, { children: [x !== void 0 && /* @__PURE__ */ k(t, {
|
|
633
|
+
component: "dateField.label",
|
|
634
|
+
display: "block",
|
|
635
|
+
mb: 1.5,
|
|
636
|
+
fontSize: 14,
|
|
637
|
+
id: `${q}-label`,
|
|
638
|
+
children: x
|
|
639
|
+
}), /* @__PURE__ */ A(t, {
|
|
640
|
+
ref: J,
|
|
641
|
+
component: "dateField",
|
|
642
|
+
display: "inline-flex",
|
|
643
|
+
ai: "center",
|
|
644
|
+
gap: 2,
|
|
645
|
+
px: 3,
|
|
646
|
+
py: 2,
|
|
647
|
+
...z,
|
|
648
|
+
variant: [z.variant, {
|
|
649
|
+
disabled: f,
|
|
650
|
+
invalid: h ?? Z
|
|
651
|
+
}],
|
|
652
|
+
props: {
|
|
653
|
+
role: "group",
|
|
654
|
+
"aria-labelledby": [x === void 0 ? void 0 : `${q}-label`, S].filter(Boolean).join(" ") || void 0,
|
|
655
|
+
"aria-invalid": (h ?? Z) || void 0,
|
|
656
|
+
"aria-describedby": w,
|
|
657
|
+
...he
|
|
658
|
+
},
|
|
659
|
+
children: [
|
|
660
|
+
/* @__PURE__ */ k(C, {
|
|
661
|
+
...xe,
|
|
662
|
+
value: H,
|
|
663
|
+
onValueChange: (e, t) => Q(e, U, t.reason, t.event),
|
|
664
|
+
name: v,
|
|
665
|
+
props: { "aria-label": T },
|
|
666
|
+
invalid: h ?? Z
|
|
667
|
+
}),
|
|
668
|
+
/* @__PURE__ */ k(t, {
|
|
669
|
+
component: "dateField.literal",
|
|
670
|
+
props: { "aria-hidden": !0 },
|
|
671
|
+
children: "–"
|
|
672
|
+
}),
|
|
673
|
+
/* @__PURE__ */ k(C, {
|
|
674
|
+
...xe,
|
|
675
|
+
value: U,
|
|
676
|
+
onValueChange: (e, t) => Q(H, e, t.reason, t.event),
|
|
677
|
+
name: y,
|
|
678
|
+
props: { "aria-label": E },
|
|
679
|
+
invalid: h ?? Z
|
|
680
|
+
}),
|
|
681
|
+
/* @__PURE__ */ A(t, {
|
|
682
|
+
display: "inline-flex",
|
|
683
|
+
ai: "center",
|
|
684
|
+
gap: 2,
|
|
685
|
+
ms: "auto",
|
|
686
|
+
children: [Se, /* @__PURE__ */ k(t, {
|
|
687
|
+
tag: "button",
|
|
688
|
+
ref: W,
|
|
689
|
+
component: "datePicker.trigger",
|
|
476
690
|
display: "inline-flex",
|
|
477
691
|
ai: "center",
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
gap: 3,
|
|
522
|
-
ai: "stretch",
|
|
523
|
-
children: [I && I.length > 0 && /* @__PURE__ */ E(ce, {
|
|
524
|
-
presets: I,
|
|
525
|
-
isSelected: (e) => R !== null && e.start === R.start && e.end === R.end,
|
|
526
|
-
onSelect: (e, t) => {
|
|
527
|
-
X(e.start, e.end, "preset", t), k && Z(t);
|
|
528
|
-
}
|
|
529
|
-
}), /* @__PURE__ */ E(te, {
|
|
530
|
-
mode: "range",
|
|
531
|
-
months: M,
|
|
532
|
-
value: R,
|
|
533
|
-
defaultFocusedDate: H ?? void 0,
|
|
534
|
-
onValueChange: (e, t) => {
|
|
535
|
-
X(e?.start ?? null, e?.end ?? null, "select", t.event), k && e && t.event && Z(t.event);
|
|
536
|
-
},
|
|
537
|
-
min: c,
|
|
538
|
-
max: l,
|
|
539
|
-
isDateUnavailable: d,
|
|
540
|
-
locale: s,
|
|
541
|
-
firstDayOfWeek: A,
|
|
542
|
-
weekNumbers: j
|
|
543
|
-
})]
|
|
544
|
-
}))
|
|
545
|
-
] });
|
|
692
|
+
jc: "center",
|
|
693
|
+
width: 7,
|
|
694
|
+
height: 7,
|
|
695
|
+
me: -1.5,
|
|
696
|
+
borderRadius: 1.5,
|
|
697
|
+
disabled: f || p,
|
|
698
|
+
props: {
|
|
699
|
+
type: "button",
|
|
700
|
+
"aria-label": X ? `${I}, ${X}` : I,
|
|
701
|
+
tabIndex: L,
|
|
702
|
+
...G
|
|
703
|
+
},
|
|
704
|
+
children: /* @__PURE__ */ k(ne, {})
|
|
705
|
+
})]
|
|
706
|
+
})
|
|
707
|
+
]
|
|
708
|
+
})] });
|
|
709
|
+
return /* @__PURE__ */ A(_, { children: [we, Y(/* @__PURE__ */ A(t, {
|
|
710
|
+
display: "flex",
|
|
711
|
+
gap: 3,
|
|
712
|
+
ai: "stretch",
|
|
713
|
+
children: [R && R.length > 0 && /* @__PURE__ */ k(se, {
|
|
714
|
+
presets: R,
|
|
715
|
+
isSelected: (e) => B !== null && e.start === B.start && e.end === B.end,
|
|
716
|
+
onSelect: (e, t) => {
|
|
717
|
+
Q(e.start, e.end, "preset", t), oe && be(t);
|
|
718
|
+
}
|
|
719
|
+
}), /* @__PURE__ */ k(ee, {
|
|
720
|
+
mode: "range",
|
|
721
|
+
months: P,
|
|
722
|
+
value: B,
|
|
723
|
+
defaultFocusedDate: H ?? void 0,
|
|
724
|
+
onValueChange: (e, t) => {
|
|
725
|
+
Q(e?.start ?? null, e?.end ?? null, "select", t.event), oe && e && t.event && be(t.event);
|
|
726
|
+
},
|
|
727
|
+
min: c,
|
|
728
|
+
max: l,
|
|
729
|
+
isDateUnavailable: u,
|
|
730
|
+
locale: s,
|
|
731
|
+
firstDayOfWeek: M,
|
|
732
|
+
weekNumbers: N
|
|
733
|
+
})]
|
|
734
|
+
}))] });
|
|
546
735
|
}
|
|
547
|
-
var
|
|
736
|
+
var P = e(M, "DatePicker"), le = e(N, "DateRangePicker");
|
|
548
737
|
//#endregion
|
|
549
|
-
export {
|
|
738
|
+
export { le as DateRangePicker, P as default };
|