asma-ui-core 3.51.0 → 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/asma-ui-core.css +1 -1
- package/dist/components/navigation/menu/StyledMenu.js +10 -9
- package/dist/components/navigation/tabs/StyledTabs.js +32 -32
- 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,23 +1,23 @@
|
|
|
1
1
|
import { cn as n } from "../../../helpers/cn.js";
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import { ChevronRightIcon as
|
|
4
|
-
import { ChevronLeftIcon as
|
|
2
|
+
import { resolveSx as K } from "../../../helpers/sx.js";
|
|
3
|
+
import { ChevronRightIcon as M } from "../../icons/chevron-right-icon/ChevronRightIcon.js";
|
|
4
|
+
import { ChevronLeftIcon as V } from "../../icons/chevron-left-icon/ChevronLeftIcon.js";
|
|
5
5
|
import { consumerOverrides as q } from "../../../helpers/classOverride.js";
|
|
6
6
|
import { TabsContext as z } from "./TabsContext.js";
|
|
7
|
-
import { Children as F, cloneElement as G, isValidElement as J, useCallback as
|
|
7
|
+
import { Children as F, cloneElement as G, isValidElement as J, useCallback as b, useLayoutEffect as Q, useMemo as U, useRef as E, useState as A } from "react";
|
|
8
8
|
import { jsx as l, jsxs as B } from "react/jsx-runtime";
|
|
9
|
-
var I = 120, le = ({ value: i, onChange: m, variant: g = "standard", scrollButtons: w = "auto", centered: j, size:
|
|
10
|
-
const a = E(null),
|
|
9
|
+
var I = 120, le = ({ value: i, onChange: m, variant: g = "standard", scrollButtons: w = "auto", centered: j, size: h = "default", className: p, sx: N, children: x }) => {
|
|
10
|
+
const a = E(null), c = E(/* @__PURE__ */ new Map()), [u, O] = A({
|
|
11
11
|
left: 0,
|
|
12
12
|
width: 0,
|
|
13
13
|
disabled: !1
|
|
14
|
-
}), [
|
|
14
|
+
}), [d, W] = A({
|
|
15
15
|
left: !1,
|
|
16
16
|
right: !1
|
|
17
|
-
}),
|
|
18
|
-
t ?
|
|
19
|
-
}, []), S =
|
|
20
|
-
const e =
|
|
17
|
+
}), y = g === "scrollable", v = b((e, t) => {
|
|
18
|
+
t ? c.current.set(e, t) : c.current.delete(e);
|
|
19
|
+
}, []), S = b((e, t) => m?.(e, t), [m]), f = b(() => {
|
|
20
|
+
const e = c.current.get(i), t = a.current;
|
|
21
21
|
if (e && O({
|
|
22
22
|
left: e.offsetLeft,
|
|
23
23
|
width: e.offsetWidth,
|
|
@@ -36,13 +36,13 @@ var I = 120, le = ({ value: i, onChange: m, variant: g = "standard", scrollButto
|
|
|
36
36
|
if (!e) return;
|
|
37
37
|
const t = new ResizeObserver(f);
|
|
38
38
|
return t.observe(e), () => t.disconnect();
|
|
39
|
-
}, [f,
|
|
39
|
+
}, [f, x]);
|
|
40
40
|
const k = (e) => {
|
|
41
41
|
a.current?.scrollBy({
|
|
42
42
|
left: e,
|
|
43
43
|
behavior: "smooth"
|
|
44
44
|
});
|
|
45
|
-
},
|
|
45
|
+
}, _ = (e) => {
|
|
46
46
|
if (![
|
|
47
47
|
"ArrowRight",
|
|
48
48
|
"ArrowLeft",
|
|
@@ -50,35 +50,35 @@ var I = 120, le = ({ value: i, onChange: m, variant: g = "standard", scrollButto
|
|
|
50
50
|
"End"
|
|
51
51
|
].includes(e.key)) return;
|
|
52
52
|
e.preventDefault();
|
|
53
|
-
const t = Array.from(
|
|
53
|
+
const t = Array.from(c.current.values()).filter((s) => !s.disabled);
|
|
54
54
|
if (t.length === 0) return;
|
|
55
55
|
const o = t.findIndex((s) => s === document.activeElement);
|
|
56
56
|
let r = o;
|
|
57
57
|
e.key === "ArrowRight" ? r = (o + 1) % t.length : e.key === "ArrowLeft" ? r = (o - 1 + t.length) % t.length : e.key === "Home" ? r = 0 : e.key === "End" && (r = t.length - 1), t[r]?.focus();
|
|
58
|
-
}, L =
|
|
58
|
+
}, L = y && w !== !1, R = w === !0, D = L && (R || d.left), P = L && (R || d.right), T = q(p, "padding-x"), H = U(() => ({
|
|
59
59
|
value: i,
|
|
60
|
-
size:
|
|
60
|
+
size: h,
|
|
61
61
|
onSelect: S,
|
|
62
62
|
register: v
|
|
63
63
|
}), [
|
|
64
64
|
i,
|
|
65
|
-
|
|
65
|
+
h,
|
|
66
66
|
S,
|
|
67
67
|
v
|
|
68
68
|
]), C = "flex h-10 w-10 shrink-0 items-center justify-center self-center rounded-[10%] border border-solid border-delta-500 text-delta-700 transition-colors hover:bg-gama-50 disabled:invisible";
|
|
69
69
|
return /* @__PURE__ */ l(z.Provider, {
|
|
70
|
-
value:
|
|
70
|
+
value: H,
|
|
71
71
|
children: /* @__PURE__ */ B("div", {
|
|
72
|
-
className: n("relative flex items-center rounded-t-lg bg-white", !
|
|
73
|
-
style:
|
|
72
|
+
className: n("relative flex items-center rounded-t-lg bg-white", !T && "px-4", p),
|
|
73
|
+
style: K(N),
|
|
74
74
|
children: [
|
|
75
|
-
|
|
75
|
+
D && /* @__PURE__ */ l("button", {
|
|
76
76
|
type: "button",
|
|
77
77
|
"aria-label": "scroll tabs left",
|
|
78
78
|
className: n(C, "mr-2"),
|
|
79
|
-
disabled: !
|
|
79
|
+
disabled: !d.left,
|
|
80
80
|
onClick: () => k(-I),
|
|
81
|
-
children: /* @__PURE__ */ l(
|
|
81
|
+
children: /* @__PURE__ */ l(V, {
|
|
82
82
|
width: 24,
|
|
83
83
|
height: 24
|
|
84
84
|
})
|
|
@@ -87,25 +87,25 @@ var I = 120, le = ({ value: i, onChange: m, variant: g = "standard", scrollButto
|
|
|
87
87
|
ref: a,
|
|
88
88
|
role: "tablist",
|
|
89
89
|
"aria-orientation": "horizontal",
|
|
90
|
-
onKeyDown:
|
|
90
|
+
onKeyDown: _,
|
|
91
91
|
onScroll: f,
|
|
92
|
-
className: n("relative flex
|
|
93
|
-
children: [F.map(
|
|
92
|
+
className: n("relative flex bg-[linear-gradient(to_top,var(--colors-delta-200)_1px,transparent_1px)] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", y ? "flex-1 overflow-x-auto" : "w-full", g === "fullWidth" && "[&>*]:flex-1", j && "justify-center", h === "small" && "min-h-9"),
|
|
93
|
+
children: [F.map(x, (e, t) => J(e) ? G(e, { index: t }) : e), /* @__PURE__ */ l("span", {
|
|
94
94
|
"aria-hidden": !0,
|
|
95
|
-
className: n("absolute bottom-0 h-0.5 transition-all duration-300",
|
|
95
|
+
className: n("absolute bottom-0 h-0.5 transition-all duration-300", u.disabled ? "bg-delta-300" : "bg-gama-500"),
|
|
96
96
|
style: {
|
|
97
|
-
left:
|
|
98
|
-
width:
|
|
97
|
+
left: u.left,
|
|
98
|
+
width: u.width
|
|
99
99
|
}
|
|
100
100
|
})]
|
|
101
101
|
}),
|
|
102
|
-
|
|
102
|
+
P && /* @__PURE__ */ l("button", {
|
|
103
103
|
type: "button",
|
|
104
104
|
"aria-label": "scroll tabs right",
|
|
105
105
|
className: n(C, "ml-2"),
|
|
106
|
-
disabled: !
|
|
106
|
+
disabled: !d.right,
|
|
107
107
|
onClick: () => k(I),
|
|
108
|
-
children: /* @__PURE__ */ l(
|
|
108
|
+
children: /* @__PURE__ */ l(M, {
|
|
109
109
|
width: 24,
|
|
110
110
|
height: 24
|
|
111
111
|
})
|
|
@@ -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;
|