lizaui 5.0.3 → 5.0.5

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