asma-ui-core 3.87.3 → 3.87.5

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,123 +1,128 @@
1
- import { cn as p } from "../../../helpers/cn.js";
1
+ import { cn as h } from "../../../helpers/cn.js";
2
2
  import { resolveSx as S } from "../../../helpers/sx.js";
3
- import { CloseIcon as B } from "../../icons/close-icon/CloseIcon.js";
4
- import { registerOpenModalDialog as G } from "../../../hooks/useTopLayer.hook.js";
5
- import { StyledButton as L } from "../../inputs/button/StyledButton.js";
6
- import { useMobileMediaQuery as P } from "../../../hooks/useMediaQuery.hook.js";
7
- import Q from "./StyledDialog.module.js";
8
- import { useEffect as D, useLayoutEffect as $, useRef as i } from "react";
3
+ import { CloseIcon as X } from "../../icons/close-icon/CloseIcon.js";
4
+ import { registerOpenModalDialog as B } from "../../../hooks/useTopLayer.hook.js";
5
+ import { StyledButton as G } from "../../inputs/button/StyledButton.js";
6
+ import { useMobileMediaQuery as Q } from "../../../hooks/useMediaQuery.hook.js";
7
+ import $ from "./StyledDialog.module.js";
8
+ import { useEffect as w, useLayoutEffect as J, useRef as a } from "react";
9
9
  import { jsx as r, jsxs as l } from "react/jsx-runtime";
