asma-ui-core 3.64.0 → 3.64.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.
|
@@ -4,51 +4,52 @@ import { TOP_LAYER_PROPS as U, TOP_LAYER_RESET_STYLE as Y, getOpenModalDialogAnc
|
|
|
4
4
|
import { cloneElement as D, useRef as H, useState as I } from "react";
|
|
5
5
|
import { Fragment as N, jsx as f, jsxs as g } from "react/jsx-runtime";
|
|
6
6
|
import { FloatingArrow as z, FloatingPortal as B, arrow as G, autoUpdate as W, flip as q, offset as J, shift as K, useDismiss as Q, useFloating as V, useFocus as X, useHover as Z, useInteractions as $, useMergeRefs as ee, useRole as oe } from "@floating-ui/react";
|
|
7
|
-
var te = "#363E4A", pe = (e) => !e.title && e.title !== 0 ? e.children : /* @__PURE__ */ f(re, { ...e }), re = ({ title: e, children: t, placement: u = "top", arrow: r = !1, enterDelay: x = 500, leaveDelay:
|
|
8
|
-
const [
|
|
9
|
-
|
|
10
|
-
}, { refs:
|
|
11
|
-
open:
|
|
7
|
+
var te = "#363E4A", pe = (e) => !e.title && e.title !== 0 ? e.children : /* @__PURE__ */ f(re, { ...e }), re = ({ title: e, children: t, placement: u = "top", arrow: r = !1, enterDelay: x = 500, leaveDelay: v = 0, open: p, onOpen: R, onClose: y, disableHoverListener: h, disableFocusListener: w, offsetDistance: F, className: T, slotProps: s }) => {
|
|
8
|
+
const [_, E] = I(!1), l = p !== void 0, n = p ?? _, c = H(null), O = (m) => {
|
|
9
|
+
l || E(m), m ? R?.() : y?.();
|
|
10
|
+
}, { refs: i, floatingStyles: b, context: o } = V({
|
|
11
|
+
open: n,
|
|
12
12
|
onOpenChange: O,
|
|
13
13
|
placement: u,
|
|
14
14
|
strategy: "fixed",
|
|
15
15
|
whileElementsMounted: W,
|
|
16
16
|
middleware: [
|
|
17
|
-
J(
|
|
17
|
+
J(F ?? (r ? 8 : 6)),
|
|
18
18
|
q({ padding: 8 }),
|
|
19
19
|
K({ padding: 8 }),
|
|
20
20
|
...r ? [G({ element: c })] : []
|
|
21
21
|
]
|
|
22
|
-
}), { getReferenceProps:
|
|
22
|
+
}), { getReferenceProps: P, getFloatingProps: A } = $([
|
|
23
23
|
Z(o, {
|
|
24
|
-
enabled: !
|
|
24
|
+
enabled: !l && !h,
|
|
25
25
|
delay: {
|
|
26
26
|
open: x,
|
|
27
|
-
close:
|
|
27
|
+
close: v
|
|
28
28
|
},
|
|
29
29
|
move: !1
|
|
30
30
|
}),
|
|
31
|
-
X(o, { enabled: !
|
|
31
|
+
X(o, { enabled: !l && !w }),
|
|
32
32
|
Q(o),
|
|
33
33
|
oe(o, { role: "tooltip" })
|
|
34
|
-
]), d =
|
|
35
|
-
return /* @__PURE__ */ g(N, { children: [D(t,
|
|
36
|
-
ref: ee([
|
|
34
|
+
]), d = n ? j(i.reference.current) : void 0, a = k(d), L = C(i.setFloating, a);
|
|
35
|
+
return /* @__PURE__ */ g(N, { children: [D(t, P({
|
|
36
|
+
ref: ee([i.setReference, t.ref]),
|
|
37
37
|
...t.props
|
|
38
|
-
})),
|
|
38
|
+
})), n && /* @__PURE__ */ f(B, {
|
|
39
39
|
root: d,
|
|
40
40
|
children: /* @__PURE__ */ g("div", {
|
|
41
41
|
ref: L,
|
|
42
|
-
...
|
|
42
|
+
...a ? U : {},
|
|
43
43
|
...A(),
|
|
44
44
|
style: {
|
|
45
|
-
...
|
|
46
|
-
...
|
|
45
|
+
...a ? Y : {},
|
|
46
|
+
...b,
|
|
47
47
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
48
|
-
|
|
49
|
-
...
|
|
48
|
+
overflow: "visible",
|
|
49
|
+
...s?.tooltip?.style,
|
|
50
|
+
...M(s?.tooltip?.sx)
|
|
50
51
|
},
|
|
51
|
-
className: S("z-[1500] block max-w-[320px] whitespace-normal break-words rounded-[3px] bg-[#363E4A] px-2 py-1 text-sm leading-5 text-white shadow-[0px_1px_6px_0px_rgba(0,0,0,0.15)]",
|
|
52
|
+
className: S("z-[1500] block max-w-[320px] whitespace-normal break-words rounded-[3px] bg-[#363E4A] px-2 py-1 text-sm leading-5 text-white shadow-[0px_1px_6px_0px_rgba(0,0,0,0.15)]", T, s?.tooltip?.className),
|
|
52
53
|
children: [e, r && /* @__PURE__ */ f(z, {
|
|
53
54
|
ref: c,
|
|
54
55
|
context: o,
|
|
@@ -1,51 +1,101 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import { getOpenModalDialogAncestor as
|
|
4
|
-
import { useFocusTrap as
|
|
5
|
-
import { useEffect as
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { FloatingPortal as
|
|
8
|
-
var
|
|
1
|
+
import { cn as c } from "../../../helpers/cn.js";
|
|
2
|
+
import { resolveSx as m } from "../../../helpers/sx.js";
|
|
3
|
+
import { TOP_LAYER_PROPS as d, getOpenModalDialogAncestor as O, shouldUsePopoverTopLayer as b } from "../../../hooks/useTopLayer.hook.js";
|
|
4
|
+
import { useFocusTrap as T } from "../../../hooks/useFocusTrap.hook.js";
|
|
5
|
+
import { useEffect as S, useLayoutEffect as L, useRef as h } from "react";
|
|
6
|
+
import { jsx as v, jsxs as k } from "react/jsx-runtime";
|
|
7
|
+
import { FloatingPortal as A } from "@floating-ui/react";
|
|
8
|
+
var D = {
|
|
9
9
|
left: "inset-y-0 left-0 h-full",
|
|
10
10
|
right: "inset-y-0 right-0 h-full",
|
|
11
11
|
top: "inset-x-0 top-0 w-full",
|
|
12
12
|
bottom: "inset-x-0 bottom-0 w-full"
|
|
13
|
-
},
|
|
13
|
+
}, N = {
|
|
14
14
|
left: "-translate-x-full",
|
|
15
15
|
right: "translate-x-full",
|
|
16
16
|
top: "-translate-y-full",
|
|
17
17
|
bottom: "translate-y-full"
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
}, y = {
|
|
19
|
+
margin: 0,
|
|
20
|
+
border: "none",
|
|
21
|
+
padding: 0
|
|
22
|
+
}, U = {
|
|
23
|
+
...y,
|
|
24
|
+
width: "auto",
|
|
25
|
+
height: "auto"
|
|
26
|
+
}, C = {
|
|
27
|
+
left: {
|
|
28
|
+
right: "auto",
|
|
29
|
+
width: "auto"
|
|
30
|
+
},
|
|
31
|
+
right: {
|
|
32
|
+
left: "auto",
|
|
33
|
+
width: "auto"
|
|
34
|
+
},
|
|
35
|
+
top: {
|
|
36
|
+
bottom: "auto",
|
|
37
|
+
height: "auto"
|
|
38
|
+
},
|
|
39
|
+
bottom: {
|
|
40
|
+
top: "auto",
|
|
41
|
+
height: "auto"
|
|
42
|
+
}
|
|
43
|
+
}, G = ({ open: o = !1, onClose: a, anchor: i = "left", variant: E = "temporary", hideBackdrop: _, className: g, sx: w, PaperProps: l, ModalProps: P, anchorEl: x, children: R }) => {
|
|
44
|
+
const e = E === "temporary", f = O(x), s = h(null), n = h(null), r = e && b(f), u = (t) => {
|
|
45
|
+
if (!(!t || !o || !r))
|
|
46
|
+
try {
|
|
47
|
+
typeof t.showPopover == "function" && !t.matches(":popover-open") && t.showPopover();
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
return L(() => {
|
|
52
|
+
if (!(!o || !r))
|
|
53
|
+
for (const t of [n.current, s.current]) try {
|
|
54
|
+
if (!t || typeof t.showPopover != "function") continue;
|
|
55
|
+
t.matches(":popover-open") && t.hidePopover(), t.showPopover();
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
}, [o, r]), S(() => {
|
|
59
|
+
if (!o || !e) return;
|
|
60
|
+
const t = (p) => {
|
|
61
|
+
p.key === "Escape" && a?.(p, "escapeKeyDown");
|
|
24
62
|
};
|
|
25
|
-
return document.addEventListener("keydown",
|
|
63
|
+
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
26
64
|
}, [
|
|
27
|
-
|
|
65
|
+
o,
|
|
28
66
|
e,
|
|
29
|
-
|
|
30
|
-
]),
|
|
31
|
-
root:
|
|
32
|
-
children: [e && !
|
|
67
|
+
a
|
|
68
|
+
]), T(o && e, s), e && !o && !P?.keepMounted ? null : /* @__PURE__ */ k(A, {
|
|
69
|
+
root: f,
|
|
70
|
+
children: [e && !_ && o && /* @__PURE__ */ v("div", {
|
|
71
|
+
ref: (t) => {
|
|
72
|
+
n.current = t, u(t);
|
|
73
|
+
},
|
|
74
|
+
...r ? d : void 0,
|
|
33
75
|
className: "fixed inset-0 z-[1200] bg-[#626e7eb2]",
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
76
|
+
style: r ? U : void 0,
|
|
77
|
+
onClick: (t) => a?.(t, "backdropClick")
|
|
78
|
+
}), /* @__PURE__ */ v("div", {
|
|
79
|
+
ref: (t) => {
|
|
80
|
+
s.current = t, u(t);
|
|
81
|
+
},
|
|
82
|
+
...r ? d : void 0,
|
|
37
83
|
role: e ? "dialog" : void 0,
|
|
38
|
-
"aria-modal": e &&
|
|
39
|
-
"aria-hidden": !
|
|
40
|
-
className:
|
|
84
|
+
"aria-modal": e && o ? !0 : void 0,
|
|
85
|
+
"aria-hidden": !o,
|
|
86
|
+
className: c("fixed z-[1200] overflow-auto bg-white transition-transform duration-300", o && "shadow-[0px_4px_40px_0px_#22213366]", D[i], !o && c(N[i], "pointer-events-none"), g, l?.className),
|
|
41
87
|
style: {
|
|
42
|
-
...
|
|
43
|
-
|
|
88
|
+
...r && {
|
|
89
|
+
...y,
|
|
90
|
+
...C[i]
|
|
91
|
+
},
|
|
92
|
+
...m(w),
|
|
93
|
+
...m(l?.sx)
|
|
44
94
|
},
|
|
45
|
-
children:
|
|
95
|
+
children: R
|
|
46
96
|
})]
|
|
47
97
|
});
|
|
48
98
|
};
|
|
49
99
|
export {
|
|
50
|
-
|
|
100
|
+
G as StyledDrawer
|
|
51
101
|
};
|