@loczer/storefront-sdk 0.196.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.
@@ -23,11 +23,11 @@ var d = (e, t, n) => new Intl.NumberFormat(t, {
23
23
  })] }) : a ?? o ?? void 0;
24
24
  return {
25
25
  value: e.value,
26
- label: e.label,
26
+ label: e.value,
27
27
  disabled: r,
28
28
  description: u
29
29
  };
30
- }), M = j.some((e) => !e.disabled), N = v !== "local" && (v !== "ready" || !M), P = v === "loading" ? f.timeSlotsLoading : v === "error" ? f.timeSlotsLoadError : v === "ready" && !M ? f.timeSlotsUnavailable : f.endTime, F = j.find((e) => !e.disabled)?.value, I = o(h ?? F ?? null), L = t();
30
+ }), M = j.some((e) => !e.disabled), N = v !== "local" && (v !== "ready" || !M), P = v === "loading" ? "" : v === "error" ? f.timeSlotsLoadError : v === "ready" && !M ? f.timeSlotsUnavailable : f.endTime, F = j.find((e) => !e.disabled)?.value, I = o(h ?? F ?? null), L = t();
31
31
  return a(() => {
32
32
  y || (I.current = h ?? F ?? null);
33
33
  }, [
@@ -23,11 +23,11 @@ var d = (e, t, n) => new Intl.NumberFormat(t, {
23
23
  })] }) : i ?? a ?? void 0;
24
24
  return {
25
25
  value: e.value,
26
- label: e.label,
26
+ label: e.value,
27
27
  disabled: n,
28
28
  description: o
29
29
  };