10
- var J = {
10
+ var U = {
11
11
  xs: 444,
12
12
  sm: 600,
13
13
  md: 900,
14
14
  lg: 1200,
15
15
  xl: 1536
16
- }, ne = ({ open: t, onClose: a, children: C, dataTest: c, maxWidth: h = "sm", fullWidth: H, fullScreen: _, scroll: M = "paper", disableEscapeKeyDown: y, className: j, style: R, sx: O, classes: w, PaperProps: W, slotProps: n, onCloseText: v, showCloseIcon: b = !0, dialogLabel: d, dialogTitle: s, dialogHeaderNode: I }) => {
17
- const z = P(), g = i(null), m = i(null), f = i(!1), k = i(t), o = _ ?? z;
18
- D(() => {
19
- k.current && !t && n?.transition?.onExited?.(), k.current = t;
20
- }, [t, n]), $(() => {
21
- const e = g.current;
16
+ }, oe = ({ open: t, onClose: c, children: C, dataTest: d, maxWidth: y = "sm", fullWidth: D, fullScreen: H, scroll: _ = "paper", disableEscapeKeyDown: M, className: j, style: O, sx: R, classes: v, PaperProps: W, slotProps: o, onCloseText: b, showCloseIcon: g = !0, dialogLabel: s, dialogTitle: m, dialogHeaderNode: I }) => {
17
+ const z = Q(), u = a(null), f = a(null), p = a(!1), k = a(t), i = H ?? z;
18
+ w(() => {
19
+ k.current && !t && o?.transition?.onExited?.(), k.current = t;
20
+ }, [t, o]), J(() => {
21
+ const e = u.current;
22
22
  if (!e || !t) return;
23
- e.open || (m.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.showModal(), e.focus({ preventScroll: !0 }), requestAnimationFrame(() => e.open && e.focus({ preventScroll: !0 })));
24
- const x = G(e);
23
+ e.open || (f.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.showModal(), e.focus({ preventScroll: !0 }), requestAnimationFrame(() => e.open && e.focus({ preventScroll: !0 })));
24
+ const n = B(e);
25
25
  return () => {
26
- x(), m.current?.isConnected && m.current.focus({ preventScroll: !0 });
26
+ n(), f.current?.isConnected && f.current.focus({ preventScroll: !0 });
27
27
  };
28
- }, [t]), D(() => {
28
+ }, [t]), w(() => {
29
29
  if (!t) return;
30
- const e = document.body.style.overflow, x = document.documentElement.style.overflow;
30
+ const e = document.body.style.overflow, n = document.documentElement.style.overflow;
31
31
  return document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden", () => {
32
- document.body.style.overflow = e, document.documentElement.style.overflow = x;
32
+ document.body.style.overflow = e, document.documentElement.style.overflow = n;
33
33
  };
34
34
  }, [t]);
35
- const u = {
35
+ const x = {
36
36
  ...W,
37
- ...n?.paper
38
- }, N = h === !1 ? void 0 : J[h], { className: q, style: A, onClick: F, ...K } = n?.backdrop ?? {}, E = (e) => {
39
- f.current || (f.current = !0, window.setTimeout(() => {
40
- f.current = !1;
41
- }, 0), a?.(e, "escapeKeyDown"));
42
- }, X = (e) => {
43
- e.preventDefault(), y || E(e);
37
+ ...o?.paper
38
+ }, E = y === !1 ? void 0 : U[y], { className: L, style: q, onClick: A, ...F } = o?.backdrop ?? {}, K = (e) => {
39
+ p.current || (p.current = !0, window.setTimeout(() => {
40
+ p.current = !1;
41
+ }, 0), c?.(e, "escapeKeyDown"));
42
+ }, P = (e) => {
43
+ e.preventDefault();
44
44
  };
45
- return t ? /* @__PURE__ */ l("dialog", {
46
- ref: g,
45
+ return w(() => {
46
+ if (!t || M) return;
47
+ const e = (n) => {
48
+ if (n.key !== "Escape" || n.defaultPrevented) return;
49
+ const N = document.activeElement;
50
+ N instanceof Element && N.closest("dialog[open]") !== u.current || K(n);
51
+ };
52
+ return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
53
+ }), t ? /* @__PURE__ */ l("dialog", {
54
+ ref: u,
47
55
  tabIndex: -1,
48
- "data-testid": c,
49
- "aria-label": c,
50
- onCancel: X,
51
- onKeyDown: (e) => {
52
- e.key !== "Escape" || y || (e.preventDefault(), E(e));
53
- },
54
- className: p(Q.StyledDialog, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none items-center justify-center overflow-hidden border-0 bg-transparent p-0 outline-none open:flex", M === "body" && "overflow-y-auto", j, w?.root),
56
+ "data-testid": d,
57
+ "aria-label": d,
58
+ onCancel: P,
59
+ className: h($.StyledDialog, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none items-center justify-center overflow-hidden border-0 bg-transparent p-0 outline-none open:flex", _ === "body" && "overflow-y-auto", j, v?.root),
55
60
  style: {
56
61
  zIndex: 999,
57
- ...S(O),
58
- ...R
62
+ ...S(R),
63
+ ...O
59
64
  },
60
65
  children: [/* @__PURE__ */ r("div", {
61
- ...K,
62
- className: p("absolute inset-0 bg-[#626e7eb2]", q),
63
- style: A,
66
+ ...F,
67
+ className: h("absolute inset-0 bg-[#626e7eb2]", L),
68
+ style: q,
64
69
  onClick: (e) => {
65
- F?.(e), e.defaultPrevented || a?.(e, "backdropClick");
70
+ A?.(e), e.defaultPrevented || c?.(e, "backdropClick");
66
71
  }
67
72
  }), /* @__PURE__ */ l("div", {
68
- className: p("relative z-[1] flex flex-col overflow-hidden rounded-lg border-0 bg-white p-0 text-delta-800 shadow-[0px_4px_40px_0px_#22213366]", o && "rounded-none", u.className, w?.paper),
73
+ className: h("relative z-[1] flex flex-col overflow-hidden rounded-lg border-0 bg-white p-0 text-delta-800 shadow-[0px_4px_40px_0px_#22213366]", i && "rounded-none", x.className, v?.paper),
69
74
  style: {
70
75
  minWidth: 0,
71
76
  minHeight: 0,
72
- ...!o && N ? { maxWidth: N } : {},
73
- ...o ? {
77
+ ...!i && E ? { maxWidth: E } : {},
78
+ ...i ? {
74
79
  width: "100%",
75
80
  maxWidth: "100%",
76
81
  height: "100%",
77
82
  maxHeight: "100%"
78
83
  } : {
79
- width: H ? "calc(100% - 64px)" : "auto",
84
+ width: D ? "calc(100% - 64px)" : "auto",
80
85
  maxHeight: "100%"
81
86
  },
82
- ...S(u.sx),
83
- ...u.style,
84
- ...o ? {
87
+ ...S(x.sx),
88
+ ...x.style,
89
+ ...i ? {
85
90
  width: "100%",
86
91
  maxWidth: "100%",
87
92
  height: "100%",
88
93
  maxHeight: "100%"
89
94
  } : { maxHeight: "calc(100% - 64px)" }
90
95
  },
91
- children: [(!!d || !!s || b) && /* @__PURE__ */ l("div", {
96
+ children: [(!!s || !!m || g) && /* @__PURE__ */ l("div", {
92
97
  className: "box-border flex w-full min-w-0 max-w-full justify-between px-4 pt-4",
93
98
  children: [/* @__PURE__ */ l("div", {
94
99
  className: "flex min-w-0 flex-1 flex-col justify-start gap-0.5",
95
- children: [d && /* @__PURE__ */ r("div", {
100
+ children: [s && /* @__PURE__ */ r("div", {
96
101
  className: "flex h-8 items-center text-sm font-normal leading-5 text-delta-600",
97
- children: d
98
- }), s && /* @__PURE__ */ r("div", {
99
- className: "flex text-2xl font-semibold leading-8 text-delta-800",
100
102
  children: s
103
+ }), m && /* @__PURE__ */ r("div", {
104
+ className: "flex text-2xl font-semibold leading-8 text-delta-800",
105
+ children: m
101
106
  })]
102
- }), b && /* @__PURE__ */ l("div", {
107
+ }), g && /* @__PURE__ */ l("div", {
103
108
  className: "flex min-w-0 max-w-full shrink-0 justify-end gap-2",
104
- children: [I, /* @__PURE__ */ r(L, {
105
- dataTest: `close-button-${c}`,
106
- "aria-label": v ? void 0 : "Close",
109
+ children: [I, /* @__PURE__ */ r(G, {
110
+ dataTest: `close-button-${d}`,
111
+ "aria-label": b ? void 0 : "Close",
107
112
  variant: "textGray",
108
113
  size: "small",
109
- endIcon: /* @__PURE__ */ r(B, {
114
+ endIcon: /* @__PURE__ */ r(X, {
110
115
  width: 20,
111
116
  height: 20
112
117
  }),
113
118
  className: "max-w-full shrink-0 whitespace-nowrap",
114
- onClick: (e) => a?.(e, "escapeKeyDown"),
119
+ onClick: (e) => c?.(e, "escapeKeyDown"),
115
120
  style: {
116
121
  color: "var(--colors-delta-800)",
117
122
  paddingRight: "6px",
118
123
  paddingLeft: "6px"
119
124
  },
120
- children: v
125
+ children: b
121
126
  })]
122
127
  })]
123
128
  }), C]
@@ -125,5 +130,5 @@ var J = {
125
130
  }) : null;
126
131
  };
127
132
  export {
128
- ne as StyledDialog
133
+ oe as StyledDialog
129
134
  };
@@ -1,28 +1,28 @@
1
1
  import { useMemo as m, useState as D } from "react";
2
- function w(a, c) {
2
+ function w(i, c) {
3
3
  const o = c.trim();
4
4
  if (o.length === 0) return !0;
5
5
  const r = o.replace(/^\+/, "").replace(/\D/g, "");
6
- return r.length === 0 && !new RegExp("\\p{L}", "u").test(o) || a.name.toLocaleLowerCase().includes(o.toLocaleLowerCase()) ? !0 : r.length > 0 && a.dialCode.startsWith(r);
6
+ return r.length === 0 && !new RegExp("\\p{L}", "u").test(o) || i.name.toLocaleLowerCase().includes(o.toLocaleLowerCase()) ? !0 : r.length > 0 && i.dialCode.startsWith(r);
7
7
  }
8
- function C({ countries: a, selectedIso2: c, query: o, listId: r, onSelect: v, onDismiss: b }) {
9
- const [p, s] = D(null), n = m(() => a.filter((e) => w(e, o)), [a, o]), i = p === null || n.length === 0 ? null : Math.max(n.findIndex((e) => e.iso2 === p), 0), k = (e) => `${r}-option-${e}`, g = (e) => {
8
+ function C({ countries: i, selectedIso2: c, query: o, listId: r, onSelect: b, onDismiss: v }) {
9
+ const [p, s] = D(null), n = m(() => i.filter((e) => w(e, o)), [i, o]), a = p === null || n.length === 0 ? null : Math.max(n.findIndex((e) => e.iso2 === p), 0), g = (e) => `${r}-option-${e}`, k = (e) => {
10
10
  const t = e === 1 ? n[0] : n[n.length - 1], l = n.find((d) => d.iso2 === c) ?? t;
11
11
  l !== void 0 && s(l.iso2);
12
12
  }, h = (e) => {
13
13
  if (n.length === 0) return;
14
- const t = n.findIndex((d) => d.iso2 === c), l = n[((i ?? (t >= 0 ? t : e === 1 ? -1 : 0)) + e + n.length) % n.length];
14
+ const t = n.findIndex((d) => d.iso2 === c), l = n[((a ?? (t >= 0 ? t : e === 1 ? -1 : 0)) + e + n.length) % n.length];
15
15
  l !== void 0 && s(l.iso2);
16
16
  }, u = (e, t = !0) => {
17
- t && s(null), v(e, t);
17
+ t && s(null), b(e, t);
18
18
  }, f = () => {
19
- s(null), b();
19
+ s(null), v();
20
20
  };
21
21
  return {
22
22
  visible: n,
23
- activeIndex: i,
24
- optionId: k,
25
- openWithKeyboard: g,
23
+ activeIndex: a,
24
+ optionId: g,
25
+ openWithKeyboard: k,
26
26
  select: u,
27
27
  dismiss: f,
28
28
  handleKeyDown: (e) => {
@@ -48,18 +48,18 @@ function C({ countries: a, selectedIso2: c, query: o, listId: r, onSelect: v, on
48
48
  case " ": {
49
49
  if (o !== "") break;
50
50
  e.preventDefault();
51
- const t = i === null ? void 0 : n[i];
51
+ const t = a === null ? void 0 : n[a];
52
52
  t !== void 0 && u(t.iso2, !1);
53
53
  break;
54
54
  }
55
55
  case "Enter": {
56
56
  e.preventDefault();
57
- const t = i === null ? void 0 : n[i];
57
+ const t = a === null ? void 0 : n[a];
58
58
  t !== void 0 && u(t.iso2);
59
59
  break;
60
60
  }
61
61
  case "Escape":
62
- e.preventDefault(), f();
62
+ e.preventDefault(), e.stopPropagation(), f();
63
63
  break;
64
64
  case "Tab":
65
65
  f();
@@ -8,16 +8,16 @@ import { StyledCheckbox as ae } from "../checkbox/base-ui/StyledCheckbox.js";
8
8
  import { TOP_LAYER_PROPS as ot, TOP_LAYER_RESET_STYLE as nt, getOpenModalDialogAncestor as at, shouldUsePopoverTopLayer as it, useTopLayerRef as ct } from "../../../hooks/useTopLayer.hook.js";
9
9
  import { LoadingIcon as dt } from "../../../table/shared-components/LoadingIcon.js";
10
10
  import z from "./StyledSelectAutocomplete.module.js";
11
- import { useEffect as ie, useMemo as W, useRef as ce, useState as D } from "react";
11
+ import { useEffect as ie, useMemo as W, useRef as ce, useState as v } from "react";
12
12
  import { jsx as o, jsxs as I } from "react/jsx-runtime";
13
13
  import { FloatingPortal as ut, autoUpdate as pt, flip as ft, offset as mt, shift as ht, size as bt, useDismiss as gt, useFloating as xt, useInteractions as wt, useMergeRefs as de, useRole as yt } from "@floating-ui/react";
14
- var kt = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), vt = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
15
- function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, getOptionLabel: pe, getOptionKey: C, isOptionEqualToValue: H, renderOption: U, renderValue: V, filterOptions: _, loading: B, loadingText: fe = "Loading…", noOptionsText: me = "No options", disabled: M, readOnly: g, error: he, helperText: be, size: ge = "small", disableClearable: xe, disableCloseOnSelect: we, popupIcon: ye, autoHeight: ke, multiple: ve, allowSelectAll: T, selectAllLabel: De = "Select all", fullWidth: Ie, classes: Ae, inputValue: R, onInputChange: Ne, open: Y, onOpen: Ce, onClose: Me, className: Re, wrapperClassName: Se, getOptionDisabled: $e, slotProps: q }) {
16
- const r = ve === !0, d = pe ?? kt, S = (e, t) => H ? H(e, t) : e === t, [Pe, Le] = D(!1), a = Y ?? Pe, u = (e) => {
14
+ var kt = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), Dt = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
15
+ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, getOptionLabel: pe, getOptionKey: C, isOptionEqualToValue: H, renderOption: U, renderValue: V, filterOptions: _, loading: B, loadingText: fe = "Loading…", noOptionsText: me = "No options", disabled: M, readOnly: g, error: he, helperText: be, size: ge = "small", disableClearable: xe, disableCloseOnSelect: we, popupIcon: ye, autoHeight: ke, multiple: De, allowSelectAll: T, selectAllLabel: ve = "Select all", fullWidth: Ie, classes: Ae, inputValue: R, onInputChange: Ne, open: Y, onOpen: Ce, onClose: Me, className: Re, wrapperClassName: Se, getOptionDisabled: Pe, slotProps: q }) {
16
+ const r = De === !0, d = pe ?? kt, S = (e, t) => H ? H(e, t) : e === t, [$e, Le] = v(!1), a = Y ?? $e, u = (e) => {
17
17
  e && (g || M) || (Y === void 0 && Le(e), e ? Ce?.() : (x(null), Me?.()));
18
- }, [Ee, G] = D(""), b = R ?? Ee, $ = (e, t, n) => {
18
+ }, [Ee, G] = v(""), b = R ?? Ee, P = (e, t, n) => {
19
19
  R === void 0 && G(t), Ne?.(e, t, n);
20
- }, [s, x] = D(null), J = `${l}-listbox`, Q = ce([]), X = ce(null), [_e, Fe] = D(null), [Z, Oe] = D(null), i = r ? Array.isArray(A) ? A : [] : [], w = r ? null : A ?? null, K = !r && w !== null ? d(w) : "";
20
+ }, [s, x] = v(null), J = `${l}-listbox`, Q = ce([]), X = ce(null), [_e, Fe] = v(null), [Z, Oe] = v(null), i = r ? Array.isArray(A) ? A : [] : [], w = r ? null : A ?? null, K = !r && w !== null ? d(w) : "";
21
21
  ie(() => {
22
22
  R !== void 0 || r || G(K);
23
23
  }, [
@@ -25,7 +25,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
25
25
  r,
26
26
  K
27
27
  ]);
28
- const F = (e) => r ? i.some((t) => S(e, t)) : w !== null && S(e, w), P = (e) => $e?.(e) ?? vt(e), ee = W(() => {
28
+ const F = (e) => r ? i.some((t) => S(e, t)) : w !== null && S(e, w), $ = (e) => Pe?.(e) ?? Dt(e), ee = W(() => {
29
29
  const e = [...p];
30
30
  if (_) return _(e, { inputValue: b });
31
31
  const t = !r && w !== null ? d(w).toLowerCase() : null;
@@ -37,7 +37,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
37
37
  b,
38
38
  _,
39
39
  A
40
- ]), f = W(() => ee.slice(0, 100), [ee]), te = f.flatMap((e, t) => P(e) ? [] : [t]), c = T && r ? [-1, ...te] : te, k = f.findIndex(F);
40
+ ]), f = W(() => ee.slice(0, 100), [ee]), te = f.flatMap((e, t) => $(e) ? [] : [t]), c = T && r ? [-1, ...te] : te, k = f.findIndex(F);
41
41
  ie(() => {
42
42
  if (!a) return;
43
43
  const e = s ?? k;
@@ -69,21 +69,21 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
69
69
  const n = c.indexOf(t ?? k);
70
70
  return n === -1 ? c[e === 1 ? 0 : c.length - 1] ?? null : c[Math.min(Math.max(n + e, 0), c.length - 1)] ?? null;
71
71
  });
72
- }, v = (e, t, n = !r || !we) => {
72
+ }, D = (e, t, n = !r || !we) => {
73
73
  if (r) {
74
74
  const m = i.some((h) => S(t, h)), y = m ? i.filter((h) => !S(t, h)) : [...i, t];
75
- N?.(e, y, m ? "removeOption" : "selectOption", { option: t }), $(e, "", "reset"), n && u(!1);
75
+ N?.(e, y, m ? "removeOption" : "selectOption", { option: t }), P(e, "", "reset"), n && u(!1);
76
76
  } else
77
- N?.(e, t, "selectOption", { option: t }), $(e, d(t), "reset"), n && u(!1);
77
+ N?.(e, t, "selectOption", { option: t }), P(e, d(t), "reset"), n && u(!1);
78
78
  }, se = (e) => {
79
- N?.(e, r ? [] : null, "clear", void 0), $(e, "", "clear");
79
+ N?.(e, r ? [] : null, "clear", void 0), P(e, "", "clear");
80
80
  }, j = (e) => {
81
81
  const t = p.length > 0 && i.length === p.length;
82
82
  N?.(e, t ? [] : p, t ? "clear" : "selectOption", void 0);
83
83
  }, Ye = (e) => {
84
84
  if (e.key === "Backspace" && b === "" && oe) {
85
85
  const t = i[i.length - 1];
86
- r ? t !== void 0 && v(e, t, !1) : se(e);
86
+ r ? t !== void 0 && D(e, t, !1) : se(e);
87
87
  } else if (e.key === "Enter" && !a)
88
88
  e.preventDefault(), u(!0);
89
89
  else if (e.key === "Enter" && s === -1)
@@ -91,7 +91,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
91
91
  else if (e.key === "Enter" && s != null && f[s] != null) {
92
92
  e.preventDefault();
93
93
  const t = f[s];
94
- P(t) || v(e, t, !0);
94
+ $(t) || D(e, t, !0);
95
95
  } else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
96
96
  if (e.preventDefault(), !a) {
97
97
  x(Be(e.key === "ArrowDown" ? 1 : -1)), u(!0);
@@ -105,8 +105,8 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
105
105
  else if (e.key === " " && s != null && f[s] != null) {
106
106
  e.preventDefault();
107
107
  const t = f[s];
108
- P(t) || v(e, t, !1);
109
- } else e.key === "Escape" ? (e.preventDefault(), u(!1)) : e.key === "Tab" && u(!1);
108
+ $(t) || D(e, t, !1);
109
+ } else e.key === "Escape" && a ? (e.preventDefault(), e.stopPropagation(), u(!1)) : e.key === "Tab" && u(!1);
110
110
  }, oe = !xe && !g && !M && (r ? i.length > 0 : w !== null);
111
111
  let ne;
112
112
  a && s != null && (s === -1 || f[s] !== void 0) && (ne = s === -1 ? `${l}-select-all` : `${l}-option-${s}`);
@@ -117,7 +117,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
117
117
  label: d(e),
118
118
  readOnly: g,
119
119
  deleteButtonTabIndex: -1,
120
- onDelete: g ? void 0 : (n) => v(n, e)
120
+ onDelete: g ? void 0 : (n) => D(n, e)
121
121
  }, C ? C(e) : `${d(e)}-${t}`)) : void 0, Je = /* @__PURE__ */ I("span", {
122
122
  className: "flex items-center gap-1",
123
123
  children: [
@@ -168,7 +168,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
168
168
  helperText: be,
169
169
  value: b,
170
170
  onChange: (e) => {
171
- x(null), $(e, e.target.value, "input"), a || u(!0);
171
+ x(null), P(e, e.target.value, "input"), a || u(!0);
172
172
  },
173
173
  onKeyDown: Ye,
174
174
  slotProps: {
@@ -220,11 +220,11 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
220
220
  ]
221
221
  }, m);
222
222
  }, Ke = (e, t) => {
223
- const n = P(e), m = {
223
+ const n = $(e), m = {
224
224
  ...He({
225
225
  onMouseDown: (h) => h.preventDefault(),
226
226
  onClick: (h) => {
227
- n || v(h, e);
227
+ n || D(h, e);
228
228
  },
229
229
  onMouseMove: () => x(null)
230
230
  }),
@@ -289,7 +289,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
289
289
  }),
290
290
  /* @__PURE__ */ o("span", {
291
291
  className: "flex-1 truncate py-2",
292
- children: De
292
+ children: ve
293
293
  })
294
294
  ]
295
295
  }), B ? /* @__PURE__ */ o("li", {
@@ -5,44 +5,44 @@ import { DatePickerInputIndex as y } from "./components/DatePickerInputIndex.js"
5
5
  import { useIsMobileView as x } from "../../hooks/useWindowWidthSize.hook.js";
6
6
  import { StyledDrawer as b } from "../../../components/navigation/drawer/StyledDrawer.js";
7
7
  import { useBackNavigationClose as h } from "../../hooks/useBackNavigationClose.hook.js";
8
- import { useEffect as C, useState as a } from "react";
9
- import { Fragment as E, jsx as t, jsxs as w } from "react/jsx-runtime";
10
- var L = (m) => {
11
- const s = x(), [e, i] = a(null), [p, d] = a(!1), [f, c] = a(!1), u = (r) => {
12
- i(r.currentTarget), P(r, d);
8
+ import { useEffect as C, useState as s } from "react";
9
+ import { Fragment as D, jsx as t, jsxs as E } from "react/jsx-runtime";
10
+ var L = (p) => {
11
+ const i = x(), [e, c] = s(null), [m, d] = s(!1), [f, l] = s(!1), u = (r) => {
12
+ c(r.currentTarget), P(r, d);
13
13
  }, o = () => {
14
- c(!0), i(null);
14
+ l(!0), c(null);
15
15
  };
16
16
  C(() => {
17
17
  if (!e) return;
18
- const r = (l) => {
19
- document.activeElement === e && (l.key === "Escape" || l.key === "Tab") && o();
18
+ const r = (n) => {
19
+ document.activeElement === e && (n.key === "Escape" ? (n.preventDefault(), n.stopPropagation(), o()) : n.key === "Tab" && o());
20
20
  };
21
21
  return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
22
22
  }, [e]), h({
23
23
  open: !!e,
24
24
  onClose: o
25
25
  });
26
- const n = {
27
- ...m,
26
+ const a = {
27
+ ...p,
28
28
  validateOnCalendarClose: f,
29
- onValidatedOnce: () => c(!1)
29
+ onValidatedOnce: () => l(!1)
30
30
  };
31
- return /* @__PURE__ */ w(E, { children: [
31
+ return /* @__PURE__ */ E(D, { children: [
32
32
  /* @__PURE__ */ t(y, {
33
- datePickerProps: n,
33
+ datePickerProps: a,
34
34
  onClick: u
35
35
  }),
36
- !s && /* @__PURE__ */ t(v, {
37
- datePickerProps: { ...n },
36
+ !i && /* @__PURE__ */ t(v, {
37
+ datePickerProps: { ...a },
38
38
  popoverProps: {
39
39
  open: !!e,
40
40
  anchorEl: e,
41
41
  onClose: o
42
42
  },
43
- positionAbove: p
43
+ positionAbove: m
44
44
  }),
45
- s && /* @__PURE__ */ t(b, {
45
+ i && /* @__PURE__ */ t(b, {
46
46
  anchor: "bottom",
47
47
  open: !!e,
48
48
  onClose: o,
@@ -50,7 +50,7 @@ var L = (m) => {
50
50
  children: /* @__PURE__ */ t("div", {
51
51
  className: "mx-auto max-w-[360px] px-2 pb-[max(1.5rem,env(safe-area-inset-bottom))]",
52
52
  children: /* @__PURE__ */ t(k, {
53
- datePickerProps: { ...n },
53
+ datePickerProps: { ...a },
54
54
  popoverProps: {
55
55
  open: !!e,
56
56
  anchorEl: e,
@@ -1,5 +1,5 @@
1
- import { useIsMobileView as O } from "../../hooks/useWindowWidthSize.hook.js";
2
- import { StyledDrawer as D } from "../../../components/navigation/drawer/StyledDrawer.js";
1
+ import { useIsMobileView as N } from "../../hooks/useWindowWidthSize.hook.js";
2
+ import { StyledDrawer as O } from "../../../components/navigation/drawer/StyledDrawer.js";
3
3
  import { useBackNavigationClose as I } from "../../hooks/useBackNavigationClose.hook.js";
4
4
  import { usePopupState as j } from "../../../hooks/usePopupState.js";
5
5
  import { ClickAwayListener as A } from "../../../components/mui-compat/ClickAwayListener.js";
@@ -7,97 +7,97 @@ import { TimePickerPanel as B } from "./components/TimePickerPanel.js";
7
7
  import { TimePickerPopper as M } from "./TimePickerPopper.js";
8
8
  import { getTimeFromValue as S } from "./helpers/getTimeFromValue.js";
9
9
  import { TimePickerInput as F } from "./TimePickerInput.js";
10
- import { useEffect as K, useState as v } from "react";
11
- import { jsx as o, jsxs as C } from "react/jsx-runtime";
12
- import { format as y, isBefore as q, isValid as z } from "date-fns";
13
- var te = (n) => {
14
- const { value: a, onSelect: r, notBeforeTime: u } = n, t = j({
10
+ import { useEffect as K, useState as y } from "react";
11
+ import { jsx as r, jsxs as C } from "react/jsx-runtime";
12
+ import { format as k, isBefore as q, isValid as z } from "date-fns";
13
+ var oe = (i) => {
14
+ const { value: a, onSelect: n, notBeforeTime: u } = i, o = j({
15
15
  variant: "popper",
16
16
  popupId: "time-picker-popper"
17
- }), c = O();
17
+ }), c = N();
18
18
  I({
19
- open: c && t.isOpen,
20
- onClose: t.close
19
+ open: c && o.isOpen,
20
+ onClose: o.close
21
21
  });
22
- const { isOpen: k, anchorEl: V, close: w } = t;
22
+ const { isOpen: V, anchorEl: w, close: p } = o;
23
23
  K(() => {
24
- if (!k || c) return;
25
- const e = (i) => {
26
- V?.contains(document.activeElement) && (i.key === "Escape" || i.key === "Tab") && w();
24
+ if (!V || c) return;
25
+ const e = (t) => {
26
+ w?.contains(document.activeElement) && (t.key === "Escape" ? (t.preventDefault(), t.stopPropagation(), p()) : t.key === "Tab" && p());
27
27
  };
28
28
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
29
29
  }, [
30
- k,
31
30
  V,
32
31
  w,
32
+ p,
33
33
  c
34
34
  ]);
35
- const E = a ? y(a, "HH:mm") : "", [b, m] = v(E), [g, l] = v(!1), [H, s] = v(!0), p = g ? b : E, f = (e) => !e || !u || !z(u) || !q(e, u), x = p.length === 5 ? S(p, a) : null, L = x ? f(x) : !0, N = (e) => {
36
- const i = e.target.value;
37
- if (l(!0), m(i), i.length !== 5) {
35
+ const E = a ? k(a, "HH:mm") : "", [b, m] = y(E), [g, l] = y(!1), [D, s] = y(!0), f = g ? b : E, d = (e) => !e || !u || !z(u) || !q(e, u), x = f.length === 5 ? S(f, a) : null, H = x ? d(x) : !0, L = (e) => {
36
+ const t = e.target.value;
37
+ if (l(!0), m(t), t.length !== 5) {
38
38
  s(!1);
39
39
  return;
40
40
  }
41
- const h = S(i, a);
42
- if (!h) {
43
- r(void 0), s(!1);
41
+ const v = S(t, a);
42
+ if (!v) {
43
+ n(void 0), s(!1);
44
44
  return;
45
45
  }
46
- s(!0), f(h) ? (r(h), l(!1), t.close()) : r(void 0);
47
- }, T = (e) => {
48
- if (s(!0), f(e)) {
49
- r(e), m(e ? y(e, "HH:mm") : ""), l(!1);
46
+ s(!0), d(v) ? (n(v), l(!1), o.close()) : n(void 0);
47
+ }, P = (e) => {
48
+ if (s(!0), d(e)) {
49
+ n(e), m(e ? k(e, "HH:mm") : ""), l(!1);
50
50
  return;
51
51
  }
52
- r(void 0), m(e ? y(e, "HH:mm") : ""), l(!0);
53
- }, P = () => {
54
- r(void 0), m(""), l(!1), s(!0);
55
- }, d = /* @__PURE__ */ o(F, {
56
- ...n,
57
- popupState: t,
58
- localValue: p,
59
- isValidTime: H,
60
- isValidEndTime: L,
61
- handleChange: N
52
+ n(void 0), m(e ? k(e, "HH:mm") : ""), l(!0);
53
+ }, T = () => {
54
+ n(void 0), m(""), l(!1), s(!0);
55
+ }, h = /* @__PURE__ */ r(F, {
56
+ ...i,
57
+ popupState: o,
58
+ localValue: f,
59
+ isValidTime: D,
60
+ isValidEndTime: H,
61
+ handleChange: L
62
62
  });
63
- return n.disabled || n.readOnly ? d : c ? /* @__PURE__ */ C("div", {
63
+ return i.disabled || i.readOnly ? h : c ? /* @__PURE__ */ C("div", {
64
64
  className: "relative h-auto w-auto",
65
- children: [/* @__PURE__ */ o("div", {
65
+ children: [/* @__PURE__ */ r("div", {
66
66
  className: "m-0 flex h-fit items-center justify-center p-0",
67
- children: d
68
- }), /* @__PURE__ */ o(D, {
67
+ children: h
68
+ }), /* @__PURE__ */ r(O, {
69
69
  anchor: "bottom",
70
- open: t.isOpen,
71
- onClose: t.close,
72
- anchorEl: t.anchorEl,
73
- children: /* @__PURE__ */ o("div", {
70
+ open: o.isOpen,
71
+ onClose: o.close,
72
+ anchorEl: o.anchorEl,
73
+ children: /* @__PURE__ */ r("div", {
74
74
  className: "mx-auto w-full max-w-[360px] px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2",
75
- children: /* @__PURE__ */ o(B, {
76
- dataTest: n.dataTest,
75
+ children: /* @__PURE__ */ r(B, {
76
+ dataTest: i.dataTest,
77
77
  value: a,
78
- onSelect: T,
79
- handleClear: P,
80
- onConfirm: t.close
78
+ onSelect: P,
79
+ handleClear: T,
80
+ onConfirm: o.close
81
81
  })
82
82
  })
83
83
  })]
84
- }) : /* @__PURE__ */ o(A, {
84
+ }) : /* @__PURE__ */ r(A, {
85
85
  mouseEvent: "onMouseDown",
86
- onClickAway: t.close,
86
+ onClickAway: o.close,
87
87
  children: /* @__PURE__ */ C("div", {
88
88
  className: "relative h-auto w-auto",
89
- children: [/* @__PURE__ */ o("div", {
89
+ children: [/* @__PURE__ */ r("div", {
90
90
  className: "m-0 flex h-fit items-center justify-center p-0",
91
- children: d
92
- }), t.isOpen && /* @__PURE__ */ o(M, {
93
- ...n,
94
- popupState: t,
95
- handleClear: P,
96
- onSelect: T
91
+ children: h
92
+ }), o.isOpen && /* @__PURE__ */ r(M, {
93
+ ...i,
94
+ popupState: o,
95
+ handleClear: T,
96
+ onSelect: P
97
97
  })]
98
98
  })
99
99
  });
100
100
  };
101
101
  export {
102
- te as StyledTimePicker
102
+ oe as StyledTimePicker
103
103
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.87.3",
6
+ "version": "3.87.5",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",