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