30
- }), A = k.some((e) => !e.disabled), j = v !== "local" && (v !== "ready" || !A), M = v === "loading" ? f.timeSlotsLoading : v === "error" ? f.timeSlotsLoadError : v === "ready" && !A ? f.timeSlotsUnavailable : f.startTime, N = k.find((e) => !e.disabled)?.value, P = o(h ?? N ?? null), F = t();
30
+ }), A = k.some((e) => !e.disabled), j = v !== "local" && (v !== "ready" || !A), M = v === "loading" ? "" : v === "error" ? f.timeSlotsLoadError : v === "ready" && !A ? f.timeSlotsUnavailable : f.startTime, N = k.find((e) => !e.disabled)?.value, P = o(h ?? N ?? null), F = t();
31
31
  return a(() => {
32
32
  y || (P.current = h ?? N ?? null);
33
33
  }, [
@@ -1 +1 @@
1
- {"version":3,"file":"BookingTimeSlotsStatus.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.tsx"],"names":[],"mappings":"AAMA,KAAK,2BAA2B,GAAG;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,wBAGpC,2BAA2B,mDA4D7B,CAAA"}
1
+ {"version":3,"file":"BookingTimeSlotsStatus.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.tsx"],"names":[],"mappings":"AAMA,KAAK,2BAA2B,GAAG;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,wBAGpC,2BAA2B,mDA0D7B,CAAA"}
@@ -6,14 +6,14 @@ import { cn as i } from "@rpcbase/ui";
6
6
  var a = ({ className: a, testId: o = "booking-time-slots-status" }) => {
7
7
  let { labels: s, startTimeSlotsStatus: c, endTimeSlotsStatus: l, retryStartTimeSlots: u, retryEndTimeSlots: d, hasAvailableTimeSlots: f } = t();
8
8
  if (c === "local" && l === "local") return null;
9
- let p = c === "error" || l === "error", m = c === "loading" || l === "loading";
10
- if (!p && !m && f) return null;
11
- let h = p ? s.timeSlotsLoadError : m ? s.timeSlotsLoading : s.timeSlotsUnavailable;
9
+ let p = c === "error" || l === "error";
10
+ if (!p && (c === "loading" || l === "loading" || f)) return null;
11
+ let m = p ? s.timeSlotsLoadError : s.timeSlotsUnavailable;
12
12
  return /* @__PURE__ */ r("div", {
13
13
  role: p ? "alert" : "status",
14
14
  "data-testid": o,
15
15
  className: i("flex flex-wrap items-center gap-2 rounded-md border px-3 py-2 text-sm", p ? "border-destructive/40 bg-destructive/5 text-destructive" : "border-border bg-muted/40 text-muted-foreground", a),
16
- children: [/* @__PURE__ */ n("span", { children: h }), p ? /* @__PURE__ */ n(e, {
16
+ children: [/* @__PURE__ */ n("span", { children: m }), p ? /* @__PURE__ */ n(e, {
17
17
  type: "button",
18
18
  variant: "outline",
19
19
  size: "sm",
@@ -2,6 +2,6 @@ import { HourPickerFieldProps } from './StorefrontHourPickerField';
2
2
  type BookingHourPickerFieldProps = HourPickerFieldProps & {
3
3
  portalContainer?: HTMLElement | null;
4
4
  };
5
- export declare const BookingHourPickerField: ({ options, className, inputClassName, portalContainer, ...props }: BookingHourPickerFieldProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const BookingHourPickerField: ({ className, inputClassName, portalContainer, ...props }: BookingHourPickerFieldProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
7
7
  //# sourceMappingURL=BookingHourPickerField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BookingHourPickerField.d.ts","sourceRoot":"","sources":["../../../../../src/components/BookingPeriodSelector/components/internal/BookingHourPickerField.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,6BAA6B,CAAA;AAIpC,KAAK,2BAA2B,GAAG,oBAAoB,GAAG;IACxD,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,mEAMpC,2BAA2B,4CAmB7B,CAAA"}
1
+ {"version":3,"file":"BookingHourPickerField.d.ts","sourceRoot":"","sources":["../../../../../src/components/BookingPeriodSelector/components/internal/BookingHourPickerField.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,6BAA6B,CAAA;AAIpC,KAAK,2BAA2B,GAAG,oBAAoB,GAAG;IACxD,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,0DAKpC,2BAA2B,4CAO7B,CAAA"}
@@ -2,25 +2,11 @@ import { cn as e } from "../../../../lib/utils.js";
2
2
  import { HourPickerField as t } from "./StorefrontHourPickerField.js";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
4
  //#region src/components/BookingPeriodSelector/components/internal/BookingHourPickerField.tsx
5
- var r = ({ options: r, className: i, inputClassName: a, portalContainer: o, ...s }) => {
6
- let c = r.map((e) => ({
7
- ...e,
8
- selectedLabel: /* @__PURE__ */ n("span", {
9
- "data-slot": "booking-hour-picker-desktop-selected-label",
10
- children: e.label
11
- }),
12
- compactSelectedLabel: /* @__PURE__ */ n("span", {
13
- "data-slot": "booking-hour-picker-mobile-selected-label",
14
- children: e.value
15
- })
16
- }));
17
- return /* @__PURE__ */ n(t, {
18
- ...s,
19
- options: c,
20
- className: e("w-full min-w-0", i),
21
- inputClassName: e("min-w-0", a),
22
- portalContainer: o
23
- });
24
- };
5
+ var r = ({ className: r, inputClassName: i, portalContainer: a, ...o }) => /* @__PURE__ */ n(t, {
6
+ ...o,
7
+ className: e("w-full min-w-0", r),
8
+ inputClassName: e("min-w-0", i),
9
+ portalContainer: a
10
+ });
25
11
  //#endregion
26
12
  export { r as BookingHourPickerField };
@@ -2,8 +2,6 @@ import * as React from "react";
2
2
  export type HourPickerOption = {
3
3
  value: string;
4
4
  label: string;
5
- selectedLabel?: React.ReactNode;
6
- compactSelectedLabel?: React.ReactNode;
7
5
  disabled?: boolean;
8
6
  description?: React.ReactNode;
9
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"StorefrontHourPickerField.d.ts","sourceRoot":"","sources":["../../../../../src/components/BookingPeriodSelector/components/internal/StorefrontHourPickerField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAkB9B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC/B,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC9B,CAAA;AAyYD,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACxC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IAC9C,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;CACrC,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,EAAE,EACF,KAAK,EACL,QAAQ,EACR,aAAa,EACb,OAAO,EACP,WAA2B,EAC3B,SAAS,EACT,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,IAAI,EAAE,QAAQ,EACd,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,eAAe,GAChB,EAAE,oBAAoB,2CA6ctB;yBA9de,eAAe;;;AAke/B,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GAAG;IACxD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AA6YD,wBAAgB,eAAe,CAAC,EAAE,OAAe,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,2CAMlF;yBANe,eAAe"}
1
+ {"version":3,"file":"StorefrontHourPickerField.d.ts","sourceRoot":"","sources":["../../../../../src/components/BookingPeriodSelector/components/internal/StorefrontHourPickerField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAkB9B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC9B,CAAA;AAyYD,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACxC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IAC9C,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;CACrC,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,EAAE,EACF,KAAK,EACL,QAAQ,EACR,aAAa,EACb,OAAO,EACP,WAA2B,EAC3B,SAAS,EACT,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,IAAI,EAAE,QAAQ,EACd,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,eAAe,GAChB,EAAE,oBAAoB,2CA0ctB;yBA3de,eAAe;;;AA+d/B,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GAAG;IACxD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAyYD,wBAAgB,eAAe,CAAC,EAAE,OAAe,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,2CAMlF;yBANe,eAAe"}
@@ -280,7 +280,7 @@ function T({ id: o, value: s, onChange: l, onValueUpdate: u, options: d, placeho
280
280
  let e = j.current, t = z.current;
281
281
  !(e instanceof HTMLElement) || !t || H(m(e, t, D));
282
282
  }, [D]);
283
- t.useLayoutEffect(() => {
283
+ return t.useLayoutEffect(() => {
284
284
  if (!G || _ || typeof window > "u") return;
285
285
  Q();
286
286
  let e = window.requestAnimationFrame(Q);
@@ -333,9 +333,7 @@ function T({ id: o, value: s, onChange: l, onValueUpdate: u, options: d, placeho
333
333
  return;
334
334
  }
335
335
  r > e.scrollTop + e.clientHeight && (e.scrollTop = Math.max(0, r - e.clientHeight));
336
- }, [I, G]);
337
- let $ = d.find((e) => e.value === s);
338
- return /* @__PURE__ */ r("div", {
336
+ }, [I, G]), /* @__PURE__ */ r("div", {
339
337
  "data-slot": "hours-picker-input",
340
338
  className: e("w-[150px]", h),
341
339
  ref: R,
@@ -348,7 +346,6 @@ function T({ id: o, value: s, onChange: l, onValueUpdate: u, options: d, placeho
348
346
  onValueUpdate: X,
349
347
  onCommit: Z,
350
348
  options: d,
351
- selectedLabel: $?.selectedLabel,
352
349
  disabled: _,
353
350
  readOnly: v,
354
351
  open: G,
@@ -392,7 +389,7 @@ function T({ id: o, value: s, onChange: l, onValueUpdate: u, options: d, placeho
392
389
  "data-value": t.value,
393
390
  "data-state": n ? "checked" : "unchecked",
394
391
  "data-disabled": t.disabled ? "" : void 0,
395
- 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"),
396
393
  onMouseDown: (e) => {
397
394
  e.preventDefault();
398
395
  },
@@ -412,7 +409,7 @@ function T({ id: o, value: s, onChange: l, onValueUpdate: u, options: d, placeho
412
409
  className: "h-4 w-4"
413
410
  }) : null
414
411
  }), /* @__PURE__ */ i("div", {
415
- className: "flex flex-col",
412
+ className: "flex w-full min-w-0 flex-col items-center",
416
413
  children: [/* @__PURE__ */ r("span", { children: t.label }), t.description == null ? null : /* @__PURE__ */ r("span", {
417
414
  "data-slot": "description",
418
415
  className: "text-xs text-muted-foreground",
@@ -502,7 +499,7 @@ function E({ id: s, value: l, onChange: u, onValueUpdate: d, options: f, placeho
502
499
  e.removeEventListener("pointerdown", n, !0), t.removeEventListener("keydown", r, !0);
503
500
  };
504
501
  }, [H, U]);
505
- let q = f.find((e) => e.value === l), J = q?.compactSelectedLabel ?? q?.selectedLabel ?? q?.label ?? l, Y = f.findIndex((e) => e.value === R), X = Y >= 0 ? `${j}-option-${Y}` : void 0;
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;
506
503
  return /* @__PURE__ */ i("div", {
507
504
  "data-slot": "hours-picker-field",
508
505
  className: e("w-[150px]", g),
@@ -515,7 +512,7 @@ function E({ id: s, value: l, onChange: u, onValueUpdate: d, options: f, placeho
515
512
  "aria-expanded": H,
516
513
  "aria-controls": `${j}-content`,
517
514
  "aria-haspopup": "listbox",
518
- "aria-activedescendant": H ? X : void 0,
515
+ "aria-activedescendant": H ? Y : void 0,
519
516
  disabled: v,
520
517
  "data-testid": E,
521
518
  "data-hydrated": O ? "true" : void 0,
@@ -549,7 +546,7 @@ function E({ id: s, value: l, onChange: u, onValueUpdate: d, options: f, placeho
549
546
  },
550
547
  children: [/* @__PURE__ */ r("span", {
551
548
  className: "line-clamp-1 text-left",
552
- children: l ? J : h
549
+ children: l ? q : h
553
550
  }), /* @__PURE__ */ r(o, {
554
551
  "aria-hidden": !0,
555
552
  className: "h-4 w-4 shrink-0 opacity-50"
@@ -586,7 +583,7 @@ function E({ id: s, value: l, onChange: u, onValueUpdate: d, options: f, placeho
586
583
  "data-value": t.value,
587
584
  "data-state": o ? "checked" : "unchecked",
588
585
  "data-disabled": t.disabled ? "" : void 0,
589
- 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"),
590
587
  onMouseDown: (e) => {
591
588
  e.preventDefault();
592
589
  },
@@ -600,7 +597,7 @@ function E({ id: s, value: l, onChange: u, onValueUpdate: d, options: f, placeho
600
597
  className: "h-4 w-4"
601
598
  }) : null
602
599
  }), /* @__PURE__ */ i("div", {
603
- className: "flex flex-col",
600
+ className: "flex w-full min-w-0 flex-col items-center",
604
601
  children: [/* @__PURE__ */ r("span", { children: t.label }), t.description == null ? null : /* @__PURE__ */ r("span", {
605
602
  "data-slot": "description",
606
603
  className: "text-xs text-muted-foreground",
@@ -624,206 +621,193 @@ function D({ compact: e = !1, ...t }) {
624
621
  return r(e ? E : T, { ...t });
625
622
  }
626
623
  D.displayName = "HourPickerField";
627
- function O({ id: n, placeholder: a, value: s, onValueUpdate: c, onCommit: u, options: d, selectedLabel: f, disabled: p, readOnly: m, open: g, setOpen: x, inputClassName: S, triggerTestId: w, isHydrated: T, highlightedValueRef: E, setHighlightedValue: D, markKeyboardNavigation: O, inputRef: k, onDraftValueHandlerChange: A }) {
628
- let j = t.useRef(!1), M = t.useRef(!1), N = t.useRef(!1), P = t.useRef(null), F = t.useRef(null), I = t.useRef(!1), [L, R] = t.useState(() => s || ""), [z, B] = t.useState(!1);
629
- t.useEffect(() => (A((e) => {
630
- R(e), B(!1);
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);
631
628
  }), () => {
632
- A(null);
633
- }), [A]);
634
- let V = t.useCallback((e) => {
635
- let t = E.current ?? s ?? "", 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);
636
633
  n === -1 && (n = e === 1 ? -1 : d.length);
637
634
  for (let t = n + e; t >= 0 && t < d.length; t += e) {
638
635
  let e = d[t];
639
636
  if (b(e)) {
640
- D(e.value), P.current = e.value, R(e.value), B(!1), c(e.value);
637
+ E(e.value), N.current = e.value, L(e.value), c(e.value);
641
638
  return;
642
639
  }
643
640
  }
644
641
  }, [
645
- E,
642
+ T,
646
643
  c,
647
644
  d,
648
- D,
645
+ E,
649
646
  s
650
647
  ]);
651
648
  t.useEffect(() => {
652
- j.current || (R(s || ""), B(!1));
649
+ A.current || L(s || "");
653
650
  }, [s]), t.useEffect(() => {
654
- F.current = _(L);
655
- }, [L]), t.useEffect(() => {
656
- s === null && (I.current = !1);
651
+ P.current = _(I);
652
+ }, [I]), t.useEffect(() => {
653
+ s === null && (F.current = !1);
657
654
  }, [s]);
658
- let H = s != null && f != null && !z, U = 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-[border-color,box-shadow]", !L && "text-muted-foreground", H && "text-transparent", g && "ring-2 ring-primary ring-offset-2", "[&_[data-slot='description']]:hidden", 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);
659
656
  return /* @__PURE__ */ i("div", {
660
657
  className: "relative",
661
- children: [
662
- /* @__PURE__ */ r(l, {
663
- id: n,
664
- "data-testid": w,
665
- "data-hydrated": T ? "true" : void 0,
666
- type: "text",
667
- disabled: p,
668
- readOnly: m,
669
- inputRef: k,
670
- autoComplete: "off",
671
- mask: [{
672
- mask: "00:00",
673
- lazy: !0
674
- }, {
675
- mask: "0:00",
676
- lazy: !0
677
- }],
678
- dispatch: (e, t) => {
679
- let n = (t.value + e).replace(/\D/g, "");
680
- if (n.length <= 2 || n.length >= 4) return t.compiledMasks[0];
681
- let r = h(Number(n.slice(0, 2)));
682
- return d.some((e) => e.value.startsWith(`${r}:`)) ? t.compiledMasks[0] : t.compiledMasks[1];
683
- },
684
- placeholder: a,
685
- value: L,
686
- className: U,
687
- onAccept: (e, t, n) => {
688
- if (!n) return;
689
- B(!0);
690
- let r = typeof e == "string" ? e : String(e ?? ""), i = r.replace(/\D/g, ""), a = _(r);
691
- if (F.current !== a) {
692
- if (F.current = a, R(r), i.length !== 0) {
693
- I.current = !1;
694
- return;
695
- }
696
- s && !I.current && (I.current = !0, u(null));
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 = v(r, d);
707
- if (!i) return;
708
- if (i.selectableValue) {
709
- if (D(i.selectableValue), R(i.selectableValue), B(!1), s === i.selectableValue) return;
710
- u(i.selectableValue);
728
+ if (e.key === "Escape") {
729
+ if (!m) return;
730
+ e.preventDefault(), g(!1);
711
731
  return;
712
732
  }
713
- let a = y(i.parsed);
714
- if (a == null) return;
715
- let o = C(a, d);
716
- o && D(o.value);
717
- },
718
- onPointerDown: () => {
719
- M.current = !0, !p && (g || x(!0));
720
- },
721
- onMouseDown: (e) => {
722
- M.current = !0, N.current = typeof document < "u" && document.activeElement === e.currentTarget, !p && (g || x(!0));
723
- },
724
- onClick: () => {
725
- p || g || x(!0);
726
- },
727
- onKeyDown: (e) => {
728
- if (!p) {
729
- if (e.key === "Tab" && g && !e.defaultPrevented) {
730
- x(!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 (!g) return;
735
- e.preventDefault(), x(!1);
736
- return;
737
- }
738
- if (!g && !e.defaultPrevented && (e.key.length === 1 || e.key === "Backspace" || e.key === "Delete") && !e.ctrlKey && !e.metaKey && !e.altKey && x(!0), e.key === "ArrowDown" || e.key === "ArrowUp") {
739
- if (O(), e.preventDefault(), !g) {
740
- x(!0);
741
- return;
742
- }
743
- V(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 = v(L, d);
749
- if (!t) {
750
- if (!g || L.trim() !== "") return;
751
- let t = d.find((e) => e.value === E.current), n = (b(t) ? t?.value : void 0) ?? d.find((e) => b(e))?.value;
752
- if (!n) return;
753
- e.preventDefault(), D(n), R(n), B(!1), u(n), x(!1);
754
- return;
755
- }
756
- if (t.selectableValue) {
757
- e.preventDefault(), D(t.selectableValue), R(t.selectableValue), B(!1), u(t.selectableValue), x(!1);
758
- return;
759
- }
760
- let n = y(t.parsed);
761
- if (n == null) return;
762
- let r = C(n, d);
763
- if (!r) return;
764
- e.preventDefault(), D(r.value), R(r.value), B(!1), u(r.value), x(!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 || g || x(!0);
776
- },
777
- onBlur: () => {
778
- j.current = !1, B(!1);
779
- let e = L.trim();
780
- if (!e) {
781
- R(s || "");
782
- return;
783
- }
784
- let t = v(e, d);
785
- if (!t) {
786
- R(s || "");
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);
787
760
  return;
788
761
  }
789
- if (!t.selectableValue) {
790
- R(s || "");
791
- return;
792
- }
793
- R(t.selectableValue), s !== t.selectableValue && u(t.selectableValue);
794
762
  }
795
- }),
796
- H ? /* @__PURE__ */ r("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 bg-background text-base text-foreground md:text-sm", p && "opacity-50"),
800
- children: /* @__PURE__ */ r("span", {
801
- className: "min-w-0 truncate",
802
- children: f
803
- })
804
- }) : null,
805
- /* @__PURE__ */ r("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": g ? "Close time picker" : "Open time picker",
812
- onPointerDown: (e) => {
813
- e.preventDefault();
814
- },
815
- onMouseDown: (e) => {
816
- e.preventDefault();
817
- },
818
- onClick: () => {
819
- p || x(!g);
820
- },
821
- children: /* @__PURE__ */ r(o, {
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
package/dist/index.d.ts CHANGED
@@ -2010,8 +2010,6 @@ declare type HeaderProps = {
2010
2010
  declare type HourPickerOption = {
2011
2011
  value: string;
2012
2012
  label: string;
2013
- selectedLabel?: React_2.ReactNode;
2014
- compactSelectedLabel?: React_2.ReactNode;
2015
2013
  disabled?: boolean;
2016
2014
  description?: React_2.ReactNode;
2017
2015
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loczer/storefront-sdk",
3
- "version": "0.196.0",
3
+ "version": "0.197.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"