@arc-ui/components 12.0.0-beta.16 → 12.0.0-beta.18

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