asma-ui-core 3.51.1 → 3.52.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.
- package/dist/components/navigation/menu/StyledMenu.js +10 -9
- package/dist/components/utils/popover/StyledPopover.js +49 -34
- package/dist/src/components/mui-compat/Popper.d.ts +1 -1
- package/dist/src/components/navigation/menu/StyledMenu.d.ts +3 -1
- package/dist/src/components/utils/popover/StyledPopover.d.ts +7 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { StyledPopover as
|
|
3
|
-
import { StyledMenuList as
|
|
1
|
+
import { cn as S } from "../../../helpers/cn.js";
|
|
2
|
+
import { StyledPopover as f } from "../../utils/popover/StyledPopover.js";
|
|
3
|
+
import { StyledMenuList as u } from "./StyledMenuList.js";
|
|
4
4
|
import { jsx as p } from "react/jsx-runtime";
|
|
5
|
-
var
|
|
5
|
+
var v = {
|
|
6
6
|
border: "1px solid var(--colors-delta-300)",
|
|
7
7
|
boxShadow: "0px 2px 4px 0px rgba(34, 33, 51, 0.15)"
|
|
8
|
-
},
|
|
8
|
+
}, h = ({ open: a, anchorEl: o, onClose: t, anchorOrigin: l, transformOrigin: m, id: d, className: s, sx: x, classes: e, slotProps: r, autoFocus: i = !0, onClick: c, children: n, keepMounted: y }) => /* @__PURE__ */ p(f, {
|
|
9
9
|
open: a,
|
|
10
10
|
anchorEl: o,
|
|
11
11
|
onClose: t,
|
|
@@ -14,12 +14,13 @@ var u = {
|
|
|
14
14
|
id: d,
|
|
15
15
|
className: s,
|
|
16
16
|
sx: x,
|
|
17
|
+
keepMounted: y,
|
|
17
18
|
slotProps: { paper: {
|
|
18
|
-
className:
|
|
19
|
-
sx: [
|
|
19
|
+
className: S("rounded", e?.paper, r?.paper?.className),
|
|
20
|
+
sx: [v, r?.paper?.sx],
|
|
20
21
|
style: r?.paper?.style
|
|
21
22
|
} },
|
|
22
|
-
children: /* @__PURE__ */ p(
|
|
23
|
+
children: /* @__PURE__ */ p(u, {
|
|
23
24
|
autoFocus: i,
|
|
24
25
|
className: e?.list,
|
|
25
26
|
onClick: c,
|
|
@@ -27,5 +28,5 @@ var u = {
|
|
|
27
28
|
})
|
|
28
29
|
});
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
+
h as StyledMenu
|
|
31
32
|
};
|
|
@@ -1,53 +1,68 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import { TOP_LAYER_PROPS as F, TOP_LAYER_RESET_STYLE as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { jsx as
|
|
6
|
-
import { FloatingPortal as
|
|
7
|
-
var
|
|
1
|
+
import { cn as E } from "../../../helpers/cn.js";
|
|
2
|
+
import { resolveSx as p } from "../../../helpers/sx.js";
|
|
3
|
+
import { TOP_LAYER_PROPS as F, TOP_LAYER_RESET_STYLE as O, getOpenModalDialogAncestor as L, useTopLayerRef as M } from "../../../hooks/useTopLayer.hook.js";
|
|
4
|
+
import { useEffect as z, useMemo as f, useState as D } from "react";
|
|
5
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
6
|
+
import { FloatingPortal as N, autoUpdate as k, flip as C, offset as U, shift as Y, useDismiss as H, useFloating as K, useInteractions as $, useMergeRefs as j } from "@floating-ui/react";
|
|
7
|
+
var I = {
|
|
8
8
|
vertical: "bottom",
|
|
9
9
|
horizontal: "left"
|
|
10
|
-
},
|
|
10
|
+
}, q = {
|
|
11
11
|
vertical: "top",
|
|
12
12
|
horizontal: "left"
|
|
13
|
-
},
|
|
14
|
-
const
|
|
13
|
+
}, B = (e, o) => `${o.vertical === "bottom" ? "top" : o.vertical === "top" ? "bottom" : e.vertical === "top" ? "top" : "bottom"}${e.horizontal === "left" ? "-start" : e.horizontal === "right" ? "-end" : ""}`, Z = ({ open: e, anchorEl: o, onClose: d, anchorOrigin: i = I, transformOrigin: l = q, id: u, className: m, sx: v, slotProps: a, onClick: g, children: h, keepMounted: y = !1 }) => {
|
|
14
|
+
const R = f(() => B(i, l), [i, l]), [n, _] = D(e);
|
|
15
|
+
e && !n && _(!0);
|
|
16
|
+
const r = e || y && n, { refs: s, floatingStyles: x, context: P } = K({
|
|
15
17
|
open: e,
|
|
16
|
-
placement:
|
|
18
|
+
placement: R,
|
|
17
19
|
strategy: "fixed",
|
|
18
|
-
whileElementsMounted:
|
|
19
|
-
elements: { reference:
|
|
20
|
+
whileElementsMounted: k,
|
|
21
|
+
elements: { reference: o ?? void 0 },
|
|
20
22
|
middleware: [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
U(4),
|
|
24
|
+
C({ padding: 8 }),
|
|
25
|
+
Y({ padding: 8 })
|
|
24
26
|
],
|
|
25
|
-
onOpenChange: (
|
|
26
|
-
|
|
27
|
+
onOpenChange: (t, b, A) => {
|
|
28
|
+
t || d?.(b ?? {}, A === "escape-key" ? "escapeKeyDown" : "backdropClick");
|
|
27
29
|
}
|
|
28
|
-
}), { getFloatingProps:
|
|
30
|
+
}), { getFloatingProps: w } = $([H(P, {
|
|
29
31
|
outsidePress: !0,
|
|
30
32
|
escapeKey: !0
|
|
31
|
-
})]),
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
})]), S = j([M(s.setFloating)]), T = f(() => r ? L(o) : void 0, [r, o]);
|
|
34
|
+
return z(() => {
|
|
35
|
+
if (!r) return;
|
|
36
|
+
const t = s.floating.current;
|
|
37
|
+
if (!(!t || typeof t.showPopover != "function"))
|
|
38
|
+
try {
|
|
39
|
+
e && !t.matches(":popover-open") && t.showPopover(), !e && t.matches(":popover-open") && t.hidePopover();
|
|
40
|
+
} catch {
|
|
41
|
+
}
|
|
42
|
+
}, [
|
|
43
|
+
e,
|
|
44
|
+
r,
|
|
45
|
+
s.floating
|
|
46
|
+
]), r ? /* @__PURE__ */ c(N, {
|
|
47
|
+
root: T,
|
|
48
|
+
children: /* @__PURE__ */ c("div", {
|
|
49
|
+
ref: S,
|
|
50
|
+
id: u,
|
|
37
51
|
...F,
|
|
38
52
|
style: {
|
|
39
|
-
...
|
|
40
|
-
...
|
|
41
|
-
...
|
|
42
|
-
...
|
|
43
|
-
...
|
|
53
|
+
...O,
|
|
54
|
+
...e ? x : {},
|
|
55
|
+
...p(v),
|
|
56
|
+
...p(a?.paper?.sx),
|
|
57
|
+
...a?.paper?.style,
|
|
58
|
+
...e ? null : { display: "none" }
|
|
44
59
|
},
|
|
45
|
-
...
|
|
46
|
-
className:
|
|
47
|
-
children:
|
|
60
|
+
...e ? w({ onClick: g }) : {},
|
|
61
|
+
className: E("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]", m ?? "my-1", a?.paper?.className),
|
|
62
|
+
children: h
|
|
48
63
|
})
|
|
49
64
|
}) : null;
|
|
50
65
|
};
|
|
51
66
|
export {
|
|
52
|
-
|
|
67
|
+
Z as StyledPopover
|
|
53
68
|
};
|
|
@@ -24,10 +24,12 @@ export interface MenuProps {
|
|
|
24
24
|
autoFocus?: boolean;
|
|
25
25
|
onClick?: (event: MouseEvent<HTMLUListElement>) => void;
|
|
26
26
|
children?: ReactNode;
|
|
27
|
+
/** MUI `Menu` `keepMounted` parity — see `StyledPopover.keepMounted`. */
|
|
28
|
+
keepMounted?: boolean;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Anchored menu (replaces MUI `Menu`) = `StyledPopover` + a keyboard-navigable `StyledMenuList`.
|
|
30
32
|
* Public props (`open`/`anchorEl`/`onClose`/`anchorOrigin`/`classes`/`autoFocus`) preserved
|
|
31
33
|
* (DEC-003). TASK-303.
|
|
32
34
|
*/
|
|
33
|
-
export declare const StyledMenu: ({ open, anchorEl, onClose, anchorOrigin, transformOrigin, id, className, sx, classes, slotProps, autoFocus, onClick, children, }: MenuProps) => JSX.Element;
|
|
35
|
+
export declare const StyledMenu: ({ open, anchorEl, onClose, anchorOrigin, transformOrigin, id, className, sx, classes, slotProps, autoFocus, onClick, children, keepMounted, }: MenuProps) => JSX.Element;
|
|
@@ -22,6 +22,12 @@ export interface StyledPopoverProps {
|
|
|
22
22
|
};
|
|
23
23
|
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
24
24
|
children?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* MUI `keepMounted` parity: after the first open, keep children in the React tree while closed
|
|
27
|
+
* (hidden). Needed when a menu item owns a dialog — without this, closing the menu unmounts the
|
|
28
|
+
* dialog in the same tick it opens.
|
|
29
|
+
*/
|
|
30
|
+
keepMounted?: boolean;
|
|
25
31
|
}
|
|
26
32
|
/**
|
|
27
33
|
* @figmaNode none — no standalone Figma component
|
|
@@ -36,4 +42,4 @@ export interface StyledPopoverProps {
|
|
|
36
42
|
* mapping to MUI's `onClose(event, reason)`. `anchorOrigin`/`transformOrigin`/`slotProps.paper`
|
|
37
43
|
* preserved (DEC-003). TASK-302.
|
|
38
44
|
*/
|
|
39
|
-
export declare const StyledPopover: ({ open, anchorEl, onClose, anchorOrigin, transformOrigin, id, className, sx, slotProps, onClick, children, }: StyledPopoverProps) => JSX.Element | null;
|
|
45
|
+
export declare const StyledPopover: ({ open, anchorEl, onClose, anchorOrigin, transformOrigin, id, className, sx, slotProps, onClick, children, keepMounted, }: StyledPopoverProps) => JSX.Element | null;
|