asma-ui-core 3.136.0 → 3.136.2
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 +129 -126
- package/dist/components/feedback/dialog/dialogHeaderStyles.js +5 -3
- package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +178 -171
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +120 -113
- package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +180 -135
- package/dist/components/utils/bottom-sheet/useDragToDismiss.hook.js +111 -31
- package/dist/src/components/feedback/dialog/StyledDialog.d.ts +3 -2
- package/dist/src/components/feedback/dialog/StyledDialogTitle.d.ts +3 -3
- package/dist/src/components/feedback/dialog/dialogHeaderStyles.d.ts +15 -3
- package/dist/src/components/utils/bottom-sheet/StyledBottomSheet.d.ts +8 -2
- package/dist/src/components/utils/bottom-sheet/useDragToDismiss.hook.d.ts +14 -3
- package/package.json +1 -1
|
@@ -1,56 +1,63 @@
|
|
|
1
1
|
import { cn as g } from "../../../helpers/cn.js";
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import { registerOpenModalDialog as
|
|
4
|
-
import { CloseIcon as
|
|
5
|
-
import { DialogBusyContext as
|
|
6
|
-
import { StyledButton as
|
|
7
|
-
import { OverlayBackOwnerContext as
|
|
8
|
-
import { useMobileMediaQuery as
|
|
9
|
-
import { warnUnnamedDialog as
|
|
10
|
-
import
|
|
11
|
-
import { StyledDialogTitleContext as
|
|
12
|
-
import { useDialogHeaderPinning as
|
|
13
|
-
import { dialogContentFlowClasses as
|
|
14
|
-
import { useEffect as s, useId as
|
|
15
|
-
import { jsx as o, jsxs as
|
|
16
|
-
var
|
|
2
|
+
import { resolveSx as Z } from "../../../helpers/sx.js";
|
|
3
|
+
import { registerOpenModalDialog as _e } from "../../../hooks/useTopLayer.hook.js";
|
|
4
|
+
import { CloseIcon as De } from "../../icons/close-icon/CloseIcon.js";
|
|
5
|
+
import { DialogBusyContext as Re, useDialogBusyBoundary as Ie } from "./DialogBusyContext.js";
|
|
6
|
+
import { StyledButton as Ae } from "../../inputs/button/StyledButton.js";
|
|
7
|
+
import { OverlayBackOwnerContext as Oe, isOverlayBackEnabled as ee, requestCloseTopOverlayBack as L, useBackCloses as Le } from "../../../hooks/useBackCloses.hook.js";
|
|
8
|
+
import { useMobileMediaQuery as Be } from "../../../hooks/useMediaQuery.hook.js";
|
|
9
|
+
import { warnUnnamedDialog as Ne } from "../../../helpers/warnUnnamedDialog.js";
|
|
10
|
+
import He from "./StyledDialog.module.js";
|
|
11
|
+
import { StyledDialogTitleContext as Te } from "./dialogTitleContext.js";
|
|
12
|
+
import { useDialogHeaderPinning as Pe } from "./useDialogHeaderPinning.js";
|
|
13
|
+
import { dialogContentFlowClasses as qe, dialogScrollerStyle as Me } from "./dialogHeaderStyles.js";
|
|
14
|
+
import { useEffect as s, useId as B, useLayoutEffect as te, useMemo as We, useRef as l, useState as N } from "react";
|
|
15
|
+
import { Fragment as je, jsx as o, jsxs as d } from "react/jsx-runtime";
|
|
16
|
+
var Fe = {
|
|
17
17
|
xs: 444,
|
|
18
18
|
sm: 600,
|
|
19
19
|
md: 900,
|
|
20
20
|
lg: 1200,
|
|
21
21
|
xl: 1536
|
|
22
|
-
},
|
|
23
|
-
const p =
|
|
22
|
+
}, ct = ({ open: t, onClose: H, children: T, dataTest: f, maxWidth: P = "sm", fullWidth: ne, fullScreen: re, scroll: oe = "paper", disableEscapeKeyDown: q, className: le, style: ie, sx: ae, classes: M, PaperProps: se, slotProps: m, busyReason: de, locale: ce = "en", onCloseText: W, showCloseIcon: b = !0, dialogLabel: c, dialogTitle: h, dialogHeaderNode: E, ariaLabel: S }) => {
|
|
23
|
+
const p = B(), j = B(), [F, ue] = N(), [G, fe] = N(null), me = We(() => ({
|
|
24
24
|
titleId: p,
|
|
25
|
-
setTitleId:
|
|
26
|
-
titleSlot:
|
|
27
|
-
}), [p,
|
|
25
|
+
setTitleId: ue,
|
|
26
|
+
titleSlot: G
|
|
27
|
+
}), [p, G]), k = !!c || b || !!E, C = k && !c, z = /* @__PURE__ */ d(je, { children: [h && /* @__PURE__ */ o("div", {
|
|
28
|
+
id: p,
|
|
29
|
+
className: "my-0 block min-w-0 whitespace-normal text-[20px] font-bold leading-[26px] text-delta-800 [overflow-wrap:anywhere] hyphens-auto min-[744px]:text-2xl min-[744px]:leading-8",
|
|
30
|
+
children: h
|
|
31
|
+
}), /* @__PURE__ */ o("div", {
|
|
32
|
+
ref: fe,
|
|
33
|
+
className: "contents"
|
|
34
|
+
})] }), w = h ? p : F ?? (c ? j : void 0), he = Be(), a = l(null), K = l(null), { headerRef: pe, pinned: _, hidden: D, scrollPaddingTop: we, scrollPaddingBottom: xe } = Pe(K), R = l(null), I = l(!1), A = l(!1), u = l(!1), X = l(t);
|
|
28
35
|
s(() => {
|
|
29
|
-
|
|
36
|
+
X.current = t;
|
|
30
37
|
}, [t]);
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const e =
|
|
34
|
-
r && !r.id && (r.id =
|
|
35
|
-
const
|
|
36
|
-
|
|
38
|
+
const U = l(t), x = re ?? he, { busy: y, busyReason: ye, contextValue: ve } = Ie(de, ce), $ = B(), [v, ge] = N(), Q = l(!1);
|
|
39
|
+
te(() => {
|
|
40
|
+
const e = a.current, n = !!w || !!S, r = e && t && !n ? e.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]') : null;
|
|
41
|
+
r && !r.id && (r.id = $);
|
|
42
|
+
const i = r?.id;
|
|
43
|
+
i !== v && ge(i), e && t && !n && !r && !Q.current && (Q.current = !0, Ne(f));
|
|
37
44
|
}, [
|
|
38
45
|
t,
|
|
39
46
|
w,
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
S,
|
|
48
|
+
T,
|
|
42
49
|
v,
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
$,
|
|
51
|
+
f
|
|
45
52
|
]), s(() => {
|
|
46
|
-
|
|
47
|
-
}, [t,
|
|
48
|
-
const e =
|
|
53
|
+
U.current && !t && m?.transition?.onExited?.(), U.current = t;
|
|
54
|
+
}, [t, m]), te(() => {
|
|
55
|
+
const e = a.current;
|
|
49
56
|
if (!e || !t) return;
|
|
50
|
-
e.open || (
|
|
51
|
-
const n =
|
|
57
|
+
e.open || (R.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.showModal(), e.focus({ preventScroll: !0 }), requestAnimationFrame(() => e.open && e.focus({ preventScroll: !0 })));
|
|
58
|
+
const n = _e(e);
|
|
52
59
|
return () => {
|
|
53
|
-
n(),
|
|
60
|
+
n(), R.current?.isConnected && R.current.focus({ preventScroll: !0 });
|
|
54
61
|
};
|
|
55
62
|
}, [t]), s(() => {
|
|
56
63
|
if (!t) return;
|
|
@@ -59,97 +66,97 @@ var Te = {
|
|
|
59
66
|
document.body.style.overflow = e, document.documentElement.style.overflow = n;
|
|
60
67
|
};
|
|
61
68
|
}, [t]);
|
|
62
|
-
const
|
|
63
|
-
...
|
|
64
|
-
...
|
|
65
|
-
},
|
|
66
|
-
if (y ||
|
|
67
|
-
const r =
|
|
69
|
+
const O = {
|
|
70
|
+
...se,
|
|
71
|
+
...m?.paper
|
|
72
|
+
}, V = P === !1 ? void 0 : Fe[P], { className: be, style: Ee, onClick: Se, ...ke } = m?.backdrop ?? {}, J = (e, n) => {
|
|
73
|
+
if (y || u.current) return;
|
|
74
|
+
const r = H?.(e, n);
|
|
68
75
|
if (r && typeof r.then == "function") {
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
76
|
+
u.current = !0;
|
|
77
|
+
const i = () => {
|
|
78
|
+
u.current = !1;
|
|
72
79
|
};
|
|
73
|
-
r.then(
|
|
80
|
+
r.then(i, i);
|
|
74
81
|
}
|
|
75
82
|
return r;
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
}, 0),
|
|
79
|
-
|
|
83
|
+
}, Y = (e) => I.current ? !1 : (I.current = !0, window.setTimeout(() => {
|
|
84
|
+
I.current = !1;
|
|
85
|
+
}, 0), J(e, "escapeKeyDown"));
|
|
86
|
+
Le({
|
|
80
87
|
active: t,
|
|
81
|
-
requestClose: (e) => !
|
|
82
|
-
ownerRef:
|
|
88
|
+
requestClose: (e) => !H || q || y || u.current ? !1 : Y(e ?? new Event("overlayBack")),
|
|
89
|
+
ownerRef: a
|
|
83
90
|
});
|
|
84
|
-
const
|
|
85
|
-
e.cancelable && e.preventDefault(), !
|
|
91
|
+
const Ce = (e) => {
|
|
92
|
+
e.cancelable && e.preventDefault(), !A.current && ee() && L();
|
|
86
93
|
};
|
|
87
94
|
return s(() => {
|
|
88
|
-
const e =
|
|
95
|
+
const e = a.current;
|
|
89
96
|
if (!e || !t) return;
|
|
90
97
|
let n = !1;
|
|
91
98
|
const r = () => {
|
|
92
99
|
requestAnimationFrame(() => {
|
|
93
|
-
n = !1,
|
|
100
|
+
n = !1, X.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
|
|
94
101
|
});
|
|
95
|
-
},
|
|
96
|
-
n || (n = !0,
|
|
102
|
+
}, i = () => {
|
|
103
|
+
n || (n = !0, ee() && !u.current && L(), r());
|
|
97
104
|
};
|
|
98
|
-
return e.addEventListener("close",
|
|
105
|
+
return e.addEventListener("close", i), () => e.removeEventListener("close", i);
|
|
99
106
|
}, [t]), s(() => {
|
|
100
|
-
if (!t ||
|
|
107
|
+
if (!t || q) return;
|
|
101
108
|
const e = (n) => {
|
|
102
|
-
n.key !== "Escape" || n.defaultPrevented || (n.preventDefault(), n.stopImmediatePropagation(),
|
|
109
|
+
n.key !== "Escape" || n.defaultPrevented || (n.preventDefault(), n.stopImmediatePropagation(), L(n));
|
|
103
110
|
};
|
|
104
111
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
105
112
|
}), s(() => {
|
|
106
113
|
if (!t) return;
|
|
107
114
|
const e = (n) => {
|
|
108
|
-
n.key === "Escape" && (
|
|
109
|
-
|
|
115
|
+
n.key === "Escape" && (A.current = !0, window.setTimeout(() => {
|
|
116
|
+
A.current = !1;
|
|
110
117
|
}, 0));
|
|
111
118
|
};
|
|
112
119
|
return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
|
|
113
|
-
}, [t]), t ? /* @__PURE__ */
|
|
114
|
-
ref:
|
|
120
|
+
}, [t]), t ? /* @__PURE__ */ d("dialog", {
|
|
121
|
+
ref: a,
|
|
115
122
|
tabIndex: -1,
|
|
116
|
-
"data-testid":
|
|
123
|
+
"data-testid": f,
|
|
117
124
|
"aria-labelledby": w ?? v,
|
|
118
|
-
"aria-label": w || v ? void 0 :
|
|
119
|
-
onCancel:
|
|
125
|
+
"aria-label": w || v ? void 0 : S,
|
|
126
|
+
onCancel: Ce,
|
|
120
127
|
onKeyDown: (e) => {
|
|
121
|
-
!y || e.key !== "Escape" || e.target.closest("dialog[open]") ===
|
|
128
|
+
!y || e.key !== "Escape" || e.target.closest("dialog[open]") === a.current && e.preventDefault();
|
|
122
129
|
},
|
|
123
|
-
className: g(
|
|
130
|
+
className: g(He.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", oe === "body" && "overflow-y-auto", le, M?.root),
|
|
124
131
|
style: {
|
|
125
132
|
zIndex: 999,
|
|
126
|
-
...
|
|
127
|
-
...
|
|
133
|
+
...Z(ae),
|
|
134
|
+
...ie
|
|
128
135
|
},
|
|
129
136
|
children: [/* @__PURE__ */ o("div", {
|
|
130
137
|
...ke,
|
|
131
|
-
className: g("absolute inset-0 bg-[#626e7eb2]",
|
|
132
|
-
style:
|
|
138
|
+
className: g("absolute inset-0 bg-[#626e7eb2]", be),
|
|
139
|
+
style: Ee,
|
|
133
140
|
onClick: (e) => {
|
|
134
|
-
|
|
141
|
+
Se?.(e), e.defaultPrevented || J(e, "backdropClick");
|
|
135
142
|
}
|
|
136
143
|
}), /* @__PURE__ */ o("div", {
|
|
137
|
-
className: g("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]", x && "rounded-none",
|
|
144
|
+
className: g("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]", x && "rounded-none", O.className, M?.paper),
|
|
138
145
|
style: {
|
|
139
146
|
minWidth: 0,
|
|
140
147
|
minHeight: 0,
|
|
141
|
-
...!x &&
|
|
148
|
+
...!x && V ? { maxWidth: V } : {},
|
|
142
149
|
...x ? {
|
|
143
150
|
width: "100%",
|
|
144
151
|
maxWidth: "100%",
|
|
145
152
|
height: "100%",
|
|
146
153
|
maxHeight: "100%"
|
|
147
154
|
} : {
|
|
148
|
-
width:
|
|
155
|
+
width: ne ? "calc(100% - 64px)" : "auto",
|
|
149
156
|
maxHeight: "100%"
|
|
150
157
|
},
|
|
151
|
-
...
|
|
152
|
-
...
|
|
158
|
+
...Z(O.sx),
|
|
159
|
+
...O.style,
|
|
153
160
|
...x ? {
|
|
154
161
|
width: "100%",
|
|
155
162
|
maxWidth: "100%",
|
|
@@ -157,71 +164,67 @@ var Te = {
|
|
|
157
164
|
maxHeight: "100%"
|
|
158
165
|
} : { maxHeight: "calc(100% - 64px)" }
|
|
159
166
|
},
|
|
160
|
-
children: /* @__PURE__ */
|
|
161
|
-
ref:
|
|
167
|
+
children: /* @__PURE__ */ d("div", {
|
|
168
|
+
ref: K,
|
|
162
169
|
"data-dialog-body": "",
|
|
163
170
|
className: "flex min-h-0 w-full min-w-0 flex-auto flex-col overflow-y-auto overflow-x-hidden overscroll-contain",
|
|
164
|
-
style:
|
|
165
|
-
children: [(
|
|
166
|
-
ref:
|
|
171
|
+
style: Me(we, xe),
|
|
172
|
+
children: [(k || !!h || !!F) && /* @__PURE__ */ d("div", {
|
|
173
|
+
ref: pe,
|
|
167
174
|
"data-dialog-header": "",
|
|
168
|
-
"data-header-pinned":
|
|
169
|
-
"aria-hidden":
|
|
170
|
-
hidden:
|
|
171
|
-
className: g("box-border w-full min-w-0 max-w-full shrink-0 bg-white px-4 pb-3 pt-4",
|
|
172
|
-
children: [
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
id:
|
|
175
|
+
"data-header-pinned": _ ? "true" : "false",
|
|
176
|
+
"aria-hidden": D || void 0,
|
|
177
|
+
hidden: D,
|
|
178
|
+
className: g("box-border w-full min-w-0 max-w-full shrink-0 bg-white px-4 pb-3 pt-4", _ && "sticky top-0 z-[2]", D && "hidden"),
|
|
179
|
+
children: [k && /* @__PURE__ */ d("div", {
|
|
180
|
+
className: C ? "flex min-h-11 w-full min-w-0 items-start justify-between gap-x-2" : "flex min-h-11 w-full min-w-0 items-center justify-between gap-x-2 max-xs:flex-wrap max-xs:gap-y-1",
|
|
181
|
+
children: [
|
|
182
|
+
c && /* @__PURE__ */ o("div", {
|
|
183
|
+
id: j,
|
|
177
184
|
className: "min-w-0 flex-auto hyphens-auto text-sm font-normal leading-5 text-delta-600 [overflow-wrap:anywhere]",
|
|
178
|
-
children:
|
|
179
|
-
}),
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
185
|
+
children: c
|
|
186
|
+
}),
|
|
187
|
+
C && /* @__PURE__ */ o("div", {
|
|
188
|
+
className: "min-w-0 flex-auto py-[9px] min-[744px]:py-1.5",
|
|
189
|
+
children: z
|
|
190
|
+
}),
|
|
191
|
+
(b || !!E) && /* @__PURE__ */ d("div", {
|
|
192
|
+
className: "ml-auto flex min-h-11 min-w-0 max-w-full shrink-0 items-center justify-end gap-2 max-xs:flex-wrap max-xs:gap-y-2",
|
|
193
|
+
children: [E, b && /* @__PURE__ */ o(Ae, {
|
|
194
|
+
dataTest: `close-button-${f}`,
|
|
195
|
+
"aria-label": W ? void 0 : "Close",
|
|
184
196
|
variant: "textGray",
|
|
185
197
|
size: "small",
|
|
186
|
-
endIcon: /* @__PURE__ */ o(
|
|
198
|
+
endIcon: /* @__PURE__ */ o(De, {
|
|
187
199
|
width: 20,
|
|
188
200
|
height: 20
|
|
189
201
|
}),
|
|
190
202
|
className: "max-w-full shrink-0 whitespace-nowrap",
|
|
191
203
|
disabled: y,
|
|
192
|
-
disabledReason:
|
|
204
|
+
disabledReason: ye,
|
|
193
205
|
onClick: (e) => {
|
|
194
|
-
|
|
206
|
+
Y(e);
|
|
195
207
|
},
|
|
196
208
|
style: {
|
|
197
209
|
color: "var(--colors-delta-800)",
|
|
198
210
|
paddingRight: "6px",
|
|
199
211
|
paddingLeft: "6px"
|
|
200
212
|
},
|
|
201
|
-
children:
|
|
213
|
+
children: W
|
|
202
214
|
})]
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
id: p,
|
|
207
|
-
className: "my-0 block min-w-0 whitespace-normal text-[20px] font-bold leading-[26px] text-delta-800 [overflow-wrap:anywhere] hyphens-auto min-[744px]:text-2xl min-[744px]:leading-8",
|
|
208
|
-
children: h
|
|
209
|
-
}),
|
|
210
|
-
/* @__PURE__ */ o("div", {
|
|
211
|
-
ref: ce,
|
|
212
|
-
className: "contents"
|
|
213
|
-
})
|
|
214
|
-
]
|
|
215
|
+
})
|
|
216
|
+
]
|
|
217
|
+
}), !C && z]
|
|
215
218
|
}), /* @__PURE__ */ o("div", {
|
|
216
219
|
"data-dialog-content-flow": "",
|
|
217
|
-
className:
|
|
218
|
-
children: /* @__PURE__ */ o(
|
|
219
|
-
value:
|
|
220
|
-
children: /* @__PURE__ */ o(
|
|
221
|
-
value:
|
|
222
|
-
children: /* @__PURE__ */ o(
|
|
223
|
-
value:
|
|
224
|
-
children:
|
|
220
|
+
className: qe(_),
|
|
221
|
+
children: /* @__PURE__ */ o(Oe.Provider, {
|
|
222
|
+
value: a,
|
|
223
|
+
children: /* @__PURE__ */ o(Te.Provider, {
|
|
224
|
+
value: me,
|
|
225
|
+
children: /* @__PURE__ */ o(Re.Provider, {
|
|
226
|
+
value: ve,
|
|
227
|
+
children: T
|
|
225
228
|
})
|
|
226
229
|
})
|
|
227
230
|
})
|
|
@@ -231,5 +234,5 @@ var Te = {
|
|
|
231
234
|
}) : null;
|
|
232
235
|
};
|
|
233
236
|
export {
|
|
234
|
-
|
|
237
|
+
ct as StyledDialog
|
|
235
238
|
};
|
|
@@ -3,11 +3,13 @@ var x = "box-border w-full min-w-0 max-w-full shrink-0 bg-white px-4 pb-3 pt-4",
|
|
|
3
3
|
scrollPaddingBottom: l,
|
|
4
4
|
"--dialog-header-offset": `${e}px`,
|
|
5
5
|
"--dialog-footer-offset": `${l}px`
|
|
6
|
-
}),
|
|
6
|
+
}), i = "flex min-h-11 w-full min-w-0 items-center justify-between gap-x-2 max-xs:flex-wrap max-xs:gap-y-1", f = "flex min-h-11 w-full min-w-0 items-start justify-between gap-x-2", n = "min-w-0 flex-auto py-[9px] min-[744px]:py-1.5", o = "my-0 block min-w-0 whitespace-normal text-[20px] font-bold leading-[26px] text-delta-800 [overflow-wrap:anywhere] hyphens-auto min-[744px]:text-2xl min-[744px]:leading-8";
|
|
7
7
|
export {
|
|
8
|
-
|
|
8
|
+
i as DIALOG_HEADER_ACTIONS_ROW_CLASSES,
|
|
9
9
|
x as DIALOG_HEADER_CLASSES,
|
|
10
|
-
|
|
10
|
+
n as DIALOG_HEADER_ROW_TITLE_BOX_CLASSES,
|
|
11
|
+
f as DIALOG_HEADER_TITLE_ROW_CLASSES,
|
|
12
|
+
o as DIALOG_TITLE_CLASSES,
|
|
11
13
|
a as dialogContentFlowClasses,
|
|
12
14
|
t as dialogScrollerStyle
|
|
13
15
|
};
|