@gild-ui/react 0.0.0 → 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +399 -1
- package/dist/Accordion.cjs +338 -0
- package/dist/Accordion.d.cts +110 -0
- package/dist/Accordion.d.mts +110 -0
- package/dist/Accordion.mjs +334 -0
- package/dist/Accordion.types-D06ViRMj.d.mts +1114 -0
- package/dist/Alert.cjs +187 -0
- package/dist/Alert.d.cts +51 -0
- package/dist/Alert.d.mts +51 -0
- package/dist/Alert.mjs +186 -0
- package/dist/AppBar.cjs +76 -0
- package/dist/AppBar.d.cts +22 -0
- package/dist/AppBar.d.mts +22 -0
- package/dist/AppBar.mjs +76 -0
- package/dist/Autocomplete.cjs +685 -0
- package/dist/Autocomplete.d.cts +97 -0
- package/dist/Autocomplete.d.mts +97 -0
- package/dist/Autocomplete.mjs +685 -0
- package/dist/Avatar.cjs +113 -0
- package/dist/Avatar.d.cts +27 -0
- package/dist/Avatar.d.mts +27 -0
- package/dist/Avatar.mjs +113 -0
- package/dist/Backdrop.cjs +30 -0
- package/dist/Backdrop.d.cts +11 -0
- package/dist/Backdrop.d.mts +11 -0
- package/dist/Backdrop.mjs +29 -0
- package/dist/Badge.cjs +136 -0
- package/dist/Badge.d.cts +47 -0
- package/dist/Badge.d.mts +47 -0
- package/dist/Badge.mjs +136 -0
- package/dist/Breadcrumbs.cjs +150 -0
- package/dist/Breadcrumbs.d.cts +33 -0
- package/dist/Breadcrumbs.d.mts +33 -0
- package/dist/Breadcrumbs.mjs +149 -0
- package/dist/Button.cjs +194 -0
- package/dist/Button.d.cts +51 -0
- package/dist/Button.d.mts +3 -0
- package/dist/Button.mjs +194 -0
- package/dist/ButtonGroup.cjs +116 -0
- package/dist/ButtonGroup.d.cts +43 -0
- package/dist/ButtonGroup.d.mts +3 -0
- package/dist/ButtonGroup.mjs +115 -0
- package/dist/ButtonGroupContext-D5Fg5Slq.mjs +5 -0
- package/dist/ButtonGroupContext-W4VkHwoR.cjs +9 -0
- package/dist/CacheProvider.cjs +9 -0
- package/dist/CacheProvider.d.cts +4 -0
- package/dist/CacheProvider.d.mts +4 -0
- package/dist/CacheProvider.mjs +9 -0
- package/dist/Card.cjs +105 -0
- package/dist/Card.d.cts +19 -0
- package/dist/Card.d.mts +19 -0
- package/dist/Card.mjs +105 -0
- package/dist/Checkbox.cjs +210 -0
- package/dist/Checkbox.d.cts +48 -0
- package/dist/Checkbox.d.mts +48 -0
- package/dist/Checkbox.mjs +210 -0
- package/dist/Chip.cjs +210 -0
- package/dist/Chip.d.cts +51 -0
- package/dist/Chip.d.mts +51 -0
- package/dist/Chip.mjs +210 -0
- package/dist/CircularProgress.cjs +151 -0
- package/dist/CircularProgress.d.cts +37 -0
- package/dist/CircularProgress.d.mts +37 -0
- package/dist/CircularProgress.mjs +151 -0
- package/dist/Collapse.cjs +133 -0
- package/dist/Collapse.d.cts +38 -0
- package/dist/Collapse.d.mts +3 -0
- package/dist/Collapse.mjs +133 -0
- package/dist/Drawer.cjs +168 -0
- package/dist/Drawer.d.cts +60 -0
- package/dist/Drawer.d.mts +60 -0
- package/dist/Drawer.mjs +166 -0
- package/dist/Fab.cjs +123 -0
- package/dist/Fab.d.cts +33 -0
- package/dist/Fab.d.mts +3 -0
- package/dist/Fab.mjs +122 -0
- package/dist/FabMenu.cjs +312 -0
- package/dist/FabMenu.d.cts +70 -0
- package/dist/FabMenu.d.mts +70 -0
- package/dist/FabMenu.mjs +311 -0
- package/dist/Fade.cjs +17 -0
- package/dist/Fade.d.cts +8 -0
- package/dist/Fade.d.mts +8 -0
- package/dist/Fade.mjs +16 -0
- package/dist/Flex.cjs +18 -0
- package/dist/Flex.d.cts +2 -0
- package/dist/Flex.d.mts +2 -0
- package/dist/Flex.mjs +18 -0
- package/dist/FocusTrap.cjs +87 -0
- package/dist/FocusTrap.d.cts +28 -0
- package/dist/FocusTrap.d.mts +28 -0
- package/dist/FocusTrap.mjs +86 -0
- package/dist/Form.cjs +47 -0
- package/dist/Form.d.cts +41 -0
- package/dist/Form.d.mts +41 -0
- package/dist/Form.mjs +46 -0
- package/dist/FormContext-DfpxiqRO.cjs +9 -0
- package/dist/FormContext-fZHQHKUU.mjs +6 -0
- package/dist/FormControl.cjs +98 -0
- package/dist/FormControl.d.cts +81 -0
- package/dist/FormControl.d.mts +81 -0
- package/dist/FormControl.mjs +96 -0
- package/dist/FormControlContext-Btvm04Sj.cjs +9 -0
- package/dist/FormControlContext-CaQLS_sK.mjs +6 -0
- package/dist/FormHelperText.cjs +40 -0
- package/dist/FormHelperText.d.cts +15 -0
- package/dist/FormHelperText.d.mts +15 -0
- package/dist/FormHelperText.mjs +39 -0
- package/dist/FormLabel.cjs +45 -0
- package/dist/FormLabel.d.cts +17 -0
- package/dist/FormLabel.d.mts +17 -0
- package/dist/FormLabel.mjs +44 -0
- package/dist/Global.cjs +8 -0
- package/dist/Global.d.cts +2 -0
- package/dist/Global.d.mts +2 -0
- package/dist/Global.mjs +1 -0
- package/dist/Grid.cjs +20 -0
- package/dist/Grid.d.cts +25 -0
- package/dist/Grid.d.mts +25 -0
- package/dist/Grid.mjs +20 -0
- package/dist/Grow.cjs +21 -0
- package/dist/Grow.d.cts +8 -0
- package/dist/Grow.d.mts +8 -0
- package/dist/Grow.mjs +20 -0
- package/dist/Icon-CpmLCuWc.mjs +916 -0
- package/dist/Icon-D8CNaUwd.cjs +927 -0
- package/dist/Icon.cjs +4 -0
- package/dist/Icon.d.cts +3 -0
- package/dist/Icon.d.mts +3 -0
- package/dist/Icon.mjs +1 -0
- package/dist/Image.cjs +89 -0
- package/dist/Image.d.cts +19 -0
- package/dist/Image.d.mts +19 -0
- package/dist/Image.mjs +89 -0
- package/dist/LayoutProvider-DFwC1-h0.d.cts +19 -0
- package/dist/LayoutProvider-DFwC1-h0.d.mts +19 -0
- package/dist/LayoutProvider-Eb5Vp2BZ.mjs +36 -0
- package/dist/LayoutProvider-nB0hiaCR.cjs +41 -0
- package/dist/LayoutProvider.cjs +3 -0
- package/dist/LayoutProvider.d.cts +2 -0
- package/dist/LayoutProvider.d.mts +2 -0
- package/dist/LayoutProvider.mjs +1 -0
- package/dist/LinearProgress.cjs +232 -0
- package/dist/LinearProgress.d.cts +39 -0
- package/dist/LinearProgress.d.mts +39 -0
- package/dist/LinearProgress.mjs +232 -0
- package/dist/Link.cjs +59 -0
- package/dist/Link.d.cts +9 -0
- package/dist/Link.d.mts +9 -0
- package/dist/Link.mjs +59 -0
- package/dist/Menu-CEr2M5u0.mjs +229 -0
- package/dist/Menu-DA9QNBfE.cjs +245 -0
- package/dist/Menu.cjs +174 -0
- package/dist/Menu.d.cts +209 -0
- package/dist/Menu.d.mts +209 -0
- package/dist/Menu.mjs +168 -0
- package/dist/MenuItem-D3lzWmIO.cjs +859 -0
- package/dist/MenuItem-DzHB9Es6.mjs +807 -0
- package/dist/MenuItem.cjs +4 -0
- package/dist/MenuItem.d.cts +3 -0
- package/dist/MenuItem.d.mts +3 -0
- package/dist/MenuItem.mjs +2 -0
- package/dist/Modal-BphaFrcw.mjs +300 -0
- package/dist/Modal-C5OWwkvp.cjs +328 -0
- package/dist/Modal.cjs +8 -0
- package/dist/Modal.d.cts +96 -0
- package/dist/Modal.d.mts +3 -0
- package/dist/Modal.mjs +2 -0
- package/dist/NativeSelect.cjs +197 -0
- package/dist/NativeSelect.d.cts +65 -0
- package/dist/NativeSelect.d.mts +65 -0
- package/dist/NativeSelect.mjs +197 -0
- package/dist/NavTree.cjs +225 -0
- package/dist/NavTree.d.cts +65 -0
- package/dist/NavTree.d.mts +65 -0
- package/dist/NavTree.mjs +223 -0
- package/dist/NumberInput.cjs +513 -0
- package/dist/NumberInput.d.cts +96 -0
- package/dist/NumberInput.d.mts +96 -0
- package/dist/NumberInput.mjs +512 -0
- package/dist/Pagination.cjs +258 -0
- package/dist/Pagination.d.cts +90 -0
- package/dist/Pagination.d.mts +3 -0
- package/dist/Pagination.mjs +256 -0
- package/dist/Paper.cjs +54 -0
- package/dist/Paper.d.cts +2 -0
- package/dist/Paper.d.mts +3 -0
- package/dist/Paper.mjs +54 -0
- package/dist/Popover-DY0ooIAM.cjs +143 -0
- package/dist/Popover-DsPTeEPx.mjs +139 -0
- package/dist/Popover.cjs +4 -0
- package/dist/Popover.d.cts +67 -0
- package/dist/Popover.d.mts +67 -0
- package/dist/Popover.mjs +2 -0
- package/dist/Portal.cjs +22 -0
- package/dist/Portal.d.cts +15 -0
- package/dist/Portal.d.mts +2 -0
- package/dist/Portal.mjs +21 -0
- package/dist/Pressable.cjs +134 -0
- package/dist/Pressable.d.cts +52 -0
- package/dist/Pressable.d.mts +3 -0
- package/dist/Pressable.mjs +134 -0
- package/dist/Quote.cjs +11 -0
- package/dist/Quote.d.cts +15 -0
- package/dist/Quote.d.mts +15 -0
- package/dist/Quote.mjs +10 -0
- package/dist/Radio.cjs +161 -0
- package/dist/Radio.d.cts +43 -0
- package/dist/Radio.d.mts +43 -0
- package/dist/Radio.mjs +161 -0
- package/dist/RangeInput.cjs +705 -0
- package/dist/RangeInput.d.cts +77 -0
- package/dist/RangeInput.d.mts +77 -0
- package/dist/RangeInput.mjs +705 -0
- package/dist/Rating.cjs +390 -0
- package/dist/Rating.d.cts +59 -0
- package/dist/Rating.d.mts +59 -0
- package/dist/Rating.mjs +390 -0
- package/dist/ScrollArea.cjs +282 -0
- package/dist/ScrollArea.d.cts +40 -0
- package/dist/ScrollArea.d.mts +40 -0
- package/dist/ScrollArea.mjs +281 -0
- package/dist/Select.cjs +528 -0
- package/dist/Select.d.cts +69 -0
- package/dist/Select.d.mts +69 -0
- package/dist/Select.mjs +528 -0
- package/dist/Sidebar.cjs +332 -0
- package/dist/Sidebar.d.cts +156 -0
- package/dist/Sidebar.d.mts +156 -0
- package/dist/Sidebar.mjs +330 -0
- package/dist/Skeleton.cjs +90 -0
- package/dist/Skeleton.d.cts +24 -0
- package/dist/Skeleton.d.mts +24 -0
- package/dist/Skeleton.mjs +90 -0
- package/dist/Slide.cjs +51 -0
- package/dist/Slide.d.cts +14 -0
- package/dist/Slide.d.mts +14 -0
- package/dist/Slide.mjs +50 -0
- package/dist/Snackbar.cjs +216 -0
- package/dist/Snackbar.d.cts +81 -0
- package/dist/Snackbar.d.mts +81 -0
- package/dist/Snackbar.mjs +215 -0
- package/dist/StyleSheet.cjs +8 -0
- package/dist/StyleSheet.d.cts +2 -0
- package/dist/StyleSheet.d.mts +2 -0
- package/dist/StyleSheet.mjs +1 -0
- package/dist/Switch.cjs +355 -0
- package/dist/Switch.d.cts +45 -0
- package/dist/Switch.d.mts +45 -0
- package/dist/Switch.mjs +355 -0
- package/dist/Table.cjs +722 -0
- package/dist/Table.d.cts +404 -0
- package/dist/Table.d.mts +404 -0
- package/dist/Table.mjs +707 -0
- package/dist/Tabs.cjs +1227 -0
- package/dist/Tabs.d.cts +245 -0
- package/dist/Tabs.d.mts +245 -0
- package/dist/Tabs.mjs +1222 -0
- package/dist/TextInput.cjs +236 -0
- package/dist/TextInput.d.cts +82 -0
- package/dist/TextInput.d.mts +82 -0
- package/dist/TextInput.mjs +236 -0
- package/dist/ThemeProvider-DS6pBgE-.cjs +68 -0
- package/dist/ThemeProvider-DuhfCo2F.mjs +63 -0
- package/dist/ThemeProvider.cjs +4 -0
- package/dist/ThemeProvider.d.cts +2 -0
- package/dist/ThemeProvider.d.mts +2 -0
- package/dist/ThemeProvider.mjs +2 -0
- package/dist/ToggleButton.cjs +115 -0
- package/dist/ToggleButton.d.cts +51 -0
- package/dist/ToggleButton.d.mts +51 -0
- package/dist/ToggleButton.mjs +113 -0
- package/dist/Tooltip-DQo2zZH0.mjs +485 -0
- package/dist/Tooltip-DaB6bJKM.cjs +495 -0
- package/dist/Tooltip.cjs +5 -0
- package/dist/Tooltip.d.cts +122 -0
- package/dist/Tooltip.d.mts +122 -0
- package/dist/Tooltip.mjs +2 -0
- package/dist/TransferList.cjs +394 -0
- package/dist/TransferList.d.cts +69 -0
- package/dist/TransferList.d.mts +69 -0
- package/dist/TransferList.mjs +394 -0
- package/dist/Typography.cjs +69 -0
- package/dist/Typography.d.cts +30 -0
- package/dist/Typography.d.mts +3 -0
- package/dist/Typography.mjs +69 -0
- package/dist/View-BmuIFO7p.mjs +75 -0
- package/dist/View-DkfIBlcy.cjs +85 -0
- package/dist/View.cjs +3 -0
- package/dist/View.d.cts +2 -0
- package/dist/View.d.mts +2 -0
- package/dist/View.mjs +1 -0
- package/dist/Zoom.cjs +16 -0
- package/dist/Zoom.d.cts +7 -0
- package/dist/Zoom.d.mts +7 -0
- package/dist/Zoom.mjs +15 -0
- package/dist/catalog.cjs +22 -0
- package/dist/catalog.d.cts +28 -0
- package/dist/catalog.d.mts +28 -0
- package/dist/catalog.mjs +21 -0
- package/dist/computePopoverPosition-C6qSQ1QD.cjs +126 -0
- package/dist/computePopoverPosition-DHV1wQgJ.mjs +121 -0
- package/dist/computePopoverPosition-JgOwCM7k.d.cts +12 -0
- package/dist/computePopoverPosition-JgOwCM7k.d.mts +12 -0
- package/dist/css.cjs +20 -0
- package/dist/css.d.cts +2 -0
- package/dist/css.d.mts +2 -0
- package/dist/css.mjs +1 -0
- package/dist/derivedTheme-B0cxTzAq.cjs +29 -0
- package/dist/derivedTheme-BB9VVZ08.mjs +24 -0
- package/dist/engine.cjs +146 -0
- package/dist/engine.d.cts +59 -0
- package/dist/engine.d.mts +59 -0
- package/dist/engine.mjs +101 -0
- package/dist/getElementRef-4m6-x2FS.cjs +18 -0
- package/dist/getElementRef-SBx9_7pp.mjs +13 -0
- package/dist/index-B7LR7Up3.d.mts +175 -0
- package/dist/index-Bgd6kxq_.d.mts +43 -0
- package/dist/index-Blc3XujV.d.mts +52 -0
- package/dist/index-C21GrYkd.d.mts +96 -0
- package/dist/index-CA5HTpT9.d.mts +90 -0
- package/dist/index-CD0xu_P6.d.mts +92 -0
- package/dist/index-CEtnJkY4.d.cts +92 -0
- package/dist/index-CKHGDpGJ.d.mts +33 -0
- package/dist/index-CT311xS9.d.cts +175 -0
- package/dist/index-CWOcMPWz.d.mts +51 -0
- package/dist/index-CmG1wW5D.d.mts +38 -0
- package/dist/index-DZFF1vMV.d.cts +1114 -0
- package/dist/index-MfIvwyA4.d.mts +1 -0
- package/dist/index-Tg9lQlVl.d.mts +30 -0
- package/dist/index-UloRwym_.d.mts +16 -0
- package/dist/index.cjs +93 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +17 -0
- package/dist/inputVariantStyles-B-4lHxUZ.mjs +41 -0
- package/dist/inputVariantStyles-CqCQatKb.cjs +58 -0
- package/dist/isRtl-DN-EdUlg.mjs +6 -0
- package/dist/isRtl-Dl6QQWib.cjs +11 -0
- package/dist/keyframes.cjs +8 -0
- package/dist/keyframes.d.cts +2 -0
- package/dist/keyframes.d.mts +2 -0
- package/dist/keyframes.mjs +1 -0
- package/dist/next.cjs +8 -0
- package/dist/next.d.cts +2 -0
- package/dist/next.d.mts +2 -0
- package/dist/next.mjs +1 -0
- package/dist/overrides-DeXScOFK.cjs +21 -0
- package/dist/overrides-Ds6QZL5Q.mjs +16 -0
- package/dist/server.cjs +19 -0
- package/dist/server.d.cts +10 -0
- package/dist/server.d.mts +10 -0
- package/dist/server.mjs +18 -0
- package/dist/styleEngine-CLid4cmR.mjs +1 -0
- package/dist/styled-DnzWP4pc.cjs +34 -0
- package/dist/styled-nr_qC_Yx.mjs +29 -0
- package/dist/styled.cjs +3 -0
- package/dist/styled.d.cts +2 -0
- package/dist/styled.d.mts +2 -0
- package/dist/styled.mjs +1 -0
- package/dist/testing.cjs +60 -0
- package/dist/testing.d.cts +6 -0
- package/dist/testing.d.mts +6 -0
- package/dist/testing.mjs +59 -0
- package/dist/themes-BtfQPcbo.mjs +8 -0
- package/dist/themes-k-PEE5O9.cjs +12 -0
- package/dist/useAnchoredPlacement-CSotv28V.cjs +116 -0
- package/dist/useAnchoredPlacement-VwHtXnAx.mjs +111 -0
- package/dist/useDefaultProps-BTQGhvfY.mjs +13 -0
- package/dist/useDefaultProps-DratGGIL.cjs +18 -0
- package/dist/useDefaultProps.cjs +3 -0
- package/dist/useDefaultProps.d.cts +2 -0
- package/dist/useDefaultProps.d.mts +2 -0
- package/dist/useDefaultProps.mjs +1 -0
- package/dist/useLiveValue-CN2SUG2B.cjs +20 -0
- package/dist/useLiveValue-CqiwCr56.mjs +15 -0
- package/dist/useMediaQuery-acJak9M3.mjs +2 -0
- package/dist/useMediaQuery.cjs +9 -0
- package/dist/useMediaQuery.d.cts +2 -0
- package/dist/useMediaQuery.d.mts +2 -0
- package/dist/useMediaQuery.mjs +2 -0
- package/dist/useStyle.cjs +14 -0
- package/dist/useStyle.d.cts +2 -0
- package/dist/useStyle.d.mts +2 -0
- package/dist/useStyle.mjs +1 -0
- package/dist/useTheme.cjs +8 -0
- package/dist/useTheme.d.cts +2 -0
- package/dist/useTheme.d.mts +2 -0
- package/dist/useTheme.mjs +1 -0
- package/dist/useTransition-B4KGUO9m.d.cts +40 -0
- package/dist/useTransition-BKBtk0Mb.mjs +78 -0
- package/dist/useTransition-BwpSHKSf.d.mts +40 -0
- package/dist/useTransition-gHFCJwqF.cjs +83 -0
- package/dist/useTransitionChild-C18w474Q.mjs +52 -0
- package/dist/useTransitionChild-DD3f44AQ.cjs +57 -0
- package/dist/utils-ChXrUitU.mjs +1 -0
- package/dist/withStyle.cjs +8 -0
- package/dist/withStyle.d.cts +2 -0
- package/dist/withStyle.d.mts +2 -0
- package/dist/withStyle.mjs +1 -0
- package/dist/withTheme.cjs +8 -0
- package/dist/withTheme.d.cts +2 -0
- package/dist/withTheme.d.mts +2 -0
- package/dist/withTheme.mjs +1 -0
- package/package.json +908 -3
package/dist/Menu.d.mts
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { Cr as MenuSlot, Dn as MenuListThemeConfig, En as MenuListSlot, Er as PaperElevation, Mn as MenuDividerSlot, Nn as MenuDividerThemeConfig, Sa as SlotProps, Sr as MenuOwnerState, Tn as MenuListOwnerState, br as ContextMenuSlot, jn as MenuDividerOwnerState, s as Theme, wa as StyleOverride, wr as MenuThemeConfig, xr as ContextMenuThemeConfig, yr as ContextMenuOwnerState } from "./Accordion.types-D06ViRMj.mjs";
|
|
2
|
+
import "./index-MfIvwyA4.mjs";
|
|
3
|
+
import { n as PopoverPosition } from "./computePopoverPosition-JgOwCM7k.mjs";
|
|
4
|
+
import { c as MenuListContext, i as MenuItemRole, l as MenuListContextValue, s as MenuItemValue, u as useMenuListContext } from "./index-CD0xu_P6.mjs";
|
|
5
|
+
import { KeyboardEvent, MouseEvent, ReactElement, ReactNode, Ref, SyntheticEvent } from "react";
|
|
6
|
+
import { LayoutProps, SpaceProps } from "@soroush.tech/styled-system";
|
|
7
|
+
/** A menu row as data - what a `MenuItem` takes, with its label as `label`. */
|
|
8
|
+
export interface MenuItemRowData {
|
|
9
|
+
value?: MenuItemValue;
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
role?: MenuItemRole;
|
|
12
|
+
selected?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
startIcon?: ReactNode;
|
|
15
|
+
shortcut?: ReactNode;
|
|
16
|
+
note?: string;
|
|
17
|
+
onClick?: (event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
|
|
18
|
+
/** The rows of this row's submenu; `null` or `[]` is an empty one. */
|
|
19
|
+
submenu?: MenuItemData[] | null;
|
|
20
|
+
emptyLabel?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/** A divider between groups of rows. */
|
|
23
|
+
export interface MenuDividerData {
|
|
24
|
+
type: 'divider';
|
|
25
|
+
}
|
|
26
|
+
export type MenuItemData = MenuItemRowData | MenuDividerData;
|
|
27
|
+
export interface MenuItemsProps {
|
|
28
|
+
items: readonly MenuItemData[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @description Menu rows from data: each entry a `MenuItem` (its label as `label`, its
|
|
32
|
+
* submenu as more entries) or `{ type: 'divider' }`. It renders the same rows JSX children
|
|
33
|
+
* would, so the two behave alike - inside a `MenuList`, a `Menu` or a `ContextMenu`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function MenuItems({ items }: Readonly<MenuItemsProps>): import("react").JSX.Element[];
|
|
36
|
+
/** Which edge of its trigger a menu lines up with: the start edge, or the end edge. */
|
|
37
|
+
type MenuAlign = 'start' | 'end';
|
|
38
|
+
/** Why a menu closed: Escape, a chosen row, its trigger pressed again, or focus leaving it. */
|
|
39
|
+
export type MenuCloseReason = 'escapeKey' | 'select' | 'triggerClick' | 'blur';
|
|
40
|
+
/** A step a menu bar takes from this menu to the previous (`-1`) or next (`1`) one. */
|
|
41
|
+
export type MenuStep = -1 | 1;
|
|
42
|
+
interface TriggerProps {
|
|
43
|
+
id?: string;
|
|
44
|
+
ref?: Ref<HTMLElement>;
|
|
45
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
46
|
+
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
|
|
47
|
+
}
|
|
48
|
+
export interface MenuProps {
|
|
49
|
+
/** The element that opens the menu - a `Button`, a `Pressable`... It is given `aria-haspopup`, `aria-expanded` and `aria-controls`, and must take a `ref` for focus to return to it. */
|
|
50
|
+
trigger: ReactElement<TriggerProps>;
|
|
51
|
+
/** `MenuItem` rows and `MenuDivider`s. */
|
|
52
|
+
children?: ReactNode;
|
|
53
|
+
/** The rows as data, in place of `children`. */
|
|
54
|
+
items?: readonly MenuItemData[];
|
|
55
|
+
/** Controlled open state. When set, the menu never opens or closes on its own - it asks through `onOpen` / `onClose`. */
|
|
56
|
+
isOpen?: boolean;
|
|
57
|
+
/** Uncontrolled initial open state. Default: `false`. */
|
|
58
|
+
defaultOpen?: boolean;
|
|
59
|
+
/** Fired when the menu asks to open. */
|
|
60
|
+
onOpen?: () => void;
|
|
61
|
+
/** Fired when the menu asks to close, with why. */
|
|
62
|
+
onClose?: (event: SyntheticEvent, reason: MenuCloseReason) => void;
|
|
63
|
+
/** Fired when Left or Right has nowhere further to go inside the menu - so an owner such as a menu bar can step to the next menu. Swapped in right-to-left pages. */
|
|
64
|
+
onStep?: (step: MenuStep) => void;
|
|
65
|
+
/** Fired with a row's `value` when a row that has one is chosen. */
|
|
66
|
+
onSelect?: (value: MenuItemValue) => void;
|
|
67
|
+
/** Fired with the key events of the menu's lists - the list and every submenu's - after the menu has handled them (the arrow keys, Home, End, type-ahead, Escape): `preventDefault()` here does not undo what the menu did. */
|
|
68
|
+
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
|
|
69
|
+
/** Which edge of the trigger the list lines up with. Mirrored in right-to-left pages. Default: `'start'`. */
|
|
70
|
+
align?: MenuAlign;
|
|
71
|
+
/** The least room between the list and the window's edge - a `theme.space` key. Default: `2`. */
|
|
72
|
+
marginThreshold?: keyof Theme['space'];
|
|
73
|
+
/** Shadow depth of the surface. Default: `8`. */
|
|
74
|
+
elevation?: PaperElevation;
|
|
75
|
+
/** Corner radius of the list, resolves against `theme.radii`. Default: `theme.defaults.surfaceRadius`, else square. */
|
|
76
|
+
borderRadius?: keyof Theme['radii'];
|
|
77
|
+
/** Stacking layer from `theme.zOrder`. Default: `'modal'`. */
|
|
78
|
+
layer?: keyof Theme['zOrder'];
|
|
79
|
+
/** Shown as one disabled row when the menu has no rows. Without it, the list stays empty. */
|
|
80
|
+
emptyLabel?: ReactNode;
|
|
81
|
+
/** Accent color for every row - resolves to `theme.palette[color]`. */
|
|
82
|
+
color?: keyof Theme['palette'];
|
|
83
|
+
/** Base text color for every row - resolves against `theme.text`. */
|
|
84
|
+
textColor?: keyof Theme['text'];
|
|
85
|
+
/** Density token for every row - resolves against `theme.sizes`. */
|
|
86
|
+
size?: keyof Theme['sizes'];
|
|
87
|
+
/** Compact vertical padding for every row. */
|
|
88
|
+
dense?: boolean;
|
|
89
|
+
/** Names the list. Default: the trigger names it (`aria-labelledby`). */
|
|
90
|
+
'aria-label'?: string;
|
|
91
|
+
/** Overrides for the slots a theme can style: `style`, `className`, `data-*` and `aria-*`. `root` is the box around the trigger, `paper` the surface of the list, `list` the `role="menu"` list - every submenu's too. The menu's own `role`, `id` and name win over `list`. */
|
|
92
|
+
slotProps?: SlotProps<MenuSlot>;
|
|
93
|
+
className?: string;
|
|
94
|
+
/** Overrides the CSS of the root: an entry of `StyleSheet.create`, or a list of them. It wins over `slotProps.root.style`. */
|
|
95
|
+
style?: StyleOverride;
|
|
96
|
+
'data-testid'?: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @description A trigger and the `MenuList` it opens. Not modal: no focus trap, no scroll
|
|
100
|
+
* lock, nothing laid over the page, so the pointer passes over it freely. The list is
|
|
101
|
+
* placed `position: fixed` in the window next to the trigger, so a panel's overflow
|
|
102
|
+
* can't clip it, but stays inside the menu's own box in the DOM. Escape or a chosen row
|
|
103
|
+
* closes it and returns focus to the trigger; focus leaving it closes it where it went.
|
|
104
|
+
*/
|
|
105
|
+
export declare function Menu({ trigger, children, items, isOpen: isOpenProp, defaultOpen, onOpen, onClose, onStep, onSelect, onKeyDown, align: alignProp, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, 'aria-label': ariaLabel, className, style, slotProps, 'data-testid': dataTestid }: Readonly<MenuProps>): import("react").JSX.Element;
|
|
106
|
+
interface TargetProps {
|
|
107
|
+
onContextMenu?: (event: MouseEvent<HTMLElement>) => void;
|
|
108
|
+
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
|
|
109
|
+
}
|
|
110
|
+
export interface ContextMenuProps {
|
|
111
|
+
/** 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`. */
|
|
112
|
+
target?: ReactElement<TargetProps>;
|
|
113
|
+
/** 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. */
|
|
114
|
+
isOpen?: boolean;
|
|
115
|
+
/** 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. */
|
|
116
|
+
anchorPosition?: PopoverPosition;
|
|
117
|
+
/** `MenuItem` rows and `MenuDivider`s. */
|
|
118
|
+
children?: ReactNode;
|
|
119
|
+
/** The rows as data, in place of `children`. */
|
|
120
|
+
items?: readonly MenuItemData[];
|
|
121
|
+
/** Fired when the menu asks to close, with why. */
|
|
122
|
+
onClose?: (event: SyntheticEvent, reason: MenuCloseReason) => void;
|
|
123
|
+
/** Fired with a row's `value` when a row that has one is chosen. */
|
|
124
|
+
onSelect?: (value: MenuItemValue) => void;
|
|
125
|
+
/** Fired with the key events of the menu's lists - the list and every submenu's - after the menu has handled them (the arrow keys, Home, End, type-ahead, Escape): `preventDefault()` here does not undo what the menu did. */
|
|
126
|
+
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
|
|
127
|
+
/** The least room between the list and the window's edge - a `theme.space` key. Default: `2`. */
|
|
128
|
+
marginThreshold?: keyof Theme['space'];
|
|
129
|
+
/** Shadow depth of the surface. Default: `8`. */
|
|
130
|
+
/** Corner radius of the list, resolves against `theme.radii`. Default: `theme.defaults.surfaceRadius`, else square. */
|
|
131
|
+
borderRadius?: keyof Theme['radii'];
|
|
132
|
+
elevation?: PaperElevation;
|
|
133
|
+
/** Stacking layer from `theme.zOrder`. Default: `'modal'`. */
|
|
134
|
+
layer?: keyof Theme['zOrder'];
|
|
135
|
+
/** Shown as one disabled row when the menu has no rows. Without it, the list stays empty. */
|
|
136
|
+
emptyLabel?: ReactNode;
|
|
137
|
+
/** Accent color for every row - resolves to `theme.palette[color]`. */
|
|
138
|
+
color?: keyof Theme['palette'];
|
|
139
|
+
/** Base text color for every row - resolves against `theme.text`. */
|
|
140
|
+
textColor?: keyof Theme['text'];
|
|
141
|
+
/** Density token for every row - resolves against `theme.sizes`. */
|
|
142
|
+
size?: keyof Theme['sizes'];
|
|
143
|
+
/** Compact vertical padding for every row. */
|
|
144
|
+
dense?: boolean;
|
|
145
|
+
/** Names the list. */
|
|
146
|
+
'aria-label'?: string;
|
|
147
|
+
className?: string;
|
|
148
|
+
/** Overrides the CSS of the root: an entry of `StyleSheet.create`, or a list of them. It wins over `slotProps.root.style`. */
|
|
149
|
+
style?: StyleOverride;
|
|
150
|
+
/** Overrides for the slots a theme can style: `style`, `className`, `data-*` and `aria-*`. `root` is the box around the target, `paper` the surface of the list, `list` the `role="menu"` list - every submenu's too. The menu's own `role`, `id` and name win over `list`. */
|
|
151
|
+
slotProps?: SlotProps<ContextMenuSlot>;
|
|
152
|
+
'data-testid'?: string;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* @description A `MenuList` opened at the pointer by a right-click over its target, or at
|
|
156
|
+
* the focused element by the context-menu key or Shift+F10. It is placed and closes as
|
|
157
|
+
* `Menu` does - Escape, a chosen row or focus leaving - and gives focus back to where it
|
|
158
|
+
* was. The browser's own menu is held back only when this one opens.
|
|
159
|
+
*/
|
|
160
|
+
export declare function ContextMenu({ target, isOpen: isOpenProp, anchorPosition, children, items, onClose, onSelect, onKeyDown, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, 'aria-label': ariaLabel, className, style, slotProps, 'data-testid': dataTestid }: Readonly<ContextMenuProps>): import("react").JSX.Element;
|
|
161
|
+
export interface MenuDividerProps {
|
|
162
|
+
className?: string;
|
|
163
|
+
/** Overrides the CSS of the divider: an entry of `StyleSheet.create`, or a list of them. It wins over `slotProps.root.style`. */
|
|
164
|
+
style?: StyleOverride;
|
|
165
|
+
/** Overrides for the slots a theme can style: `style`, `className`, `data-*` and `aria-*`. */
|
|
166
|
+
slotProps?: SlotProps<MenuDividerSlot>;
|
|
167
|
+
'data-testid'?: string;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* @description A `role="separator"` line between groups of rows in a `MenuList`. The
|
|
171
|
+
* arrow keys pass over it.
|
|
172
|
+
*/
|
|
173
|
+
export declare function MenuDivider({ className, style, slotProps, 'data-testid': dataTestid }: Readonly<MenuDividerProps>): import("react").JSX.Element;
|
|
174
|
+
export interface MenuListProps extends SpaceProps, LayoutProps {
|
|
175
|
+
/** `MenuItem` rows and `MenuDivider`s. */
|
|
176
|
+
children?: ReactNode;
|
|
177
|
+
/** Fired with a row's `value` when a row that has one is chosen. */
|
|
178
|
+
onSelect?: (value: MenuItemValue) => void;
|
|
179
|
+
/** Carry the arrow keys past the last row to the first, and back. Default: `true`. */
|
|
180
|
+
shouldWrap?: boolean;
|
|
181
|
+
/** Focus the selected row, or the first enabled one, on mount. Default: `false`. */
|
|
182
|
+
shouldAutoFocus?: boolean;
|
|
183
|
+
/** Accent color for every row - resolves to `theme.palette[color]`. A row's own value wins. */
|
|
184
|
+
color?: keyof Theme['palette'];
|
|
185
|
+
/** Base text color for every row - resolves against `theme.text`. A row's own value wins. */
|
|
186
|
+
textColor?: keyof Theme['text'];
|
|
187
|
+
/** Density token for every row - resolves against `theme.sizes`. A row's own value wins. */
|
|
188
|
+
size?: keyof Theme['sizes'];
|
|
189
|
+
/** Compact vertical padding for every row. */
|
|
190
|
+
dense?: boolean;
|
|
191
|
+
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
|
|
192
|
+
id?: string;
|
|
193
|
+
className?: string;
|
|
194
|
+
/** Overrides the CSS of the list: an entry of `StyleSheet.create`, or a list of them. It wins over `slotProps.root.style`. */
|
|
195
|
+
style?: StyleOverride;
|
|
196
|
+
/** Overrides for the slots a theme can style: `style`, `className`, `data-*` and `aria-*`. */
|
|
197
|
+
slotProps?: SlotProps<MenuListSlot>;
|
|
198
|
+
'aria-label'?: string;
|
|
199
|
+
'aria-labelledby'?: string;
|
|
200
|
+
'data-testid'?: string;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* @description A `role="menu"` list that owns the keyboard: the arrow keys, Home and End
|
|
204
|
+
* move focus between its own rows, skipping disabled ones; typing jumps to a row by its
|
|
205
|
+
* label. Rows are found in the DOM by their nearest `role="menu"`, so a nested submenu's
|
|
206
|
+
* rows are never this list's. Renders in place - `Menu` floats one next to a trigger.
|
|
207
|
+
*/
|
|
208
|
+
export declare function MenuList({ children, onSelect, shouldWrap: shouldWrapProp, shouldAutoFocus, color, textColor, size, dense, onKeyDown, style, className, slotProps, ...rest }: Readonly<MenuListProps>): import("react").JSX.Element;
|
|
209
|
+
export { ContextMenuOwnerState, ContextMenuSlot, ContextMenuThemeConfig, type MenuAlign, MenuDividerOwnerState, MenuDividerSlot, MenuDividerThemeConfig, MenuItemValue, MenuListContext, MenuListContextValue, MenuListOwnerState, MenuListSlot, MenuListThemeConfig, MenuOwnerState, MenuSlot, MenuThemeConfig, useMenuListContext };
|
package/dist/Menu.mjs
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as MenuListSlot, c as useMenuListContext, i as MenuPaper, l as MenuActivationContext, n as useMenuPlacement, o as MenuList, r as MenuContext, s as MenuListContext, t as MenuItem } from "./MenuItem-DzHB9Es6.mjs";
|
|
3
|
+
import { t as styled } from "./styled-nr_qC_Yx.mjs";
|
|
4
|
+
import "./themes-BtfQPcbo.mjs";
|
|
5
|
+
import { t as useDefaultProps } from "./useDefaultProps-BTQGhvfY.mjs";
|
|
6
|
+
import { _ as useTheme } from "./styleEngine-CLid4cmR.mjs";
|
|
7
|
+
import { t as mergeOverrides } from "./overrides-Ds6QZL5Q.mjs";
|
|
8
|
+
import { n as MenuItems, r as MenuDivider, t as Menu } from "./Menu-CEr2M5u0.mjs";
|
|
9
|
+
import { Children, cloneElement, useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
// src/Menu/ContextMenu/ContextMenu.tsx
|
|
12
|
+
const ContextMenuPaper = styled(MenuPaper, {
|
|
13
|
+
name: "ContextMenu",
|
|
14
|
+
slot: "paper",
|
|
15
|
+
label: "ContextMenuPaper"
|
|
16
|
+
})();
|
|
17
|
+
const ContextMenuList = styled(MenuListSlot, {
|
|
18
|
+
name: "ContextMenu",
|
|
19
|
+
slot: "list",
|
|
20
|
+
label: "ContextMenuList"
|
|
21
|
+
})();
|
|
22
|
+
const ContextMenuRoot = styled("div", {
|
|
23
|
+
name: "ContextMenu",
|
|
24
|
+
label: "ContextMenu"
|
|
25
|
+
})({ display: "contents" });
|
|
26
|
+
const isMenuKey = (event) => event.key === "ContextMenu" || event.key === "F10" && event.shiftKey;
|
|
27
|
+
/** The element given, listening for a right-click and the context-menu keys. */
|
|
28
|
+
function ContextMenuTarget({ element, onContextMenu, onKeyDown }) {
|
|
29
|
+
return cloneElement(element, {
|
|
30
|
+
onContextMenu,
|
|
31
|
+
onKeyDown
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @description A `MenuList` opened at the pointer by a right-click over its target, or at
|
|
36
|
+
* the focused element by the context-menu key or Shift+F10. It is placed and closes as
|
|
37
|
+
* `Menu` does - Escape, a chosen row or focus leaving - and gives focus back to where it
|
|
38
|
+
* was. The browser's own menu is held back only when this one opens.
|
|
39
|
+
*/
|
|
40
|
+
function ContextMenu({ target, isOpen: isOpenProp, anchorPosition, children, items, onClose, onSelect, onKeyDown, marginThreshold: marginThresholdProp, elevation: elevationProp, layer: layerProp, borderRadius: borderRadiusProp, emptyLabel, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, "aria-label": ariaLabel, className, style, slotProps, "data-testid": dataTestid }) {
|
|
41
|
+
const dp = useDefaultProps("ContextMenu");
|
|
42
|
+
const marginThreshold = marginThresholdProp ?? dp.marginThreshold ?? 2;
|
|
43
|
+
const elevation = elevationProp ?? dp.elevation ?? 8;
|
|
44
|
+
const layer = layerProp ?? dp.layer ?? "modal";
|
|
45
|
+
const borderRadius = borderRadiusProp ?? dp.borderRadius;
|
|
46
|
+
const color = colorProp ?? dp.color;
|
|
47
|
+
const textColor = textColorProp ?? dp.textColor;
|
|
48
|
+
const size = sizeProp ?? dp.size;
|
|
49
|
+
const dense = denseProp ?? dp.dense;
|
|
50
|
+
const theme = useTheme();
|
|
51
|
+
const [openPoint, setOpenPoint] = useState(null);
|
|
52
|
+
const isControlled = isOpenProp !== void 0;
|
|
53
|
+
const point = isControlled ? isOpenProp && anchorPosition || null : openPoint;
|
|
54
|
+
const isOpen = point !== null;
|
|
55
|
+
const rootRef = useRef(null);
|
|
56
|
+
const surfaceRef = useRef(null);
|
|
57
|
+
const returnFocusRef = useRef(null);
|
|
58
|
+
const listId = useId();
|
|
59
|
+
const margin = Number.parseFloat(String(theme.space[marginThreshold]));
|
|
60
|
+
const menuContext = useMemo(() => ({
|
|
61
|
+
align: "start",
|
|
62
|
+
margin,
|
|
63
|
+
elevation,
|
|
64
|
+
layer,
|
|
65
|
+
listProps: slotProps?.list
|
|
66
|
+
}), [
|
|
67
|
+
margin,
|
|
68
|
+
elevation,
|
|
69
|
+
layer,
|
|
70
|
+
slotProps?.list
|
|
71
|
+
]);
|
|
72
|
+
useMenuPlacement({
|
|
73
|
+
isOpen,
|
|
74
|
+
anchorRef: rootRef,
|
|
75
|
+
anchorPosition: point,
|
|
76
|
+
surfaceRef,
|
|
77
|
+
placement: "below",
|
|
78
|
+
align: "start",
|
|
79
|
+
margin
|
|
80
|
+
});
|
|
81
|
+
useLayoutEffect(() => {
|
|
82
|
+
if (isControlled && isOpen) returnFocusRef.current = document.activeElement;
|
|
83
|
+
}, [isControlled, isOpen]);
|
|
84
|
+
const openAt = (top, left) => {
|
|
85
|
+
returnFocusRef.current = document.activeElement;
|
|
86
|
+
setOpenPoint({
|
|
87
|
+
top,
|
|
88
|
+
left
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
const close = useCallback((event, reason) => {
|
|
92
|
+
if (!isControlled) setOpenPoint(null);
|
|
93
|
+
onClose?.(event, reason);
|
|
94
|
+
if (reason !== "blur") returnFocusRef.current?.focus();
|
|
95
|
+
}, [isControlled, onClose]);
|
|
96
|
+
const handleActivate = useCallback((_value, event) => close(event, "select"), [close]);
|
|
97
|
+
const handleContextMenu = (event) => {
|
|
98
|
+
target?.props.onContextMenu?.(event);
|
|
99
|
+
if (isControlled) return;
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
openAt(event.clientY, event.clientX);
|
|
102
|
+
};
|
|
103
|
+
const handleKeyDown = (event) => {
|
|
104
|
+
target?.props.onKeyDown?.(event);
|
|
105
|
+
if (isControlled || !isMenuKey(event)) return;
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
const { bottom, left } = event.target.getBoundingClientRect();
|
|
108
|
+
openAt(bottom, left);
|
|
109
|
+
};
|
|
110
|
+
const handleSurfaceKeyDown = (event) => {
|
|
111
|
+
if (event.key === "Escape") {
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
close(event, "escapeKey");
|
|
114
|
+
}
|
|
115
|
+
onKeyDown?.(event);
|
|
116
|
+
};
|
|
117
|
+
const handleBlur = (event) => {
|
|
118
|
+
const next = event.relatedTarget;
|
|
119
|
+
if (isOpen && !event.currentTarget.contains(next)) close(event, "blur");
|
|
120
|
+
};
|
|
121
|
+
const hasRows = items ? items.length > 0 : Children.toArray(children).length > 0;
|
|
122
|
+
const rows = items ? /* @__PURE__ */ jsx(MenuItems, { items }) : children;
|
|
123
|
+
return /* @__PURE__ */ jsxs(ContextMenuRoot, {
|
|
124
|
+
ref: rootRef,
|
|
125
|
+
...mergeOverrides(slotProps?.root, {
|
|
126
|
+
style,
|
|
127
|
+
className
|
|
128
|
+
}),
|
|
129
|
+
"data-testid": dataTestid,
|
|
130
|
+
onBlur: handleBlur,
|
|
131
|
+
children: [target && /* @__PURE__ */ jsx(ContextMenuTarget, {
|
|
132
|
+
element: target,
|
|
133
|
+
onContextMenu: handleContextMenu,
|
|
134
|
+
onKeyDown: handleKeyDown
|
|
135
|
+
}), isOpen && /* @__PURE__ */ jsx(ContextMenuPaper, {
|
|
136
|
+
...slotProps?.paper,
|
|
137
|
+
ref: surfaceRef,
|
|
138
|
+
elevation,
|
|
139
|
+
layer,
|
|
140
|
+
margin,
|
|
141
|
+
borderRadius,
|
|
142
|
+
onKeyDown: handleSurfaceKeyDown,
|
|
143
|
+
children: /* @__PURE__ */ jsx(MenuContext.Provider, {
|
|
144
|
+
value: menuContext,
|
|
145
|
+
children: /* @__PURE__ */ jsx(MenuActivationContext.Provider, {
|
|
146
|
+
value: handleActivate,
|
|
147
|
+
children: /* @__PURE__ */ jsx(ContextMenuList, {
|
|
148
|
+
slotProps: { root: slotProps?.list },
|
|
149
|
+
id: listId,
|
|
150
|
+
...ariaLabel ? { "aria-label": ariaLabel } : {},
|
|
151
|
+
shouldAutoFocus: true,
|
|
152
|
+
onSelect,
|
|
153
|
+
color,
|
|
154
|
+
textColor,
|
|
155
|
+
size,
|
|
156
|
+
dense,
|
|
157
|
+
width: "100%",
|
|
158
|
+
children: hasRows ? rows : emptyLabel != null && /* @__PURE__ */ jsx(MenuItem, {
|
|
159
|
+
disabled: true,
|
|
160
|
+
children: emptyLabel
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
})
|
|
164
|
+
})
|
|
165
|
+
})]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
export { ContextMenu, Menu, MenuDivider, MenuItems, MenuList, MenuListContext, useMenuListContext };
|