lizaui 5.0.3 → 5.0.4

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.
@@ -0,0 +1,767 @@
1
+ import { j as i } from "../chunks/jsx-runtime-Cl_4eDuT.js";
2
+ import { memo as Re, useLayoutEffect as rn, useEffect as pe, useState as te, useRef as Z, useCallback as xe, useMemo as on, createElement as De } from "react";
3
+ import { createPortal as an } from "react-dom";
4
+ import { c as be } from "../chunks/clsx-OuTLNxxd.js";
5
+ import { g as Oe, a as H, b as re, c as de, d as Pe, u as ye, e as sn, f as Be, h as Ue, m as cn, F as un, i as ln } from "../chunks/styled-components.browser.esm-CAEXERbT.js";
6
+ function Se(e) {
7
+ var n = e.angle, r = n === void 0 ? 0 : n, a = e.name, o = e.length, c = o === void 0 ? 100 : o, s = e.oppositeLength, u = s === void 0 ? 10 : s, l = e.width, p = l === void 0 ? 1 : l;
8
+ return i.jsx("div", { className: "react-clock__hand react-clock__".concat(a, "-hand"), style: {
9
+ transform: "rotate(".concat(r, "deg)")
10
+ }, children: i.jsx("div", { className: "react-clock__hand__body react-clock__".concat(a, "-hand__body"), style: {
11
+ width: "".concat(p, "px"),
12
+ top: "".concat(50 - c / 2, "%"),
13
+ bottom: "".concat(50 - u / 2, "%")
14
+ } }) });
15
+ }
16
+ var ze = Re(function(n) {
17
+ var r = n.angle, a = r === void 0 ? 0 : r, o = n.length, c = o === void 0 ? 10 : o, s = n.name, u = n.width, l = u === void 0 ? 1 : u;
18
+ return i.jsx("div", { className: "react-clock__mark react-clock__".concat(s, "-mark"), style: {
19
+ transform: "rotate(".concat(a, "deg)")
20
+ }, children: i.jsx("div", { className: "react-clock__mark__body react-clock__".concat(s, "-mark__body"), style: {
21
+ width: "".concat(l, "px"),
22
+ top: 0,
23
+ bottom: "".concat(100 - c / 2, "%")
24
+ } }) });
25
+ }), dn = Re(function(n) {
26
+ var r = n.angle, a = r === void 0 ? 0 : r, o = n.length, c = o === void 0 ? 10 : o, s = n.name, u = n.number;
27
+ return i.jsx("div", { className: "react-clock__mark react-clock__".concat(s, "-mark"), style: {
28
+ transform: "rotate(".concat(a, "deg)")
29
+ }, children: i.jsx("div", { className: "react-clock__mark__number", style: {
30
+ transform: "rotate(-".concat(a, "deg)"),
31
+ top: "".concat(c / 2, "%")
32
+ }, children: u }) });
33
+ });
34
+ function mn(e, n) {
35
+ return n.toLocaleString(e || Oe() || void 0);
36
+ }
37
+ function pn(e) {
38
+ return e !== null && e !== !1 && !Number.isNaN(Number(e));
39
+ }
40
+ function fn() {
41
+ for (var e = [], n = 0; n < arguments.length; n++)
42
+ e[n] = arguments[n];
43
+ return Math.max.apply(Math, e.filter(pn));
44
+ }
45
+ function hn(e) {
46
+ var n = e.className, r = e.formatHour, a = r === void 0 ? mn : r, o = e.hourHandLength, c = o === void 0 ? 50 : o, s = e.hourHandOppositeLength, u = e.hourHandWidth, l = u === void 0 ? 4 : u, p = e.hourMarksLength, v = p === void 0 ? 10 : p, g = e.hourMarksWidth, x = g === void 0 ? 3 : g, N = e.locale, E = e.minuteHandLength, A = E === void 0 ? 70 : E, k = e.minuteHandOppositeLength, I = e.minuteHandWidth, K = I === void 0 ? 2 : I, O = e.minuteMarksLength, oe = O === void 0 ? 6 : O, U = e.minuteMarksWidth, J = U === void 0 ? 1 : U, G = e.renderHourMarks, S = G === void 0 ? !0 : G, F = e.renderMinuteHand, q = F === void 0 ? !0 : F, W = e.renderMinuteMarks, Q = W === void 0 ? !0 : W, T = e.renderNumbers, ie = e.renderSecondHand, X = ie === void 0 ? !0 : ie, D = e.secondHandLength, ae = D === void 0 ? 90 : D, se = e.secondHandOppositeLength, z = e.secondHandWidth, Y = z === void 0 ? 1 : z, R = e.size, w = R === void 0 ? 150 : R, M = e.useMillisecondPrecision, h = e.value;
47
+ function ce() {
48
+ if (!Q)
49
+ return null;
50
+ for (var _ = [], b = 1; b <= 60; b += 1) {
51
+ var ne = S && !(b % 5);
52
+ ne || _.push(i.jsx(ze, { angle: b * 6, length: oe, name: "minute", width: J }, "minute_".concat(b)));
53
+ }
54
+ return _;
55
+ }
56
+ function ue() {
57
+ if (!S)
58
+ return null;
59
+ for (var _ = [], b = 1; b <= 12; b += 1)
60
+ _.push(i.jsx(ze, { angle: b * 30, length: v, name: "hour", width: x }, "hour_".concat(b)));
61
+ return _;
62
+ }
63
+ function P() {
64
+ if (!T)
65
+ return null;
66
+ for (var _ = [], b = 1; b <= 12; b += 1)
67
+ _.push(i.jsx(dn, { angle: b * 30, length: fn(S && v, Q && oe, 0), name: "number", number: a(N, b) }, "number_".concat(b)));
68
+ return _;
69
+ }
70
+ function fe() {
71
+ return i.jsxs("div", { className: "react-clock__face", children: [ce(), ue(), P()] });
72
+ }
73
+ function le() {
74
+ var _ = h ? H(h) * 30 + re(h) / 2 + de(h) / 120 + (M ? Pe(h) / 12e4 : 0) : 0;
75
+ return i.jsx(Se, { angle: _, length: c, name: "hour", oppositeLength: s, width: l });
76
+ }
77
+ function he() {
78
+ if (!q)
79
+ return null;
80
+ var _ = h ? H(h) * 360 + re(h) * 6 + de(h) / 10 + (M ? Pe(h) / 1e4 : 0) : 0;
81
+ return i.jsx(Se, { angle: _, length: A, name: "minute", oppositeLength: k, width: K });
82
+ }
83
+ function ee() {
84
+ if (!X)
85
+ return null;
86
+ var _ = h ? re(h) * 360 + de(h) * 6 + (M ? Pe(h) * 6e-3 : 0) : 0;
87
+ return i.jsx(Se, { angle: _, length: ae, name: "second", oppositeLength: se, width: Y });
88
+ }
89
+ return i.jsxs("time", { className: be("react-clock", n), dateTime: h instanceof Date ? (
90
+ // Returns a string in the format "HH:MM" or "HH:MM:SS"
91
+ h.toLocaleTimeString("en", {
92
+ hourCycle: "h23",
93
+ hour: "2-digit",
94
+ minute: q ? "2-digit" : void 0,
95
+ second: X ? "2-digit" : void 0
96
+ })
97
+ ) : h || void 0, style: {
98
+ width: w,
99
+ height: w
100
+ }, children: [fe(), le(), he(), ee()] });
101
+ }
102
+ function gn({ children: e }) {
103
+ return i.jsx("span", { className: "react-time-picker__inputGroup__divider", children: e });
104
+ }
105
+ function Ve(e, n) {
106
+ let r = Number(e);
107
+ return n === "am" && r === 12 ? r = 0 : n === "pm" && r < 12 && (r += 12), r;
108
+ }
109
+ function me(e) {
110
+ return [Number(e) % 12 || 12, Number(e) < 12 ? "am" : "pm"];
111
+ }
112
+ const Me = /* @__PURE__ */ new Map();
113
+ function Je(e) {
114
+ return function(r, a) {
115
+ const o = r || Oe();
116
+ Me.has(o) || Me.set(o, /* @__PURE__ */ new Map());
117
+ const c = Me.get(o);
118
+ return c.has(e) || c.set(e, new Intl.DateTimeFormat(o || void 0, e).format), c.get(e)(a);
119
+ };
120
+ }
121
+ const $e = /* @__PURE__ */ new Map();
122
+ function bn(e) {
123
+ return (n, r) => {
124
+ const a = n || Oe();
125
+ $e.has(a) || $e.set(a, /* @__PURE__ */ new Map());
126
+ const o = $e.get(a);
127
+ return o.has(e) || o.set(e, new Intl.NumberFormat(a || void 0, e).format), o.get(e)(r);
128
+ };
129
+ }
130
+ const kn = ["9", "٩"], Ze = new RegExp(`[${kn.join("")}]`), Ke = Je({ hour: "numeric" });
131
+ function Qe(e) {
132
+ const n = Ke(e, new Date(2017, 0, 1, 9)), r = Ke(e, new Date(2017, 0, 1, 21)), [a, o] = n.split(Ze), [c, s] = r.split(Ze);
133
+ if (s !== void 0) {
134
+ if (a !== c)
135
+ return [a, c].map((u) => u.trim());
136
+ if (o !== s)
137
+ return [o, s].map((u) => u.trim());
138
+ }
139
+ return ["AM", "PM"];
140
+ }
141
+ function Te(e) {
142
+ return e !== null && e !== !1 && !Number.isNaN(Number(e));
143
+ }
144
+ function Le(...e) {
145
+ return Math.min(...e.filter(Te));
146
+ }
147
+ function je(...e) {
148
+ return Math.max(...e.filter(Te));
149
+ }
150
+ function vn({ ariaLabel: e, autoFocus: n, className: r, disabled: a, inputRef: o, locale: c, maxTime: s, minTime: u, onChange: l, onKeyDown: p, required: v, value: g }) {
151
+ const x = u ? me(H(u))[1] === "pm" : !1, N = s ? me(H(s))[1] === "am" : !1, E = "amPm", [A, k] = Qe(c);
152
+ return i.jsxs("select", {
153
+ "aria-label": e,
154
+ // biome-ignore lint/a11y/noAutofocus: This is up to developers' decision
155
+ autoFocus: n,
156
+ className: be(`${r}__input`, `${r}__${E}`),
157
+ "data-input": "true",
158
+ "data-select": "true",
159
+ disabled: a,
160
+ name: E,
161
+ onChange: l,
162
+ onKeyDown: p,
163
+ // Assertion is needed for React 18 compatibility
164
+ ref: o,
165
+ required: v,
166
+ value: g !== null ? g : "",
167
+ children: [!g && i.jsx("option", { value: "", children: "--" }), i.jsx("option", { disabled: x, value: "am", children: A }), i.jsx("option", { disabled: N, value: "pm", children: k })]
168
+ });
169
+ }
170
+ const We = typeof window < "u", _n = We ? rn : pe, xn = We && /(MSIE|Trident\/|Edge\/)/.test(navigator.userAgent), wn = We && /Firefox/.test(navigator.userAgent);
171
+ function yn(e) {
172
+ const { target: n } = e;
173
+ xn ? requestAnimationFrame(() => n.select()) : n.select();
174
+ }
175
+ function Ln(e) {
176
+ if (document.readyState === "complete")
177
+ return;
178
+ function n() {
179
+ ye(e);
180
+ }
181
+ window.addEventListener("load", n);
182
+ }
183
+ function jn(e) {
184
+ if (!document.fonts)
185
+ return;
186
+ const n = sn(e);
187
+ if (!n || document.fonts.check(n))
188
+ return;
189
+ function a() {
190
+ ye(e);
191
+ }
192
+ document.fonts.addEventListener("loadingdone", a);
193
+ }
194
+ function Nn(e) {
195
+ if (e && "selectionStart" in e && e.selectionStart !== null && "selectionEnd" in e && e.selectionEnd !== null)
196
+ return e.value.slice(e.selectionStart, e.selectionEnd);
197
+ if ("getSelection" in window) {
198
+ const n = window.getSelection();
199
+ return n?.toString();
200
+ }
201
+ return null;
202
+ }
203
+ function Hn(e) {
204
+ if (e !== null)
205
+ return function(r) {
206
+ if (wn)
207
+ return;
208
+ const { key: a, target: o } = r, { value: c } = o, s = a.length === 1 && /\d/.test(a), u = Nn(o);
209
+ (!s || !(u || c.length < e)) && r.preventDefault();
210
+ };
211
+ }
212
+ function Ne({ ariaLabel: e, autoFocus: n, className: r, disabled: a, inputRef: o, max: c, min: s, name: u, nameForClass: l, onChange: p, onKeyDown: v, onKeyUp: g, placeholder: x = "--", required: N, showLeadingZeros: E, step: A, value: k }) {
213
+ _n(() => {
214
+ !o || !o.current || (ye(o.current), Ln(o.current), jn(o.current));
215
+ }, [o, k]);
216
+ const I = E && k && Number(k) < 10 && (k === "0" || !k.toString().startsWith("0")), K = c ? c.toString().length : null;
217
+ return i.jsxs(i.Fragment, { children: [I ? i.jsx("span", { className: `${r}__leadingZero`, children: "0" }) : null, i.jsx("input", {
218
+ "aria-label": e,
219
+ autoComplete: "off",
220
+ // biome-ignore lint/a11y/noAutofocus: This is up to developers' decision
221
+ autoFocus: n,
222
+ className: be(`${r}__input`, `${r}__${l || u}`, I && `${r}__input--hasLeadingZero`),
223
+ "data-input": "true",
224
+ disabled: a,
225
+ inputMode: "numeric",
226
+ max: c,
227
+ min: s,
228
+ name: u,
229
+ onChange: p,
230
+ onFocus: yn,
231
+ onKeyDown: v,
232
+ onKeyPress: Hn(K),
233
+ onKeyUp: (O) => {
234
+ ye(O.target), g && g(O);
235
+ },
236
+ placeholder: x,
237
+ // Assertion is needed for React 18 compatibility
238
+ ref: o,
239
+ required: N,
240
+ step: A,
241
+ type: "number",
242
+ value: k !== null ? k : ""
243
+ })] });
244
+ }
245
+ function Cn({ amPm: e, maxTime: n, minTime: r, value: a, ...o }) {
246
+ const c = Le(12, n && (() => {
247
+ const [l, p] = me(H(n));
248
+ return p !== e ? null : l;
249
+ })()), s = je(1, r && (() => {
250
+ const [l, p] = me(H(r));
251
+ return (
252
+ // pm is always after am, so we should ignore validation
253
+ p !== e || // If minHour is 12 am/pm, user should be able to enter 12, 1, ..., 11.
254
+ l === 12 ? null : l
255
+ );
256
+ })()), u = a ? me(a)[0].toString() : "";
257
+ return i.jsx(Ne, { max: c, min: s, name: "hour12", nameForClass: "hour", value: u, ...o });
258
+ }
259
+ function En({ maxTime: e, minTime: n, ...r }) {
260
+ const a = Le(23, e && H(e)), o = je(0, n && H(n));
261
+ return i.jsx(Ne, { max: a, min: o, name: "hour24", nameForClass: "hour", ...r });
262
+ }
263
+ function In({ hour: e, maxTime: n, minTime: r, showLeadingZeros: a = !0, ...o }) {
264
+ function c(l) {
265
+ return e === H(l).toString();
266
+ }
267
+ const s = Le(59, n && c(n) && re(n)), u = je(0, r && c(r) && re(r));
268
+ return i.jsx(Ne, { max: s, min: u, name: "minute", showLeadingZeros: a, ...o });
269
+ }
270
+ function Fn({ ariaLabel: e, disabled: n, maxTime: r, minTime: a, name: o, onChange: c, required: s, value: u, valueType: l }) {
271
+ const p = (() => {
272
+ switch (l) {
273
+ case "hour":
274
+ return (x) => `${H(x)}:00`;
275
+ case "minute":
276
+ return Ue;
277
+ case "second":
278
+ return Be;
279
+ default:
280
+ throw new Error("Invalid valueType");
281
+ }
282
+ })(), v = (() => {
283
+ switch (l) {
284
+ case "hour":
285
+ return 3600;
286
+ case "minute":
287
+ return 60;
288
+ case "second":
289
+ return 1;
290
+ default:
291
+ throw new Error("Invalid valueType");
292
+ }
293
+ })();
294
+ function g(x) {
295
+ x.stopPropagation();
296
+ }
297
+ return i.jsx("input", { "aria-label": e, disabled: n, hidden: !0, max: r ? p(r) : void 0, min: a ? p(a) : void 0, name: o, onChange: c, onFocus: g, required: s, step: v, style: {
298
+ visibility: "hidden",
299
+ position: "absolute",
300
+ zIndex: "-999"
301
+ }, type: "time", value: u ? p(u) : "" });
302
+ }
303
+ function Pn({ hour: e, maxTime: n, minTime: r, minute: a, showLeadingZeros: o = !0, ...c }) {
304
+ function s(p) {
305
+ return e === H(p).toString() && a === re(p).toString();
306
+ }
307
+ const u = Le(59, n && s(n) && de(n)), l = je(0, r && s(r) && de(r));
308
+ return i.jsx(Ne, { max: u, min: l, name: "second", showLeadingZeros: o, ...c });
309
+ }
310
+ const Ge = {}, Sn = ["hour", "minute", "second"];
311
+ function Mn(e) {
312
+ return e.dataset.input === "true";
313
+ }
314
+ function qe(e, n) {
315
+ let r = e;
316
+ do
317
+ r = r[n];
318
+ while (r && !Mn(r));
319
+ return r;
320
+ }
321
+ function Ae(e) {
322
+ e && e.focus();
323
+ }
324
+ function $n(e, n, r) {
325
+ const a = [], o = new RegExp(Object.keys(n).map((s) => `${s}+`).join("|"), "g"), c = e.match(o);
326
+ return e.split(o).reduce((s, u, l) => {
327
+ const p = u && // biome-ignore lint/suspicious/noArrayIndexKey: index is stable here
328
+ i.jsx(gn, { children: u }, `separator_${l}`);
329
+ s.push(p);
330
+ const v = c?.[l];
331
+ if (v) {
332
+ const g = n[v] || n[Object.keys(n).find((x) => v.match(x))];
333
+ if (!g)
334
+ return s;
335
+ !r && a.includes(g) ? s.push(v) : (s.push(g(v, l)), a.push(g));
336
+ }
337
+ return s;
338
+ }, []);
339
+ }
340
+ const we = bn({ useGrouping: !1 });
341
+ function An({ amPmAriaLabel: e, autoFocus: n, className: r, disabled: a, format: o, hourAriaLabel: c, hourPlaceholder: s, isClockOpen: u = null, locale: l, maxDetail: p = "minute", maxTime: v, minTime: g, minuteAriaLabel: x, minutePlaceholder: N, name: E = "time", nativeInputAriaLabel: A, onChange: k, onInvalidChange: I, required: K, secondAriaLabel: O, secondPlaceholder: oe, value: U }) {
342
+ const [J, G] = te(null), [S, F] = te(null), [q, W] = te(null), [Q, T] = te(null), [ie, X] = te(null), D = Z(null), ae = Z(null), se = Z(null), z = Z(null), Y = Z(null), [R, w] = te(u), M = Z(void 0);
343
+ pe(() => {
344
+ w(u);
345
+ }, [u]), pe(() => {
346
+ const t = U;
347
+ t ? (G(me(H(t))[1]), F(H(t).toString()), W(re(t).toString()), T(de(t).toString()), X(t)) : (G(null), F(null), W(null), T(null), X(null));
348
+ }, [
349
+ U,
350
+ g,
351
+ v,
352
+ p,
353
+ // Toggling clock visibility resets values
354
+ R
355
+ ]);
356
+ const h = p, ce = (() => {
357
+ const t = Sn.indexOf(p), d = Ge[t] || (() => {
358
+ const m = { hour: "numeric" };
359
+ return t >= 1 && (m.minute = "numeric"), t >= 2 && (m.second = "numeric"), Ge[t] = m, m;
360
+ })();
361
+ return Je(d);
362
+ })();
363
+ function ue(t) {
364
+ return (() => {
365
+ switch (h) {
366
+ case "hour":
367
+ case "minute":
368
+ return Ue;
369
+ case "second":
370
+ return Be;
371
+ default:
372
+ throw new Error("Invalid valueType");
373
+ }
374
+ })()(t);
375
+ }
376
+ const P = o || (() => {
377
+ const Ee = new Date(2017, 0, 1, 21, 13, 14);
378
+ return ce(l, Ee).replace(we(l, 9), "h").replace(we(l, 21), "H").replace(we(l, 13), "mm").replace(we(l, 14), "ss").replace(new RegExp(Qe(l).join("|")), "a");
379
+ })(), fe = (() => {
380
+ const t = P.match(/[^0-9a-z]/i);
381
+ return t ? t[0] : null;
382
+ })();
383
+ function le(t) {
384
+ if (t.target === t.currentTarget) {
385
+ const d = t.target.children[1];
386
+ Ae(d);
387
+ }
388
+ }
389
+ function he(t) {
390
+ switch (M.current = t.key, t.key) {
391
+ case "ArrowLeft":
392
+ case "ArrowRight":
393
+ case fe: {
394
+ t.preventDefault();
395
+ const { target: d } = t, m = t.key === "ArrowLeft" ? "previousElementSibling" : "nextElementSibling", C = qe(d, m);
396
+ Ae(C);
397
+ break;
398
+ }
399
+ }
400
+ }
401
+ function ee(t) {
402
+ const { key: d, target: m } = t;
403
+ if (!(M.current === d) || !!Number.isNaN(Number(d)))
404
+ return;
405
+ const ge = m.getAttribute("max");
406
+ if (!ge)
407
+ return;
408
+ const { value: _e } = m;
409
+ if (Number(_e) * 10 > Number(ge) || _e.length >= ge.length) {
410
+ const Ie = qe(m, "nextElementSibling");
411
+ Ae(Ie);
412
+ }
413
+ }
414
+ function _() {
415
+ if (!k)
416
+ return;
417
+ function t(y) {
418
+ return !!y;
419
+ }
420
+ const d = [
421
+ D.current,
422
+ ae.current,
423
+ se.current,
424
+ z.current,
425
+ Y.current
426
+ ].filter(t), m = d.slice(1), C = {};
427
+ for (const y of d)
428
+ C[y.name] = y.type === "number" ? y.valueAsNumber : y.value;
429
+ if (m.every((y) => !y.value)) {
430
+ k(null, !1);
431
+ return;
432
+ }
433
+ const ge = d.every((y) => y.value), _e = d.every((y) => y.validity.valid);
434
+ if (ge && _e) {
435
+ const y = Number(C.hour24 || C.hour12 && C.amPm && Ve(C.hour12, C.amPm) || 0), Ie = Number(C.minute || 0), Ye = Number(C.second || 0), Fe = (tn) => `0${tn}`.slice(-2), en = `${Fe(y)}:${Fe(Ie)}:${Fe(Ye)}`, nn = ue(en);
436
+ k(nn, !1);
437
+ return;
438
+ }
439
+ I && I();
440
+ }
441
+ function b(t) {
442
+ const { name: d, value: m } = t.target;
443
+ switch (d) {
444
+ case "amPm":
445
+ G(m);
446
+ break;
447
+ case "hour12":
448
+ F(m ? Ve(m, J || "am").toString() : "");
449
+ break;
450
+ case "hour24":
451
+ F(m);
452
+ break;
453
+ case "minute":
454
+ W(m);
455
+ break;
456
+ case "second":
457
+ T(m);
458
+ break;
459
+ }
460
+ _();
461
+ }
462
+ function ne(t) {
463
+ const { value: d } = t.target;
464
+ if (!k)
465
+ return;
466
+ k(d || null, !1);
467
+ }
468
+ const V = {
469
+ className: r,
470
+ disabled: a,
471
+ maxTime: v,
472
+ minTime: g,
473
+ onChange: b,
474
+ onKeyDown: he,
475
+ onKeyUp: ee,
476
+ // This is only for showing validity when editing
477
+ required: !!(K || R)
478
+ };
479
+ function He(t, d) {
480
+ if (t && t.length > 2)
481
+ throw new Error(`Unsupported token: ${t}`);
482
+ const m = t ? t.length === 2 : !1;
483
+ return i.jsx(Cn, { ...V, amPm: J, ariaLabel: c, autoFocus: d === 0 && n, inputRef: ae, placeholder: s, showLeadingZeros: m, value: S }, "hour12");
484
+ }
485
+ function Ce(t, d) {
486
+ if (t && t.length > 2)
487
+ throw new Error(`Unsupported token: ${t}`);
488
+ const m = t ? t.length === 2 : !1;
489
+ return i.jsx(En, { ...V, ariaLabel: c, autoFocus: d === 0 && n, inputRef: se, placeholder: s, showLeadingZeros: m, value: S }, "hour24");
490
+ }
491
+ function ke(t, d) {
492
+ return /h/.test(t) ? He(t, d) : Ce(t, d);
493
+ }
494
+ function f(t, d) {
495
+ if (t && t.length > 2)
496
+ throw new Error(`Unsupported token: ${t}`);
497
+ const m = t ? t.length === 2 : !1;
498
+ return i.jsx(In, { ...V, ariaLabel: x, autoFocus: d === 0 && n, hour: S, inputRef: z, placeholder: N, showLeadingZeros: m, value: q }, "minute");
499
+ }
500
+ function L(t, d) {
501
+ if (t && t.length > 2)
502
+ throw new Error(`Unsupported token: ${t}`);
503
+ const m = t ? t.length === 2 : !0;
504
+ return i.jsx(Pn, { ...V, ariaLabel: O, autoFocus: d === 0 && n, hour: S, inputRef: Y, minute: q, placeholder: oe, showLeadingZeros: m, value: Q }, "second");
505
+ }
506
+ function $(t, d) {
507
+ return i.jsx(vn, { ...V, ariaLabel: e, autoFocus: d === 0 && n, inputRef: D, locale: l, onChange: b, value: J }, "ampm");
508
+ }
509
+ function B() {
510
+ return $n(P, {
511
+ h: ke,
512
+ H: ke,
513
+ m: f,
514
+ s: L,
515
+ a: $
516
+ }, typeof o < "u");
517
+ }
518
+ function ve() {
519
+ return i.jsx(Fn, { ariaLabel: A, disabled: a, maxTime: v, minTime: g, name: E, onChange: ne, required: K, value: ie, valueType: h }, "time");
520
+ }
521
+ return (
522
+ // biome-ignore lint/a11y/useKeyWithClickEvents: This interaction is designed for mouse users only
523
+ // biome-ignore lint/a11y/noStaticElementInteractions: This interaction is designed for mouse users only
524
+ i.jsxs("div", { className: r, onClick: le, children: [ve(), B()] })
525
+ );
526
+ }
527
+ const j = "react-time-picker", On = ["mousedown", "focusin", "touchstart"], Xe = {
528
+ xmlns: "http://www.w3.org/2000/svg",
529
+ width: 19,
530
+ height: 19,
531
+ viewBox: "0 0 19 19",
532
+ stroke: "black",
533
+ strokeWidth: 2
534
+ }, Wn = i.jsxs("svg", { ...Xe, "aria-hidden": "true", className: `${j}__clock-button__icon ${j}__button__icon`, fill: "none", children: [i.jsx("circle", { cx: "9.5", cy: "9.5", r: "7.5" }), i.jsx("path", { d: "M9.5 4.5 v5 h4" })] }), Dn = i.jsxs("svg", { ...Xe, "aria-hidden": "true", className: `${j}__clear-button__icon ${j}__button__icon`, children: [i.jsx("line", { x1: "4", x2: "15", y1: "4", y2: "15" }), i.jsx("line", { x1: "15", x2: "4", y1: "4", y2: "15" })] });
535
+ function zn(e) {
536
+ const { amPmAriaLabel: n, autoFocus: r, className: a, clearAriaLabel: o, clearIcon: c = Dn, clockAriaLabel: s, clockIcon: u = Wn, closeClock: l = !0, "data-testid": p, hourAriaLabel: v, hourPlaceholder: g, disableClock: x, disabled: N, format: E, id: A, isOpen: k = null, locale: I, maxTime: K, maxDetail: O = "minute", minTime: oe, minuteAriaLabel: U, minutePlaceholder: J, name: G = "time", nativeInputAriaLabel: S, onClockClose: F, onClockOpen: q, onChange: W, onFocus: Q, onInvalidChange: T, openClockOnFocus: ie = !0, required: X, value: D, secondAriaLabel: ae, secondPlaceholder: se, shouldCloseClock: z, shouldOpenClock: Y, ...R } = e, [w, M] = te(k), h = Z(null), ce = Z(null);
537
+ pe(() => {
538
+ M(k);
539
+ }, [k]);
540
+ function ue({ reason: f }) {
541
+ Y && !Y({ reason: f }) || (M(!0), q && q());
542
+ }
543
+ const P = xe(({ reason: f }) => {
544
+ z && !z({ reason: f }) || (M(!1), F && F());
545
+ }, [F, z]);
546
+ function fe() {
547
+ w ? P({ reason: "buttonClick" }) : ue({ reason: "buttonClick" });
548
+ }
549
+ function le(f, L = l) {
550
+ L && P({ reason: "select" }), W && W(f);
551
+ }
552
+ function he(f) {
553
+ Q && Q(f), // Internet Explorer still fires onFocus on disabled elements
554
+ !(N || w || !ie || f.target.dataset.select === "true") && ue({ reason: "focus" });
555
+ }
556
+ const ee = xe((f) => {
557
+ f.key === "Escape" && P({ reason: "escape" });
558
+ }, [P]);
559
+ function _() {
560
+ le(null);
561
+ }
562
+ function b(f) {
563
+ f.stopPropagation();
564
+ }
565
+ const ne = xe((f) => {
566
+ const { current: L } = h, { current: $ } = ce, B = "composedPath" in f ? f.composedPath()[0] : f.target;
567
+ B && L && !L.contains(B) && (!$ || !$.contains(B)) && P({ reason: "outsideAction" });
568
+ }, [P]), V = xe((f = w) => {
569
+ for (const L of On)
570
+ f ? document.addEventListener(L, ne) : document.removeEventListener(L, ne);
571
+ f ? document.addEventListener("keydown", ee) : document.removeEventListener("keydown", ee);
572
+ }, [w, ne, ee]);
573
+ pe(() => (V(), () => {
574
+ V(!1);
575
+ }), [V]);
576
+ function He() {
577
+ const [f] = Array.isArray(D) ? D : [D], L = {
578
+ amPmAriaLabel: n,
579
+ hourAriaLabel: v,
580
+ minuteAriaLabel: U,
581
+ nativeInputAriaLabel: S,
582
+ secondAriaLabel: ae
583
+ }, $ = {
584
+ hourPlaceholder: g,
585
+ minutePlaceholder: J,
586
+ secondPlaceholder: se
587
+ };
588
+ return i.jsxs("div", { className: `${j}__wrapper`, children: [i.jsx(An, { ...L, ...$, autoFocus: r, className: `${j}__inputGroup`, disabled: N, format: E, isClockOpen: w, locale: I, maxDetail: O, maxTime: K, minTime: oe, name: G, onChange: le, onInvalidChange: T, required: X, value: f }), c !== null && i.jsx("button", { "aria-label": o, className: `${j}__clear-button ${j}__button`, disabled: N, onClick: _, onFocus: b, type: "button", children: typeof c == "function" ? De(c) : c }), u !== null && !x && i.jsx("button", { "aria-expanded": w || !1, "aria-label": s, className: `${j}__clock-button ${j}__button`, disabled: N, onClick: fe, onFocus: b, type: "button", children: typeof u == "function" ? De(u) : u })] });
589
+ }
590
+ function Ce() {
591
+ if (w === null || x)
592
+ return null;
593
+ const { clockProps: f, portalContainer: L, value: $ } = e, B = `${j}__clock`, ve = be(B, `${B}--${w ? "open" : "closed"}`), [t] = Array.isArray($) ? $ : [$], d = i.jsx(hn, { locale: I, value: t, ...f });
594
+ return L ? an(i.jsx("div", { ref: ce, className: ve, children: d }), L) : i.jsx(un, { children: i.jsx("div", { ref: (m) => {
595
+ m && !w && m.removeAttribute("style");
596
+ }, className: ve, children: d }) });
597
+ }
598
+ const ke = on(
599
+ () => cn(R),
600
+ // biome-ignore lint/correctness/useExhaustiveDependencies: FIXME
601
+ [R]
602
+ );
603
+ return (
604
+ // biome-ignore lint/a11y/noStaticElementInteractions: False positive caused by non interactive wrapper listening for bubbling events
605
+ i.jsxs("div", { className: be(j, `${j}--${w ? "open" : "closed"}`, `${j}--${N ? "disabled" : "enabled"}`, a), "data-testid": p, id: A, ...ke, onFocus: he, ref: h, children: [He(), Ce()] })
606
+ );
607
+ }
608
+ const Vn = ln.div`
609
+ width: auto;
610
+
611
+ .react-time-picker {
612
+ display: inline-flex;
613
+ position: relative;
614
+ width: 86px;
615
+ min-width: 86px;
616
+ max-width: 86px;
617
+ }
618
+
619
+ .react-time-picker,
620
+ .react-time-picker *,
621
+ .react-time-picker *:before,
622
+ .react-time-picker *:after {
623
+ -moz-box-sizing: border-box;
624
+ -webkit-box-sizing: border-box;
625
+ box-sizing: border-box;
626
+ }
627
+ .react-time-picker--disabled {
628
+ background-color: #f0f0f0;
629
+ color: #6d6d6d;
630
+ }
631
+ .react-time-picker__wrapper {
632
+ display: flex;
633
+ flex-grow: 1;
634
+ flex-shrink: 0;
635
+ border: 1px solid var(--input);
636
+ background-color: white;
637
+ border-radius: var(--radius-medium);
638
+ width: 100%;
639
+ height: var(--input-default);
640
+ padding: 0 6px;
641
+ }
642
+ .react-time-picker__inputGroup {
643
+ padding: 0;
644
+ min-width: unset;
645
+ display: flex;
646
+ align-items: center;
647
+ }
648
+ .react-time-picker__inputGroup__divider {
649
+ padding: 1px 0;
650
+ white-space: pre;
651
+ }
652
+ .react-time-picker__inputGroup__leadingZero {
653
+ font-weight: 400;
654
+ font-size: 14px;
655
+ color: inherit;
656
+ }
657
+ .react-time-picker__inputGroup__input {
658
+ min-width: 0.54em;
659
+ height: auto;
660
+ position: relative;
661
+ padding: 0 1px;
662
+ border: 0;
663
+ background: none;
664
+ font: inherit;
665
+ box-sizing: content-box;
666
+ -moz-appearance: textfield;
667
+ font-weight: 400;
668
+ font-size: 14px;
669
+ color: inherit;
670
+ outline: none;
671
+ border-radius: var(--radius-small);
672
+ }
673
+ .react-time-picker__inputGroup__input::-webkit-outer-spin-button,
674
+ .react-time-picker__inputGroup__input::-webkit-inner-spin-button {
675
+ -webkit-appearance: none;
676
+ margin: 0;
677
+ }
678
+ .react-time-picker__inputGroup__input:invalid {
679
+ background: rgba(245, 65, 128, 0.1);
680
+ }
681
+ .react-time-picker__inputGroup__input--hasLeadingZero {
682
+ margin-left: -0.54em;
683
+ padding-left: calc(1px + 0.54em);
684
+ }
685
+ .react-time-picker__inputGroup__amPm {
686
+ display: none;
687
+ font: inherit;
688
+ -moz-appearance: menulist;
689
+ }
690
+ .react-time-picker__button {
691
+ border: 0;
692
+ background: transparent;
693
+ padding: 2px 2px;
694
+ margin-left: auto;
695
+ width: 20px;
696
+ }
697
+ .react-time-picker__button:enabled {
698
+ cursor: pointer;
699
+ opacity: 0.7;
700
+ }
701
+
702
+ .react-time-picker__button:enabled:hover,
703
+ .react-time-picker__button:enabled:focus {
704
+ opacity: 1;
705
+ }
706
+ .react-time-picker__button:enabled:hover .react-time-picker__button__icon,
707
+ .react-time-picker__button:enabled:focus .react-time-picker__button__icon {
708
+ opacity: 1;
709
+ }
710
+ .react-time-picker__button:disabled .react-time-picker__button__icon {
711
+ stroke: #6d6d6d;
712
+ }
713
+ .react-time-picker__button svg {
714
+ display: inherit;
715
+ }
716
+ .react-time-picker__clock {
717
+ width: 200px;
718
+ height: 200px;
719
+ max-width: 100vw;
720
+ padding: 25px;
721
+ background-color: white;
722
+ border: thin solid #a0a096;
723
+ position: absolute;
724
+ top: 100%;
725
+ left: 0;
726
+ z-index: 1;
727
+ }
728
+ .react-time-picker__clock--closed {
729
+ display: none;
730
+ }
731
+ `, Bn = ({
732
+ onChange: e,
733
+ time: n,
734
+ name: r,
735
+ handleAddTime: a,
736
+ disabled: o = !1,
737
+ ...c
738
+ }) => {
739
+ const s = Z(null);
740
+ return pe(() => {
741
+ const u = (l) => {
742
+ l.key === "Enter" && (l.preventDefault(), a && a(l));
743
+ };
744
+ return s.current && s.current.addEventListener("keydown", u), () => {
745
+ s.current && s.current.removeEventListener("keydown", u);
746
+ };
747
+ }, [a, r]), /* @__PURE__ */ i.jsx(Vn, { ref: s, children: /* @__PURE__ */ i.jsx(
748
+ zn,
749
+ {
750
+ name: r,
751
+ value: n,
752
+ onChange: e,
753
+ amPmAriaLabel: "n/a",
754
+ disableClock: !0,
755
+ format: "HH:mm a",
756
+ hourPlaceholder: "hh",
757
+ minutePlaceholder: "mm",
758
+ disabled: o,
759
+ clearIcon: /* @__PURE__ */ i.jsx("svg", { "aria-hidden": "true", focusable: "false", height: "1em", role: "presentation", viewBox: "0 0 24 24", width: "1em", children: /* @__PURE__ */ i.jsx("path", { d: "M12 2a10 10 0 1010 10A10.016 10.016 0 0012 2zm3.36 12.3a.754.754 0 010 1.06.748.748 0 01-1.06 0l-2.3-2.3-2.3 2.3a.748.748 0 01-1.06 0 .754.754 0 010-1.06l2.3-2.3-2.3-2.3A.75.75 0 019.7 8.64l2.3 2.3 2.3-2.3a.75.75 0 011.06 1.06l-2.3 2.3z", fill: "currentColor" }) }),
760
+ ...c
761
+ }
762
+ ) });
763
+ };
764
+ export {
765
+ Bn as TimePickerInput
766
+ };
767
+ //# sourceMappingURL=index.es.js.map