asma-ui-core 3.134.2 → 3.134.4
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 +8 -11
- package/dist/components/feedback/dialog/dialogHeaderStyles.js +11 -5
- package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +16 -19
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +20 -23
- package/dist/components/utils/popover/StyledPopover.js +52 -45
- package/dist/src/components/feedback/dialog/dialogHeaderStyles.d.ts +11 -0
- package/package.json +1 -1
|
@@ -10,17 +10,17 @@ import { warnUnnamedDialog as Oe } from "../../../helpers/warnUnnamedDialog.js";
|
|
|
10
10
|
import Le from "./StyledDialog.module.js";
|
|
11
11
|
import { StyledDialogTitleContext as Ae } from "./dialogTitleContext.js";
|
|
12
12
|
import { useDialogHeaderPinning as He } from "./useDialogHeaderPinning.js";
|
|
13
|
-
import { dialogContentFlowClasses as Pe } from "./dialogHeaderStyles.js";
|
|
14
|
-
import { useEffect as s, useId as N, useLayoutEffect as Z, useMemo as
|
|
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
15
|
import { jsx as o, jsxs as c } from "react/jsx-runtime";
|
|
16
|
-
var
|
|
16
|
+
var Te = {
|
|
17
17
|
xs: 444,
|
|
18
18
|
sm: 600,
|
|
19
19
|
md: 900,
|
|
20
20
|
lg: 1200,
|
|
21
21
|
xl: 1536
|
|
22
|
-
},
|
|
23
|
-
const p = N(), T = N(), [W, de] = O(), [j, ce] = O(null), ue =
|
|
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
24
|
titleId: p,
|
|
25
25
|
setTitleId: de,
|
|
26
26
|
titleSlot: j
|
|
@@ -62,7 +62,7 @@ var Me = {
|
|
|
62
62
|
const _ = {
|
|
63
63
|
...ae,
|
|
64
64
|
...f?.paper
|
|
65
|
-
}, Q = H === !1 ? void 0 :
|
|
65
|
+
}, Q = H === !1 ? void 0 : Te[H], { className: ve, style: ge, onClick: be, ...ke } = f?.backdrop ?? {}, V = (e, n) => {
|
|
66
66
|
if (y || d.current) return;
|
|
67
67
|
const r = L?.(e, n);
|
|
68
68
|
if (r && typeof r.then == "function") {
|
|
@@ -161,10 +161,7 @@ var Me = {
|
|
|
161
161
|
ref: F,
|
|
162
162
|
"data-dialog-body": "",
|
|
163
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:
|
|
165
|
-
scrollPaddingTop: he,
|
|
166
|
-
scrollPaddingBottom: pe
|
|
167
|
-
},
|
|
164
|
+
style: qe(he, pe),
|
|
168
165
|
children: [(z || !!h || !!W) && /* @__PURE__ */ c("div", {
|
|
169
166
|
ref: me,
|
|
170
167
|
"data-dialog-header": "",
|
|
@@ -234,5 +231,5 @@ var Me = {
|
|
|
234
231
|
}) : null;
|
|
235
232
|
};
|
|
236
233
|
export {
|
|
237
|
-
|
|
234
|
+
lt as StyledDialog
|
|
238
235
|
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
var
|
|
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";
|
|
2
7
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
7
13
|
};
|
|
@@ -8,28 +8,28 @@ import { KeyboardCapslockIcon as ze } from "../../icons/keyboard-capslock-icon/K
|
|
|
8
8
|
import { ArrowExpandIcon as Ce } from "../../icons/arrow-expand-icon/ArrowExpandIcon.js";
|
|
9
9
|
import { ArrowShrinkIcon as Ie } from "../../icons/arrow-shrink-icon/ArrowShrinkIcon.js";
|
|
10
10
|
import { StyledButton as a } from "../../inputs/button/StyledButton.js";
|
|
11
|
-
import { OverlayBackOwnerContext as
|
|
11
|
+
import { OverlayBackOwnerContext as Se, isOverlayBackNavigationPending as Ne, useBackCloses as _e } from "../../../hooks/useBackCloses.hook.js";
|
|
12
12
|
import { useFocusTrap as Re } from "../../../hooks/useFocusTrap.hook.js";
|
|
13
13
|
import { StyledMenu as Ee } from "../../navigation/menu/StyledMenu.js";
|
|
14
14
|
import { StyledMenuItem as Me } from "../../navigation/menu/StyledMenuItem.js";
|
|
15
15
|
import { useDialogHeaderPinning as Ae } from "../dialog/useDialogHeaderPinning.js";
|
|
16
|
-
import { DIALOG_HEADER_ACTIONS_ROW_CLASSES as De, DIALOG_HEADER_CLASSES as Oe, DIALOG_TITLE_CLASSES as je, dialogContentFlowClasses as Fe } from "../dialog/dialogHeaderStyles.js";
|
|
17
|
-
import { fullScreenFieldWidthVars as
|
|
16
|
+
import { DIALOG_HEADER_ACTIONS_ROW_CLASSES as De, DIALOG_HEADER_CLASSES as Oe, DIALOG_TITLE_CLASSES as je, dialogContentFlowClasses as Fe, dialogScrollerStyle as Ge } from "../dialog/dialogHeaderStyles.js";
|
|
17
|
+
import { fullScreenFieldWidthVars as Pe } from "../../inputs/field-styles.js";
|
|
18
18
|
import Z from "./MinimizableDialog.module.js";
|
|
19
|
-
import { useToggleMenuVisibility as
|
|
19
|
+
import { useToggleMenuVisibility as qe } from "../../../hooks/useToggleMenuVisibility.hook.js";
|
|
20
20
|
import B from "clsx";
|
|
21
|
-
import { useId as
|
|
21
|
+
import { useId as Le, useLayoutEffect as Te, useRef as N, useState as ee } from "react";
|
|
22
22
|
import { Fragment as p, jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
23
|
-
var
|
|
24
|
-
const [i, ce] = ee(!1), [V, me] = ee(!1), { open: fe, anchorEl: he, handleOpen: ue, handleClose: ve } =
|
|
23
|
+
var fi = ({ onCloseText: u = "", onMinimizeText: _ = "", onExpandText: R = "", onFullScreenText: E = "", showCloseIcon: M = !0, showMinimizeIcon: ie = !0, showExpandIcon: te = !0, showFullScreenIcon: le = !0, title: g, label: A, children: x, open: w, onClose: ae, className: D = "", primaryButtonText: O, primaryButtonLoading: d = !1, primaryButtonDisabled: de, primaryButtonDisabledReason: re, secondaryButtonText: y, onPrimaryButtonClick: j, onSecondaryButtonClick: F, dataTest: G, actionNode: ne, extraActions: r, extraActionsText: h, btnContainerClassName: P, footerClassName: oe, footerInfo: q, locale: t = "en", enableFullscreen: se = !0, fullscreenLockedReason: L, fullScreenState: T, handleFullScreenState: H }) => {
|
|
24
|
+
const [i, ce] = ee(!1), [V, me] = ee(!1), { open: fe, anchorEl: he, handleOpen: ue, handleClose: ve } = qe(), c = N(null), k = N(null), W = Le(), U = N(null), { headerRef: be, pinned: v, hidden: z, scrollPaddingTop: pe, scrollPaddingBottom: ge } = Ae(U), C = t === "en" ? "Wait until saved" : "Vent til lagringen er ferdig", b = () => {
|
|
25
25
|
if (d) return !1;
|
|
26
26
|
ae();
|
|
27
27
|
}, o = T ?? V, n = o && !i, I = !!L;
|
|
28
28
|
if (Re(w && n, c, b), _e({
|
|
29
29
|
active: w && !i,
|
|
30
|
-
requestClose: () => !n &&
|
|
30
|
+
requestClose: () => !n && Ne() ? !1 : b(),
|
|
31
31
|
ownerRef: c
|
|
32
|
-
}),
|
|
32
|
+
}), Te(() => {
|
|
33
33
|
c.current?.toggleAttribute("inert", i), k.current?.toggleAttribute("inert", !i);
|
|
34
34
|
}, [i]), !w) return null;
|
|
35
35
|
const xe = n ? {
|
|
@@ -40,7 +40,7 @@ var mi = ({ onCloseText: u = "", onMinimizeText: _ = "", onExpandText: R = "", o
|
|
|
40
40
|
transform: "translate(-50%, -50%)",
|
|
41
41
|
width: "min(1000px, calc(100vw - 32px))",
|
|
42
42
|
height: "95dvh",
|
|
43
|
-
...
|
|
43
|
+
...Pe
|
|
44
44
|
} : void 0, $ = o ? t === "en" ? "Exit full screen" : "Avslutt fullskjerm" : t === "en" ? "Full screen" : "Fullskjerm", K = O ?? d, J = K || y, Q = /* @__PURE__ */ l(p, { children: [y && F && /* @__PURE__ */ e(a, {
|
|
45
45
|
dataTest: "cancel-button",
|
|
46
46
|
variant: "outlined",
|
|
@@ -59,8 +59,8 @@ var mi = ({ onCloseText: u = "", onMinimizeText: _ = "", onExpandText: R = "", o
|
|
|
59
59
|
})] }), X = () => {
|
|
60
60
|
const m = i ? c : k;
|
|
61
61
|
ce(!i), requestAnimationFrame(() => {
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const S = m.current;
|
|
63
|
+
S && (S.querySelector('[data-testid="minimize-button"]') ?? we(S))?.focus({ preventScroll: !0 });
|
|
64
64
|
});
|
|
65
65
|
};
|
|
66
66
|
return /* @__PURE__ */ l(p, { children: [
|
|
@@ -128,7 +128,7 @@ var mi = ({ onCloseText: u = "", onMinimizeText: _ = "", onExpandText: R = "", o
|
|
|
128
128
|
"aria-labelledby": n ? W : void 0,
|
|
129
129
|
className: s("fixed bottom-4 right-4 z-[51] rounded-lg bg-white shadow-[0_4px_40px_0px_rgba(34,33,51,0.4)] transition-all duration-300", "max-xs:max-w-[calc(100vw-32px)]", D && !i && !o ? D : "", i && "!h-0 !w-0 opacity-0 duration-0", n && "fixed duration-0"),
|
|
130
130
|
"data-testid": G,
|
|
131
|
-
children: /* @__PURE__ */ e(
|
|
131
|
+
children: /* @__PURE__ */ e(Se.Provider, {
|
|
132
132
|
value: c,
|
|
133
133
|
children: /* @__PURE__ */ l("div", {
|
|
134
134
|
className: B("flex flex-col", o && !i && "h-full"),
|
|
@@ -136,10 +136,7 @@ var mi = ({ onCloseText: u = "", onMinimizeText: _ = "", onExpandText: R = "", o
|
|
|
136
136
|
ref: U,
|
|
137
137
|
"data-dialog-body": "",
|
|
138
138
|
className: s("flex min-h-0 flex-grow flex-col overflow-y-auto overscroll-contain", "[&_[data-dialog-footer]]:sticky [&_[data-dialog-footer]]:bottom-0 [&_[data-dialog-footer]]:z-[2] [&_[data-dialog-footer]]:bg-white"),
|
|
139
|
-
style:
|
|
140
|
-
scrollPaddingTop: pe,
|
|
141
|
-
scrollPaddingBottom: ge
|
|
142
|
-
},
|
|
139
|
+
style: Ge(pe, ge),
|
|
143
140
|
children: [/* @__PURE__ */ l("div", {
|
|
144
141
|
ref: be,
|
|
145
142
|
"data-dialog-header": "",
|
|
@@ -225,7 +222,7 @@ var mi = ({ onCloseText: u = "", onMinimizeText: _ = "", onExpandText: R = "", o
|
|
|
225
222
|
})]
|
|
226
223
|
}), /* @__PURE__ */ e("div", {
|
|
227
224
|
"data-dialog-content-flow": "",
|
|
228
|
-
className: v ? "flex-grow" : Fe(v),
|
|
225
|
+
className: v ? "isolate flex-grow" : Fe(v),
|
|
229
226
|
children: typeof x == "function" ? x({ fullScreen: o }) : x
|
|
230
227
|
})]
|
|
231
228
|
}), (Array.isArray(r) && r.length || typeof r == "function") && h || q ? /* @__PURE__ */ l("div", {
|
|
@@ -272,5 +269,5 @@ var mi = ({ onCloseText: u = "", onMinimizeText: _ = "", onExpandText: R = "", o
|
|
|
272
269
|
] });
|
|
273
270
|
};
|
|
274
271
|
export {
|
|
275
|
-
|
|
272
|
+
fi as MinimizableDialog
|
|
276
273
|
};
|
|
@@ -6,36 +6,36 @@ import { OverlayBackOwnerContext as me, isOverlayBackNavigationPending as ue, us
|
|
|
6
6
|
import { useFocusTrap as pe } from "../../../../hooks/useFocusTrap.hook.js";
|
|
7
7
|
import { useMobileMediaQuery as ve } from "../../../../hooks/useMediaQuery.hook.js";
|
|
8
8
|
import { useDialogHeaderPinning as he } from "../../dialog/useDialogHeaderPinning.js";
|
|
9
|
-
import { DIALOG_HEADER_ACTIONS_ROW_CLASSES as xe, DIALOG_HEADER_CLASSES as ge, DIALOG_TITLE_CLASSES as be, dialogContentFlowClasses as ye } from "../../dialog/dialogHeaderStyles.js";
|
|
10
|
-
import { fullScreenFieldWidthVars as
|
|
9
|
+
import { DIALOG_HEADER_ACTIONS_ROW_CLASSES as xe, DIALOG_HEADER_CLASSES as ge, DIALOG_TITLE_CLASSES as be, dialogContentFlowClasses as ye, dialogScrollerStyle as we } from "../../dialog/dialogHeaderStyles.js";
|
|
10
|
+
import { fullScreenFieldWidthVars as Ce } from "../../../inputs/field-styles.js";
|
|
11
11
|
import { CloseBtn as W } from "../components/CloseBtn.js";
|
|
12
12
|
import { MinimizeBtn as $ } from "../components/MinimizeBtn.js";
|
|
13
|
-
import { FullScreenBtn as
|
|
13
|
+
import { FullScreenBtn as Se } from "../components/FullscreenBtn.js";
|
|
14
14
|
import f from "./MinimizableDialogV2.module.js";
|
|
15
15
|
import { useTranslations as ze } from "./useTranslations.js";
|
|
16
16
|
import { useControlledProps as Re } from "./useControlledProps.js";
|
|
17
|
-
import
|
|
17
|
+
import Ne from "clsx";
|
|
18
18
|
import { useId as G, useLayoutEffect as Q, useRef as l } from "react";
|
|
19
|
-
import { Fragment as
|
|
20
|
-
var
|
|
19
|
+
import { Fragment as Be, jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
20
|
+
var Je = (R) => {
|
|
21
21
|
const { showCloseIcon: N = !0, showMinimizeIcon: U = !0, showExpandIcon: J = !0, enableFullscreen: K = !0, fullscreenLockedReason: B, title: p, label: v, children: X, open: i, onClose: Y, classNameOverrides: h = {
|
|
22
22
|
maximized: "",
|
|
23
23
|
minimized: "",
|
|
24
24
|
fullscreen: ""
|
|
25
|
-
}, dataTest: Z, actionNode: ee, locale: te = "en", busyReason: ie, style: I, initialFocusRef: _ } =
|
|
26
|
-
if (
|
|
25
|
+
}, dataTest: Z, actionNode: ee, locale: te = "en", busyReason: ie, style: I, initialFocusRef: _ } = R, x = ve(), o = ze(te), n = l(null), c = l(null), k = l(null), E = l(null), g = l(!1), b = l(null), y = G(), F = G(), T = l(null), { headerRef: oe, pinned: w, hidden: C, scrollPaddingTop: ne, scrollPaddingBottom: le } = he(T), { minimized: t, setMinimized: A, fullScreen: a, setFullScreen: D } = Re(R), s = a && !t, L = !!B, { busy: S, busyReason: O, contextValue: M } = ce(ie ?? o.waitUntilSaved), m = () => {
|
|
26
|
+
if (S) return !1;
|
|
27
27
|
A(!1), Y();
|
|
28
28
|
};
|
|
29
29
|
Q(() => {
|
|
30
30
|
n.current?.toggleAttribute("inert", t), c.current?.toggleAttribute("inert", !t);
|
|
31
31
|
}, [t]), Q(() => {
|
|
32
|
-
const
|
|
32
|
+
const z = i && !g.current, d = !i && g.current;
|
|
33
33
|
if (g.current = i, d) {
|
|
34
34
|
const H = b.current;
|
|
35
35
|
b.current = null, (!document.activeElement || document.activeElement === document.body) && H?.isConnected && H.focus({ preventScroll: !0 });
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
if (!
|
|
38
|
+
if (!z) return;
|
|
39
39
|
b.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
40
40
|
const j = t ? c.current : n.current, se = t ? E.current : k.current;
|
|
41
41
|
(_?.current ?? se ?? (j ? q(j) : void 0))?.focus({ preventScroll: !0 });
|
|
@@ -45,9 +45,9 @@ var Ue = (S) => {
|
|
|
45
45
|
i
|
|
46
46
|
]);
|
|
47
47
|
const P = () => {
|
|
48
|
-
const
|
|
48
|
+
const z = t ? n : c;
|
|
49
49
|
A(!t), requestAnimationFrame(() => {
|
|
50
|
-
const d =
|
|
50
|
+
const d = z.current;
|
|
51
51
|
d && (d.querySelector('[data-testid="toggle-minimize-btn"]') ?? q(d))?.focus({ preventScroll: !0 });
|
|
52
52
|
});
|
|
53
53
|
};
|
|
@@ -72,11 +72,11 @@ var Ue = (S) => {
|
|
|
72
72
|
width: "min(1000px, calc(100vw - 32px))",
|
|
73
73
|
maxWidth: "min(1000px, calc(100vw - 32px))",
|
|
74
74
|
height: "95dvh",
|
|
75
|
-
...
|
|
75
|
+
...Ce
|
|
76
76
|
} : void 0;
|
|
77
77
|
if (!i) return null;
|
|
78
78
|
const ae = v ? `${F} ${y}` : y;
|
|
79
|
-
return /* @__PURE__ */ r(
|
|
79
|
+
return /* @__PURE__ */ r(Be, { children: [
|
|
80
80
|
/* @__PURE__ */ e("div", {
|
|
81
81
|
ref: c,
|
|
82
82
|
style: {
|
|
@@ -85,7 +85,7 @@ var Ue = (S) => {
|
|
|
85
85
|
},
|
|
86
86
|
className: u(f["minimized-dialog"], !t && f.hidden, h.minimized),
|
|
87
87
|
children: /* @__PURE__ */ r("div", {
|
|
88
|
-
className:
|
|
88
|
+
className: Ne("flex items-center justify-between", !t && "hidden"),
|
|
89
89
|
"data-testid": Z,
|
|
90
90
|
children: [/* @__PURE__ */ e("div", {
|
|
91
91
|
className: "min-w-0 max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
|
|
@@ -110,7 +110,7 @@ var Ue = (S) => {
|
|
|
110
110
|
buttonRef: E,
|
|
111
111
|
showCloseIcon: N,
|
|
112
112
|
onClick: m,
|
|
113
|
-
disabledReason:
|
|
113
|
+
disabledReason: S ? O : void 0,
|
|
114
114
|
tooltipTitle: o.close
|
|
115
115
|
})]
|
|
116
116
|
})]
|
|
@@ -139,10 +139,7 @@ var Ue = (S) => {
|
|
|
139
139
|
ref: T,
|
|
140
140
|
"data-dialog-body": "",
|
|
141
141
|
className: u(t && "hidden", "flex min-h-0 flex-grow flex-col overflow-y-auto overscroll-contain", "[&>[data-dialog-content-flow]>[data-dialog-content]]:!flex-[1_0_auto]", "[&_[data-dialog-footer]]:sticky [&_[data-dialog-footer]]:bottom-0 [&_[data-dialog-footer]]:z-[2] [&_[data-dialog-footer]]:bg-white"),
|
|
142
|
-
style:
|
|
143
|
-
scrollPaddingTop: ne,
|
|
144
|
-
scrollPaddingBottom: le
|
|
145
|
-
},
|
|
142
|
+
style: we(ne, le),
|
|
146
143
|
children: [/* @__PURE__ */ r("div", {
|
|
147
144
|
ref: oe,
|
|
148
145
|
"data-dialog-header": "",
|
|
@@ -169,7 +166,7 @@ var Ue = (S) => {
|
|
|
169
166
|
onClick: P,
|
|
170
167
|
tooltipTitle: o.minimize
|
|
171
168
|
}),
|
|
172
|
-
/* @__PURE__ */ e(
|
|
169
|
+
/* @__PURE__ */ e(Se, {
|
|
173
170
|
showFullScreenIcon: (K || L) && !x,
|
|
174
171
|
disabledReason: B,
|
|
175
172
|
fullScreen: a,
|
|
@@ -182,7 +179,7 @@ var Ue = (S) => {
|
|
|
182
179
|
buttonRef: k,
|
|
183
180
|
showCloseIcon: N,
|
|
184
181
|
onClick: m,
|
|
185
|
-
disabledReason:
|
|
182
|
+
disabledReason: S ? O : void 0,
|
|
186
183
|
tooltipTitle: o.close
|
|
187
184
|
})
|
|
188
185
|
]
|
|
@@ -206,5 +203,5 @@ var Ue = (S) => {
|
|
|
206
203
|
] });
|
|
207
204
|
};
|
|
208
205
|
export {
|
|
209
|
-
|
|
206
|
+
Je as MinimizableDialogV2
|
|
210
207
|
};
|
|
@@ -1,50 +1,54 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import { tabbableWithin as
|
|
4
|
-
import { TOP_LAYER_PROPS as
|
|
5
|
-
import { OverlayBackOwnerContext as
|
|
6
|
-
import { useEffect as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { FloatingPortal as
|
|
9
|
-
var
|
|
1
|
+
import { cn as $ } from "../../../helpers/cn.js";
|
|
2
|
+
import { resolveSx as R } from "../../../helpers/sx.js";
|
|
3
|
+
import { tabbableWithin as y } from "../../../helpers/focusable.js";
|
|
4
|
+
import { TOP_LAYER_PROPS as j, TOP_LAYER_RESET_STYLE as q, getOpenModalDialogAncestor as C, shouldUsePopoverTopLayer as G, useTopLayerRef as J } from "../../../hooks/useTopLayer.hook.js";
|
|
5
|
+
import { OverlayBackOwnerContext as Q, useBackCloses as V } from "../../../hooks/useBackCloses.hook.js";
|
|
6
|
+
import { useEffect as P, useMemo as X, useRef as Z, useState as w } from "react";
|
|
7
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
8
|
+
import { FloatingPortal as ee, autoUpdate as te, flip as oe, offset as ne, shift as re, size as se, useDismiss as ie, useFloating as ae, useInteractions as ce, useMergeRefs as fe } from "@floating-ui/react";
|
|
9
|
+
var ue = {
|
|
10
10
|
vertical: "bottom",
|
|
11
11
|
horizontal: "left"
|
|
12
|
-
},
|
|
12
|
+
}, le = {
|
|
13
13
|
vertical: "top",
|
|
14
14
|
horizontal: "left"
|
|
15
|
-
},
|
|
16
|
-
const _ =
|
|
17
|
-
t && !
|
|
18
|
-
const m = t || O &&
|
|
19
|
-
o && v !== p &&
|
|
20
|
-
const { refs: i, floatingStyles:
|
|
15
|
+
}, de = (t, o) => `${o.vertical === "bottom" ? "top" : o.vertical === "top" ? "bottom" : t.vertical === "top" ? "top" : "bottom"}${t.horizontal === "left" ? "-start" : t.horizontal === "right" ? "-end" : ""}`, be = ({ open: t, anchorEl: o, onClose: c, anchorOrigin: h = ue, transformOrigin: b = le, id: D, className: T, sx: K, slotProps: l, onClick: k, children: E, keepMounted: O = !1, tabIntoContent: d = !0, registerBackClose: S = !0 }) => {
|
|
16
|
+
const _ = X(() => de(h, b), [h, b]), [L, F] = w(t), f = Z(!1), [M, H] = w();
|
|
17
|
+
t && !L && F(!0);
|
|
18
|
+
const m = t || O && L, p = C(o), [v, A] = w(p);
|
|
19
|
+
o && v !== p && A(p);
|
|
20
|
+
const { refs: i, floatingStyles: z, context: N } = ae({
|
|
21
21
|
open: t,
|
|
22
22
|
placement: _,
|
|
23
23
|
strategy: "fixed",
|
|
24
|
-
whileElementsMounted:
|
|
24
|
+
whileElementsMounted: te,
|
|
25
25
|
elements: { reference: o ?? void 0 },
|
|
26
26
|
middleware: [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
ne(4),
|
|
28
|
+
oe({ padding: 8 }),
|
|
29
|
+
re({ padding: 8 }),
|
|
30
|
+
se({
|
|
31
|
+
padding: 8,
|
|
32
|
+
apply: ({ availableHeight: e }) => H(e)
|
|
33
|
+
})
|
|
30
34
|
],
|
|
31
35
|
onOpenChange: (e, r, n) => {
|
|
32
36
|
e || c?.(r ?? {}, n === "escape-key" ? "escapeKeyDown" : "backdropClick");
|
|
33
37
|
}
|
|
34
|
-
}), { getFloatingProps:
|
|
38
|
+
}), { getFloatingProps: U } = ce([ie(N, {
|
|
35
39
|
outsidePress: (e) => {
|
|
36
40
|
const r = e.target;
|
|
37
41
|
return !(o instanceof Element && r instanceof Node && o.contains(r));
|
|
38
42
|
},
|
|
39
43
|
escapeKey: !0
|
|
40
44
|
})]);
|
|
41
|
-
|
|
45
|
+
V({
|
|
42
46
|
active: t && S,
|
|
43
47
|
requestClose: (e) => c ? c(e ?? new Event("overlayBack"), "escapeKeyDown") : !1,
|
|
44
48
|
ownerRef: i.floating
|
|
45
49
|
});
|
|
46
|
-
const u =
|
|
47
|
-
|
|
50
|
+
const u = G(v), B = fe([J(i.setFloating, u)]);
|
|
51
|
+
P(() => {
|
|
48
52
|
if (!t) return;
|
|
49
53
|
const e = o instanceof HTMLElement ? o : null, r = () => i.floating.current?.contains(document.activeElement) ?? !1;
|
|
50
54
|
let n = r();
|
|
@@ -53,20 +57,20 @@ var ae = {
|
|
|
53
57
|
};
|
|
54
58
|
return document.addEventListener("focusin", s), () => {
|
|
55
59
|
document.removeEventListener("focusin", s);
|
|
56
|
-
const a = document.activeElement,
|
|
57
|
-
n &&
|
|
60
|
+
const a = document.activeElement, g = !a || a === document.body || r();
|
|
61
|
+
n && g && e?.isConnected && e.focus({ preventScroll: !0 });
|
|
58
62
|
};
|
|
59
63
|
}, [
|
|
60
64
|
t,
|
|
61
65
|
o,
|
|
62
66
|
i.floating
|
|
63
|
-
]),
|
|
67
|
+
]), P(() => {
|
|
64
68
|
if (!t) return;
|
|
65
69
|
const e = (n) => {
|
|
66
70
|
if (f.current = n.key === "Tab", !d || !f.current || n.shiftKey || n.defaultPrevented) return;
|
|
67
71
|
const s = i.floating.current;
|
|
68
72
|
if (!s || !(o instanceof Element) || !o.contains(document.activeElement)) return;
|
|
69
|
-
const [a] =
|
|
73
|
+
const [a] = y(s);
|
|
70
74
|
a && (n.preventDefault(), a.focus({ preventScroll: !0 }), f.current = !1);
|
|
71
75
|
}, r = (n) => {
|
|
72
76
|
const s = n.target, a = s instanceof Node && ((i.floating.current?.contains(s) ?? !1) || o instanceof Element && o.contains(s));
|
|
@@ -82,18 +86,18 @@ var ae = {
|
|
|
82
86
|
i.floating,
|
|
83
87
|
d
|
|
84
88
|
]);
|
|
85
|
-
const
|
|
89
|
+
const I = t ? U({
|
|
86
90
|
onClick: k,
|
|
87
91
|
onKeyDown: (e) => {
|
|
88
92
|
if (e.key !== "Tab" || e.defaultPrevented || !(o instanceof HTMLElement)) return;
|
|
89
|
-
const r = e.currentTarget, n =
|
|
93
|
+
const r = e.currentTarget, n = y(r), s = n.indexOf(document.activeElement);
|
|
90
94
|
if (s === -1 || (e.shiftKey ? s !== 0 : s !== n.length - 1)) return;
|
|
91
95
|
e.preventDefault();
|
|
92
|
-
const a =
|
|
93
|
-
f.current = !1,
|
|
96
|
+
const a = y(document).filter((W) => !r.contains(W)), g = a[a.indexOf(o) + (e.shiftKey ? -1 : 1)], Y = (d && e.shiftKey ? void 0 : g) ?? o;
|
|
97
|
+
f.current = !1, Y.focus({ preventScroll: !0 }), c?.(e, "tabKeyDown");
|
|
94
98
|
}
|
|
95
99
|
}) : {};
|
|
96
|
-
return
|
|
100
|
+
return P(() => {
|
|
97
101
|
if (!m || !u) return;
|
|
98
102
|
const e = i.floating.current;
|
|
99
103
|
if (!(!e || typeof e.showPopover != "function"))
|
|
@@ -106,23 +110,26 @@ var ae = {
|
|
|
106
110
|
m,
|
|
107
111
|
u,
|
|
108
112
|
i.floating
|
|
109
|
-
]), m ? /* @__PURE__ */
|
|
113
|
+
]), m ? /* @__PURE__ */ x(ee, {
|
|
110
114
|
root: v,
|
|
111
|
-
children: /* @__PURE__ */
|
|
112
|
-
ref:
|
|
115
|
+
children: /* @__PURE__ */ x("div", {
|
|
116
|
+
ref: B,
|
|
113
117
|
id: D,
|
|
114
|
-
...u ?
|
|
118
|
+
...u ? j : {},
|
|
115
119
|
style: {
|
|
116
|
-
...u ?
|
|
117
|
-
...t ?
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
...u ? q : {},
|
|
121
|
+
...t ? {
|
|
122
|
+
...z,
|
|
123
|
+
maxHeight: M
|
|
124
|
+
} : {},
|
|
125
|
+
...R(K),
|
|
126
|
+
...R(l?.paper?.sx),
|
|
120
127
|
...l?.paper?.style,
|
|
121
128
|
...t ? null : { display: "none" }
|
|
122
129
|
},
|
|
123
|
-
...
|
|
124
|
-
className:
|
|
125
|
-
children: /* @__PURE__ */
|
|
130
|
+
...I,
|
|
131
|
+
className: $("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]", T ?? "my-1", l?.paper?.className),
|
|
132
|
+
children: /* @__PURE__ */ x(Q.Provider, {
|
|
126
133
|
value: i.floating,
|
|
127
134
|
children: E
|
|
128
135
|
})
|
|
@@ -130,5 +137,5 @@ var ae = {
|
|
|
130
137
|
}) : null;
|
|
131
138
|
};
|
|
132
139
|
export {
|
|
133
|
-
|
|
140
|
+
be as StyledPopover
|
|
134
141
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
1
2
|
/**
|
|
2
3
|
* The one dialog header layout (ASMA-8737), shared by `StyledDialog`, `MinimizableDialog` and
|
|
3
4
|
* `MinimizableDialogV2`: the actions row on top, then the title on a row of its own across the full
|
|
@@ -19,6 +20,16 @@ export declare const DIALOG_HEADER_CLASSES = "box-border w-full min-w-0 max-w-fu
|
|
|
19
20
|
* still grows to fill a short dialog, keeping a form's footer at the bottom.
|
|
20
21
|
*/
|
|
21
22
|
export declare const dialogContentFlowClasses: (pinned: boolean) => string;
|
|
23
|
+
/**
|
|
24
|
+
* The scroller's inline style: scroll padding for focus, plus the same offsets as CSS variables so a
|
|
25
|
+
* sticky child of the content can sit under a pinned header with `top-[var(--dialog-header-offset,0px)]`
|
|
26
|
+
* (0 when the header scrolls away or is stepped aside). Always set, so a nested dialog never inherits
|
|
27
|
+
* its parent's offset.
|
|
28
|
+
*
|
|
29
|
+
* The content flow is `isolate`d, so a consumer `z-index` stays below the header (z-2): a sticky bar
|
|
30
|
+
* or a menu that is not portalled can slide under the header, never over the title.
|
|
31
|
+
*/
|
|
32
|
+
export declare const dialogScrollerStyle: (scrollPaddingTop: number, scrollPaddingBottom: number) => CSSProperties;
|
|
22
33
|
/** Label (if any) on the left, the header actions on the right. Wraps rather than overflowing at 320 px. */
|
|
23
34
|
export declare const DIALOG_HEADER_ACTIONS_ROW_CLASSES = "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";
|
|
24
35
|
/**
|