@loczer/storefront-sdk 0.195.0 → 0.197.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.d.ts.map +1 -1
  2. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +16 -15
  3. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.d.ts.map +1 -1
  4. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +16 -15
  5. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.d.ts.map +1 -1
  6. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.js +4 -4
  7. package/dist/components/BookingPeriodSelector/components/internal/BookingHourPickerField.d.ts +1 -1
  8. package/dist/components/BookingPeriodSelector/components/internal/BookingHourPickerField.d.ts.map +1 -1
  9. package/dist/components/BookingPeriodSelector/components/internal/BookingHourPickerField.js +8 -23
  10. package/dist/components/BookingPeriodSelector/components/internal/StorefrontHourPickerField.d.ts +4 -3
  11. package/dist/components/BookingPeriodSelector/components/internal/StorefrontHourPickerField.d.ts.map +1 -1
  12. package/dist/components/BookingPeriodSelector/components/internal/StorefrontHourPickerField.js +308 -324
  13. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
  14. package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +52 -46
  15. package/dist/index.d.ts +0 -1
  16. package/dist/storefront.css +1 -1
  17. package/package.json +1 -1
  18. package/dist/components/BookingPeriodSelector/components/internal/useIsTouchDevice.d.ts +0 -2
  19. package/dist/components/BookingPeriodSelector/components/internal/useIsTouchDevice.d.ts.map +0 -1
  20. package/dist/components/BookingPeriodSelector/components/internal/useIsTouchDevice.js +0 -21
@@ -1,21 +1,20 @@
1
1
  import { cn as e } from "../../../../lib/utils.js";
2
- import { useIsTouchDevice as t } from "./useIsTouchDevice.js";
3
- import * as n from "react";
4
- import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
5
- import { Check as o, ChevronDown as s, ChevronUp as c } from "lucide-react";
6
- import { createPortal as l } from "react-dom";
7
- import { IMaskInput as u } from "react-imask";
8
- import d, { InputMask as f } from "imask";
2
+ import * as t from "react";
3
+ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ import { Check as a, ChevronDown as o, ChevronUp as s } from "lucide-react";
5
+ import { createPortal as c } from "react-dom";
6
+ import { IMaskInput as l } from "react-imask";
7
+ import u, { InputMask as d } from "imask";
9
8
  //#region src/components/BookingPeriodSelector/components/internal/StorefrontHourPickerField.tsx
