lizaui 5.0.4 → 5.0.6

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