@ringcentral/spring-ui 1.12.0 → 1.13.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.
Files changed (213) hide show
  1. package/Accordion.js +90 -34
  2. package/AccordionHeader.js +71 -21
  3. package/Alert.js +120 -28
  4. package/Animation.js +2 -46
  5. package/Announcement.js +46 -35
  6. package/Autocomplete.js +1011 -583
  7. package/Avatar.js +134 -73
  8. package/AvatarGroup.js +50 -7
  9. package/Backdrop.js +45 -7
  10. package/Badge.js +77 -15
  11. package/Block.js +34 -12
  12. package/BlockHeader.js +57 -15
  13. package/BottomNavigation.js +181 -65
  14. package/BottomNavigationItem.js +93 -30
  15. package/Button.js +160 -24
  16. package/CallButton.js +53 -31
  17. package/Checkbox.js +88 -26
  18. package/Chip.js +126 -26
  19. package/CircularProgressIndicator.js +80 -8
  20. package/ClickAwayListener.js +4 -1
  21. package/ComponentsProps.js +1 -0
  22. package/DatePicker.js +611 -192
  23. package/DateUtilsContext.js +43 -25
  24. package/Dialer.js +564 -253
  25. package/Dialog.js +99 -45
  26. package/Divider.js +43 -7
  27. package/DragHandle.js +32 -6
  28. package/Drawer.js +117 -19
  29. package/Dropdown.js +154 -77
  30. package/EmptyState.js +65 -15
  31. package/FabButton.js +51 -17
  32. package/FocusTrap.js +109 -12
  33. package/FormField.js +108 -12
  34. package/FormLabel.js +81 -7
  35. package/Icon.js +1 -8
  36. package/IconButton.js +142 -26
  37. package/IconButtonGroup.js +35 -12
  38. package/InlineEditable.js +98 -44
  39. package/LinearProgressIndicator.js +73 -24
  40. package/Link.js +40 -11
  41. package/List.js +54 -9
  42. package/ListItem.js +152 -23
  43. package/ListItemText.js +44 -17
  44. package/ListNavigation.js +272 -20
  45. package/Menu.js +139 -23
  46. package/MenuActions.js +37 -12
  47. package/MenuDivider.js +34 -8
  48. package/MenuFooter.js +36 -12
  49. package/MenuHeader.js +54 -16
  50. package/MenuItem.js +402 -35
  51. package/MenuItemText.js +51 -9
  52. package/MenuList.js +87 -36
  53. package/Modal.js +345 -16
  54. package/NestedMenuContext.js +183 -11
  55. package/Option.js +32 -36
  56. package/Overlap.js +54 -7
  57. package/PageHeader.js +62 -24
  58. package/PickerTextField.js +156 -35
  59. package/Popover.js +262 -21
  60. package/Popper.js +112 -62
  61. package/PopperPaper.js +54 -8
  62. package/Portal.js +6 -1
  63. package/Radio.js +65 -21
  64. package/RadioGroup.js +56 -17
  65. package/Rating.js +223 -87
  66. package/Select.js +387 -44
  67. package/SingleFilter.js +148 -79
  68. package/Skeleton.js +68 -17
  69. package/Slider.js +167 -69
  70. package/Snackbar.js +122 -59
  71. package/SortableList.js +32 -12
  72. package/SortableListDndContext.js +69 -22
  73. package/SortableListItem.js +92 -47
  74. package/SortableVirtualizedList.js +44 -20
  75. package/SplitButton.js +124 -89
  76. package/Squircle.js +4 -7
  77. package/StatusIndicator.js +51 -9
  78. package/Step.js +63 -38
  79. package/StepButton.js +51 -23
  80. package/StepConnector.js +48 -8
  81. package/StepContent.js +67 -24
  82. package/StepIcon.js +90 -9
  83. package/StepLabel.js +90 -14
  84. package/Stepper.js +65 -23
  85. package/SubMenu.js +203 -101
  86. package/SwipeableDrawer.js +439 -194
  87. package/Switch.js +70 -23
  88. package/Tab.js +120 -57
  89. package/TabContext.js +59 -15
  90. package/TabPanel.js +40 -13
  91. package/Table.js +60 -17
  92. package/TableBody.js +42 -12
  93. package/TableCell.js +84 -50
  94. package/TableContainer.js +32 -10
  95. package/TableFooter.js +38 -10
  96. package/TableHead.js +49 -15
  97. package/TablePagination.js +153 -79
  98. package/TableRow.js +60 -21
  99. package/Tabs.js +592 -271
  100. package/Tag.js +51 -16
  101. package/Text.js +68 -37
  102. package/TextField.js +209 -31
  103. package/Textarea.js +51 -42
  104. package/TimePicker.js +490 -232
  105. package/Tooltip.js +48 -23
  106. package/Tray.js +237 -13
  107. package/TrayMenu.js +62 -43
  108. package/VirtualizedList.js +205 -107
  109. package/VirtualizedMenu.js +359 -29
  110. package/VisuallyHidden.js +29 -6
  111. package/chunks/1250.js +98 -0
  112. package/chunks/1294.js +126 -0
  113. package/chunks/2956.js +18 -0
  114. package/chunks/4476.js +460 -0
  115. package/chunks/4491.js +10 -0
  116. package/chunks/4535.js +364 -0
  117. package/chunks/5047.js +3 -0
  118. package/chunks/6335.js +24 -0
  119. package/chunks/7279.js +10 -0
  120. package/chunks/8011.js +8 -0
  121. package/chunks/8307.js +56 -0
  122. package/chunks/8467.js +8 -0
  123. package/chunks/8809.js +8 -0
  124. package/chunks/{RadioGroup.context.js → 9551.js} +12 -6
  125. package/chunks/987.js +8 -0
  126. package/index.css +2436 -2261
  127. package/index.js +245 -195
  128. package/internal/utils/setRef.d.ts +2 -1
  129. package/package.json +4 -4
  130. package/src/Animation/hooks/useMotionSafeTransition/useMotionSafeTransition.d.ts +2 -0
  131. package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +1 -1
  132. package/src/Button/Button.classes.d.ts +1 -1
  133. package/src/ComponentsProps.d.ts +111 -110
  134. package/src/DatePicker/DatePickerDataAttributes.d.ts +11 -0
  135. package/src/DatePicker/utils/DatePickerUtils.d.ts +1 -1
  136. package/src/MenuItem/MenuItem.type.d.ts +1 -0
  137. package/src/MenuList/MenuListContext.d.ts +2 -3
  138. package/src/Modal/Modal.type.d.ts +1 -0
  139. package/src/Popover/Popover.classes.d.ts +1 -1
  140. package/src/Popover/Popover.internal.d.ts +8 -0
  141. package/src/Popover/Popover.type.d.ts +1 -0
  142. package/src/Select/Select.type.d.ts +6 -4
  143. package/src/Table/Table.type.d.ts +3 -0
  144. package/src/Table/TableContext.d.ts +3 -0
  145. package/src/Table/TableRowContext.d.ts +7 -0
  146. package/src/Table/index.d.ts +1 -0
  147. package/src/TableCell/TableCell.classes.d.ts +1 -1
  148. package/src/TableFooter/TableFooter.classes.d.ts +1 -1
  149. package/src/TableFooter/TableFooter.type.d.ts +1 -0
  150. package/src/TableHead/TableHead.classes.d.ts +1 -1
  151. package/src/TableHead/TableHead.type.d.ts +1 -0
  152. package/src/TableRow/TableRow.type.d.ts +2 -0
  153. package/chunks/AccordionContext.js +0 -6
  154. package/chunks/Alert.js +0 -48
  155. package/chunks/AvatarGroup.js +0 -22
  156. package/chunks/Backdrop.js +0 -18
  157. package/chunks/Badge.js +0 -32
  158. package/chunks/BottomNavigationItem.js +0 -36
  159. package/chunks/Button.js +0 -88
  160. package/chunks/Chip.js +0 -73
  161. package/chunks/CircularProgressIndicator.js +0 -36
  162. package/chunks/Divider.js +0 -19
  163. package/chunks/DragHandle.js +0 -11
  164. package/chunks/Drawer.js +0 -33
  165. package/chunks/ExpandCollapseCaret.js +0 -24
  166. package/chunks/FormLabel.js +0 -27
  167. package/chunks/Icon.js +0 -25
  168. package/chunks/IconButtonLabel.js +0 -68
  169. package/chunks/List.js +0 -22
  170. package/chunks/ListItem.js +0 -83
  171. package/chunks/Menu.js +0 -61
  172. package/chunks/MenuDivider.js +0 -14
  173. package/chunks/MenuItemText.js +0 -18
  174. package/chunks/MenuList.js +0 -47
  175. package/chunks/Modal.js +0 -211
  176. package/chunks/Overlap.js +0 -25
  177. package/chunks/PickerTextField.js +0 -85
  178. package/chunks/Popover.js +0 -61
  179. package/chunks/PopperPaper.js +0 -15
  180. package/chunks/Select.js +0 -225
  181. package/chunks/ShowHideEye.js +0 -56
  182. package/chunks/SlideIn.js +0 -20
  183. package/chunks/SortableArrow.js +0 -73
  184. package/chunks/Squircle.js +0 -31
  185. package/chunks/StatusIndicator.js +0 -20
  186. package/chunks/StepConnector.js +0 -21
  187. package/chunks/StepIcon.js +0 -43
  188. package/chunks/StepLabel.js +0 -29
  189. package/chunks/StepperContext.js +0 -9
  190. package/chunks/TableContext.js +0 -6
  191. package/chunks/Tablelvl2Context.js +0 -6
  192. package/chunks/TabsContext.js +0 -6
  193. package/chunks/TextField.js +0 -110
  194. package/chunks/Tooltip.js +0 -217
  195. package/chunks/VirtualizedMenu.js +0 -162
  196. package/chunks/VisuallyHidden.js +0 -12
  197. package/chunks/composeEventHandlers.js +0 -10
  198. package/chunks/getFade.js +0 -27
  199. package/chunks/getGrow.js +0 -70
  200. package/chunks/getSlideIn.js +0 -30
  201. package/chunks/hasContent.js +0 -3
  202. package/chunks/useAnimationFrame.js +0 -15
  203. package/chunks/useFocusTrapStack.js +0 -38
  204. package/chunks/useHelperTextId.js +0 -24
  205. package/chunks/useListNavigation.js +0 -199
  206. package/chunks/useMenuItemSelect.js +0 -282
  207. package/chunks/useMotionSafeTransition.js +0 -9
  208. package/chunks/useNestedMenuItem.js +0 -27
  209. package/chunks/useNestedParentMenu.js +0 -113
  210. package/chunks/usePrefersReducedMotion.js +0 -36
  211. package/chunks/useTooltipForceHide.js +0 -27
  212. package/chunks/useTrayNavigate.js +0 -150
  213. package/chunks/withTooltip.js +0 -15
