@loczer/storefront-sdk 0.158.0 → 0.159.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"}
@@ -1,49 +1,49 @@
1
- import { jsxs as U, jsx as u } from "react/jsx-runtime";
2
- import { useRef as K, useState as S, useEffect as O } from "react";
3
- import { DayButton as R } from "react-day-picker";
4
- import { cn as p, DayPickerField as _ } from "@rpcbase/ui";
5
- import { useMorphingModalWizardOverlayLayer as $ } from "../../../chunks/ui/dist/MorphingModalWizard-D7hc-dDP.js";
1
+ import { jsxs as I, jsx as u } from "react/jsx-runtime";
2
+ import { useRef as L, useState as A, useEffect as H } from "react";
3
+ import { DayButton as U } from "react-day-picker";
4
+ import { cn as f, DayPickerField as K } from "@rpcbase/ui";
5
+ import { useMorphingModalWizardOverlayLayer as R } from "../../../chunks/ui/dist/MorphingModalWizard-D7hc-dDP.js";
6
6
  import { DayPicker as v } from "../../../ui/day-picker.js";
7
- import { Label as j } from "../../../ui/label.js";
8
- import { useBookingPeriod as q } from "../BookingPeriodContext.js";
9
- import { BookingPeriodFieldErrorMessage as z } from "./BookingPeriodFieldErrorMessage.js";
10
- import { ModalDayPickerField as V } from "./internal/ModalDayPickerField.js";
11
- const h = (e) => {
7
+ import { Label as _ } from "../../../ui/label.js";
8
+ import { useBookingPeriod as $ } from "../BookingPeriodContext.js";
9
+ import { BookingPeriodFieldErrorMessage as j } from "./BookingPeriodFieldErrorMessage.js";
10
+ import { ModalDayPickerField as q } from "./internal/ModalDayPickerField.js";
11
+ const k = (e) => {
12
12
  const t = e.modifiers.disabled ? "cursor-not-allowed" : "cursor-pointer";
13
- return /* @__PURE__ */ u(R, { ...e, className: p(e.className, t) });
13
+ return /* @__PURE__ */ u(U, { ...e, className: f(e.className, t) });
14
14
  };
15
- h.displayName = "BookingStartDateDayButton";
16
- const D = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()), W = (e) => {
15
+ k.displayName = "BookingStartDateDayButton";
16
+ const y = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()), z = (e) => {
17
17
  const t = e.trim();
18
18
  if (!t)
19
19
  return null;
20
20
  const i = /^(\d{2})\/(\d{2})\/(\d{4})$/.exec(t);
21
21
  if (i) {
22
22
  const s = Number(i[1]), n = Number(i[2]), o = Number(i[3]), r = new Date(o, n - 1, s);
23
- return Number.isNaN(r.getTime()) || r.getFullYear() !== o || r.getMonth() !== n - 1 || r.getDate() !== s ? null : D(r);
23
+ return Number.isNaN(r.getTime()) || r.getFullYear() !== o || r.getMonth() !== n - 1 || r.getDate() !== s ? null : y(r);
24
24
  }
25
25
  const l = /^(\d{2})\/(\d{2})\/(\d{2})$/.exec(t);
26
26
  if (l) {
27
27
  const s = Number(l[1]), n = Number(l[2]), o = 2e3 + Number(l[3]), r = new Date(o, n - 1, s);
28
- return Number.isNaN(r.getTime()) || r.getFullYear() !== o || r.getMonth() !== n - 1 || r.getDate() !== s ? null : D(r);
28
+ return Number.isNaN(r.getTime()) || r.getFullYear() !== o || r.getMonth() !== n - 1 || r.getDate() !== s ? null : y(r);
29
29
  }
30
30
  const d = /^(\d{2})\/(\d{2})$/.exec(t);
31
31
  if (d) {
32
32
  const s = Number(d[1]), n = Number(d[2]), o = (/* @__PURE__ */ new Date()).getFullYear(), r = new Date(o, n - 1, s);
33
- return Number.isNaN(r.getTime()) || r.getFullYear() !== o || r.getMonth() !== n - 1 || r.getDate() !== s ? null : D(r);
33
+ return Number.isNaN(r.getTime()) || r.getFullYear() !== o || r.getMonth() !== n - 1 || r.getDate() !== s ? null : y(r);
34
34
  }
35
35
  return null;
36
- }, G = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), J = (e) => {
36
+ }, V = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), W = (e) => {
37
37
  if (typeof document > "u")
38
38
  return e.current = !1, !1;
39
39
  const t = document.activeElement, i = e.current && t instanceof HTMLElement && t.id === "start-date-picker";
40
40
  return e.current = !1, i;
41
- }, Q = () => {
41
+ }, G = () => {
42
42
  if (typeof document > "u")
43
43
  return !1;
44
44
  const e = document.activeElement;
45
45
  return e instanceof HTMLElement ? !!(document.getElementById("start-date-calendar")?.contains(e) || e.id === "start-date-picker") : !1;
46
- }, X = "You cannot select date in the past", de = () => {
46
+ }, J = "You cannot select date in the past", ie = () => {
47
47
  const {
48
48
  labels: e,
49
49
  startDate: t,
@@ -54,59 +54,63 @@ const D = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()), W = (e) =
54
54
  inputClassName: n,
55
55
  buttonClassName: o,
56
56
  errors: r,
57
- dateLocale: k,
58
- numberOfMonths: b,
59
- isMobile: B,
57
+ dateLocale: b,
58
+ numberOfMonths: N,
59
+ isMobile: S,
60
60
  isHydrated: M,
61
- openDatePickerOnFocus: T,
62
- withMobileDateDrawer: Y,
63
- minSelectableDate: N
64
- } = q(), c = Y && B, y = K(!1), [x, m] = S(null), [I, L] = S(!1), w = $(), A = !!w || !I;
65
- O(() => {
66
- L(!0);
67
- }, []), O(() => {
61
+ openDatePickerOnFocus: O,
62
+ withMobileDateDrawer: B,
63
+ minSelectableDate: w
64
+ } = $(), c = B && S, g = L(!1), [T, m] = A(null), E = R(), x = !!E;
65
+ H(() => {
68
66
  if (typeof document > "u")
69
67
  return;
70
68
  const a = document.getElementById("start-date-picker");
71
69
  if (!(a instanceof HTMLInputElement))
72
70
  return;
73
- const F = (g) => {
74
- if (g.key === "ArrowUp" || g.key === "ArrowDown") {
75
- y.current = !0;
71
+ const p = (h) => {
72
+ if (h.key === "ArrowUp" || h.key === "ArrowDown") {
73
+ g.current = !0;
76
74
  return;
77
75
  }
78
- if (y.current = !1, g.key !== "Enter") return;
79
- const P = W(a.value);
76
+ if (g.current = !1, h.key !== "Enter") return;
77
+ const P = z(a.value);
80
78
  if (!P) return;
81
- const H = D(/* @__PURE__ */ new Date());
82
- P < H ? m(X) : m(null);
79
+ const Y = y(/* @__PURE__ */ new Date());
80
+ P < Y ? m(J) : m(null);
83
81
  };
84
- return a.addEventListener("keydown", F, !0), () => {
85
- a.removeEventListener("keydown", F, !0);
82
+ return a.addEventListener("keydown", p, !0), () => {
83
+ a.removeEventListener("keydown", p, !0);
86
84
  };
87
85
  }, []);
88
- const E = (a) => {
89
- a && (m(null), !J(y) && (t && G(a, t) || i(a, { openTimePicker: Q() })));
90
- }, f = r.startDate ?? x, C = () => {
86
+ const C = (a) => {
87
+ if (!a || (m(null), W(g)) || t && V(a, t))
88
+ return;
89
+ const p = G();
90
+ i(a, {
91
+ openTimePicker: p ? void 0 : !1,
92
+ openEndDatePicker: p ? void 0 : !1
93
+ });
94
+ }, D = r.startDate ?? T, F = () => {
91
95
  c && d(!0);
92
96
  };
93
- return /* @__PURE__ */ U(
97
+ return /* @__PURE__ */ I(
94
98
  "div",
95
99
  {
96
- className: p("group/form-item relative flex-grow", c && "cursor-pointer rounded-md"),
97
- onPointerDownCapture: C,
98
- onClick: C,
100
+ className: f("group/form-item relative flex-grow", c && "cursor-pointer rounded-md"),
101
+ onPointerDownCapture: F,
102
+ onClick: F,
99
103
  children: [
100
104
  /* @__PURE__ */ u(
101
- j,
105
+ _,
102
106
  {
103
107
  htmlFor: "start-date-picker",
104
- className: p("mb-1 block text-sm font-medium", c && "cursor-pointer", s),
108
+ className: f("mb-1 block text-sm font-medium", c && "cursor-pointer", s),
105
109
  children: /* @__PURE__ */ u("span", { children: e.startDate })
106
110
  }
107
111
  ),
108
- A ? /* @__PURE__ */ u(
109
- V,
112
+ x ? /* @__PURE__ */ u(
113
+ q,
110
114
  {
111
115
  id: "start-date-picker",
112
116
  value: t ?? null,
@@ -116,30 +120,30 @@ const D = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()), W = (e) =
116
120
  open: c ? !1 : l,
117
121
  onOpenChange: d,
118
122
  readOnly: c,
119
- openOnFocus: T,
123
+ openOnFocus: O,
120
124
  onValueUpdate: () => {
121
125
  m(null);
122
126
  },
123
- onChange: E,
124
- inputClassName: p(f && "border-destructive", n, o),
127
+ onChange: C,
128
+ inputClassName: f(D && "border-destructive", n, o),
125
129
  dayPickerComponent: v,
126
130
  dayPickerProps: {
127
131
  id: "start-date-calendar",
128
- locale: k,
132
+ locale: b,
129
133
  showOutsideDays: !1,
130
- numberOfMonths: b,
134
+ numberOfMonths: N,
131
135
  required: !0,
132
136
  components: {
133
- DayButton: h
137
+ DayButton: k
134
138
  },
135
- disabled: (a) => a < N,
139
+ disabled: (a) => a < w,
136
140
  initialFocus: !0,
137
141
  "data-testid": "start-date-calendar"
138
142
  },
139
- portalContainer: w
143
+ portalContainer: E
140
144
  }
141
145
  ) : /* @__PURE__ */ u(
142
- _,
146
+ K,
143
147
  {
144
148
  id: "start-date-picker",
145
149
  value: t ?? null,
@@ -152,29 +156,29 @@ const D = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()), W = (e) =
152
156
  onValueUpdate: () => {
153
157
  m(null);
154
158
  },
155
- onChange: E,
156
- inputClassName: p(f && "border-destructive", n, o),
159
+ onChange: C,
160
+ inputClassName: f(D && "border-destructive", n, o),
157
161
  dayPickerComponent: v,
158
162
  dayPickerProps: {
159
163
  id: "start-date-calendar",
160
- locale: k,
164
+ locale: b,
161
165
  showOutsideDays: !1,
162
- numberOfMonths: b,
166
+ numberOfMonths: N,
163
167
  required: !0,
164
168
  components: {
165
- DayButton: h
169
+ DayButton: k
166
170
  },
167
- disabled: (a) => a < N,
171
+ disabled: (a) => a < w,
168
172
  initialFocus: !0,
169
173
  "data-testid": "start-date-calendar"
170
174
  }
171
175
  }
172
176
  ),
173
- f && /* @__PURE__ */ u(z, { children: f })
177
+ D && /* @__PURE__ */ u(j, { children: D })
174
178
  ]
175
179
  }
176
180
  );
177
181
  };
178
182
  export {
179
- de as BookingStartDateField
183
+ ie as BookingStartDateField
180
184
  };
@@ -1 +1 @@
1
- {"version":3,"file":"BookingStartTimeField.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingStartTimeField.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,qBAAqB,+CA6LjC,CAAA"}
1
+ {"version":3,"file":"BookingStartTimeField.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingStartTimeField.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,qBAAqB,+CAwJjC,CAAA"}
@@ -1,131 +1,111 @@
1
- import { jsxs as x, Fragment as O, jsx as a } from "react/jsx-runtime";
2
- import { useRef as R, useState as w, useEffect as b } from "react";
3
- import { cn as y, HourPickerField as P } from "@rpcbase/ui";
4
- import { useMorphingModalWizardOverlayLayer as A } from "../../../chunks/ui/dist/MorphingModalWizard-D7hc-dDP.js";
5
- import { Label as U } from "../../../ui/label.js";
6
- import { useBookingPeriod as V } from "../BookingPeriodContext.js";
7
- import { BookingPeriodFieldErrorMessage as j } from "./BookingPeriodFieldErrorMessage.js";
8
- import { ModalHourPickerField as q } from "./internal/ModalHourPickerField.js";
9
- const L = (n, c, d) => new Intl.NumberFormat(c, {
1
+ import { jsxs as E, Fragment as B, jsx as n } from "react/jsx-runtime";
2
+ import { useRef as O, useEffect as S } from "react";
3
+ import { cn as T, HourPickerField as R } from "@rpcbase/ui";
4
+ import { useMorphingModalWizardOverlayLayer as w } from "../../../chunks/ui/dist/MorphingModalWizard-D7hc-dDP.js";
5
+ import { Label as P } from "../../../ui/label.js";
6
+ import { useBookingPeriod as H } from "../BookingPeriodContext.js";
7
+ import { BookingPeriodFieldErrorMessage as U } from "./BookingPeriodFieldErrorMessage.js";
8
+ import { ModalHourPickerField as V } from "./internal/ModalHourPickerField.js";
9
+ const N = (t, m, d) => new Intl.NumberFormat(m, {
10
10
  style: "currency",
11
11
  currency: d,
12
12
  minimumFractionDigits: 0,
13
13
  maximumFractionDigits: 0
14
- }).format(n / 100), Y = () => {
14
+ }).format(t / 100), J = () => {
15
15
  const {
16
- labels: n,
17
- localeCode: c,
16
+ labels: t,
17
+ localeCode: m,
18
18
  currencyCode: d,
19
- startTime: s,
20
- selectStartTime: u,
21
- startTimeSlots: M,
22
- isStartTimeSelectOpen: o,
23
- setIsStartTimeSelectOpen: f,
24
- labelClassName: S,
25
- inputClassName: E,
19
+ startTime: r,
20
+ selectStartTime: c,
21
+ startTimeSlots: D,
22
+ isStartTimeSelectOpen: s,
23
+ setIsStartTimeSelectOpen: h,
24
+ labelClassName: v,
25
+ inputClassName: y,
26
26
  buttonClassName: k,
27
- errors: p,
28
- isHydrated: F,
27
+ errors: u,
28
+ isHydrated: C,
29
29
  isStartToday: I,
30
- earliestMinutesForToday: C
31
- } = V(), g = M.map((e) => {
32
- const i = I && C != null && e.startMinutes < C, t = e.isDisabled || i, r = e.disabledReason === "closed" ? n.timeSlotClosedLabel ?? "Closed" : e.disabledReason, T = e.isExtra && e.extraAmount != null ? n.timeSlotExtraFee?.({
33
- amount: L(e.extraAmount, c, d)
34
- }) ?? `Extra fee: ${L(e.extraAmount, c, d)}` : null, h = e.isDisabled && r ? r : null, H = T && h ? /* @__PURE__ */ x(O, { children: [
35
- /* @__PURE__ */ a("span", { className: "block", children: T }),
36
- /* @__PURE__ */ a("span", { className: "block", children: h })
37
- ] }) : T ?? h ?? void 0;
30
+ earliestMinutesForToday: F
31
+ } = H(), p = D.map((e) => {
32
+ const f = I && F != null && e.startMinutes < F, o = e.isDisabled || f, l = e.disabledReason === "closed" ? t.timeSlotClosedLabel ?? "Closed" : e.disabledReason, b = e.isExtra && e.extraAmount != null ? t.timeSlotExtraFee?.({
33
+ amount: N(e.extraAmount, m, d)
34
+ }) ?? `Extra fee: ${N(e.extraAmount, m, d)}` : null, g = e.isDisabled && l ? l : null, M = b && g ? /* @__PURE__ */ E(B, { children: [
35
+ /* @__PURE__ */ n("span", { className: "block", children: b }),
36
+ /* @__PURE__ */ n("span", { className: "block", children: g })
37
+ ] }) : b ?? g ?? void 0;
38
38
  return {
39
39
  value: e.value,
40
40
  label: e.label,
41
- disabled: t,
42
- description: H
41
+ disabled: o,
42
+ description: M
43
43
  };
44
- }), m = g.find((e) => !e.disabled)?.value, l = R(s ?? m ?? null), [N, D] = w(!1), v = A(), B = !!v || !N;
45
- return b(() => {
46
- D(!0);
47
- }, []), b(() => {
48
- o || (l.current = s ?? m ?? null);
49
- }, [m, o, s]), b(() => {
44
+ }), a = p.find((e) => !e.disabled)?.value, i = O(r ?? a ?? null), x = w(), L = !!x;
45
+ return S(() => {
46
+ s || (i.current = r ?? a ?? null);
47
+ }, [a, s, r]), S(() => {
50
48
  if (typeof document > "u")
51
49
  return;
52
50
  const e = document.getElementById("start-time-picker");
53
51
  if (!(e instanceof HTMLInputElement))
54
52
  return;
55
- const i = (t) => {
56
- if (t.key !== "Enter" || !o) return;
57
- t.preventDefault(), t.stopPropagation();
58
- const r = l.current ?? s ?? m;
59
- r && u(r);
53
+ const f = (o) => {
54
+ if (o.key !== "Enter" || !s) return;
55
+ o.preventDefault(), o.stopPropagation();
56
+ const l = i.current ?? r ?? a;
57
+ l && c(l);
60
58
  };
61
- return e.addEventListener("keydown", i, !0), () => {
62
- e.removeEventListener("keydown", i, !0);
59
+ return e.addEventListener("keydown", f, !0), () => {
60
+ e.removeEventListener("keydown", f, !0);
63
61
  };
64
- }, [m, o, u, s]), b(() => {
65
- if (typeof document > "u")
66
- return;
67
- const e = document.getElementById("start-time-picker");
68
- if (!(e instanceof HTMLInputElement))
69
- return;
70
- const i = () => {
71
- requestAnimationFrame(() => {
72
- const t = document.activeElement;
73
- if (t instanceof HTMLElement && t.id === "start-time-picker")
74
- return;
75
- const r = document.querySelector("[data-testid='start-time-select-content']");
76
- r instanceof HTMLElement && t instanceof Node && r.contains(t) || f(!1);
77
- });
78
- };
79
- return e.addEventListener("blur", i, !0), () => {
80
- e.removeEventListener("blur", i, !0);
81
- };
82
- }, [f]), /* @__PURE__ */ x("div", { className: "group/form-item relative w-[150px]", children: [
83
- /* @__PURE__ */ a(U, { htmlFor: "start-time-picker", className: y("mb-1 block text-sm font-medium", S), children: /* @__PURE__ */ a("span", { children: n.startTime }) }),
84
- B ? /* @__PURE__ */ a(
85
- q,
62
+ }, [a, s, c, r]), /* @__PURE__ */ E("div", { className: "group/form-item relative w-[150px]", children: [
63
+ /* @__PURE__ */ n(P, { htmlFor: "start-time-picker", className: T("mb-1 block text-sm font-medium", v), children: /* @__PURE__ */ n("span", { children: t.startTime }) }),
64
+ L ? /* @__PURE__ */ n(
65
+ V,
86
66
  {
87
67
  id: "start-time-picker",
88
- placeholder: n.startTime,
89
- value: s ?? null,
68
+ placeholder: t.startTime,
69
+ value: r ?? null,
90
70
  onValueUpdate: (e) => {
91
- e && (l.current = e);
71
+ e && (i.current = e);
92
72
  },
93
73
  onChange: (e) => {
94
- e && (l.current = e, u(e));
74
+ e && (i.current = e, c(e));
95
75
  },
96
- options: g,
97
- open: o,
98
- onOpenChange: f,
76
+ options: p,
77
+ open: s,
78
+ onOpenChange: h,
99
79
  triggerTestId: "start-time-trigger",
100
80
  contentTestId: "start-time-select-content",
101
- isHydrated: F,
102
- inputClassName: y(p.startTime && "border-destructive", E, k),
103
- portalContainer: v
81
+ isHydrated: C,
82
+ inputClassName: T(u.startTime && "border-destructive", y, k),
83
+ portalContainer: x
104
84
  }
105
- ) : /* @__PURE__ */ a(
106
- P,
85
+ ) : /* @__PURE__ */ n(
86
+ R,
107
87
  {
108
88
  id: "start-time-picker",
109
- placeholder: n.startTime,
110
- value: s ?? null,
89
+ placeholder: t.startTime,
90
+ value: r ?? null,
111
91
  onValueUpdate: (e) => {
112
- e && (l.current = e);
92
+ e && (i.current = e);
113
93
  },
114
94
  onChange: (e) => {
115
- e && (l.current = e, u(e));
95
+ e && (i.current = e, c(e));
116
96
  },
117
- options: g,
118
- open: o,
119
- onOpenChange: f,
97
+ options: p,
98
+ open: s,
99
+ onOpenChange: h,
120
100
  triggerTestId: "start-time-trigger",
121
101
  contentTestId: "start-time-select-content",
122
- isHydrated: F,
123
- inputClassName: y(p.startTime && "border-destructive", E, k)
102
+ isHydrated: C,
103
+ inputClassName: T(u.startTime && "border-destructive", y, k)
124
104
  }
125
105
  ),
126
- p.startTime && /* @__PURE__ */ a(j, { children: p.startTime })
106
+ u.startTime && /* @__PURE__ */ n(U, { children: u.startTime })
127
107
  ] });
128
108
  };
129
109
  export {
130
- Y as BookingStartTimeField
110
+ J as BookingStartTimeField
131
111
  };
@@ -81,6 +81,7 @@ export interface BookingPeriodControllerValue {
81
81
  isHydrated: boolean;
82
82
  openDatePickerOnFocus: boolean;
83
83
  withMobileDateDrawer: boolean;
84
+ selectionFlow: BookingPeriodSelectionFlow;
84
85
  isStartDatePopoverOpen: boolean;
85
86
  setIsStartDatePopoverOpen: (open: boolean) => void;
86
87
  isStartTimeSelectOpen: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"useBookingPeriodController.d.ts","sourceRoot":"","sources":["../../../src/components/BookingPeriodSelector/useBookingPeriodController.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,U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AS,8BAA8B,KACtC,4BA2wBF,CAAA"}
1
+ {"version":3,"file":"useBookingPeriodController.d.ts","sourceRoot":"","sources":["../../../src/components/BookingPeriodSelector/useBookingPeriodController.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,OAAO,EAQL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAiC,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,qCAAqC,CAAA;AAGpH,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,CACpC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,MAAM,CAAA;AAEX,MAAM,MAAM,6BAA6B,GAAG,CAC1C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,KACjB,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAA;AAE/B,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAA;IACzD,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAA;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAA;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AE,OAAO,CAAA;KAAE,KACtE,IAAI,CAAA;IACT;;;OAGG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACvC;AAuFD,eAAO,MAAM,0BAA0B,GACrC,SAAS,8BAA8B,KACtC,4BA4wBF,CAAA"}
@@ -1,4 +1,4 @@
1
- import { useMemo as d, useState as y, useRef as N, useCallback as h, useEffect as F } from "react";
1
+ import { useMemo as d, useState as C, useRef as N, useCallback as h, useEffect as F } from "react";
2
2
  import { differenceInCalendarDays as Te } from "date-fns";
3
3
  import { fr as nt, de as rt, es as it, it as st, enUS as at } from "date-fns/locale";
4
4
  import { useMediaQuery as ot } from "@rpcbase/client";
@@ -66,7 +66,7 @@ const Tt = (T) => T, Dt = {
66
66
  buttonClassName: Ie,
67
67
  bookingPeriodConfig: D,
68
68
  fetchTimeSlots: s,
69
- selectionFlow: C = "chained-times",
69
+ selectionFlow: E = "chained-times",
70
70
  withMobileDateDrawer: Le = !1,
71
71
  currencyCode: Re = "EUR",
72
72
  disableAutomaticTimeCorrection: H = !1,
@@ -78,21 +78,21 @@ const Tt = (T) => T, Dt = {
78
78
  } = T, W = ot("(max-width: 767px)"), Y = Ke ?? pe ?? "en-US", He = d(
79
79
  () => pt({ locale: he, localeCode: Y }),
80
80
  [he, Y]
81
- ), E = d(
81
+ ), b = d(
82
82
  () => D ? lt(D) : null,
83
83
  [D]
84
- ), R = d(() => D?.timing.slotIntervalMinutes ? D.timing.slotIntervalMinutes : vt(U) ?? 30, [D?.timing.slotIntervalMinutes, U]), [ne, j] = y(!1), [re, ie] = y(!1), [se, z] = y(!1), [ae, oe] = y(!1), [Ue, le] = y(void 0), [We, ze] = y(!1), [ge, Ne] = y(!1), [Ee, qe] = y([]), [be, G] = y([]), [J, q] = y(void 0), b = N(null), ue = N(0), ce = N(0), fe = N(0), Me = N(void 0), $ = N(void 0), $e = h(() => {
84
+ ), R = d(() => D?.timing.slotIntervalMinutes ? D.timing.slotIntervalMinutes : vt(U) ?? 30, [D?.timing.slotIntervalMinutes, U]), [ne, j] = C(!1), [re, ie] = C(!1), [se, z] = C(!1), [ae, oe] = C(!1), [Ue, le] = C(void 0), [We, ze] = C(!1), [ge, Ne] = C(!1), [Ee, qe] = C([]), [be, G] = C([]), [J, q] = C(void 0), M = N(null), ue = N(0), ce = N(0), fe = N(0), Me = N(void 0), $ = N(void 0), $e = h(() => {
85
85
  le(void 0);
86
86
  }, []), X = d(() => !r || !m ? !1 : Te(m, r) === 0, [r, m]), Ze = d(() => x(n), [n]), k = h(
87
87
  (e) => {
88
88
  const c = (e instanceof Date ? e : e ? new Date(e) : void 0) ?? /* @__PURE__ */ new Date();
89
- if (E)
90
- return ut(c, E.timeZone) ?? void 0;
89
+ if (b)
90
+ return ut(c, b.timeZone) ?? void 0;
91
91
  const u = c.getFullYear(), v = String(c.getMonth() + 1).padStart(2, "0"), S = String(c.getDate()).padStart(2, "0");
92
92
  return `${u}-${v}-${S}`;
93
93
  },
94
- [E]
95
- ), A = d(() => k(r), [r, k]), l = d(() => k(m ?? r), [m, r, k]), ye = E ? ct(/* @__PURE__ */ new Date(), E.timeZone) : null, O = ye?.dateString, de = ye?.minutesFromMidnight, B = d(() => O ? !!(r && A && A === O) : !!r && Te(r, /* @__PURE__ */ new Date()) === 0, [r, A, O]), Z = d(() => O ? !!(m && l && l === O) : !!m && Te(m, /* @__PURE__ */ new Date()) === 0, [m, l, O]), _e = d(() => {
94
+ [b]
95
+ ), A = d(() => k(r), [r, k]), l = d(() => k(m ?? r), [m, r, k]), ye = b ? ct(/* @__PURE__ */ new Date(), b.timeZone) : null, O = ye?.dateString, de = ye?.minutesFromMidnight, B = d(() => O ? !!(r && A && A === O) : !!r && Te(r, /* @__PURE__ */ new Date()) === 0, [r, A, O]), Z = d(() => O ? !!(m && l && l === O) : !!m && Te(m, /* @__PURE__ */ new Date()) === 0, [m, l, O]), _e = d(() => {
96
96
  if (O)
97
97
  return ft(O);
98
98
  const e = /* @__PURE__ */ new Date();
@@ -109,17 +109,17 @@ const Tt = (T) => T, Dt = {
109
109
  [I, B]
110
110
  ), Ce = h(
111
111
  (e) => {
112
- if (!E)
112
+ if (!b)
113
113
  return;
114
114
  const t = k(e);
115
115
  if (!t)
116
- return E.defaultEndTime;
117
- const c = dt(t), u = E.getLastStartMinutesForWeekday(c, {
116
+ return b.defaultEndTime;
117
+ const c = dt(t), u = b.getLastStartMinutesForWeekday(c, {
118
118
  dateString: t
119
119
  });
120
- return typeof u == "number" ? mt(u) : E.defaultEndTime;
120
+ return typeof u == "number" ? mt(u) : b.defaultEndTime;
121
121
  },
122
- [E, k]
122
+ [b, k]
123
123
  );
124
124
  F(() => {
125
125
  if (!s || !A)
@@ -172,7 +172,7 @@ const Tt = (T) => T, Dt = {
172
172
  J,
173
173
  R,
174
174
  U
175
- ]), M = h(
175
+ ]), y = h(
176
176
  (e, t) => {
177
177
  e !== n && (Ne(t === "user"), K(e, { source: t }));
178
178
  },
@@ -184,13 +184,13 @@ const Tt = (T) => T, Dt = {
184
184
  [o, De]
185
185
  ), te = d(() => w.length ? w.find((e) => !(e.isDisabled || Se != null && e.startMinutes < Se)) ?? null : null, [Se, w]);
186
186
  F(() => {
187
- H || ge || te && n !== te.value && M(te.value, "auto");
188
- }, [H, te, ge, n, M]), F(() => {
187
+ H || ge || te && n !== te.value && y(te.value, "auto");
188
+ }, [H, te, ge, n, y]), F(() => {
189
189
  if (H || !w.length)
190
190
  return;
191
191
  const e = n ? w.find((f) => f.value === n) : void 0, t = I ?? void 0, c = B ? t : null, u = (f) => {
192
192
  const a = typeof f == "number" ? f : null, g = w.find((P) => !(P.isDisabled || a != null && P.startMinutes < a));
193
- g && g.value !== n ? M(g.value, "auto") : !g && n && M("", "auto");
193
+ g && g.value !== n ? y(g.value, "auto") : !g && n && y("", "auto");
194
194
  };
195
195
  if (n && !e) {
196
196
  u(c);
@@ -206,8 +206,8 @@ const Tt = (T) => T, Dt = {
206
206
  if (v != null && v >= t && !e?.isDisabled)
207
207
  return;
208
208
  const S = w.find((f) => !f.isDisabled && f.startMinutes >= t);
209
- S && S.value !== n && M(S.value, "auto");
210
- }, [H, I, B, n, w, M]), F(() => {
209
+ S && S.value !== n && y(S.value, "auto");
210
+ }, [H, I, B, n, w, y]), F(() => {
211
211
  if (H || !L.length)
212
212
  return;
213
213
  if (s && $.current === l && J === l) {
@@ -256,7 +256,7 @@ const Tt = (T) => T, Dt = {
256
256
  n,
257
257
  p
258
258
  ]), F(() => (ze(!0), () => {
259
- b.current != null && clearTimeout(b.current);
259
+ M.current != null && clearTimeout(M.current);
260
260
  }), []), F(() => {
261
261
  re && ne && j(!1);
262
262
  }, [ne, re]), F(() => {
@@ -274,37 +274,37 @@ const Tt = (T) => T, Dt = {
274
274
  openEndDatePicker: c,
275
275
  close: u = !0
276
276
  } = {}) => {
277
- const v = t ?? C === "chained-times", S = c ?? C === "dates-first";
277
+ const v = t ?? E === "chained-times", S = c ?? E === "dates-first";
278
278
  if (!e) {
279
279
  u && j(!1);
280
280
  return;
281
281
  }
282
- i(e), (u || S) && (ue.current = Date.now() + 250, j(!1)), m && e > m && _(e), v && ie(!0), S && (b.current != null && clearTimeout(b.current), W ? (z(!0), b.current = null) : b.current = setTimeout(() => {
282
+ i(e), (u || S) && (ue.current = Date.now() + 250, j(!1)), m && e > m && _(e), v && ie(!0), S && (M.current != null && clearTimeout(M.current), W ? (z(!0), M.current = null) : M.current = setTimeout(() => {
283
283
  z(!0);
284
284
  }, 100));
285
285
  },
286
- [m, W, _, i, C]
286
+ [m, W, _, i, E]
287
287
  ), Ge = h(
288
288
  (e) => {
289
- M(e, "user"), ie(!1), b.current != null && clearTimeout(b.current), C === "chained-times" && e && r ? b.current = setTimeout(() => {
289
+ y(e, "user"), ie(!1), M.current != null && clearTimeout(M.current), E === "chained-times" && e && r ? M.current = setTimeout(() => {
290
290
  z(!0);
291
- }, 100) : b.current = null;
291
+ }, 100) : M.current = null;
292
292
  },
293
- [C, r, M]
293
+ [E, r, y]
294
294
  ), Je = h(
295
295
  (e) => {
296
- e && e !== n && M(e, "user");
296
+ e && e !== n && y(e, "user");
297
297
  },
298
- [n, M]
298
+ [n, y]
299
299
  ), Xe = h(
300
300
  (e, {
301
301
  openTimePicker: t,
302
302
  close: c = !0,
303
- commit: u = C === "dates-first" ? W : !1
303
+ commit: u = E === "dates-first" ? W : !1
304
304
  } = {}) => {
305
- const v = t ?? C === "chained-times";
305
+ const v = t ?? E === "chained-times";
306
306
  let S = o;
307
- if (e && C === "dates-first") {
307
+ if (e && E === "dates-first") {
308
308
  if (s) {
309
309
  const a = k(e);
310
310
  a && ($.current = a);
@@ -321,7 +321,7 @@ const Tt = (T) => T, Dt = {
321
321
  W,
322
322
  _,
323
323
  Q,
324
- C,
324
+ E,
325
325
  k,
326
326
  p
327
327
  ]
@@ -359,6 +359,7 @@ const Tt = (T) => T, Dt = {
359
359
  isHydrated: We,
360
360
  openDatePickerOnFocus: xe,
361
361
  withMobileDateDrawer: Le,
362
+ selectionFlow: E,
362
363
  isStartDatePopoverOpen: ne,
363
364
  setIsStartDatePopoverOpen: Qe,
364
365
  isStartTimeSelectOpen: re,
package/dist/index.d.ts CHANGED
@@ -657,6 +657,7 @@ export declare interface BookingPeriodControllerValue {
657
657
  isHydrated: boolean;
658
658
  openDatePickerOnFocus: boolean;
659
659
  withMobileDateDrawer: boolean;
660
+ selectionFlow: BookingPeriodSelectionFlow;
660
661
  isStartDatePopoverOpen: boolean;
661
662
  setIsStartDatePopoverOpen: (open: boolean) => void;
662
663
  isStartTimeSelectOpen: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loczer/storefront-sdk",
3
- "version": "0.158.0",
3
+ "version": "0.159.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"