@loczer/storefront-sdk 0.158.0 → 0.160.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.
@@ -1 +1 @@
1
- {"version":3,"file":"BookingEndDateField.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingEndDateField.tsx"],"names":[],"mappings":"AAqJA,eAAO,MAAM,mBAAmB,+CA6hB/B,CAAA"}
1
+ {"version":3,"file":"BookingEndDateField.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingEndDateField.tsx"],"names":[],"mappings":"AAqJA,eAAO,MAAM,mBAAmB,+CAkiB/B,CAAA"}
@@ -1,38 +1,38 @@
1
- import { jsxs as te, jsx as s } from "react/jsx-runtime";
2
- import { differenceInCalendarDays as pe } from "date-fns";
3
- import { createContext as ye, useRef as F, useState as Y, useEffect as h, useContext as De } from "react";
4
- import { cn as k, DayPickerField as Ee } from "@rpcbase/ui";
5
- import { useMorphingModalWizardOverlayLayer as he } from "../../../chunks/ui/dist/MorphingModalWizard-D7hc-dDP.js";
6
- import { DayPicker as ve } from "../../../ui/day-picker.js";
7
- import { Label as be } from "../../../ui/label.js";
8
- import { Provider as ge, Root as Me, TooltipTrigger as ke, Content as Te } from "../../../ui/tooltip.js";
9
- import { useBookingPeriod as Pe } from "../BookingPeriodContext.js";
10
- import { BookingPeriodFieldErrorMessage as we } from "./BookingPeriodFieldErrorMessage.js";
11
- import { ModalDayPickerField as Ce } from "./internal/ModalDayPickerField.js";
12
- const X = (t) => String(t).padStart(2, "0"), $ = (t) => `${t.getFullYear()}-${X(t.getMonth() + 1)}-${X(t.getDate())}`, z = (t) => t.getFullYear() * 12 + t.getMonth(), ne = (t) => new Date(Math.floor(t / 12), t % 12, 1), H = (t) => ne(z(t)), Z = (t, i, r) => {
1
+ import { jsxs as ne, jsx as s } from "react/jsx-runtime";
2
+ import { differenceInCalendarDays as me } from "date-fns";
3
+ import { createContext as pe, useRef as F, useState as X, useEffect as v, useContext as ye } from "react";
4
+ import { cn as k, DayPickerField as De } from "@rpcbase/ui";
5
+ import { useMorphingModalWizardOverlayLayer as Ee } from "../../../chunks/ui/dist/MorphingModalWizard-D7hc-dDP.js";
6
+ import { DayPicker as he } from "../../../ui/day-picker.js";
7
+ import { Label as ve } from "../../../ui/label.js";
8
+ import { Provider as be, Root as ge, TooltipTrigger as Me, Content as ke } from "../../../ui/tooltip.js";
9
+ import { useBookingPeriod as Te } from "../BookingPeriodContext.js";
10
+ import { BookingPeriodFieldErrorMessage as Pe } from "./BookingPeriodFieldErrorMessage.js";
11
+ import { ModalDayPickerField as we } from "./internal/ModalDayPickerField.js";
12
+ const Z = (t) => String(t).padStart(2, "0"), $ = (t) => `${t.getFullYear()}-${Z(t.getMonth() + 1)}-${Z(t.getDate())}`, z = (t) => t.getFullYear() * 12 + t.getMonth(), oe = (t) => new Date(Math.floor(t / 12), t % 12, 1), N = (t) => oe(z(t)), ee = (t, i, r) => {
13
13
  const c = z(t), d = z(i), f = Math.max(0, r - 1), b = c + f;
14
14
  if (d < c)
15
- return H(i);
15
+ return N(i);
16
16
  if (d > b) {
17
17
  const m = d - f;
18
- return m === c ? t : ne(m);
18
+ return m === c ? t : oe(m);
19
19
  }
20
20
  return t;
21
- }, Fe = (t) => {
21
+ }, Ce = (t) => {
22
22
  if (typeof PointerEvent == "function") {
23
23
  t.dispatchEvent(new PointerEvent("pointermove", { bubbles: !0, pointerType: "mouse" }));
24
24
  return;
25
25
  }
26
26
  t.dispatchEvent(new MouseEvent("mousemove", { bubbles: !0 }));
27
- }, ee = (t) => {
27
+ }, te = (t) => {
28
28
  if (typeof PointerEvent == "function") {
29
29
  t.dispatchEvent(new PointerEvent("pointerout", { bubbles: !0, pointerType: "mouse" })), t.dispatchEvent(new PointerEvent("pointerleave", { bubbles: !0, pointerType: "mouse" }));
30
30
  return;
31
31
  }
32
32
  t.dispatchEvent(new MouseEvent("mouseout", { bubbles: !0 })), t.dispatchEvent(new MouseEvent("mouseleave", { bubbles: !0 }));
33
- }, oe = ye(null), re = (t) => {
34
- const i = De(oe), { day: r, modifiers: c, className: d, ...f } = t, b = c.disabled ? "cursor-not-allowed" : "cursor-pointer", m = F(null);
35
- h(() => {
33
+ }, re = pe(null), ae = (t) => {
34
+ const i = ye(re), { day: r, modifiers: c, className: d, ...f } = t, b = c.disabled ? "cursor-not-allowed" : "cursor-pointer", m = F(null);
35
+ v(() => {
36
36
  c.focused && m.current?.focus();
37
37
  }, [c.focused]);
38
38
  const p = /* @__PURE__ */ s(
@@ -48,14 +48,14 @@ const X = (t) => String(t).padStart(2, "0"), $ = (t) => `${t.getFullYear()}-${X(
48
48
  const { labels: y, startDate: L, hoveredEndDate: T, keyboardTooltipDay: P, numberOfMonths: g, overlayLayer: M } = i;
49
49
  if (!L || c.disabled || g === 1)
50
50
  return p;
51
- const l = pe(r.date, L);
51
+ const l = me(r.date, L);
52
52
  if (l < 0)
53
53
  return p;
54
54
  const B = $(r.date), I = P === B || (!P && T ? $(T) === B : !1), O = y.selectedDaysTooltip?.({ count: l + 1 });
55
- return O ? /* @__PURE__ */ te(Me, { open: I, children: [
56
- /* @__PURE__ */ s(ke, { asChild: !0, children: p }),
55
+ return O ? /* @__PURE__ */ ne(ge, { open: I, children: [
56
+ /* @__PURE__ */ s(Me, { asChild: !0, children: p }),
57
57
  /* @__PURE__ */ s(
58
- Te,
58
+ ke,
59
59
  {
60
60
  container: M ?? void 0,
61
61
  side: "top",
@@ -71,8 +71,8 @@ const X = (t) => String(t).padStart(2, "0"), $ = (t) => `${t.getFullYear()}-${X(
71
71
  )
72
72
  ] }) : p;
73
73
  };
74
- re.displayName = "BookingEndDateDayButton";
75
- const Re = () => {
74
+ ae.displayName = "BookingEndDateDayButton";
75
+ const qe = () => {
76
76
  const {
77
77
  labels: t,
78
78
  startDate: i,
@@ -93,36 +93,35 @@ const Re = () => {
93
93
  isMobile: B,
94
94
  isHydrated: I,
95
95
  openDatePickerOnFocus: O,
96
- withMobileDateDrawer: ae,
96
+ withMobileDateDrawer: ie,
97
+ selectionFlow: x,
97
98
  minSelectableDate: U
98
- } = Pe(), D = ae && B, E = F(null), v = F(!1), [ie, de] = Y(!1), [V, N] = Y(null), [j, A] = Y(
99
- () => H(i ?? r ?? /* @__PURE__ */ new Date())
100
- ), x = he(), se = !!x || !ie;
101
- h(() => {
102
- de(!0);
103
- }, []), h(() => {
99
+ } = Te(), D = ie && B, E = F(null), h = F(!1), [V, A] = X(null), [j, K] = X(
100
+ () => N(i ?? r ?? /* @__PURE__ */ new Date())
101
+ ), S = Ee(), de = !!S;
102
+ v(() => {
104
103
  if (typeof document > "u")
105
104
  return;
106
105
  const e = document.getElementById("end-date-picker");
107
106
  if (!(e instanceof HTMLInputElement))
108
107
  return;
109
108
  const n = (o) => {
110
- v.current = o.key === "ArrowUp" || o.key === "ArrowDown";
109
+ h.current = o.key === "ArrowUp" || o.key === "ArrowDown";
111
110
  };
112
111
  return e.addEventListener("keydown", n, !0), () => {
113
112
  e.removeEventListener("keydown", n, !0);
114
113
  };
115
- }, []), h(() => {
114
+ }, []), v(() => {
116
115
  if (!d || D)
117
116
  return;
118
- const e = H(i ?? r ?? /* @__PURE__ */ new Date()), n = r ?? i;
119
- A(n ? Z(e, n, l) : e);
120
- }, [r, d, l, i]), h(() => {
117
+ const e = N(i ?? r ?? /* @__PURE__ */ new Date()), n = r ?? i;
118
+ K(n ? ee(e, n, l) : e);
119
+ }, [r, d, l, i]), v(() => {
121
120
  if (!d)
122
121
  return;
123
122
  const e = m ?? r;
124
- e && A((n) => Z(n, e, l));
125
- }, [r, m, d, l]), h(() => {
123
+ e && K((n) => ee(n, e, l));
124
+ }, [r, m, d, l]), v(() => {
126
125
  if (!d || typeof document > "u" || (y(), D))
127
126
  return;
128
127
  const e = document.getElementById("end-date-picker");
@@ -131,13 +130,13 @@ const Re = () => {
131
130
  return;
132
131
  }
133
132
  document.activeElement !== e && requestAnimationFrame(() => {
134
- e.focus({ preventScroll: !0 }), e.click();
133
+ e.focus({ preventScroll: !0 }), x === "chained-times" && e.click();
135
134
  });
136
- }, [d, y, f]), h(() => {
135
+ }, [d, y, x, f]), v(() => {
137
136
  if (typeof document > "u")
138
137
  return;
139
138
  const e = document.getElementById("end-date-picker");
140
- if (!(e instanceof HTMLInputElement))
139
+ if (!(e instanceof HTMLInputElement) || x !== "chained-times")
141
140
  return;
142
141
  const n = () => {
143
142
  b(!1);
@@ -145,14 +144,14 @@ const Re = () => {
145
144
  return e.addEventListener("focus", n, !0), () => {
146
145
  e.removeEventListener("focus", n, !0);
147
146
  };
148
- }, [b]), h(() => {
147
+ }, [x, b]), v(() => {
149
148
  if (d || typeof document > "u")
150
149
  return;
151
150
  const e = E.current;
152
151
  if (!e)
153
152
  return;
154
153
  const o = document.getElementById("end-date-calendar")?.querySelector(`[data-day="${e}"] button`);
155
- o instanceof HTMLElement && ee(o), E.current = null, N(null);
154
+ o instanceof HTMLElement && te(o), E.current = null, A(null);
156
155
  }, [d]);
157
156
  const W = F({
158
157
  labels: t,
@@ -161,7 +160,7 @@ const Re = () => {
161
160
  hoveredEndDate: m,
162
161
  keyboardTooltipDay: V,
163
162
  numberOfMonths: l,
164
- overlayLayer: x,
163
+ overlayLayer: S,
165
164
  calendarMonth: j,
166
165
  resetHoveredEndDate: y,
167
166
  setHoveredEndDate: p
@@ -173,41 +172,41 @@ const Re = () => {
173
172
  hoveredEndDate: m,
174
173
  keyboardTooltipDay: V,
175
174
  numberOfMonths: l,
176
- overlayLayer: x,
175
+ overlayLayer: S,
177
176
  calendarMonth: j,
178
177
  resetHoveredEndDate: y,
179
178
  setHoveredEndDate: p
180
179
  };
181
- const K = F(null);
182
- if (!K.current) {
180
+ const q = F(null);
181
+ if (!q.current) {
183
182
  const e = (n) => {
184
183
  const {
185
184
  labels: o,
186
185
  startDate: a,
187
186
  endDate: u,
188
187
  hoveredEndDate: w,
189
- keyboardTooltipDay: S,
188
+ keyboardTooltipDay: H,
190
189
  numberOfMonths: Q,
191
- overlayLayer: ce,
192
- calendarMonth: le,
193
- resetHoveredEndDate: ue,
194
- setHoveredEndDate: fe
195
- } = W.current, me = {
190
+ overlayLayer: se,
191
+ calendarMonth: ce,
192
+ resetHoveredEndDate: le,
193
+ setHoveredEndDate: ue
194
+ } = W.current, fe = {
196
195
  labels: o,
197
196
  startDate: a,
198
197
  hoveredEndDate: w,
199
- keyboardTooltipDay: S,
198
+ keyboardTooltipDay: H,
200
199
  numberOfMonths: Q,
201
- overlayLayer: ce
200
+ overlayLayer: se
202
201
  };
203
- return /* @__PURE__ */ s(oe.Provider, { value: me, children: /* @__PURE__ */ s(ge, { delayDuration: 0, children: /* @__PURE__ */ s("div", { onMouseLeave: ue, children: /* @__PURE__ */ s(
204
- ve,
202
+ return /* @__PURE__ */ s(re.Provider, { value: fe, children: /* @__PURE__ */ s(be, { delayDuration: 0, children: /* @__PURE__ */ s("div", { onMouseLeave: le, children: /* @__PURE__ */ s(
203
+ he,
205
204
  {
206
205
  ...n,
207
206
  mode: "range",
208
- month: le,
207
+ month: ce,
209
208
  onMonthChange: (C) => {
210
- A(H(C));
209
+ K(N(C));
211
210
  },
212
211
  selected: {
213
212
  from: a,
@@ -215,20 +214,20 @@ const Re = () => {
215
214
  },
216
215
  components: {
217
216
  ...n.components,
218
- DayButton: re
217
+ DayButton: ae
219
218
  },
220
- onSelect: (C, R) => {
221
- n.onSelect?.(R);
219
+ onSelect: (C, Y) => {
220
+ n.onSelect?.(Y);
222
221
  },
223
- onDayMouseEnter: (C, R) => {
224
- Q !== 1 && a && !R.disabled && C >= a && fe(C);
222
+ onDayMouseEnter: (C, Y) => {
223
+ Q !== 1 && a && !Y.disabled && C >= a && ue(C);
225
224
  }
226
225
  }
227
226
  ) }) }) });
228
227
  };
229
- e.displayName = "BookingEndDateDayPicker", K.current = e;
228
+ e.displayName = "BookingEndDateDayPicker", q.current = e;
230
229
  }
231
- const _ = K.current, q = () => {
230
+ const _ = q.current, R = () => {
232
231
  if (typeof document > "u") {
233
232
  E.current = null;
234
233
  return;
@@ -237,14 +236,14 @@ const Re = () => {
237
236
  if (!e)
238
237
  return;
239
238
  const o = document.getElementById("end-date-calendar")?.querySelector(`[data-day="${e}"] button`);
240
- o instanceof HTMLElement && ee(o), E.current = null, N(null);
239
+ o instanceof HTMLElement && te(o), E.current = null, A(null);
241
240
  }, G = (e) => {
242
241
  if (typeof document > "u")
243
242
  return;
244
243
  const n = $(e);
245
244
  if (E.current === n)
246
245
  return;
247
- q(), E.current = n, N(n);
246
+ R(), E.current = n, A(n);
248
247
  let o = 0;
249
248
  const a = 6, u = () => {
250
249
  if (E.current !== n)
@@ -254,9 +253,9 @@ const Re = () => {
254
253
  o += 1, o <= a && requestAnimationFrame(u);
255
254
  return;
256
255
  }
257
- const S = w.querySelector(`[data-day="${n}"] button:not([disabled])`);
258
- if (S instanceof HTMLElement) {
259
- Fe(S);
256
+ const H = w.querySelector(`[data-day="${n}"] button:not([disabled])`);
257
+ if (H instanceof HTMLElement) {
258
+ Ce(H);
260
259
  return;
261
260
  }
262
261
  o += 1, o <= a && requestAnimationFrame(u);
@@ -265,7 +264,7 @@ const Re = () => {
265
264
  }, J = () => {
266
265
  D && f(!0);
267
266
  };
268
- return /* @__PURE__ */ te(
267
+ return /* @__PURE__ */ ne(
269
268
  "div",
270
269
  {
271
270
  className: k("group/form-item relative flex-grow", D && "cursor-pointer rounded-md"),
@@ -273,15 +272,15 @@ const Re = () => {
273
272
  onClick: J,
274
273
  children: [
275
274
  /* @__PURE__ */ s(
276
- be,
275
+ ve,
277
276
  {
278
277
  htmlFor: "end-date-picker",
279
278
  className: k("mb-1 block text-sm font-medium", D && "cursor-pointer", L),
280
279
  children: /* @__PURE__ */ s("span", { children: t.endDate })
281
280
  }
282
281
  ),
283
- se ? /* @__PURE__ */ s(
284
- Ce,
282
+ de ? /* @__PURE__ */ s(
283
+ we,
285
284
  {
286
285
  id: "end-date-picker",
287
286
  value: r ?? null,
@@ -300,7 +299,7 @@ const Re = () => {
300
299
  return o instanceof HTMLElement && o.id === "end-date-picker";
301
300
  })();
302
301
  if (!i || !e || e < i) {
303
- y(), n && q();
302
+ y(), n && R();
304
303
  return;
305
304
  }
306
305
  p(e), n && G(e);
@@ -308,9 +307,9 @@ const Re = () => {
308
307
  onChange: (e) => {
309
308
  if (y(), (() => {
310
309
  if (typeof document > "u")
311
- return v.current = !1, !1;
312
- const a = document.activeElement, u = v.current && a instanceof HTMLElement && a.id === "end-date-picker";
313
- return v.current = !1, u;
310
+ return h.current = !1, !1;
311
+ const a = document.activeElement, u = h.current && a instanceof HTMLElement && a.id === "end-date-picker";
312
+ return h.current = !1, u;
314
313
  })() || e && r && e.getFullYear() === r.getFullYear() && e.getMonth() === r.getMonth() && e.getDate() === r.getDate())
315
314
  return;
316
315
  const o = (() => {
@@ -319,7 +318,7 @@ const Re = () => {
319
318
  const a = document.activeElement;
320
319
  return a instanceof HTMLElement ? !!(document.getElementById("end-date-calendar")?.contains(a) || a.id === "end-date-picker") : !1;
321
320
  })();
322
- c(e ?? void 0, { openTimePicker: o });
321
+ c(e ?? void 0, { openTimePicker: o ? void 0 : !1 });
323
322
  },
324
323
  inputClassName: k(g.endDate && "border-destructive", T, P),
325
324
  dayPickerComponent: _,
@@ -332,10 +331,10 @@ const Re = () => {
332
331
  initialFocus: !0,
333
332
  "data-testid": "end-date-calendar"
334
333
  },
335
- portalContainer: x
334
+ portalContainer: S
336
335
  }
337
336
  ) : /* @__PURE__ */ s(
338
- Ee,
337
+ De,
339
338
  {
340
339
  id: "end-date-picker",
341
340
  value: r ?? null,
@@ -353,7 +352,7 @@ const Re = () => {
353
352
  return o instanceof HTMLElement && o.id === "end-date-picker";
354
353
  })();
355
354
  if (!i || !e || e < i) {
356
- y(), n && q();
355
+ y(), n && R();
357
356
  return;
358
357
  }
359
358
  p(e), n && G(e);
@@ -361,9 +360,9 @@ const Re = () => {
361
360
  onChange: (e) => {
362
361
  if (y(), (() => {
363
362
  if (typeof document > "u")
364
- return v.current = !1, !1;
365
- const a = document.activeElement, u = v.current && a instanceof HTMLElement && a.id === "end-date-picker";
366
- return v.current = !1, u;
363
+ return h.current = !1, !1;
364
+ const a = document.activeElement, u = h.current && a instanceof HTMLElement && a.id === "end-date-picker";
365
+ return h.current = !1, u;
367
366
  })() || e && r && e.getFullYear() === r.getFullYear() && e.getMonth() === r.getMonth() && e.getDate() === r.getDate())
368
367
  return;
369
368
  const o = (() => {
@@ -372,7 +371,7 @@ const Re = () => {
372
371
  const a = document.activeElement;
373
372
  return a instanceof HTMLElement ? !!(document.getElementById("end-date-calendar")?.contains(a) || a.id === "end-date-picker") : !1;
374
373
  })();
375
- c(e ?? void 0, { openTimePicker: o });
374
+ c(e ?? void 0, { openTimePicker: o ? void 0 : !1 });
376
375
  },
377
376
  inputClassName: k(g.endDate && "border-destructive", T, P),
378
377
  dayPickerComponent: _,
@@ -387,11 +386,11 @@ const Re = () => {
387
386
  }
388
387
  }
389
388
  ),
390
- g.endDate && /* @__PURE__ */ s(we, { children: g.endDate })
389
+ g.endDate && /* @__PURE__ */ s(Pe, { children: g.endDate })
391
390
  ]
392
391
  }
393
392
  );
394
393
  };
395
394
  export {
396
- Re as BookingEndDateField
395
+ qe as BookingEndDateField
397
396
  };
@@ -1 +1 @@
1
- {"version":3,"file":"BookingEndTimeField.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingEndTimeField.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,mBAAmB,+CAmK/B,CAAA"}
1
+ {"version":3,"file":"BookingEndTimeField.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingEndTimeField.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,mBAAmB,+CA8J/B,CAAA"}
@@ -1,113 +1,111 @@
1
- import { jsxs as N, Fragment as V, jsx as r } from "react/jsx-runtime";
2
- import { useRef as H, useState as U, useEffect as T } from "react";
3
- import { cn as h, HourPickerField as A } from "@rpcbase/ui";
4
- import { useMorphingModalWizardOverlayLayer as j } from "../../../chunks/ui/dist/MorphingModalWizard-D7hc-dDP.js";
5
- import { Label as z } from "../../../ui/label.js";
6
- import { useBookingPeriod as K } from "../BookingPeriodContext.js";
7
- import { BookingPeriodFieldErrorMessage as W } from "./BookingPeriodFieldErrorMessage.js";
8
- import { ModalHourPickerField as $ } from "./internal/ModalHourPickerField.js";
9
- const v = (t, o, d) => new Intl.NumberFormat(o, {
1
+ import { jsxs as M, Fragment as w, jsx as r } from "react/jsx-runtime";
2
+ import { useRef as P, useEffect as N } from "react";
3
+ import { cn as T, HourPickerField as V } from "@rpcbase/ui";
4
+ import { useMorphingModalWizardOverlayLayer as H } from "../../../chunks/ui/dist/MorphingModalWizard-D7hc-dDP.js";
5
+ import { Label as U } from "../../../ui/label.js";
6
+ import { useBookingPeriod as A } from "../BookingPeriodContext.js";
7
+ import { BookingPeriodFieldErrorMessage as j } from "./BookingPeriodFieldErrorMessage.js";
8
+ import { ModalHourPickerField as z } from "./internal/ModalHourPickerField.js";
9
+ const v = (n, o, d) => new Intl.NumberFormat(o, {
10
10
  style: "currency",
11
11
  currency: d,
12
12
  minimumFractionDigits: 0,
13
13
  maximumFractionDigits: 0
14
- }).format(t / 100), ee = () => {
14
+ }).format(n / 100), Y = () => {
15
15
  const {
16
- labels: t,
16
+ labels: n,
17
17
  localeCode: o,
18
18
  currencyCode: d,
19
- endTime: n,
19
+ endTime: t,
20
20
  selectEndTime: m,
21
21
  availableEndTimeSlots: I,
22
22
  isEndTimeSelectOpen: i,
23
- setIsEndTimeSelectOpen: y,
24
- labelClassName: S,
25
- inputClassName: E,
26
- buttonClassName: k,
23
+ setIsEndTimeSelectOpen: h,
24
+ labelClassName: L,
25
+ inputClassName: y,
26
+ buttonClassName: E,
27
27
  errors: c,
28
- isHydrated: C,
29
- startMinutesValue: F,
30
- isSameDaySelection: L,
28
+ isHydrated: k,
29
+ startMinutesValue: C,
30
+ isSameDaySelection: S,
31
31
  isEndToday: O,
32
- earliestMinutesForToday: x
33
- } = K(), p = I.map((e) => {
34
- const u = !!L && F != null && e.startMinutes <= F, l = O && x != null && e.startMinutes < x, f = e.isDisabled || u || l, M = e.disabledReason === "closed" ? t.timeSlotClosedLabel ?? "Closed" : e.disabledReason, b = e.isExtra && e.extraAmount != null ? t.timeSlotExtraFee?.({
32
+ earliestMinutesForToday: F
33
+ } = A(), f = I.map((e) => {
34
+ const u = !!S && C != null && e.startMinutes <= C, l = O && F != null && e.startMinutes < F, p = e.isDisabled || u || l, D = e.disabledReason === "closed" ? n.timeSlotClosedLabel ?? "Closed" : e.disabledReason, b = e.isExtra && e.extraAmount != null ? n.timeSlotExtraFee?.({
35
35
  amount: v(e.extraAmount, o, d)
36
- }) ?? `Extra fee: ${v(e.extraAmount, o, d)}` : null, g = e.isDisabled && M ? M : null, P = b && g ? /* @__PURE__ */ N(V, { children: [
36
+ }) ?? `Extra fee: ${v(e.extraAmount, o, d)}` : null, g = e.isDisabled && D ? D : null, R = b && g ? /* @__PURE__ */ M(w, { children: [
37
37
  /* @__PURE__ */ r("span", { className: "block", children: b }),
38
38
  /* @__PURE__ */ r("span", { className: "block", children: g })
39
39
  ] }) : b ?? g ?? void 0;
40
40
  return {
41
41
  value: e.value,
42
42
  label: e.label,
43
- disabled: f,
44
- description: P
43
+ disabled: p,
44
+ description: R
45
45
  };
46
- }), a = p.find((e) => !e.disabled)?.value, s = H(n ?? a ?? null), [B, R] = U(!1), D = j(), w = !!D || !B;
47
- return T(() => {
48
- R(!0);
49
- }, []), T(() => {
50
- i || (s.current = n ?? a ?? null);
51
- }, [n, a, i]), T(() => {
46
+ }), a = f.find((e) => !e.disabled)?.value, s = P(t ?? a ?? null), x = H(), B = !!x;
47
+ return N(() => {
48
+ i || (s.current = t ?? a ?? null);
49
+ }, [t, a, i]), N(() => {
52
50
  const e = document.getElementById("end-time-picker");
53
51
  if (!(e instanceof HTMLInputElement))
54
52
  return;
55
53
  const u = (l) => {
56
54
  if (l.key !== "Enter" || !i) return;
57
55
  l.preventDefault(), l.stopPropagation();
58
- const f = s.current ?? n ?? a;
59
- f && m(f);
56
+ const p = s.current ?? t ?? a;
57
+ p && m(p);
60
58
  };
61
59
  return e.addEventListener("keydown", u, !0), () => {
62
60
  e.removeEventListener("keydown", u, !0);
63
61
  };
64
- }, [n, a, i, m]), /* @__PURE__ */ N("div", { className: "group/form-item relative w-[150px]", children: [
65
- /* @__PURE__ */ r(z, { htmlFor: "end-time-picker", className: h("mb-1 block text-sm font-medium", S), children: /* @__PURE__ */ r("span", { children: t.endTime }) }),
66
- w ? /* @__PURE__ */ r(
67
- $,
62
+ }, [t, a, i, m]), /* @__PURE__ */ M("div", { className: "group/form-item relative w-[150px]", children: [
63
+ /* @__PURE__ */ r(U, { htmlFor: "end-time-picker", className: T("mb-1 block text-sm font-medium", L), children: /* @__PURE__ */ r("span", { children: n.endTime }) }),
64
+ B ? /* @__PURE__ */ r(
65
+ z,
68
66
  {
69
67
  id: "end-time-picker",
70
- placeholder: t.endTime,
71
- value: n ?? null,
68
+ placeholder: n.endTime,
69
+ value: t ?? null,
72
70
  onValueUpdate: (e) => {
73
71
  e && (s.current = e);
74
72
  },
75
73
  onChange: (e) => {
76
74
  e && (s.current = e, m(e));
77
75
  },
78
- options: p,
76
+ options: f,
79
77
  open: i,
80
- onOpenChange: y,
78
+ onOpenChange: h,
81
79
  triggerTestId: "end-time-trigger",
82
80
  contentTestId: "end-time-select-content",
83
- isHydrated: C,
84
- inputClassName: h(c.endTime && "border-destructive", E, k),
85
- portalContainer: D
81
+ isHydrated: k,
82
+ inputClassName: T(c.endTime && "border-destructive", y, E),
83
+ portalContainer: x
86
84
  }
87
85
  ) : /* @__PURE__ */ r(
88
- A,
86
+ V,
89
87
  {
90
88
  id: "end-time-picker",
91
- placeholder: t.endTime,
92
- value: n ?? null,
89
+ placeholder: n.endTime,
90
+ value: t ?? null,
93
91
  onValueUpdate: (e) => {
94
92
  e && (s.current = e);
95
93
  },
96
94
  onChange: (e) => {
97
95
  e && (s.current = e, m(e));
98
96
  },
99
- options: p,
97
+ options: f,
100
98
  open: i,
101
- onOpenChange: y,
99
+ onOpenChange: h,
102
100
  triggerTestId: "end-time-trigger",
103
101
  contentTestId: "end-time-select-content",
104
- isHydrated: C,
105
- inputClassName: h(c.endTime && "border-destructive", E, k)
102
+ isHydrated: k,
103
+ inputClassName: T(c.endTime && "border-destructive", y, E)
106
104
  }
107
105
  ),
108
- c.endTime && /* @__PURE__ */ r(W, { children: c.endTime })
106
+ c.endTime && /* @__PURE__ */ r(j, { children: c.endTime })
109
107
  ] });
110
108
  };
111
109
  export {
112
- ee as BookingEndTimeField
110
+ Y as BookingEndTimeField
113
111
  };
@@ -1 +1 @@
1
- {"version":3,"file":"BookingStartDateField.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingStartDateField.tsx"],"names":[],"mappings":"AA4HA,eAAO,MAAM,qBAAqB,+CA2KjC,CAAA"}
1
+ {"version":3,"file":"BookingStartDateField.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingStartDateField.tsx"],"names":[],"mappings":"AA4HA,eAAO,MAAM,qBAAqB,+CA0KjC,CAAA"}