10
- var p = d;
11
- typeof p.InputMask != "function" && (p.InputMask = f);
12
- var m = {
9
+ var f = u;
10
+ typeof f.InputMask != "function" && (f.InputMask = d);
11
+ var p = {
13
12
  left: 0,
14
13
  top: 0,
15
14
  width: 0,
16
15
  strategy: "fixed"
17
16
  };
18
- function h(e, t, n) {
17
+ function m(e, t, n) {
19
18
  let r = e.getBoundingClientRect(), i = t.offsetHeight, a = window.innerWidth ?? 0, o = window.innerHeight ?? 0, s = r.width, c = r.left;
20
19
  c + s > a - 8 && (c = Math.max(8, a - s - 8)), c < 8 && (c = 8);
21
20
  let l = r.bottom + 8, u = l + i > o - 8, d = r.top - i - 8;
@@ -33,19 +32,19 @@ function h(e, t, n) {
33
32
  strategy: "absolute"
34
33
  };
35
34
  }
36
- function g(e) {
35
+ function h(e) {
37
36
  return String(e).padStart(2, "0");
38
37
  }
39
- function _(e) {
38
+ function g(e) {
40
39
  let t = e.trim();
41
40
  if (!t) return null;
42
41
  let n = /^(\d{1,2}):(\d{2})$/.exec(t);
43
42
  if (!n) return null;
44
43
  let r = Number(n[1]), i = Number(n[2]);
45
- return !Number.isFinite(r) || !Number.isFinite(i) || r < 0 || r > 23 || i < 0 || i > 59 ? null : `${g(r)}:${g(i)}`;
44
+ return !Number.isFinite(r) || !Number.isFinite(i) || r < 0 || r > 23 || i < 0 || i > 59 ? null : `${h(r)}:${h(i)}`;
46
45
  }
47
- function v(e) {
48
- let t = _(e);
46
+ function _(e) {
47
+ let t = g(e);
49
48
  if (t) return `parsed:${t}`;
50
49
  let n = e.replace(/\D/g, "");
51
50
  if (!n) return "empty";
@@ -53,9 +52,9 @@ function v(e) {
53
52
  let r = n.slice(-2), i = n.slice(0, -2);
54
53
  return `hour-minute:${Number(i)}:${r}`;
55
54
  }
56
- function y(e, t) {
57
- let n = _(e);
58
- return n ? x(t.find((e) => e.value === n)) ? {
55
+ function v(e, t) {
56
+ let n = g(e);
57
+ return n ? b(t.find((e) => e.value === n)) ? {
59
58
  parsed: n,
60
59
  selectableValue: n
61
60
  } : {
@@ -63,117 +62,117 @@ function y(e, t) {
63
62
  selectableValue: null
64
63
  } : null;
65
64
  }
66
- function b(e) {
65
+ function y(e) {
67
66
  let t = /^(\d{2}):(\d{2})$/.exec(e);
68
67
  if (!t) return null;
69
68
  let n = Number(t[1]), r = Number(t[2]);
70
69
  return !Number.isFinite(n) || !Number.isFinite(r) ? null : n * 60 + r;
71
70
  }
72
- function x(e) {
71
+ function b(e) {
73
72
  return e ? !e.disabled : !1;
74
73
  }
75
- function S(e, t, n) {
74
+ function x(e, t, n) {
76
75
  let r = e ? n.findIndex((t) => t.value === e) : -1;
77
76
  r === -1 && (r = t === 1 ? -1 : n.length);
78
77
  for (let e = r + t; e >= 0 && e < n.length; e += t) {
79
78
  let t = n[e];
80
- if (x(t)) return t.value;
79
+ if (b(t)) return t.value;
81
80
  }
82
81
  return null;
83
82
  }
84
- function C(e, t, r, i) {
85
- n.useEffect(() => {
86
- if (!t || !r) return;
87
- let n = e.current, a = n?.ownerDocument.defaultView?.IntersectionObserver;
88
- if (!n || !a) return;
83
+ function S(e, n, r, i) {
84
+ t.useEffect(() => {
85
+ if (!n || !r) return;
86
+ let t = e.current, a = t?.ownerDocument.defaultView?.IntersectionObserver;
87
+ if (!t || !a) return;
89
88
  let o = !0, s = new a((e) => {
90
89
  if (!o) return;
91
90
  let t = e[0];
92
91
  t && !t.isIntersecting && i(!1);
93
92
  });
94
- return s.observe(n), () => {
93
+ return s.observe(t), () => {
95
94
  o = !1, s.disconnect();
96
95
  };
97
96
  }, [
98
97
  r,
99
- t,
98
+ n,
100
99
  i,
101
100
  e
102
101
  ]);
103
102
  }
104
- function w(e, t) {
103
+ function C(e, t) {
105
104
  let n = null, r = Infinity, i = -Infinity;
106
105
  for (let a of t) {
107
- if (!x(a)) continue;
108
- let t = b(a.value);
106
+ if (!b(a)) continue;
107
+ let t = y(a.value);
109
108
  if (t == null) continue;
110
109
  let o = Math.abs(t - e);
111
110
  (o < r || o === r && t > i) && (n = a, r = o, i = t);
112
111
  }
113
112
  return n;
114
113
  }
115
- function T({ direction: t, viewportRef: r, speed: a = 400, className: o }) {
116
- let [l, u] = n.useState(!0), d = n.useRef(void 0), f = n.useRef(void 0), p = n.useRef(!1), m = n.useCallback(() => {
117
- let e = r.current;
114
+ function w({ direction: n, viewportRef: i, speed: a = 400, className: c }) {
115
+ let [l, u] = t.useState(!0), d = t.useRef(void 0), f = t.useRef(void 0), p = t.useRef(!1), m = t.useCallback(() => {
116
+ let e = i.current;
118
117
  if (!e) {
119
118
  u(!0);
120
119
  return;
121
120
  }
122
- let { scrollTop: n, scrollHeight: i, clientHeight: a } = e, o = n > 2, s = n < i - a - 2;
123
- if (!(i > a + 2)) {
121
+ let { scrollTop: t, scrollHeight: r, clientHeight: a } = e, o = t > 2, s = t < r - a - 2;
122
+ if (!(r > a + 2)) {
124
123
  u(!0);
125
124
  return;
126
125
  }
127
- u(t === "up" ? !o : !s);
128
- }, [t, r]);
129
- n.useEffect(() => {
130
- let e = r.current;
126
+ u(n === "up" ? !o : !s);
127
+ }, [n, i]);
128
+ t.useEffect(() => {
129
+ let e = i.current;
131
130
  if (!e) return;
132
131
  m();
133
132
  let t = () => m(), n = () => m();
134
133
  e.addEventListener("scroll", t, { passive: !0 });
135
- let i = new ResizeObserver(n);
136
- i.observe(e);
134
+ let r = new ResizeObserver(n);
135
+ r.observe(e);
137
136
  let a = new MutationObserver(n);
138
137
  return a.observe(e, {
139
138
  childList: !0,
140
139
  subtree: !0
141
140
  }), () => {
142
- e.removeEventListener("scroll", t), i.disconnect(), a.disconnect();
141
+ e.removeEventListener("scroll", t), r.disconnect(), a.disconnect();
143
142
  };
144
- }, [r, m]);
145
- let h = n.useCallback(() => {
143
+ }, [i, m]);
144
+ let h = t.useCallback(() => {
146
145
  d.current &&= (cancelAnimationFrame(d.current), void 0), p.current = !1, f.current = void 0;
147
- }, []), g = n.useCallback((e) => {
148
- let n = r.current;
149
- if (!n || l || !p.current) {
146
+ }, []), g = t.useCallback((e) => {
147
+ let t = i.current;
148
+ if (!t || l || !p.current) {
150
149
  h();
151
150
  return;
152
151
  }
153
152
  f.current ||= e;
154
- let i = a * (e - f.current) / 1e3;
155
- if (i < .1) {
153
+ let r = a * (e - f.current) / 1e3;
154
+ if (r < .1) {
156
155
  d.current = requestAnimationFrame(g);
157
156
  return;
158
157
  }
159
- let o = n.scrollTop, s = n.scrollHeight - n.clientHeight, c;
160
- c = t === "up" ? Math.max(0, o - i) : Math.min(s, o + i), n.scrollTo({ top: c }), f.current = e, (t === "up" ? c > 1 : c < s - 1) && Math.abs(c - o) > .01 ? d.current = requestAnimationFrame(g) : (h(), setTimeout(m, 16));
158
+ let o = t.scrollTop, s = t.scrollHeight - t.clientHeight, c;
159
+ c = n === "up" ? Math.max(0, o - r) : Math.min(s, o + r), t.scrollTo({ top: c }), f.current = e, (n === "up" ? c > 1 : c < s - 1) && Math.abs(c - o) > .01 ? d.current = requestAnimationFrame(g) : (h(), setTimeout(m, 16));
161
160
  }, [
162
161
  m,
163
- t,
162
+ n,
164
163
  l,
165
164
  a,
166
165
  h,
167
- r
168
- ]), _ = n.useCallback(() => {
169
- l || !r.current || p.current || (p.current = !0, f.current = void 0, d.current = requestAnimationFrame(g));
166
+ i
167
+ ]), _ = t.useCallback(() => {
168
+ l || !i.current || p.current || (p.current = !0, f.current = void 0, d.current = requestAnimationFrame(g));
170
169
  }, [
171
170
  l,
172
171
  g,
173
- r
172
+ i
174
173
  ]);
175
- return n.useEffect(() => h, [h]), /* @__PURE__ */ i("div", {
176
- className: e("flex items-center justify-center py-1 select-none", l ? "cursor-default opacity-40" : "cursor-pointer opacity-100 hover:bg-accent/20", o),
174
+ return t.useEffect(() => h, [h]), /* @__PURE__ */ r("div", {
175
+ className: e("flex items-center justify-center py-1 select-none", l ? "cursor-default opacity-40" : "cursor-pointer opacity-100 hover:bg-accent/20", c),
177
176
  onPointerEnter: () => {
178
177
  l || _();
179
178
  },
@@ -183,17 +182,17 @@ function T({ direction: t, viewportRef: r, speed: a = 400, className: o }) {
183
182
  onPointerLeave: () => {
184
183
  h();
185
184
  },
186
- children: i(t === "up" ? c : s, {
185
+ children: r(n === "up" ? s : o, {
187
186
  "aria-hidden": !0,
188
187
  className: "h-4 w-4 opacity-50"
189
188
  })
190
189
  });
191
190
  }
192
- function E({ id: t, value: s, onChange: c, onValueUpdate: u, options: d, placeholder: f = "Select time", className: p, inputClassName: g, disabled: _, readOnly: v, open: y, onOpenChange: b, triggerTestId: S, contentTestId: w, isHydrated: E, portalContainer: D }) {
193
- let O = n.useId(), A = t ?? `hours-picker-${O}`, j = n.useRef(null), M = n.useRef(null), N = n.useCallback((e) => {
191
+ function T({ id: o, value: s, onChange: l, onValueUpdate: u, options: d, placeholder: f = "Select time", className: h, inputClassName: g, disabled: _, readOnly: v, open: y, onOpenChange: x, triggerTestId: C, contentTestId: T, isHydrated: E, portalContainer: D }) {
192
+ let k = t.useId(), A = o ?? `hours-picker-${k}`, j = t.useRef(null), M = t.useRef(null), N = t.useCallback((e) => {
194
193
  M.current = e;
195
- }, []), P = n.useRef(null), F = n.useRef(!1), [I, L] = n.useState(null), R = n.useRef(null), z = n.useRef(null), B = n.useRef(null), [V, H] = n.useState(m), [U, W] = n.useState(!1), G = y ?? U, K = b ?? W, q = n.useRef(!1);
196
- q.current = G, n.useEffect(() => {
194
+ }, []), P = t.useRef(null), F = t.useRef(!1), [I, L] = t.useState(null), R = t.useRef(null), z = t.useRef(null), B = t.useRef(null), [V, H] = t.useState(p), [U, W] = t.useState(!1), G = y ?? U, K = x ?? W, q = t.useRef(!1);
195
+ q.current = G, t.useEffect(() => {
197
196
  if (!G || _ || v) return;
198
197
  let e = j.current;
199
198
  e instanceof HTMLInputElement && (typeof document < "u" && document.activeElement === e || e.focus({ preventScroll: !0 }));
@@ -202,19 +201,19 @@ function E({ id: t, value: s, onChange: c, onValueUpdate: u, options: d, placeho
202
201
  G,
203
202
  v
204
203
  ]);
205
- let J = n.useCallback((e) => {
204
+ let J = t.useCallback((e) => {
206
205
  P.current = e, L(e);
207
- }, []), Y = n.useCallback(() => {
206
+ }, []), Y = t.useCallback(() => {
208
207
  F.current = !0;
209
208
  }, []);
210
- n.useEffect(() => {
209
+ t.useEffect(() => {
211
210
  if (!G) return;
212
211
  let e = d.find((e) => e.value === s);
213
- if (e && x(e)) {
212
+ if (e && b(e)) {
214
213
  J(e.value);
215
214
  return;
216
215
  }
217
- let t = d.find((e) => x(e));
216
+ let t = d.find((e) => b(e));
218
217
  J(t?.value ?? null);
219
218
  }, [
220
219
  G,
@@ -222,24 +221,24 @@ function E({ id: t, value: s, onChange: c, onValueUpdate: u, options: d, placeho
222
221
  J,
223
222
  s
224
223
  ]);
225
- let X = n.useCallback((e) => {
224
+ let X = t.useCallback((e) => {
226
225
  if (e === null) {
227
226
  u && u(null);
228
227
  return;
229
228
  }
230
- x(d.find((t) => t.value === e)) && u && u(e);
231
- }, [u, d]), Z = n.useCallback((e) => {
229
+ b(d.find((t) => t.value === e)) && u && u(e);
230
+ }, [u, d]), Z = t.useCallback((e) => {
232
231
  if (e === null) {
233
- u && u(null), c(null);
232
+ u && u(null), l(null);
234
233
  return;
235
234
  }
236
- x(d.find((t) => t.value === e)) && (u && u(e), c(e));
235
+ b(d.find((t) => t.value === e)) && (u && u(e), l(e));
237
236
  }, [
238
- c,
237
+ l,
239
238
  u,
240
239
  d
241
240
  ]);
242
- n.useEffect(() => {
241
+ t.useEffect(() => {
243
242
  if (!G) return;
244
243
  let e = R.current?.ownerDocument ?? document, t = e.defaultView ?? window, n = (e) => {
245
244
  let t = e.target;
@@ -256,7 +255,7 @@ function E({ id: t, value: s, onChange: c, onValueUpdate: u, options: d, placeho
256
255
  return e.addEventListener("pointerdown", n, !0), t.addEventListener("keydown", r, !0), () => {
257
256
  e.removeEventListener("pointerdown", n, !0), t.removeEventListener("keydown", r, !0);
258
257
  };
259
- }, [G, K]), n.useEffect(() => {
258
+ }, [G, K]), t.useEffect(() => {
260
259
  if (!G) return;
261
260
  let e = z.current;
262
261
  if (!e) return;
@@ -275,13 +274,13 @@ function E({ id: t, value: s, onChange: c, onValueUpdate: u, options: d, placeho
275
274
  return e.addEventListener("wheel", t, { passive: !1 }), () => {
276
275
  e.removeEventListener("wheel", t);
277
276
  };
278
- }, [G]), C(j, G, y === void 0 || b !== void 0, K);
279
- let Q = n.useCallback(() => {
277
+ }, [G]), S(j, G, y === void 0 || x !== void 0, K);
278
+ let Q = t.useCallback(() => {
280
279
  if (typeof window > "u") return;
281
280
  let e = j.current, t = z.current;
282
- !(e instanceof HTMLElement) || !t || H(h(e, t, D));
281
+ !(e instanceof HTMLElement) || !t || H(m(e, t, D));
283
282
  }, [D]);
284
- n.useLayoutEffect(() => {
283
+ return t.useLayoutEffect(() => {
285
284
  if (!G || _ || typeof window > "u") return;
286
285
  Q();
287
286
  let e = window.requestAnimationFrame(Q);
@@ -292,7 +291,7 @@ function E({ id: t, value: s, onChange: c, onValueUpdate: u, options: d, placeho
292
291
  _,
293
292
  G,
294
293
  Q
295
- ]), n.useEffect(() => {
294
+ ]), t.useEffect(() => {
296
295
  if (!G) return;
297
296
  let e = B.current;
298
297
  if (!e) return;
@@ -322,7 +321,7 @@ function E({ id: t, value: s, onChange: c, onValueUpdate: u, options: d, placeho
322
321
  e.scrollTop = a;
323
322
  });
324
323
  return () => cancelAnimationFrame(t);
325
- }, [G, d]), n.useEffect(() => {
324
+ }, [G, d]), t.useEffect(() => {
326
325
  if (!G || !I || !F.current) return;
327
326
  let e = B.current;
328
327
  if (!e) return;
@@ -334,28 +333,25 @@ function E({ id: t, value: s, onChange: c, onValueUpdate: u, options: d, placeho
334
333
  return;
335
334
  }
336
335
  r > e.scrollTop + e.clientHeight && (e.scrollTop = Math.max(0, r - e.clientHeight));
337
- }, [I, G]);
338
- let $ = d.find((e) => e.value === s);
339
- return /* @__PURE__ */ i("div", {
336
+ }, [I, G]), /* @__PURE__ */ r("div", {
340
337
  "data-slot": "hours-picker-input",
341
- className: e("w-[150px]", p),
338
+ className: e("w-[150px]", h),
342
339
  ref: R,
343
- children: /* @__PURE__ */ a("div", {
340
+ children: /* @__PURE__ */ i("div", {
344
341
  className: "relative",
345
- children: [/* @__PURE__ */ i(k, {
342
+ children: [/* @__PURE__ */ r(O, {
346
343
  id: A,
347
344
  placeholder: f,
348
345
  value: s,
349
346
  onValueUpdate: X,
350
347
  onCommit: Z,
351
348
  options: d,
352
- selectedLabel: $?.selectedLabel,
353
349
  disabled: _,
354
350
  readOnly: v,
355
351
  open: G,
356
352
  setOpen: K,
357
353
  inputClassName: g,
358
- triggerTestId: S,
354
+ triggerTestId: C,
359
355
  isHydrated: E,
360
356
  highlightedValueRef: P,
361
357
  setHighlightedValue: J,
@@ -365,9 +361,9 @@ function E({ id: t, value: s, onChange: c, onValueUpdate: u, options: d, placeho
365
361
  },
366
362
  onDraftValueHandlerChange: N
367
363
  }), G ? (() => {
368
- let t = /* @__PURE__ */ i(r, { children: /* @__PURE__ */ a("div", {
364
+ let t = /* @__PURE__ */ r(n, { children: /* @__PURE__ */ i("div", {
369
365
  ref: z,
370
- "data-testid": w,
366
+ "data-testid": T,
371
367
  "data-state": "open",
372
368
  className: e("pointer-events-auto z-[60] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md", "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95"),
373
369
  style: {
@@ -377,23 +373,23 @@ function E({ id: t, value: s, onChange: c, onValueUpdate: u, options: d, placeho
377
373
  width: V.width
378
374
  },
379
375
  children: [
380
- /* @__PURE__ */ i(T, {
376
+ /* @__PURE__ */ r(w, {
381
377
  direction: "up",
382
378
  viewportRef: B
383
379
  }),
384
- /* @__PURE__ */ i("div", {
380
+ /* @__PURE__ */ r("div", {
385
381
  ref: B,
386
382
  role: "listbox",
387
383
  className: "max-h-64 overflow-y-auto p-1 [overscroll-behavior:contain] [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
388
384
  children: d.map((t) => {
389
385
  let n = t.value === s;
390
- return /* @__PURE__ */ a("div", {
386
+ return /* @__PURE__ */ i("div", {
391
387
  role: "option",
392
388
  "aria-selected": n,
393
389
  "data-value": t.value,
394
390
  "data-state": n ? "checked" : "unchecked",
395
391
  "data-disabled": t.disabled ? "" : void 0,
396
- className: e("relative flex w-full select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none cursor-pointer", t.disabled && "pointer-events-none opacity-50", I === t.value && "bg-accent text-accent-foreground"),
392
+ className: e("relative flex w-full select-none items-center justify-center rounded-sm px-2 py-1.5 text-center text-sm outline-none cursor-pointer", t.disabled && "pointer-events-none opacity-50", I === t.value && "bg-accent text-accent-foreground"),
397
393
  onMouseDown: (e) => {
398
394
  e.preventDefault();
399
395
  },
@@ -406,15 +402,15 @@ function E({ id: t, value: s, onChange: c, onValueUpdate: u, options: d, placeho
406
402
  onPointerMove: (e) => {
407
403
  F.current && e.movementX === 0 && e.movementY === 0 || (F.current = !1, J(t.value));
408
404
  },
409
- children: [/* @__PURE__ */ i("span", {
405
+ children: [/* @__PURE__ */ r("span", {
410
406
  className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
411
- children: n ? /* @__PURE__ */ i(o, {
407
+ children: n ? /* @__PURE__ */ r(a, {
412
408
  "aria-hidden": !0,
413
409
  className: "h-4 w-4"
414
410
  }) : null
415
- }), /* @__PURE__ */ a("div", {
416
- className: "flex flex-col",
417
- children: [/* @__PURE__ */ i("span", { children: t.label }), t.description == null ? null : /* @__PURE__ */ i("span", {
411
+ }), /* @__PURE__ */ i("div", {
412
+ className: "flex w-full min-w-0 flex-col items-center",
413
+ children: [/* @__PURE__ */ r("span", { children: t.label }), t.description == null ? null : /* @__PURE__ */ r("span", {
418
414
  "data-slot": "description",
419
415
  className: "text-xs text-muted-foreground",
420
416
  children: t.description
@@ -423,42 +419,42 @@ function E({ id: t, value: s, onChange: c, onValueUpdate: u, options: d, placeho
423
419
  }, t.value);
424
420
  })
425
421
  }),
426
- /* @__PURE__ */ i(T, {
422
+ /* @__PURE__ */ r(w, {
427
423
  direction: "down",
428
424
  viewportRef: B
429
425
  })
430
426
  ]
431
427
  }) });
432
- return typeof document > "u" ? t : l(t, D ?? document.body);
428
+ return typeof document > "u" ? t : c(t, D ?? document.body);
433
429
  })() : null]
434
430
  })
435
431
  });
436
432
  }
437
- E.displayName = "HourPickerInput";
438
- function D({ id: t, value: c, onChange: u, onValueUpdate: d, options: f, placeholder: p = "Select time", className: g, inputClassName: _, disabled: v, readOnly: y, open: b, onOpenChange: w, triggerTestId: E, contentTestId: D, isHydrated: O, portalContainer: k }) {
439
- let A = n.useId(), j = t ?? `hours-picker-${A}`, M = n.useRef(null), N = n.useRef(null), P = n.useRef(null), F = n.useRef(null), [I, L] = n.useState(m), [R, z] = n.useState(null), [B, V] = n.useState(!1), H = b ?? B, U = w ?? V, W = n.useRef(!1);
433
+ T.displayName = "HourPickerInput";
434
+ function E({ id: s, value: l, onChange: u, onValueUpdate: d, options: f, placeholder: h = "Select time", className: g, inputClassName: _, disabled: v, readOnly: y, open: C, onOpenChange: T, triggerTestId: E, contentTestId: D, isHydrated: O, portalContainer: k }) {
435
+ let A = t.useId(), j = s ?? `hours-picker-${A}`, M = t.useRef(null), N = t.useRef(null), P = t.useRef(null), F = t.useRef(null), [I, L] = t.useState(p), [R, z] = t.useState(null), [B, V] = t.useState(!1), H = C ?? B, U = T ?? V, W = t.useRef(!1);
440
436
  W.current = H;
441
- let G = n.useCallback((e) => {
442
- x(f.find((t) => t.value === e)) && (d && d(e), u(e));
437
+ let G = t.useCallback((e) => {
438
+ b(f.find((t) => t.value === e)) && (d && d(e), u(e));
443
439
  }, [
444
440
  u,
445
441
  d,
446
442
  f
447
443
  ]);
448
- n.useEffect(() => {
444
+ t.useEffect(() => {
449
445
  if (!H) return;
450
- let e = f.find((e) => e.value === c);
451
- if (x(e)) {
446
+ let e = f.find((e) => e.value === l);
447
+ if (b(e)) {
452
448
  z(e.value);
453
449
  return;
454
450
  }
455
- let t = f.find((e) => x(e));
451
+ let t = f.find((e) => b(e));
456
452
  z(t?.value ?? null);
457
453
  }, [
458
454
  f,
459
455
  H,
460
- c
461
- ]), n.useEffect(() => {
456
+ l
457
+ ]), t.useEffect(() => {
462
458
  if (!H || !R) return;
463
459
  let e = F.current;
464
460
  if (!e) return;
@@ -470,13 +466,13 @@ function D({ id: t, value: c, onChange: u, onValueUpdate: d, options: f, placeho
470
466
  return;
471
467
  }
472
468
  r > e.scrollTop + e.clientHeight && (e.scrollTop = Math.max(0, r - e.clientHeight));
473
- }, [R, H]), C(M, H, b === void 0 || w !== void 0, U);
474
- let K = n.useCallback(() => {
469
+ }, [R, H]), S(M, H, C === void 0 || T !== void 0, U);
470
+ let K = t.useCallback(() => {
475
471
  if (typeof window > "u") return;
476
472
  let e = M.current, t = P.current;
477
- !(e instanceof HTMLElement) || !t || L(h(e, t, k));
473
+ !(e instanceof HTMLElement) || !t || L(m(e, t, k));
478
474
  }, [k]);
479
- n.useLayoutEffect(() => {
475
+ t.useLayoutEffect(() => {
480
476
  if (!H || v || typeof window > "u") return;
481
477
  K();
482
478
  let e = window.requestAnimationFrame(K);
@@ -487,7 +483,7 @@ function D({ id: t, value: c, onChange: u, onValueUpdate: d, options: f, placeho
487
483
  v,
488
484
  H,
489
485
  K
490
- ]), n.useEffect(() => {
486
+ ]), t.useEffect(() => {
491
487
  if (!H) return;
492
488
  let e = N.current?.ownerDocument ?? document, t = e.defaultView ?? window, n = (e) => {
493
489
  let t = e.target;
@@ -503,12 +499,12 @@ function D({ id: t, value: c, onChange: u, onValueUpdate: d, options: f, placeho
503
499
  e.removeEventListener("pointerdown", n, !0), t.removeEventListener("keydown", r, !0);
504
500
  };
505
501
  }, [H, U]);
506
- let q = f.find((e) => e.value === c), J = q?.selectedLabel ?? q?.label ?? c, Y = f.findIndex((e) => e.value === R), X = Y >= 0 ? `${j}-option-${Y}` : void 0;
507
- return /* @__PURE__ */ a("div", {
502
+ let q = f.find((e) => e.value === l)?.label ?? l, J = f.findIndex((e) => e.value === R), Y = J >= 0 ? `${j}-option-${J}` : void 0;
503
+ return /* @__PURE__ */ i("div", {
508
504
  "data-slot": "hours-picker-field",
509
505
  className: e("w-[150px]", g),
510
506
  ref: N,
511
- children: [/* @__PURE__ */ a("button", {
507
+ children: [/* @__PURE__ */ i("button", {
512
508
  ref: M,
513
509
  id: j,
514
510
  type: "button",
@@ -516,11 +512,11 @@ function D({ id: t, value: c, onChange: u, onValueUpdate: d, options: f, placeho
516
512
  "aria-expanded": H,
517
513
  "aria-controls": `${j}-content`,
518
514
  "aria-haspopup": "listbox",
519
- "aria-activedescendant": H ? X : void 0,
515
+ "aria-activedescendant": H ? Y : void 0,
520
516
  disabled: v,
521
517
  "data-testid": E,
522
518
  "data-hydrated": O ? "true" : void 0,
523
- className: e("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", "hover:bg-accent hover:text-accent-foreground", !c && "text-muted-foreground", H && "ring-2 ring-primary ring-offset-2", _),
519
+ className: e("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", !l && "text-muted-foreground", H && "ring-2 ring-primary ring-offset-2", _),
524
520
  onClick: () => {
525
521
  v || y || U(!H);
526
522
  },
@@ -535,7 +531,7 @@ function D({ id: t, value: c, onChange: u, onValueUpdate: d, options: f, placeho
535
531
  U(!0);
536
532
  return;
537
533
  }
538
- let t = S(R ?? c, e.key === "ArrowDown" ? 1 : -1, f);
534
+ let t = x(R ?? l, e.key === "ArrowDown" ? 1 : -1, f);
539
535
  if (!t) return;
540
536
  z(t), d?.(t);
541
537
  return;
@@ -545,18 +541,18 @@ function D({ id: t, value: c, onChange: u, onValueUpdate: d, options: f, placeho
545
541
  U(!0);
546
542
  return;
547
543
  }
548
- let t = f.find((e) => e.value === R), n = x(t) ? t.value : f.find((e) => x(e))?.value;
544
+ let t = f.find((e) => e.value === R), n = b(t) ? t.value : f.find((e) => b(e))?.value;
549
545
  n && (G(n), U(!1));
550
546
  },
551
- children: [/* @__PURE__ */ i("span", {
547
+ children: [/* @__PURE__ */ r("span", {
552
548
  className: "line-clamp-1 text-left",
553
- children: c ? J : p
554
- }), /* @__PURE__ */ i(s, {
549
+ children: l ? q : h
550
+ }), /* @__PURE__ */ r(o, {
555
551
  "aria-hidden": !0,
556
552
  className: "h-4 w-4 shrink-0 opacity-50"
557
553
  })]
558
554
  }), H ? (() => {
559
- let t = /* @__PURE__ */ i(r, { children: /* @__PURE__ */ a("div", {
555
+ let t = /* @__PURE__ */ r(n, { children: /* @__PURE__ */ i("div", {
560
556
  ref: P,
561
557
  id: `${j}-content`,
562
558
  "data-testid": D,
@@ -569,40 +565,40 @@ function D({ id: t, value: c, onChange: u, onValueUpdate: d, options: f, placeho
569
565
  width: I.width
570
566
  },
571
567
  children: [
572
- /* @__PURE__ */ i(T, {
568
+ /* @__PURE__ */ r(w, {
573
569
  direction: "up",
574
570
  viewportRef: F
575
571
  }),
576
- /* @__PURE__ */ i("div", {
572
+ /* @__PURE__ */ r("div", {
577
573
  ref: F,
578
574
  role: "listbox",
579
575
  className: "max-h-64 overflow-y-auto p-1 [overscroll-behavior:contain] [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
580
576
  children: f.map((t, n) => {
581
- let r = t.value === c, s = t.value === R;
582
- return /* @__PURE__ */ a("div", {
577
+ let o = t.value === l, s = t.value === R;
578
+ return /* @__PURE__ */ i("div", {
583
579
  id: `${j}-option-${n}`,
584
580
  role: "option",
585
- "aria-selected": r,
581
+ "aria-selected": o,
586
582
  "aria-disabled": t.disabled || void 0,
587
583
  "data-value": t.value,
588
- "data-state": r ? "checked" : "unchecked",
584
+ "data-state": o ? "checked" : "unchecked",
589
585
  "data-disabled": t.disabled ? "" : void 0,
590
- className: e("relative flex w-full select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none cursor-pointer", t.disabled && "pointer-events-none opacity-50", s && "bg-accent text-accent-foreground"),
586
+ className: e("relative flex w-full select-none items-center justify-center rounded-sm px-2 py-1.5 text-center text-sm outline-none cursor-pointer", t.disabled && "pointer-events-none opacity-50", s && "bg-accent text-accent-foreground"),
591
587
  onMouseDown: (e) => {
592
588
  e.preventDefault();
593
589
  },
594
590
  onClick: () => {
595
591
  t.disabled || y || (z(t.value), G(t.value), U(!1), M.current?.focus({ preventScroll: !0 }));
596
592
  },
597
- children: [/* @__PURE__ */ i("span", {
593
+ children: [/* @__PURE__ */ r("span", {
598
594
  className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
599
- children: r ? /* @__PURE__ */ i(o, {
595
+ children: o ? /* @__PURE__ */ r(a, {
600
596
  "aria-hidden": !0,
601
597
  className: "h-4 w-4"
602
598
  }) : null
603
- }), /* @__PURE__ */ a("div", {
604
- className: "flex flex-col",
605
- children: [/* @__PURE__ */ i("span", { children: t.label }), t.description == null ? null : /* @__PURE__ */ i("span", {
599
+ }), /* @__PURE__ */ i("div", {
600
+ className: "flex w-full min-w-0 flex-col items-center",
601
+ children: [/* @__PURE__ */ r("span", { children: t.label }), t.description == null ? null : /* @__PURE__ */ r("span", {
606
602
  "data-slot": "description",
607
603
  className: "text-xs text-muted-foreground",
608
604
  children: t.description
@@ -611,220 +607,208 @@ function D({ id: t, value: c, onChange: u, onValueUpdate: d, options: f, placeho
611
607
  }, t.value);
612
608
  })
613
609
  }),
614
- /* @__PURE__ */ i(T, {
610
+ /* @__PURE__ */ r(w, {
615
611
  direction: "down",
616
612
  viewportRef: F
617
613
  })
618
614
  ]
619
615
  }) });
620
- return typeof document > "u" ? t : l(t, k ?? document.body);
616
+ return typeof document > "u" ? t : c(t, k ?? document.body);
621
617
  })() : null]
622
618
  });
623
619
  }
624
- function O(e) {
625
- return t() ? /* @__PURE__ */ i(D, { ...e }) : /* @__PURE__ */ i(E, { ...e });
620
+ function D({ compact: e = !1, ...t }) {
621
+ return r(e ? E : T, { ...t });
626
622
  }
627
- O.displayName = "HourPickerField";
628
- function k({ id: t, placeholder: r, value: o, onValueUpdate: c, onCommit: l, options: d, selectedLabel: f, disabled: p, readOnly: m, open: h, setOpen: _, inputClassName: S, triggerTestId: C, isHydrated: T, highlightedValueRef: E, setHighlightedValue: D, markKeyboardNavigation: O, inputRef: k, onDraftValueHandlerChange: A }) {
629
- let j = n.useRef(!1), M = n.useRef(!1), N = n.useRef(!1), P = n.useRef(null), F = n.useRef(null), I = n.useRef(!1), [L, R] = n.useState(() => o || "");
630
- n.useEffect(() => (A((e) => {
631
- R(e);
623
+ D.displayName = "HourPickerField";
624
+ function O({ id: n, placeholder: a, value: s, onValueUpdate: c, onCommit: u, options: d, disabled: f, readOnly: p, open: m, setOpen: g, inputClassName: x, triggerTestId: S, isHydrated: w, highlightedValueRef: T, setHighlightedValue: E, markKeyboardNavigation: D, inputRef: O, onDraftValueHandlerChange: k }) {
625
+ let A = t.useRef(!1), j = t.useRef(!1), M = t.useRef(!1), N = t.useRef(null), P = t.useRef(null), F = t.useRef(!1), [I, L] = t.useState(() => s || "");
626
+ t.useEffect(() => (k((e) => {
627
+ L(e);
632
628
  }), () => {
633
- A(null);
634
- }), [A]);
635
- let z = n.useCallback((e) => {
636
- let t = E.current ?? o ?? "", n = d.findIndex((e) => e.value === t);
629
+ k(null);
630
+ }), [k]);
631
+ let R = t.useCallback((e) => {
632
+ let t = T.current ?? s ?? "", n = d.findIndex((e) => e.value === t);
637
633
  n === -1 && (n = e === 1 ? -1 : d.length);
638
634
  for (let t = n + e; t >= 0 && t < d.length; t += e) {
639
635
  let e = d[t];
640
- if (x(e)) {
641
- D(e.value), P.current = e.value, R(e.value), c(e.value);
636
+ if (b(e)) {
637
+ E(e.value), N.current = e.value, L(e.value), c(e.value);
642
638
  return;
643
639
  }
644
640
  }
645
641
  }, [
646
- E,
642
+ T,
647
643
  c,
648
644
  d,
649
- D,
650
- o
645
+ E,
646
+ s
651
647
  ]);
652
- n.useEffect(() => {
653
- j.current || R(o || "");
654
- }, [o]), n.useEffect(() => {
655
- F.current = v(L);
656
- }, [L]), n.useEffect(() => {
657
- o === null && (I.current = !1);
658
- }, [o]);
659
- let B = o != null && f != null, V = e("peer flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 pr-10 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "transition-colors group-hover:bg-accent", !B && "group-hover:text-accent-foreground", !L && "text-muted-foreground", h && "ring-2 ring-primary ring-offset-2", "[&_[data-slot='description']]:hidden", S, B && "text-transparent focus:text-foreground");
660
- return /* @__PURE__ */ a("div", {
661
- className: "relative group",
662
- children: [
663
- /* @__PURE__ */ i(u, {
664
- id: t,
665
- "data-testid": C,
666
- "data-hydrated": T ? "true" : void 0,
667
- type: "text",
668
- disabled: p,
669
- readOnly: m,
670
- inputRef: k,
671
- autoComplete: "off",
672
- mask: [{
673
- mask: "00:00",
674
- lazy: !0
675
- }, {
676
- mask: "0:00",
677
- lazy: !0
678
- }],
679
- dispatch: (e, t) => {
680
- let n = (t.value + e).replace(/\D/g, "");
681
- if (n.length <= 2 || n.length >= 4) return t.compiledMasks[0];
682
- let r = g(Number(n.slice(0, 2)));
683
- return d.some((e) => e.value.startsWith(`${r}:`)) ? t.compiledMasks[0] : t.compiledMasks[1];
684
- },
685
- placeholder: r,
686
- value: L,
687
- className: V,
688
- onAccept: (e, t, n) => {
689
- if (!n) return;
690
- let r = typeof e == "string" ? e : String(e ?? ""), i = r.replace(/\D/g, ""), a = v(r);
691
- if (F.current !== a) {
692
- if (F.current = a, R(r), i.length !== 0) {
693
- I.current = !1;
694
- return;
695
- }
696
- o && !I.current && (I.current = !0, l(null));
648
+ t.useEffect(() => {
649
+ A.current || L(s || "");
650
+ }, [s]), t.useEffect(() => {
651
+ P.current = _(I);
652
+ }, [I]), t.useEffect(() => {
653
+ s === null && (F.current = !1);
654
+ }, [s]);
655
+ let z = e("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 pr-10 text-left text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "transition-[border-color,box-shadow]", !I && "text-muted-foreground", m && "ring-2 ring-primary ring-offset-2", "[&_[data-slot='description']]:hidden", x);
656
+ return /* @__PURE__ */ i("div", {
657
+ className: "relative",
658
+ children: [/* @__PURE__ */ r(l, {
659
+ id: n,
660
+ "data-testid": S,
661
+ "data-hydrated": w ? "true" : void 0,
662
+ type: "text",
663
+ disabled: f,
664
+ readOnly: p,
665
+ inputRef: O,
666
+ autoComplete: "off",
667
+ mask: [{
668
+ mask: "00:00",
669
+ lazy: !0
670
+ }, {
671
+ mask: "0:00",
672
+ lazy: !0
673
+ }],
674
+ dispatch: (e, t) => {
675
+ let n = (t.value + e).replace(/\D/g, "");
676
+ if (n.length <= 2 || n.length >= 4) return t.compiledMasks[0];
677
+ let r = h(Number(n.slice(0, 2)));
678
+ return d.some((e) => e.value.startsWith(`${r}:`)) ? t.compiledMasks[0] : t.compiledMasks[1];
679
+ },
680
+ placeholder: a,
681
+ value: I,
682
+ className: z,
683
+ onAccept: (e, t, n) => {
684
+ if (!n) return;
685
+ let r = typeof e == "string" ? e : String(e ?? ""), i = r.replace(/\D/g, ""), a = _(r);
686
+ if (P.current !== a) {
687
+ if (P.current = a, L(r), i.length !== 0) {
688
+ F.current = !1;
689
+ return;
697
690
  }
698
- },
699
- onComplete: (e, t, n) => {
700
- if (!n) return;
701
- let r = typeof e == "string" ? e : String(e ?? "");
702
- if (P.current === r) {
703
- P.current = null;
691
+ s && !F.current && (F.current = !0, u(null));
692
+ }
693
+ },
694
+ onComplete: (e, t, n) => {
695
+ if (!n) return;
696
+ let r = typeof e == "string" ? e : String(e ?? "");
697
+ if (N.current === r) {
698
+ N.current = null;
699
+ return;
700
+ }
701
+ let i = v(r, d);
702
+ if (!i) return;
703
+ if (i.selectableValue) {
704
+ if (E(i.selectableValue), L(i.selectableValue), s === i.selectableValue) return;
705
+ u(i.selectableValue);
706
+ return;
707
+ }
708
+ let a = y(i.parsed);
709
+ if (a == null) return;
710
+ let o = C(a, d);
711
+ o && E(o.value);
712
+ },
713
+ onPointerDown: () => {
714
+ j.current = !0, !f && (m || g(!0));
715
+ },
716
+ onMouseDown: (e) => {
717
+ j.current = !0, M.current = typeof document < "u" && document.activeElement === e.currentTarget, !f && (m || g(!0));
718
+ },
719
+ onClick: () => {
720
+ f || m || g(!0);
721
+ },
722
+ onKeyDown: (e) => {
723
+ if (!f) {
724
+ if (e.key === "Tab" && m && !e.defaultPrevented) {
725
+ g(!1);
704
726
  return;
705
727
  }
706
- let i = y(r, d);
707
- if (!i) return;
708
- if (i.selectableValue) {
709
- if (D(i.selectableValue), R(i.selectableValue), o === i.selectableValue) return;
710
- l(i.selectableValue);
728
+ if (e.key === "Escape") {
729
+ if (!m) return;
730
+ e.preventDefault(), g(!1);
711
731
  return;
712
732
  }
713
- let a = b(i.parsed);
714
- if (a == null) return;
715
- let s = w(a, d);
716
- s && D(s.value);
717
- },
718
- onPointerDown: () => {
719
- M.current = !0, !p && (h || _(!0));
720
- },
721
- onMouseDown: (e) => {
722
- M.current = !0, N.current = typeof document < "u" && document.activeElement === e.currentTarget, !p && (h || _(!0));
723
- },
724
- onClick: () => {
725
- p || h || _(!0);
726
- },
727
- onKeyDown: (e) => {
728
- if (!p) {
729
- if (e.key === "Tab" && h && !e.defaultPrevented) {
730
- _(!1);
733
+ if (!m && !e.defaultPrevented && (e.key.length === 1 || e.key === "Backspace" || e.key === "Delete") && !e.ctrlKey && !e.metaKey && !e.altKey && g(!0), e.key === "ArrowDown" || e.key === "ArrowUp") {
734
+ if (D(), e.preventDefault(), !m) {
735
+ g(!0);
731
736
  return;
732
737
  }
733
- if (e.key === "Escape") {
734
- if (!h) return;
735
- e.preventDefault(), _(!1);
736
- return;
737
- }
738
- if (!h && !e.defaultPrevented && (e.key.length === 1 || e.key === "Backspace" || e.key === "Delete") && !e.ctrlKey && !e.metaKey && !e.altKey && _(!0), e.key === "ArrowDown" || e.key === "ArrowUp") {
739
- if (O(), e.preventDefault(), !h) {
740
- _(!0);
741
- return;
742
- }
743
- z(e.key === "ArrowDown" ? 1 : -1);
738
+ R(e.key === "ArrowDown" ? 1 : -1);
739
+ return;
740
+ }
741
+ if (e.key === "Enter") {
742
+ D();
743
+ let t = v(I, d);
744
+ if (!t) {
745
+ if (!m || I.trim() !== "") return;
746
+ let t = d.find((e) => e.value === T.current), n = (b(t) ? t?.value : void 0) ?? d.find((e) => b(e))?.value;
747
+ if (!n) return;
748
+ e.preventDefault(), E(n), L(n), u(n), g(!1);
744
749
  return;
745
750
  }
746
- if (e.key === "Enter") {
747
- O();
748
- let t = y(L, d);
749
- if (!t) {
750
- if (!h || L.trim() !== "") return;
751
- let t = d.find((e) => e.value === E.current), n = (x(t) ? t?.value : void 0) ?? d.find((e) => x(e))?.value;
752
- if (!n) return;
753
- e.preventDefault(), D(n), R(n), l(n), _(!1);
754
- return;
755
- }
756
- if (t.selectableValue) {
757
- e.preventDefault(), D(t.selectableValue), R(t.selectableValue), l(t.selectableValue), _(!1);
758
- return;
759
- }
760
- let n = b(t.parsed);
761
- if (n == null) return;
762
- let r = w(n, d);
763
- if (!r) return;
764
- e.preventDefault(), D(r.value), R(r.value), l(r.value), _(!1);
751
+ if (t.selectableValue) {
752
+ e.preventDefault(), E(t.selectableValue), L(t.selectableValue), u(t.selectableValue), g(!1);
765
753
  return;
766
754
  }
767
- }
768
- },
769
- onFocus: (e) => {
770
- let t = !M.current || !N.current;
771
- if (M.current = !1, N.current = !1, j.current = !0, t) {
772
- let t = e.currentTarget;
773
- requestAnimationFrame(() => t.select());
774
- }
775
- p || h || _(!0);
776
- },
777
- onBlur: () => {
778
- j.current = !1;
779
- let e = L.trim();
780
- if (!e) {
781
- R(o || "");
782
- return;
783
- }
784
- let t = y(e, d);
785
- if (!t) {
786
- R(o || "");
787
- return;
788
- }
789
- if (!t.selectableValue) {
790
- R(o || "");
755
+ let n = y(t.parsed);
756
+ if (n == null) return;
757
+ let r = C(n, d);
758
+ if (!r) return;
759
+ e.preventDefault(), E(r.value), L(r.value), u(r.value), g(!1);
791
760
  return;
792
761
  }
793
- R(t.selectableValue), o !== t.selectableValue && l(t.selectableValue);
794
762
  }
795
- }),
796
- o && f != null ? /* @__PURE__ */ i("span", {
797
- "aria-hidden": "true",
798
- "data-slot": "hours-picker-input-selected-label",
799
- className: e("pointer-events-none absolute inset-y-0 left-3 right-10 flex min-w-0 items-center text-base transition-colors group-hover:text-accent-foreground peer-focus:hidden md:text-sm", p && "opacity-50"),
800
- children: /* @__PURE__ */ i("span", {
801
- className: "min-w-0 truncate",
802
- children: f
803
- })
804
- }) : null,
805
- /* @__PURE__ */ i("button", {
806
- type: "button",
807
- tabIndex: -1,
808
- disabled: p,
809
- "data-slot": "hours-picker-input-toggle",
810
- className: e("absolute right-1 top-1/2 inline-flex size-8 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"),
811
- "aria-label": h ? "Close time picker" : "Open time picker",
812
- onPointerDown: (e) => {
813
- e.preventDefault();
814
- },
815
- onMouseDown: (e) => {
816
- e.preventDefault();
817
- },
818
- onClick: () => {
819
- p || _(!h);
820
- },
821
- children: /* @__PURE__ */ i(s, {
822
- "aria-hidden": !0,
823
- className: "size-4"
824
- })
763
+ },
764
+ onFocus: (e) => {
765
+ let t = !j.current || !M.current;
766
+ if (j.current = !1, M.current = !1, A.current = !0, t) {
767
+ let t = e.currentTarget;
768
+ requestAnimationFrame(() => t.select());
769
+ }
770
+ f || m || g(!0);
771
+ },
772
+ onBlur: () => {
773
+ A.current = !1;
774
+ let e = I.trim();
775
+ if (!e) {
776
+ L(s || "");
777
+ return;
778
+ }
779
+ let t = v(e, d);
780
+ if (!t) {
781
+ L(s || "");
782
+ return;
783
+ }
784
+ if (!t.selectableValue) {
785
+ L(s || "");
786
+ return;
787
+ }
788
+ L(t.selectableValue), s !== t.selectableValue && u(t.selectableValue);
789
+ }
790
+ }), /* @__PURE__ */ r("button", {
791
+ type: "button",
792
+ tabIndex: -1,
793
+ disabled: f,
794
+ "data-slot": "hours-picker-input-toggle",
795
+ className: e("absolute right-1 top-1/2 inline-flex size-8 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"),
796
+ "aria-label": m ? "Close time picker" : "Open time picker",
797
+ onPointerDown: (e) => {
798
+ e.preventDefault();
799
+ },
800
+ onMouseDown: (e) => {
801
+ e.preventDefault();
802
+ },
803
+ onClick: () => {
804
+ f || g(!m);
805
+ },
806
+ children: /* @__PURE__ */ r(o, {
807
+ "aria-hidden": !0,
808
+ className: "size-4"
825
809
  })
826
- ]
810
+ })]
827
811
  });
828
812
  }
829
813
  //#endregion
830
- export { O as HourPickerField, E as HourPickerInput };
814
+ export { D as HourPickerField, T as HourPickerInput };