asma-ui-core 3.108.1 → 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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/feedback/dialog/StyledDialog.js +139 -96
- package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +180 -171
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +115 -106
- package/dist/datetime/components/date-picker/StyledDatePicker.js +15 -19
- package/dist/datetime/components/time-picker/StyledTimePicker.js +56 -62
- package/dist/hooks/useBackCloses.hook.js +100 -0
- package/dist/src/components/data-display/badge/StyledBadge.d.ts +5 -3
- package/dist/src/components/feedback/dialog/StyledDialog.d.ts +6 -1
- package/dist/src/hooks/useBackCloses.hook.d.ts +101 -0
- package/dist/src/hooks/useBackCloses.hook.test.d.ts +1 -0
- package/package.json +1 -1
- package/dist/datetime/hooks/useBackNavigationClose.hook.js +0 -10
- package/dist/src/datetime/hooks/useBackNavigationClose.hook.d.ts +0 -4
|
@@ -1,53 +1,59 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { firstTabbable as
|
|
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
|
|
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 {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
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:
|
|
22
|
-
|
|
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
|
-
|
|
27
|
+
n.current?.toggleAttribute("inert", t), p.current?.toggleAttribute("inert", !t);
|
|
26
28
|
}, [t]), H(() => {
|
|
27
|
-
const w =
|
|
28
|
-
if (
|
|
29
|
-
const
|
|
30
|
-
|
|
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
|
-
|
|
35
|
-
const
|
|
36
|
-
(S?.current ?? ee ?? (
|
|
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
|
-
|
|
42
|
+
i
|
|
41
43
|
]);
|
|
42
|
-
const
|
|
43
|
-
const w = t ?
|
|
44
|
-
|
|
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"]') ??
|
|
48
|
+
m && (m.querySelector('[data-testid="toggle-minimize-btn"]') ?? O(m))?.focus({ preventScroll: !0 });
|
|
47
49
|
});
|
|
48
50
|
};
|
|
49
|
-
|
|
50
|
-
|
|
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 (!
|
|
68
|
-
const Z = f ? `${
|
|
69
|
-
return /* @__PURE__ */
|
|
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
|
-
...
|
|
80
|
+
...N
|
|
75
81
|
},
|
|
76
|
-
className:
|
|
77
|
-
children: /* @__PURE__ */
|
|
78
|
-
className:
|
|
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__ */
|
|
96
|
+
}), /* @__PURE__ */ r("div", {
|
|
91
97
|
className: "flex items-center gap-x-1",
|
|
92
|
-
children: [/* @__PURE__ */ e(
|
|
98
|
+
children: [/* @__PURE__ */ e(q, {
|
|
93
99
|
type: "expand",
|
|
94
100
|
visibility: W,
|
|
95
|
-
onClick:
|
|
96
|
-
tooltipTitle:
|
|
97
|
-
}), /* @__PURE__ */ e(
|
|
98
|
-
buttonRef:
|
|
101
|
+
onClick: j,
|
|
102
|
+
tooltipTitle: l.expand
|
|
103
|
+
}), /* @__PURE__ */ e($, {
|
|
104
|
+
buttonRef: B,
|
|
99
105
|
showCloseIcon: R,
|
|
100
|
-
onClick:
|
|
101
|
-
disabledReason:
|
|
102
|
-
tooltipTitle:
|
|
106
|
+
onClick: v,
|
|
107
|
+
disabledReason: z ? k : void 0,
|
|
108
|
+
tooltipTitle: l.close
|
|
103
109
|
})]
|
|
104
110
|
})]
|
|
105
111
|
})
|
|
106
112
|
}),
|
|
107
|
-
|
|
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
|
-
|
|
116
|
+
M(!1);
|
|
111
117
|
}
|
|
112
118
|
}),
|
|
113
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ e("div", {
|
|
114
120
|
style: {
|
|
115
121
|
zIndex: 51,
|
|
116
|
-
...
|
|
122
|
+
...N,
|
|
117
123
|
...Y
|
|
118
124
|
},
|
|
119
|
-
ref:
|
|
125
|
+
ref: n,
|
|
120
126
|
role: "dialog",
|
|
121
|
-
"aria-modal":
|
|
127
|
+
"aria-modal": c ? !0 : void 0,
|
|
122
128
|
"aria-labelledby": Z,
|
|
123
|
-
className:
|
|
124
|
-
children:
|
|
125
|
-
|
|
126
|
-
children: [/* @__PURE__ */
|
|
127
|
-
className: "flex
|
|
128
|
-
children: [
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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:
|
|
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
|
-
}),
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
})
|
|
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
|
-
|
|
191
|
+
Te as MinimizableDialogV2
|
|
183
192
|
};
|
|
@@ -1,39 +1,35 @@
|
|
|
1
|
-
import { setPickerPosition as
|
|
1
|
+
import { setPickerPosition as u } from "./helpers.js";
|
|
2
2
|
import { StyledDayPicker as k } from "./components/StyledDayPicker.js";
|
|
3
|
-
import { StyledCalendarPicker as
|
|
4
|
-
import { DatePickerInputIndex as
|
|
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 {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
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])
|
|
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__ */
|
|
32
|
-
/* @__PURE__ */ t(
|
|
27
|
+
return /* @__PURE__ */ D(C, { children: [
|
|
28
|
+
/* @__PURE__ */ t(v, {
|
|
33
29
|
datePickerProps: a,
|
|
34
|
-
onClick:
|
|
30
|
+
onClick: P
|
|
35
31
|
}),
|
|
36
|
-
!i && /* @__PURE__ */ t(
|
|
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
|
-
|
|
61
|
+
j as StyledDatePicker
|
|
66
62
|
};
|
|
@@ -1,110 +1,104 @@
|
|
|
1
|
-
import { useIsMobileView as
|
|
2
|
-
import { StyledDrawer as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
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
|
|
14
|
-
var
|
|
15
|
-
const { value: l, onSelect: n, notBeforeTime:
|
|
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
|
-
}),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
28
|
+
d
|
|
35
29
|
]);
|
|
36
|
-
const T = l ? E(l, "HH:mm") : "", [H,
|
|
37
|
-
const
|
|
38
|
-
if (a(!0),
|
|
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
|
|
43
|
-
if (!
|
|
36
|
+
const f = C(o, l);
|
|
37
|
+
if (!f) {
|
|
44
38
|
n(void 0), s(!1);
|
|
45
39
|
return;
|
|
46
40
|
}
|
|
47
|
-
s(!0), !
|
|
48
|
-
},
|
|
49
|
-
if (!(e &&
|
|
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),
|
|
45
|
+
n(e), m(e ? E(e, "HH:mm") : ""), a(!1);
|
|
52
46
|
return;
|
|
53
47
|
}
|
|
54
|
-
n(void 0),
|
|
48
|
+
n(void 0), m(e ? E(e, "HH:mm") : ""), a(!0);
|
|
55
49
|
}
|
|
56
|
-
},
|
|
57
|
-
S &&
|
|
58
|
-
},
|
|
59
|
-
n(void 0),
|
|
60
|
-
},
|
|
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:
|
|
56
|
+
popupState: t,
|
|
63
57
|
localValue: v,
|
|
64
58
|
isValidTime: L,
|
|
65
|
-
isValidEndTime:
|
|
66
|
-
handleChange:
|
|
67
|
-
handleBlur:
|
|
59
|
+
isValidEndTime: I,
|
|
60
|
+
handleChange: N,
|
|
61
|
+
handleBlur: O
|
|
68
62
|
});
|
|
69
|
-
return i.disabled || i.readOnly ?
|
|
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:
|
|
74
|
-
}), /* @__PURE__ */ r(
|
|
67
|
+
children: V
|
|
68
|
+
}), /* @__PURE__ */ r(B, {
|
|
75
69
|
anchor: "bottom",
|
|
76
|
-
open:
|
|
77
|
-
onClose:
|
|
78
|
-
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(
|
|
75
|
+
children: /* @__PURE__ */ r(F, {
|
|
82
76
|
dataTest: i.dataTest,
|
|
83
77
|
value: l,
|
|
84
78
|
minTime: c,
|
|
85
|
-
onSelect:
|
|
86
|
-
handleClear:
|
|
87
|
-
onConfirm:
|
|
79
|
+
onSelect: b,
|
|
80
|
+
handleClear: g,
|
|
81
|
+
onConfirm: t.close
|
|
88
82
|
})
|
|
89
83
|
})
|
|
90
84
|
})]
|
|
91
|
-
}) : /* @__PURE__ */ r(
|
|
85
|
+
}) : /* @__PURE__ */ r(A, {
|
|
92
86
|
mouseEvent: "onMouseDown",
|
|
93
|
-
onClickAway:
|
|
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:
|
|
99
|
-
}),
|
|
92
|
+
children: V
|
|
93
|
+
}), t.isOpen && /* @__PURE__ */ r(K, {
|
|
100
94
|
...i,
|
|
101
|
-
popupState:
|
|
102
|
-
handleClear:
|
|
103
|
-
onSelect:
|
|
95
|
+
popupState: t,
|
|
96
|
+
handleClear: g,
|
|
97
|
+
onSelect: b
|
|
104
98
|
})]
|
|
105
99
|
})
|
|
106
100
|
});
|
|
107
101
|
};
|
|
108
102
|
export {
|
|
109
|
-
|
|
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
|
+
};
|
|
@@ -4,9 +4,11 @@ type StyledBadgeSize = 'medium' | 'small';
|
|
|
4
4
|
type StyledBadgePurpose = 'notification' | 'unread' | 'filter';
|
|
5
5
|
/**
|
|
6
6
|
* @figmaNode wXrXt5uKNNzV2DnQCgyYZH#15181-43817
|
|
7
|
-
* Figma "Badge". Notification count = 20px lime pill with a 1px
|
|
8
|
-
* `dot` = 12px lime circle with a stronger 2px
|
|
9
|
-
*
|
|
7
|
+
* Figma "Badge". Notification count = 20px lime pill with a 1px ring and Helper-Semibold 14/20;
|
|
8
|
+
* `dot` = 12px lime circle with a stronger 2px ring. Both rings are stroked on the inside, as
|
|
9
|
+
* Figma draws them, so they cost no layout space: a count is its label plus 6px either side and
|
|
10
|
+
* nothing more. Other colors and `small` are legacy app extensions with no matching Figma
|
|
11
|
+
* notification variant.
|
|
10
12
|
*
|
|
11
13
|
* Pass children to decorate them — the badge anchors to their corner. Pass none and the badge,
|
|
12
14
|
* count or dot, becomes a flow element (for the dot, Figma `Size=Dot`, node 44267-214524), for a
|
|
@@ -16,7 +16,12 @@ interface DialogPaperProps {
|
|
|
16
16
|
*/
|
|
17
17
|
export interface IStyledDialogProps {
|
|
18
18
|
open: boolean;
|
|
19
|
-
|
|
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;
|