@arc-ui/components 12.0.0-beta.22 → 12.0.0-beta.23

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 (203) hide show
  1. package/lib/Alert/Alert.cjs +22 -21
  2. package/lib/Alert/Alert.mjs +22 -21
  3. package/lib/Alert/styles.css +1 -1
  4. package/lib/Align/styles.css +1 -1
  5. package/lib/AppButton/styles.css +1 -1
  6. package/lib/Avatar/styles.css +1 -1
  7. package/lib/AvatarGroup/styles.css +1 -1
  8. package/lib/Badge/styles.css +1 -1
  9. package/lib/Banner/Banner.cjs +1 -1
  10. package/lib/Banner/Banner.mjs +1 -1
  11. package/lib/Box/styles.css +1 -1
  12. package/lib/BrandLogo/styles.css +1 -1
  13. package/lib/Breadcrumbs/Breadcrumbs.cjs +12 -3
  14. package/lib/Breadcrumbs/Breadcrumbs.mjs +12 -3
  15. package/lib/Breadcrumbs/styles.css +1 -1
  16. package/lib/Button/styles.css +1 -1
  17. package/lib/ButtonGroup/styles.css +1 -1
  18. package/lib/ButtonV2/styles.css +1 -1
  19. package/lib/Calendar/Calendar.cjs +2 -2
  20. package/lib/Calendar/Calendar.mjs +2 -2
  21. package/lib/Calendar/styles.css +1 -1
  22. package/lib/CardFooter/styles.css +1 -1
  23. package/lib/CardHeading/styles.css +1 -1
  24. package/lib/Carousel/Carousel.cjs +11 -5
  25. package/lib/Carousel/Carousel.mjs +8 -2
  26. package/lib/Carousel/styles.css +1 -1
  27. package/lib/Checkbox/Checkbox.cjs +85 -11
  28. package/lib/Checkbox/Checkbox.mjs +87 -9
  29. package/lib/Checkbox/styles.css +1 -1
  30. package/lib/Columns/styles.css +1 -1
  31. package/lib/ComboBox/ComboBox.cjs +276 -11
  32. package/lib/ComboBox/ComboBox.mjs +279 -10
  33. package/lib/ComboBox/styles.css +1 -1
  34. package/lib/ContentSwitcher/ContentSwitcher.cjs +5 -6
  35. package/lib/ContentSwitcher/ContentSwitcher.mjs +5 -6
  36. package/lib/ContentSwitcher/styles.css +1 -1
  37. package/lib/ContentSwitcherDropdown/styles.css +1 -1
  38. package/lib/DatePicker/DatePicker.cjs +351 -38
  39. package/lib/DatePicker/DatePicker.mjs +329 -17
  40. package/lib/DatePicker/styles.css +1 -1
  41. package/lib/Disclosure/styles.css +1 -1
  42. package/lib/DisclosureMini/styles.css +1 -1
  43. package/lib/Download/styles.css +1 -1
  44. package/lib/Drawer/styles.css +1 -1
  45. package/lib/Elevation/styles.css +1 -1
  46. package/lib/Filter/styles.css +1 -1
  47. package/lib/FormControl/styles.css +1 -1
  48. package/lib/GhostedHeroBanner/styles.css +1 -1
  49. package/lib/GradientPageBackground/GradientPageBackground.cjs +55 -43
  50. package/lib/GradientPageBackground/GradientPageBackground.mjs +55 -43
  51. package/lib/GradientPageBackground/styles.css +1 -1
  52. package/lib/Grid/styles.css +1 -1
  53. package/lib/Group/styles.css +1 -1
  54. package/lib/Heading/styles.css +1 -1
  55. package/lib/HeroBanner/HeroBanner.cjs +1 -1
  56. package/lib/HeroBanner/HeroBanner.mjs +1 -1
  57. package/lib/HeroBanner/styles.css +1 -1
  58. package/lib/HeroButton/HeroButton.cjs +77 -9
  59. package/lib/HeroButton/HeroButton.mjs +80 -8
  60. package/lib/HeroButton/styles.css +1 -1
  61. package/lib/Hidden/styles.css +1 -1
  62. package/lib/HorizontalCard/styles.css +1 -1
  63. package/lib/Icon/styles.css +1 -1
  64. package/lib/Image/styles.css +1 -1
  65. package/lib/ImpactCard/ImpactCard.cjs +3 -3
  66. package/lib/ImpactCard/ImpactCard.mjs +3 -3
  67. package/lib/ImpactCard/styles.css +1 -1
  68. package/lib/InformationCard/InformationCard.cjs +6 -6
  69. package/lib/InformationCard/InformationCard.mjs +6 -6
  70. package/lib/InformationCard/styles.css +1 -1
  71. package/lib/Link/Link.cjs +1 -1
  72. package/lib/Link/Link.mjs +1 -1
  73. package/lib/Link/styles.css +1 -1
  74. package/lib/Markup/styles.css +1 -1
  75. package/lib/MediaCard/MediaCard.cjs +53 -14
  76. package/lib/MediaCard/MediaCard.mjs +55 -12
  77. package/lib/MediaCard/styles.css +1 -1
  78. package/lib/Menu/Menu.cjs +1327 -25
  79. package/lib/Menu/Menu.mjs +1292 -9
  80. package/lib/Menu/styles.css +1 -1
  81. package/lib/Modal/styles.css +1 -1
  82. package/lib/NavigationHeader/NavigationHeader.cjs +743 -16
  83. package/lib/NavigationHeader/NavigationHeader.mjs +734 -7
  84. package/lib/NavigationHeader/styles.css +1 -1
  85. package/lib/Pagination/styles.css +1 -1
  86. package/lib/PaginationSimple/styles.css +1 -1
  87. package/lib/Popover/styles.css +1 -1
  88. package/lib/Poster/styles.css +1 -1
  89. package/lib/ProgressBar/styles.css +1 -1
  90. package/lib/ProgressStepper/styles.css +1 -1
  91. package/lib/ProgressStepperOverflow/ProgressStepperOverflow.cjs +138 -7
  92. package/lib/ProgressStepperOverflow/ProgressStepperOverflow.mjs +140 -5
  93. package/lib/ProgressStepperOverflow/styles.css +1 -1
  94. package/lib/RadioCardGroup/RadioCardGroup.cjs +48 -7
  95. package/lib/RadioCardGroup/RadioCardGroup.mjs +48 -8
  96. package/lib/RadioCardGroup/styles.css +1 -1
  97. package/lib/RadioGroup/RadioGroup.cjs +50 -8
  98. package/lib/RadioGroup/RadioGroup.mjs +49 -8
  99. package/lib/RadioGroup/styles.css +1 -1
  100. package/lib/Rule/styles.css +1 -1
  101. package/lib/ScrollToTop/styles.css +1 -1
  102. package/lib/Section/Section.cjs +1 -1
  103. package/lib/Section/Section.mjs +1 -1
  104. package/lib/Section/styles.css +1 -1
  105. package/lib/Select/styles.css +1 -1
  106. package/lib/SiteFooter/SiteFooter.cjs +1 -1
  107. package/lib/SiteFooter/SiteFooter.mjs +1 -1
  108. package/lib/SiteFooter/styles.css +1 -1
  109. package/lib/SiteFooterV2/SiteFooterV2.cjs +6 -5
  110. package/lib/SiteFooterV2/SiteFooterV2.mjs +6 -5
  111. package/lib/SiteFooterV2/styles.css +1 -1
  112. package/lib/SiteHeaderV2/SiteHeaderV2.cjs +440 -15
  113. package/lib/SiteHeaderV2/SiteHeaderV2.mjs +435 -11
  114. package/lib/SiteHeaderV2/styles.css +1 -1
  115. package/lib/Skeleton/styles.css +1 -1
  116. package/lib/SkipLink/styles.css +1 -1
  117. package/lib/Spinner/styles.css +1 -1
  118. package/lib/Surface/styles.css +1 -1
  119. package/lib/Switch/styles.css +1 -1
  120. package/lib/TabbedBanner/TabbedBanner.cjs +4 -5
  121. package/lib/TabbedBanner/TabbedBanner.mjs +4 -5
  122. package/lib/TabbedBanner/styles.css +1 -1
  123. package/lib/Tabs/Tabs.mjs +1 -1
  124. package/lib/Tabs/styles.css +1 -1
  125. package/lib/Tag/Tag.cjs +9 -9
  126. package/lib/Tag/Tag.mjs +9 -9
  127. package/lib/Tag/styles.css +1 -1
  128. package/lib/TemplateBanner/TemplateBanner.cjs +1 -1
  129. package/lib/TemplateBanner/TemplateBanner.mjs +1 -1
  130. package/lib/TemplateBanner/styles.css +1 -1
  131. package/lib/Text/styles.css +1 -1
  132. package/lib/TextArea/TextArea.cjs +2 -53
  133. package/lib/TextArea/TextArea.mjs +2 -53
  134. package/lib/TextArea/styles.css +1 -1
  135. package/lib/TextInput/styles.css +1 -1
  136. package/lib/Theme/Theme.cjs +1 -1
  137. package/lib/Theme/Theme.mjs +1 -1
  138. package/lib/Theme/styles.css +1 -1
  139. package/lib/ThemeIcon/styles.css +1 -1
  140. package/lib/ThumbnailSignpost/styles.css +1 -1
  141. package/lib/Toast/styles.css +1 -1
  142. package/lib/Tooltip/styles.css +1 -1
  143. package/lib/Truncate/styles.css +1 -1
  144. package/lib/TypographyCard/TypographyCard.cjs +3 -3
  145. package/lib/TypographyCard/TypographyCard.mjs +3 -3
  146. package/lib/TypographyCard/styles.css +1 -1
  147. package/lib/UniversalHeader/styles.css +1 -1
  148. package/lib/VerticalSpace/styles.css +1 -1
  149. package/lib/VideoPlayer/styles.css +1 -1
  150. package/lib/Visible/styles.css +1 -1
  151. package/lib/VisuallyHidden/styles.css +1 -1
  152. package/lib/_shared/cjs/{Calendar-B-va25n2.cjs → Calendar-Bfdgf5q1.cjs} +1 -1
  153. package/lib/_shared/cjs/{ContentSwitcherList-bCEzIPN2.cjs → ContentSwitcherList-pcYtuT6L.cjs} +8 -0
  154. package/lib/_shared/cjs/{Link-7xUgVf1I.cjs → Link-C3OSQIIk.cjs} +3 -1
  155. package/lib/_shared/cjs/{Section-wUVdzmGA.cjs → Section-Bz2fwj8Z.cjs} +2 -2
  156. package/lib/_shared/cjs/{TemplateBanner-CImrJ9ON.cjs → TemplateBanner-COymAI91.cjs} +2 -2
  157. package/lib/_shared/cjs/{arc-breakpoints-DWUgmeLA.cjs → arc-breakpoints-CS8JVk5T.cjs} +1 -1
  158. package/lib/_shared/cjs/{index.es-DlNskPlN.cjs → index.es-fkulh7qu.cjs} +1 -1
  159. package/lib/_shared/esm/{Calendar-Bd2_eT1Y.mjs → Calendar-Drh_NJ9I.mjs} +1 -1
  160. package/lib/_shared/esm/{ContentSwitcherList-bCQz0qkU.mjs → ContentSwitcherList-DwHfU3no.mjs} +10 -3
  161. package/lib/_shared/esm/{Link-Biyg9qBH.mjs → Link-DxjGH_7f.mjs} +3 -1
  162. package/lib/_shared/esm/{Section-DDygQ5Az.mjs → Section-7InCvzfh.mjs} +2 -2
  163. package/lib/_shared/esm/{TemplateBanner-DeHjliNP.mjs → TemplateBanner-Dkgzu3A5.mjs} +2 -2
  164. package/lib/_shared/esm/{arc-breakpoints-D5hR5m3t.mjs → arc-breakpoints-D7Ie4kBt.mjs} +1 -1
  165. package/lib/_shared/esm/{index-BDWwJ5x2.mjs → index-BWkI4Dwz.mjs} +1 -1
  166. package/lib/_shared/esm/{index.es-C3WqfFKH.mjs → index.es-CtRkzfKP.mjs} +2 -2
  167. package/lib/index.cjs +300 -283
  168. package/lib/index.cjs.map +1 -1
  169. package/lib/index.d.cts +28 -3
  170. package/lib/index.d.mts +28 -3
  171. package/lib/index.js.map +1 -1
  172. package/lib/index.mjs +301 -284
  173. package/lib/index.mjs.map +1 -1
  174. package/lib/styles.css +10 -10
  175. package/package.json +8 -8
  176. package/lib/_shared/cjs/BreadcrumbsLink-CDmk3Y3m.cjs +0 -18
  177. package/lib/_shared/cjs/Checkbox-DfZMjO1Y.cjs +0 -88
  178. package/lib/_shared/cjs/ComboBox-BGUhlqx1.cjs +0 -281
  179. package/lib/_shared/cjs/ContentSwitcherTab-B387Qs3I.cjs +0 -14
  180. package/lib/_shared/cjs/DatePicker-Dt4faA_N.cjs +0 -334
  181. package/lib/_shared/cjs/HeroButton-CrzkTUwP.cjs +0 -82
  182. package/lib/_shared/cjs/MediaCard-BEZFbiYO.cjs +0 -57
  183. package/lib/_shared/cjs/MenuItemMultiLevelContent-vLr6hSBm.cjs +0 -1328
  184. package/lib/_shared/cjs/ProgressStepperOverflow-BAGZNC26.cjs +0 -142
  185. package/lib/_shared/cjs/RadioCardGroupInput-CeUM3yPS.cjs +0 -53
  186. package/lib/_shared/cjs/RadioGroupInput-w2qkfsnG.cjs +0 -54
  187. package/lib/_shared/cjs/SiteHeaderV2NavItemWithSubNav-CagFKPEa.cjs +0 -445
  188. package/lib/_shared/cjs/kebabCase-D5yA6u-V.cjs +0 -743
  189. package/lib/_shared/cjs/keynames-Cx13-hWr.cjs +0 -8
  190. package/lib/_shared/esm/BreadcrumbsLink-BxTurGNa.mjs +0 -16
  191. package/lib/_shared/esm/Checkbox-CwOHzlQF.mjs +0 -86
  192. package/lib/_shared/esm/ComboBox-CRlJjeev.mjs +0 -279
  193. package/lib/_shared/esm/ContentSwitcherTab-CfC3PGeZ.mjs +0 -12
  194. package/lib/_shared/esm/DatePicker-DT4OEzxP.mjs +0 -324
  195. package/lib/_shared/esm/HeroButton-jdjjV_Gf.mjs +0 -80
  196. package/lib/_shared/esm/MediaCard-DqMaNWsE.mjs +0 -55
  197. package/lib/_shared/esm/MenuItemMultiLevelContent-JTOHqpzg.mjs +0 -1296
  198. package/lib/_shared/esm/ProgressStepperOverflow-fPkLltVO.mjs +0 -140
  199. package/lib/_shared/esm/RadioCardGroupInput-D7W28geB.mjs +0 -50
  200. package/lib/_shared/esm/RadioGroupInput-zAWSV29m.mjs +0 -50
  201. package/lib/_shared/esm/SiteHeaderV2NavItemWithSubNav-CxGwdV6u.mjs +0 -439
  202. package/lib/_shared/esm/kebabCase-CCEMRBfd.mjs +0 -737
  203. package/lib/_shared/esm/keynames-B5whqsjh.mjs +0 -8
