@soroush.tech/design-system 2.0.0 → 2.1.0-alpha.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/dist/Accordion/Accordion.d.cts +2 -2
- package/dist/Accordion/Accordion.d.mts +2 -2
- package/dist/Accordion/AccordionGroup.d.cts +1 -1
- package/dist/Accordion/AccordionGroup.d.mts +1 -1
- package/dist/Alert/Alert.d.cts +1 -1
- package/dist/Alert/Alert.d.mts +1 -1
- package/dist/AppBar.d.cts +1 -1
- package/dist/AppBar.d.mts +1 -1
- package/dist/Autocomplete.cjs +1 -1
- package/dist/Autocomplete.d.cts +1 -1
- package/dist/Autocomplete.d.mts +1 -1
- package/dist/Autocomplete.mjs +1 -1
- package/dist/Avatar.d.cts +1 -1
- package/dist/Avatar.d.mts +1 -1
- package/dist/Backdrop.d.cts +1 -1
- package/dist/Backdrop.d.mts +1 -1
- package/dist/Badge.d.cts +1 -1
- package/dist/Badge.d.mts +1 -1
- package/dist/Breadcrumbs.d.cts +3 -3
- package/dist/Breadcrumbs.d.mts +3 -3
- package/dist/Button.d.cts +1 -1
- package/dist/Button.d.mts +1 -1
- package/dist/ButtonGroup.d.cts +1 -1
- package/dist/ButtonGroup.d.mts +1 -1
- package/dist/Card.d.cts +4 -4
- package/dist/Card.d.mts +4 -4
- package/dist/Checkbox.d.cts +1 -1
- package/dist/Checkbox.d.mts +1 -1
- package/dist/Chip.d.cts +1 -1
- package/dist/Chip.d.mts +1 -1
- package/dist/CircularProgress.d.cts +2 -2
- package/dist/CircularProgress.d.mts +2 -2
- package/dist/Collapse.d.cts +1 -1
- package/dist/Collapse.d.mts +1 -1
- package/dist/Drawer.d.cts +3 -3
- package/dist/Drawer.d.mts +3 -3
- package/dist/Fab.d.cts +1 -1
- package/dist/Fab.d.mts +1 -1
- package/dist/FabMenu/FabMenu.d.cts +1 -1
- package/dist/FabMenu/FabMenu.d.mts +1 -1
- package/dist/FabMenu/FabMenuItem.d.cts +1 -1
- package/dist/FabMenu/FabMenuItem.d.mts +1 -1
- package/dist/Fade.d.cts +1 -1
- package/dist/Fade.d.mts +1 -1
- package/dist/Flex.d.cts +1 -1
- package/dist/Flex.d.mts +1 -1
- package/dist/Form.d.cts +1 -1
- package/dist/Form.d.mts +1 -1
- package/dist/FormControl.d.cts +1 -1
- package/dist/FormControl.d.mts +1 -1
- package/dist/FormHelperText.d.cts +1 -1
- package/dist/FormHelperText.d.mts +1 -1
- package/dist/FormLabel.d.cts +1 -1
- package/dist/FormLabel.d.mts +1 -1
- package/dist/Grid.d.cts +1 -1
- package/dist/Grid.d.mts +1 -1
- package/dist/Grow.d.cts +1 -1
- package/dist/Grow.d.mts +1 -1
- package/dist/Icon.d.cts +1 -1
- package/dist/Icon.d.mts +1 -1
- package/dist/Image.d.cts +1 -1
- package/dist/Image.d.mts +1 -1
- package/dist/LinearProgress.d.cts +2 -2
- package/dist/LinearProgress.d.mts +2 -2
- package/dist/Link.d.cts +1 -1
- package/dist/Link.d.mts +1 -1
- package/dist/Menu/ContextMenu.cjs +23 -14
- package/dist/Menu/ContextMenu.d.cts +18 -8
- package/dist/Menu/ContextMenu.d.mts +18 -8
- package/dist/Menu/ContextMenu.mjs +24 -15
- package/dist/Menu/Menu.cjs +1 -1
- package/dist/Menu/Menu.d.cts +1 -1
- package/dist/Menu/Menu.d.mts +1 -1
- package/dist/Menu/Menu.mjs +1 -1
- package/dist/Menu/MenuItems.cjs +1 -1
- package/dist/Menu/MenuItems.d.cts +1 -1
- package/dist/Menu/MenuItems.d.mts +1 -1
- package/dist/Menu/MenuItems.mjs +1 -1
- package/dist/Menu/MenuList.cjs +1 -1
- package/dist/Menu/MenuList.d.cts +3 -36
- package/dist/Menu/MenuList.d.mts +3 -36
- package/dist/Menu/MenuList.mjs +1 -1
- package/dist/{Menu-Bx9jaHOy.cjs → Menu-C6eIdA1J.cjs} +8 -5
- package/dist/{Menu-D4AIpdJv.mjs → Menu-C_4jYHWE.mjs} +8 -5
- package/dist/Menu.cjs +2 -2
- package/dist/Menu.d.cts +5 -5
- package/dist/Menu.d.mts +5 -5
- package/dist/Menu.mjs +2 -2
- package/dist/{MenuItem-DXRw3Yca.cjs → MenuItem-Bg4iRvVe.cjs} +29 -26
- package/dist/{MenuItem-vXHGPK8g.mjs → MenuItem-kRGVRI6G.mjs} +29 -26
- package/dist/MenuItem.cjs +1 -1
- package/dist/MenuItem.d.cts +1 -1
- package/dist/MenuItem.d.mts +1 -1
- package/dist/MenuItem.mjs +1 -1
- package/dist/{MenuList-DsJmxNPu.cjs → MenuList-CSaaR3jt.cjs} +2 -1
- package/dist/{MenuList-CGZgfBno.mjs → MenuList-D7Pvpn_K.mjs} +2 -1
- package/dist/{MenuListContext-BwgQHUu9.d.cts → MenuListContext-AnAxu0he.d.cts} +2 -2
- package/dist/{MenuListContext-DbnAoUdJ.d.mts → MenuListContext-DURKFg_T.d.mts} +2 -2
- package/dist/Modal.d.cts +1 -1
- package/dist/Modal.d.mts +1 -1
- package/dist/NativeSelect.d.cts +2 -2
- package/dist/NativeSelect.d.mts +2 -2
- package/dist/NavTree/NavLink.d.cts +1 -1
- package/dist/NavTree/NavLink.d.mts +1 -1
- package/dist/NavTree/NavTree.d.cts +1 -1
- package/dist/NavTree/NavTree.d.mts +1 -1
- package/dist/NumberInput.d.cts +1 -1
- package/dist/NumberInput.d.mts +1 -1
- package/dist/Pagination/PaginationItem.d.cts +1 -1
- package/dist/Pagination/PaginationItem.d.mts +1 -1
- package/dist/Pagination.d.cts +2 -2
- package/dist/Pagination.d.mts +2 -2
- package/dist/Paper.d.cts +2 -2
- package/dist/Paper.d.mts +2 -2
- package/dist/Popover.d.cts +4 -14
- package/dist/Popover.d.mts +4 -14
- package/dist/Pressable.d.cts +1 -1
- package/dist/Pressable.d.mts +1 -1
- package/dist/Quote.d.cts +2 -2
- package/dist/Quote.d.mts +2 -2
- package/dist/Radio.d.cts +1 -1
- package/dist/Radio.d.mts +1 -1
- package/dist/RangeInput.d.cts +1 -1
- package/dist/RangeInput.d.mts +1 -1
- package/dist/Rating.d.cts +1 -1
- package/dist/Rating.d.mts +1 -1
- package/dist/ScrollArea.d.cts +1 -1
- package/dist/ScrollArea.d.mts +1 -1
- package/dist/Select.d.cts +2 -2
- package/dist/Select.d.mts +2 -2
- package/dist/Sidebar/Sidebar.d.cts +1 -1
- package/dist/Sidebar/Sidebar.d.mts +1 -1
- package/dist/Sidebar/SidebarItem.d.cts +3 -3
- package/dist/Sidebar/SidebarItem.d.mts +3 -3
- package/dist/Skeleton.d.cts +1 -1
- package/dist/Skeleton.d.mts +1 -1
- package/dist/Slide.d.cts +1 -1
- package/dist/Slide.d.mts +1 -1
- package/dist/Snackbar.d.cts +2 -2
- package/dist/Snackbar.d.mts +2 -2
- package/dist/Switch.d.cts +1 -1
- package/dist/Switch.d.mts +1 -1
- package/dist/Table/Table.d.cts +2 -2
- package/dist/Table/Table.d.mts +2 -2
- package/dist/Table/TableBody.d.cts +1 -1
- package/dist/Table/TableBody.d.mts +1 -1
- package/dist/Table/TableCell.d.cts +1 -1
- package/dist/Table/TableCell.d.mts +1 -1
- package/dist/Table/TableContainer.d.cts +1 -1
- package/dist/Table/TableContainer.d.mts +1 -1
- package/dist/Table/TableControl.d.cts +1 -1
- package/dist/Table/TableControl.d.mts +1 -1
- package/dist/Table/TableFooter.d.cts +1 -1
- package/dist/Table/TableFooter.d.mts +1 -1
- package/dist/Table/TableHead.d.cts +1 -1
- package/dist/Table/TableHead.d.mts +1 -1
- package/dist/Table/TablePagination.d.cts +2 -2
- package/dist/Table/TablePagination.d.mts +2 -2
- package/dist/Table/TablePaginationActions.d.cts +1 -1
- package/dist/Table/TablePaginationActions.d.mts +1 -1
- package/dist/Table/TableRow.d.cts +1 -1
- package/dist/Table/TableRow.d.mts +1 -1
- package/dist/Table/TableSortLabel.d.cts +1 -1
- package/dist/Table/TableSortLabel.d.mts +1 -1
- package/dist/Table/hooks.d.cts +1 -1
- package/dist/Table/hooks.d.mts +1 -1
- package/dist/Table.d.cts +5 -5
- package/dist/Table.d.mts +5 -5
- package/dist/{TableContext-0hifLOKH.d.mts → TableContext-CPxH920f.d.mts} +1 -1
- package/dist/{TableContext-fIyMD_Bj.d.cts → TableContext-VuMFtVNr.d.cts} +1 -1
- package/dist/Tabs/Tab.cjs +18 -14
- package/dist/Tabs/Tab.d.cts +2 -2
- package/dist/Tabs/Tab.d.mts +2 -2
- package/dist/Tabs/Tab.mjs +18 -14
- package/dist/Tabs/TabContext.d.cts +1 -1
- package/dist/Tabs/TabContext.d.mts +1 -1
- package/dist/Tabs/TabList.cjs +1 -1
- package/dist/Tabs/TabList.d.cts +1 -1
- package/dist/Tabs/TabList.d.mts +1 -1
- package/dist/Tabs/TabList.mjs +1 -1
- package/dist/Tabs/TabPanel.d.cts +2 -2
- package/dist/Tabs/TabPanel.d.mts +2 -2
- package/dist/Tabs/TabScrollButton.d.cts +1 -1
- package/dist/Tabs/TabScrollButton.d.mts +1 -1
- package/dist/Tabs/Tabs.cjs +1 -1
- package/dist/Tabs/Tabs.d.cts +2 -2
- package/dist/Tabs/Tabs.d.mts +2 -2
- package/dist/Tabs/Tabs.mjs +1 -1
- package/dist/{Tabs-JvjuCU8m.mjs → Tabs-C_qe9d4p.mjs} +28 -21
- package/dist/{Tabs-BsbX0jFL.cjs → Tabs-DmiA1J--.cjs} +28 -21
- package/dist/Tabs.cjs +1 -1
- package/dist/Tabs.d.cts +3 -3
- package/dist/Tabs.d.mts +3 -3
- package/dist/Tabs.mjs +1 -1
- package/dist/{TabsContext-0ZtedNyH.d.mts → TabsContext-DeP8oJpC.d.cts} +1 -1
- package/dist/{TabsContext-MpMEEVuB.d.cts → TabsContext-VJcdZQOf.d.mts} +1 -1
- package/dist/TextInput.d.cts +1 -1
- package/dist/TextInput.d.mts +1 -1
- package/dist/ToggleButton/ToggleButton.d.cts +1 -1
- package/dist/ToggleButton/ToggleButton.d.mts +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.d.cts +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.d.mts +1 -1
- package/dist/Tooltip-CrPRvmj3.cjs +338 -0
- package/dist/Tooltip-CwbuEQzf.mjs +332 -0
- package/dist/Tooltip.cjs +2 -267
- package/dist/Tooltip.d.cts +42 -7
- package/dist/Tooltip.d.mts +42 -7
- package/dist/Tooltip.mjs +1 -266
- package/dist/TransferList.d.cts +1 -1
- package/dist/TransferList.d.mts +1 -1
- package/dist/Typography.d.cts +2 -2
- package/dist/Typography.d.mts +2 -2
- package/dist/View.d.cts +1 -1
- package/dist/View.d.mts +1 -1
- package/dist/Zoom.d.cts +1 -1
- package/dist/Zoom.d.mts +1 -1
- package/dist/catalog.cjs +12 -0
- package/dist/catalog.d.cts +1 -1
- package/dist/catalog.d.mts +1 -1
- package/dist/catalog.mjs +12 -0
- package/dist/computePopoverPosition-JgOwCM7k.d.cts +12 -0
- package/dist/computePopoverPosition-JgOwCM7k.d.mts +12 -0
- package/dist/engine.d.cts +1 -1
- package/dist/engine.d.mts +1 -1
- package/dist/{index-4maWM1H8.d.mts → index-2jMSUeji.d.cts} +1 -1
- package/dist/{index-76zijQoi.d.mts → index-3Xe5X6Ny.d.mts} +2 -2
- package/dist/{index-C7EUYyom.d.cts → index-B-p51b0z.d.cts} +2 -2
- package/dist/index-B2XL_zZY.d.mts +44 -0
- package/dist/{index-D4PcgL-c.d.cts → index-B5_-Bxoo.d.cts} +2 -2
- package/dist/{index-DBF5n3ey.d.cts → index-BFUn2EWp.d.mts} +3 -3
- package/dist/{index-Byk1_ms9.d.cts → index-BKM4d_F4.d.cts} +2 -2
- package/dist/index-BL5Kj3Ka.d.mts +1 -0
- package/dist/{index-SotXsXXb.d.mts → index-BLypGp0N.d.mts} +4 -4
- package/dist/{index-hoHPfsc1.d.cts → index-BVDN2XbT.d.mts} +3 -3
- package/dist/{index-CLTFsCYC.d.cts → index-Bhb0bFxe.d.mts} +2 -2
- package/dist/index-Biqpy7c9.d.cts +44 -0
- package/dist/{index-CKywwIep.d.mts → index-C-ebcNOc.d.mts} +1 -1
- package/dist/{index-Lsm4v8fB.d.cts → index-C6a3kDn2.d.cts} +3 -0
- package/dist/{index-RaDENVX_.d.cts → index-C9nnnfhd.d.cts} +2 -2
- package/dist/{index-BuAKhHMs.d.cts → index-CBHCGizS.d.mts} +1 -1
- package/dist/{index-BChRNCld.d.mts → index-CCEfrBNN.d.mts} +1 -1
- package/dist/{index-Dxu6Ks2A.d.cts → index-CHWMSBhQ.d.cts} +1 -1
- package/dist/index-CJMvoc8h.d.cts +1 -0
- package/dist/{index-C2a-5yop.d.mts → index-COgZvhXQ.d.mts} +1 -1
- package/dist/{index-BC9S8Fpr.d.cts → index-CP55_Zs2.d.mts} +1 -1
- package/dist/{index-Dm7vQHor.d.cts → index-CgyyM3ty.d.cts} +10 -5
- package/dist/{index-CfB7OceY.d.cts → index-CtwlReZi.d.cts} +1 -1
- package/dist/{index-CnVvfG9_.d.mts → index-D0skdQEK.d.mts} +1 -1
- package/dist/{index-Cjh607-v.d.cts → index-D2tfsNPw.d.cts} +1 -1
- package/dist/{index-B3Bdupj3.d.mts → index-D7h8qFS1.d.cts} +2 -2
- package/dist/{index-BV5BvdeN.d.mts → index-DACdQ7-d.d.cts} +1 -1
- package/dist/{index-CAt0-L4i.d.cts → index-DAJ5DVHh.d.cts} +2 -2
- package/dist/{index-CGyIuCRh.d.cts → index-DMysZsti.d.cts} +1 -1
- package/dist/{index-CR8qkP8U.d.mts → index-DOH6uskj.d.mts} +3 -0
- package/dist/{index-C2tTbEBS.d.mts → index-DQo4XtH4.d.mts} +2 -2
- package/dist/{index-CQeTS_zL.d.cts → index-DTJN6JL2.d.cts} +1 -1
- package/dist/{index-Dt274Ngt.d.mts → index-DbKYSbLs.d.mts} +2 -2
- package/dist/{index-CJYWGPVO.d.mts → index-Dg0FPoms.d.mts} +2 -2
- package/dist/{index-C_J58B_n.d.mts → index-DlNBgVwb.d.mts} +1 -1
- package/dist/{index-UiyZAKID.d.mts → index-DsBOpK8T.d.mts} +2 -2
- package/dist/{index-DbgrItbx.d.cts → index-Dvx5TRET.d.cts} +2 -2
- package/dist/{index-tOrd12AJ.d.mts → index-Sq75GwA2.d.cts} +3 -3
- package/dist/{index-BAzMLTVi.d.mts → index-ZyigJMkV.d.mts} +10 -5
- package/dist/{index-Bo45R0nD.d.cts → index-gHMydoIS.d.cts} +4 -4
- package/dist/{index-BzQze7eY.d.cts → index-gxBafJdz.d.cts} +1 -1
- package/dist/{index-D48qVo1X.d.mts → index-hTgl9zwe.d.mts} +2 -2
- package/dist/{index-CF_pl72E.d.mts → index-i8BxMDEC.d.mts} +1 -1
- package/dist/{index-BXlBouWV.d.mts → index-v1I6VA9w.d.cts} +3 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/style.d.cts +2 -2
- package/dist/style.d.mts +2 -2
- package/dist/theme.d.cts +2 -2
- package/dist/theme.d.mts +2 -2
- package/dist/{useAnchoredPlacement-ee6KzG3t.cjs → useAnchoredPlacement-BSfjNMut.cjs} +10 -5
- package/dist/{useAnchoredPlacement-COrXZxhm.mjs → useAnchoredPlacement-txSaWzfk.mjs} +10 -5
- package/dist/{useTablePagination-BlD8mK8k.d.mts → useTablePagination-CUsagS5T.d.mts} +1 -1
- package/dist/{useTablePagination-CGjb_jPX.d.cts → useTablePagination-jpEfHKUh.d.cts} +1 -1
- package/dist/{useTransition-3EoagwIe.d.mts → useTransition-BJ375Sto.d.cts} +1 -1
- package/dist/{useTransition-C89K0mS7.d.cts → useTransition-DDGpvgci.d.mts} +1 -1
- package/package.json +1 -1
- package/dist/index-1Xzj0iAs.d.mts +0 -1
- package/dist/index-323PrYLR.d.cts +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_src = require("../src-yC1f5WR2.cjs");
|
|
3
3
|
const require_theme = require("../theme-XJvMdOnY.cjs");
|
|
4
|
-
const require_MenuList = require("../MenuList-
|
|
5
|
-
const require_MenuItem = require("../MenuItem-
|
|
4
|
+
const require_MenuList = require("../MenuList-CSaaR3jt.cjs");
|
|
5
|
+
const require_MenuItem = require("../MenuItem-Bg4iRvVe.cjs");
|
|
6
6
|
const require_Menu_MenuItems = require("./MenuItems.cjs");
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -30,7 +30,7 @@ function ContextMenuTarget({ element, onContextMenu, onKeyDown }) {
|
|
|
30
30
|
* `Menu` does - Escape, a chosen row or focus leaving - and gives focus back to where it
|
|
31
31
|
* was. The browser's own menu is held back only when this one opens.
|
|
32
32
|
*/
|
|
33
|
-
function ContextMenu({ target, children, items, onClose, onSelect, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, "aria-label": ariaLabel, className, "data-testid": dataTestid }) {
|
|
33
|
+
function ContextMenu({ target, isOpen: isOpenProp, anchorPosition, children, items, onClose, onSelect, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, "aria-label": ariaLabel, className, slotProps, "data-testid": dataTestid }) {
|
|
34
34
|
const dp = require_theme.useDefaultProps("ContextMenu");
|
|
35
35
|
const marginThreshold = marginThresholdProp ?? dp.marginThreshold ?? 2;
|
|
36
36
|
const elevation = elevationProp ?? dp.elevation ?? 8;
|
|
@@ -41,7 +41,9 @@ function ContextMenu({ target, children, items, onClose, onSelect, marginThresho
|
|
|
41
41
|
const size = sizeProp ?? dp.size;
|
|
42
42
|
const dense = denseProp ?? dp.dense;
|
|
43
43
|
const theme = require_theme.useTheme();
|
|
44
|
-
const [
|
|
44
|
+
const [openPoint, setOpenPoint] = (0, react.useState)(null);
|
|
45
|
+
const isControlled = isOpenProp !== void 0;
|
|
46
|
+
const point = isControlled ? isOpenProp && anchorPosition || null : openPoint;
|
|
45
47
|
const isOpen = point !== null;
|
|
46
48
|
const rootRef = (0, react.useRef)(null);
|
|
47
49
|
const surfaceRef = (0, react.useRef)(null);
|
|
@@ -52,11 +54,13 @@ function ContextMenu({ target, children, items, onClose, onSelect, marginThresho
|
|
|
52
54
|
align: "start",
|
|
53
55
|
margin,
|
|
54
56
|
elevation,
|
|
55
|
-
layer
|
|
57
|
+
layer,
|
|
58
|
+
listProps: slotProps?.list
|
|
56
59
|
}), [
|
|
57
60
|
margin,
|
|
58
61
|
elevation,
|
|
59
|
-
layer
|
|
62
|
+
layer,
|
|
63
|
+
slotProps?.list
|
|
60
64
|
]);
|
|
61
65
|
require_MenuItem.useMenuPlacement({
|
|
62
66
|
isOpen,
|
|
@@ -67,27 +71,31 @@ function ContextMenu({ target, children, items, onClose, onSelect, marginThresho
|
|
|
67
71
|
align: "start",
|
|
68
72
|
margin
|
|
69
73
|
});
|
|
74
|
+
(0, react.useLayoutEffect)(() => {
|
|
75
|
+
if (isControlled && isOpen) returnFocusRef.current = document.activeElement;
|
|
76
|
+
}, [isControlled, isOpen]);
|
|
70
77
|
const openAt = (top, left) => {
|
|
71
78
|
returnFocusRef.current = document.activeElement;
|
|
72
|
-
|
|
79
|
+
setOpenPoint({
|
|
73
80
|
top,
|
|
74
81
|
left
|
|
75
82
|
});
|
|
76
83
|
};
|
|
77
84
|
const close = (0, react.useCallback)((event, reason) => {
|
|
78
|
-
|
|
85
|
+
if (!isControlled) setOpenPoint(null);
|
|
79
86
|
onClose?.(event, reason);
|
|
80
|
-
if (reason !== "blur") returnFocusRef.current
|
|
81
|
-
}, [onClose]);
|
|
87
|
+
if (reason !== "blur") returnFocusRef.current?.focus();
|
|
88
|
+
}, [isControlled, onClose]);
|
|
82
89
|
const handleActivate = (0, react.useCallback)((_value, event) => close(event, "select"), [close]);
|
|
83
90
|
const handleContextMenu = (event) => {
|
|
84
|
-
target
|
|
91
|
+
target?.props.onContextMenu?.(event);
|
|
92
|
+
if (isControlled) return;
|
|
85
93
|
event.preventDefault();
|
|
86
94
|
openAt(event.clientY, event.clientX);
|
|
87
95
|
};
|
|
88
96
|
const handleKeyDown = (event) => {
|
|
89
|
-
target
|
|
90
|
-
if (!isMenuKey(event)) return;
|
|
97
|
+
target?.props.onKeyDown?.(event);
|
|
98
|
+
if (isControlled || !isMenuKey(event)) return;
|
|
91
99
|
event.preventDefault();
|
|
92
100
|
const { bottom, left } = event.target.getBoundingClientRect();
|
|
93
101
|
openAt(bottom, left);
|
|
@@ -109,7 +117,7 @@ function ContextMenu({ target, children, items, onClose, onSelect, marginThresho
|
|
|
109
117
|
className,
|
|
110
118
|
"data-testid": dataTestid,
|
|
111
119
|
onBlur: handleBlur,
|
|
112
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuTarget, {
|
|
120
|
+
children: [target && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContextMenuTarget, {
|
|
113
121
|
element: target,
|
|
114
122
|
onContextMenu: handleContextMenu,
|
|
115
123
|
onKeyDown: handleKeyDown
|
|
@@ -125,6 +133,7 @@ function ContextMenu({ target, children, items, onClose, onSelect, marginThresho
|
|
|
125
133
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MenuList.MenuActivationContext.Provider, {
|
|
126
134
|
value: handleActivate,
|
|
127
135
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MenuList.MenuList, {
|
|
136
|
+
...slotProps?.list,
|
|
128
137
|
id: listId,
|
|
129
138
|
"aria-label": ariaLabel,
|
|
130
139
|
shouldAutoFocus: true,
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import { cn as PaperElevation, nt as Theme } from "../index-
|
|
2
|
-
import "../index-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { cn as PaperElevation, nt as Theme } from "../index-C6a3kDn2.cjs";
|
|
2
|
+
import "../index-CJMvoc8h.cjs";
|
|
3
|
+
import { n as PopoverPosition } from "../computePopoverPosition-JgOwCM7k.cjs";
|
|
4
|
+
import { t as MenuItemValue } from "../MenuListContext-AnAxu0he.cjs";
|
|
5
|
+
import { r as MenuListSlotProps } from "../index-Biqpy7c9.cjs";
|
|
6
|
+
import { n as MenuItemData } from "../index-Dvx5TRET.cjs";
|
|
7
|
+
import { n as MenuCloseReason } from "../index-CgyyM3ty.cjs";
|
|
6
8
|
import { KeyboardEvent, MouseEvent, ReactElement, ReactNode, SyntheticEvent } from "react";
|
|
7
9
|
interface TargetProps {
|
|
8
10
|
onContextMenu?: (event: MouseEvent<HTMLElement>) => void;
|
|
9
11
|
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
|
|
10
12
|
}
|
|
11
13
|
interface ContextMenuProps {
|
|
12
|
-
/** The element whose right-click opens the menu - the canvas, a row, a card. Its own `onContextMenu` / `onKeyDown` still run. */
|
|
13
|
-
target
|
|
14
|
+
/** The element whose right-click opens the menu - the canvas, a row, a card. Its own `onContextMenu` / `onKeyDown` still run. Optional when the app opens the menu itself, with `isOpen` and `anchorPosition`. */
|
|
15
|
+
target?: ReactElement<TargetProps>;
|
|
16
|
+
/** Whether the menu is open, when the app decides: it then opens at `anchorPosition` - from a hit test, a shortcut, a toolbar button - and asks to close through `onClose`, whatever was right-clicked. Without it, the menu opens at the target's right-click or context-menu key, as before. */
|
|
17
|
+
isOpen?: boolean;
|
|
18
|
+
/** With `isOpen`: where the menu opens - a point in the window, client coordinates, as Popover's. A changed point moves the open list. Without one, the menu stays closed. */
|
|
19
|
+
anchorPosition?: PopoverPosition;
|
|
14
20
|
/** `MenuItem` rows and `MenuDivider`s. */
|
|
15
21
|
children?: ReactNode;
|
|
16
22
|
/** The rows as data, in place of `children`. */
|
|
@@ -40,6 +46,10 @@ interface ContextMenuProps {
|
|
|
40
46
|
/** Names the list. */
|
|
41
47
|
'aria-label'?: string;
|
|
42
48
|
className?: string;
|
|
49
|
+
/** Props for a part: `list` is the `role="menu"` list - and every submenu's - for the app's `data-*`, class and `aria-*`. The menu's own `role`, `id` and name win. */
|
|
50
|
+
slotProps?: {
|
|
51
|
+
list?: MenuListSlotProps;
|
|
52
|
+
};
|
|
43
53
|
'data-testid'?: string;
|
|
44
54
|
}
|
|
45
55
|
/**
|
|
@@ -48,5 +58,5 @@ interface ContextMenuProps {
|
|
|
48
58
|
* `Menu` does - Escape, a chosen row or focus leaving - and gives focus back to where it
|
|
49
59
|
* was. The browser's own menu is held back only when this one opens.
|
|
50
60
|
*/
|
|
51
|
-
declare function ContextMenu({ target, children, items, onClose, onSelect, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, 'aria-label': ariaLabel, className, 'data-testid': dataTestid }: Readonly<ContextMenuProps>): import("react").JSX.Element;
|
|
61
|
+
declare function ContextMenu({ target, isOpen: isOpenProp, anchorPosition, children, items, onClose, onSelect, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, 'aria-label': ariaLabel, className, slotProps, 'data-testid': dataTestid }: Readonly<ContextMenuProps>): import("react").JSX.Element;
|
|
52
62
|
export { ContextMenu, ContextMenuProps };
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import { cn as PaperElevation, nt as Theme } from "../index-
|
|
2
|
-
import "../index-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { cn as PaperElevation, nt as Theme } from "../index-DOH6uskj.mjs";
|
|
2
|
+
import "../index-BL5Kj3Ka.mjs";
|
|
3
|
+
import { n as PopoverPosition } from "../computePopoverPosition-JgOwCM7k.mjs";
|
|
4
|
+
import { t as MenuItemValue } from "../MenuListContext-DURKFg_T.mjs";
|
|
5
|
+
import { r as MenuListSlotProps } from "../index-B2XL_zZY.mjs";
|
|
6
|
+
import { n as MenuItemData } from "../index-Dg0FPoms.mjs";
|
|
7
|
+
import { n as MenuCloseReason } from "../index-ZyigJMkV.mjs";
|
|
6
8
|
import { KeyboardEvent, MouseEvent, ReactElement, ReactNode, SyntheticEvent } from "react";
|
|
7
9
|
interface TargetProps {
|
|
8
10
|
onContextMenu?: (event: MouseEvent<HTMLElement>) => void;
|
|
9
11
|
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
|
|
10
12
|
}
|
|
11
13
|
interface ContextMenuProps {
|
|
12
|
-
/** The element whose right-click opens the menu - the canvas, a row, a card. Its own `onContextMenu` / `onKeyDown` still run. */
|
|
13
|
-
target
|
|
14
|
+
/** The element whose right-click opens the menu - the canvas, a row, a card. Its own `onContextMenu` / `onKeyDown` still run. Optional when the app opens the menu itself, with `isOpen` and `anchorPosition`. */
|
|
15
|
+
target?: ReactElement<TargetProps>;
|
|
16
|
+
/** Whether the menu is open, when the app decides: it then opens at `anchorPosition` - from a hit test, a shortcut, a toolbar button - and asks to close through `onClose`, whatever was right-clicked. Without it, the menu opens at the target's right-click or context-menu key, as before. */
|
|
17
|
+
isOpen?: boolean;
|
|
18
|
+
/** With `isOpen`: where the menu opens - a point in the window, client coordinates, as Popover's. A changed point moves the open list. Without one, the menu stays closed. */
|
|
19
|
+
anchorPosition?: PopoverPosition;
|
|
14
20
|
/** `MenuItem` rows and `MenuDivider`s. */
|
|
15
21
|
children?: ReactNode;
|
|
16
22
|
/** The rows as data, in place of `children`. */
|
|
@@ -40,6 +46,10 @@ interface ContextMenuProps {
|
|
|
40
46
|
/** Names the list. */
|
|
41
47
|
'aria-label'?: string;
|
|
42
48
|
className?: string;
|
|
49
|
+
/** Props for a part: `list` is the `role="menu"` list - and every submenu's - for the app's `data-*`, class and `aria-*`. The menu's own `role`, `id` and name win. */
|
|
50
|
+
slotProps?: {
|
|
51
|
+
list?: MenuListSlotProps;
|
|
52
|
+
};
|
|
43
53
|
'data-testid'?: string;
|
|
44
54
|
}
|
|
45
55
|
/**
|
|
@@ -48,5 +58,5 @@ interface ContextMenuProps {
|
|
|
48
58
|
* `Menu` does - Escape, a chosen row or focus leaving - and gives focus back to where it
|
|
49
59
|
* was. The browser's own menu is held back only when this one opens.
|
|
50
60
|
*/
|
|
51
|
-
declare function ContextMenu({ target, children, items, onClose, onSelect, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, 'aria-label': ariaLabel, className, 'data-testid': dataTestid }: Readonly<ContextMenuProps>): import("react").JSX.Element;
|
|
61
|
+
declare function ContextMenu({ target, isOpen: isOpenProp, anchorPosition, children, items, onClose, onSelect, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, 'aria-label': ariaLabel, className, slotProps, 'data-testid': dataTestid }: Readonly<ContextMenuProps>): import("react").JSX.Element;
|
|
52
62
|
export { ContextMenu, ContextMenuProps };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { o as styled } from "../src-B-rNjHIL.mjs";
|
|
2
2
|
import { n as useDefaultProps, r as useTheme } from "../theme-DyyZQFzQ.mjs";
|
|
3
|
-
import { o as MenuActivationContext, t as MenuList } from "../MenuList-
|
|
4
|
-
import { i as MenuPaper, n as useMenuPlacement, r as MenuContext, t as MenuItem } from "../MenuItem-
|
|
3
|
+
import { o as MenuActivationContext, t as MenuList } from "../MenuList-D7Pvpn_K.mjs";
|
|
4
|
+
import { i as MenuPaper, n as useMenuPlacement, r as MenuContext, t as MenuItem } from "../MenuItem-kRGVRI6G.mjs";
|
|
5
5
|
import { MenuItems } from "./MenuItems.mjs";
|
|
6
|
-
import { Children, cloneElement, useCallback, useId, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { Children, cloneElement, useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
// src/Menu/ContextMenu/ContextMenu.tsx
|
|
9
9
|
const ContextMenuPaper = styled(MenuPaper, {
|
|
@@ -29,7 +29,7 @@ function ContextMenuTarget({ element, onContextMenu, onKeyDown }) {
|
|
|
29
29
|
* `Menu` does - Escape, a chosen row or focus leaving - and gives focus back to where it
|
|
30
30
|
* was. The browser's own menu is held back only when this one opens.
|
|
31
31
|
*/
|
|
32
|
-
function ContextMenu({ target, children, items, onClose, onSelect, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, "aria-label": ariaLabel, className, "data-testid": dataTestid }) {
|
|
32
|
+
function ContextMenu({ target, isOpen: isOpenProp, anchorPosition, children, items, onClose, onSelect, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, "aria-label": ariaLabel, className, slotProps, "data-testid": dataTestid }) {
|
|
33
33
|
const dp = useDefaultProps("ContextMenu");
|
|
34
34
|
const marginThreshold = marginThresholdProp ?? dp.marginThreshold ?? 2;
|
|
35
35
|
const elevation = elevationProp ?? dp.elevation ?? 8;
|
|
@@ -40,7 +40,9 @@ function ContextMenu({ target, children, items, onClose, onSelect, marginThresho
|
|
|
40
40
|
const size = sizeProp ?? dp.size;
|
|
41
41
|
const dense = denseProp ?? dp.dense;
|
|
42
42
|
const theme = useTheme();
|
|
43
|
-
const [
|
|
43
|
+
const [openPoint, setOpenPoint] = useState(null);
|
|
44
|
+
const isControlled = isOpenProp !== void 0;
|
|
45
|
+
const point = isControlled ? isOpenProp && anchorPosition || null : openPoint;
|
|
44
46
|
const isOpen = point !== null;
|
|
45
47
|
const rootRef = useRef(null);
|
|
46
48
|
const surfaceRef = useRef(null);
|
|
@@ -51,11 +53,13 @@ function ContextMenu({ target, children, items, onClose, onSelect, marginThresho
|
|
|
51
53
|
align: "start",
|
|
52
54
|
margin,
|
|
53
55
|
elevation,
|
|
54
|
-
layer
|
|
56
|
+
layer,
|
|
57
|
+
listProps: slotProps?.list
|
|
55
58
|
}), [
|
|
56
59
|
margin,
|
|
57
60
|
elevation,
|
|
58
|
-
layer
|
|
61
|
+
layer,
|
|
62
|
+
slotProps?.list
|
|
59
63
|
]);
|
|
60
64
|
useMenuPlacement({
|
|
61
65
|
isOpen,
|
|
@@ -66,27 +70,31 @@ function ContextMenu({ target, children, items, onClose, onSelect, marginThresho
|
|
|
66
70
|
align: "start",
|
|
67
71
|
margin
|
|
68
72
|
});
|
|
73
|
+
useLayoutEffect(() => {
|
|
74
|
+
if (isControlled && isOpen) returnFocusRef.current = document.activeElement;
|
|
75
|
+
}, [isControlled, isOpen]);
|
|
69
76
|
const openAt = (top, left) => {
|
|
70
77
|
returnFocusRef.current = document.activeElement;
|
|
71
|
-
|
|
78
|
+
setOpenPoint({
|
|
72
79
|
top,
|
|
73
80
|
left
|
|
74
81
|
});
|
|
75
82
|
};
|
|
76
83
|
const close = useCallback((event, reason) => {
|
|
77
|
-
|
|
84
|
+
if (!isControlled) setOpenPoint(null);
|
|
78
85
|
onClose?.(event, reason);
|
|
79
|
-
if (reason !== "blur") returnFocusRef.current
|
|
80
|
-
}, [onClose]);
|
|
86
|
+
if (reason !== "blur") returnFocusRef.current?.focus();
|
|
87
|
+
}, [isControlled, onClose]);
|
|
81
88
|
const handleActivate = useCallback((_value, event) => close(event, "select"), [close]);
|
|
82
89
|
const handleContextMenu = (event) => {
|
|
83
|
-
target
|
|
90
|
+
target?.props.onContextMenu?.(event);
|
|
91
|
+
if (isControlled) return;
|
|
84
92
|
event.preventDefault();
|
|
85
93
|
openAt(event.clientY, event.clientX);
|
|
86
94
|
};
|
|
87
95
|
const handleKeyDown = (event) => {
|
|
88
|
-
target
|
|
89
|
-
if (!isMenuKey(event)) return;
|
|
96
|
+
target?.props.onKeyDown?.(event);
|
|
97
|
+
if (isControlled || !isMenuKey(event)) return;
|
|
90
98
|
event.preventDefault();
|
|
91
99
|
const { bottom, left } = event.target.getBoundingClientRect();
|
|
92
100
|
openAt(bottom, left);
|
|
@@ -108,7 +116,7 @@ function ContextMenu({ target, children, items, onClose, onSelect, marginThresho
|
|
|
108
116
|
className,
|
|
109
117
|
"data-testid": dataTestid,
|
|
110
118
|
onBlur: handleBlur,
|
|
111
|
-
children: [/* @__PURE__ */ jsx(ContextMenuTarget, {
|
|
119
|
+
children: [target && /* @__PURE__ */ jsx(ContextMenuTarget, {
|
|
112
120
|
element: target,
|
|
113
121
|
onContextMenu: handleContextMenu,
|
|
114
122
|
onKeyDown: handleKeyDown
|
|
@@ -124,6 +132,7 @@ function ContextMenu({ target, children, items, onClose, onSelect, marginThresho
|
|
|
124
132
|
children: /* @__PURE__ */ jsx(MenuActivationContext.Provider, {
|
|
125
133
|
value: handleActivate,
|
|
126
134
|
children: /* @__PURE__ */ jsx(MenuList, {
|
|
135
|
+
...slotProps?.list,
|
|
127
136
|
id: listId,
|
|
128
137
|
"aria-label": ariaLabel,
|
|
129
138
|
shouldAutoFocus: true,
|
package/dist/Menu/Menu.cjs
CHANGED
package/dist/Menu/Menu.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MenuAlign, i as MenuStep, n as MenuCloseReason, r as MenuProps, t as Menu } from "../index-
|
|
1
|
+
import { a as MenuAlign, i as MenuStep, n as MenuCloseReason, r as MenuProps, t as Menu } from "../index-CgyyM3ty.cjs";
|
|
2
2
|
export { Menu, type MenuAlign, MenuCloseReason, MenuProps, MenuStep };
|
package/dist/Menu/Menu.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MenuAlign, i as MenuStep, n as MenuCloseReason, r as MenuProps, t as Menu } from "../index-
|
|
1
|
+
import { a as MenuAlign, i as MenuStep, n as MenuCloseReason, r as MenuProps, t as Menu } from "../index-ZyigJMkV.mjs";
|
|
2
2
|
export { Menu, type MenuAlign, MenuCloseReason, MenuProps, MenuStep };
|
package/dist/Menu/Menu.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Menu } from "../Menu-
|
|
1
|
+
export { t as Menu } from "../Menu-C_4jYHWE.mjs";
|
package/dist/Menu/MenuItems.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_MenuItem = require("../MenuItem-
|
|
2
|
+
const require_MenuItem = require("../MenuItem-Bg4iRvVe.cjs");
|
|
3
3
|
const require_Menu_MenuDivider = require("./MenuDivider.cjs");
|
|
4
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
5
|
// src/Menu/MenuItems/MenuItems.tsx
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MenuItemsProps, i as MenuItems, n as MenuItemData, r as MenuItemRowData, t as MenuDividerData } from "../index-
|
|
1
|
+
import { a as MenuItemsProps, i as MenuItems, n as MenuItemData, r as MenuItemRowData, t as MenuDividerData } from "../index-Dvx5TRET.cjs";
|
|
2
2
|
export { MenuDividerData, MenuItemData, MenuItemRowData, MenuItems, MenuItemsProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MenuItemsProps, i as MenuItems, n as MenuItemData, r as MenuItemRowData, t as MenuDividerData } from "../index-
|
|
1
|
+
import { a as MenuItemsProps, i as MenuItems, n as MenuItemData, r as MenuItemRowData, t as MenuDividerData } from "../index-Dg0FPoms.mjs";
|
|
2
2
|
export { MenuDividerData, MenuItemData, MenuItemRowData, MenuItems, MenuItemsProps };
|
package/dist/Menu/MenuItems.mjs
CHANGED
package/dist/Menu/MenuList.cjs
CHANGED
package/dist/Menu/MenuList.d.cts
CHANGED
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
|
|
4
|
-
import { LayoutProps, SpaceProps } from "@soroush.tech/styled-system";
|
|
5
|
-
interface MenuListProps extends SpaceProps<Theme>, LayoutProps<Theme> {
|
|
6
|
-
/** `MenuItem` rows and `MenuDivider`s. */
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
/** Fired with a row's `value` when a row that has one is chosen. */
|
|
9
|
-
onSelect?: (value: MenuItemValue) => void;
|
|
10
|
-
/** Carry the arrow keys past the last row to the first, and back. Default: `true`. */
|
|
11
|
-
shouldWrap?: boolean;
|
|
12
|
-
/** Focus the selected row, or the first enabled one, on mount. Default: `false`. */
|
|
13
|
-
shouldAutoFocus?: boolean;
|
|
14
|
-
/** Accent color for every row - resolves to `theme.palette[color]`. A row's own value wins. */
|
|
15
|
-
color?: keyof Theme['palette'];
|
|
16
|
-
/** Base text color for every row - resolves against `theme.text`. A row's own value wins. */
|
|
17
|
-
textColor?: keyof Theme['text'];
|
|
18
|
-
/** Density token for every row - resolves against `theme.sizes`. A row's own value wins. */
|
|
19
|
-
size?: keyof Theme['sizes'];
|
|
20
|
-
/** Compact vertical padding for every row. */
|
|
21
|
-
dense?: boolean;
|
|
22
|
-
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
|
|
23
|
-
id?: string;
|
|
24
|
-
className?: string;
|
|
25
|
-
'aria-label'?: string;
|
|
26
|
-
'aria-labelledby'?: string;
|
|
27
|
-
'data-testid'?: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @description A `role="menu"` list that owns the keyboard: the arrow keys, Home and End
|
|
31
|
-
* move focus between its own rows, skipping disabled ones; typing jumps to a row by its
|
|
32
|
-
* label. Rows are found in the DOM by their nearest `role="menu"`, so a nested submenu's
|
|
33
|
-
* rows are never this list's. Renders in place - `Menu` floats one next to a trigger.
|
|
34
|
-
*/
|
|
35
|
-
declare function MenuList({ children, onSelect, shouldWrap: shouldWrapProp, shouldAutoFocus, color, textColor, size, dense, onKeyDown, ...rest }: Readonly<MenuListProps>): import("react").JSX.Element;
|
|
36
|
-
export { type MenuItemValue, MenuList, MenuListProps };
|
|
1
|
+
import { t as MenuItemValue } from "../MenuListContext-AnAxu0he.cjs";
|
|
2
|
+
import { n as MenuListProps, r as MenuListSlotProps, t as MenuList } from "../index-Biqpy7c9.cjs";
|
|
3
|
+
export { type MenuItemValue, MenuList, MenuListProps, MenuListSlotProps };
|
package/dist/Menu/MenuList.d.mts
CHANGED
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
|
|
4
|
-
import { KeyboardEvent, ReactNode } from "react";
|
|
5
|
-
interface MenuListProps extends SpaceProps<Theme>, LayoutProps<Theme> {
|
|
6
|
-
/** `MenuItem` rows and `MenuDivider`s. */
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
/** Fired with a row's `value` when a row that has one is chosen. */
|
|
9
|
-
onSelect?: (value: MenuItemValue) => void;
|
|
10
|
-
/** Carry the arrow keys past the last row to the first, and back. Default: `true`. */
|
|
11
|
-
shouldWrap?: boolean;
|
|
12
|
-
/** Focus the selected row, or the first enabled one, on mount. Default: `false`. */
|
|
13
|
-
shouldAutoFocus?: boolean;
|
|
14
|
-
/** Accent color for every row - resolves to `theme.palette[color]`. A row's own value wins. */
|
|
15
|
-
color?: keyof Theme['palette'];
|
|
16
|
-
/** Base text color for every row - resolves against `theme.text`. A row's own value wins. */
|
|
17
|
-
textColor?: keyof Theme['text'];
|
|
18
|
-
/** Density token for every row - resolves against `theme.sizes`. A row's own value wins. */
|
|
19
|
-
size?: keyof Theme['sizes'];
|
|
20
|
-
/** Compact vertical padding for every row. */
|
|
21
|
-
dense?: boolean;
|
|
22
|
-
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
|
|
23
|
-
id?: string;
|
|
24
|
-
className?: string;
|
|
25
|
-
'aria-label'?: string;
|
|
26
|
-
'aria-labelledby'?: string;
|
|
27
|
-
'data-testid'?: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @description A `role="menu"` list that owns the keyboard: the arrow keys, Home and End
|
|
31
|
-
* move focus between its own rows, skipping disabled ones; typing jumps to a row by its
|
|
32
|
-
* label. Rows are found in the DOM by their nearest `role="menu"`, so a nested submenu's
|
|
33
|
-
* rows are never this list's. Renders in place - `Menu` floats one next to a trigger.
|
|
34
|
-
*/
|
|
35
|
-
declare function MenuList({ children, onSelect, shouldWrap: shouldWrapProp, shouldAutoFocus, color, textColor, size, dense, onKeyDown, ...rest }: Readonly<MenuListProps>): import("react").JSX.Element;
|
|
36
|
-
export { type MenuItemValue, MenuList, MenuListProps };
|
|
1
|
+
import { t as MenuItemValue } from "../MenuListContext-DURKFg_T.mjs";
|
|
2
|
+
import { n as MenuListProps, r as MenuListSlotProps, t as MenuList } from "../index-B2XL_zZY.mjs";
|
|
3
|
+
export { type MenuItemValue, MenuList, MenuListProps, MenuListSlotProps };
|
package/dist/Menu/MenuList.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as MenuList } from "../MenuList-
|
|
1
|
+
export { t as MenuList } from "../MenuList-D7Pvpn_K.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_src = require("./src-yC1f5WR2.cjs");
|
|
2
2
|
const require_theme = require("./theme-XJvMdOnY.cjs");
|
|
3
3
|
const require_isRtl = require("./isRtl-Dl6QQWib.cjs");
|
|
4
|
-
const require_MenuList = require("./MenuList-
|
|
5
|
-
const require_MenuItem = require("./MenuItem-
|
|
4
|
+
const require_MenuList = require("./MenuList-CSaaR3jt.cjs");
|
|
5
|
+
const require_MenuItem = require("./MenuItem-Bg4iRvVe.cjs");
|
|
6
6
|
const require_Menu_MenuItems = require("./Menu/MenuItems.cjs");
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -36,7 +36,7 @@ function MenuTrigger({ element, id, elementRef, isOpen, listId, onClick, onKeyDo
|
|
|
36
36
|
* can't clip it, but stays inside the menu's own box in the DOM. Escape or a chosen row
|
|
37
37
|
* closes it and returns focus to the trigger; focus leaving it closes it where it went.
|
|
38
38
|
*/
|
|
39
|
-
function Menu({ trigger, children, items, isOpen: isOpenProp, defaultOpen = false, onOpen, onClose, onStep, onSelect, align: alignProp, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, "aria-label": ariaLabel, className, "data-testid": dataTestid }) {
|
|
39
|
+
function Menu({ trigger, children, items, isOpen: isOpenProp, defaultOpen = false, onOpen, onClose, onStep, onSelect, align: alignProp, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, "aria-label": ariaLabel, className, slotProps, "data-testid": dataTestid }) {
|
|
40
40
|
const dp = require_theme.useDefaultProps("Menu");
|
|
41
41
|
const align = alignProp ?? dp.align ?? "start";
|
|
42
42
|
const marginThreshold = marginThresholdProp ?? dp.marginThreshold ?? 2;
|
|
@@ -62,12 +62,14 @@ function Menu({ trigger, children, items, isOpen: isOpenProp, defaultOpen = fals
|
|
|
62
62
|
align,
|
|
63
63
|
margin,
|
|
64
64
|
elevation,
|
|
65
|
-
layer
|
|
65
|
+
layer,
|
|
66
|
+
listProps: slotProps?.list
|
|
66
67
|
}), [
|
|
67
68
|
align,
|
|
68
69
|
margin,
|
|
69
70
|
elevation,
|
|
70
|
-
layer
|
|
71
|
+
layer,
|
|
72
|
+
slotProps?.list
|
|
71
73
|
]);
|
|
72
74
|
require_MenuItem.useMenuPlacement({
|
|
73
75
|
isOpen,
|
|
@@ -145,6 +147,7 @@ function Menu({ trigger, children, items, isOpen: isOpenProp, defaultOpen = fals
|
|
|
145
147
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MenuList.MenuActivationContext.Provider, {
|
|
146
148
|
value: handleActivate,
|
|
147
149
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MenuList.MenuList, {
|
|
150
|
+
...slotProps?.list,
|
|
148
151
|
id: listId,
|
|
149
152
|
"aria-label": ariaLabel,
|
|
150
153
|
"aria-labelledby": ariaLabel ? void 0 : triggerId,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { o as styled } from "./src-B-rNjHIL.mjs";
|
|
2
2
|
import { n as useDefaultProps, r as useTheme } from "./theme-DyyZQFzQ.mjs";
|
|
3
3
|
import { t as isRtl } from "./isRtl-DN-EdUlg.mjs";
|
|
4
|
-
import { o as MenuActivationContext, t as MenuList } from "./MenuList-
|
|
5
|
-
import { i as MenuPaper, n as useMenuPlacement, r as MenuContext, t as MenuItem } from "./MenuItem-
|
|
4
|
+
import { o as MenuActivationContext, t as MenuList } from "./MenuList-D7Pvpn_K.mjs";
|
|
5
|
+
import { i as MenuPaper, n as useMenuPlacement, r as MenuContext, t as MenuItem } from "./MenuItem-kRGVRI6G.mjs";
|
|
6
6
|
import { MenuItems } from "./Menu/MenuItems.mjs";
|
|
7
7
|
import { Children, cloneElement, useCallback, useId, useMemo, useRef, useState } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -36,7 +36,7 @@ function MenuTrigger({ element, id, elementRef, isOpen, listId, onClick, onKeyDo
|
|
|
36
36
|
* can't clip it, but stays inside the menu's own box in the DOM. Escape or a chosen row
|
|
37
37
|
* closes it and returns focus to the trigger; focus leaving it closes it where it went.
|
|
38
38
|
*/
|
|
39
|
-
function Menu({ trigger, children, items, isOpen: isOpenProp, defaultOpen = false, onOpen, onClose, onStep, onSelect, align: alignProp, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, "aria-label": ariaLabel, className, "data-testid": dataTestid }) {
|
|
39
|
+
function Menu({ trigger, children, items, isOpen: isOpenProp, defaultOpen = false, onOpen, onClose, onStep, onSelect, align: alignProp, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, "aria-label": ariaLabel, className, slotProps, "data-testid": dataTestid }) {
|
|
40
40
|
const dp = useDefaultProps("Menu");
|
|
41
41
|
const align = alignProp ?? dp.align ?? "start";
|
|
42
42
|
const marginThreshold = marginThresholdProp ?? dp.marginThreshold ?? 2;
|
|
@@ -62,12 +62,14 @@ function Menu({ trigger, children, items, isOpen: isOpenProp, defaultOpen = fals
|
|
|
62
62
|
align,
|
|
63
63
|
margin,
|
|
64
64
|
elevation,
|
|
65
|
-
layer
|
|
65
|
+
layer,
|
|
66
|
+
listProps: slotProps?.list
|
|
66
67
|
}), [
|
|
67
68
|
align,
|
|
68
69
|
margin,
|
|
69
70
|
elevation,
|
|
70
|
-
layer
|
|
71
|
+
layer,
|
|
72
|
+
slotProps?.list
|
|
71
73
|
]);
|
|
72
74
|
useMenuPlacement({
|
|
73
75
|
isOpen,
|
|
@@ -145,6 +147,7 @@ function Menu({ trigger, children, items, isOpen: isOpenProp, defaultOpen = fals
|
|
|
145
147
|
children: /* @__PURE__ */ jsx(MenuActivationContext.Provider, {
|
|
146
148
|
value: handleActivate,
|
|
147
149
|
children: /* @__PURE__ */ jsx(MenuList, {
|
|
150
|
+
...slotProps?.list,
|
|
148
151
|
id: listId,
|
|
149
152
|
"aria-label": ariaLabel,
|
|
150
153
|
"aria-labelledby": ariaLabel ? void 0 : triggerId,
|
package/dist/Menu.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_MenuList = require("./MenuList-
|
|
2
|
+
const require_MenuList = require("./MenuList-CSaaR3jt.cjs");
|
|
3
3
|
const require_Menu_MenuDivider = require("./Menu/MenuDivider.cjs");
|
|
4
4
|
const require_Menu_MenuItems = require("./Menu/MenuItems.cjs");
|
|
5
5
|
const require_Menu_ContextMenu = require("./Menu/ContextMenu.cjs");
|
|
6
|
-
const require_Menu = require("./Menu-
|
|
6
|
+
const require_Menu = require("./Menu-C6eIdA1J.cjs");
|
|
7
7
|
exports.ContextMenu = require_Menu_ContextMenu.ContextMenu;
|
|
8
8
|
exports.Menu = require_Menu.Menu;
|
|
9
9
|
exports.MenuDivider = require_Menu_MenuDivider.MenuDivider;
|
package/dist/Menu.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as useMenuListContext, n as MenuListContext, r as MenuListContextValue, t as MenuItemValue } from "./MenuListContext-
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
1
|
+
import { i as useMenuListContext, n as MenuListContext, r as MenuListContextValue, t as MenuItemValue } from "./MenuListContext-AnAxu0he.cjs";
|
|
2
|
+
import { n as MenuListProps, r as MenuListSlotProps, t as MenuList } from "./index-Biqpy7c9.cjs";
|
|
3
|
+
import { a as MenuItemsProps, i as MenuItems, n as MenuItemData, r as MenuItemRowData, t as MenuDividerData } from "./index-Dvx5TRET.cjs";
|
|
4
|
+
import { a as MenuAlign, i as MenuStep, n as MenuCloseReason, r as MenuProps, t as Menu } from "./index-CgyyM3ty.cjs";
|
|
4
5
|
import { ContextMenu, ContextMenuProps } from "./Menu/ContextMenu.cjs";
|
|
5
6
|
import { MenuDivider, MenuDividerProps } from "./Menu/MenuDivider.cjs";
|
|
6
|
-
|
|
7
|
-
export { ContextMenu, ContextMenuProps, Menu, type MenuAlign, MenuCloseReason, MenuDivider, MenuDividerData, MenuDividerProps, MenuItemData, MenuItemRowData, MenuItemValue, MenuItems, MenuItemsProps, MenuList, MenuListContext, MenuListContextValue, MenuListProps, MenuProps, MenuStep, useMenuListContext };
|
|
7
|
+
export { ContextMenu, ContextMenuProps, Menu, type MenuAlign, MenuCloseReason, MenuDivider, MenuDividerData, MenuDividerProps, MenuItemData, MenuItemRowData, MenuItemValue, MenuItems, MenuItemsProps, MenuList, MenuListContext, MenuListContextValue, MenuListProps, MenuListSlotProps, MenuProps, MenuStep, useMenuListContext };
|
package/dist/Menu.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as useMenuListContext, n as MenuListContext, r as MenuListContextValue, t as MenuItemValue } from "./MenuListContext-
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
1
|
+
import { i as useMenuListContext, n as MenuListContext, r as MenuListContextValue, t as MenuItemValue } from "./MenuListContext-DURKFg_T.mjs";
|
|
2
|
+
import { n as MenuListProps, r as MenuListSlotProps, t as MenuList } from "./index-B2XL_zZY.mjs";
|
|
3
|
+
import { a as MenuItemsProps, i as MenuItems, n as MenuItemData, r as MenuItemRowData, t as MenuDividerData } from "./index-Dg0FPoms.mjs";
|
|
4
|
+
import { a as MenuAlign, i as MenuStep, n as MenuCloseReason, r as MenuProps, t as Menu } from "./index-ZyigJMkV.mjs";
|
|
4
5
|
import { ContextMenu, ContextMenuProps } from "./Menu/ContextMenu.mjs";
|
|
5
6
|
import { MenuDivider, MenuDividerProps } from "./Menu/MenuDivider.mjs";
|
|
6
|
-
|
|
7
|
-
export { ContextMenu, ContextMenuProps, Menu, type MenuAlign, MenuCloseReason, MenuDivider, MenuDividerData, MenuDividerProps, MenuItemData, MenuItemRowData, MenuItemValue, MenuItems, MenuItemsProps, MenuList, MenuListContext, MenuListContextValue, MenuListProps, MenuProps, MenuStep, useMenuListContext };
|
|
7
|
+
export { ContextMenu, ContextMenuProps, Menu, type MenuAlign, MenuCloseReason, MenuDivider, MenuDividerData, MenuDividerProps, MenuItemData, MenuItemRowData, MenuItemValue, MenuItems, MenuItemsProps, MenuList, MenuListContext, MenuListContextValue, MenuListProps, MenuListSlotProps, MenuProps, MenuStep, useMenuListContext };
|
package/dist/Menu.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as useMenuListContext, i as MenuListContext, t as MenuList } from "./MenuList-
|
|
1
|
+
import { a as useMenuListContext, i as MenuListContext, t as MenuList } from "./MenuList-D7Pvpn_K.mjs";
|
|
2
2
|
import { MenuDivider } from "./Menu/MenuDivider.mjs";
|
|
3
3
|
import { MenuItems } from "./Menu/MenuItems.mjs";
|
|
4
4
|
import { ContextMenu } from "./Menu/ContextMenu.mjs";
|
|
5
|
-
import { t as Menu } from "./Menu-
|
|
5
|
+
import { t as Menu } from "./Menu-C_4jYHWE.mjs";
|
|
6
6
|
export { ContextMenu, Menu, MenuDivider, MenuItems, MenuList, MenuListContext, useMenuListContext };
|