overflow-toolbar 0.1.8 → 0.2.1
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/README.md +45 -35
- package/dist/components/MuiOverflow/MuiOverflow.js +3 -2
- package/dist/components/MuiOverflow/MuiOverflow.js.map +1 -1
- package/dist/components/MuiOverflow/MuiOverflowItem.d.ts +6 -6
- package/dist/components/MuiOverflow/MuiOverflowItem.d.ts.map +1 -1
- package/dist/components/MuiOverflow/MuiOverflowItem.js +9 -8
- package/dist/components/MuiOverflow/MuiOverflowItem.js.map +1 -1
- package/dist/components/MuiOverflow/MuiOverflowMenu.d.ts +4 -4
- package/dist/components/MuiOverflow/MuiOverflowMenu.d.ts.map +1 -1
- package/dist/components/MuiOverflow/MuiOverflowMenu.js +8 -7
- package/dist/components/MuiOverflow/MuiOverflowMenu.js.map +1 -1
- package/dist/components/MuiOverflow/index.d.ts +1 -0
- package/dist/components/MuiOverflow/index.d.ts.map +1 -1
- package/dist/components/NoFrameworkOverflow/NoFrameworkOverflow.d.ts +3 -0
- package/dist/components/NoFrameworkOverflow/NoFrameworkOverflow.d.ts.map +1 -1
- package/dist/components/NoFrameworkOverflow/NoFrameworkOverflow.js +21 -17
- package/dist/components/NoFrameworkOverflow/NoFrameworkOverflow.js.map +1 -1
- package/dist/components/NoFrameworkOverflow/index.d.ts +2 -0
- package/dist/components/NoFrameworkOverflow/index.d.ts.map +1 -1
- package/dist/components/NoFrameworkOverflow/noframework.css +1 -110
- package/dist/components/Overflow/Overflow.css +1 -1
- package/dist/components/Overflow/Overflow.d.ts +8 -1
- package/dist/components/Overflow/Overflow.d.ts.map +1 -1
- package/dist/components/Overflow/Overflow.js +32 -32
- package/dist/components/Overflow/Overflow.js.map +1 -1
- package/dist/components/Overflow/OverflowController.d.ts +2 -1
- package/dist/components/Overflow/OverflowController.d.ts.map +1 -1
- package/dist/components/Overflow/OverflowController.js +44 -40
- package/dist/components/Overflow/OverflowController.js.map +1 -1
- package/dist/components/Overflow/OverflowItem.d.ts +10 -6
- package/dist/components/Overflow/OverflowItem.d.ts.map +1 -1
- package/dist/components/Overflow/OverflowItem.js +20 -11
- package/dist/components/Overflow/OverflowItem.js.map +1 -1
- package/dist/components/Overflow/OverflowMenu.d.ts +12 -4
- package/dist/components/Overflow/OverflowMenu.d.ts.map +1 -1
- package/dist/components/Overflow/OverflowMenu.js +37 -30
- package/dist/components/Overflow/OverflowMenu.js.map +1 -1
- package/dist/components/Overflow/index.d.ts +1 -0
- package/dist/components/Overflow/index.d.ts.map +1 -1
- package/dist/components/Overflow/overflowSteps.d.ts +10 -6
- package/dist/components/Overflow/overflowSteps.d.ts.map +1 -1
- package/dist/components/Overflow/overflowSteps.js +34 -23
- package/dist/components/Overflow/overflowSteps.js.map +1 -1
- package/dist/components/Overflow/useResizer.d.ts.map +1 -1
- package/dist/components/Overflow/useResizer.js +5 -3
- package/dist/components/Overflow/useResizer.js.map +1 -1
- package/dist/components/RxOverflow/RxOverflow.d.ts +0 -1
- package/dist/components/RxOverflow/RxOverflow.d.ts.map +1 -1
- package/dist/components/RxOverflow/RxOverflow.js +1 -1
- package/dist/components/RxOverflow/RxOverflow.js.map +1 -1
- package/dist/components/RxOverflow/RxOverflowItem.d.ts +6 -6
- package/dist/components/RxOverflow/RxOverflowItem.d.ts.map +1 -1
- package/dist/components/RxOverflow/RxOverflowItem.js +7 -6
- package/dist/components/RxOverflow/RxOverflowItem.js.map +1 -1
- package/dist/components/RxOverflow/RxOverflowMenu.d.ts +4 -4
- package/dist/components/RxOverflow/RxOverflowMenu.d.ts.map +1 -1
- package/dist/components/RxOverflow/RxOverflowMenu.js +19 -16
- package/dist/components/RxOverflow/RxOverflowMenu.js.map +1 -1
- package/dist/components/RxOverflow/index.d.ts +2 -0
- package/dist/components/RxOverflow/index.d.ts.map +1 -1
- package/dist/index.js +30 -27
- package/dist/index.js.map +1 -1
- package/dist/mui.js +7 -6
- package/dist/mui.js.map +1 -1
- package/dist/overflow.js +7 -6
- package/dist/overflow.js.map +1 -1
- package/dist/rx.js +10 -8
- package/dist/rx.js.map +1 -1
- package/dist/vanilla.js +4 -2
- package/dist/vanilla.js.map +1 -1
- package/package.json +2 -14
- package/styles.d.ts +0 -3
|
@@ -1,42 +1,49 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as R, useRef as
|
|
3
|
-
import { useOverflow as
|
|
4
|
-
function B({ opener:
|
|
5
|
-
const { hiddenMap: d } =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}, [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { jsxs as q, Fragment as A, jsx as H } from "react/jsx-runtime";
|
|
2
|
+
import { useState as R, useRef as p, useEffect as a, Children as v, isValidElement as E, cloneElement as j } from "react";
|
|
3
|
+
import { useOverflow as S } from "./OverflowContext.js";
|
|
4
|
+
function B({ opener: l, children: b, renderMenu: y, open: r, onOpenChange: s }) {
|
|
5
|
+
const { hiddenMap: d } = S(), [f, i] = R(null), n = p(null), u = r !== void 0, t = u ? r : !!f, o = [...d.values()].some((e) => e === "hidden"), m = p(o);
|
|
6
|
+
a(() => {
|
|
7
|
+
m.current && !o && t && queueMicrotask(() => {
|
|
8
|
+
i(null), s?.(!1);
|
|
9
|
+
}), m.current = o;
|
|
10
|
+
}, [o, t, s]), a(() => {
|
|
11
|
+
u && !r && queueMicrotask(() => i(null));
|
|
12
|
+
}, [u, r]), a(() => {
|
|
13
|
+
!t && n.current && n.current.querySelector('button, [role="button"]')?.focus();
|
|
14
|
+
}, [t]);
|
|
15
|
+
const I = () => {
|
|
16
|
+
const e = n.current?.firstElementChild;
|
|
17
|
+
i(e ?? n.current), t || s?.(!0);
|
|
18
|
+
}, M = () => {
|
|
19
|
+
u || i(null), s?.(!1);
|
|
20
|
+
}, c = [];
|
|
21
|
+
v.forEach(b, (e) => {
|
|
22
|
+
E(e) && c.push({ menuId: e.props.menuId, content: e.props.children });
|
|
19
23
|
});
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
+
const w = c.filter(({ menuId: e }) => e === void 0 ? !0 : d.get(e) === "hidden"), x = c.some(({ menuId: e }) => e === void 0), h = !o && !x, C = v.toArray(
|
|
25
|
+
w.map(({ content: e }) => e)
|
|
26
|
+
), k = E(l) ? j(l, {
|
|
27
|
+
"aria-haspopup": "menu",
|
|
28
|
+
"aria-expanded": t
|
|
29
|
+
}) : l;
|
|
30
|
+
return /* @__PURE__ */ q(A, { children: [
|
|
24
31
|
/* @__PURE__ */ H(
|
|
25
32
|
"li",
|
|
26
33
|
{
|
|
27
|
-
ref:
|
|
34
|
+
ref: n,
|
|
28
35
|
className: "overflow-opener",
|
|
29
|
-
"data-state":
|
|
30
|
-
style:
|
|
31
|
-
onClick:
|
|
32
|
-
children:
|
|
36
|
+
"data-state": h ? "hidden" : void 0,
|
|
37
|
+
style: h ? { display: "none" } : void 0,
|
|
38
|
+
onClick: I,
|
|
39
|
+
children: k
|
|
33
40
|
}
|
|
34
41
|
),
|
|
35
|
-
|
|
42
|
+
y({ anchorEl: f, open: t, onClose: M, children: C })
|
|
36
43
|
] });
|
|
37
44
|
}
|
|
38
|
-
|
|
45
|
+
B.overflowRole = "menu";
|
|
39
46
|
export {
|
|
40
|
-
|
|
47
|
+
B as default
|
|
41
48
|
};
|
|
42
49
|
//# sourceMappingURL=OverflowMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverflowMenu.js","sources":["../../../src/components/Overflow/OverflowMenu.tsx"],"sourcesContent":["import { Children, isValidElement, type ReactNode, useEffect, useRef, useState } from 'react';\nimport { useOverflow } from './OverflowContext';\nimport type { OverflowItemProps } from './OverflowItem';\n\nexport interface RenderMenuProps {\n anchorEl: HTMLElement | null;\n open: boolean;\n onClose: () => void;\n children: ReactNode;\n}\n\nexport interface OverflowMenuControlProps {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\ninterface OverflowMenuProps extends OverflowMenuControlProps {\n opener: ReactNode;\n children: ReactNode;\n renderMenu: (props: RenderMenuProps) => ReactNode;\n}\n\nfunction OverflowMenu({ opener, children, renderMenu, open: controlledOpen, onOpenChange }: OverflowMenuProps) {\n const { hiddenMap } = useOverflow();\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n const openerRef = useRef<HTMLLIElement>(null);\n\n const isControlled = controlledOpen !== undefined;\n const open = isControlled ? controlledOpen : Boolean(anchorEl);\n\n const hasHiddenItems = [...hiddenMap.values()].some(s => s === 'hidden');\n const prevHasHidden = useRef(hasHiddenItems);\n\n // Auto-close when no items are fully hidden\n useEffect(() => {\n if (prevHasHidden.current && !hasHiddenItems && open) {\n setAnchorEl(null);\n
|
|
1
|
+
{"version":3,"file":"OverflowMenu.js","sources":["../../../src/components/Overflow/OverflowMenu.tsx"],"sourcesContent":["import { Children, cloneElement, isValidElement, type ReactElement, type ReactNode, useEffect, useRef, useState } from 'react';\nimport { useOverflow } from './OverflowContext';\nimport type { OverflowItemProps } from './OverflowItem';\n\n/** Props passed to the `renderMenu` callback to render a framework-specific dropdown. */\nexport interface RenderMenuProps {\n /** The DOM element to anchor the menu to (null when closed). */\n anchorEl: HTMLElement | null;\n /** Whether the menu is currently open. */\n open: boolean;\n /** Call to close the menu. */\n onClose: () => void;\n /** The menu item elements to render inside the dropdown. */\n children: ReactNode;\n}\n\n/** Props for controlling the menu open/close state externally. */\nexport interface OverflowMenuControlProps {\n /** Controlled open state. When provided, you manage open/close. */\n open?: boolean;\n /** Called when the menu opens or closes. Use alone for notifications, or with `open` for full control. */\n onOpenChange?: (open: boolean) => void;\n}\n\ninterface OverflowMenuProps extends OverflowMenuControlProps {\n opener: ReactNode;\n children: ReactNode;\n renderMenu: (props: RenderMenuProps) => ReactNode;\n}\n\nfunction OverflowMenu({ opener, children, renderMenu, open: controlledOpen, onOpenChange }: OverflowMenuProps) {\n const { hiddenMap } = useOverflow();\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n const openerRef = useRef<HTMLLIElement>(null);\n\n const isControlled = controlledOpen !== undefined;\n const open = isControlled ? controlledOpen : Boolean(anchorEl);\n\n const hasHiddenItems = [...hiddenMap.values()].some(s => s === 'hidden');\n const prevHasHidden = useRef(hasHiddenItems);\n\n // Auto-close when no items are fully hidden\n useEffect(() => {\n if (prevHasHidden.current && !hasHiddenItems && open) {\n // Use a microtask to avoid synchronous setState in effect\n queueMicrotask(() => {\n setAnchorEl(null);\n onOpenChange?.(false);\n });\n }\n prevHasHidden.current = hasHiddenItems;\n }, [hasHiddenItems, open, onOpenChange]);\n\n // Sync anchorEl when controlled open changes to false\n useEffect(() => {\n if (isControlled && !controlledOpen) {\n queueMicrotask(() => setAnchorEl(null));\n }\n }, [isControlled, controlledOpen]);\n\n // Return focus to opener when menu closes\n useEffect(() => {\n if (!open && openerRef.current) {\n const button = openerRef.current.querySelector('button, [role=\"button\"]') as HTMLElement | null;\n button?.focus();\n }\n }, [open]);\n\n const handleOpen = () => {\n const button = openerRef.current?.firstElementChild as HTMLElement | null;\n setAnchorEl(button ?? openerRef.current);\n if (!open) {\n onOpenChange?.(true);\n }\n };\n\n const handleClose = () => {\n if (!isControlled) {\n setAnchorEl(null);\n }\n onOpenChange?.(false);\n };\n\n // Collect menuId set from children to determine which are \"menu-only\"\n const menuItems: { menuId: string | undefined; content: ReactNode }[] = [];\n Children.forEach(children, (child) => {\n if (!isValidElement<OverflowItemProps>(child)) return;\n menuItems.push({ menuId: child.props.menuId, content: child.props.children });\n });\n\n // Determine visible menu items: show when fully hidden or menu-only\n const visibleItems = menuItems.filter(({ menuId }) => {\n if (menuId === undefined) return true; // no menuId = always shown in menu\n return hiddenMap.get(menuId) === 'hidden'; // shown when fully hidden in toolbar\n });\n\n const hasMenuOnlyItems = menuItems.some(({ menuId }) => menuId === undefined);\n const hidden = !hasHiddenItems && !hasMenuOnlyItems;\n\n const menuChildren = Children.toArray(\n visibleItems.map(({ content }) => content)\n );\n\n // Clone opener to inject ARIA attributes\n const openerWithAria = isValidElement(opener)\n ? cloneElement(opener as ReactElement<Record<string, unknown>>, {\n 'aria-haspopup': 'menu',\n 'aria-expanded': open,\n })\n : opener;\n\n return (\n <>\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions -- the opener child is an interactive button; the li is a structural wrapper */}\n <li\n ref={openerRef}\n className=\"overflow-opener\"\n data-state={hidden ? 'hidden' : undefined}\n style={hidden ? { display: 'none' } : undefined}\n onClick={handleOpen}\n >\n {openerWithAria}\n </li>\n {renderMenu({ anchorEl, open, onClose: handleClose, children: menuChildren })}\n </>\n );\n}\n\nOverflowMenu.overflowRole = 'menu' as const;\nexport default OverflowMenu;\n"],"names":["OverflowMenu","opener","children","renderMenu","controlledOpen","onOpenChange","hiddenMap","useOverflow","anchorEl","setAnchorEl","useState","openerRef","useRef","isControlled","open","hasHiddenItems","s","prevHasHidden","useEffect","handleOpen","button","handleClose","menuItems","Children","child","isValidElement","visibleItems","menuId","hasMenuOnlyItems","hidden","menuChildren","content","openerWithAria","cloneElement","jsxs","Fragment","jsx"],"mappings":";;;AA8BA,SAASA,EAAa,EAAE,QAAAC,GAAQ,UAAAC,GAAU,YAAAC,GAAY,MAAMC,GAAgB,cAAAC,KAAmC;AAC7G,QAAM,EAAE,WAAAC,EAAA,IAAcC,EAAA,GAChB,CAACC,GAAUC,CAAW,IAAIC,EAA6B,IAAI,GAC3DC,IAAYC,EAAsB,IAAI,GAEtCC,IAAeT,MAAmB,QAClCU,IAAOD,IAAeT,IAAiB,EAAQI,GAE/CO,IAAiB,CAAC,GAAGT,EAAU,OAAA,CAAQ,EAAE,KAAK,CAAAU,MAAKA,MAAM,QAAQ,GACjEC,IAAgBL,EAAOG,CAAc;AAG3C,EAAAG,EAAU,MAAM;AACd,IAAID,EAAc,WAAW,CAACF,KAAkBD,KAE9C,eAAe,MAAM;AACnB,MAAAL,EAAY,IAAI,GAChBJ,IAAe,EAAK;AAAA,IACtB,CAAC,GAEHY,EAAc,UAAUF;AAAA,EAC1B,GAAG,CAACA,GAAgBD,GAAMT,CAAY,CAAC,GAGvCa,EAAU,MAAM;AACd,IAAIL,KAAgB,CAACT,KACnB,eAAe,MAAMK,EAAY,IAAI,CAAC;AAAA,EAE1C,GAAG,CAACI,GAAcT,CAAc,CAAC,GAGjCc,EAAU,MAAM;AACd,IAAI,CAACJ,KAAQH,EAAU,WACNA,EAAU,QAAQ,cAAc,yBAAyB,GAChE,MAAA;AAAA,EAEZ,GAAG,CAACG,CAAI,CAAC;AAET,QAAMK,IAAa,MAAM;AACvB,UAAMC,IAAST,EAAU,SAAS;AAClC,IAAAF,EAAYW,KAAUT,EAAU,OAAO,GAClCG,KACHT,IAAe,EAAI;AAAA,EAEvB,GAEMgB,IAAc,MAAM;AACxB,IAAKR,KACHJ,EAAY,IAAI,GAElBJ,IAAe,EAAK;AAAA,EACtB,GAGMiB,IAAkE,CAAA;AACxE,EAAAC,EAAS,QAAQrB,GAAU,CAACsB,MAAU;AACpC,IAAKC,EAAkCD,CAAK,KAC5CF,EAAU,KAAK,EAAE,QAAQE,EAAM,MAAM,QAAQ,SAASA,EAAM,MAAM,SAAA,CAAU;AAAA,EAC9E,CAAC;AAGD,QAAME,IAAeJ,EAAU,OAAO,CAAC,EAAE,QAAAK,QACnCA,MAAW,SAAkB,KAC1BrB,EAAU,IAAIqB,CAAM,MAAM,QAClC,GAEKC,IAAmBN,EAAU,KAAK,CAAC,EAAE,QAAAK,EAAA,MAAaA,MAAW,MAAS,GACtEE,IAAS,CAACd,KAAkB,CAACa,GAE7BE,IAAeP,EAAS;AAAA,IAC5BG,EAAa,IAAI,CAAC,EAAE,SAAAK,EAAA,MAAcA,CAAO;AAAA,EAAA,GAIrCC,IAAiBP,EAAexB,CAAM,IACxCgC,EAAahC,GAAiD;AAAA,IAC5D,iBAAiB;AAAA,IACjB,iBAAiBa;AAAA,EAAA,CAClB,IACDb;AAEJ,SACE,gBAAAiC,EAAAC,GAAA,EAEE,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKzB;AAAA,QACL,WAAU;AAAA,QACV,cAAYkB,IAAS,WAAW;AAAA,QAChC,OAAOA,IAAS,EAAE,SAAS,WAAW;AAAA,QACtC,SAASV;AAAA,QAER,UAAAa;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF7B,EAAW,EAAE,UAAAK,GAAU,MAAAM,GAAM,SAASO,GAAa,UAAUS,GAAc;AAAA,EAAA,GAC9E;AAEJ;AAEA9B,EAAa,eAAe;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Overflow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Overflow/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface Step {
|
|
2
|
-
|
|
2
|
+
menuId: string;
|
|
3
3
|
step: 'min' | 'hidden';
|
|
4
4
|
}
|
|
5
5
|
export interface AppliedStep extends Step {
|
|
@@ -7,9 +7,9 @@ export interface AppliedStep extends Step {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Build the ordered collapse sequence.
|
|
10
|
-
* All min steps come first (in
|
|
11
|
-
* A
|
|
12
|
-
* A
|
|
10
|
+
* All min steps come first (in menuId order), then all hidden steps (in menuId order).
|
|
11
|
+
* A menuId only gets a min step if it has a minStateWidth.
|
|
12
|
+
* A menuId only gets a hidden step if it's represented in the menu.
|
|
13
13
|
*/
|
|
14
14
|
export declare function buildOrderedSteps(menuIds: string[], inMenuIds: Set<string>, minWidthMenuIds: Set<string>): Step[];
|
|
15
15
|
/**
|
|
@@ -20,7 +20,11 @@ export declare function buildOrderedSteps(menuIds: string[], inMenuIds: Set<stri
|
|
|
20
20
|
export declare function computeNextSteps(prev: AppliedStep[], scrollWidth: number, clientWidth: number, orderedSteps: Step[]): AppliedStep[];
|
|
21
21
|
/**
|
|
22
22
|
* Derive the hiddenMap from appliedSteps.
|
|
23
|
-
* Later steps for the same
|
|
23
|
+
* Later steps for the same menuId overwrite earlier ones (e.g., min → hidden).
|
|
24
|
+
*
|
|
25
|
+
* When `snap` is true, hidden state is expanded: if any item is 'hidden',
|
|
26
|
+
* all menuIds in `inMenuIds` are also set to 'hidden'. Min state snap is
|
|
27
|
+
* handled purely via CSS (`.overflow-snap:has(> [data-state="min"])`).
|
|
24
28
|
*/
|
|
25
|
-
export declare function deriveHiddenMap(appliedSteps: AppliedStep[]): Map<string, 'min' | 'hidden'>;
|
|
29
|
+
export declare function deriveHiddenMap(appliedSteps: AppliedStep[], snap?: boolean, inMenuIds?: Set<string>): Map<string, 'min' | 'hidden'>;
|
|
26
30
|
//# sourceMappingURL=overflowSteps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overflowSteps.d.ts","sourceRoot":"","sources":["../../../src/components/Overflow/overflowSteps.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,KAAK,GAAG,QAAQ,CAAC;CACxB;AAED,MAAM,WAAW,WAAY,SAAQ,IAAI;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,EACtB,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,GAC3B,IAAI,EAAE,CAaR;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,EAAE,EACnB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,IAAI,EAAE,GACnB,WAAW,EAAE,CAef;AAED
|
|
1
|
+
{"version":3,"file":"overflowSteps.d.ts","sourceRoot":"","sources":["../../../src/components/Overflow/overflowSteps.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,KAAK,GAAG,QAAQ,CAAC;CACxB;AAED,MAAM,WAAW,WAAY,SAAQ,IAAI;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,EACtB,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,GAC3B,IAAI,EAAE,CAaR;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,EAAE,EACnB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,IAAI,EAAE,GACnB,WAAW,EAAE,CAef;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,WAAW,EAAE,EAC3B,IAAI,CAAC,EAAE,OAAO,EACd,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GACtB,GAAG,CAAC,MAAM,EAAE,KAAK,GAAG,QAAQ,CAAC,CAiB/B"}
|
|
@@ -1,32 +1,43 @@
|
|
|
1
|
-
function i(
|
|
2
|
-
const
|
|
3
|
-
for (const
|
|
4
|
-
|
|
5
|
-
for (const
|
|
6
|
-
o.has(
|
|
7
|
-
return
|
|
1
|
+
function i(e, o, s) {
|
|
2
|
+
const n = [];
|
|
3
|
+
for (const t of e)
|
|
4
|
+
s.has(t) && n.push({ menuId: t, step: "min" });
|
|
5
|
+
for (const t of e)
|
|
6
|
+
o.has(t) && n.push({ menuId: t, step: "hidden" });
|
|
7
|
+
return n;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (o >
|
|
11
|
-
const
|
|
12
|
-
return
|
|
9
|
+
function d(e, o, s, n) {
|
|
10
|
+
if (o > s) {
|
|
11
|
+
const t = n[e.length];
|
|
12
|
+
return t ? [...e, { ...t, width: s }] : e;
|
|
13
13
|
}
|
|
14
|
-
if (
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
return
|
|
14
|
+
if (e.length > 0) {
|
|
15
|
+
const t = e[e.length - 1];
|
|
16
|
+
if (s > t.width)
|
|
17
|
+
return e.slice(0, -1);
|
|
18
18
|
}
|
|
19
|
-
return
|
|
19
|
+
return e;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
for (const {
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
function r(e, o, s) {
|
|
22
|
+
const n = /* @__PURE__ */ new Map();
|
|
23
|
+
for (const { menuId: t, step: f } of e)
|
|
24
|
+
n.set(t, f);
|
|
25
|
+
if (o && s) {
|
|
26
|
+
let t = !1;
|
|
27
|
+
for (const f of n.values())
|
|
28
|
+
if (f === "hidden") {
|
|
29
|
+
t = !0;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
if (t)
|
|
33
|
+
for (const f of s)
|
|
34
|
+
n.set(f, "hidden");
|
|
35
|
+
}
|
|
36
|
+
return n;
|
|
26
37
|
}
|
|
27
38
|
export {
|
|
28
39
|
i as buildOrderedSteps,
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
d as computeNextSteps,
|
|
41
|
+
r as deriveHiddenMap
|
|
31
42
|
};
|
|
32
43
|
//# sourceMappingURL=overflowSteps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overflowSteps.js","sources":["../../../src/components/Overflow/overflowSteps.ts"],"sourcesContent":["export interface Step {\n
|
|
1
|
+
{"version":3,"file":"overflowSteps.js","sources":["../../../src/components/Overflow/overflowSteps.ts"],"sourcesContent":["export interface Step {\n menuId: string;\n step: 'min' | 'hidden';\n}\n\nexport interface AppliedStep extends Step {\n width: number;\n}\n\n/**\n * Build the ordered collapse sequence.\n * All min steps come first (in menuId order), then all hidden steps (in menuId order).\n * A menuId only gets a min step if it has a minStateWidth.\n * A menuId only gets a hidden step if it's represented in the menu.\n */\nexport function buildOrderedSteps(\n menuIds: string[],\n inMenuIds: Set<string>,\n minWidthMenuIds: Set<string>,\n): Step[] {\n const steps: Step[] = [];\n for (const menuId of menuIds) {\n if (minWidthMenuIds.has(menuId)) {\n steps.push({ menuId, step: 'min' });\n }\n }\n for (const menuId of menuIds) {\n if (inMenuIds.has(menuId)) {\n steps.push({ menuId, step: 'hidden' });\n }\n }\n return steps;\n}\n\n/**\n * Compute the next appliedSteps state given a resize event.\n * On overflow: push the next step from orderedSteps.\n * On space available: pop the last step if the container is wider than when it was applied.\n */\nexport function computeNextSteps(\n prev: AppliedStep[],\n scrollWidth: number,\n clientWidth: number,\n orderedSteps: Step[],\n): AppliedStep[] {\n if (scrollWidth > clientWidth) {\n const nextStep = orderedSteps[prev.length];\n if (!nextStep) return prev;\n return [...prev, { ...nextStep, width: clientWidth }];\n }\n\n if (prev.length > 0) {\n const lastStep = prev[prev.length - 1];\n if (clientWidth > lastStep.width) {\n return prev.slice(0, -1);\n }\n }\n\n return prev;\n}\n\n/**\n * Derive the hiddenMap from appliedSteps.\n * Later steps for the same menuId overwrite earlier ones (e.g., min → hidden).\n *\n * When `snap` is true, hidden state is expanded: if any item is 'hidden',\n * all menuIds in `inMenuIds` are also set to 'hidden'. Min state snap is\n * handled purely via CSS (`.overflow-snap:has(> [data-state=\"min\"])`).\n */\nexport function deriveHiddenMap(\n appliedSteps: AppliedStep[],\n snap?: boolean,\n inMenuIds?: Set<string>,\n): Map<string, 'min' | 'hidden'> {\n const map = new Map<string, 'min' | 'hidden'>();\n for (const { menuId, step } of appliedSteps) {\n map.set(menuId, step);\n }\n if (snap && inMenuIds) {\n let hasHidden = false;\n for (const v of map.values()) {\n if (v === 'hidden') { hasHidden = true; break; }\n }\n if (hasHidden) {\n for (const id of inMenuIds) {\n map.set(id, 'hidden');\n }\n }\n }\n return map;\n}\n"],"names":["buildOrderedSteps","menuIds","inMenuIds","minWidthMenuIds","steps","menuId","computeNextSteps","prev","scrollWidth","clientWidth","orderedSteps","nextStep","lastStep","deriveHiddenMap","appliedSteps","snap","map","step","hasHidden","v","id"],"mappings":"AAeO,SAASA,EACdC,GACAC,GACAC,GACQ;AACR,QAAMC,IAAgB,CAAA;AACtB,aAAWC,KAAUJ;AACnB,IAAIE,EAAgB,IAAIE,CAAM,KAC5BD,EAAM,KAAK,EAAE,QAAAC,GAAQ,MAAM,OAAO;AAGtC,aAAWA,KAAUJ;AACnB,IAAIC,EAAU,IAAIG,CAAM,KACtBD,EAAM,KAAK,EAAE,QAAAC,GAAQ,MAAM,UAAU;AAGzC,SAAOD;AACT;AAOO,SAASE,EACdC,GACAC,GACAC,GACAC,GACe;AACf,MAAIF,IAAcC,GAAa;AAC7B,UAAME,IAAWD,EAAaH,EAAK,MAAM;AACzC,WAAKI,IACE,CAAC,GAAGJ,GAAM,EAAE,GAAGI,GAAU,OAAOF,GAAa,IAD9BF;AAAA,EAExB;AAEA,MAAIA,EAAK,SAAS,GAAG;AACnB,UAAMK,IAAWL,EAAKA,EAAK,SAAS,CAAC;AACrC,QAAIE,IAAcG,EAAS;AACzB,aAAOL,EAAK,MAAM,GAAG,EAAE;AAAA,EAE3B;AAEA,SAAOA;AACT;AAUO,SAASM,EACdC,GACAC,GACAb,GAC+B;AAC/B,QAAMc,wBAAU,IAAA;AAChB,aAAW,EAAE,QAAAX,GAAQ,MAAAY,EAAA,KAAUH;AAC7B,IAAAE,EAAI,IAAIX,GAAQY,CAAI;AAEtB,MAAIF,KAAQb,GAAW;AACrB,QAAIgB,IAAY;AAChB,eAAWC,KAAKH,EAAI;AAClB,UAAIG,MAAM,UAAU;AAAE,QAAAD,IAAY;AAAM;AAAA,MAAO;AAEjD,QAAIA;AACF,iBAAWE,KAAMlB;AACf,QAAAc,EAAI,IAAII,GAAI,QAAQ;AAAA,EAG1B;AACA,SAAOJ;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizer.d.ts","sourceRoot":"","sources":["../../../src/components/Overflow/useResizer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1D,wBAAgB,UAAU,CACxB,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,QAAQ,EAAE,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"useResizer.d.ts","sourceRoot":"","sources":["../../../src/components/Overflow/useResizer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1D,wBAAgB,UAAU,CACxB,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,QAAQ,EAAE,MAAM,IAAI,QAkBrB"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { useRef as
|
|
1
|
+
import { useRef as o, useEffect as s } from "react";
|
|
2
2
|
function f(e, r) {
|
|
3
|
-
const t =
|
|
4
|
-
|
|
3
|
+
const t = o(r);
|
|
4
|
+
s(() => {
|
|
5
|
+
t.current = r;
|
|
6
|
+
}), s(() => {
|
|
5
7
|
const n = e.current;
|
|
6
8
|
if (!n) return;
|
|
7
9
|
const c = new ResizeObserver(() => t.current());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizer.js","sources":["../../../src/components/Overflow/useResizer.tsx"],"sourcesContent":["import { useEffect, useRef, type RefObject } from \"react\";\n\nexport function useResizer(\n ref: RefObject<HTMLElement | null>,\n onResize: () => void\n) {\n const callbackRef = useRef(onResize);\n callbackRef.current = onResize;\n\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n\n const observer = new ResizeObserver(() => callbackRef.current());\n observer.observe(element);\n\n return () => {\n observer.disconnect();\n };\n }, [ref]);\n}\n"],"names":["useResizer","ref","onResize","callbackRef","useRef","useEffect","element","observer"],"mappings":";AAEO,SAASA,EACdC,GACAC,GACA;AACA,QAAMC,IAAcC,EAAOF,CAAQ;AACnC,
|
|
1
|
+
{"version":3,"file":"useResizer.js","sources":["../../../src/components/Overflow/useResizer.tsx"],"sourcesContent":["import { useEffect, useRef, type RefObject } from \"react\";\n\nexport function useResizer(\n ref: RefObject<HTMLElement | null>,\n onResize: () => void\n) {\n const callbackRef = useRef(onResize);\n useEffect(() => {\n callbackRef.current = onResize;\n });\n\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n\n const observer = new ResizeObserver(() => callbackRef.current());\n observer.observe(element);\n\n return () => {\n observer.disconnect();\n };\n }, [ref]);\n}\n"],"names":["useResizer","ref","onResize","callbackRef","useRef","useEffect","element","observer"],"mappings":";AAEO,SAASA,EACdC,GACAC,GACA;AACA,QAAMC,IAAcC,EAAOF,CAAQ;AACnC,EAAAG,EAAU,MAAM;AACd,IAAAF,EAAY,UAAUD;AAAA,EACxB,CAAC,GAEDG,EAAU,MAAM;AACd,UAAMC,IAAUL,EAAI;AACpB,QAAI,CAACK,EAAS;AAEd,UAAMC,IAAW,IAAI,eAAe,MAAMJ,EAAY,SAAS;AAC/D,WAAAI,EAAS,QAAQD,CAAO,GAEjB,MAAM;AACX,MAAAC,EAAS,WAAA;AAAA,IACX;AAAA,EACF,GAAG,CAACN,CAAG,CAAC;AACV;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type OverflowProps } from '../Overflow';
|
|
2
|
-
import './rx.css';
|
|
3
2
|
declare const RxOverflow: import("react").ForwardRefExoticComponent<OverflowProps & import("react").RefAttributes<HTMLUListElement>>;
|
|
4
3
|
export default RxOverflow;
|
|
5
4
|
//# sourceMappingURL=RxOverflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RxOverflow.d.ts","sourceRoot":"","sources":["../../../src/components/RxOverflow/RxOverflow.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"RxOverflow.d.ts","sourceRoot":"","sources":["../../../src/components/RxOverflow/RxOverflow.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAE3D,QAAA,MAAM,UAAU,4GAEd,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import '../Overflow/Overflow.css';
|
|
1
2
|
import { jsx as f } from "react/jsx-runtime";
|
|
2
3
|
import { forwardRef as t } from "react";
|
|
3
4
|
import e from "../Overflow/Overflow.js";
|
|
4
|
-
/* empty css */
|
|
5
5
|
const w = t(function(r, o) {
|
|
6
6
|
return /* @__PURE__ */ f(e, { ref: o, ...r });
|
|
7
7
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RxOverflow.js","sources":["../../../src/components/RxOverflow/RxOverflow.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { Overflow, type OverflowProps } from '../Overflow';\
|
|
1
|
+
{"version":3,"file":"RxOverflow.js","sources":["../../../src/components/RxOverflow/RxOverflow.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { Overflow, type OverflowProps } from '../Overflow';\n\nconst RxOverflow = forwardRef<HTMLUListElement, OverflowProps>(function RxOverflow(props, ref) {\n return <Overflow ref={ref} {...props} />;\n});\n\nexport default RxOverflow;\n"],"names":["RxOverflow","forwardRef","props","ref","jsx","Overflow"],"mappings":";;;;AAGA,MAAMA,IAAaC,EAA4C,SAAoBC,GAAOC,GAAK;AAC7F,SAAO,gBAAAC,EAACC,GAAA,EAAS,KAAAF,GAAW,GAAGD,EAAA,CAAO;AACxC,CAAC;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
interface RxOverflowItemProps {
|
|
3
3
|
children: ReactNode;
|
|
4
|
-
|
|
4
|
+
menuId?: string;
|
|
5
5
|
minStateWidth?: string;
|
|
6
6
|
}
|
|
7
|
-
declare function RxOverflowItem({ children,
|
|
8
|
-
declare
|
|
9
|
-
overflowRole: "item";
|
|
10
|
-
}
|
|
11
|
-
export default
|
|
7
|
+
declare function RxOverflowItem({ children, menuId, minStateWidth }: RxOverflowItemProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare namespace RxOverflowItem {
|
|
9
|
+
var overflowRole: "item";
|
|
10
|
+
}
|
|
11
|
+
export default RxOverflowItem;
|
|
12
12
|
//# sourceMappingURL=RxOverflowItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RxOverflowItem.d.ts","sourceRoot":"","sources":["../../../src/components/RxOverflow/RxOverflowItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,iBAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,mBAAmB,2CAM/E
|
|
1
|
+
{"version":3,"file":"RxOverflowItem.d.ts","sourceRoot":"","sources":["../../../src/components/RxOverflow/RxOverflowItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,iBAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,mBAAmB,2CAM/E;kBANQ,cAAc;;;AASvB,eAAe,cAAc,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import '../Overflow/Overflow.css';
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import m from "../Overflow/OverflowItem.js";
|
|
4
|
+
function f({ children: o, menuId: r, minStateWidth: e }) {
|
|
5
|
+
return /* @__PURE__ */ t(m, { menuId: r, minStateWidth: e, children: o });
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
+
f.overflowRole = "item";
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
+
f as default
|
|
9
10
|
};
|
|
10
11
|
//# sourceMappingURL=RxOverflowItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RxOverflowItem.js","sources":["../../../src/components/RxOverflow/RxOverflowItem.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { OverflowItem } from '../Overflow';\n\ninterface RxOverflowItemProps {\n children: ReactNode;\n
|
|
1
|
+
{"version":3,"file":"RxOverflowItem.js","sources":["../../../src/components/RxOverflow/RxOverflowItem.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { OverflowItem } from '../Overflow';\n\ninterface RxOverflowItemProps {\n children: ReactNode;\n menuId?: string;\n minStateWidth?: string;\n}\n\nfunction RxOverflowItem({ children, menuId, minStateWidth }: RxOverflowItemProps) {\n return (\n <OverflowItem menuId={menuId} minStateWidth={minStateWidth}>\n {children}\n </OverflowItem>\n );\n}\n\nRxOverflowItem.overflowRole = 'item' as const;\nexport default RxOverflowItem;\n"],"names":["RxOverflowItem","children","menuId","minStateWidth","jsx","OverflowItem"],"mappings":";;;AASA,SAASA,EAAe,EAAE,UAAAC,GAAU,QAAAC,GAAQ,eAAAC,KAAsC;AAChF,SACE,gBAAAC,EAACC,GAAA,EAAa,QAAAH,GAAgB,eAAAC,GAC3B,UAAAF,EAAA,CACH;AAEJ;AAEAD,EAAe,eAAe;"}
|
|
@@ -5,8 +5,8 @@ interface RxOverflowMenuProps extends OverflowMenuControlProps {
|
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
}
|
|
7
7
|
declare function RxOverflowMenu({ opener, children, open, onOpenChange }: RxOverflowMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
declare
|
|
9
|
-
overflowRole: "menu";
|
|
10
|
-
}
|
|
11
|
-
export default
|
|
8
|
+
declare namespace RxOverflowMenu {
|
|
9
|
+
var overflowRole: "menu";
|
|
10
|
+
}
|
|
11
|
+
export default RxOverflowMenu;
|
|
12
12
|
//# sourceMappingURL=RxOverflowMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RxOverflowMenu.d.ts","sourceRoot":"","sources":["../../../src/components/RxOverflow/RxOverflowMenu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"RxOverflowMenu.d.ts","sourceRoot":"","sources":["../../../src/components/RxOverflow/RxOverflowMenu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAgB,KAAK,wBAAwB,EAAwB,MAAM,aAAa,CAAC;AAEhG,UAAU,mBAAoB,SAAQ,wBAAwB;IAC5D,MAAM,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,iBAAS,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,mBAAmB,2CAYpF;kBAZQ,cAAc;;;AAevB,eAAe,cAAc,CAAC"}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import '../Overflow/Overflow.css';
|
|
2
|
+
import { jsx as n, jsxs as m } from "react/jsx-runtime";
|
|
3
|
+
import * as r from "@radix-ui/react-popover";
|
|
4
|
+
import { useRef as p, useEffect as d } from "react";
|
|
5
|
+
import R from "../Overflow/OverflowMenu.js";
|
|
6
|
+
function a({ opener: e, children: o, open: t, onOpenChange: i }) {
|
|
7
|
+
return /* @__PURE__ */ n(R, { opener: e, renderMenu: ({ anchorEl: f, open: c, onClose: l, children: s }) => /* @__PURE__ */ n(g, { anchorEl: f, open: c, onClose: l, children: s }), open: t, onOpenChange: i, children: o });
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
const u =
|
|
9
|
+
a.overflowRole = "menu";
|
|
10
|
+
function g({ anchorEl: e, open: o, onClose: t, children: i }) {
|
|
11
|
+
const u = p({
|
|
11
12
|
getBoundingClientRect: () => new DOMRect()
|
|
12
13
|
});
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
return d(() => {
|
|
15
|
+
e && (u.current = {
|
|
16
|
+
getBoundingClientRect: () => e.getBoundingClientRect()
|
|
17
|
+
});
|
|
18
|
+
}, [e]), /* @__PURE__ */ m(r.Root, { open: o, onOpenChange: (f) => {
|
|
16
19
|
f || t();
|
|
17
20
|
}, children: [
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
|
|
21
|
+
/* @__PURE__ */ n(r.Anchor, { virtualRef: u }),
|
|
22
|
+
/* @__PURE__ */ n(r.Portal, { children: /* @__PURE__ */ n(
|
|
23
|
+
r.Content,
|
|
21
24
|
{
|
|
22
25
|
className: "rx-menu-panel",
|
|
23
26
|
sideOffset: 4,
|
|
@@ -29,6 +32,6 @@ function R({ anchorEl: n, open: r, onClose: t, children: i }) {
|
|
|
29
32
|
] });
|
|
30
33
|
}
|
|
31
34
|
export {
|
|
32
|
-
|
|
35
|
+
a as default
|
|
33
36
|
};
|
|
34
37
|
//# sourceMappingURL=RxOverflowMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RxOverflowMenu.js","sources":["../../../src/components/RxOverflow/RxOverflowMenu.tsx"],"sourcesContent":["import * as Popover from '@radix-ui/react-popover';\nimport { type ReactNode, useRef } from 'react';\nimport { OverflowMenu, type OverflowMenuControlProps, type RenderMenuProps } from '../Overflow';\n\ninterface RxOverflowMenuProps extends OverflowMenuControlProps {\n opener: ReactNode;\n children: ReactNode;\n}\n\nfunction RxOverflowMenu({ opener, children, open, onOpenChange }: RxOverflowMenuProps) {\n const renderMenu = ({ anchorEl, open, onClose, children: menuChildren }: RenderMenuProps) => (\n <RxPopoverMenu anchorEl={anchorEl} open={open} onClose={onClose}>\n {menuChildren}\n </RxPopoverMenu>\n );\n\n return (\n <OverflowMenu opener={opener} renderMenu={renderMenu} open={open} onOpenChange={onOpenChange}>\n {children}\n </OverflowMenu>\n );\n}\n\
|
|
1
|
+
{"version":3,"file":"RxOverflowMenu.js","sources":["../../../src/components/RxOverflow/RxOverflowMenu.tsx"],"sourcesContent":["import * as Popover from '@radix-ui/react-popover';\nimport { type ReactNode, useEffect, useRef } from 'react';\nimport { OverflowMenu, type OverflowMenuControlProps, type RenderMenuProps } from '../Overflow';\n\ninterface RxOverflowMenuProps extends OverflowMenuControlProps {\n opener: ReactNode;\n children: ReactNode;\n}\n\nfunction RxOverflowMenu({ opener, children, open, onOpenChange }: RxOverflowMenuProps) {\n const renderMenu = ({ anchorEl, open, onClose, children: menuChildren }: RenderMenuProps) => (\n <RxPopoverMenu anchorEl={anchorEl} open={open} onClose={onClose}>\n {menuChildren}\n </RxPopoverMenu>\n );\n\n return (\n <OverflowMenu opener={opener} renderMenu={renderMenu} open={open} onOpenChange={onOpenChange}>\n {children}\n </OverflowMenu>\n );\n}\n\nRxOverflowMenu.overflowRole = 'menu' as const;\nexport default RxOverflowMenu;\n\nfunction RxPopoverMenu({ anchorEl, open, onClose, children }: RenderMenuProps) {\n const virtualRef = useRef<{ getBoundingClientRect: () => DOMRect }>({\n getBoundingClientRect: () => new DOMRect(),\n });\n\n useEffect(() => {\n if (anchorEl) {\n virtualRef.current = {\n getBoundingClientRect: () => anchorEl.getBoundingClientRect(),\n };\n }\n }, [anchorEl]);\n\n return (\n <Popover.Root open={open} onOpenChange={(o) => { if (!o) onClose(); }}>\n <Popover.Anchor virtualRef={virtualRef} />\n <Popover.Portal>\n <Popover.Content\n className=\"rx-menu-panel\"\n sideOffset={4}\n align=\"start\"\n onClick={onClose}\n >\n {children}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n}\n"],"names":["RxOverflowMenu","opener","children","open","onOpenChange","OverflowMenu","anchorEl","onClose","menuChildren","RxPopoverMenu","virtualRef","useRef","useEffect","Popover","o","jsx"],"mappings":";;;;;AASA,SAASA,EAAe,EAAE,QAAAC,GAAQ,UAAAC,GAAU,MAAAC,GAAM,cAAAC,KAAqC;AAOrF,2BACGC,GAAA,EAAa,QAAAJ,GAAgB,YAPb,CAAC,EAAE,UAAAK,GAAU,MAAAH,GAAM,SAAAI,GAAS,UAAUC,EAAA,wBACtDC,GAAA,EAAc,UAAAH,GAAoB,MAAMH,GAAM,SAAAI,GAC5C,UAAAC,GACH,GAIsD,MAAAL,GAAY,cAAAC,GAC/D,UAAAF,GACH;AAEJ;AAEAF,EAAe,eAAe;AAG9B,SAASS,EAAc,EAAE,UAAAH,GAAU,MAAAH,GAAM,SAAAI,GAAS,UAAAL,KAA6B;AAC7E,QAAMQ,IAAaC,EAAiD;AAAA,IAClE,uBAAuB,MAAM,IAAI,QAAA;AAAA,EAAQ,CAC1C;AAED,SAAAC,EAAU,MAAM;AACd,IAAIN,MACFI,EAAW,UAAU;AAAA,MACnB,uBAAuB,MAAMJ,EAAS,sBAAA;AAAA,IAAsB;AAAA,EAGlE,GAAG,CAACA,CAAQ,CAAC,qBAGVO,EAAQ,MAAR,EAAa,MAAAV,GAAY,cAAc,CAACW,MAAM;AAAE,IAAKA,KAAGP,EAAA;AAAA,EAAW,GAClE,UAAA;AAAA,IAAA,gBAAAQ,EAACF,EAAQ,QAAR,EAAe,YAAAH,EAAA,CAAwB;AAAA,IACxC,gBAAAK,EAACF,EAAQ,QAAR,EACC,UAAA,gBAAAE;AAAA,MAACF,EAAQ;AAAA,MAAR;AAAA,QACC,WAAU;AAAA,QACV,YAAY;AAAA,QACZ,OAAM;AAAA,QACN,SAASN;AAAA,QAER,UAAAL;AAAA,MAAA;AAAA,IAAA,EACH,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RxOverflow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RxOverflow/index.ts"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAC;AAClC,OAAO,UAAU,CAAC;AAClB,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { default as
|
|
5
|
-
import {
|
|
6
|
-
import { default as
|
|
7
|
-
import { default as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { default as
|
|
11
|
-
import { default as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
1
|
+
import './components/Overflow/Overflow.css';
|
|
2
|
+
import './components/RxOverflow/rx.css';
|
|
3
|
+
import './components/NoFrameworkOverflow/noframework.css';
|
|
4
|
+
import { default as l } from "./components/Overflow/Overflow.js";
|
|
5
|
+
import { default as m } from "./components/Overflow/OverflowItem.js";
|
|
6
|
+
import { default as x } from "./components/Overflow/OverflowMenu.js";
|
|
7
|
+
import { default as v, useOverflow as w } from "./components/Overflow/OverflowContext.js";
|
|
8
|
+
import { OverflowController as s } from "./components/Overflow/OverflowController.js";
|
|
9
|
+
import { default as i } from "./components/RxOverflow/RxOverflow.js";
|
|
10
|
+
import { default as M } from "./components/RxOverflow/RxOverflowItem.js";
|
|
11
|
+
import { default as R } from "./components/RxOverflow/RxOverflowMenu.js";
|
|
12
|
+
import { cn as b } from "./components/RxOverflow/cn.js";
|
|
13
|
+
import { default as T } from "./components/MuiOverflow/MuiOverflow.js";
|
|
14
|
+
import { default as h } from "./components/MuiOverflow/MuiOverflowItem.js";
|
|
15
|
+
import { default as k } from "./components/MuiOverflow/MuiOverflowMenu.js";
|
|
16
|
+
import { OverflowToolbar as y } from "./components/NoFrameworkOverflow/NoFrameworkOverflow.js";
|
|
14
17
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
T as MuiOverflow,
|
|
19
|
+
h as MuiOverflowItem,
|
|
20
|
+
k as MuiOverflowMenu,
|
|
21
|
+
l as Overflow,
|
|
22
|
+
v as OverflowContext,
|
|
23
|
+
s as OverflowController,
|
|
24
|
+
m as OverflowItem,
|
|
25
|
+
x as OverflowMenu,
|
|
26
|
+
y as OverflowToolbar,
|
|
27
|
+
i as RxOverflow,
|
|
28
|
+
M as RxOverflowItem,
|
|
29
|
+
R as RxOverflowMenu,
|
|
30
|
+
b as cn,
|
|
31
|
+
w as useOverflow
|
|
29
32
|
};
|
|
30
33
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
package/dist/mui.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { default as
|
|
3
|
-
import { default as
|
|
1
|
+
import './components/Overflow/Overflow.css';
|
|
2
|
+
import { default as f } from "./components/MuiOverflow/MuiOverflow.js";
|
|
3
|
+
import { default as u } from "./components/MuiOverflow/MuiOverflowItem.js";
|
|
4
|
+
import { default as l } from "./components/MuiOverflow/MuiOverflowMenu.js";
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
f as MuiOverflow,
|
|
7
|
+
u as MuiOverflowItem,
|
|
8
|
+
l as MuiOverflowMenu
|
|
8
9
|
};
|
|
9
10
|
//# sourceMappingURL=mui.js.map
|
package/dist/mui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mui.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mui.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/overflow.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { default as
|
|
3
|
-
import { default as
|
|
1
|
+
import './components/Overflow/Overflow.css';
|
|
2
|
+
import { default as f } from "./components/Overflow/Overflow.js";
|
|
3
|
+
import { default as l } from "./components/Overflow/OverflowItem.js";
|
|
4
|
+
import { default as m } from "./components/Overflow/OverflowMenu.js";
|
|
4
5
|
import { default as u, useOverflow as v } from "./components/Overflow/OverflowContext.js";
|
|
5
6
|
import { OverflowController as x } from "./components/Overflow/OverflowController.js";
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
+
f as Overflow,
|
|
8
9
|
u as OverflowContext,
|
|
9
10
|
x as OverflowController,
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
l as OverflowItem,
|
|
12
|
+
m as OverflowMenu,
|
|
12
13
|
v as useOverflow
|
|
13
14
|
};
|
|
14
15
|
//# sourceMappingURL=overflow.js.map
|
package/dist/overflow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overflow.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"overflow.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|