package/lib/Menu/Menu.cjs CHANGED
@@ -3,30 +3,1316 @@
3
3
 
4
4
  var filterAttrs = require('../_shared/cjs/filter-attrs-eK6E_34o.cjs');
5
5
  var React = require('react');
6
- var MenuItemMultiLevelContent = require('../_shared/cjs/MenuItemMultiLevelContent-vLr6hSBm.cjs');
7
- var index = require('../_shared/cjs/index-CTlXMLug.cjs');
6
+ var Combination = require('../_shared/cjs/Combination-B-rSVLfT.cjs');
7
+ var index$1 = require('../_shared/cjs/index-DXNM3D1d.cjs');
8
+ var index = require('../_shared/cjs/index-EFXw1jWg.cjs');
9
+ var index$2 = require('../_shared/cjs/index-Bt7hfZBc.cjs');
10
+ var index$3 = require('../_shared/cjs/index-Dv1xvB_E.cjs');
11
+ var jsxRuntime = require('react/jsx-runtime');
12
+ var index$4 = require('../_shared/cjs/index-CTlXMLug.cjs');
8
13
  var Icon = require('../_shared/cjs/Icon-CzhyKqMd.cjs');
9
14
  var Text = require('../_shared/cjs/Text-Cr5nmYmx.cjs');
10
15
  var Rule = require('../_shared/cjs/Rule-DMQsi2L6.cjs');
11
- var index$1 = require('../_shared/cjs/index-DXNM3D1d.cjs');
12
16
  var BtIconChevronRightMid = require('../_shared/cjs/BtIconChevronRightMid-eGxk3ae6.cjs');
13
- require('../_shared/cjs/Combination-B-rSVLfT.cjs');
14
- require('react/jsx-runtime');
15
17
  require('react-dom');
16
- require('../_shared/cjs/index-EFXw1jWg.cjs');
17
- require('../_shared/cjs/index-Bt7hfZBc.cjs');
18
18
  require('../_shared/cjs/index-B11wQrRa.cjs');
19
- require('../_shared/cjs/index-Dv1xvB_E.cjs');
20
19
  require('../_shared/cjs/suffix-modifier-DLUGR-yG.cjs');
21
20
  require('../_shared/cjs/index-DR8Rkav9.cjs');
22
21
  require('../_shared/cjs/Surface-BFx1yNsq.cjs');
23
22
 
