asma-ui-core 3.108.2 → 3.108.3

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,53 +1,59 @@
1
- import { cn as s } from "../../../../helpers/cn.js";
2
- import { firstTabbable as A } from "../../../../helpers/focusable.js";
1
+ import { cn as a } from "../../../../helpers/cn.js";
2
+ import { firstTabbable as O } from "../../../../helpers/focusable.js";
3
3
  import { StyledTooltip as te } from "../../../data-display/tooltip/StyledTooltip.js";
4
- import { DialogBusyContext as $, useDialogBusyBoundary as ie } from "../../dialog/DialogBusyContext.js";
4
+ import { DialogBusyContext as A, useDialogBusyBoundary as ie } from "../../dialog/DialogBusyContext.js";
5
5
  import { useMobileMediaQuery as le } from "../../../../hooks/useMediaQuery.hook.js";
6
- import { useFocusTrap as ne } from "../../../../hooks/useFocusTrap.hook.js";
7
- import { CloseBtn as O } from "../components/CloseBtn.js";
8
- import { MinimizeBtn as V } from "../components/MinimizeBtn.js";
9
- import { FullScreenBtn as oe } from "../components/FullscreenBtn.js";
10
- import v from "./MinimizableDialogV2.module.js";
11
- import { useTranslations as re } from "./useTranslations.js";
12
- import { useControlledProps as se } from "./useControlledProps.js";
13
- import ce from "clsx";
14
- import { useId as q, useLayoutEffect as H, useRef as c } from "react";
15
- import { Fragment as ae, jsx as e, jsxs as n } from "react/jsx-runtime";
16
- var Se = (N) => {
17
- const { showCloseIcon: R = !0, showMinimizeIcon: L = !0, showExpandIcon: W = !0, enableFullscreen: _ = !0, title: u, label: f, children: Q, open: o, onClose: U, classNameOverrides: h = {
6
+ import { OverlayBackOwnerContext as ne, useBackCloses as oe } from "../../../../hooks/useBackCloses.hook.js";
7
+ import { useFocusTrap as re } from "../../../../hooks/useFocusTrap.hook.js";
8
+ import { CloseBtn as $ } from "../components/CloseBtn.js";
9
+ import { MinimizeBtn as q } from "../components/MinimizeBtn.js";
10
+ import { FullScreenBtn as se } from "../components/FullscreenBtn.js";
11
+ import h from "./MinimizableDialogV2.module.js";
12
+ import { useTranslations as ce } from "./useTranslations.js";
13
+ import { useControlledProps as ae } from "./useControlledProps.js";
14
+ import de from "clsx";
15
+ import { useId as V, useLayoutEffect as H, useRef as d } from "react";
16
+ import { Fragment as me, jsx as e, jsxs as r } from "react/jsx-runtime";
17
+ var Te = (C) => {
18
+ const { showCloseIcon: R = !0, showMinimizeIcon: L = !0, showExpandIcon: W = !0, enableFullscreen: _ = !0, title: u, label: f, children: Q, open: i, onClose: U, classNameOverrides: b = {
18
19
  maximized: "",
19
20
  minimized: "",
20
21
  fullscreen: ""
21
- }, dataTest: G, actionNode: J, locale: K = "en", busyReason: X, style: C, initialFocusRef: S } = N, r = le(), i = re(K), a = c(null), p = c(null), F = c(null), T = c(null), b = c(!1), g = c(null), x = q(), I = q(), { minimized: t, setMinimized: M, fullScreen: l, setFullScreen: B } = se(N), d = l && !t, { busy: y, busyReason: E, contextValue: j } = ie(X ?? i.waitUntilSaved), z = () => {
22
- y || (M(!1), U());
22
+ }, dataTest: G, actionNode: J, locale: K = "en", busyReason: X, style: N, initialFocusRef: S } = C, s = le(), l = ce(K), n = d(null), p = d(null), F = d(null), B = d(null), g = d(!1), y = d(null), x = V(), T = V(), { minimized: t, setMinimized: I, fullScreen: o, setFullScreen: M } = ae(C), c = o && !t, { busy: z, busyReason: k, contextValue: E } = ie(X ?? l.waitUntilSaved), v = () => {
23
+ if (z) return !1;
24
+ I(!1), U();
23
25
  };
24
26
  H(() => {
25
- a.current?.toggleAttribute("inert", t), p.current?.toggleAttribute("inert", !t);
27
+ n.current?.toggleAttribute("inert", t), p.current?.toggleAttribute("inert", !t);
26
28
  }, [t]), H(() => {
27
- const w = o && !b.current, m = !o && b.current;
28
- if (b.current = o, m) {
29
- const P = g.current;
30
- g.current = null, (!document.activeElement || document.activeElement === document.body) && P?.isConnected && P.focus({ preventScroll: !0 });
29
+ const w = i && !g.current, m = !i && g.current;
30
+ if (g.current = i, m) {
31
+ const D = y.current;
32
+ y.current = null, (!document.activeElement || document.activeElement === document.body) && D?.isConnected && D.focus({ preventScroll: !0 });
31
33
  return;
32
34
  }
33
35
  if (!w) return;
34
- g.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
35
- const D = t ? p.current : a.current, ee = t ? T.current : F.current;
36
- (S?.current ?? ee ?? (D ? A(D) : void 0))?.focus({ preventScroll: !0 });
36
+ y.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
37
+ const P = t ? p.current : n.current, ee = t ? B.current : F.current;
38
+ (S?.current ?? ee ?? (P ? O(P) : void 0))?.focus({ preventScroll: !0 });
37
39
  }, [
38
40
  S,
39
41
  t,
40
- o
42
+ i
41
43
  ]);
42
- const k = () => {
43
- const w = t ? a : p;
44
- M(!t), requestAnimationFrame(() => {
44
+ const j = () => {
45
+ const w = t ? n : p;
46
+ I(!t), requestAnimationFrame(() => {
45
47
  const m = w.current;
46
- m && (m.querySelector('[data-testid="toggle-minimize-btn"]') ?? A(m))?.focus({ preventScroll: !0 });
48
+ m && (m.querySelector('[data-testid="toggle-minimize-btn"]') ?? O(m))?.focus({ preventScroll: !0 });
47
49
  });
48
50
  };
49
- ne(o && d, a, z);
50
- const Y = d ? r ? {
51
+ re(i && c, n, v), oe({
52
+ active: i && c,
53
+ requestClose: v,
54
+ ownerRef: n
55
+ });
56
+ const Y = c ? s ? {
51
57
  inset: 0,
52
58
  maxHeight: "100dvh",
53
59
  maxWidth: "100dvw",
@@ -64,18 +70,18 @@ var Se = (N) => {
64
70
  maxWidth: "min(1000px, calc(100vw - 32px))",
65
71
  height: "95dvh"
66
72
  } : void 0;
67
- if (!o) return null;
68
- const Z = f ? `${I} ${x}` : x;
69
- return /* @__PURE__ */ n(ae, { children: [
73
+ if (!i) return null;
74
+ const Z = f ? `${T} ${x}` : x;
75
+ return /* @__PURE__ */ r(me, { children: [
70
76
  /* @__PURE__ */ e("div", {
71
77
  ref: p,
72
78
  style: {
73
79
  zIndex: 51,
74
- ...C
80
+ ...N
75
81
  },
76
- className: s(v["minimized-dialog"], !t && v.hidden, h.minimized),
77
- children: /* @__PURE__ */ n("div", {
78
- className: ce("flex items-center justify-between", !t && "hidden"),
82
+ className: a(h["minimized-dialog"], !t && h.hidden, b.minimized),
83
+ children: /* @__PURE__ */ r("div", {
84
+ className: de("flex items-center justify-between", !t && "hidden"),
79
85
  "data-testid": G,
80
86
  children: [/* @__PURE__ */ e("div", {
81
87
  className: "max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
@@ -87,97 +93,100 @@ var Se = (N) => {
87
93
  children: u
88
94
  })
89
95
  })
90
- }), /* @__PURE__ */ n("div", {
96
+ }), /* @__PURE__ */ r("div", {
91
97
  className: "flex items-center gap-x-1",
92
- children: [/* @__PURE__ */ e(V, {
98
+ children: [/* @__PURE__ */ e(q, {
93
99
  type: "expand",
94
100
  visibility: W,
95
- onClick: k,
96
- tooltipTitle: i.expand
97
- }), /* @__PURE__ */ e(O, {
98
- buttonRef: T,
101
+ onClick: j,
102
+ tooltipTitle: l.expand
103
+ }), /* @__PURE__ */ e($, {
104
+ buttonRef: B,
99
105
  showCloseIcon: R,
100
- onClick: z,
101
- disabledReason: y ? E : void 0,
102
- tooltipTitle: i.close
106
+ onClick: v,
107
+ disabledReason: z ? k : void 0,
108
+ tooltipTitle: l.close
103
109
  })]
104
110
  })]
105
111
  })
106
112
  }),
107
- d && /* @__PURE__ */ e("div", {
113
+ c && /* @__PURE__ */ e("div", {
108
114
  className: "fixed inset-0 z-[52] bg-[rgb(98,110,126)] bg-opacity-70",
109
115
  onClick: () => {
110
- B(!1);
116
+ M(!1);
111
117
  }
112
118
  }),
113
- /* @__PURE__ */ n("div", {
119
+ /* @__PURE__ */ e("div", {
114
120
  style: {
115
121
  zIndex: 51,
116
- ...C,
122
+ ...N,
117
123
  ...Y
118
124
  },
119
- ref: a,
125
+ ref: n,
120
126
  role: "dialog",
121
- "aria-modal": d ? !0 : void 0,
127
+ "aria-modal": c ? !0 : void 0,
122
128
  "aria-labelledby": Z,
123
- className: s(v.dialog, t && v.hidden, !l && h.maximized, l && h.fullscreen, d && "fixed z-[53] duration-0"),
124
- children: [/* @__PURE__ */ n("div", {
125
- className: s("flex flex-col border-b-[1px] border-delta-200 px-4", r ? "py-3" : "py-4"),
126
- children: [/* @__PURE__ */ n("div", {
127
- className: "flex items-center justify-between",
128
- children: [f ? /* @__PURE__ */ e("div", {
129
- id: I,
130
- className: "text-sm text-delta-700",
131
- children: f
132
- }) : /* @__PURE__ */ e("div", {
129
+ className: a(h.dialog, t && h.hidden, !o && b.maximized, o && b.fullscreen, c && "fixed z-[53] duration-0"),
130
+ children: /* @__PURE__ */ r(ne.Provider, {
131
+ value: n,
132
+ children: [/* @__PURE__ */ r("div", {
133
+ className: a("flex flex-col border-b-[1px] border-delta-200 px-4", s ? "py-3" : "py-4"),
134
+ children: [/* @__PURE__ */ r("div", {
135
+ className: "flex items-center justify-between",
136
+ children: [f ? /* @__PURE__ */ e("div", {
137
+ id: T,
138
+ className: "text-sm text-delta-700",
139
+ children: f
140
+ }) : /* @__PURE__ */ e("div", {
141
+ id: x,
142
+ className: a("font-semibold text-delta-800", s ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
143
+ children: u
144
+ }), /* @__PURE__ */ r("div", {
145
+ className: "flex items-center gap-x-1",
146
+ children: [
147
+ /* @__PURE__ */ e(A.Provider, {
148
+ value: E,
149
+ children: J
150
+ }),
151
+ /* @__PURE__ */ e(q, {
152
+ visibility: L && !s && !o,
153
+ type: "minimize",
154
+ onClick: j,
155
+ tooltipTitle: l.minimize
156
+ }),
157
+ /* @__PURE__ */ e(se, {
158
+ showFullScreenIcon: _ && !s,
159
+ fullScreen: o,
160
+ onClick: () => {
161
+ M(!o);
162
+ },
163
+ tooltipTitle: o ? l.exitFullscreen : l.fullscreen
164
+ }),
165
+ /* @__PURE__ */ e($, {
166
+ buttonRef: F,
167
+ showCloseIcon: R,
168
+ onClick: v,
169
+ disabledReason: z ? k : void 0,
170
+ tooltipTitle: l.close
171
+ })
172
+ ]
173
+ })]
174
+ }), f && /* @__PURE__ */ e("div", {
133
175
  id: x,
134
- className: s("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
176
+ className: a("font-semibold text-delta-800", s ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
135
177
  children: u
136
- }), /* @__PURE__ */ n("div", {
137
- className: "flex items-center gap-x-1",
138
- children: [
139
- /* @__PURE__ */ e($.Provider, {
140
- value: j,
141
- children: J
142
- }),
143
- /* @__PURE__ */ e(V, {
144
- visibility: L && !r && !l,
145
- type: "minimize",
146
- onClick: k,
147
- tooltipTitle: i.minimize
148
- }),
149
- /* @__PURE__ */ e(oe, {
150
- showFullScreenIcon: _ && !r,
151
- fullScreen: l,
152
- onClick: () => {
153
- B(!l);
154
- },
155
- tooltipTitle: l ? i.exitFullscreen : i.fullscreen
156
- }),
157
- /* @__PURE__ */ e(O, {
158
- buttonRef: F,
159
- showCloseIcon: R,
160
- onClick: z,
161
- disabledReason: y ? E : void 0,
162
- tooltipTitle: i.close
163
- })
164
- ]
165
178
  })]
166
- }), f && /* @__PURE__ */ e("div", {
167
- id: x,
168
- className: s("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
169
- children: u
179
+ }), /* @__PURE__ */ e("div", {
180
+ className: a(t && "hidden", "flex flex-grow flex-col overflow-y-auto overscroll-contain"),
181
+ children: /* @__PURE__ */ e(A.Provider, {
182
+ value: E,
183
+ children: Q
184
+ })
170
185
  })]
171
- }), /* @__PURE__ */ e("div", {
172
- className: s(t && "hidden", "flex flex-grow flex-col overflow-y-auto overscroll-contain"),
173
- children: /* @__PURE__ */ e($.Provider, {
174
- value: j,
175
- children: Q
176
- })
177
- })]
186
+ })
178
187
  })
179
188
  ] });
180
189
  };
181
190
  export {
182
- Se as MinimizableDialogV2
191
+ Te as MinimizableDialogV2
183
192
  };
@@ -1,39 +1,35 @@
1
- import { setPickerPosition as P } from "./helpers.js";
1
+ import { setPickerPosition as u } from "./helpers.js";
2
2
  import { StyledDayPicker as k } from "./components/StyledDayPicker.js";
3
- import { StyledCalendarPicker as v } from "./components/StyledCalendarPicker.js";
4
- import { DatePickerInputIndex as y } from "./components/DatePickerInputIndex.js";
3
+ import { StyledCalendarPicker as y } from "./components/StyledCalendarPicker.js";
4
+ import { DatePickerInputIndex as v } 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
- import { useBackNavigationClose as h } from "../../hooks/useBackNavigationClose.hook.js";
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);
7
+ import { useEffect as h, useState as s } from "react";
8
+ import { Fragment as C, jsx as t, jsxs as D } from "react/jsx-runtime";
9
+ var j = (p) => {
10
+ const i = x(), [e, c] = s(null), [m, d] = s(!1), [f, l] = s(!1), P = (r) => {
11
+ c(r.currentTarget), u(r, d);
13
12
  }, o = () => {
14
13
  l(!0), c(null);
15
14
  };
16
- C(() => {
15
+ h(() => {
17
16
  if (!e) return;
18
17
  const r = (n) => {
19
18
  document.activeElement === e && (n.key === "Escape" ? (n.preventDefault(), n.stopPropagation(), o()) : n.key === "Tab" && o());
20
19
  };
21
20
  return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
22
- }, [e]), h({
23
- open: !!e,
24
- onClose: o
25
- });
21
+ }, [e]);
26
22
  const a = {
27
23
  ...p,
28
24
  validateOnCalendarClose: f,
29
25
  onValidatedOnce: () => l(!1)
30
26
  };
31
- return /* @__PURE__ */ E(D, { children: [
32
- /* @__PURE__ */ t(y, {
27
+ return /* @__PURE__ */ D(C, { children: [
28
+ /* @__PURE__ */ t(v, {
33
29
  datePickerProps: a,
34
- onClick: u
30
+ onClick: P
35
31
  }),
36
- !i && /* @__PURE__ */ t(v, {
32
+ !i && /* @__PURE__ */ t(y, {
37
33
  datePickerProps: { ...a },
38
34
  popoverProps: {
39
35
  open: !!e,
@@ -62,5 +58,5 @@ var L = (p) => {
62
58
  ] });
63
59
  };
64
60
  export {
65
- L as StyledDatePicker
61
+ j as StyledDatePicker
66
62
  };
@@ -1,110 +1,104 @@
1
- import { useIsMobileView as I } from "../../hooks/useWindowWidthSize.hook.js";
2
- import { StyledDrawer as j } from "../../../components/navigation/drawer/StyledDrawer.js";
3
- import { useBackNavigationClose as M } from "../../hooks/useBackNavigationClose.hook.js";
4
- import { usePopupState as A } from "../../../hooks/usePopupState.js";
5
- import { ClickAwayListener as F } from "../../../components/mui-compat/ClickAwayListener.js";
6
- import { isBeforeMinTime as V } from "./helpers/minTime.js";
7
- import { TimePickerPanel as K } from "./components/TimePickerPanel.js";
8
- import { TimePickerPopper as q } from "./TimePickerPopper.js";
9
- import { getTimeFromValue as g } from "./helpers/getTimeFromValue.js";
10
- import { TimePickerInput as z } from "./TimePickerInput.js";
11
- import { useEffect as G, useState as w } from "react";
1
+ import { useIsMobileView as j } from "../../hooks/useWindowWidthSize.hook.js";
2
+ import { StyledDrawer as B } from "../../../components/navigation/drawer/StyledDrawer.js";
3
+ import { usePopupState as M } from "../../../hooks/usePopupState.js";
4
+ import { ClickAwayListener as A } from "../../../components/mui-compat/ClickAwayListener.js";
5
+ import { isBeforeMinTime as k } from "./helpers/minTime.js";
6
+ import { TimePickerPanel as F } from "./components/TimePickerPanel.js";
7
+ import { TimePickerPopper as K } from "./TimePickerPopper.js";
8
+ import { getTimeFromValue as C } from "./helpers/getTimeFromValue.js";
9
+ import { TimePickerInput as q } from "./TimePickerInput.js";
10
+ import { useEffect as z, useState as w } from "react";
12
11
  import { jsx as r, jsxs as D } from "react/jsx-runtime";
13
- import { format as E, isBefore as J, isValid as Q } from "date-fns";
14
- var ne = (i) => {
15
- const { value: l, onSelect: n, notBeforeTime: d, minTime: c } = i, o = A({
12
+ import { format as E, isBefore as G, isValid as J } from "date-fns";
13
+ var re = (i) => {
14
+ const { value: l, onSelect: n, notBeforeTime: p, minTime: c } = i, t = M({
16
15
  variant: "popper",
17
16
  popupId: "time-picker-popper"
18
- }), m = I();
19
- M({
20
- open: m && o.isOpen,
21
- onClose: o.close
22
- });
23
- const { isOpen: x, anchorEl: P, close: h } = o;
24
- G(() => {
25
- if (!x || m) return;
26
- const e = (t) => {
27
- P?.contains(document.activeElement) && (t.key === "Escape" ? (t.preventDefault(), t.stopPropagation(), h()) : t.key === "Tab" && h());
17
+ }), d = j(), { isOpen: x, anchorEl: P, close: h } = t;
18
+ z(() => {
19
+ if (!x || d) return;
20
+ const e = (o) => {
21
+ P?.contains(document.activeElement) && (o.key === "Escape" ? (o.preventDefault(), o.stopPropagation(), h()) : o.key === "Tab" && h());
28
22
  };
29
23
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
30
24
  }, [
31
25
  x,
32
26
  P,
33
27
  h,
34
- m
28
+ d
35
29
  ]);
36
- const T = l ? E(l, "HH:mm") : "", [H, u] = w(T), [S, a] = w(!1), [L, s] = w(!0), v = S ? H : T, y = (e) => !e || !d || !Q(d) || !J(e, d), f = v.length === 5 ? g(v, l) : null, N = f ? y(f) : !0, O = (e) => {
37
- const t = e.target.value;
38
- if (a(!0), u(t), t.length !== 5) {
30
+ const T = l ? E(l, "HH:mm") : "", [H, m] = w(T), [S, a] = w(!1), [L, s] = w(!0), v = S ? H : T, y = (e) => !e || !p || !J(p) || !G(e, p), u = v.length === 5 ? C(v, l) : null, I = u ? y(u) : !0, N = (e) => {
31
+ const o = e.target.value;
32
+ if (a(!0), m(o), o.length !== 5) {
39
33
  s(!1);
40
34
  return;
41
35
  }
42
- const p = g(t, l);
43
- if (!p) {
36
+ const f = C(o, l);
37
+ if (!f) {
44
38
  n(void 0), s(!1);
45
39
  return;
46
40
  }
47
- s(!0), !V(p, c) && (y(p) ? (n(p), a(!1), o.close()) : n(void 0));
48
- }, C = (e) => {
49
- if (!(e && V(e, c))) {
41
+ s(!0), !k(f, c) && (y(f) ? (n(f), a(!1), t.close()) : n(void 0));
42
+ }, b = (e) => {
43
+ if (!(e && k(e, c))) {
50
44
  if (s(!0), y(e)) {
51
- n(e), u(e ? E(e, "HH:mm") : ""), a(!1);
45
+ n(e), m(e ? E(e, "HH:mm") : ""), a(!1);
52
46
  return;
53
47
  }
54
- n(void 0), u(e ? E(e, "HH:mm") : ""), a(!0);
48
+ n(void 0), m(e ? E(e, "HH:mm") : ""), a(!0);
55
49
  }
56
- }, B = () => {
57
- S && f && V(f, c) && a(!1);
58
- }, b = () => {
59
- n(void 0), u(""), a(!1), s(!0);
60
- }, k = /* @__PURE__ */ r(z, {
50
+ }, O = () => {
51
+ S && u && k(u, c) && a(!1);
52
+ }, g = () => {
53
+ n(void 0), m(""), a(!1), s(!0);
54
+ }, V = /* @__PURE__ */ r(q, {
61
55
  ...i,
62
- popupState: o,
56
+ popupState: t,
63
57
  localValue: v,
64
58
  isValidTime: L,
65
- isValidEndTime: N,
66
- handleChange: O,
67
- handleBlur: B
59
+ isValidEndTime: I,
60
+ handleChange: N,
61
+ handleBlur: O
68
62
  });
69
- return i.disabled || i.readOnly ? k : m ? /* @__PURE__ */ D("div", {
63
+ return i.disabled || i.readOnly ? V : d ? /* @__PURE__ */ D("div", {
70
64
  className: "relative h-auto w-auto",
71
65
  children: [/* @__PURE__ */ r("div", {
72
66
  className: "m-0 flex h-fit items-center justify-center p-0",
73
- children: k
74
- }), /* @__PURE__ */ r(j, {
67
+ children: V
68
+ }), /* @__PURE__ */ r(B, {
75
69
  anchor: "bottom",
76
- open: o.isOpen,
77
- onClose: o.close,
78
- anchorEl: o.anchorEl,
70
+ open: t.isOpen,
71
+ onClose: t.close,
72
+ anchorEl: t.anchorEl,
79
73
  children: /* @__PURE__ */ r("div", {
80
74
  className: "mx-auto w-full max-w-[360px] px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2",
81
- children: /* @__PURE__ */ r(K, {
75
+ children: /* @__PURE__ */ r(F, {
82
76
  dataTest: i.dataTest,
83
77
  value: l,
84
78
  minTime: c,
85
- onSelect: C,
86
- handleClear: b,
87
- onConfirm: o.close
79
+ onSelect: b,
80
+ handleClear: g,
81
+ onConfirm: t.close
88
82
  })
89
83
  })
90
84
  })]
91
- }) : /* @__PURE__ */ r(F, {
85
+ }) : /* @__PURE__ */ r(A, {
92
86
  mouseEvent: "onMouseDown",
93
- onClickAway: o.close,
87
+ onClickAway: t.close,
94
88
  children: /* @__PURE__ */ D("div", {
95
89
  className: "relative h-auto w-auto",
96
90
  children: [/* @__PURE__ */ r("div", {
97
91
  className: "m-0 flex h-fit items-center justify-center p-0",
98
- children: k
99
- }), o.isOpen && /* @__PURE__ */ r(q, {
92
+ children: V
93
+ }), t.isOpen && /* @__PURE__ */ r(K, {
100
94
  ...i,
101
- popupState: o,
102
- handleClear: b,
103
- onSelect: C
95
+ popupState: t,
96
+ handleClear: g,
97
+ onSelect: b
104
98
  })]
105
99
  })
106
100
  });
107
101
  };
108
102
  export {
109
- ne as StyledTimePicker
103
+ re as StyledTimePicker
110
104
  };
@@ -0,0 +1,100 @@
1
+ import { createContext as v, useContext as y, useEffect as p, useRef as O } from "react";
2
+ function _() {
3
+ return {
4
+ version: 1,
5
+ entries: [],
6
+ adapter: { unregister: null }
7
+ };
8
+ }
9
+ function a() {
10
+ if (!(typeof window > "u"))
11
+ return window.rawWindow ?? document.defaultView ?? window;
12
+ }
13
+ function l() {
14
+ const e = a();
15
+ return e ? e.__asmaOverlayBackRegistry__ ??= _() : k ??= _();
16
+ }
17
+ var k, B = (e) => typeof e == "object" && e !== null && typeof e.then == "function";
18
+ function d(e, n) {
19
+ if (e.parentOwnerRef && e.parentOwnerRef === n.ownerRef) return !0;
20
+ const t = e.parentOwnerRef?.current ?? e.parentOwner, i = n.ownerRef?.current ?? n.owner;
21
+ return !!t && !!i && (t === i || i.contains(t));
22
+ }
23
+ function w(e) {
24
+ if (e.adapter.unregister) return;
25
+ const n = a()?.__ASMA__SHELL__?.overlayBack;
26
+ n?.v !== 1 || typeof n.register != "function" || (e.adapter.unregister = n.register(() => S()));
27
+ }
28
+ function A(e) {
29
+ e.adapter.unregister && Promise.resolve().then(() => {
30
+ if (e.entries.length > 0) return;
31
+ const n = e.adapter.unregister;
32
+ e.adapter.unregister = null, n?.();
33
+ });
34
+ }
35
+ function L(e, n = null, t = null, i, o) {
36
+ const r = l(), s = {
37
+ requestClose: e,
38
+ pending: !1,
39
+ owner: n,
40
+ parentOwner: t,
41
+ ownerRef: i,
42
+ parentOwnerRef: o
43
+ }, c = n || i ? r.entries.findIndex((u) => i !== void 0 && u.parentOwnerRef === i || n !== null && u.parentOwner === n || n !== null && u.owner !== null && n.contains(u.owner)) : -1;
44
+ r.entries.splice(c === -1 ? r.entries.length : c, 0, s), r.entries.length === 1 && w(r);
45
+ let f = !1;
46
+ return () => {
47
+ if (f) return;
48
+ f = !0;
49
+ const u = r.entries.indexOf(s);
50
+ if (u !== -1 && r.entries.splice(u, 1), r.entries.length === 0) {
51
+ A(r);
52
+ return;
53
+ }
54
+ queueMicrotask(() => {
55
+ const g = a()?.__ASMA__SHELL__?.overlayBack;
56
+ r.entries.length > 0 && g?.pendingNavigation && g.continuePendingNavigation?.();
57
+ });
58
+ };
59
+ }
60
+ var R = v(void 0);
61
+ function S(e) {
62
+ const { entries: n } = l(), t = n.reduce((o, r) => !o || d(r, o) ? r : d(o, r) ? o : r, void 0);
63
+ if (!t) return;
64
+ if (t.pending) return !1;
65
+ const i = t.requestClose(e);
66
+ if (B(i)) {
67
+ t.pending = !0;
68
+ const o = () => {
69
+ t.pending = !1, globalThis.setTimeout(() => {
70
+ const r = l(), s = a()?.__ASMA__SHELL__?.overlayBack;
71
+ r.entries.includes(t) && s?.pendingNavigation && s.failOpenPendingNavigation?.();
72
+ }, 0);
73
+ };
74
+ i.then(o, o);
75
+ }
76
+ return i;
77
+ }
78
+ function E() {
79
+ const e = a()?.__ASMA__SHELL__?.overlayBack;
80
+ return e?.v === 1 && e.enabled === !0;
81
+ }
82
+ function m({ active: e, requestClose: n, ownerRef: t }) {
83
+ const i = y(R), o = O(n);
84
+ p(() => {
85
+ o.current = n;
86
+ }, [n]), p(() => {
87
+ if (e)
88
+ return L((r) => o.current(r), t?.current ?? null, i?.current ?? null, t, i);
89
+ }, [
90
+ e,
91
+ t,
92
+ i
93
+ ]);
94
+ }
95
+ export {
96
+ R as OverlayBackOwnerContext,
97
+ E as isOverlayBackEnabled,
98
+ S as requestCloseTopOverlayBack,
99
+ m as useBackCloses
100
+ };
@@ -16,7 +16,12 @@ interface DialogPaperProps {
16
16
  */
17
17
  export interface IStyledDialogProps {
18
18
  open: boolean;
19
- onClose?: (event: SyntheticEvent | Event, reason: DialogCloseReason) => void;
19
+ /**
20
+ * ✕, Escape and (ASMA-8471) native Back all funnel through this. Returning a Promise (a dirty or
21
+ * async confirmation) latches the dialog against Back while it is pending (`requestCloseTopOverlayBack`);
22
+ * returning nothing leaves it unlatched, so a repeated Back repeats the same dismissal attempt.
23
+ */
24
+ onClose?: (event: SyntheticEvent | Event, reason: DialogCloseReason) => void | Promise<unknown>;
20
25
  children?: ReactNode;
21
26
  dataTest: string;
22
27
  maxWidth?: DialogMaxWidth;