asma-ui-core 3.46.1 → 3.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,121 +1,123 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import { CloseIcon as
|
|
4
|
-
import { StyledButton as
|
|
5
|
-
import { useMobileMediaQuery as
|
|
6
|
-
import
|
|
7
|
-
import { useEffect as
|
|
8
|
-
import { jsx as l, jsxs as
|
|
9
|
-
var
|
|
1
|
+
import { cn as f } from "../../../helpers/cn.js";
|
|
2
|
+
import { resolveSx as D } from "../../../helpers/sx.js";
|
|
3
|
+
import { CloseIcon as B } from "../../icons/close-icon/CloseIcon.js";
|
|
4
|
+
import { StyledButton as F } from "../../inputs/button/StyledButton.js";
|
|
5
|
+
import { useMobileMediaQuery as G } from "../../../hooks/useMediaQuery.hook.js";
|
|
6
|
+
import P from "./StyledDialog.module.js";
|
|
7
|
+
import { useEffect as _, useLayoutEffect as Q, useRef as u } from "react";
|
|
8
|
+
import { jsx as l, jsxs as r } from "react/jsx-runtime";
|
|
9
|
+
var $ = {
|
|
10
10
|
xs: 444,
|
|
11
11
|
sm: 600,
|
|
12
12
|
md: 900,
|
|
13
13
|
lg: 1200,
|
|
14
14
|
xl: 1536
|
|
15
|
-
},
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
}, te = ({ open: t, onClose: a, children: C, dataTest: i, maxWidth: x = "sm", fullWidth: E, fullScreen: H, scroll: p = "paper", disableEscapeKeyDown: h, className: S, style: j, sx: M, classes: y, PaperProps: R, slotProps: o, onCloseText: w, showCloseIcon: b = !0, dialogLabel: d, dialogTitle: s, dialogHeaderNode: W }) => {
|
|
16
|
+
const I = G(), v = u(null), c = u(!1), g = u(t), n = I ? !0 : H;
|
|
17
|
+
_(() => {
|
|
18
|
+
g.current && !t && o?.transition?.onExited?.(), g.current = t;
|
|
19
|
+
}, [t, o]), Q(() => {
|
|
20
|
+
const e = v.current;
|
|
19
21
|
e && t && !e.open && e.showModal();
|
|
20
|
-
}, [t]),
|
|
22
|
+
}, [t]), _(() => {
|
|
21
23
|
if (!t) return;
|
|
22
|
-
const e = document.body.style.overflow,
|
|
24
|
+
const e = document.body.style.overflow, A = document.documentElement.style.overflow;
|
|
23
25
|
return document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden", () => {
|
|
24
|
-
document.body.style.overflow = e, document.documentElement.style.overflow =
|
|
26
|
+
document.body.style.overflow = e, document.documentElement.style.overflow = A;
|
|
25
27
|
};
|
|
26
28
|
}, [t]);
|
|
27
|
-
const
|
|
28
|
-
...
|
|
29
|
-
...
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, 0),
|
|
34
|
-
},
|
|
35
|
-
e.preventDefault(),
|
|
29
|
+
const m = {
|
|
30
|
+
...R,
|
|
31
|
+
...o?.paper
|
|
32
|
+
}, k = x === !1 ? void 0 : $[x], { className: O, style: z, onClick: K, ...X } = o?.backdrop ?? {}, N = (e) => {
|
|
33
|
+
c.current || (c.current = !0, window.setTimeout(() => {
|
|
34
|
+
c.current = !1;
|
|
35
|
+
}, 0), a?.(e, "escapeKeyDown"));
|
|
36
|
+
}, q = (e) => {
|
|
37
|
+
e.preventDefault(), h || N(e);
|
|
36
38
|
};
|
|
37
|
-
return t ? /* @__PURE__ */
|
|
38
|
-
ref:
|
|
39
|
+
return t ? /* @__PURE__ */ r("dialog", {
|
|
40
|
+
ref: v,
|
|
39
41
|
tabIndex: -1,
|
|
40
|
-
"data-testid":
|
|
41
|
-
"aria-label":
|
|
42
|
-
onCancel:
|
|
42
|
+
"data-testid": i,
|
|
43
|
+
"aria-label": i,
|
|
44
|
+
onCancel: q,
|
|
43
45
|
onKeyDown: (e) => {
|
|
44
|
-
e.key !== "Escape" ||
|
|
46
|
+
e.key !== "Escape" || h || (e.preventDefault(), N(e));
|
|
45
47
|
},
|
|
46
|
-
className:
|
|
48
|
+
className: f(P.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", p === "body" && "overflow-y-auto", S, y?.root),
|
|
47
49
|
style: {
|
|
48
50
|
zIndex: 999,
|
|
49
|
-
...
|
|
50
|
-
...
|
|
51
|
+
...D(M),
|
|
52
|
+
...j
|
|
51
53
|
},
|
|
52
54
|
children: [/* @__PURE__ */ l("div", {
|
|
53
|
-
...
|
|
54
|
-
className:
|
|
55
|
-
style:
|
|
55
|
+
...X,
|
|
56
|
+
className: f("absolute inset-0 bg-[#626e7eb2]", O),
|
|
57
|
+
style: z,
|
|
56
58
|
onClick: (e) => {
|
|
57
|
-
|
|
59
|
+
K?.(e), e.defaultPrevented || a?.(e, "backdropClick");
|
|
58
60
|
}
|
|
59
|
-
}), /* @__PURE__ */
|
|
60
|
-
className:
|
|
61
|
+
}), /* @__PURE__ */ r("div", {
|
|
62
|
+
className: f("relative z-[1] flex overflow-hidden rounded-lg border-0 bg-white p-0 text-delta-800 shadow-[0px_4px_40px_0px_#22213366]", p === "paper" && "flex-col", n && "rounded-none", m.className, y?.paper),
|
|
61
63
|
style: {
|
|
62
64
|
minWidth: 0,
|
|
63
65
|
minHeight: 0,
|
|
64
|
-
...!
|
|
65
|
-
...
|
|
66
|
+
...!n && k ? { maxWidth: k } : {},
|
|
67
|
+
...n ? {
|
|
66
68
|
width: "100%",
|
|
67
69
|
maxWidth: "100%",
|
|
68
70
|
height: "100%",
|
|
69
71
|
maxHeight: "100%"
|
|
70
72
|
} : {
|
|
71
|
-
width:
|
|
73
|
+
width: E ? "calc(100% - 64px)" : "auto",
|
|
72
74
|
maxHeight: "100%"
|
|
73
75
|
},
|
|
74
|
-
...
|
|
75
|
-
...
|
|
76
|
-
...
|
|
76
|
+
...D(m.sx),
|
|
77
|
+
...m.style,
|
|
78
|
+
...n ? {
|
|
77
79
|
width: "100%",
|
|
78
80
|
maxWidth: "100%",
|
|
79
81
|
height: "100%",
|
|
80
82
|
maxHeight: "100%"
|
|
81
83
|
} : { maxHeight: "calc(100% - 64px)" }
|
|
82
84
|
},
|
|
83
|
-
children: [(!!
|
|
85
|
+
children: [(!!d || !!s || b) && /* @__PURE__ */ r("div", {
|
|
84
86
|
className: "box-border flex w-full min-w-0 max-w-full justify-between px-4 pt-4",
|
|
85
|
-
children: [/* @__PURE__ */
|
|
87
|
+
children: [/* @__PURE__ */ r("div", {
|
|
86
88
|
className: "flex min-w-0 flex-1 flex-col justify-start gap-0.5",
|
|
87
|
-
children: [
|
|
89
|
+
children: [d && /* @__PURE__ */ l("div", {
|
|
88
90
|
className: "flex h-8 items-center text-sm font-normal leading-5 text-delta-600",
|
|
89
|
-
children: i
|
|
90
|
-
}), d && /* @__PURE__ */ l("div", {
|
|
91
|
-
className: "flex text-2xl font-semibold leading-8 text-delta-800",
|
|
92
91
|
children: d
|
|
92
|
+
}), s && /* @__PURE__ */ l("div", {
|
|
93
|
+
className: "flex text-2xl font-semibold leading-8 text-delta-800",
|
|
94
|
+
children: s
|
|
93
95
|
})]
|
|
94
|
-
}),
|
|
96
|
+
}), b && /* @__PURE__ */ r("div", {
|
|
95
97
|
className: "flex min-w-0 max-w-full shrink-0 justify-end gap-2",
|
|
96
|
-
children: [
|
|
97
|
-
dataTest: `close-button-${
|
|
98
|
-
"aria-label":
|
|
98
|
+
children: [W, /* @__PURE__ */ l(F, {
|
|
99
|
+
dataTest: `close-button-${i}`,
|
|
100
|
+
"aria-label": w ? void 0 : "Close",
|
|
99
101
|
variant: "textGray",
|
|
100
102
|
size: "small",
|
|
101
|
-
endIcon: /* @__PURE__ */ l(
|
|
103
|
+
endIcon: /* @__PURE__ */ l(B, {
|
|
102
104
|
width: 20,
|
|
103
105
|
height: 20
|
|
104
106
|
}),
|
|
105
107
|
className: "max-w-full shrink-0 whitespace-nowrap",
|
|
106
|
-
onClick: (e) =>
|
|
108
|
+
onClick: (e) => a?.(e, "escapeKeyDown"),
|
|
107
109
|
style: {
|
|
108
110
|
color: "var(--colors-delta-800)",
|
|
109
111
|
paddingRight: "6px",
|
|
110
112
|
paddingLeft: "6px"
|
|
111
113
|
},
|
|
112
|
-
children:
|
|
114
|
+
children: w
|
|
113
115
|
})]
|
|
114
116
|
})]
|
|
115
|
-
}),
|
|
117
|
+
}), C]
|
|
116
118
|
})]
|
|
117
119
|
}) : null;
|
|
118
120
|
};
|
|
119
121
|
export {
|
|
120
|
-
|
|
122
|
+
te as StyledDialog
|
|
121
123
|
};
|
|
@@ -33,14 +33,14 @@ var et = ({ dataTest: u, label: a, value: p, defaultValue: b, onChange: O, onBlu
|
|
|
33
33
|
_.current = e instanceof HTMLTextAreaElement ? e : null;
|
|
34
34
|
}, [])]), { style: E, ...Re } = c, f = !r && !d, Ee = f ? {
|
|
35
35
|
boxSizing: "border-box",
|
|
36
|
-
...F,
|
|
37
36
|
height: 40,
|
|
38
37
|
minHeight: 40,
|
|
39
|
-
maxHeight: 40
|
|
38
|
+
maxHeight: 40,
|
|
39
|
+
...F
|
|
40
40
|
} : d ? {
|
|
41
41
|
boxSizing: "border-box",
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
minHeight: 40,
|
|
43
|
+
...F
|
|
44
44
|
} : F, Me = f ? {
|
|
45
45
|
...E,
|
|
46
46
|
height: void 0,
|