23
+ function _interopNamespaceDefault(e) {
24
+ var n = Object.create(null);
25
+ if (e) {
26
+ Object.keys(e).forEach(function (k) {
27
+ if (k !== 'default') {
28
+ var d = Object.getOwnPropertyDescriptor(e, k);
29
+ Object.defineProperty(n, k, d.get ? d : {
30
+ enumerable: true,
31
+ get: function () { return e[k]; }
32
+ });
33
+ }
34
+ });
35
+ }
36
+ n.default = e;
37
+ return Object.freeze(n);
38
+ }
39
+
40
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
41
+
42
+ var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
43
+ var EVENT_OPTIONS = { bubbles: false, cancelable: true };
44
+ var GROUP_NAME$2 = "RovingFocusGroup";
45
+ var [Collection$1, useCollection$1, createCollectionScope$1] = index.createCollection(GROUP_NAME$2);
46
+ var [createRovingFocusGroupContext, createRovingFocusGroupScope] = index$1.createContextScope(
47
+ GROUP_NAME$2,
48
+ [createCollectionScope$1]
49
+ );
50
+ var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME$2);
51
+ var RovingFocusGroup = React__namespace.forwardRef(
52
+ (props, forwardedRef) => {
53
+ return /* @__PURE__ */ jsxRuntime.jsx(Collection$1.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsxRuntime.jsx(Collection$1.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsxRuntime.jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
54
+ }
55
+ );
56
+ RovingFocusGroup.displayName = GROUP_NAME$2;
57
+ var RovingFocusGroupImpl = React__namespace.forwardRef((props, forwardedRef) => {
58
+ const {
59
+ __scopeRovingFocusGroup,
60
+ orientation,
61
+ loop = false,
62
+ dir,
63
+ currentTabStopId: currentTabStopIdProp,
64
+ defaultCurrentTabStopId,
65
+ onCurrentTabStopIdChange,
66
+ onEntryFocus,
67
+ preventScrollOnEntryFocus = false,
68
+ ...groupProps
69
+ } = props;
70
+ const ref = React__namespace.useRef(null);
71
+ const composedRefs = Combination.useComposedRefs(forwardedRef, ref);
72
+ const direction = index.useDirection(dir);
73
+ const [currentTabStopId = null, setCurrentTabStopId] = index$1.useControllableState({
74
+ prop: currentTabStopIdProp,
75
+ defaultProp: defaultCurrentTabStopId,
76
+ onChange: onCurrentTabStopIdChange
77
+ });
78
+ const [isTabbingBackOut, setIsTabbingBackOut] = React__namespace.useState(false);
79
+ const handleEntryFocus = index$1.useCallbackRef(onEntryFocus);
80
+ const getItems = useCollection$1(__scopeRovingFocusGroup);
81
+ const isClickFocusRef = React__namespace.useRef(false);
82
+ const [focusableItemsCount, setFocusableItemsCount] = React__namespace.useState(0);
83
+ React__namespace.useEffect(() => {
84
+ const node = ref.current;
85
+ if (node) {
86
+ node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
87
+ return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
88
+ }
89
+ }, [handleEntryFocus]);
90
+ return /* @__PURE__ */ jsxRuntime.jsx(
91
+ RovingFocusProvider,
92
+ {
93
+ scope: __scopeRovingFocusGroup,
94
+ orientation,
95
+ dir: direction,
96
+ loop,
97
+ currentTabStopId,
98
+ onItemFocus: React__namespace.useCallback(
99
+ (tabStopId) => setCurrentTabStopId(tabStopId),
100
+ [setCurrentTabStopId]
101
+ ),
102
+ onItemShiftTab: React__namespace.useCallback(() => setIsTabbingBackOut(true), []),
103
+ onFocusableItemAdd: React__namespace.useCallback(
104
+ () => setFocusableItemsCount((prevCount) => prevCount + 1),
105
+ []
106
+ ),
107
+ onFocusableItemRemove: React__namespace.useCallback(
108
+ () => setFocusableItemsCount((prevCount) => prevCount - 1),
109
+ []
110
+ ),
111
+ children: /* @__PURE__ */ jsxRuntime.jsx(
112
+ Combination.Primitive.div,
113
+ {
114
+ tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
115
+ "data-orientation": orientation,
116
+ ...groupProps,
117
+ ref: composedRefs,
118
+ style: { outline: "none", ...props.style },
119
+ onMouseDown: Combination.composeEventHandlers(props.onMouseDown, () => {
120
+ isClickFocusRef.current = true;
121
+ }),
122
+ onFocus: Combination.composeEventHandlers(props.onFocus, (event) => {
123
+ const isKeyboardFocus = !isClickFocusRef.current;
124
+ if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
125
+ const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
126
+ event.currentTarget.dispatchEvent(entryFocusEvent);
127
+ if (!entryFocusEvent.defaultPrevented) {
128
+ const items = getItems().filter((item) => item.focusable);
129
+ const activeItem = items.find((item) => item.active);
130
+ const currentItem = items.find((item) => item.id === currentTabStopId);
131
+ const candidateItems = [activeItem, currentItem, ...items].filter(
132
+ Boolean
133
+ );
134
+ const candidateNodes = candidateItems.map((item) => item.ref.current);
135
+ focusFirst$1(candidateNodes, preventScrollOnEntryFocus);
136
+ }
137
+ }
138
+ isClickFocusRef.current = false;
139
+ }),
140
+ onBlur: Combination.composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
141
+ }
142
+ )
143
+ }
144
+ );
145
+ });
146
+ var ITEM_NAME$2 = "RovingFocusGroupItem";
147
+ var RovingFocusGroupItem = React__namespace.forwardRef(
148
+ (props, forwardedRef) => {
149
+ const {
150
+ __scopeRovingFocusGroup,
151
+ focusable = true,
152
+ active = false,
153
+ tabStopId,
154
+ ...itemProps
155
+ } = props;
156
+ const autoId = index$1.useId();
157
+ const id = tabStopId || autoId;
158
+ const context = useRovingFocusContext(ITEM_NAME$2, __scopeRovingFocusGroup);
159
+ const isCurrentTabStop = context.currentTabStopId === id;
160
+ const getItems = useCollection$1(__scopeRovingFocusGroup);
161
+ const { onFocusableItemAdd, onFocusableItemRemove } = context;
162
+ React__namespace.useEffect(() => {
163
+ if (focusable) {
164
+ onFocusableItemAdd();
165
+ return () => onFocusableItemRemove();
166
+ }
167
+ }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
168
+ return /* @__PURE__ */ jsxRuntime.jsx(
169
+ Collection$1.ItemSlot,
170
+ {
171
+ scope: __scopeRovingFocusGroup,
172
+ id,
173
+ focusable,
174
+ active,
175
+ children: /* @__PURE__ */ jsxRuntime.jsx(
176
+ Combination.Primitive.span,
177
+ {
178
+ tabIndex: isCurrentTabStop ? 0 : -1,
179
+ "data-orientation": context.orientation,
180
+ ...itemProps,
181
+ ref: forwardedRef,
182
+ onMouseDown: Combination.composeEventHandlers(props.onMouseDown, (event) => {
183
+ if (!focusable) event.preventDefault();
184
+ else context.onItemFocus(id);
185
+ }),
186
+ onFocus: Combination.composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
187
+ onKeyDown: Combination.composeEventHandlers(props.onKeyDown, (event) => {
188
+ if (event.key === "Tab" && event.shiftKey) {
189
+ context.onItemShiftTab();
190
+ return;
191
+ }
192
+ if (event.target !== event.currentTarget) return;
193
+ const focusIntent = getFocusIntent(event, context.orientation, context.dir);
194
+ if (focusIntent !== void 0) {
195
+ if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
196
+ event.preventDefault();
197
+ const items = getItems().filter((item) => item.focusable);
198
+ let candidateNodes = items.map((item) => item.ref.current);
199
+ if (focusIntent === "last") candidateNodes.reverse();
200
+ else if (focusIntent === "prev" || focusIntent === "next") {
201
+ if (focusIntent === "prev") candidateNodes.reverse();
202
+ const currentIndex = candidateNodes.indexOf(event.currentTarget);
203
+ candidateNodes = context.loop ? wrapArray$1(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
204
+ }
205
+ setTimeout(() => focusFirst$1(candidateNodes));
206
+ }
207
+ })
208
+ }
209
+ )
210
+ }
211
+ );
212
+ }
213
+ );
214
+ RovingFocusGroupItem.displayName = ITEM_NAME$2;
215
+ var MAP_KEY_TO_FOCUS_INTENT = {
216
+ ArrowLeft: "prev",
217
+ ArrowUp: "prev",
218
+ ArrowRight: "next",
219
+ ArrowDown: "next",
220
+ PageUp: "first",
221
+ Home: "first",
222
+ PageDown: "last",
223
+ End: "last"
224
+ };
225
+ function getDirectionAwareKey(key, dir) {
226
+ if (dir !== "rtl") return key;
227
+ return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
228
+ }
229
+ function getFocusIntent(event, orientation, dir) {
230
+ const key = getDirectionAwareKey(event.key, dir);
231
+ if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
232
+ if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
233
+ return MAP_KEY_TO_FOCUS_INTENT[key];
234
+ }
235
+ function focusFirst$1(candidates, preventScroll = false) {
236
+ const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
237
+ for (const candidate of candidates) {
238
+ if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
239
+ candidate.focus({ preventScroll });
240
+ if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
241
+ }
242
+ }
243
+ function wrapArray$1(array, startIndex) {
244
+ return array.map((_, index) => array[(startIndex + index) % array.length]);
245
+ }
246
+ var Root = RovingFocusGroup;
247
+ var Item = RovingFocusGroupItem;
248
+
249
+ var SELECTION_KEYS = ["Enter", " "];
250
+ var FIRST_KEYS = ["ArrowDown", "PageUp", "Home"];
251
+ var LAST_KEYS = ["ArrowUp", "PageDown", "End"];
252
+ var FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
253
+ var SUB_OPEN_KEYS = {
254
+ ltr: [...SELECTION_KEYS, "ArrowRight"],
255
+ rtl: [...SELECTION_KEYS, "ArrowLeft"]
256
+ };
257
+ var SUB_CLOSE_KEYS = {
258
+ ltr: ["ArrowLeft"],
259
+ rtl: ["ArrowRight"]
260
+ };
261
+ var MENU_NAME = "Menu";
262
+ var [Collection, useCollection, createCollectionScope] = index.createCollection(MENU_NAME);
263
+ var [createMenuContext, createMenuScope] = index$1.createContextScope(MENU_NAME, [
264
+ createCollectionScope,
265
+ index$2.createPopperScope,
266
+ createRovingFocusGroupScope
267
+ ]);
268
+ var usePopperScope = index$2.createPopperScope();
269
+ var useRovingFocusGroupScope = createRovingFocusGroupScope();
270
+ var [MenuProvider, useMenuContext] = createMenuContext(MENU_NAME);
271
+ var [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME);
272
+ var Menu$1 = (props) => {
273
+ const { __scopeMenu, open = false, children, dir, onOpenChange, modal = true } = props;
274
+ const popperScope = usePopperScope(__scopeMenu);
275
+ const [content, setContent] = React__namespace.useState(null);
276
+ const isUsingKeyboardRef = React__namespace.useRef(false);
277
+ const handleOpenChange = index$1.useCallbackRef(onOpenChange);
278
+ const direction = index.useDirection(dir);
279
+ React__namespace.useEffect(() => {
280
+ const handleKeyDown = () => {
281
+ isUsingKeyboardRef.current = true;
282
+ document.addEventListener("pointerdown", handlePointer, { capture: true, once: true });
283
+ document.addEventListener("pointermove", handlePointer, { capture: true, once: true });
284
+ };
285
+ const handlePointer = () => isUsingKeyboardRef.current = false;
286
+ document.addEventListener("keydown", handleKeyDown, { capture: true });
287
+ return () => {
288
+ document.removeEventListener("keydown", handleKeyDown, { capture: true });
289
+ document.removeEventListener("pointerdown", handlePointer, { capture: true });
290
+ document.removeEventListener("pointermove", handlePointer, { capture: true });
291
+ };
292
+ }, []);
293
+ return /* @__PURE__ */ jsxRuntime.jsx(index$2.Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
294
+ MenuProvider,
295
+ {
296
+ scope: __scopeMenu,
297
+ open,
298
+ onOpenChange: handleOpenChange,
299
+ content,
300
+ onContentChange: setContent,
301
+ children: /* @__PURE__ */ jsxRuntime.jsx(
302
+ MenuRootProvider,
303
+ {
304
+ scope: __scopeMenu,
305
+ onClose: React__namespace.useCallback(() => handleOpenChange(false), [handleOpenChange]),
306
+ isUsingKeyboardRef,
307
+ dir: direction,
308
+ modal,
309
+ children
310
+ }
311
+ )
312
+ }
313
+ ) });
314
+ };
315
+ Menu$1.displayName = MENU_NAME;
316
+ var ANCHOR_NAME = "MenuAnchor";
317
+ var MenuAnchor = React__namespace.forwardRef(
318
+ (props, forwardedRef) => {
319
+ const { __scopeMenu, ...anchorProps } = props;
320
+ const popperScope = usePopperScope(__scopeMenu);
321
+ return /* @__PURE__ */ jsxRuntime.jsx(index$2.Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
322
+ }
323
+ );
324
+ MenuAnchor.displayName = ANCHOR_NAME;
325
+ var PORTAL_NAME$1 = "MenuPortal";
326
+ var [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME$1, {
327
+ forceMount: void 0
328
+ });
329
+ var MenuPortal$1 = (props) => {
330
+ const { __scopeMenu, forceMount, children, container } = props;
331
+ const context = useMenuContext(PORTAL_NAME$1, __scopeMenu);
332
+ return /* @__PURE__ */ jsxRuntime.jsx(PortalProvider, { scope: __scopeMenu, forceMount, children: /* @__PURE__ */ jsxRuntime.jsx(index$3.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(Combination.Portal, { asChild: true, container, children }) }) });
333
+ };
334
+ MenuPortal$1.displayName = PORTAL_NAME$1;
335
+ var CONTENT_NAME$1 = "MenuContent";
336
+ var [MenuContentProvider, useMenuContentContext] = createMenuContext(CONTENT_NAME$1);
337
+ var MenuContent$1 = React__namespace.forwardRef(
338
+ (props, forwardedRef) => {
339
+ const portalContext = usePortalContext(CONTENT_NAME$1, props.__scopeMenu);
340
+ const { forceMount = portalContext.forceMount, ...contentProps } = props;
341
+ const context = useMenuContext(CONTENT_NAME$1, props.__scopeMenu);
342
+ const rootContext = useMenuRootContext(CONTENT_NAME$1, props.__scopeMenu);
343
+ return /* @__PURE__ */ jsxRuntime.jsx(Collection.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsxRuntime.jsx(index$3.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(Collection.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ jsxRuntime.jsx(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntime.jsx(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) });
344
+ }
345
+ );
346
+ var MenuRootContentModal = React__namespace.forwardRef(
347
+ (props, forwardedRef) => {
348
+ const context = useMenuContext(CONTENT_NAME$1, props.__scopeMenu);
349
+ const ref = React__namespace.useRef(null);
350
+ const composedRefs = Combination.useComposedRefs(forwardedRef, ref);
351
+ React__namespace.useEffect(() => {
352
+ const content = ref.current;
353
+ if (content) return Combination.hideOthers(content);
354
+ }, []);
355
+ return /* @__PURE__ */ jsxRuntime.jsx(
356
+ MenuContentImpl,
357
+ {
358
+ ...props,
359
+ ref: composedRefs,
360
+ trapFocus: context.open,
361
+ disableOutsidePointerEvents: context.open,
362
+ disableOutsideScroll: true,
363
+ onFocusOutside: Combination.composeEventHandlers(
364
+ props.onFocusOutside,
365
+ (event) => event.preventDefault(),
366
+ { checkForDefaultPrevented: false }
367
+ ),
368
+ onDismiss: () => context.onOpenChange(false)
369
+ }
370
+ );
371
+ }
372
+ );
373
+ var MenuRootContentNonModal = React__namespace.forwardRef((props, forwardedRef) => {
374
+ const context = useMenuContext(CONTENT_NAME$1, props.__scopeMenu);
375
+ return /* @__PURE__ */ jsxRuntime.jsx(
376
+ MenuContentImpl,
377
+ {
378
+ ...props,
379
+ ref: forwardedRef,
380
+ trapFocus: false,
381
+ disableOutsidePointerEvents: false,
382
+ disableOutsideScroll: false,
383
+ onDismiss: () => context.onOpenChange(false)
384
+ }
385
+ );
386
+ });
387
+ var MenuContentImpl = React__namespace.forwardRef(
388
+ (props, forwardedRef) => {
389
+ const {
390
+ __scopeMenu,
391
+ loop = false,
392
+ trapFocus,
393
+ onOpenAutoFocus,
394
+ onCloseAutoFocus,
395
+ disableOutsidePointerEvents,
396
+ onEntryFocus,
397
+ onEscapeKeyDown,
398
+ onPointerDownOutside,
399
+ onFocusOutside,
400
+ onInteractOutside,
401
+ onDismiss,
402
+ disableOutsideScroll,
403
+ ...contentProps
404
+ } = props;
405
+ const context = useMenuContext(CONTENT_NAME$1, __scopeMenu);
406
+ const rootContext = useMenuRootContext(CONTENT_NAME$1, __scopeMenu);
407
+ const popperScope = usePopperScope(__scopeMenu);
408
+ const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);
409
+ const getItems = useCollection(__scopeMenu);
410
+ const [currentItemId, setCurrentItemId] = React__namespace.useState(null);
411
+ const contentRef = React__namespace.useRef(null);
412
+ const composedRefs = Combination.useComposedRefs(forwardedRef, contentRef, context.onContentChange);
413
+ const timerRef = React__namespace.useRef(0);
414
+ const searchRef = React__namespace.useRef("");
415
+ const pointerGraceTimerRef = React__namespace.useRef(0);
416
+ const pointerGraceIntentRef = React__namespace.useRef(null);
417
+ const pointerDirRef = React__namespace.useRef("right");
418
+ const lastPointerXRef = React__namespace.useRef(0);
419
+ const ScrollLockWrapper = disableOutsideScroll ? Combination.ReactRemoveScroll : React__namespace.Fragment;
420
+ const scrollLockWrapperProps = disableOutsideScroll ? { as: Combination.Slot, allowPinchZoom: true } : void 0;
421
+ const handleTypeaheadSearch = (key) => {
422
+ const search = searchRef.current + key;
423
+ const items = getItems().filter((item) => !item.disabled);
424
+ const currentItem = document.activeElement;
425
+ const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue;
426
+ const values = items.map((item) => item.textValue);
427
+ const nextMatch = getNextMatch(values, search, currentMatch);
428
+ const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;
429
+ (function updateSearch(value) {
430
+ searchRef.current = value;
431
+ window.clearTimeout(timerRef.current);
432
+ if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3);
433
+ })(search);
434
+ if (newItem) {
435
+ setTimeout(() => newItem.focus());
436
+ }
437
+ };
438
+ React__namespace.useEffect(() => {
439
+ return () => window.clearTimeout(timerRef.current);
440
+ }, []);
441
+ Combination.useFocusGuards();
442
+ const isPointerMovingToSubmenu = React__namespace.useCallback((event) => {
443
+ const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;
444
+ return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);
445
+ }, []);
446
+ return /* @__PURE__ */ jsxRuntime.jsx(
447
+ MenuContentProvider,
448
+ {
449
+ scope: __scopeMenu,
450
+ searchRef,
451
+ onItemEnter: React__namespace.useCallback(
452
+ (event) => {
453
+ if (isPointerMovingToSubmenu(event)) event.preventDefault();
454
+ },
455
+ [isPointerMovingToSubmenu]
456
+ ),
457
+ onItemLeave: React__namespace.useCallback(
458
+ (event) => {
459
+ if (isPointerMovingToSubmenu(event)) return;
460
+ contentRef.current?.focus();
461
+ setCurrentItemId(null);
462
+ },
463
+ [isPointerMovingToSubmenu]
464
+ ),
465
+ onTriggerLeave: React__namespace.useCallback(
466
+ (event) => {
467
+ if (isPointerMovingToSubmenu(event)) event.preventDefault();
468
+ },
469
+ [isPointerMovingToSubmenu]
470
+ ),
471
+ pointerGraceTimerRef,
472
+ onPointerGraceIntentChange: React__namespace.useCallback((intent) => {
473
+ pointerGraceIntentRef.current = intent;
474
+ }, []),
475
+ children: /* @__PURE__ */ jsxRuntime.jsx(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ jsxRuntime.jsx(
476
+ Combination.FocusScope,
477
+ {
478
+ asChild: true,
479
+ trapped: trapFocus,
480
+ onMountAutoFocus: Combination.composeEventHandlers(onOpenAutoFocus, (event) => {
481
+ event.preventDefault();
482
+ contentRef.current?.focus({ preventScroll: true });
483
+ }),
484
+ onUnmountAutoFocus: onCloseAutoFocus,
485
+ children: /* @__PURE__ */ jsxRuntime.jsx(
486
+ Combination.DismissableLayer,
487
+ {
488
+ asChild: true,
489
+ disableOutsidePointerEvents,
490
+ onEscapeKeyDown,
491
+ onPointerDownOutside,
492
+ onFocusOutside,
493
+ onInteractOutside,
494
+ onDismiss,
495
+ children: /* @__PURE__ */ jsxRuntime.jsx(
496
+ Root,
497
+ {
498
+ asChild: true,
499
+ ...rovingFocusGroupScope,
500
+ dir: rootContext.dir,
501
+ orientation: "vertical",
502
+ loop,
503
+ currentTabStopId: currentItemId,
504
+ onCurrentTabStopIdChange: setCurrentItemId,
505
+ onEntryFocus: Combination.composeEventHandlers(onEntryFocus, (event) => {
506
+ if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();
507
+ }),
508
+ preventScrollOnEntryFocus: true,
509
+ children: /* @__PURE__ */ jsxRuntime.jsx(
510
+ index$2.Content,
511
+ {
512
+ role: "menu",
513
+ "aria-orientation": "vertical",
514
+ "data-state": getOpenState(context.open),
515
+ "data-radix-menu-content": "",
516
+ dir: rootContext.dir,
517
+ ...popperScope,
518
+ ...contentProps,
519
+ ref: composedRefs,
520
+ style: { outline: "none", ...contentProps.style },
521
+ onKeyDown: Combination.composeEventHandlers(contentProps.onKeyDown, (event) => {
522
+ const target = event.target;
523
+ const isKeyDownInside = target.closest("[data-radix-menu-content]") === event.currentTarget;
524
+ const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
525
+ const isCharacterKey = event.key.length === 1;
526
+ if (isKeyDownInside) {
527
+ if (event.key === "Tab") event.preventDefault();
528
+ if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);
529
+ }
530
+ const content = contentRef.current;
531
+ if (event.target !== content) return;
532
+ if (!FIRST_LAST_KEYS.includes(event.key)) return;
533
+ event.preventDefault();
534
+ const items = getItems().filter((item) => !item.disabled);
535
+ const candidateNodes = items.map((item) => item.ref.current);
536
+ if (LAST_KEYS.includes(event.key)) candidateNodes.reverse();
537
+ focusFirst(candidateNodes);
538
+ }),
539
+ onBlur: Combination.composeEventHandlers(props.onBlur, (event) => {
540
+ if (!event.currentTarget.contains(event.target)) {
541
+ window.clearTimeout(timerRef.current);
542
+ searchRef.current = "";
543
+ }
544
+ }),
545
+ onPointerMove: Combination.composeEventHandlers(
546
+ props.onPointerMove,
547
+ whenMouse((event) => {
548
+ const target = event.target;
549
+ const pointerXHasChanged = lastPointerXRef.current !== event.clientX;
550
+ if (event.currentTarget.contains(target) && pointerXHasChanged) {
551
+ const newDir = event.clientX > lastPointerXRef.current ? "right" : "left";
552
+ pointerDirRef.current = newDir;
553
+ lastPointerXRef.current = event.clientX;
554
+ }
555
+ })
556
+ )
557
+ }
558
+ )
559
+ }
560
+ )
561
+ }
562
+ )
563
+ }
564
+ ) })
565
+ }
566
+ );
567
+ }
568
+ );
569
+ MenuContent$1.displayName = CONTENT_NAME$1;
570
+ var GROUP_NAME$1 = "MenuGroup";
571
+ var MenuGroup$1 = React__namespace.forwardRef(
572
+ (props, forwardedRef) => {
573
+ const { __scopeMenu, ...groupProps } = props;
574
+ return /* @__PURE__ */ jsxRuntime.jsx(Combination.Primitive.div, { role: "group", ...groupProps, ref: forwardedRef });
575
+ }
576
+ );
577
+ MenuGroup$1.displayName = GROUP_NAME$1;
578
+ var LABEL_NAME$1 = "MenuLabel";
579
+ var MenuLabel$1 = React__namespace.forwardRef(
580
+ (props, forwardedRef) => {
581
+ const { __scopeMenu, ...labelProps } = props;
582
+ return /* @__PURE__ */ jsxRuntime.jsx(Combination.Primitive.div, { ...labelProps, ref: forwardedRef });
583
+ }
584
+ );
585
+ MenuLabel$1.displayName = LABEL_NAME$1;
586
+ var ITEM_NAME$1 = "MenuItem";
587
+ var ITEM_SELECT = "menu.itemSelect";
588
+ var MenuItem$1 = React__namespace.forwardRef(
589
+ (props, forwardedRef) => {
590
+ const { disabled = false, onSelect, ...itemProps } = props;
591
+ const ref = React__namespace.useRef(null);
592
+ const rootContext = useMenuRootContext(ITEM_NAME$1, props.__scopeMenu);
593
+ const contentContext = useMenuContentContext(ITEM_NAME$1, props.__scopeMenu);
594
+ const composedRefs = Combination.useComposedRefs(forwardedRef, ref);
595
+ const isPointerDownRef = React__namespace.useRef(false);
596
+ const handleSelect = () => {
597
+ const menuItem = ref.current;
598
+ if (!disabled && menuItem) {
599
+ const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true });
600
+ menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true });
601
+ Combination.dispatchDiscreteCustomEvent(menuItem, itemSelectEvent);
602
+ if (itemSelectEvent.defaultPrevented) {
603
+ isPointerDownRef.current = false;
604
+ } else {
605
+ rootContext.onClose();
606
+ }
607
+ }
608
+ };
609
+ return /* @__PURE__ */ jsxRuntime.jsx(
610
+ MenuItemImpl,
611
+ {
612
+ ...itemProps,
613
+ ref: composedRefs,
614
+ disabled,
615
+ onClick: Combination.composeEventHandlers(props.onClick, handleSelect),
616
+ onPointerDown: (event) => {
617
+ props.onPointerDown?.(event);
618
+ isPointerDownRef.current = true;
619
+ },
620
+ onPointerUp: Combination.composeEventHandlers(props.onPointerUp, (event) => {
621
+ if (!isPointerDownRef.current) event.currentTarget?.click();
622
+ }),
623
+ onKeyDown: Combination.composeEventHandlers(props.onKeyDown, (event) => {
624
+ const isTypingAhead = contentContext.searchRef.current !== "";
625
+ if (disabled || isTypingAhead && event.key === " ") return;
626
+ if (SELECTION_KEYS.includes(event.key)) {
627
+ event.currentTarget.click();
628
+ event.preventDefault();
629
+ }
630
+ })
631
+ }
632
+ );
633
+ }
634
+ );
635
+ MenuItem$1.displayName = ITEM_NAME$1;
636
+ var MenuItemImpl = React__namespace.forwardRef(
637
+ (props, forwardedRef) => {
638
+ const { __scopeMenu, disabled = false, textValue, ...itemProps } = props;
639
+ const contentContext = useMenuContentContext(ITEM_NAME$1, __scopeMenu);
640
+ const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);
641
+ const ref = React__namespace.useRef(null);
642
+ const composedRefs = Combination.useComposedRefs(forwardedRef, ref);
643
+ const [isFocused, setIsFocused] = React__namespace.useState(false);
644
+ const [textContent, setTextContent] = React__namespace.useState("");
645
+ React__namespace.useEffect(() => {
646
+ const menuItem = ref.current;
647
+ if (menuItem) {
648
+ setTextContent((menuItem.textContent ?? "").trim());
649
+ }
650
+ }, [itemProps.children]);
651
+ return /* @__PURE__ */ jsxRuntime.jsx(
652
+ Collection.ItemSlot,
653
+ {
654
+ scope: __scopeMenu,
655
+ disabled,
656
+ textValue: textValue ?? textContent,
657
+ children: /* @__PURE__ */ jsxRuntime.jsx(Item, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsxRuntime.jsx(
658
+ Combination.Primitive.div,
659
+ {
660
+ role: "menuitem",
661
+ "data-highlighted": isFocused ? "" : void 0,
662
+ "aria-disabled": disabled || void 0,
663
+ "data-disabled": disabled ? "" : void 0,
664
+ ...itemProps,
665
+ ref: composedRefs,
666
+ onPointerMove: Combination.composeEventHandlers(
667
+ props.onPointerMove,
668
+ whenMouse((event) => {
669
+ if (disabled) {
670
+ contentContext.onItemLeave(event);
671
+ } else {
672
+ contentContext.onItemEnter(event);
673
+ if (!event.defaultPrevented) {
674
+ const item = event.currentTarget;
675
+ item.focus({ preventScroll: true });
676
+ }
677
+ }
678
+ })
679
+ ),
680
+ onPointerLeave: Combination.composeEventHandlers(
681
+ props.onPointerLeave,
682
+ whenMouse((event) => contentContext.onItemLeave(event))
683
+ ),
684
+ onFocus: Combination.composeEventHandlers(props.onFocus, () => setIsFocused(true)),
685
+ onBlur: Combination.composeEventHandlers(props.onBlur, () => setIsFocused(false))
686
+ }
687
+ ) })
688
+ }
689
+ );
690
+ }
691
+ );
692
+ var CHECKBOX_ITEM_NAME$1 = "MenuCheckboxItem";
693
+ var MenuCheckboxItem = React__namespace.forwardRef(
694
+ (props, forwardedRef) => {
695
+ const { checked = false, onCheckedChange, ...checkboxItemProps } = props;
696
+ return /* @__PURE__ */ jsxRuntime.jsx(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsxRuntime.jsx(
697
+ MenuItem$1,
698
+ {
699
+ role: "menuitemcheckbox",
700
+ "aria-checked": isIndeterminate(checked) ? "mixed" : checked,
701
+ ...checkboxItemProps,
702
+ ref: forwardedRef,
703
+ "data-state": getCheckedState(checked),
704
+ onSelect: Combination.composeEventHandlers(
705
+ checkboxItemProps.onSelect,
706
+ () => onCheckedChange?.(isIndeterminate(checked) ? true : !checked),
707
+ { checkForDefaultPrevented: false }
708
+ )
709
+ }
710
+ ) });
711
+ }
712
+ );
713
+ MenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME$1;
714
+ var RADIO_GROUP_NAME$1 = "MenuRadioGroup";
715
+ var [RadioGroupProvider, useRadioGroupContext] = createMenuContext(
716
+ RADIO_GROUP_NAME$1,
717
+ { value: void 0, onValueChange: () => {
718
+ } }
719
+ );
720
+ var MenuRadioGroup = React__namespace.forwardRef(
721
+ (props, forwardedRef) => {
722
+ const { value, onValueChange, ...groupProps } = props;
723
+ const handleValueChange = index$1.useCallbackRef(onValueChange);
724
+ return /* @__PURE__ */ jsxRuntime.jsx(RadioGroupProvider, { scope: props.__scopeMenu, value, onValueChange: handleValueChange, children: /* @__PURE__ */ jsxRuntime.jsx(MenuGroup$1, { ...groupProps, ref: forwardedRef }) });
725
+ }
726
+ );
727
+ MenuRadioGroup.displayName = RADIO_GROUP_NAME$1;
728
+ var RADIO_ITEM_NAME$1 = "MenuRadioItem";
729
+ var MenuRadioItem = React__namespace.forwardRef(
730
+ (props, forwardedRef) => {
731
+ const { value, ...radioItemProps } = props;
732
+ const context = useRadioGroupContext(RADIO_ITEM_NAME$1, props.__scopeMenu);
733
+ const checked = value === context.value;
734
+ return /* @__PURE__ */ jsxRuntime.jsx(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsxRuntime.jsx(
735
+ MenuItem$1,
736
+ {
737
+ role: "menuitemradio",
738
+ "aria-checked": checked,
739
+ ...radioItemProps,
740
+ ref: forwardedRef,
741
+ "data-state": getCheckedState(checked),
742
+ onSelect: Combination.composeEventHandlers(
743
+ radioItemProps.onSelect,
744
+ () => context.onValueChange?.(value),
745
+ { checkForDefaultPrevented: false }
746
+ )
747
+ }
748
+ ) });
749
+ }
750
+ );
751
+ MenuRadioItem.displayName = RADIO_ITEM_NAME$1;
752
+ var ITEM_INDICATOR_NAME = "MenuItemIndicator";
753
+ var [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext(
754
+ ITEM_INDICATOR_NAME,
755
+ { checked: false }
756
+ );
757
+ var MenuItemIndicator = React__namespace.forwardRef(
758
+ (props, forwardedRef) => {
759
+ const { __scopeMenu, forceMount, ...itemIndicatorProps } = props;
760
+ const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu);
761
+ return /* @__PURE__ */ jsxRuntime.jsx(
762
+ index$3.Presence,
763
+ {
764
+ present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true,
765
+ children: /* @__PURE__ */ jsxRuntime.jsx(
766
+ Combination.Primitive.span,
767
+ {
768
+ ...itemIndicatorProps,
769
+ ref: forwardedRef,
770
+ "data-state": getCheckedState(indicatorContext.checked)
771
+ }
772
+ )
773
+ }
774
+ );
775
+ }
776
+ );
777
+ MenuItemIndicator.displayName = ITEM_INDICATOR_NAME;
778
+ var SEPARATOR_NAME$1 = "MenuSeparator";
779
+ var MenuSeparator$1 = React__namespace.forwardRef(
780
+ (props, forwardedRef) => {
781
+ const { __scopeMenu, ...separatorProps } = props;
782
+ return /* @__PURE__ */ jsxRuntime.jsx(
783
+ Combination.Primitive.div,
784
+ {
785
+ role: "separator",
786
+ "aria-orientation": "horizontal",
787
+ ...separatorProps,
788
+ ref: forwardedRef
789
+ }
790
+ );
791
+ }
792
+ );
793
+ MenuSeparator$1.displayName = SEPARATOR_NAME$1;
794
+ var ARROW_NAME$1 = "MenuArrow";
795
+ var MenuArrow = React__namespace.forwardRef(
796
+ (props, forwardedRef) => {
797
+ const { __scopeMenu, ...arrowProps } = props;
798
+ const popperScope = usePopperScope(__scopeMenu);
799
+ return /* @__PURE__ */ jsxRuntime.jsx(index$2.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
800
+ }
801
+ );
802
+ MenuArrow.displayName = ARROW_NAME$1;
803
+ var SUB_NAME = "MenuSub";
804
+ var [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME);
805
+ var MenuSub = (props) => {
806
+ const { __scopeMenu, children, open = false, onOpenChange } = props;
807
+ const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);
808
+ const popperScope = usePopperScope(__scopeMenu);
809
+ const [trigger, setTrigger] = React__namespace.useState(null);
810
+ const [content, setContent] = React__namespace.useState(null);
811
+ const handleOpenChange = index$1.useCallbackRef(onOpenChange);
812
+ React__namespace.useEffect(() => {
813
+ if (parentMenuContext.open === false) handleOpenChange(false);
814
+ return () => handleOpenChange(false);
815
+ }, [parentMenuContext.open, handleOpenChange]);
816
+ return /* @__PURE__ */ jsxRuntime.jsx(index$2.Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
817
+ MenuProvider,
818
+ {
819
+ scope: __scopeMenu,
820
+ open,
821
+ onOpenChange: handleOpenChange,
822
+ content,
823
+ onContentChange: setContent,
824
+ children: /* @__PURE__ */ jsxRuntime.jsx(
825
+ MenuSubProvider,
826
+ {
827
+ scope: __scopeMenu,
828
+ contentId: index$1.useId(),
829
+ triggerId: index$1.useId(),
830
+ trigger,
831
+ onTriggerChange: setTrigger,
832
+ children
833
+ }
834
+ )
835
+ }
836
+ ) });
837
+ };
838
+ MenuSub.displayName = SUB_NAME;
839
+ var SUB_TRIGGER_NAME$1 = "MenuSubTrigger";
840
+ var MenuSubTrigger = React__namespace.forwardRef(
841
+ (props, forwardedRef) => {
842
+ const context = useMenuContext(SUB_TRIGGER_NAME$1, props.__scopeMenu);
843
+ const rootContext = useMenuRootContext(SUB_TRIGGER_NAME$1, props.__scopeMenu);
844
+ const subContext = useMenuSubContext(SUB_TRIGGER_NAME$1, props.__scopeMenu);
845
+ const contentContext = useMenuContentContext(SUB_TRIGGER_NAME$1, props.__scopeMenu);
846
+ const openTimerRef = React__namespace.useRef(null);
847
+ const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext;
848
+ const scope = { __scopeMenu: props.__scopeMenu };
849
+ const clearOpenTimer = React__namespace.useCallback(() => {
850
+ if (openTimerRef.current) window.clearTimeout(openTimerRef.current);
851
+ openTimerRef.current = null;
852
+ }, []);
853
+ React__namespace.useEffect(() => clearOpenTimer, [clearOpenTimer]);
854
+ React__namespace.useEffect(() => {
855
+ const pointerGraceTimer = pointerGraceTimerRef.current;
856
+ return () => {
857
+ window.clearTimeout(pointerGraceTimer);
858
+ onPointerGraceIntentChange(null);
859
+ };
860
+ }, [pointerGraceTimerRef, onPointerGraceIntentChange]);
861
+ return /* @__PURE__ */ jsxRuntime.jsx(MenuAnchor, { asChild: true, ...scope, children: /* @__PURE__ */ jsxRuntime.jsx(
862
+ MenuItemImpl,
863
+ {
864
+ id: subContext.triggerId,
865
+ "aria-haspopup": "menu",
866
+ "aria-expanded": context.open,
867
+ "aria-controls": subContext.contentId,
868
+ "data-state": getOpenState(context.open),
869
+ ...props,
870
+ ref: Combination.composeRefs(forwardedRef, subContext.onTriggerChange),
871
+ onClick: (event) => {
872
+ props.onClick?.(event);
873
+ if (props.disabled || event.defaultPrevented) return;
874
+ event.currentTarget.focus();
875
+ if (!context.open) context.onOpenChange(true);
876
+ },
877
+ onPointerMove: Combination.composeEventHandlers(
878
+ props.onPointerMove,
879
+ whenMouse((event) => {
880
+ contentContext.onItemEnter(event);
881
+ if (event.defaultPrevented) return;
882
+ if (!props.disabled && !context.open && !openTimerRef.current) {
883
+ contentContext.onPointerGraceIntentChange(null);
884
+ openTimerRef.current = window.setTimeout(() => {
885
+ context.onOpenChange(true);
886
+ clearOpenTimer();
887
+ }, 100);
888
+ }
889
+ })
890
+ ),
891
+ onPointerLeave: Combination.composeEventHandlers(
892
+ props.onPointerLeave,
893
+ whenMouse((event) => {
894
+ clearOpenTimer();
895
+ const contentRect = context.content?.getBoundingClientRect();
896
+ if (contentRect) {
897
+ const side = context.content?.dataset.side;
898
+ const rightSide = side === "right";
899
+ const bleed = rightSide ? -5 : 5;
900
+ const contentNearEdge = contentRect[rightSide ? "left" : "right"];
901
+ const contentFarEdge = contentRect[rightSide ? "right" : "left"];
902
+ contentContext.onPointerGraceIntentChange({
903
+ area: [
904
+ // Apply a bleed on clientX to ensure that our exit point is
905
+ // consistently within polygon bounds
906
+ { x: event.clientX + bleed, y: event.clientY },
907
+ { x: contentNearEdge, y: contentRect.top },
908
+ { x: contentFarEdge, y: contentRect.top },
909
+ { x: contentFarEdge, y: contentRect.bottom },
910
+ { x: contentNearEdge, y: contentRect.bottom }
911
+ ],
912
+ side
913
+ });
914
+ window.clearTimeout(pointerGraceTimerRef.current);
915
+ pointerGraceTimerRef.current = window.setTimeout(
916
+ () => contentContext.onPointerGraceIntentChange(null),
917
+ 300
918
+ );
919
+ } else {
920
+ contentContext.onTriggerLeave(event);
921
+ if (event.defaultPrevented) return;
922
+ contentContext.onPointerGraceIntentChange(null);
923
+ }
924
+ })
925
+ ),
926
+ onKeyDown: Combination.composeEventHandlers(props.onKeyDown, (event) => {
927
+ const isTypingAhead = contentContext.searchRef.current !== "";
928
+ if (props.disabled || isTypingAhead && event.key === " ") return;
929
+ if (SUB_OPEN_KEYS[rootContext.dir].includes(event.key)) {
930
+ context.onOpenChange(true);
931
+ context.content?.focus();
932
+ event.preventDefault();
933
+ }
934
+ })
935
+ }
936
+ ) });
937
+ }
938
+ );
939
+ MenuSubTrigger.displayName = SUB_TRIGGER_NAME$1;
940
+ var SUB_CONTENT_NAME$1 = "MenuSubContent";
941
+ var MenuSubContent = React__namespace.forwardRef(
942
+ (props, forwardedRef) => {
943
+ const portalContext = usePortalContext(CONTENT_NAME$1, props.__scopeMenu);
944
+ const { forceMount = portalContext.forceMount, ...subContentProps } = props;
945
+ const context = useMenuContext(CONTENT_NAME$1, props.__scopeMenu);
946
+ const rootContext = useMenuRootContext(CONTENT_NAME$1, props.__scopeMenu);
947
+ const subContext = useMenuSubContext(SUB_CONTENT_NAME$1, props.__scopeMenu);
948
+ const ref = React__namespace.useRef(null);
949
+ const composedRefs = Combination.useComposedRefs(forwardedRef, ref);
950
+ return /* @__PURE__ */ jsxRuntime.jsx(Collection.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsxRuntime.jsx(index$3.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(Collection.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsxRuntime.jsx(
951
+ MenuContentImpl,
952
+ {
953
+ id: subContext.contentId,
954
+ "aria-labelledby": subContext.triggerId,
955
+ ...subContentProps,
956
+ ref: composedRefs,
957
+ align: "start",
958
+ side: rootContext.dir === "rtl" ? "left" : "right",
959
+ disableOutsidePointerEvents: false,
960
+ disableOutsideScroll: false,
961
+ trapFocus: false,
962
+ onOpenAutoFocus: (event) => {
963
+ if (rootContext.isUsingKeyboardRef.current) ref.current?.focus();
964
+ event.preventDefault();
965
+ },
966
+ onCloseAutoFocus: (event) => event.preventDefault(),
967
+ onFocusOutside: Combination.composeEventHandlers(props.onFocusOutside, (event) => {
968
+ if (event.target !== subContext.trigger) context.onOpenChange(false);
969
+ }),
970
+ onEscapeKeyDown: Combination.composeEventHandlers(props.onEscapeKeyDown, (event) => {
971
+ rootContext.onClose();
972
+ event.preventDefault();
973
+ }),
974
+ onKeyDown: Combination.composeEventHandlers(props.onKeyDown, (event) => {
975
+ const isKeyDownInside = event.currentTarget.contains(event.target);
976
+ const isCloseKey = SUB_CLOSE_KEYS[rootContext.dir].includes(event.key);
977
+ if (isKeyDownInside && isCloseKey) {
978
+ context.onOpenChange(false);
979
+ subContext.trigger?.focus();
980
+ event.preventDefault();
981
+ }
982
+ })
983
+ }
984
+ ) }) }) });
985
+ }
986
+ );
987
+ MenuSubContent.displayName = SUB_CONTENT_NAME$1;
988
+ function getOpenState(open) {
989
+ return open ? "open" : "closed";
990
+ }
991
+ function isIndeterminate(checked) {
992
+ return checked === "indeterminate";
993
+ }
994
+ function getCheckedState(checked) {
995
+ return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
996
+ }
997
+ function focusFirst(candidates) {
998
+ const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
999
+ for (const candidate of candidates) {
1000
+ if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
1001
+ candidate.focus();
1002
+ if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
1003
+ }
1004
+ }
1005
+ function wrapArray(array, startIndex) {
1006
+ return array.map((_, index) => array[(startIndex + index) % array.length]);
1007
+ }
1008
+ function getNextMatch(values, search, currentMatch) {
1009
+ const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
1010
+ const normalizedSearch = isRepeated ? search[0] : search;
1011
+ const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;
1012
+ let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0));
1013
+ const excludeCurrentMatch = normalizedSearch.length === 1;
1014
+ if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch);
1015
+ const nextMatch = wrappedValues.find(
1016
+ (value) => value.toLowerCase().startsWith(normalizedSearch.toLowerCase())
1017
+ );
1018
+ return nextMatch !== currentMatch ? nextMatch : void 0;
1019
+ }
1020
+ function isPointInPolygon(point, polygon) {
1021
+ const { x, y } = point;
1022
+ let inside = false;
1023
+ for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
1024
+ const xi = polygon[i].x;
1025
+ const yi = polygon[i].y;
1026
+ const xj = polygon[j].x;
1027
+ const yj = polygon[j].y;
1028
+ const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
1029
+ if (intersect) inside = !inside;
1030
+ }
1031
+ return inside;
1032
+ }
1033
+ function isPointerInGraceArea(event, area) {
1034
+ if (!area) return false;
1035
+ const cursorPos = { x: event.clientX, y: event.clientY };
1036
+ return isPointInPolygon(cursorPos, area);
1037
+ }
1038
+ function whenMouse(handler) {
1039
+ return (event) => event.pointerType === "mouse" ? handler(event) : void 0;
1040
+ }
1041
+ var Root3 = Menu$1;
1042
+ var Anchor2 = MenuAnchor;
1043
+ var Portal = MenuPortal$1;
1044
+ var Content2$1 = MenuContent$1;
1045
+ var Group = MenuGroup$1;
1046
+ var Label = MenuLabel$1;
1047
+ var Item2$1 = MenuItem$1;
1048
+ var CheckboxItem = MenuCheckboxItem;
1049
+ var RadioGroup = MenuRadioGroup;
1050
+ var RadioItem = MenuRadioItem;
1051
+ var ItemIndicator = MenuItemIndicator;
1052
+ var Separator = MenuSeparator$1;
1053
+ var Arrow2 = MenuArrow;
1054
+ var Sub = MenuSub;
1055
+ var SubTrigger = MenuSubTrigger;
1056
+ var SubContent = MenuSubContent;
1057
+
1058
+ var DROPDOWN_MENU_NAME = "DropdownMenu";
1059
+ var [createDropdownMenuContext, createDropdownMenuScope] = index$1.createContextScope(
1060
+ DROPDOWN_MENU_NAME,
1061
+ [createMenuScope]
1062
+ );
1063
+ var useMenuScope = createMenuScope();
1064
+ var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
1065
+ var DropdownMenu = (props) => {
1066
+ const {
1067
+ __scopeDropdownMenu,
1068
+ children,
1069
+ dir,
1070
+ open: openProp,
1071
+ defaultOpen,
1072
+ onOpenChange,
1073
+ modal = true
1074
+ } = props;
1075
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1076
+ const triggerRef = React__namespace.useRef(null);
1077
+ const [open = false, setOpen] = index$1.useControllableState({
1078
+ prop: openProp,
1079
+ defaultProp: defaultOpen,
1080
+ onChange: onOpenChange
1081
+ });
1082
+ return /* @__PURE__ */ jsxRuntime.jsx(
1083
+ DropdownMenuProvider,
1084
+ {
1085
+ scope: __scopeDropdownMenu,
1086
+ triggerId: index$1.useId(),
1087
+ triggerRef,
1088
+ contentId: index$1.useId(),
1089
+ open,
1090
+ onOpenChange: setOpen,
1091
+ onOpenToggle: React__namespace.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
1092
+ modal,
1093
+ children: /* @__PURE__ */ jsxRuntime.jsx(Root3, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children })
1094
+ }
1095
+ );
1096
+ };
1097
+ DropdownMenu.displayName = DROPDOWN_MENU_NAME;
1098
+ var TRIGGER_NAME = "DropdownMenuTrigger";
1099
+ var DropdownMenuTrigger = React__namespace.forwardRef(
1100
+ (props, forwardedRef) => {
1101
+ const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
1102
+ const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
1103
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1104
+ return /* @__PURE__ */ jsxRuntime.jsx(Anchor2, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsxRuntime.jsx(
1105
+ Combination.Primitive.button,
1106
+ {
1107
+ type: "button",
1108
+ id: context.triggerId,
1109
+ "aria-haspopup": "menu",
1110
+ "aria-expanded": context.open,
1111
+ "aria-controls": context.open ? context.contentId : void 0,
1112
+ "data-state": context.open ? "open" : "closed",
1113
+ "data-disabled": disabled ? "" : void 0,
1114
+ disabled,
1115
+ ...triggerProps,
1116
+ ref: Combination.composeRefs(forwardedRef, context.triggerRef),
1117
+ onPointerDown: Combination.composeEventHandlers(props.onPointerDown, (event) => {
1118
+ if (!disabled && event.button === 0 && event.ctrlKey === false) {
1119
+ context.onOpenToggle();
1120
+ if (!context.open) event.preventDefault();
1121
+ }
1122
+ }),
1123
+ onKeyDown: Combination.composeEventHandlers(props.onKeyDown, (event) => {
1124
+ if (disabled) return;
1125
+ if (["Enter", " "].includes(event.key)) context.onOpenToggle();
1126
+ if (event.key === "ArrowDown") context.onOpenChange(true);
1127
+ if (["Enter", " ", "ArrowDown"].includes(event.key)) event.preventDefault();
1128
+ })
1129
+ }
1130
+ ) });
1131
+ }
1132
+ );
1133
+ DropdownMenuTrigger.displayName = TRIGGER_NAME;
1134
+ var PORTAL_NAME = "DropdownMenuPortal";
1135
+ var DropdownMenuPortal = (props) => {
1136
+ const { __scopeDropdownMenu, ...portalProps } = props;
1137
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1138
+ return /* @__PURE__ */ jsxRuntime.jsx(Portal, { ...menuScope, ...portalProps });
1139
+ };
1140
+ DropdownMenuPortal.displayName = PORTAL_NAME;
1141
+ var CONTENT_NAME = "DropdownMenuContent";
1142
+ var DropdownMenuContent = React__namespace.forwardRef(
1143
+ (props, forwardedRef) => {
1144
+ const { __scopeDropdownMenu, ...contentProps } = props;
1145
+ const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
1146
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1147
+ const hasInteractedOutsideRef = React__namespace.useRef(false);
1148
+ return /* @__PURE__ */ jsxRuntime.jsx(
1149
+ Content2$1,
1150
+ {
1151
+ id: context.contentId,
1152
+ "aria-labelledby": context.triggerId,
1153
+ ...menuScope,
1154
+ ...contentProps,
1155
+ ref: forwardedRef,
1156
+ onCloseAutoFocus: Combination.composeEventHandlers(props.onCloseAutoFocus, (event) => {
1157
+ if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
1158
+ hasInteractedOutsideRef.current = false;
1159
+ event.preventDefault();
1160
+ }),
1161
+ onInteractOutside: Combination.composeEventHandlers(props.onInteractOutside, (event) => {
1162
+ const originalEvent = event.detail.originalEvent;
1163
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
1164
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
1165
+ if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;
1166
+ }),
1167
+ style: {
1168
+ ...props.style,
1169
+ // re-namespace exposed content custom properties
1170
+ ...{
1171
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1172
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1173
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1174
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1175
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1176
+ }
1177
+ }
1178
+ }
1179
+ );
1180
+ }
1181
+ );
1182
+ DropdownMenuContent.displayName = CONTENT_NAME;
1183
+ var GROUP_NAME = "DropdownMenuGroup";
1184
+ var DropdownMenuGroup = React__namespace.forwardRef(
1185
+ (props, forwardedRef) => {
1186
+ const { __scopeDropdownMenu, ...groupProps } = props;
1187
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1188
+ return /* @__PURE__ */ jsxRuntime.jsx(Group, { ...menuScope, ...groupProps, ref: forwardedRef });
1189
+ }
1190
+ );
1191
+ DropdownMenuGroup.displayName = GROUP_NAME;
1192
+ var LABEL_NAME = "DropdownMenuLabel";
1193
+ var DropdownMenuLabel = React__namespace.forwardRef(
1194
+ (props, forwardedRef) => {
1195
+ const { __scopeDropdownMenu, ...labelProps } = props;
1196
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1197
+ return /* @__PURE__ */ jsxRuntime.jsx(Label, { ...menuScope, ...labelProps, ref: forwardedRef });
1198
+ }
1199
+ );
1200
+ DropdownMenuLabel.displayName = LABEL_NAME;
1201
+ var ITEM_NAME = "DropdownMenuItem";
1202
+ var DropdownMenuItem = React__namespace.forwardRef(
1203
+ (props, forwardedRef) => {
1204
+ const { __scopeDropdownMenu, ...itemProps } = props;
1205
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1206
+ return /* @__PURE__ */ jsxRuntime.jsx(Item2$1, { ...menuScope, ...itemProps, ref: forwardedRef });
1207
+ }
1208
+ );
1209
+ DropdownMenuItem.displayName = ITEM_NAME;
1210
+ var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
1211
+ var DropdownMenuCheckboxItem = React__namespace.forwardRef((props, forwardedRef) => {
1212
+ const { __scopeDropdownMenu, ...checkboxItemProps } = props;
1213
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1214
+ return /* @__PURE__ */ jsxRuntime.jsx(CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
1215
+ });
1216
+ DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
1217
+ var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
1218
+ var DropdownMenuRadioGroup = React__namespace.forwardRef((props, forwardedRef) => {
1219
+ const { __scopeDropdownMenu, ...radioGroupProps } = props;
1220
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1221
+ return /* @__PURE__ */ jsxRuntime.jsx(RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });
1222
+ });
1223
+ DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
1224
+ var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
1225
+ var DropdownMenuRadioItem = React__namespace.forwardRef((props, forwardedRef) => {
1226
+ const { __scopeDropdownMenu, ...radioItemProps } = props;
1227
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1228
+ return /* @__PURE__ */ jsxRuntime.jsx(RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });
1229
+ });
1230
+ DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
1231
+ var INDICATOR_NAME = "DropdownMenuItemIndicator";
1232
+ var DropdownMenuItemIndicator = React__namespace.forwardRef((props, forwardedRef) => {
1233
+ const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
1234
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1235
+ return /* @__PURE__ */ jsxRuntime.jsx(ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });
1236
+ });
1237
+ DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
1238
+ var SEPARATOR_NAME = "DropdownMenuSeparator";
1239
+ var DropdownMenuSeparator = React__namespace.forwardRef((props, forwardedRef) => {
1240
+ const { __scopeDropdownMenu, ...separatorProps } = props;
1241
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1242
+ return /* @__PURE__ */ jsxRuntime.jsx(Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
1243
+ });
1244
+ DropdownMenuSeparator.displayName = SEPARATOR_NAME;
1245
+ var ARROW_NAME = "DropdownMenuArrow";
1246
+ var DropdownMenuArrow = React__namespace.forwardRef(
1247
+ (props, forwardedRef) => {
1248
+ const { __scopeDropdownMenu, ...arrowProps } = props;
1249
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1250
+ return /* @__PURE__ */ jsxRuntime.jsx(Arrow2, { ...menuScope, ...arrowProps, ref: forwardedRef });
1251
+ }
1252
+ );
1253
+ DropdownMenuArrow.displayName = ARROW_NAME;
1254
+ var DropdownMenuSub = (props) => {
1255
+ const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
1256
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1257
+ const [open = false, setOpen] = index$1.useControllableState({
1258
+ prop: openProp,
1259
+ defaultProp: defaultOpen,
1260
+ onChange: onOpenChange
1261
+ });
1262
+ return /* @__PURE__ */ jsxRuntime.jsx(Sub, { ...menuScope, open, onOpenChange: setOpen, children });
1263
+ };
1264
+ var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
1265
+ var DropdownMenuSubTrigger = React__namespace.forwardRef((props, forwardedRef) => {
1266
+ const { __scopeDropdownMenu, ...subTriggerProps } = props;
1267
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1268
+ return /* @__PURE__ */ jsxRuntime.jsx(SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });
1269
+ });
1270
+ DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
1271
+ var SUB_CONTENT_NAME = "DropdownMenuSubContent";
1272
+ var DropdownMenuSubContent = React__namespace.forwardRef((props, forwardedRef) => {
1273
+ const { __scopeDropdownMenu, ...subContentProps } = props;
1274
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1275
+ return /* @__PURE__ */ jsxRuntime.jsx(
1276
+ SubContent,
1277
+ {
1278
+ ...menuScope,
1279
+ ...subContentProps,
1280
+ ref: forwardedRef,
1281
+ style: {
1282
+ ...props.style,
1283
+ // re-namespace exposed content custom properties
1284
+ ...{
1285
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1286
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1287
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1288
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1289
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1290
+ }
1291
+ }
1292
+ }
1293
+ );
1294
+ });
1295
+ DropdownMenuSubContent.displayName = SUB_CONTENT_NAME;
1296
+ var Root2 = DropdownMenu;
1297
+ var Trigger = DropdownMenuTrigger;
1298
+ var Portal2 = DropdownMenuPortal;
1299
+ var Content2 = DropdownMenuContent;
1300
+ var Group2 = DropdownMenuGroup;
1301
+ var Item2 = DropdownMenuItem;
1302
+ var CheckboxItem2 = DropdownMenuCheckboxItem;
1303
+ var RadioGroup2 = DropdownMenuRadioGroup;
1304
+ var RadioItem2 = DropdownMenuRadioItem;
1305
+ var Separator2 = DropdownMenuSeparator;
1306
+ var Sub2 = DropdownMenuSub;
1307
+ var SubTrigger2 = DropdownMenuSubTrigger;
1308
+ var SubContent2 = DropdownMenuSubContent;
1309
+
24
1310
  /**
25
1311
  * Contains all the parts of a dropdown menu.
26
1312
  */
