@soroush.tech/design-system 2.1.0-alpha.0 → 2.1.0-alpha.2
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.d.cts +1 -1
- package/dist/Autocomplete.d.mts +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-CX9V2DAu.mjs → Menu-Cv887y7O.mjs} +8 -5
- package/dist/{Menu-BfJF32J2.cjs → Menu-DOOK_gM9.cjs} +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-CvCMGXuL.cjs → MenuItem-BWm8DC-S.cjs} +28 -25
- package/dist/{MenuItem-DdPzSWZY.mjs → MenuItem-hJeCsQZX.mjs} +28 -25
- 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-DJ_qJ1Uo.d.cts → MenuListContext-BN1VV12-.d.mts} +2 -2
- package/dist/{MenuListContext-DiZAVDCb.d.mts → MenuListContext-BkQzp2DA.d.cts} +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 +3 -3
- package/dist/Popover.d.mts +3 -3
- 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-4sJdk84N.d.cts → TableContext-BNwokJ3f.d.cts} +1 -1
- package/dist/{TableContext-BCW5av9c.d.mts → TableContext-jOlk5jxs.d.mts} +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-CPH0H6yp.cjs → Tabs-BTa2myRe.cjs} +28 -21
- package/dist/{Tabs-CG-hRs9L.mjs → Tabs-CE8iDr0D.mjs} +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-CsiW5MOp.d.mts → TabsContext-D5E7s9i5.d.mts} +1 -1
- package/dist/{TabsContext-DrmDtBqA.d.cts → TabsContext-i57cha5W.d.cts} +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-Cx4ez9vY.mjs +405 -0
- package/dist/Tooltip-rkGm1HnP.cjs +417 -0
- package/dist/Tooltip.cjs +3 -311
- package/dist/Tooltip.d.cts +36 -5
- package/dist/Tooltip.d.mts +36 -5
- package/dist/Tooltip.mjs +1 -310
- 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 +4 -0
- package/dist/catalog.d.cts +1 -1
- package/dist/catalog.d.mts +1 -1
- package/dist/catalog.mjs +4 -0
- package/dist/engine.d.cts +1 -1
- package/dist/engine.d.mts +1 -1
- package/dist/{index-D24iFgwR.d.cts → index-3-LXZL7g.d.mts} +3 -3
- package/dist/{index-BWiDilH8.d.mts → index-B-1sp9oV.d.mts} +7 -0
- package/dist/{index-C3TrdOpQ.d.cts → index-BDVi1DNs.d.mts} +3 -3
- package/dist/{index-5TAVgzbU.d.mts → index-BJIqJbF4.d.mts} +2 -2
- package/dist/{index-Bx-4KmJU.d.mts → index-BMeqk34D.d.mts} +1 -1
- package/dist/{index-DQYhGgbl.d.cts → index-BYg-l1_n.d.cts} +2 -2
- package/dist/{index-Biqn5xUs.d.mts → index-BbWQZ2Wj.d.mts} +4 -4
- package/dist/{index-DKNvADeE.d.mts → index-BhWBXIkH.d.cts} +3 -3
- package/dist/{index-DWon54cO.d.cts → index-BwFPSXSw.d.mts} +1 -1
- package/dist/{index-Bo8Og0oC.d.cts → index-Bwry7fNj.d.mts} +3 -3
- package/dist/{index-CeFExef3.d.cts → index-C3D70-3U.d.mts} +2 -2
- package/dist/{index-HLDMvfb2.d.cts → index-C6uLwNRF.d.cts} +4 -4
- package/dist/{index-BgmEVOSj.d.mts → index-C9jnQ-mQ.d.mts} +1 -1
- package/dist/{index-D--R4_5H.d.mts → index-CGlDeiGk.d.cts} +2 -2
- package/dist/{index-DvVQLBZc.d.cts → index-CK-uaK5U.d.cts} +7 -0
- package/dist/{index-DjmWIzXF.d.mts → index-CLTH0nFB.d.cts} +3 -3
- package/dist/{index-Dt-ZNTnC.d.cts → index-COGZ6LV4.d.mts} +1 -1
- package/dist/{index-DhzjNAzv.d.mts → index-CPmemva9.d.mts} +10 -5
- package/dist/{index-CW0DW6Aq.d.mts → index-CRbfhyQ6.d.mts} +2 -2
- package/dist/{index-m1RGSQlP.d.mts → index-CZofj6vc.d.cts} +3 -3
- package/dist/{index-Buu5MtRG.d.mts → index-C_K0hsEr.d.mts} +1 -1
- package/dist/index-C_n4ZPpQ.d.mts +1 -0
- package/dist/{index-fRyMPKtY.d.cts → index-Cc7Yhn7-.d.cts} +1 -1
- package/dist/{index-DgLjcrkG.d.cts → index-Cf2D7Y1b.d.cts} +1 -1
- package/dist/{index-YKXzINGk.d.mts → index-ClTo3BEJ.d.mts} +2 -2
- package/dist/{index-DR76LcSz.d.mts → index-CoHM1HQY.d.cts} +1 -1
- package/dist/{index-DtVrZFJI.d.mts → index-Cp96BUYc.d.cts} +2 -2
- package/dist/{index-CAICXdTA.d.cts → index-CvV0TCBK.d.cts} +1 -1
- package/dist/{index-DhTzn0mf.d.cts → index-CwWM6Xfz.d.cts} +1 -1
- package/dist/{index-BlHFb150.d.cts → index-CykbbqeN.d.cts} +2 -2
- package/dist/{index-Ba39mhDf.d.cts → index-DA3M2w5w.d.cts} +10 -5
- package/dist/index-DOimZ1Wo.d.mts +44 -0
- package/dist/{index-HAVWK7RM.d.cts → index-DOnYRzqY.d.cts} +2 -2
- package/dist/{index-BYAtunSZ.d.cts → index-DPCh-ols.d.mts} +2 -2
- package/dist/{index-CBOtkDdX.d.cts → index-DXUVsHux.d.mts} +1 -1
- package/dist/{index-DrfJt7W6.d.cts → index-Dh_9qMhj.d.mts} +2 -2
- package/dist/index-DiQHPHUv.d.cts +44 -0
- package/dist/{index-CyOSmefH.d.cts → index-F81TdZtB.d.mts} +2 -2
- package/dist/{index-DM7HHa4V.d.mts → index-YxsjfTkO.d.cts} +2 -2
- package/dist/{index-Bp9ECTzr.d.mts → index-d5jm3kxO.d.cts} +2 -2
- package/dist/index-fwRQcB91.d.cts +1 -0
- package/dist/{index-D_azfqsX.d.mts → index-qgFJF8n2.d.cts} +1 -1
- package/dist/{index-DtK3SaKA.d.mts → index-vls8Jhdl.d.cts} +1 -1
- package/dist/{index-Dudkopvi.d.mts → index-xhbtDtsc.d.mts} +1 -1
- 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/{useTablePagination-BOzuKUnF.d.mts → useTablePagination-DOLl6Ba7.d.cts} +1 -1
- package/dist/{useTablePagination-CraL2Mux.d.cts → useTablePagination-bZTeweJ_.d.mts} +1 -1
- package/dist/{useTransition-B-hzi7Sm.d.mts → useTransition-Dk84FQFT.d.mts} +1 -1
- package/dist/{useTransition-CF_Zy_tM.d.cts → useTransition-DnOAXNav.d.cts} +1 -1
- package/package.json +1 -1
- package/dist/index-6zQ2VUlM.d.cts +0 -1
- package/dist/index-B1qv6yGM.d.mts +0 -1
|
@@ -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-CK-uaK5U.cjs";
|
|
2
|
+
import "../index-fwRQcB91.cjs";
|
|
3
|
+
import { n as PopoverPosition } from "../computePopoverPosition-JgOwCM7k.cjs";
|
|
4
|
+
import { t as MenuItemValue } from "../MenuListContext-BkQzp2DA.cjs";
|
|
5
|
+
import { r as MenuListSlotProps } from "../index-DiQHPHUv.cjs";
|
|
6
|
+
import { n as MenuItemData } from "../index-CykbbqeN.cjs";
|
|
7
|
+
import { n as MenuCloseReason } from "../index-DA3M2w5w.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-B-1sp9oV.mjs";
|
|
2
|
+
import "../index-C_n4ZPpQ.mjs";
|
|
3
|
+
import { n as PopoverPosition } from "../computePopoverPosition-JgOwCM7k.mjs";
|
|
4
|
+
import { t as MenuItemValue } from "../MenuListContext-BN1VV12-.mjs";
|
|
5
|
+
import { r as MenuListSlotProps } from "../index-DOimZ1Wo.mjs";
|
|
6
|
+
import { n as MenuItemData } from "../index-CRbfhyQ6.mjs";
|
|
7
|
+
import { n as MenuCloseReason } from "../index-CPmemva9.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-hJeCsQZX.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-DA3M2w5w.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-CPmemva9.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-Cv887y7O.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-BWm8DC-S.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-CykbbqeN.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-CRbfhyQ6.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-BkQzp2DA.cjs";
|
|
2
|
+
import { n as MenuListProps, r as MenuListSlotProps, t as MenuList } from "../index-DiQHPHUv.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-BN1VV12-.mjs";
|
|
2
|
+
import { n as MenuListProps, r as MenuListSlotProps, t as MenuList } from "../index-DOimZ1Wo.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
|
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-hJeCsQZX.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,
|
|
@@ -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-BWm8DC-S.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,
|
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-DOOK_gM9.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-BkQzp2DA.cjs";
|
|
2
|
+
import { n as MenuListProps, r as MenuListSlotProps, t as MenuList } from "./index-DiQHPHUv.cjs";
|
|
3
|
+
import { a as MenuItemsProps, i as MenuItems, n as MenuItemData, r as MenuItemRowData, t as MenuDividerData } from "./index-CykbbqeN.cjs";
|
|
4
|
+
import { a as MenuAlign, i as MenuStep, n as MenuCloseReason, r as MenuProps, t as Menu } from "./index-DA3M2w5w.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-BN1VV12-.mjs";
|
|
2
|
+
import { n as MenuListProps, r as MenuListSlotProps, t as MenuList } from "./index-DOimZ1Wo.mjs";
|
|
3
|
+
import { a as MenuItemsProps, i as MenuItems, n as MenuItemData, r as MenuItemRowData, t as MenuDividerData } from "./index-CRbfhyQ6.mjs";
|
|
4
|
+
import { a as MenuAlign, i as MenuStep, n as MenuCloseReason, r as MenuProps, t as Menu } from "./index-CPmemva9.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-Cv887y7O.mjs";
|
|
6
6
|
export { ContextMenu, Menu, MenuDivider, MenuItems, MenuList, MenuListContext, useMenuListContext };
|
|
@@ -5,7 +5,8 @@ const require_getSurfaceRadius = require("./getSurfaceRadius-DwOn3ALC.cjs");
|
|
|
5
5
|
const require_Icon = require("./Icon-C5Iz5ekp.cjs");
|
|
6
6
|
const require_isRtl = require("./isRtl-Dl6QQWib.cjs");
|
|
7
7
|
const require_useAnchoredPlacement = require("./useAnchoredPlacement-BSfjNMut.cjs");
|
|
8
|
-
const require_MenuList = require("./MenuList-
|
|
8
|
+
const require_MenuList = require("./MenuList-CSaaR3jt.cjs");
|
|
9
|
+
const require_Tooltip = require("./Tooltip-rkGm1HnP.cjs");
|
|
9
10
|
let react = require("react");
|
|
10
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
12
|
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
@@ -135,7 +136,7 @@ function useMenuPlacement({ isOpen, anchorRef, surfaceRef, placement, align, mar
|
|
|
135
136
|
*/
|
|
136
137
|
function Submenu({ anchorRef, listId, labelledBy, children }) {
|
|
137
138
|
const menu = useMenuContext();
|
|
138
|
-
const { align, margin, elevation, layer } = menu;
|
|
139
|
+
const { align, margin, elevation, layer, listProps } = menu;
|
|
139
140
|
const surfaceRef = (0, react.useRef)(null);
|
|
140
141
|
const isFlipped = useMenuPlacement({
|
|
141
142
|
isOpen: true,
|
|
@@ -163,6 +164,7 @@ function Submenu({ anchorRef, listId, labelledBy, children }) {
|
|
|
163
164
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MenuContext.Provider, {
|
|
164
165
|
value: context,
|
|
165
166
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MenuList.MenuList, {
|
|
167
|
+
...listProps,
|
|
166
168
|
id: listId,
|
|
167
169
|
"aria-labelledby": labelledBy,
|
|
168
170
|
width: "100%",
|
|
@@ -413,10 +415,14 @@ const getRowAria = (state) => ({
|
|
|
413
415
|
"aria-expanded": state.hasSubmenu ? state.isSubmenuOpen : void 0,
|
|
414
416
|
"aria-controls": state.isSubmenuOpen ? state.submenuId : void 0,
|
|
415
417
|
"aria-checked": state.role === "menuitem" ? void 0 : state.selected,
|
|
416
|
-
"aria-keyshortcuts": state.keyShortcuts ?? (typeof state.shortcut === "string" ? state.shortcut : void 0)
|
|
417
|
-
"aria-describedby": state.note ? state.noteId : void 0
|
|
418
|
+
"aria-keyshortcuts": state.keyShortcuts ?? (typeof state.shortcut === "string" ? state.shortcut : void 0)
|
|
418
419
|
});
|
|
419
420
|
const joinClassNames = (...names) => names.filter(Boolean).join(" ") || void 0;
|
|
421
|
+
const getTick = (role, selected) => role !== "menuitem" && selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
422
|
+
name: "check",
|
|
423
|
+
size: "sm",
|
|
424
|
+
color: "inherit"
|
|
425
|
+
}) : null;
|
|
420
426
|
/**
|
|
421
427
|
* @description A row of a list. Inside a `MenuList` it is a menu row - a `menuitem`
|
|
422
428
|
* (or `menuitemradio` / `menuitemcheckbox`) with a leading icon column, its label and a
|
|
@@ -435,7 +441,6 @@ function MenuItem({ value, children, as, disabled = false, selected = false, hig
|
|
|
435
441
|
}, menu);
|
|
436
442
|
const rootRef = (0, react.useRef)(null);
|
|
437
443
|
const [isFocusVisible, setIsFocusVisible] = (0, react.useState)(false);
|
|
438
|
-
const noteId = (0, react.useId)();
|
|
439
444
|
const fallbackId = (0, react.useId)();
|
|
440
445
|
const hasSubmenu = isMenu && submenu !== void 0;
|
|
441
446
|
const { isOpen: isSubmenuOpen, entryRef, listId: submenuId, handleRowFocus, handleRowKeyDown, handleEntryKeyDown, handleEntryBlur } = useSubmenu(rootRef, hasSubmenu && !disabled);
|
|
@@ -511,16 +516,13 @@ function MenuItem({ value, children, as, disabled = false, selected = false, hig
|
|
|
511
516
|
})
|
|
512
517
|
}), children]
|
|
513
518
|
});
|
|
514
|
-
const tick = role !== "menuitem" && selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
515
|
-
name: "check",
|
|
516
|
-
size: "sm",
|
|
517
|
-
color: "inherit"
|
|
518
|
-
}) : null;
|
|
519
519
|
const rowId = id ?? fallbackId;
|
|
520
520
|
const hasSecondaryAction = secondaryAction != null;
|
|
521
|
+
const hasNote = Boolean(note);
|
|
522
|
+
const isEntry = hasSubmenu || hasSecondaryAction || hasNote;
|
|
521
523
|
const row = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(MenuItemRoot, {
|
|
522
524
|
...rootProps,
|
|
523
|
-
as:
|
|
525
|
+
as: isEntry ? "div" : as,
|
|
524
526
|
id: rowId,
|
|
525
527
|
role,
|
|
526
528
|
...getRowAria({
|
|
@@ -530,18 +532,15 @@ function MenuItem({ value, children, as, disabled = false, selected = false, hig
|
|
|
530
532
|
isSubmenuOpen,
|
|
531
533
|
submenuId,
|
|
532
534
|
shortcut,
|
|
533
|
-
keyShortcuts
|
|
534
|
-
note,
|
|
535
|
-
noteId
|
|
535
|
+
keyShortcuts
|
|
536
536
|
}),
|
|
537
|
-
title: note,
|
|
538
537
|
onKeyDown: handleKeyDown,
|
|
539
538
|
onKeyUp: handleKeyUp,
|
|
540
539
|
onPointerMove: handlePointerMove,
|
|
541
540
|
children: [
|
|
542
541
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StartIconSlot, {
|
|
543
542
|
"aria-hidden": true,
|
|
544
|
-
children: startIcon ??
|
|
543
|
+
children: startIcon ?? getTick(role, selected)
|
|
545
544
|
}),
|
|
546
545
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LabelSlot, {
|
|
547
546
|
"data-menu-label": true,
|
|
@@ -558,19 +557,23 @@ function MenuItem({ value, children, as, disabled = false, selected = false, hig
|
|
|
558
557
|
size: "sm",
|
|
559
558
|
color: "inherit"
|
|
560
559
|
})
|
|
561
|
-
}),
|
|
562
|
-
note && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
563
|
-
id: noteId,
|
|
564
|
-
hidden: true,
|
|
565
|
-
children: note
|
|
566
560
|
})
|
|
567
561
|
]
|
|
568
562
|
});
|
|
569
|
-
|
|
563
|
+
const noted = hasNote ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Tooltip.Tooltip, {
|
|
564
|
+
title: note,
|
|
565
|
+
placement: "right",
|
|
566
|
+
isInteractive: false,
|
|
567
|
+
shouldDescribeChild: true,
|
|
568
|
+
isDescriptionPersistent: true,
|
|
569
|
+
shouldWrapDisabledChild: false,
|
|
570
|
+
children: row
|
|
571
|
+
}) : row;
|
|
572
|
+
if (!isEntry) return row;
|
|
570
573
|
if (!hasSubmenu) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(EntrySlot, {
|
|
571
574
|
role: "none",
|
|
572
|
-
hasSecondaryAction
|
|
573
|
-
children: [
|
|
575
|
+
hasSecondaryAction,
|
|
576
|
+
children: [noted, hasSecondaryAction && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SecondaryActionSlot, {
|
|
574
577
|
"aria-hidden": shouldAnnounceSecondaryAction ? void 0 : true,
|
|
575
578
|
children: secondaryAction
|
|
576
579
|
})]
|
|
@@ -583,7 +586,7 @@ function MenuItem({ value, children, as, disabled = false, selected = false, hig
|
|
|
583
586
|
onKeyDown: handleEntryKeyDown,
|
|
584
587
|
onBlur: handleEntryBlur,
|
|
585
588
|
children: [
|
|
586
|
-
|
|
589
|
+
noted,
|
|
587
590
|
hasSecondaryAction && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SecondaryActionSlot, {
|
|
588
591
|
"aria-hidden": shouldAnnounceSecondaryAction ? void 0 : true,
|
|
589
592
|
children: secondaryAction
|