asma-ui-core 3.53.1 → 3.54.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,39 +1,41 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import { TOP_LAYER_PROPS as
|
|
4
|
-
import { useEffect as
|
|
5
|
-
import { jsx as
|
|
6
|
-
import { FloatingPortal as
|
|
7
|
-
var
|
|
1
|
+
import { cn as O } from "../../../helpers/cn.js";
|
|
2
|
+
import { resolveSx as c } from "../../../helpers/sx.js";
|
|
3
|
+
import { TOP_LAYER_PROPS as L, TOP_LAYER_RESET_STYLE as M, getOpenModalDialogAncestor as z, useTopLayerRef as D } from "../../../hooks/useTopLayer.hook.js";
|
|
4
|
+
import { useEffect as N, useMemo as k, useState as d } from "react";
|
|
5
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
6
|
+
import { FloatingPortal as C, autoUpdate as U, flip as Y, offset as H, shift as K, useDismiss as $, useFloating as j, useInteractions as I, useMergeRefs as q } from "@floating-ui/react";
|
|
7
|
+
var B = {
|
|
8
8
|
vertical: "bottom",
|
|
9
9
|
horizontal: "left"
|
|
10
|
-
},
|
|
10
|
+
}, G = {
|
|
11
11
|
vertical: "top",
|
|
12
12
|
horizontal: "left"
|
|
13
|
-
},
|
|
14
|
-
const
|
|
15
|
-
e && !
|
|
16
|
-
const
|
|
13
|
+
}, J = (e, o) => `${o.vertical === "bottom" ? "top" : o.vertical === "top" ? "bottom" : e.vertical === "top" ? "top" : "bottom"}${e.horizontal === "left" ? "-start" : e.horizontal === "right" ? "-end" : ""}`, te = ({ open: e, anchorEl: o, onClose: m, anchorOrigin: l = B, transformOrigin: n = G, id: v, className: g, sx: h, slotProps: r, onClick: y, children: R, keepMounted: P = !1 }) => {
|
|
14
|
+
const _ = k(() => J(l, n), [l, n]), [p, x] = d(e);
|
|
15
|
+
e && !p && x(!0);
|
|
16
|
+
const a = e || P && p, s = z(o), [f, w] = d(s);
|
|
17
|
+
o && f !== s && w(s);
|
|
18
|
+
const { refs: i, floatingStyles: S, context: T } = j({
|
|
17
19
|
open: e,
|
|
18
|
-
placement:
|
|
20
|
+
placement: _,
|
|
19
21
|
strategy: "fixed",
|
|
20
|
-
whileElementsMounted:
|
|
22
|
+
whileElementsMounted: U,
|
|
21
23
|
elements: { reference: o ?? void 0 },
|
|
22
24
|
middleware: [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
H(4),
|
|
26
|
+
Y({ padding: 8 }),
|
|
27
|
+
K({ padding: 8 })
|
|
26
28
|
],
|
|
27
|
-
onOpenChange: (t,
|
|
28
|
-
t ||
|
|
29
|
+
onOpenChange: (t, E, F) => {
|
|
30
|
+
t || m?.(E ?? {}, F === "escape-key" ? "escapeKeyDown" : "backdropClick");
|
|
29
31
|
}
|
|
30
|
-
}), { getFloatingProps:
|
|
32
|
+
}), { getFloatingProps: b } = I([$(T, {
|
|
31
33
|
outsidePress: !0,
|
|
32
34
|
escapeKey: !0
|
|
33
|
-
})]),
|
|
34
|
-
return
|
|
35
|
-
if (!
|
|
36
|
-
const t =
|
|
35
|
+
})]), A = q([D(i.setFloating)]);
|
|
36
|
+
return N(() => {
|
|
37
|
+
if (!a) return;
|
|
38
|
+
const t = i.floating.current;
|
|
37
39
|
if (!(!t || typeof t.showPopover != "function"))
|
|
38
40
|
try {
|
|
39
41
|
e && !t.matches(":popover-open") && t.showPopover(), !e && t.matches(":popover-open") && t.hidePopover();
|
|
@@ -41,28 +43,28 @@ var I = {
|
|
|
41
43
|
}
|
|
42
44
|
}, [
|
|
43
45
|
e,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
]),
|
|
47
|
-
root:
|
|
48
|
-
children: /* @__PURE__ */
|
|
49
|
-
ref:
|
|
50
|
-
id:
|
|
51
|
-
...
|
|
46
|
+
a,
|
|
47
|
+
i.floating
|
|
48
|
+
]), a ? /* @__PURE__ */ u(C, {
|
|
49
|
+
root: f,
|
|
50
|
+
children: /* @__PURE__ */ u("div", {
|
|
51
|
+
ref: A,
|
|
52
|
+
id: v,
|
|
53
|
+
...L,
|
|
52
54
|
style: {
|
|
53
|
-
...
|
|
54
|
-
...e ?
|
|
55
|
-
...
|
|
56
|
-
...
|
|
57
|
-
...
|
|
55
|
+
...M,
|
|
56
|
+
...e ? S : {},
|
|
57
|
+
...c(h),
|
|
58
|
+
...c(r?.paper?.sx),
|
|
59
|
+
...r?.paper?.style,
|
|
58
60
|
...e ? null : { display: "none" }
|
|
59
61
|
},
|
|
60
|
-
...e ?
|
|
61
|
-
className:
|
|
62
|
-
children:
|
|
62
|
+
...e ? b({ onClick: y }) : {},
|
|
63
|
+
className: O("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]", g ?? "my-1", r?.paper?.className),
|
|
64
|
+
children: R
|
|
63
65
|
})
|
|
64
66
|
}) : null;
|
|
65
67
|
};
|
|
66
68
|
export {
|
|
67
|
-
|
|
69
|
+
te as StyledPopover
|
|
68
70
|
};
|