27
1313
  var Menu = function (_a) {
28
1314
  var defaultOpen = _a.defaultOpen, open = _a.open, onOpenChange = _a.onOpenChange, _b = _a.modal, modal = _b === void 0 ? false : _b, children = _a.children, props = filterAttrs.__rest(_a, ["defaultOpen", "open", "onOpenChange", "modal", "children"]);
29
- return (React.createElement(MenuItemMultiLevelContent.Root2, filterAttrs.__assign({ defaultOpen: defaultOpen, open: open, onOpenChange: onOpenChange, modal: modal }, filterAttrs.filterAttrs(props)), children));
1315
+ return (React.createElement(Root2, filterAttrs.__assign({ defaultOpen: defaultOpen, open: open, onOpenChange: onOpenChange, modal: modal }, filterAttrs.filterAttrs(props)), children));
30
1316
  };
31
1317
 
32
1318
  var MenuItemContentTemplate = function (_a) {
@@ -46,20 +1332,28 @@ var MenuItemContentTemplate = function (_a) {
46
1332
 
47
1333
  var MenuItemCheckbox = function (_a) {
48
1334
  var children = _a.children, checked = _a.checked, onCheckedChange = _a.onCheckedChange, isDisabled = _a.isDisabled, onSelect = _a.onSelect, id = _a.id, _b = _a.shouldKeepOpen, shouldKeepOpen = _b === void 0 ? true : _b, props = filterAttrs.__rest(_a, ["children", "checked", "onCheckedChange", "isDisabled", "onSelect", "id", "shouldKeepOpen"]);
49
- return (React.createElement(MenuItemMultiLevelContent.CheckboxItem2, filterAttrs.__assign({ className: "arc-MenuItem arc-MenuItemCheckbox", checked: checked, onCheckedChange: onCheckedChange, disabled: isDisabled, onSelect: function (event) {
1335
+ return (React.createElement(CheckboxItem2, filterAttrs.__assign({ className: "arc-MenuItem arc-MenuItemCheckbox", checked: checked, onCheckedChange: onCheckedChange, disabled: isDisabled, onSelect: function (event) {
50
1336
  if (shouldKeepOpen) {
51
1337
  event.preventDefault();
52
1338
  onCheckedChange === null || onCheckedChange === void 0 ? void 0 : onCheckedChange(!checked);
53
1339
  }
54
1340
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(event);
55
1341
  }, id: id }, filterAttrs.filterAttrs(props)),
56
- React.createElement("div", { className: index.classNames("arc-MenuItemCheckbox-box", {
1342
+ React.createElement("div", { className: index$4.classNames("arc-MenuItemCheckbox-box", {
57
1343
  "arc-MenuItemCheckbox-box--checked": checked,
58
1344
  }) }, checked && (React.createElement("svg", { style: { width: 14, height: 11 }, viewBox: "0 0 18 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
59
1345
  React.createElement("path", { d: "M5.99459 14L0.350576 8.23277C0.126079 8.00285 0 7.69132 0 7.36653C0 7.04173 0.126079 6.7302 0.350576 6.50028C0.578979 6.27752 0.88258 6.15324 1.19832 6.15324C1.51405 6.15324 1.81765 6.27752 2.04606 6.50028L5.99459 10.535L15.9385 0.374054C16.0491 0.25703 16.1814 0.163688 16.3277 0.0994738C16.474 0.0352599 16.6313 0.00145997 16.7905 4.626e-05C16.9497 -0.00136745 17.1076 0.0296342 17.255 0.0912406C17.4023 0.152847 17.5362 0.243825 17.6488 0.358867C17.7614 0.473908 17.8504 0.610709 17.9107 0.761287C17.971 0.911865 18.0013 1.0732 18 1.23589C17.9986 1.39858 17.9655 1.55936 17.9026 1.70884C17.8398 1.85833 17.7485 1.99352 17.6339 2.10655L5.99459 14Z", fill: "currentColor" })))),
60
1346
  React.createElement(MenuItemContentTemplate, null, children)));
61
1347
  };
62
1348
 
1349
+ /**
1350
+ * The component that pops out when the dropdown menu is open.
1351
+ */
1352
+ var MenuContent = React.forwardRef(function (_a, ref) {
1353
+ var children = _a.children, width = _a.width, minWidth = _a.minWidth, maxWidth = _a.maxWidth, _b = _a.align, align = _b === void 0 ? "start" : _b, alignOffset = _a.alignOffset, side = _a.side, props = filterAttrs.__rest(_a, ["children", "width", "minWidth", "maxWidth", "align", "alignOffset", "side"]);
1354
+ return (React.createElement(Content2, filterAttrs.__assign({ ref: ref, style: { width: width, minWidth: minWidth, maxWidth: maxWidth }, className: "arc-MenuContent", sideOffset: 12, loop: true, collisionPadding: 12, forceMount: true, align: align, alignOffset: alignOffset, side: side }, filterAttrs.filterAttrs(props)), children));
1355
+ });
1356
+
63
1357
  /**
64
1358
  * Displays footer content at the bottom of the menu.
65
1359
  */
@@ -70,7 +1364,7 @@ var MenuFooter = function (_a) {
70
1364
  } },
71
1365
  React.createElement("div", { className: "arc-MenuSeparator", style: { paddingTop: 0 } },
72
1366
  React.createElement(Rule.Rule, null)),
73
- React.createElement(MenuItemMultiLevelContent.Item2, { className: "arc-MenuItem", "aria-label": ariaLabel, onClick: onClick, disabled: isDisabled },
1367
+ React.createElement(Item2, { className: "arc-MenuItem", "aria-label": ariaLabel, onClick: onClick, disabled: isDisabled },
74
1368
  React.createElement(MenuItemContentTemplate, { leadingIcon: leadingIcon, trailingIcon: trailingIcon, supportingText: supportingText, keyCommands: keyCommands }, children))));
75
1369
  };
76
1370
 
@@ -79,7 +1373,7 @@ var MenuFooter = function (_a) {
79
1373
  */
80
1374
  var MenuGroup = function (_a) {
81
1375
  var children = _a.children, props = filterAttrs.__rest(_a, ["children"]);
82
- return (React.createElement(MenuItemMultiLevelContent.Group2, filterAttrs.__assign({ className: "arc-MenuGroup" }, filterAttrs.filterAttrs(props)), children));
1376
+ return (React.createElement(Group2, filterAttrs.__assign({ className: "arc-MenuGroup" }, filterAttrs.filterAttrs(props)), children));
83
1377
  };
84
1378
 
85
1379
  /**
@@ -88,7 +1382,7 @@ var MenuGroup = function (_a) {
88
1382
  var MenuHeader = function (_a) {
89
1383
  var leadingIcon = _a.leadingIcon, trailingIcon = _a.trailingIcon, supportingText = _a.supportingText, keyCommands = _a.keyCommands, children = _a.children, onClick = _a.onClick, isDisabled = _a.isDisabled, ariaLabel = _a.ariaLabel;
90
1384
  return (React.createElement("div", { className: "arc-MenuHeader" },
91
- React.createElement(MenuItemMultiLevelContent.Item2, { className: "arc-MenuItem ", style: { marginBottom: 0 }, "aria-label": ariaLabel, onClick: onClick, disabled: isDisabled },
1385
+ React.createElement(Item2, { className: "arc-MenuItem ", style: { marginBottom: 0 }, "aria-label": ariaLabel, onClick: onClick, disabled: isDisabled },
92
1386
  React.createElement(MenuItemContentTemplate, { leadingIcon: leadingIcon, trailingIcon: trailingIcon, supportingText: supportingText, keyCommands: keyCommands }, children)),
93
1387
  React.createElement("div", { className: "arc-MenuSeparator", style: {
94
1388
  paddingBottom: 0,
@@ -102,7 +1396,7 @@ var MenuHeader = function (_a) {
102
1396
  var MenuItem = function (_a) {
103
1397
  var leadingIcon = _a.leadingIcon, supportingText = _a.supportingText, keyCommands = _a.keyCommands, trailingIcon = _a.trailingIcon, children = _a.children, onClick = _a.onClick, _b = _a.shouldKeepOpen, shouldKeepOpen = _b === void 0 ? true : _b, isDisabled = _a.isDisabled, href = _a.href, ariaLabel = _a.ariaLabel, props = filterAttrs.__rest(_a, ["leadingIcon", "supportingText", "keyCommands", "trailingIcon", "children", "onClick", "shouldKeepOpen", "isDisabled", "href", "ariaLabel"]);
104
1398
  var Component = href ? "a" : "div";
105
- return (React.createElement(MenuItemMultiLevelContent.Item2, filterAttrs.__assign({ className: "arc-MenuItem", asChild: true, "aria-label": ariaLabel, onClick: isDisabled ? undefined : onClick, onSelect: function (event) {
1399
+ return (React.createElement(Item2, filterAttrs.__assign({ className: "arc-MenuItem", asChild: true, "aria-label": ariaLabel, onClick: isDisabled ? undefined : onClick, onSelect: function (event) {
106
1400
  if (shouldKeepOpen) {
107
1401
  event.preventDefault();
108
1402
  }
@@ -116,7 +1410,7 @@ var MenuItem = function (_a) {
116
1410
  */
117
1411
  var MenuLabel = function (_a) {
118
1412
  var children = _a.children, props = filterAttrs.__rest(_a, ["children"]);
119
- return (React.createElement(MenuItemMultiLevelContent.Item2, filterAttrs.__assign({ asChild: true, className: "arc-MenuLabel", tabIndex: 0, role: "presentation" }, filterAttrs.filterAttrs(props), { style: { pointerEvents: "none" } }),
1413
+ return (React.createElement(Item2, filterAttrs.__assign({ asChild: true, className: "arc-MenuLabel", tabIndex: 0, role: "presentation" }, filterAttrs.filterAttrs(props), { style: { pointerEvents: "none" } }),
120
1414
  React.createElement("div", null, children)));
121
1415
  };
122
1416
 
@@ -127,7 +1421,7 @@ var MenuPortal = function (_a) {
127
1421
  var children = _a.children, props = filterAttrs.__rest(_a, ["children"]);
128
1422
  var _b = index$1.useThemeElement(), themeElement = _b[0], setThemeElement = _b[1];
129
1423
  return (React.createElement("span", { ref: setThemeElement, style: { display: "none" } },
130
- React.createElement(MenuItemMultiLevelContent.Portal2, filterAttrs.__assign({ container: themeElement }, filterAttrs.filterAttrs(props)), children)));
1424
+ React.createElement(Portal2, filterAttrs.__assign({ container: themeElement }, filterAttrs.filterAttrs(props)), children)));
131
1425
  };
132
1426
 
133
1427
  /**
@@ -135,7 +1429,7 @@ var MenuPortal = function (_a) {
135
1429
  */
136
1430
  var MenuGroupSingleSelect = function (_a) {
137
1431
  var children = _a.children, value = _a.value, onValueChange = _a.onValueChange, props = filterAttrs.__rest(_a, ["children", "value", "onValueChange"]);
138
- return (React.createElement(MenuItemMultiLevelContent.RadioGroup2, filterAttrs.__assign({ className: "arc-MenuGroupSingleSelect", value: value, onValueChange: onValueChange }, filterAttrs.filterAttrs(props)), children));
1432
+ return (React.createElement(RadioGroup2, filterAttrs.__assign({ className: "arc-MenuGroupSingleSelect", value: value, onValueChange: onValueChange }, filterAttrs.filterAttrs(props)), children));
139
1433
  };
140
1434
 
141
1435
  /**
@@ -151,7 +1445,7 @@ const BtIconTickAlt2Px =
151
1445
  */
152
1446
  var MenuItemSingleSelect = function (_a) {
153
1447
  var children = _a.children, value = _a.value, _b = _a.disabled, disabled = _b === void 0 ? false : _b, onSelect = _a.onSelect, leadingIcon = _a.leadingIcon, supportingText = _a.supportingText, _c = _a.shouldKeepOpen, shouldKeepOpen = _c === void 0 ? true : _c, props = filterAttrs.__rest(_a, ["children", "value", "disabled", "onSelect", "leadingIcon", "supportingText", "shouldKeepOpen"]);
154
- return (React.createElement(MenuItemMultiLevelContent.RadioItem2, filterAttrs.__assign({ className: "arc-MenuItem arc-MenuItemSingleSelect", value: value, disabled: disabled, onSelect: function (event) {
1448
+ return (React.createElement(RadioItem2, filterAttrs.__assign({ className: "arc-MenuItem arc-MenuItemSingleSelect", value: value, disabled: disabled, onSelect: function (event) {
155
1449
  if (shouldKeepOpen) {
156
1450
  event.preventDefault();
157
1451
  }
@@ -188,7 +1482,7 @@ var MenuScrollable = function (_a) {
188
1482
  * Visual separator used to divide groups of menu items.
189
1483
  */
190
1484
  var MenuSeparator = function (props) {
191
- return (React.createElement(MenuItemMultiLevelContent.Separator2, filterAttrs.__assign({ className: "arc-MenuSeparator" }, filterAttrs.filterAttrs(props)),
1485
+ return (React.createElement(Separator2, filterAttrs.__assign({ className: "arc-MenuSeparator" }, filterAttrs.filterAttrs(props)),
192
1486
  React.createElement(Rule.Rule, null)));
193
1487
  };
194
1488
 
@@ -197,17 +1491,25 @@ var MenuSeparator = function (props) {
197
1491
  */
198
1492
  var MenuItemMultiLevel = function (_a) {
199
1493
  var children = _a.children, props = filterAttrs.__rest(_a, ["children"]);
200
- return React.createElement(MenuItemMultiLevelContent.Sub2, filterAttrs.__assign({}, filterAttrs.filterAttrs(props)),
1494
+ return React.createElement(Sub2, filterAttrs.__assign({}, filterAttrs.filterAttrs(props)),
201
1495
  " ",
202
1496
  children);
203
1497
  };
204
1498
 
1499
+ /**
1500
+ * The multi-level menu content that pops out when a menu item with children is hovered or clicked.
1501
+ */
1502
+ var MenuItemMultiLevelContent = React.forwardRef(function (_a, ref) {
1503
+ var children = _a.children, width = _a.width, minWidth = _a.minWidth, maxWidth = _a.maxWidth, alignOffset = _a.alignOffset, props = filterAttrs.__rest(_a, ["children", "width", "minWidth", "maxWidth", "alignOffset"]);
1504
+ return (React.createElement(SubContent2, filterAttrs.__assign({ ref: ref, style: { width: width, minWidth: minWidth, maxWidth: maxWidth }, className: "arc-MenuContent", sideOffset: 24, collisionPadding: 12, avoidCollisions: true, alignOffset: alignOffset }, filterAttrs.filterAttrs(props)), children));
1505
+ });
1506
+
205
1507
  /**
206
1508
  * Trigger element that opens a multi-level menu when selected.
207
1509
  */
208
1510
  var MenuItemMultiLevelTrigger = function (_a) {
209
1511
  var children = _a.children, isDisabled = _a.isDisabled, leadingIcon = _a.leadingIcon, supportingText = _a.supportingText, keyCommands = _a.keyCommands, ariaLabel = _a.ariaLabel, props = filterAttrs.__rest(_a, ["children", "isDisabled", "leadingIcon", "supportingText", "keyCommands", "ariaLabel"]);
210
- return (React.createElement(MenuItemMultiLevelContent.SubTrigger2, filterAttrs.__assign({ className: "arc-MenuItem arc-MenuItem--trigger", disabled: isDisabled, "aria-label": ariaLabel }, filterAttrs.filterAttrs(props)),
1512
+ return (React.createElement(SubTrigger2, filterAttrs.__assign({ className: "arc-MenuItem arc-MenuItem--trigger", disabled: isDisabled, "aria-label": ariaLabel }, filterAttrs.filterAttrs(props)),
211
1513
  React.createElement("div", { className: "arc-MenuItem-content" },
212
1514
  leadingIcon && (React.createElement("div", { className: "arc-MenuItem-leadingIcon" },
213
1515
  React.createElement(Icon.Icon, { icon: leadingIcon, size: 24 }))),
@@ -225,12 +1527,11 @@ var MenuItemMultiLevelTrigger = function (_a) {
225
1527
  */
226
1528
  var MenuTrigger = function (_a) {
227
1529
  var children = _a.children, asChild = _a.asChild, props = filterAttrs.__rest(_a, ["children", "asChild"]);
228
- return (React.createElement(MenuItemMultiLevelContent.Trigger, filterAttrs.__assign({ className: "arc-MenuTrigger", asChild: asChild }, filterAttrs.filterAttrs(props)), children));
1530
+ return (React.createElement(Trigger, filterAttrs.__assign({ className: "arc-MenuTrigger", asChild: asChild }, filterAttrs.filterAttrs(props)), children));
229
1531
  };
230
1532
 
231
- exports.MenuContent = MenuItemMultiLevelContent.MenuContent;
232
- exports.MenuItemMultiLevelContent = MenuItemMultiLevelContent.MenuItemMultiLevelContent;
233
1533
  exports.Menu = Menu;
1534
+ exports.MenuContent = MenuContent;
234
1535
  exports.MenuFooter = MenuFooter;
235
1536
  exports.MenuGroup = MenuGroup;
236
1537
  exports.MenuGroupSingleSelect = MenuGroupSingleSelect;
@@ -239,6 +1540,7 @@ exports.MenuItem = MenuItem;
239
1540
  exports.MenuItemCheckbox = MenuItemCheckbox;
240
1541
  exports.MenuItemContentTemplate = MenuItemContentTemplate;
241
1542
  exports.MenuItemMultiLevel = MenuItemMultiLevel;
1543
+ exports.MenuItemMultiLevelContent = MenuItemMultiLevelContent;
242
1544
  exports.MenuItemMultiLevelTrigger = MenuItemMultiLevelTrigger;
243
1545
  exports.MenuItemSingleSelect = MenuItemSingleSelect;
244
1546
  exports.MenuLabel = MenuLabel;