package/SubMenu.js CHANGED
@@ -1,128 +1,159 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { forwardRef, useState, useCallback, useEffect, useRef } from 'react';
3
- import { useClasses, useWindowContext, useForkRef, useId, useFocusVisible, useEventCallback } from '@ringcentral/spring-base';
4
- import { a as useNestedParentMenu, N as NestedMenuContext } from './chunks/useNestedParentMenu.js';
5
- import { Popper } from './Popper.js';
6
- import { CaretRightMd } from '@ringcentral/spring-icon';
7
- import { useThemeProps } from '@ringcentral/spring-theme';
8
- import { I as Icon } from './chunks/Icon.js';
9
- import { S as SubMenuTriggerNestedIdContext, M as MenuItem } from './chunks/useMenuItemSelect.js';
10
- import '@mui/utils';
11
- import 'tabbable';
12
- import './chunks/useListNavigation.js';
13
- import { b as useMenuOverlayGroupContext } from './chunks/Menu.js';
14
- import './VirtualizedList.js';
15
- import { useNestedChildMenu } from './NestedMenuContext.js';
16
- import { u as useNestedMenuItem } from './chunks/useNestedMenuItem.js';
17
- import { M as MenuItemText } from './chunks/MenuItemText.js';
18
- import '@floating-ui/react-dom';
19
- import './chunks/Modal.js';
20
- import '@mui/base';
21
- import 'framer-motion';
22
- import './chunks/usePrefersReducedMotion.js';
23
- import './chunks/getFade.js';
24
- import './chunks/useFocusTrapStack.js';
25
- import './chunks/Backdrop.js';
26
- import './chunks/useAnimationFrame.js';
27
- import './chunks/composeEventHandlers.js';
28
- import './ListNavigation.js';
29
- import './chunks/Popover.js';
30
- import './chunks/getGrow.js';
31
- import './chunks/PopperPaper.js';
32
- import 'react-virtuoso';
33
- import './chunks/List.js';
34
- import './chunks/hasContent.js';
35
-
36
- var PopperMenu$1 = {"sui-popper-menu-root":"sui-popper-menu-root","sui-popper-menu-paper":"sui-popper-menu-paper"};
37
-
38
- const PopperMenu = forwardRef((props, ref) => {
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useCallback, useEffect, useRef, useState } from "react";
3
+ import { useClasses, useEventCallback, useFocusVisible, useForkRef, useId, useWindowContext } from "@ringcentral/spring-base";
4
+ import { CaretRightMd } from "@ringcentral/spring-icon";
5
+ import { useThemeProps } from "@ringcentral/spring-theme";
6
+ import { useNestedParentMenu, useNestedChildMenu, useNestedMenuItem, NestedMenuContext } from "./NestedMenuContext.js";
7
+ import { Popper } from "./Popper.js";
8
+ import { Icon as Icon_Icon } from "./chunks/8307.js";
9
+ import { SubMenuTriggerNestedIdContext, MenuItem as MenuItem_MenuItem } from "./MenuItem.js";
10
+ import { useMenuOverlayGroupContext } from "./Menu.js";
11
+ import { MenuItemText as MenuItemText_MenuItemText } from "./MenuItemText.js";
12
+
13
+
14
+
15
+
16
+ // extracted by css-extract-rspack-plugin
17
+ /* export default */ var PopperMenu = ({"sui-popper-menu-root":"sui-popper-menu-root","sui-popper-menu-paper":"sui-popper-menu-paper"});
18
+
19
+
20
+
21
+
22
+
23
+
24
+ const PopperMenu_PopperMenu = /*#__PURE__*/ forwardRef((props, ref)=>{
39
25
  const { classes, children, actions, className, onClickCapture, onPointerMove, ...rest } = props;
40
26
  const cls = useClasses('popper-menu', classes, className);
41
27
  const { contentClickHandlers, contentPointerHandlers, contextValue } = useNestedParentMenu({
42
- open: true,
28
+ open: true
43
29
  });
44
- return (jsx(Popper, { className: cls('root'), ...rest, onClickCapture: (event) => {
30
+ return /*#__PURE__*/ jsx(Popper, {
31
+ className: cls('root'),
32
+ ...rest,
33
+ onClickCapture: (event)=>{
45
34
  onClickCapture?.(event);
46
35
  contentClickHandlers.onClickCapture(event);
47
- }, onPointerMove: (event) => {
36
+ },
37
+ onPointerMove: (event)=>{
48
38
  onPointerMove?.(event);
49
39
  contentPointerHandlers.onPointerMove(event);
50
- }, ref: ref, children: jsx("div", { className: cls('paper'), children: jsx(NestedMenuContext.Provider, { value: contextValue, children: children }) }) }));
40
+ },
41
+ ref: ref,
42
+ children: /*#__PURE__*/ jsx("div", {
43
+ className: cls('paper'),
44
+ children: /*#__PURE__*/ jsx(NestedMenuContext.Provider, {
45
+ value: contextValue,
46
+ children: children
47
+ })
48
+ })
49
+ });
51
50
  });
52
- PopperMenu.displayName = 'SuiPopperMenu';
51
+ PopperMenu_PopperMenu.displayName = 'SuiPopperMenu';
52
+
53
+
54
+
55
+
56
+
53
57
 
54
- const useSubMenuInteractionState = ({ open, focusVisibleWithin, isPointerGraceActive, clearPointerGrace, }) => {
58
+
59
+
60
+
61
+ const useSubMenuInteractionState = ({ open, focusVisibleWithin, isPointerGraceActive, clearPointerGrace })=>{
55
62
  const [hasEnteredMenuContent, setHasEnteredMenuContent] = useState(false);
56
63
  const [isPointerInsideTrigger, setIsPointerInsideTrigger] = useState(false);
57
- const resetInteractionState = useCallback(() => {
64
+ const resetInteractionState = useCallback(()=>{
58
65
  setHasEnteredMenuContent(false);
59
66
  setIsPointerInsideTrigger(false);
60
67
  }, []);
61
- const markTriggerPointerMoved = useCallback(() => {
68
+ const markTriggerPointerMoved = useCallback(()=>{
62
69
  setIsPointerInsideTrigger(true);
63
70
  setHasEnteredMenuContent(false);
64
71
  }, []);
65
- const markTriggerPointerLeft = useCallback(() => {
72
+ const markTriggerPointerLeft = useCallback(()=>{
66
73
  setIsPointerInsideTrigger(false);
67
74
  setHasEnteredMenuContent(false);
68
75
  }, []);
69
- const markMenuContentEntered = useCallback(() => {
76
+ const markMenuContentEntered = useCallback(()=>{
70
77
  setHasEnteredMenuContent(true);
71
78
  clearPointerGrace();
72
- }, [clearPointerGrace]);
73
- const shouldKeepSubMenuOpen = isPointerInsideTrigger ||
74
- hasEnteredMenuContent ||
75
- focusVisibleWithin ||
76
- isPointerGraceActive;
77
- useEffect(() => {
79
+ }, [
80
+ clearPointerGrace
81
+ ]);
82
+ const shouldKeepSubMenuOpen = isPointerInsideTrigger || hasEnteredMenuContent || focusVisibleWithin || isPointerGraceActive;
83
+ useEffect(()=>{
78
84
  if (!open) {
79
85
  resetInteractionState();
80
86
  }
81
- }, [open, resetInteractionState]);
87
+ }, [
88
+ open,
89
+ resetInteractionState
90
+ ]);
82
91
  return {
83
92
  markTriggerPointerLeft,
84
93
  markTriggerPointerMoved,
85
94
  markMenuContentEntered,
86
95
  resetInteractionState,
87
- shouldKeepSubMenuOpen,
96
+ shouldKeepSubMenuOpen
88
97
  };
89
98
  };
90
99
 
100
+
101
+
102
+
103
+
91
104
  const POINTER_GRACE_TIMEOUT = 300;
92
105
  const POINTER_GRACE_BLEED = 5;
93
- const getSubMenuSide = (anchorRect, menuRect) => {
106
+ const getSubMenuSide = (anchorRect, menuRect)=>{
94
107
  const anchorCenterX = anchorRect.left + anchorRect.width / 2;
95
108
  const menuCenterX = menuRect.left + menuRect.width / 2;
96
109
  return menuCenterX >= anchorCenterX ? 'right' : 'left';
97
110
  };
98
- const getPointerGraceIntent = (event, menuRect, side) => {
111
+ const getPointerGraceIntent = (event, menuRect, side)=>{
99
112
  const bleed = side === 'right' ? -POINTER_GRACE_BLEED : POINTER_GRACE_BLEED;
100
113
  const contentNearEdge = menuRect[side === 'right' ? 'left' : 'right'];
101
114
  const contentFarEdge = menuRect[side === 'right' ? 'right' : 'left'];
102
115
  return {
103
116
  area: [
104
- { x: event.clientX + bleed, y: event.clientY },
105
- { x: contentNearEdge, y: menuRect.top },
106
- { x: contentFarEdge, y: menuRect.top },
107
- { x: contentFarEdge, y: menuRect.bottom },
108
- { x: contentNearEdge, y: menuRect.bottom },
117
+ {
118
+ x: event.clientX + bleed,
119
+ y: event.clientY
120
+ },
121
+ {
122
+ x: contentNearEdge,
123
+ y: menuRect.top
124
+ },
125
+ {
126
+ x: contentFarEdge,
127
+ y: menuRect.top
128
+ },
129
+ {
130
+ x: contentFarEdge,
131
+ y: menuRect.bottom
132
+ },
133
+ {
134
+ x: contentNearEdge,
135
+ y: menuRect.bottom
136
+ }
109
137
  ],
110
- side,
138
+ side
111
139
  };
112
140
  };
113
- const useSubMenuPointerGrace = (props) => {
141
+ const useSubMenuPointerGrace = (props)=>{
114
142
  const { isPointerMovingToSubMenu, onPointerGraceIntentChange } = props;
115
143
  const { externalWindow, globalThis: contextGlobal } = useWindowContext();
116
144
  const contextWindow = externalWindow ?? contextGlobal;
117
145
  const [isPointerGraceActive, setIsPointerGraceActive] = useState(false);
118
146
  const timerRef = useRef();
119
- const clearPointerGrace = useCallback(() => {
147
+ const clearPointerGrace = useCallback(()=>{
120
148
  contextWindow.clearTimeout(timerRef.current);
121
149
  timerRef.current = undefined;
122
150
  setIsPointerGraceActive(false);
123
151
  onPointerGraceIntentChange?.(null);
124
- }, [contextWindow, onPointerGraceIntentChange]);
125
- const startPointerGrace = useCallback((event, anchorElement, menuElement) => {
152
+ }, [
153
+ contextWindow,
154
+ onPointerGraceIntentChange
155
+ ]);
156
+ const startPointerGrace = useCallback((event, anchorElement, menuElement)=>{
126
157
  if (!anchorElement || !menuElement) {
127
158
  clearPointerGrace();
128
159
  return;
@@ -148,23 +179,43 @@ const useSubMenuPointerGrace = (props) => {
148
179
  clearPointerGrace,
149
180
  contextWindow,
150
181
  isPointerMovingToSubMenu,
151
- onPointerGraceIntentChange,
182
+ onPointerGraceIntentChange
152
183
  ]);
153
- useEffect(() => {
184
+ useEffect(()=>{
154
185
  return clearPointerGrace;
155
- }, [clearPointerGrace]);
186
+ }, [
187
+ clearPointerGrace
188
+ ]);
156
189
  return {
157
190
  isPointerGraceActive,
158
191
  clearPointerGrace,
159
- startPointerGrace,
192
+ startPointerGrace
160
193
  };
161
194
  };
162
195
 
163
- const isSubMenuNavigationOpenEvent = (event) => ['ArrowRight'].includes(event.key);
164
- const isSubMenuKeyboardActivationEvent = (event) => (event.type === 'keydown' && event.key === 'Enter') ||
165
- (event.type === 'keyup' && event.key === ' ');
166
- const SubMenu = forwardRef((inProps, ref) => {
167
- const props = useThemeProps({ props: inProps, name: 'SubMenu' });
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+ const isSubMenuNavigationOpenEvent = (event)=>[
211
+ 'ArrowRight'
212
+ ].includes(event.key);
213
+ const isSubMenuKeyboardActivationEvent = (event)=>event.type === 'keydown' && event.key === 'Enter' || event.type === 'keyup' && event.key === ' ';
214
+ const SubMenu = /*#__PURE__*/ forwardRef((inProps, ref)=>{
215
+ const props = useThemeProps({
216
+ props: inProps,
217
+ name: 'SubMenu'
218
+ });
168
219
  const { classes, children, itemContent, onClick: onClickProp, onKeyDown: onKeyDownProp, onPointerLeave: onPointerLeaveProp, onPointerMove: onPointerMoveProp, disabled, ...rest } = props;
169
220
  const [anchor, setAnchor] = useState(null);
170
221
  const itemRef = useRef(null);
@@ -172,21 +223,23 @@ const SubMenu = forwardRef((inProps, ref) => {
172
223
  const menuRef = useRef(null);
173
224
  const open = Boolean(anchor);
174
225
  const id = useId();
175
- const { isPointerMovingToSubMenu, onPointerGraceIntentChange } = useNestedMenuItem({ id });
226
+ const { isPointerMovingToSubMenu, onPointerGraceIntentChange } = useNestedMenuItem({
227
+ id
228
+ });
176
229
  const { isPointerGraceActive, clearPointerGrace, startPointerGrace } = useSubMenuPointerGrace({
177
230
  isPointerMovingToSubMenu,
178
- onPointerGraceIntentChange,
231
+ onPointerGraceIntentChange
179
232
  });
180
233
  const { focusVisibleWithin, focusVisibleHandlers } = useFocusVisible({
181
- within: true,
234
+ within: true
182
235
  });
183
- const { markTriggerPointerLeft, markTriggerPointerMoved, markMenuContentEntered, resetInteractionState, shouldKeepSubMenuOpen, } = useSubMenuInteractionState({
236
+ const { markTriggerPointerLeft, markTriggerPointerMoved, markMenuContentEntered, resetInteractionState, shouldKeepSubMenuOpen } = useSubMenuInteractionState({
184
237
  open,
185
238
  focusVisibleWithin,
186
239
  isPointerGraceActive,
187
- clearPointerGrace,
240
+ clearPointerGrace
188
241
  });
189
- const closeSubMenu = useEventCallback((options) => {
242
+ const closeSubMenu = useEventCallback((options)=>{
190
243
  if (options?.restoreFocus) {
191
244
  itemRef.current?.focus();
192
245
  }
@@ -196,7 +249,7 @@ const SubMenu = forwardRef((inProps, ref) => {
196
249
  });
197
250
  const overlayGroupContext = useMenuOverlayGroupContext();
198
251
  const overlayContainer = overlayGroupContext?.container;
199
- const handleTriggerPointerMove = (event) => {
252
+ const handleTriggerPointerMove = (event)=>{
200
253
  onPointerMoveProp?.(event);
201
254
  if (event.pointerType !== 'mouse' || event.defaultPrevented || disabled) {
202
255
  return;
@@ -209,32 +262,45 @@ const SubMenu = forwardRef((inProps, ref) => {
209
262
  clearPointerGrace();
210
263
  setAnchor(event.currentTarget);
211
264
  };
212
- const handleTriggerPointerLeave = (event) => {
265
+ const handleTriggerPointerLeave = (event)=>{
213
266
  onPointerLeaveProp?.(event);
214
267
  if (event.pointerType === 'mouse') {
215
268
  markTriggerPointerLeft();
216
269
  startPointerGrace(event, itemRef.current, menuRef.current);
217
270
  }
218
271
  };
219
- const openSubMenuFromTrigger = (trigger) => {
272
+ const openSubMenuFromTrigger = (trigger)=>{
220
273
  markMenuContentEntered();
221
274
  setAnchor(trigger);
222
275
  };
223
- const getAnchorElement = useCallback(() => itemRef.current, []);
276
+ const getAnchorElement = useCallback(()=>itemRef.current, []);
224
277
  useNestedChildMenu({
225
278
  open,
226
279
  closeMenu: closeSubMenu,
227
280
  getAnchorElement,
228
- id,
281
+ id
229
282
  });
230
- useEffect(() => {
231
- if (!open)
232
- return;
283
+ useEffect(()=>{
284
+ if (!open) return;
233
285
  if (!shouldKeepSubMenuOpen) {
234
286
  closeSubMenu();
235
287
  }
236
- }, [closeSubMenu, open, shouldKeepSubMenuOpen]);
237
- return (jsxs(Fragment, { children: [jsx(SubMenuTriggerNestedIdContext.Provider, { value: id, children: jsxs(MenuItem, { "aria-haspopup": "menu", ...rest, "aria-expanded": open, autoClose: false, disabled: disabled, onKeyDown: (e) => {
288
+ }, [
289
+ closeSubMenu,
290
+ open,
291
+ shouldKeepSubMenuOpen
292
+ ]);
293
+ return /*#__PURE__*/ jsxs(Fragment, {
294
+ children: [
295
+ /*#__PURE__*/ jsx(SubMenuTriggerNestedIdContext.Provider, {
296
+ value: id,
297
+ children: /*#__PURE__*/ jsxs(MenuItem_MenuItem, {
298
+ "aria-haspopup": "menu",
299
+ ...rest,
300
+ "aria-expanded": open,
301
+ autoClose: false,
302
+ disabled: disabled,
303
+ onKeyDown: (e)=>{
238
304
  if (disabled) {
239
305
  return;
240
306
  }
@@ -245,7 +311,8 @@ const SubMenu = forwardRef((inProps, ref) => {
245
311
  if (isSubMenuNavigationOpenEvent(e)) {
246
312
  openSubMenuFromTrigger(e.currentTarget);
247
313
  }
248
- }, onClick: (e) => {
314
+ },
315
+ onClick: (e)=>{
249
316
  if (disabled) {
250
317
  return;
251
318
  }
@@ -256,18 +323,53 @@ const SubMenu = forwardRef((inProps, ref) => {
256
323
  if (isSubMenuKeyboardActivationEvent(e)) {
257
324
  openSubMenuFromTrigger(e.currentTarget);
258
325
  }
259
- }, onPointerMove: handleTriggerPointerMove, onPointerLeave: handleTriggerPointerLeave, ref: handleRef, children: [typeof itemContent === 'string' ? (jsx(MenuItemText, { children: itemContent })) : (itemContent), jsx(Icon, { symbol: CaretRightMd })] }) }), open && (jsx(PopperMenu, { anchorEl: anchor, container: overlayContainer ?? undefined, disablePortal: overlayContainer ? false : undefined, placement: "right-start", offset: -4, ref: menuRef, onKeyDown: (e) => {
260
- if ((e.key === 'ArrowLeft' || e.key === 'Escape') &&
261
- e.currentTarget.contains(e.target)) {
326
+ },
327
+ onPointerMove: handleTriggerPointerMove,
328
+ onPointerLeave: handleTriggerPointerLeave,
329
+ ref: handleRef,
330
+ children: [
331
+ typeof itemContent === 'string' ? /*#__PURE__*/ jsx(MenuItemText_MenuItemText, {
332
+ children: itemContent
333
+ }) : itemContent,
334
+ /*#__PURE__*/ jsx(Icon_Icon, {
335
+ symbol: CaretRightMd
336
+ })
337
+ ]
338
+ })
339
+ }),
340
+ open && /*#__PURE__*/ jsx(PopperMenu_PopperMenu, {
341
+ anchorEl: anchor,
342
+ container: overlayContainer ?? undefined,
343
+ disablePortal: overlayContainer ? false : undefined,
344
+ placement: "right-start",
345
+ offset: -4,
346
+ ref: menuRef,
347
+ onKeyDown: (e)=>{
348
+ if ((e.key === 'ArrowLeft' || e.key === 'Escape') && e.currentTarget.contains(e.target)) {
262
349
  e.stopPropagation();
263
- closeSubMenu({ restoreFocus: true });
350
+ closeSubMenu({
351
+ restoreFocus: true
352
+ });
264
353
  }
265
- }, onPointerMove: (event) => {
354
+ },
355
+ onPointerMove: (event)=>{
266
356
  if (event.pointerType === 'mouse') {
267
357
  markMenuContentEntered();
268
358
  }
269
- }, ...focusVisibleHandlers, children: children }))] }));
359
+ },
360
+ ...focusVisibleHandlers,
361
+ children: children
362
+ })
363
+ ]
364
+ });
270
365
  });
271
366
  SubMenu.displayName = 'SuiSubMenu';
272
367
 
273
- export { PopperMenu, SubMenu, PopperMenu$1 as popperMenuStyle };
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+ export { PopperMenu as popperMenuStyle, PopperMenu_PopperMenu as PopperMenu, SubMenu };