@react-md/core 1.0.0-next.19 → 1.0.0-next.20

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 (1071) hide show
  1. package/dist/CoreProviders.js.map +1 -1
  2. package/dist/NoSsr.js.map +1 -1
  3. package/dist/RootHtml.js.map +1 -1
  4. package/dist/SsrProvider.js.map +1 -1
  5. package/dist/_core.scss +10 -9
  6. package/dist/app-bar/AppBar.js.map +1 -1
  7. package/dist/app-bar/AppBarTitle.js.map +1 -1
  8. package/dist/app-bar/_app-bar.scss +0 -4
  9. package/dist/app-bar/styles.js.map +1 -1
  10. package/dist/autocomplete/Autocomplete.js.map +1 -1
  11. package/dist/autocomplete/AutocompleteChip.js +1 -1
  12. package/dist/autocomplete/AutocompleteChip.js.map +1 -1
  13. package/dist/autocomplete/AutocompleteCircularProgress.js.map +1 -1
  14. package/dist/autocomplete/AutocompleteClearButton.js +1 -1
  15. package/dist/autocomplete/AutocompleteClearButton.js.map +1 -1
  16. package/dist/autocomplete/AutocompleteDropdownButton.js +1 -1
  17. package/dist/autocomplete/AutocompleteDropdownButton.js.map +1 -1
  18. package/dist/autocomplete/AutocompleteListboxChildren.js.map +1 -1
  19. package/dist/autocomplete/_autocomplete.scss +15 -13
  20. package/dist/autocomplete/autocompleteStyles.js.map +1 -1
  21. package/dist/autocomplete/types.js.map +1 -1
  22. package/dist/autocomplete/useAutocomplete.js +1 -1
  23. package/dist/autocomplete/useAutocomplete.js.map +1 -1
  24. package/dist/autocomplete/utils.js.map +1 -1
  25. package/dist/avatar/Avatar.js.map +1 -1
  26. package/dist/avatar/styles.js.map +1 -1
  27. package/dist/badge/Badge.js.map +1 -1
  28. package/dist/badge/styles.js.map +1 -1
  29. package/dist/box/Box.js +2 -1
  30. package/dist/box/Box.js.map +1 -1
  31. package/dist/box/_box.scss +24 -1
  32. package/dist/box/styles.d.ts +11 -0
  33. package/dist/box/styles.js +4 -3
  34. package/dist/box/styles.js.map +1 -1
  35. package/dist/button/AsyncButton.js.map +1 -1
  36. package/dist/button/Button.js.map +1 -1
  37. package/dist/button/ButtonUnstyled.js.map +1 -1
  38. package/dist/button/FloatingActionButton.js.map +1 -1
  39. package/dist/button/TooltippedButton.js.map +1 -1
  40. package/dist/button/buttonStyles.js.map +1 -1
  41. package/dist/card/Card.d.ts +4 -13
  42. package/dist/card/Card.js +3 -3
  43. package/dist/card/Card.js.map +1 -1
  44. package/dist/card/CardContent.js.map +1 -1
  45. package/dist/card/CardFooter.js.map +1 -1
  46. package/dist/card/CardHeader.js.map +1 -1
  47. package/dist/card/CardSubtitle.js.map +1 -1
  48. package/dist/card/CardTitle.js.map +1 -1
  49. package/dist/card/ClickableCard.js.map +1 -1
  50. package/dist/card/_card.scss +5 -0
  51. package/dist/card/styles.js.map +1 -1
  52. package/dist/chip/Chip.js +1 -1
  53. package/dist/chip/Chip.js.map +1 -1
  54. package/dist/chip/styles.js.map +1 -1
  55. package/dist/dialog/Dialog.d.ts +4 -4
  56. package/dist/dialog/Dialog.js.map +1 -1
  57. package/dist/dialog/DialogContent.js.map +1 -1
  58. package/dist/dialog/DialogFooter.js.map +1 -1
  59. package/dist/dialog/DialogHeader.js.map +1 -1
  60. package/dist/dialog/DialogTitle.js.map +1 -1
  61. package/dist/dialog/FixedDialog.js +8 -5
  62. package/dist/dialog/FixedDialog.js.map +1 -1
  63. package/dist/dialog/NestedDialogProvider.js.map +1 -1
  64. package/dist/dialog/styles.d.ts +12 -3
  65. package/dist/dialog/styles.js.map +1 -1
  66. package/dist/divider/Divider.js.map +1 -1
  67. package/dist/divider/styles.js.map +1 -1
  68. package/dist/draggable/useDraggable.d.ts +3 -0
  69. package/dist/draggable/useDraggable.js +20 -5
  70. package/dist/draggable/useDraggable.js.map +1 -1
  71. package/dist/draggable/utils.js.map +1 -1
  72. package/dist/expansion-panel/ExpansionList.js.map +1 -1
  73. package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
  74. package/dist/expansion-panel/ExpansionPanelHeader.js +1 -1
  75. package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
  76. package/dist/expansion-panel/expansionPanelStyles.js.map +1 -1
  77. package/dist/expansion-panel/useExpansionList.js.map +1 -1
  78. package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
  79. package/dist/files/FileInput.js +1 -1
  80. package/dist/files/FileInput.js.map +1 -1
  81. package/dist/files/styles.js.map +1 -1
  82. package/dist/files/useFileUpload.js.map +1 -1
  83. package/dist/files/utils.d.ts +31 -1
  84. package/dist/files/utils.js +30 -0
  85. package/dist/files/utils.js.map +1 -1
  86. package/dist/focus/useFocusContainer.d.ts +5 -7
  87. package/dist/focus/useFocusContainer.js +5 -7
  88. package/dist/focus/useFocusContainer.js.map +1 -1
  89. package/dist/form/Checkbox.js.map +1 -1
  90. package/dist/form/Fieldset.js.map +1 -1
  91. package/dist/form/Form.js.map +1 -1
  92. package/dist/form/FormMessage.js.map +1 -1
  93. package/dist/form/FormMessageContainer.js.map +1 -1
  94. package/dist/form/FormMessageCounter.js.map +1 -1
  95. package/dist/form/InputToggle.js.map +1 -1
  96. package/dist/form/InputToggleIcon.js +1 -1
  97. package/dist/form/InputToggleIcon.js.map +1 -1
  98. package/dist/form/Label.js.map +1 -1
  99. package/dist/form/Legend.js.map +1 -1
  100. package/dist/form/Listbox.js.map +1 -1
  101. package/dist/form/ListboxProvider.js.map +1 -1
  102. package/dist/form/MenuItemCheckbox.js.map +1 -1
  103. package/dist/form/MenuItemFileInput.d.ts +1 -4
  104. package/dist/form/MenuItemFileInput.js +15 -6
  105. package/dist/form/MenuItemFileInput.js.map +1 -1
  106. package/dist/form/MenuItemInputToggle.js.map +1 -1
  107. package/dist/form/MenuItemRadio.js.map +1 -1
  108. package/dist/form/MenuItemSwitch.js.map +1 -1
  109. package/dist/form/MenuItemTextField.js.map +1 -1
  110. package/dist/form/NativeSelect.js +1 -1
  111. package/dist/form/NativeSelect.js.map +1 -1
  112. package/dist/form/OptGroup.js.map +1 -1
  113. package/dist/form/Option.js +4 -4
  114. package/dist/form/Option.js.map +1 -1
  115. package/dist/form/Password.js +2 -2
  116. package/dist/form/Password.js.map +1 -1
  117. package/dist/form/Radio.js.map +1 -1
  118. package/dist/form/ResizingTextAreaWrapper.js.map +1 -1
  119. package/dist/form/Select.js +1 -1
  120. package/dist/form/Select.js.map +1 -1
  121. package/dist/form/SelectedOption.js.map +1 -1
  122. package/dist/form/Slider.js +9 -62
  123. package/dist/form/Slider.js.map +1 -1
  124. package/dist/form/SliderContainer.js.map +1 -1
  125. package/dist/form/SliderMark.js.map +1 -1
  126. package/dist/form/SliderMarkLabel.js.map +1 -1
  127. package/dist/form/SliderThumb.js +1 -0
  128. package/dist/form/SliderThumb.js.map +1 -1
  129. package/dist/form/SliderTrack.js.map +1 -1
  130. package/dist/form/SliderValueMarks.js.map +1 -1
  131. package/dist/form/SliderValueTooltip.js.map +1 -1
  132. package/dist/form/Switch.js.map +1 -1
  133. package/dist/form/SwitchTrack.js.map +1 -1
  134. package/dist/form/TextArea.js.map +1 -1
  135. package/dist/form/TextField.js.map +1 -1
  136. package/dist/form/TextFieldAddon.js.map +1 -1
  137. package/dist/form/TextFieldContainer.js.map +1 -1
  138. package/dist/form/_form.scss +313 -269
  139. package/dist/form/formMessageContainerStyles.js.map +1 -1
  140. package/dist/form/formMessageStyles.js.map +1 -1
  141. package/dist/form/inputToggleStyles.js.map +1 -1
  142. package/dist/form/menuItemInputToggleStyles.js.map +1 -1
  143. package/dist/form/nativeSelectStyles.js.map +1 -1
  144. package/dist/form/optionStyles.js.map +1 -1
  145. package/dist/form/passwordStyles.js.map +1 -1
  146. package/dist/form/selectStyles.js.map +1 -1
  147. package/dist/form/selectUtils.js.map +1 -1
  148. package/dist/form/sliderUtils.d.ts +2 -7
  149. package/dist/form/sliderUtils.js +5 -5
  150. package/dist/form/sliderUtils.js.map +1 -1
  151. package/dist/form/switchStyles.js.map +1 -1
  152. package/dist/form/textAreaStyles.js.map +1 -1
  153. package/dist/form/textFieldContainerStyles.js.map +1 -1
  154. package/dist/form/textFieldStyles.js.map +1 -1
  155. package/dist/form/types.js.map +1 -1
  156. package/dist/form/useCheckboxGroup.d.ts +2 -2
  157. package/dist/form/useCheckboxGroup.js.map +1 -1
  158. package/dist/form/useCombobox.js.map +1 -1
  159. package/dist/form/useEditableCombobox.js.map +1 -1
  160. package/dist/form/useFormReset.js.map +1 -1
  161. package/dist/form/useNumberField.js.map +1 -1
  162. package/dist/form/useRadioGroup.d.ts +1 -1
  163. package/dist/form/useRadioGroup.js.map +1 -1
  164. package/dist/form/useRangeSlider.d.ts +1 -0
  165. package/dist/form/useRangeSlider.js.map +1 -1
  166. package/dist/form/useResizingTextArea.js.map +1 -1
  167. package/dist/form/useSelectCombobox.js.map +1 -1
  168. package/dist/form/useSlider.d.ts +1 -3
  169. package/dist/form/useSlider.js.map +1 -1
  170. package/dist/form/useSliderDraggable.d.ts +9 -0
  171. package/dist/form/useSliderDraggable.js +44 -0
  172. package/dist/form/useSliderDraggable.js.map +1 -0
  173. package/dist/form/useTextField.d.ts +24 -14
  174. package/dist/form/useTextField.js +7 -5
  175. package/dist/form/useTextField.js.map +1 -1
  176. package/dist/form/useTextFieldContainerAddons.js.map +1 -1
  177. package/dist/form/validation.js +2 -0
  178. package/dist/form/validation.js.map +1 -1
  179. package/dist/hoverMode/useHoverMode.d.ts +64 -3
  180. package/dist/hoverMode/useHoverMode.js.map +1 -1
  181. package/dist/hoverMode/useHoverModeProvider.d.ts +22 -12
  182. package/dist/hoverMode/useHoverModeProvider.js +21 -11
  183. package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
  184. package/dist/icon/FontIcon.js.map +1 -1
  185. package/dist/icon/IconRotator.js.map +1 -1
  186. package/dist/icon/MaterialIcon.js.map +1 -1
  187. package/dist/icon/MaterialSymbol.js.map +1 -1
  188. package/dist/icon/SVGIcon.js.map +1 -1
  189. package/dist/icon/TextIconSpacing.js.map +1 -1
  190. package/dist/icon/{iconConfig.js → config.js} +1 -1
  191. package/dist/icon/config.js.map +1 -0
  192. package/dist/icon/materialConfig.js.map +1 -1
  193. package/dist/icon/styles.js.map +1 -1
  194. package/dist/interaction/Ripple.js.map +1 -1
  195. package/dist/interaction/RippleContainer.js.map +1 -1
  196. package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
  197. package/dist/interaction/_interaction.scss +2 -2
  198. package/dist/interaction/useElementInteraction.d.ts +24 -25
  199. package/dist/interaction/useElementInteraction.js +20 -21
  200. package/dist/interaction/useElementInteraction.js.map +1 -1
  201. package/dist/interaction/useHigherContrastChildren.d.ts +8 -6
  202. package/dist/interaction/useHigherContrastChildren.js +10 -8
  203. package/dist/interaction/useHigherContrastChildren.js.map +1 -1
  204. package/dist/interaction/utils.js.map +1 -1
  205. package/dist/layout/LayoutAppBar.js.map +1 -1
  206. package/dist/layout/LayoutNav.js.map +1 -1
  207. package/dist/layout/LayoutWindowSplitter.js.map +1 -1
  208. package/dist/layout/Main.js.map +1 -1
  209. package/dist/layout/_layout.scss +4 -0
  210. package/dist/layout/layoutNavStyles.js.map +1 -1
  211. package/dist/layout/layoutWindowSplitterStyles.js.map +1 -1
  212. package/dist/layout/mainStyles.js.map +1 -1
  213. package/dist/layout/useExpandableLayout.d.ts +12 -14
  214. package/dist/layout/useExpandableLayout.js +13 -15
  215. package/dist/layout/useExpandableLayout.js.map +1 -1
  216. package/dist/layout/useHorizontalLayoutTransition.js.map +1 -1
  217. package/dist/layout/useLayoutAppBarHeight.js.map +1 -1
  218. package/dist/layout/useLayoutTree.d.ts +4 -3
  219. package/dist/layout/useLayoutTree.js +4 -3
  220. package/dist/layout/useLayoutTree.js.map +1 -1
  221. package/dist/layout/useLayoutWindowSplitter.js.map +1 -1
  222. package/dist/layout/useMainTabIndex.js.map +1 -1
  223. package/dist/layout/useResizableLayout.d.ts +13 -16
  224. package/dist/layout/useResizableLayout.js +13 -16
  225. package/dist/layout/useResizableLayout.js.map +1 -1
  226. package/dist/layout/useTemporaryLayout.d.ts +14 -9
  227. package/dist/layout/useTemporaryLayout.js +12 -10
  228. package/dist/layout/useTemporaryLayout.js.map +1 -1
  229. package/dist/link/Link.js.map +1 -1
  230. package/dist/link/SkipToMainContent.js.map +1 -1
  231. package/dist/link/styles.js.map +1 -1
  232. package/dist/list/List.js.map +1 -1
  233. package/dist/list/ListItem.js +1 -1
  234. package/dist/list/ListItem.js.map +1 -1
  235. package/dist/list/ListItemAddon.js.map +1 -1
  236. package/dist/list/ListItemChildren.js.map +1 -1
  237. package/dist/list/ListItemLink.js.map +1 -1
  238. package/dist/list/ListItemText.js.map +1 -1
  239. package/dist/list/ListSubheader.js.map +1 -1
  240. package/dist/list/listItemStyles.js.map +1 -1
  241. package/dist/list/listStyles.js.map +1 -1
  242. package/dist/list/types.js.map +1 -1
  243. package/dist/media-queries/AppSizeProvider.d.ts +1 -1
  244. package/dist/media-queries/AppSizeProvider.js +1 -1
  245. package/dist/media-queries/AppSizeProvider.js.map +1 -1
  246. package/dist/media-queries/useMediaQuery.d.ts +3 -3
  247. package/dist/media-queries/useMediaQuery.js +3 -3
  248. package/dist/media-queries/useMediaQuery.js.map +1 -1
  249. package/dist/menu/DropdownMenu.js.map +1 -1
  250. package/dist/menu/Menu.js.map +1 -1
  251. package/dist/menu/MenuBar.js.map +1 -1
  252. package/dist/menu/MenuButton.js +1 -1
  253. package/dist/menu/MenuButton.js.map +1 -1
  254. package/dist/menu/MenuConfigurationProvider.js.map +1 -1
  255. package/dist/menu/MenuItem.js.map +1 -1
  256. package/dist/menu/MenuItemButton.js +1 -1
  257. package/dist/menu/MenuItemButton.js.map +1 -1
  258. package/dist/menu/MenuItemCircularProgress.js.map +1 -1
  259. package/dist/menu/MenuItemGroup.js.map +1 -1
  260. package/dist/menu/MenuItemSeparator.js.map +1 -1
  261. package/dist/menu/MenuSheet.js.map +1 -1
  262. package/dist/menu/MenuVisibilityProvider.js.map +1 -1
  263. package/dist/menu/MenuWidget.js.map +1 -1
  264. package/dist/menu/MenuWidgetKeyboardProvider.js.map +1 -1
  265. package/dist/menu/useContextMenu.js.map +1 -1
  266. package/dist/menu/useMenuBarProvider.js.map +1 -1
  267. package/dist/movement/types.js.map +1 -1
  268. package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
  269. package/dist/movement/utils.js.map +1 -1
  270. package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
  271. package/dist/navigation/DefaultNavigationRenderer.js.map +1 -1
  272. package/dist/navigation/NavGroup.js.map +1 -1
  273. package/dist/navigation/NavItem.js.map +1 -1
  274. package/dist/navigation/NavItemButton.js +1 -1
  275. package/dist/navigation/NavItemButton.js.map +1 -1
  276. package/dist/navigation/NavItemLink.js.map +1 -1
  277. package/dist/navigation/NavSubheader.d.ts +1 -1
  278. package/dist/navigation/NavSubheader.js +1 -1
  279. package/dist/navigation/NavSubheader.js.map +1 -1
  280. package/dist/navigation/Navigation.js.map +1 -1
  281. package/dist/navigation/navGroupStyles.js.map +1 -1
  282. package/dist/navigation/navItemStyles.js.map +1 -1
  283. package/dist/navigation/types.js.map +1 -1
  284. package/dist/navigation/useActiveHeadingId.d.ts +1 -1
  285. package/dist/navigation/useActiveHeadingId.js +4 -4
  286. package/dist/navigation/useActiveHeadingId.js.map +1 -1
  287. package/dist/navigation/useNavigationExpansion.js.map +1 -1
  288. package/dist/navigation/useTableOfContentsHeadings.d.ts +75 -0
  289. package/dist/navigation/useTableOfContentsHeadings.js +91 -0
  290. package/dist/navigation/useTableOfContentsHeadings.js.map +1 -0
  291. package/dist/objectFit.js.map +1 -1
  292. package/dist/overlay/Overlay.js +1 -1
  293. package/dist/overlay/Overlay.js.map +1 -1
  294. package/dist/overlay/overlayStyles.d.ts +7 -3
  295. package/dist/overlay/overlayStyles.js.map +1 -1
  296. package/dist/portal/Portal.js.map +1 -1
  297. package/dist/portal/PortalContainerProvider.js.map +1 -1
  298. package/dist/positioning/createHorizontalPosition.js.map +1 -1
  299. package/dist/positioning/createVerticalPosition.js.map +1 -1
  300. package/dist/positioning/useFixedPositioning.d.ts +11 -8
  301. package/dist/positioning/useFixedPositioning.js +7 -6
  302. package/dist/positioning/useFixedPositioning.js.map +1 -1
  303. package/dist/progress/CircularProgress.js.map +1 -1
  304. package/dist/progress/LinearProgress.js.map +1 -1
  305. package/dist/progress/_progress.scss +2 -1
  306. package/dist/responsive-item/ResponsiveItem.js.map +1 -1
  307. package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
  308. package/dist/responsive-item/responsiveItemOverlayStyles.js.map +1 -1
  309. package/dist/responsive-item/responsiveItemStyles.js.map +1 -1
  310. package/dist/scroll/ScrollLock.js.map +1 -1
  311. package/dist/scroll/useScrollLock.d.ts +1 -1
  312. package/dist/scroll/useScrollLock.js +1 -1
  313. package/dist/scroll/useScrollLock.js.map +1 -1
  314. package/dist/searching/fuzzy.d.ts +1 -1
  315. package/dist/searching/fuzzy.js.map +1 -1
  316. package/dist/searching/useFuzzyMatch.js.map +1 -1
  317. package/dist/segmented-button/SegmentedButton.js +1 -1
  318. package/dist/segmented-button/SegmentedButton.js.map +1 -1
  319. package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -1
  320. package/dist/segmented-button/_segmented-button.scss +40 -0
  321. package/dist/segmented-button/segmentedButtonContainerStyles.js.map +1 -1
  322. package/dist/segmented-button/segmentedButtonStyles.js.map +1 -1
  323. package/dist/sheet/Sheet.js.map +1 -1
  324. package/dist/sheet/styles.js.map +1 -1
  325. package/dist/snackbar/DefaultToastRenderer.js.map +1 -1
  326. package/dist/snackbar/Snackbar.js.map +1 -1
  327. package/dist/snackbar/Toast.js.map +1 -1
  328. package/dist/snackbar/ToastActionButton.js.map +1 -1
  329. package/dist/snackbar/ToastCloseButton.js +1 -1
  330. package/dist/snackbar/ToastCloseButton.js.map +1 -1
  331. package/dist/snackbar/ToastContent.js.map +1 -1
  332. package/dist/snackbar/ToastManager.js.map +1 -1
  333. package/dist/snackbar/ToastManagerProvider.js.map +1 -1
  334. package/dist/snackbar/snackbarStyles.js.map +1 -1
  335. package/dist/snackbar/toastContentStyles.js.map +1 -1
  336. package/dist/snackbar/toastStyles.js.map +1 -1
  337. package/dist/snackbar/useCurrentToastActions.js.map +1 -1
  338. package/dist/storage/internalUtils.d.ts +19 -0
  339. package/dist/storage/internalUtils.js +22 -0
  340. package/dist/storage/internalUtils.js.map +1 -0
  341. package/dist/storage/types.d.ts +75 -0
  342. package/dist/storage/types.js +3 -0
  343. package/dist/storage/types.js.map +1 -0
  344. package/dist/storage/useStorage.d.ts +113 -0
  345. package/dist/storage/useStorage.js +247 -0
  346. package/dist/storage/useStorage.js.map +1 -0
  347. package/dist/storage/utils.d.ts +94 -0
  348. package/dist/storage/utils.js +106 -0
  349. package/dist/storage/utils.js.map +1 -0
  350. package/dist/suspense/CircularProgressSuspense.js.map +1 -1
  351. package/dist/suspense/NullSuspense.js.map +1 -1
  352. package/dist/table/StickyTableSection.js.map +1 -1
  353. package/dist/table/Table.js.map +1 -1
  354. package/dist/table/TableBody.js.map +1 -1
  355. package/dist/table/TableCell.js +1 -1
  356. package/dist/table/TableCell.js.map +1 -1
  357. package/dist/table/TableCellContent.js.map +1 -1
  358. package/dist/table/TableCheckbox.js.map +1 -1
  359. package/dist/table/TableConfigurationProvider.js.map +1 -1
  360. package/dist/table/TableContainer.js.map +1 -1
  361. package/dist/table/TableContainerProvider.js.map +1 -1
  362. package/dist/table/TableFooter.js.map +1 -1
  363. package/dist/table/TableHeader.js.map +1 -1
  364. package/dist/table/TableRadio.js.map +1 -1
  365. package/dist/table/TableRow.js.map +1 -1
  366. package/dist/table/_table.scss +0 -1
  367. package/dist/table/tableCellStyles.js.map +1 -1
  368. package/dist/table/tableFooterStyles.js.map +1 -1
  369. package/dist/table/tableHeaderStyles.js.map +1 -1
  370. package/dist/table/tableRowStyles.js.map +1 -1
  371. package/dist/table/tableStyles.js.map +1 -1
  372. package/dist/table/useStickyTableSection.js.map +1 -1
  373. package/dist/table/useTableSectionConfig.js.map +1 -1
  374. package/dist/tabs/SimpleTabPanel.d.ts +17 -0
  375. package/dist/tabs/SimpleTabPanel.js +21 -0
  376. package/dist/tabs/SimpleTabPanel.js.map +1 -0
  377. package/dist/tabs/SimpleTabPanels.d.ts +17 -0
  378. package/dist/tabs/SimpleTabPanels.js +18 -0
  379. package/dist/tabs/SimpleTabPanels.js.map +1 -0
  380. package/dist/tabs/Tab.js.map +1 -1
  381. package/dist/tabs/TabList.d.ts +8 -25
  382. package/dist/tabs/TabList.js +4 -6
  383. package/dist/tabs/TabList.js.map +1 -1
  384. package/dist/tabs/TabListScrollButton.js +2 -1
  385. package/dist/tabs/TabListScrollButton.js.map +1 -1
  386. package/dist/tabs/_tabs.scss +50 -14
  387. package/dist/tabs/tabIndicatorStyles.js.map +1 -1
  388. package/dist/tabs/tabListScrollButtonStyles.js.map +1 -1
  389. package/dist/tabs/tabListStyles.d.ts +9 -0
  390. package/dist/tabs/tabListStyles.js +2 -1
  391. package/dist/tabs/tabListStyles.js.map +1 -1
  392. package/dist/tabs/tabStyles.d.ts +7 -0
  393. package/dist/tabs/tabStyles.js.map +1 -1
  394. package/dist/tabs/types.d.ts +25 -0
  395. package/dist/tabs/types.js +24 -0
  396. package/dist/tabs/types.js.map +1 -0
  397. package/dist/tabs/useMaxTabPanelHeight.d.ts +82 -0
  398. package/dist/tabs/useMaxTabPanelHeight.js +95 -0
  399. package/dist/tabs/useMaxTabPanelHeight.js.map +1 -0
  400. package/dist/tabs/useTabList.d.ts +4 -2
  401. package/dist/tabs/useTabList.js +24 -6
  402. package/dist/tabs/useTabList.js.map +1 -1
  403. package/dist/tabs/useTabs.d.ts +53 -68
  404. package/dist/tabs/useTabs.js +6 -2
  405. package/dist/tabs/useTabs.js.map +1 -1
  406. package/dist/tabs/utils.d.ts +4 -0
  407. package/dist/tabs/utils.js +5 -0
  408. package/dist/tabs/utils.js.map +1 -1
  409. package/dist/test-utils/drag.d.ts +1 -0
  410. package/dist/test-utils/index.d.ts +6 -4
  411. package/dist/test-utils/index.js +6 -4
  412. package/dist/test-utils/index.js.map +1 -1
  413. package/dist/test-utils/jest-globals/index.d.ts +4 -0
  414. package/dist/test-utils/jest-globals/index.js +6 -0
  415. package/dist/test-utils/jest-globals/index.js.map +1 -0
  416. package/dist/test-utils/jest-globals/match-media.d.ts +32 -0
  417. package/dist/test-utils/jest-globals/match-media.js +35 -0
  418. package/dist/test-utils/jest-globals/match-media.js.map +1 -0
  419. package/dist/test-utils/jest-globals/resize-observer.d.ts +5 -0
  420. package/dist/test-utils/jest-globals/resize-observer.js +10 -0
  421. package/dist/test-utils/jest-globals/resize-observer.js.map +1 -0
  422. package/dist/test-utils/jest-globals/setup.d.ts +1 -0
  423. package/dist/test-utils/{jest-setup.js → jest-globals/setup.js} +4 -3
  424. package/dist/test-utils/jest-globals/setup.js.map +1 -0
  425. package/dist/test-utils/{timers.d.ts → jest-globals/timers.d.ts} +2 -2
  426. package/dist/test-utils/{timers.js → jest-globals/timers.js} +2 -2
  427. package/dist/test-utils/jest-globals/timers.js.map +1 -0
  428. package/dist/test-utils/jest-globals/uploadMenuItemFileInput.d.ts +32 -0
  429. package/dist/test-utils/jest-globals/uploadMenuItemFileInput.js +39 -0
  430. package/dist/test-utils/jest-globals/uploadMenuItemFileInput.js.map +1 -0
  431. package/dist/test-utils/mocks/IntersectionObserver.js.map +1 -0
  432. package/dist/test-utils/{ResizeObserver.d.ts → mocks/ResizeObserver.d.ts} +16 -23
  433. package/dist/test-utils/{ResizeObserver.js → mocks/ResizeObserver.js} +17 -38
  434. package/dist/test-utils/mocks/ResizeObserver.js.map +1 -0
  435. package/dist/test-utils/mocks/match-media-implementation.d.ts +42 -0
  436. package/dist/test-utils/mocks/match-media-implementation.js +46 -0
  437. package/dist/test-utils/mocks/match-media-implementation.js.map +1 -0
  438. package/dist/test-utils/mocks/match-media.d.ts +32 -0
  439. package/dist/test-utils/mocks/match-media.js +39 -0
  440. package/dist/test-utils/mocks/match-media.js.map +1 -0
  441. package/dist/test-utils/polyfills/IntersectionObserver.js +1 -1
  442. package/dist/test-utils/polyfills/IntersectionObserver.js.map +1 -1
  443. package/dist/test-utils/polyfills/ResizeObserver.js +1 -1
  444. package/dist/test-utils/polyfills/ResizeObserver.js.map +1 -1
  445. package/dist/test-utils/polyfills/matchMedia.js +1 -1
  446. package/dist/test-utils/polyfills/matchMedia.js.map +1 -1
  447. package/dist/test-utils/queries/index.d.ts +2 -0
  448. package/dist/test-utils/queries/index.js +4 -0
  449. package/dist/test-utils/queries/index.js.map +1 -0
  450. package/dist/test-utils/queries/select.d.ts +67 -0
  451. package/dist/test-utils/queries/select.js +69 -0
  452. package/dist/test-utils/queries/select.js.map +1 -0
  453. package/dist/test-utils/queries/slider.d.ts +126 -0
  454. package/dist/test-utils/queries/slider.js +136 -0
  455. package/dist/test-utils/queries/slider.js.map +1 -0
  456. package/dist/test-utils/queries/types.d.ts +8 -0
  457. package/dist/test-utils/queries/types.js +5 -0
  458. package/dist/test-utils/queries/types.js.map +1 -0
  459. package/dist/test-utils/render.js.map +1 -1
  460. package/dist/test-utils/utils/createFileList.d.ts +4 -0
  461. package/dist/test-utils/utils/createFileList.js +27 -0
  462. package/dist/test-utils/utils/createFileList.js.map +1 -0
  463. package/dist/test-utils/utils/createResizeObserverEntry.d.ts +18 -0
  464. package/dist/test-utils/utils/createResizeObserverEntry.js +33 -0
  465. package/dist/test-utils/utils/createResizeObserverEntry.js.map +1 -0
  466. package/dist/test-utils/vitest/index.d.ts +4 -0
  467. package/dist/test-utils/vitest/index.js +6 -0
  468. package/dist/test-utils/vitest/index.js.map +1 -0
  469. package/dist/test-utils/vitest/match-media.d.ts +32 -0
  470. package/dist/test-utils/vitest/match-media.js +35 -0
  471. package/dist/test-utils/vitest/match-media.js.map +1 -0
  472. package/dist/test-utils/vitest/resize-observer.d.ts +5 -0
  473. package/dist/test-utils/vitest/resize-observer.js +10 -0
  474. package/dist/test-utils/vitest/resize-observer.js.map +1 -0
  475. package/dist/test-utils/vitest/setup.d.ts +1 -0
  476. package/dist/test-utils/vitest/setup.js +14 -0
  477. package/dist/test-utils/vitest/setup.js.map +1 -0
  478. package/dist/test-utils/vitest/timers.d.ts +42 -0
  479. package/dist/test-utils/vitest/timers.js +42 -0
  480. package/dist/test-utils/vitest/timers.js.map +1 -0
  481. package/dist/test-utils/vitest/uploadMenuItemFileInput.d.ts +32 -0
  482. package/dist/test-utils/vitest/uploadMenuItemFileInput.js +39 -0
  483. package/dist/test-utils/vitest/uploadMenuItemFileInput.js.map +1 -0
  484. package/dist/theme/LocalStorageColorSchemeProvider.d.ts +17 -17
  485. package/dist/theme/LocalStorageColorSchemeProvider.js +19 -19
  486. package/dist/theme/LocalStorageColorSchemeProvider.js.map +1 -1
  487. package/dist/theme/ThemeProvider.d.ts +2 -2
  488. package/dist/theme/ThemeProvider.js +4 -4
  489. package/dist/theme/ThemeProvider.js.map +1 -1
  490. package/dist/theme/_theme.scss +0 -4
  491. package/dist/theme/isColorScheme.d.ts +5 -5
  492. package/dist/theme/isColorScheme.js +5 -5
  493. package/dist/theme/isColorScheme.js.map +1 -1
  494. package/dist/theme/types.d.ts +10 -22
  495. package/dist/theme/types.js.map +1 -1
  496. package/dist/theme/useCSSVariables.d.ts +8 -15
  497. package/dist/theme/useCSSVariables.js.map +1 -1
  498. package/dist/theme/useColorScheme.d.ts +15 -13
  499. package/dist/theme/useColorScheme.js +17 -15
  500. package/dist/theme/useColorScheme.js.map +1 -1
  501. package/dist/theme/useColorSchemeMetaTag.d.ts +15 -2
  502. package/dist/theme/useColorSchemeMetaTag.js +13 -0
  503. package/dist/theme/useColorSchemeMetaTag.js.map +1 -1
  504. package/dist/theme/useColorSchemeProvider.d.ts +18 -20
  505. package/dist/theme/useColorSchemeProvider.js +13 -13
  506. package/dist/theme/useColorSchemeProvider.js.map +1 -1
  507. package/dist/theme/{usePrefersDarkScheme.js → usePrefersDarkTheme.js} +1 -1
  508. package/dist/theme/usePrefersDarkTheme.js.map +1 -0
  509. package/dist/tooltip/Tooltip.js.map +1 -1
  510. package/dist/tooltip/TooltipHoverModeProvider.js.map +1 -1
  511. package/dist/tooltip/tooltipStyles.js.map +1 -1
  512. package/dist/tooltip/useTooltip.d.ts +5 -2
  513. package/dist/tooltip/useTooltip.js.map +1 -1
  514. package/dist/tooltip/useTooltipPosition.js.map +1 -1
  515. package/dist/transition/CSSTransition.js.map +1 -1
  516. package/dist/transition/Collapse.js.map +1 -1
  517. package/dist/transition/CrossFade.d.ts +1 -1
  518. package/dist/transition/CrossFade.js +1 -1
  519. package/dist/transition/CrossFade.js.map +1 -1
  520. package/dist/transition/ScaleTransition.js.map +1 -1
  521. package/dist/transition/SkeletonPlaceholder.js.map +1 -1
  522. package/dist/transition/Slide.js.map +1 -1
  523. package/dist/transition/SlideContainer.js.map +1 -1
  524. package/dist/transition/collapseStyles.js.map +1 -1
  525. package/dist/transition/config.d.ts +4 -1
  526. package/dist/transition/config.js.map +1 -1
  527. package/dist/transition/maxWidthTransition.d.ts +6 -0
  528. package/dist/transition/maxWidthTransition.js +3 -1
  529. package/dist/transition/maxWidthTransition.js.map +1 -1
  530. package/dist/transition/skeletonPlaceholderUtils.js.map +1 -1
  531. package/dist/transition/types.d.ts +0 -1
  532. package/dist/transition/types.js.map +1 -1
  533. package/dist/transition/useCSSTransition.d.ts +8 -4
  534. package/dist/transition/useCSSTransition.js +8 -4
  535. package/dist/transition/useCSSTransition.js.map +1 -1
  536. package/dist/transition/useCarousel.js.map +1 -1
  537. package/dist/transition/useCollapseTransition.d.ts +13 -8
  538. package/dist/transition/useCollapseTransition.js +11 -6
  539. package/dist/transition/useCollapseTransition.js.map +1 -1
  540. package/dist/transition/useCrossFadeTransition.js.map +1 -1
  541. package/dist/transition/useMaxWidthTransition.d.ts +9 -0
  542. package/dist/transition/useMaxWidthTransition.js +9 -0
  543. package/dist/transition/useMaxWidthTransition.js.map +1 -1
  544. package/dist/transition/useScaleTransition.d.ts +27 -6
  545. package/dist/transition/useScaleTransition.js +4 -2
  546. package/dist/transition/useScaleTransition.js.map +1 -1
  547. package/dist/transition/useSkeletonPlaceholder.d.ts +16 -0
  548. package/dist/transition/useSkeletonPlaceholder.js +13 -1
  549. package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
  550. package/dist/transition/useSlideTransition.d.ts +12 -16
  551. package/dist/transition/useSlideTransition.js +12 -16
  552. package/dist/transition/useSlideTransition.js.map +1 -1
  553. package/dist/transition/useTransition.js +1 -1
  554. package/dist/transition/useTransition.js.map +1 -1
  555. package/dist/tree/DefaultTreeItemRenderer.js.map +1 -1
  556. package/dist/tree/Tree.js.map +1 -1
  557. package/dist/tree/TreeGroup.js.map +1 -1
  558. package/dist/tree/TreeItem.js.map +1 -1
  559. package/dist/tree/TreeItemExpander.js +1 -1
  560. package/dist/tree/TreeItemExpander.js.map +1 -1
  561. package/dist/tree/TreeProvider.js.map +1 -1
  562. package/dist/tree/_tree.scss +0 -1
  563. package/dist/tree/styles.js.map +1 -1
  564. package/dist/tree/types.js.map +1 -1
  565. package/dist/tree/useTree.js.map +1 -1
  566. package/dist/tree/useTreeExpansion.js.map +1 -1
  567. package/dist/tree/useTreeItems.d.ts +1 -1
  568. package/dist/tree/useTreeItems.js.map +1 -1
  569. package/dist/tree/useTreeMovement.js.map +1 -1
  570. package/dist/tree/useTreeSelection.js.map +1 -1
  571. package/dist/typography/SrOnly.js.map +1 -1
  572. package/dist/typography/TextContainer.js.map +1 -1
  573. package/dist/typography/Typography.js.map +1 -1
  574. package/dist/typography/WritingDirectionProvider.js.map +1 -1
  575. package/dist/typography/textContainerStyles.js.map +1 -1
  576. package/dist/typography/typographyStyles.js.map +1 -1
  577. package/dist/useAsyncFunction.d.ts +20 -0
  578. package/dist/useAsyncFunction.js.map +1 -1
  579. package/dist/useDebouncedFunction.js.map +1 -1
  580. package/dist/useDropzone.d.ts +18 -11
  581. package/dist/useDropzone.js +27 -23
  582. package/dist/useDropzone.js.map +1 -1
  583. package/dist/useElementSize.d.ts +3 -3
  584. package/dist/useElementSize.js +1 -1
  585. package/dist/useElementSize.js.map +1 -1
  586. package/dist/useEnsuredId.d.ts +1 -1
  587. package/dist/useEnsuredId.js +1 -1
  588. package/dist/useEnsuredId.js.map +1 -1
  589. package/dist/useEnsuredRef.d.ts +1 -1
  590. package/dist/useEnsuredRef.js +1 -1
  591. package/dist/useEnsuredRef.js.map +1 -1
  592. package/dist/useEnsuredState.js.map +1 -1
  593. package/dist/useHtmlClassName.d.ts +11 -0
  594. package/dist/useHtmlClassName.js +11 -0
  595. package/dist/useHtmlClassName.js.map +1 -1
  596. package/dist/useIntersectionObserver.d.ts +3 -3
  597. package/dist/useIntersectionObserver.js +2 -2
  598. package/dist/useIntersectionObserver.js.map +1 -1
  599. package/dist/useIsomorphicLayoutEffect.js.map +1 -1
  600. package/dist/useMutationObserver.d.ts +3 -3
  601. package/dist/useMutationObserver.js +4 -4
  602. package/dist/useMutationObserver.js.map +1 -1
  603. package/dist/useOrientation.d.ts +0 -1
  604. package/dist/useOrientation.js +0 -1
  605. package/dist/useOrientation.js.map +1 -1
  606. package/dist/usePageInactive.d.ts +7 -2
  607. package/dist/usePageInactive.js +7 -2
  608. package/dist/usePageInactive.js.map +1 -1
  609. package/dist/useReadonlySet.d.ts +5 -4
  610. package/dist/useReadonlySet.js +4 -3
  611. package/dist/useReadonlySet.js.map +1 -1
  612. package/dist/useResizeListener.d.ts +6 -4
  613. package/dist/useResizeListener.js +6 -4
  614. package/dist/useResizeListener.js.map +1 -1
  615. package/dist/useResizeObserver.d.ts +1 -1
  616. package/dist/useResizeObserver.js +1 -1
  617. package/dist/useResizeObserver.js.map +1 -1
  618. package/dist/useThrottledFunction.js.map +1 -1
  619. package/dist/useToggle.d.ts +3 -3
  620. package/dist/useToggle.js +3 -3
  621. package/dist/useToggle.js.map +1 -1
  622. package/dist/useUnmounted.js.map +1 -1
  623. package/dist/useWindowSize.d.ts +1 -1
  624. package/dist/useWindowSize.js +1 -1
  625. package/dist/useWindowSize.js.map +1 -1
  626. package/dist/utils/RenderRecursively.d.ts +88 -32
  627. package/dist/utils/RenderRecursively.js +88 -32
  628. package/dist/utils/RenderRecursively.js.map +1 -1
  629. package/dist/utils/alphaNumericSort.d.ts +5 -0
  630. package/dist/utils/alphaNumericSort.js +5 -4
  631. package/dist/utils/alphaNumericSort.js.map +1 -1
  632. package/dist/utils/bem.d.ts +49 -6
  633. package/dist/utils/bem.js +5 -14
  634. package/dist/utils/bem.js.map +1 -1
  635. package/dist/utils/getRangeDefaultValue.js.map +1 -1
  636. package/dist/utils/isElementVisible.d.ts +1 -1
  637. package/dist/utils/isElementVisible.js +1 -1
  638. package/dist/utils/isElementVisible.js.map +1 -1
  639. package/dist/utils/loop.d.ts +2 -0
  640. package/dist/utils/loop.js.map +1 -1
  641. package/dist/utils/parseCssLengthUnit.d.ts +1 -1
  642. package/dist/utils/parseCssLengthUnit.js.map +1 -1
  643. package/dist/utils/wait.d.ts +4 -4
  644. package/dist/utils/wait.js +6 -4
  645. package/dist/utils/wait.js.map +1 -1
  646. package/dist/window-splitter/WindowSplitter.js.map +1 -1
  647. package/dist/window-splitter/styles.js.map +1 -1
  648. package/dist/window-splitter/useWindowSplitter.d.ts +4 -1
  649. package/dist/window-splitter/useWindowSplitter.js +4 -1
  650. package/dist/window-splitter/useWindowSplitter.js.map +1 -1
  651. package/package.json +26 -22
  652. package/src/CoreProviders.tsx +8 -6
  653. package/src/NoSsr.tsx +3 -1
  654. package/src/RootHtml.tsx +1 -0
  655. package/src/SsrProvider.tsx +3 -2
  656. package/src/app-bar/AppBar.tsx +3 -2
  657. package/src/app-bar/AppBarTitle.tsx +1 -0
  658. package/src/app-bar/styles.ts +1 -0
  659. package/src/autocomplete/Autocomplete.tsx +2 -0
  660. package/src/autocomplete/AutocompleteChip.tsx +2 -1
  661. package/src/autocomplete/AutocompleteCircularProgress.tsx +1 -0
  662. package/src/autocomplete/AutocompleteClearButton.tsx +3 -1
  663. package/src/autocomplete/AutocompleteDropdownButton.tsx +3 -1
  664. package/src/autocomplete/AutocompleteListboxChildren.tsx +2 -0
  665. package/src/autocomplete/autocompleteStyles.ts +1 -0
  666. package/src/autocomplete/types.ts +1 -0
  667. package/src/autocomplete/useAutocomplete.ts +4 -2
  668. package/src/autocomplete/utils.ts +1 -0
  669. package/src/avatar/Avatar.tsx +3 -2
  670. package/src/avatar/styles.ts +2 -1
  671. package/src/badge/Badge.tsx +3 -2
  672. package/src/badge/styles.ts +1 -0
  673. package/src/box/Box.tsx +5 -2
  674. package/src/box/styles.ts +17 -2
  675. package/src/button/AsyncButton.tsx +3 -1
  676. package/src/button/Button.tsx +4 -2
  677. package/src/button/ButtonUnstyled.tsx +2 -1
  678. package/src/button/FloatingActionButton.tsx +2 -1
  679. package/src/button/TooltippedButton.tsx +4 -2
  680. package/src/button/buttonStyles.ts +2 -1
  681. package/src/card/Card.tsx +10 -23
  682. package/src/card/CardContent.tsx +3 -2
  683. package/src/card/CardFooter.tsx +1 -0
  684. package/src/card/CardHeader.tsx +2 -1
  685. package/src/card/CardSubtitle.tsx +1 -0
  686. package/src/card/CardTitle.tsx +1 -0
  687. package/src/card/ClickableCard.tsx +3 -1
  688. package/src/card/styles.ts +1 -0
  689. package/src/chip/Chip.tsx +4 -2
  690. package/src/chip/styles.ts +1 -0
  691. package/src/dialog/Dialog.tsx +10 -6
  692. package/src/dialog/DialogContent.tsx +3 -2
  693. package/src/dialog/DialogFooter.tsx +3 -2
  694. package/src/dialog/DialogHeader.tsx +2 -1
  695. package/src/dialog/DialogTitle.tsx +2 -1
  696. package/src/dialog/FixedDialog.tsx +14 -9
  697. package/src/dialog/NestedDialogProvider.ts +1 -0
  698. package/src/dialog/styles.ts +5 -4
  699. package/src/divider/Divider.tsx +3 -2
  700. package/src/divider/styles.ts +1 -0
  701. package/src/draggable/useDraggable.ts +25 -12
  702. package/src/draggable/utils.ts +2 -1
  703. package/src/expansion-panel/ExpansionList.tsx +3 -1
  704. package/src/expansion-panel/ExpansionPanel.tsx +3 -1
  705. package/src/expansion-panel/ExpansionPanelHeader.tsx +3 -2
  706. package/src/expansion-panel/expansionPanelStyles.ts +1 -0
  707. package/src/expansion-panel/useExpansionList.ts +2 -0
  708. package/src/expansion-panel/useExpansionPanels.ts +1 -0
  709. package/src/files/FileInput.tsx +4 -2
  710. package/src/files/styles.ts +1 -0
  711. package/src/files/useFileUpload.ts +7 -5
  712. package/src/files/utils.ts +31 -1
  713. package/src/focus/useFocusContainer.ts +10 -10
  714. package/src/form/Checkbox.tsx +2 -1
  715. package/src/form/Fieldset.tsx +2 -1
  716. package/src/form/Form.tsx +2 -1
  717. package/src/form/FormMessage.tsx +1 -0
  718. package/src/form/FormMessageContainer.tsx +2 -1
  719. package/src/form/FormMessageCounter.tsx +1 -0
  720. package/src/form/InputToggle.tsx +3 -1
  721. package/src/form/InputToggleIcon.tsx +4 -3
  722. package/src/form/Label.tsx +1 -0
  723. package/src/form/Legend.tsx +1 -0
  724. package/src/form/Listbox.tsx +1 -0
  725. package/src/form/ListboxProvider.ts +2 -0
  726. package/src/form/MenuItemCheckbox.tsx +5 -3
  727. package/src/form/MenuItemFileInput.tsx +25 -13
  728. package/src/form/MenuItemInputToggle.tsx +3 -1
  729. package/src/form/MenuItemRadio.tsx +4 -2
  730. package/src/form/MenuItemSwitch.tsx +2 -0
  731. package/src/form/MenuItemTextField.tsx +3 -1
  732. package/src/form/NativeSelect.tsx +3 -2
  733. package/src/form/OptGroup.tsx +3 -1
  734. package/src/form/Option.tsx +6 -4
  735. package/src/form/Password.tsx +5 -3
  736. package/src/form/Radio.tsx +2 -0
  737. package/src/form/ResizingTextAreaWrapper.tsx +2 -1
  738. package/src/form/Select.tsx +6 -4
  739. package/src/form/SelectedOption.tsx +1 -0
  740. package/src/form/Slider.tsx +13 -71
  741. package/src/form/SliderContainer.tsx +2 -1
  742. package/src/form/SliderMark.tsx +1 -0
  743. package/src/form/SliderMarkLabel.tsx +2 -1
  744. package/src/form/SliderThumb.tsx +6 -3
  745. package/src/form/SliderTrack.tsx +4 -3
  746. package/src/form/SliderValueMarks.tsx +3 -2
  747. package/src/form/SliderValueTooltip.tsx +2 -0
  748. package/src/form/Switch.tsx +2 -1
  749. package/src/form/SwitchTrack.tsx +2 -1
  750. package/src/form/TextArea.tsx +4 -2
  751. package/src/form/TextField.tsx +2 -1
  752. package/src/form/TextFieldAddon.tsx +1 -0
  753. package/src/form/TextFieldContainer.tsx +3 -1
  754. package/src/form/formMessageContainerStyles.ts +1 -0
  755. package/src/form/formMessageStyles.ts +1 -0
  756. package/src/form/inputToggleStyles.ts +1 -0
  757. package/src/form/menuItemInputToggleStyles.ts +1 -0
  758. package/src/form/nativeSelectStyles.ts +1 -0
  759. package/src/form/optionStyles.ts +1 -0
  760. package/src/form/passwordStyles.ts +1 -0
  761. package/src/form/selectStyles.ts +1 -0
  762. package/src/form/selectUtils.ts +2 -1
  763. package/src/form/sliderUtils.ts +8 -7
  764. package/src/form/switchStyles.ts +1 -0
  765. package/src/form/textAreaStyles.ts +2 -1
  766. package/src/form/textFieldContainerStyles.ts +2 -1
  767. package/src/form/textFieldStyles.ts +1 -0
  768. package/src/form/types.ts +1 -0
  769. package/src/form/useCheckboxGroup.ts +4 -2
  770. package/src/form/useCombobox.ts +4 -2
  771. package/src/form/useEditableCombobox.ts +2 -0
  772. package/src/form/useFormReset.ts +4 -2
  773. package/src/form/useNumberField.ts +3 -1
  774. package/src/form/useRadioGroup.ts +5 -3
  775. package/src/form/useRangeSlider.ts +3 -0
  776. package/src/form/useResizingTextArea.ts +5 -3
  777. package/src/form/useSelectCombobox.ts +2 -1
  778. package/src/form/useSlider.ts +3 -3
  779. package/src/form/useSliderDraggable.ts +71 -0
  780. package/src/form/useTextField.ts +40 -26
  781. package/src/form/useTextFieldContainerAddons.ts +4 -2
  782. package/src/form/validation.ts +2 -0
  783. package/src/hoverMode/useHoverMode.ts +76 -4
  784. package/src/hoverMode/useHoverModeProvider.ts +24 -12
  785. package/src/icon/FontIcon.tsx +3 -2
  786. package/src/icon/IconRotator.tsx +5 -4
  787. package/src/icon/MaterialIcon.tsx +3 -2
  788. package/src/icon/MaterialSymbol.tsx +4 -3
  789. package/src/icon/SVGIcon.tsx +3 -2
  790. package/src/icon/TextIconSpacing.tsx +2 -2
  791. package/src/icon/{iconConfig.tsx → config.tsx} +1 -0
  792. package/src/icon/materialConfig.ts +1 -0
  793. package/src/icon/styles.ts +2 -1
  794. package/src/interaction/Ripple.tsx +2 -0
  795. package/src/interaction/RippleContainer.tsx +1 -0
  796. package/src/interaction/UserInteractionModeProvider.tsx +3 -2
  797. package/src/interaction/useElementInteraction.tsx +39 -36
  798. package/src/interaction/useHigherContrastChildren.tsx +11 -8
  799. package/src/interaction/utils.ts +1 -0
  800. package/src/layout/LayoutAppBar.tsx +2 -0
  801. package/src/layout/LayoutNav.tsx +4 -2
  802. package/src/layout/LayoutWindowSplitter.tsx +4 -2
  803. package/src/layout/Main.tsx +4 -2
  804. package/src/layout/layoutNavStyles.ts +1 -0
  805. package/src/layout/layoutWindowSplitterStyles.ts +1 -0
  806. package/src/layout/mainStyles.ts +1 -0
  807. package/src/layout/useExpandableLayout.ts +17 -17
  808. package/src/layout/useHorizontalLayoutTransition.ts +2 -0
  809. package/src/layout/useLayoutAppBarHeight.ts +3 -1
  810. package/src/layout/useLayoutTree.ts +6 -3
  811. package/src/layout/useLayoutWindowSplitter.ts +2 -1
  812. package/src/layout/useMainTabIndex.ts +1 -0
  813. package/src/layout/useResizableLayout.ts +14 -17
  814. package/src/layout/useTemporaryLayout.ts +18 -11
  815. package/src/link/Link.tsx +3 -2
  816. package/src/link/SkipToMainContent.tsx +4 -2
  817. package/src/link/styles.ts +1 -0
  818. package/src/list/List.tsx +2 -1
  819. package/src/list/ListItem.tsx +4 -2
  820. package/src/list/ListItemAddon.tsx +2 -1
  821. package/src/list/ListItemChildren.tsx +1 -0
  822. package/src/list/ListItemLink.tsx +4 -2
  823. package/src/list/ListItemText.tsx +2 -1
  824. package/src/list/ListSubheader.tsx +2 -1
  825. package/src/list/listItemStyles.ts +1 -0
  826. package/src/list/listStyles.ts +1 -0
  827. package/src/list/types.ts +1 -0
  828. package/src/media-queries/AppSizeProvider.tsx +7 -5
  829. package/src/media-queries/useMediaQuery.ts +5 -3
  830. package/src/menu/DropdownMenu.tsx +5 -3
  831. package/src/menu/Menu.tsx +8 -6
  832. package/src/menu/MenuBar.tsx +2 -0
  833. package/src/menu/MenuButton.tsx +3 -1
  834. package/src/menu/MenuConfigurationProvider.tsx +4 -2
  835. package/src/menu/MenuItem.tsx +2 -0
  836. package/src/menu/MenuItemButton.tsx +3 -1
  837. package/src/menu/MenuItemCircularProgress.tsx +2 -1
  838. package/src/menu/MenuItemGroup.tsx +3 -1
  839. package/src/menu/MenuItemSeparator.tsx +3 -1
  840. package/src/menu/MenuSheet.tsx +3 -1
  841. package/src/menu/MenuVisibilityProvider.tsx +4 -2
  842. package/src/menu/MenuWidget.tsx +3 -1
  843. package/src/menu/MenuWidgetKeyboardProvider.tsx +2 -0
  844. package/src/menu/useContextMenu.ts +2 -0
  845. package/src/menu/useMenuBarProvider.ts +2 -0
  846. package/src/movement/types.ts +1 -0
  847. package/src/movement/useKeyboardMovementProvider.ts +2 -0
  848. package/src/movement/utils.ts +1 -0
  849. package/src/navigation/CollapsibleNavGroup.tsx +3 -1
  850. package/src/navigation/DefaultNavigationRenderer.tsx +1 -0
  851. package/src/navigation/NavGroup.tsx +2 -1
  852. package/src/navigation/NavItem.tsx +2 -1
  853. package/src/navigation/NavItemButton.tsx +4 -2
  854. package/src/navigation/NavItemLink.tsx +4 -2
  855. package/src/navigation/NavSubheader.tsx +2 -1
  856. package/src/navigation/Navigation.tsx +3 -2
  857. package/src/navigation/navGroupStyles.ts +1 -0
  858. package/src/navigation/navItemStyles.ts +1 -0
  859. package/src/navigation/types.ts +1 -0
  860. package/src/navigation/useActiveHeadingId.ts +8 -6
  861. package/src/navigation/useNavigationExpansion.ts +2 -0
  862. package/src/navigation/useTableOfContentsHeadings.ts +150 -0
  863. package/src/objectFit.ts +1 -0
  864. package/src/overlay/Overlay.tsx +4 -2
  865. package/src/overlay/overlayStyles.ts +10 -10
  866. package/src/portal/Portal.tsx +1 -0
  867. package/src/portal/PortalContainerProvider.tsx +4 -3
  868. package/src/positioning/createHorizontalPosition.ts +1 -1
  869. package/src/positioning/createVerticalPosition.ts +1 -1
  870. package/src/positioning/useFixedPositioning.ts +17 -12
  871. package/src/progress/CircularProgress.tsx +3 -2
  872. package/src/progress/LinearProgress.tsx +3 -2
  873. package/src/responsive-item/ResponsiveItem.tsx +3 -2
  874. package/src/responsive-item/ResponsiveItemOverlay.tsx +3 -2
  875. package/src/responsive-item/responsiveItemOverlayStyles.ts +1 -0
  876. package/src/responsive-item/responsiveItemStyles.ts +1 -0
  877. package/src/scroll/ScrollLock.tsx +1 -0
  878. package/src/scroll/useScrollLock.ts +3 -1
  879. package/src/searching/fuzzy.ts +1 -1
  880. package/src/searching/useFuzzyMatch.ts +2 -0
  881. package/src/segmented-button/SegmentedButton.tsx +4 -2
  882. package/src/segmented-button/SegmentedButtonContainer.tsx +3 -2
  883. package/src/segmented-button/segmentedButtonContainerStyles.ts +1 -0
  884. package/src/segmented-button/segmentedButtonStyles.ts +1 -0
  885. package/src/sheet/Sheet.tsx +4 -2
  886. package/src/sheet/styles.ts +3 -3
  887. package/src/snackbar/DefaultToastRenderer.tsx +5 -3
  888. package/src/snackbar/Snackbar.tsx +4 -2
  889. package/src/snackbar/Toast.tsx +4 -2
  890. package/src/snackbar/ToastActionButton.tsx +2 -0
  891. package/src/snackbar/ToastCloseButton.tsx +3 -1
  892. package/src/snackbar/ToastContent.tsx +3 -1
  893. package/src/snackbar/ToastManager.tsx +1 -0
  894. package/src/snackbar/ToastManagerProvider.tsx +4 -3
  895. package/src/snackbar/snackbarStyles.ts +1 -0
  896. package/src/snackbar/toastContentStyles.ts +1 -0
  897. package/src/snackbar/toastStyles.ts +2 -1
  898. package/src/snackbar/useCurrentToastActions.ts +1 -0
  899. package/src/storage/internalUtils.ts +43 -0
  900. package/src/storage/types.ts +88 -0
  901. package/src/storage/useStorage.ts +277 -0
  902. package/src/storage/utils.ts +156 -0
  903. package/src/suspense/CircularProgressSuspense.tsx +2 -1
  904. package/src/suspense/NullSuspense.tsx +1 -1
  905. package/src/table/StickyTableSection.tsx +3 -1
  906. package/src/table/Table.tsx +3 -1
  907. package/src/table/TableBody.tsx +3 -1
  908. package/src/table/TableCell.tsx +4 -2
  909. package/src/table/TableCellContent.tsx +2 -1
  910. package/src/table/TableCheckbox.tsx +3 -1
  911. package/src/table/TableConfigurationProvider.tsx +2 -0
  912. package/src/table/TableContainer.tsx +4 -2
  913. package/src/table/TableContainerProvider.tsx +2 -1
  914. package/src/table/TableFooter.tsx +3 -1
  915. package/src/table/TableHeader.tsx +3 -1
  916. package/src/table/TableRadio.tsx +3 -1
  917. package/src/table/TableRow.tsx +3 -1
  918. package/src/table/tableCellStyles.ts +1 -0
  919. package/src/table/tableFooterStyles.ts +1 -0
  920. package/src/table/tableHeaderStyles.ts +1 -0
  921. package/src/table/tableRowStyles.ts +1 -0
  922. package/src/table/tableStyles.ts +1 -0
  923. package/src/table/useStickyTableSection.tsx +4 -2
  924. package/src/table/useTableSectionConfig.ts +2 -0
  925. package/src/tabs/SimpleTabPanel.tsx +35 -0
  926. package/src/tabs/SimpleTabPanels.tsx +28 -0
  927. package/src/tabs/Tab.tsx +4 -3
  928. package/src/tabs/TabList.tsx +38 -51
  929. package/src/tabs/TabListScrollButton.tsx +6 -3
  930. package/src/tabs/tabIndicatorStyles.ts +1 -0
  931. package/src/tabs/tabListScrollButtonStyles.ts +1 -0
  932. package/src/tabs/tabListStyles.ts +22 -2
  933. package/src/tabs/tabStyles.ts +8 -0
  934. package/src/tabs/types.ts +30 -0
  935. package/src/tabs/useMaxTabPanelHeight.ts +138 -0
  936. package/src/tabs/useTabList.ts +45 -8
  937. package/src/tabs/useTabs.ts +64 -79
  938. package/src/tabs/utils.ts +9 -0
  939. package/src/test-utils/drag.ts +10 -2
  940. package/src/test-utils/index.ts +6 -5
  941. package/src/test-utils/jest-globals/index.ts +4 -0
  942. package/src/test-utils/jest-globals/match-media.ts +41 -0
  943. package/src/test-utils/jest-globals/resize-observer.ts +11 -0
  944. package/src/test-utils/{jest-setup.ts → jest-globals/setup.ts} +4 -2
  945. package/src/test-utils/{timers.ts → jest-globals/timers.ts} +2 -2
  946. package/src/test-utils/jest-globals/uploadMenuItemFileInput.ts +52 -0
  947. package/src/test-utils/{ResizeObserver.ts → mocks/ResizeObserver.ts} +25 -59
  948. package/src/test-utils/mocks/match-media-implementation.ts +111 -0
  949. package/src/test-utils/mocks/match-media.ts +63 -0
  950. package/src/test-utils/polyfills/IntersectionObserver.ts +1 -1
  951. package/src/test-utils/polyfills/ResizeObserver.ts +1 -1
  952. package/src/test-utils/polyfills/matchMedia.ts +1 -1
  953. package/src/test-utils/queries/index.ts +2 -0
  954. package/src/test-utils/queries/select.ts +116 -0
  955. package/src/test-utils/queries/slider.ts +247 -0
  956. package/src/test-utils/queries/types.ts +13 -0
  957. package/src/test-utils/render.tsx +2 -1
  958. package/src/test-utils/utils/createFileList.ts +27 -0
  959. package/src/test-utils/utils/createResizeObserverEntry.ts +47 -0
  960. package/src/test-utils/vitest/index.ts +4 -0
  961. package/src/test-utils/vitest/match-media.ts +41 -0
  962. package/src/test-utils/vitest/resize-observer.ts +11 -0
  963. package/src/test-utils/vitest/setup.ts +15 -0
  964. package/src/test-utils/vitest/timers.ts +48 -0
  965. package/src/test-utils/vitest/uploadMenuItemFileInput.ts +52 -0
  966. package/src/theme/LocalStorageColorSchemeProvider.tsx +30 -30
  967. package/src/theme/ThemeProvider.tsx +9 -7
  968. package/src/theme/isColorScheme.ts +8 -6
  969. package/src/theme/types.ts +11 -23
  970. package/src/theme/useCSSVariables.ts +10 -15
  971. package/src/theme/useColorScheme.ts +19 -15
  972. package/src/theme/useColorSchemeMetaTag.ts +17 -2
  973. package/src/theme/useColorSchemeProvider.ts +36 -37
  974. package/src/theme/{usePrefersDarkScheme.ts → usePrefersDarkTheme.ts} +1 -0
  975. package/src/tooltip/Tooltip.tsx +3 -1
  976. package/src/tooltip/TooltipHoverModeProvider.tsx +6 -4
  977. package/src/tooltip/tooltipStyles.ts +2 -1
  978. package/src/tooltip/useTooltip.ts +15 -10
  979. package/src/tooltip/useTooltipPosition.ts +2 -0
  980. package/src/transition/CSSTransition.tsx +3 -1
  981. package/src/transition/Collapse.tsx +4 -2
  982. package/src/transition/CrossFade.tsx +5 -3
  983. package/src/transition/ScaleTransition.tsx +4 -2
  984. package/src/transition/SkeletonPlaceholder.tsx +4 -2
  985. package/src/transition/Slide.tsx +3 -1
  986. package/src/transition/SlideContainer.tsx +2 -1
  987. package/src/transition/collapseStyles.ts +1 -0
  988. package/src/transition/config.ts +4 -1
  989. package/src/transition/maxWidthTransition.ts +7 -0
  990. package/src/transition/skeletonPlaceholderUtils.ts +1 -0
  991. package/src/transition/types.ts +0 -2
  992. package/src/transition/useCSSTransition.ts +10 -4
  993. package/src/transition/useCarousel.ts +2 -0
  994. package/src/transition/useCollapseTransition.ts +20 -14
  995. package/src/transition/useCrossFadeTransition.ts +1 -0
  996. package/src/transition/useMaxWidthTransition.ts +11 -0
  997. package/src/transition/useScaleTransition.ts +12 -10
  998. package/src/transition/useSkeletonPlaceholder.ts +20 -2
  999. package/src/transition/useSlideTransition.ts +14 -16
  1000. package/src/transition/useTransition.ts +3 -1
  1001. package/src/tree/DefaultTreeItemRenderer.tsx +1 -0
  1002. package/src/tree/Tree.tsx +3 -1
  1003. package/src/tree/TreeGroup.tsx +3 -1
  1004. package/src/tree/TreeItem.tsx +4 -2
  1005. package/src/tree/TreeItemExpander.tsx +5 -3
  1006. package/src/tree/TreeProvider.tsx +4 -2
  1007. package/src/tree/styles.ts +1 -0
  1008. package/src/tree/types.ts +1 -0
  1009. package/src/tree/useTree.ts +3 -2
  1010. package/src/tree/useTreeExpansion.ts +1 -0
  1011. package/src/tree/useTreeItems.ts +4 -3
  1012. package/src/tree/useTreeMovement.ts +2 -0
  1013. package/src/tree/useTreeSelection.ts +1 -0
  1014. package/src/typography/SrOnly.tsx +2 -1
  1015. package/src/typography/TextContainer.tsx +3 -2
  1016. package/src/typography/Typography.tsx +3 -2
  1017. package/src/typography/WritingDirectionProvider.tsx +4 -2
  1018. package/src/typography/textContainerStyles.ts +1 -0
  1019. package/src/typography/typographyStyles.ts +2 -1
  1020. package/src/useAsyncFunction.ts +23 -0
  1021. package/src/useDebouncedFunction.ts +2 -0
  1022. package/src/useDropzone.ts +50 -34
  1023. package/src/useElementSize.ts +7 -5
  1024. package/src/useEnsuredId.ts +1 -1
  1025. package/src/useEnsuredRef.ts +3 -1
  1026. package/src/useEnsuredState.ts +1 -0
  1027. package/src/useHtmlClassName.ts +12 -0
  1028. package/src/useIntersectionObserver.ts +5 -3
  1029. package/src/useIsomorphicLayoutEffect.ts +1 -0
  1030. package/src/useMutationObserver.ts +7 -6
  1031. package/src/useOrientation.ts +1 -1
  1032. package/src/usePageInactive.ts +8 -2
  1033. package/src/useReadonlySet.ts +7 -4
  1034. package/src/useResizeListener.ts +8 -4
  1035. package/src/useResizeObserver.ts +4 -3
  1036. package/src/useThrottledFunction.ts +2 -0
  1037. package/src/useToggle.ts +5 -3
  1038. package/src/useUnmounted.ts +2 -0
  1039. package/src/useWindowSize.ts +4 -2
  1040. package/src/utils/RenderRecursively.tsx +88 -32
  1041. package/src/utils/alphaNumericSort.ts +10 -4
  1042. package/src/utils/bem.ts +58 -26
  1043. package/src/utils/getRangeDefaultValue.ts +1 -1
  1044. package/src/utils/isElementVisible.ts +1 -1
  1045. package/src/utils/loop.ts +2 -0
  1046. package/src/utils/parseCssLengthUnit.ts +1 -1
  1047. package/src/utils/wait.ts +6 -5
  1048. package/src/window-splitter/WindowSplitter.tsx +2 -2
  1049. package/src/window-splitter/styles.ts +1 -0
  1050. package/src/window-splitter/useWindowSplitter.ts +7 -2
  1051. package/dist/icon/iconConfig.js.map +0 -1
  1052. package/dist/test-utils/IntersectionObserver.js.map +0 -1
  1053. package/dist/test-utils/ResizeObserver.js.map +0 -1
  1054. package/dist/test-utils/jest-setup.d.ts +0 -1
  1055. package/dist/test-utils/jest-setup.js.map +0 -1
  1056. package/dist/test-utils/matchMedia.d.ts +0 -97
  1057. package/dist/test-utils/matchMedia.js +0 -112
  1058. package/dist/test-utils/matchMedia.js.map +0 -1
  1059. package/dist/test-utils/timers.js.map +0 -1
  1060. package/dist/theme/usePrefersDarkScheme.js.map +0 -1
  1061. package/dist/useLocalStorage.d.ts +0 -368
  1062. package/dist/useLocalStorage.js +0 -377
  1063. package/dist/useLocalStorage.js.map +0 -1
  1064. package/src/test-utils/README.md +0 -150
  1065. package/src/test-utils/matchMedia.ts +0 -194
  1066. package/src/useLocalStorage.ts +0 -584
  1067. /package/dist/icon/{iconConfig.d.ts → config.d.ts} +0 -0
  1068. /package/dist/test-utils/{IntersectionObserver.d.ts → mocks/IntersectionObserver.d.ts} +0 -0
  1069. /package/dist/test-utils/{IntersectionObserver.js → mocks/IntersectionObserver.js} +0 -0
  1070. /package/dist/theme/{usePrefersDarkScheme.d.ts → usePrefersDarkTheme.d.ts} +0 -0
  1071. /package/src/test-utils/{IntersectionObserver.ts → mocks/IntersectionObserver.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/media-queries/AppSizeProvider.tsx"],"sourcesContent":["\"use client\";\nimport {\n createContext,\n useContext,\n useMemo,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { useSsr } from \"../SsrProvider.js\";\nimport { useOrientation } from \"../useOrientation.js\";\nimport {\n DEFAULT_APP_SIZE,\n DEFAULT_DESKTOP_LARGE_MIN_WIDTH,\n DEFAULT_DESKTOP_MIN_WIDTH,\n DEFAULT_PHONE_MAX_WIDTH,\n DEFAULT_TABLET_MAX_WIDTH,\n DEFAULT_TABLET_MIN_WIDTH,\n type AppSize,\n type AppSizeQueries,\n} from \"./appSize.js\";\nimport { useMediaQuery } from \"./useMediaQuery.js\";\n\n/** @internal */\ninterface AppSizeContext extends AppSize {\n __root: boolean;\n}\n\nconst context = createContext<AppSizeContext>({\n __root: false,\n isPhone: false,\n isTablet: false,\n isDesktop: true,\n isLargeDesktop: false,\n isLandscape: true,\n});\ncontext.displayName = \"AppSize\";\nconst { Provider } = context;\n\n/**\n * **Note**: The app size object returned by this hook will **not** be equal\n * between renders.\n *\n * @example Simple Example\n * ```tsx\n * import { useAppSize } from \"@react-md/core\";\n *\n * function Example() {\n * const { isPhone, isTablet, isDesktop, isLargeDesktop, isLandscape } =\n * useAppSize()\n *\n * // do something based on the app size\n * return null;\n * }\n * ```\n *\n * @returns the current app size.\n * @throws \"The `AppSizeProvider` has not been mounted.\"\n */\nexport function useAppSize(): Readonly<AppSize> {\n const { __root, ...appSize } = useContext(context);\n if (!__root) {\n throw new Error(\"The `AppSizeProvider` has not been mounted.\");\n }\n\n return appSize;\n}\n\n/**\n * @since 6.0.0 Renamed from `AppSizeListenerProps`.\n * @since 6.0.0 Removed the `onChange` prop\n * @since 6.0.0 Renamed `defaultSize` to `ssrSize`\n */\nexport interface AppSizeProviderProps extends AppSizeQueries {\n /**\n * @defaultValue `DEFAULT_APP_SIZE`\n * @see {@link DEFAULT_APP_SIZE}\n * @since 6.0.0\n */\n ssrSize?: Readonly<AppSize>;\n children: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * This component should be mounted near the root of your app to determine the\n * current app size based on different media queries.\n *\n * @since 6.0.0 Renamed from `AppSizeListener`\n */\nexport function AppSizeProvider(props: AppSizeProviderProps): ReactElement {\n const {\n ssrSize = DEFAULT_APP_SIZE,\n phoneMaxWidth = DEFAULT_PHONE_MAX_WIDTH,\n tabletMinWidth = DEFAULT_TABLET_MIN_WIDTH,\n tabletMaxWidth = DEFAULT_TABLET_MAX_WIDTH,\n desktopMinWidth = DEFAULT_DESKTOP_MIN_WIDTH,\n desktopLargeMinWidth = DEFAULT_DESKTOP_LARGE_MIN_WIDTH,\n children,\n } = props;\n const { __root } = useContext(context);\n if (__root) {\n throw new Error(\"The `AppSizeProvider` cannot be mounted multiple times.\");\n }\n\n const ssr = useSsr();\n const matchesDesktop = useMediaQuery(\n `screen and (min-width: ${desktopMinWidth})`\n );\n const matchesLargeDesktop = useMediaQuery(\n `screen and (min-width: ${desktopLargeMinWidth})`\n );\n const matchesTablet = useMediaQuery(\n `screen and (min-width: ${tabletMinWidth}) and (max-width: ${tabletMaxWidth})`\n );\n const matchesPhone = useMediaQuery(\n `screen and (max-width: ${phoneMaxWidth})`\n );\n const isDesktop = matchesDesktop;\n const isTablet = !matchesDesktop && matchesTablet;\n const isPhone = !isTablet && !isDesktop && matchesPhone;\n const isLandscape = useOrientation().includes(\"landscape\");\n const isLargeDesktop = matchesLargeDesktop;\n\n const appSize = useMemo<AppSizeContext>(\n () => ({\n __root: true,\n isPhone,\n isTablet,\n isDesktop,\n isLargeDesktop,\n isLandscape,\n }),\n [isDesktop, isLandscape, isLargeDesktop, isPhone, isTablet]\n );\n\n let value = appSize;\n if (ssr || typeof window === \"undefined\") {\n value = {\n __root: true,\n ...ssrSize,\n };\n }\n\n return <Provider value={value}>{children}</Provider>;\n}\n"],"names":["createContext","useContext","useMemo","useSsr","useOrientation","DEFAULT_APP_SIZE","DEFAULT_DESKTOP_LARGE_MIN_WIDTH","DEFAULT_DESKTOP_MIN_WIDTH","DEFAULT_PHONE_MAX_WIDTH","DEFAULT_TABLET_MAX_WIDTH","DEFAULT_TABLET_MIN_WIDTH","useMediaQuery","context","__root","isPhone","isTablet","isDesktop","isLargeDesktop","isLandscape","displayName","Provider","useAppSize","appSize","Error","AppSizeProvider","props","ssrSize","phoneMaxWidth","tabletMinWidth","tabletMaxWidth","desktopMinWidth","desktopLargeMinWidth","children","ssr","matchesDesktop","matchesLargeDesktop","matchesTablet","matchesPhone","includes","value","window"],"mappings":"AAAA;;AACA,SACEA,aAAa,EACbC,UAAU,EACVC,OAAO,QAGF,QAAQ;AACf,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SACEC,gBAAgB,EAChBC,+BAA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E;IACpC,MAAMtB,UAAU,CAACC,YAAY,CAACC,aAAaqB;IAC3C,MAAMnB,cAAcd,iBAAiBkC,QAAQ,CAAC;IAC9C,MAAMrB,iBAAiBkB;IAEvB,MAAMb,UAAUpB,QACd,IAAO,CAAA;YACLW,QAAQ;YACRC;YACAC;YACAC;YACAC;YACAC;QACF,CAAA,GACA;QAACF;QAAWE;QAAaD;QAAgBH;QAASC;KAAS;IAG7D,IAAIwB,QAAQjB;IACZ,IAAIW,OAAO,OAAOO,WAAW,aAAa;QACxCD,QAAQ;YACN1B,QAAQ;YACR,GAAGa,OAAO;QACZ;IACF;IAEA,qBAAO,KAACN;QAASmB,OAAOA;kBAAQP;;AAClC"}
1
+ {"version":3,"sources":["../../src/media-queries/AppSizeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ReactElement,\n type ReactNode,\n createContext,\n useContext,\n useMemo,\n} from \"react\";\n\nimport { useSsr } from \"../SsrProvider.js\";\nimport { useOrientation } from \"../useOrientation.js\";\nimport {\n type AppSize,\n type AppSizeQueries,\n DEFAULT_APP_SIZE,\n DEFAULT_DESKTOP_LARGE_MIN_WIDTH,\n DEFAULT_DESKTOP_MIN_WIDTH,\n DEFAULT_PHONE_MAX_WIDTH,\n DEFAULT_TABLET_MAX_WIDTH,\n DEFAULT_TABLET_MIN_WIDTH,\n} from \"./appSize.js\";\nimport { useMediaQuery } from \"./useMediaQuery.js\";\n\n/** @internal */\ninterface AppSizeContext extends AppSize {\n __root: boolean;\n}\n\nconst context = createContext<AppSizeContext>({\n __root: false,\n isPhone: false,\n isTablet: false,\n isDesktop: true,\n isLargeDesktop: false,\n isLandscape: true,\n});\ncontext.displayName = \"AppSize\";\nconst { Provider } = context;\n\n/**\n * **Note**: The app size object returned by this hook will **not** be equal\n * between renders.\n *\n * @example Simple Example\n * ```tsx\n * import { useAppSize } from \"@react-md/core/media-queries/AppSizeProvider\";\n *\n * function Example() {\n * const { isPhone, isTablet, isDesktop, isLargeDesktop, isLandscape } =\n * useAppSize()\n *\n * // do something based on the app size\n * return null;\n * }\n * ```\n *\n * @returns the current app size.\n * @throws \"The `AppSizeProvider` has not been mounted.\"\n */\nexport function useAppSize(): Readonly<AppSize> {\n const { __root, ...appSize } = useContext(context);\n if (!__root) {\n throw new Error(\"The `AppSizeProvider` has not been mounted.\");\n }\n\n return appSize;\n}\n\n/**\n * @since 6.0.0 Renamed from `AppSizeListenerProps`.\n * @since 6.0.0 Removed the `onChange` prop\n * @since 6.0.0 Renamed `defaultSize` to `ssrSize`\n */\nexport interface AppSizeProviderProps extends AppSizeQueries {\n /**\n * @defaultValue `DEFAULT_APP_SIZE`\n * @see {@link DEFAULT_APP_SIZE}\n * @since 6.0.0\n */\n ssrSize?: Readonly<AppSize>;\n children: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * This component should be mounted near the root of your app to determine the\n * current app size based on different media queries.\n *\n * @since 6.0.0 Renamed from `AppSizeListener`\n */\nexport function AppSizeProvider(props: AppSizeProviderProps): ReactElement {\n const {\n ssrSize = DEFAULT_APP_SIZE,\n phoneMaxWidth = DEFAULT_PHONE_MAX_WIDTH,\n tabletMinWidth = DEFAULT_TABLET_MIN_WIDTH,\n tabletMaxWidth = DEFAULT_TABLET_MAX_WIDTH,\n desktopMinWidth = DEFAULT_DESKTOP_MIN_WIDTH,\n desktopLargeMinWidth = DEFAULT_DESKTOP_LARGE_MIN_WIDTH,\n children,\n } = props;\n const { __root } = useContext(context);\n if (__root) {\n throw new Error(\"The `AppSizeProvider` cannot be mounted multiple times.\");\n }\n\n const ssr = useSsr();\n const matchesDesktop = useMediaQuery(\n `screen and (min-width: ${desktopMinWidth})`\n );\n const matchesLargeDesktop = useMediaQuery(\n `screen and (min-width: ${desktopLargeMinWidth})`\n );\n const matchesTablet = useMediaQuery(\n `screen and (min-width: ${tabletMinWidth}) and (max-width: ${tabletMaxWidth})`\n );\n const matchesPhone = useMediaQuery(\n `screen and (max-width: ${phoneMaxWidth})`\n );\n const isDesktop = matchesDesktop;\n const isTablet = !matchesDesktop && matchesTablet;\n const isPhone = !isTablet && !isDesktop && matchesPhone;\n const isLandscape = useOrientation().includes(\"landscape\");\n const isLargeDesktop = matchesLargeDesktop;\n\n const appSize = useMemo<AppSizeContext>(\n () => ({\n __root: true,\n isPhone,\n isTablet,\n isDesktop,\n isLargeDesktop,\n isLandscape,\n }),\n [isDesktop, isLandscape, isLargeDesktop, isPhone, isTablet]\n );\n\n let value = appSize;\n if (ssr || typeof window === \"undefined\") {\n value = {\n __root: true,\n ...ssrSize,\n };\n }\n\n return <Provider value={value}>{children}</Provider>;\n}\n"],"names":["createContext","useContext","useMemo","useSsr","useOrientation","DEFAULT_APP_SIZE","DEFAULT_DESKTOP_LARGE_MIN_WIDTH","DEFAULT_DESKTOP_MIN_WIDTH","DEFAULT_PHONE_MAX_WIDTH","DEFAULT_TABLET_MAX_WIDTH","DEFAULT_TABLET_MIN_WIDTH","useMediaQuery","context","__root","isPhone","isTablet","isDesktop","isLargeDesktop","isLandscape","displayName","Provider","useAppSize","appSize","Error","AppSizeProvider","props","ssrSize","phoneMaxWidth","tabletMinWidth","tabletMaxWidth","desktopMinWidth","desktopLargeMinWidth","children","ssr","matchesDesktop","matchesLargeDesktop","matchesTablet","matchesPhone","includes","value","window"],"mappings":"AAAA;;AAEA,SAGEA,aAAa,EACbC,UAAU,EACVC,OAAO,QACF,QAAQ;AAEf,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAGEC,gBAAgB,EAChBC,+BAA+B,EAC/BC,yBAAyB,EACzBC,uBAAuB,EACvBC,wBAAwB,EACxBC,wBAAwB,QACnB,eAAe;AACtB,SAASC,aAAa,QAAQ,qBAAqB;AAOnD,MAAMC,wBAAUZ,cAA8B;IAC5Ca,QAAQ;IACRC,SAAS;IACTC,UAAU;IACVC,WAAW;IACXC,gBAAgB;IAChBC,aAAa;AACf;AACAN,QAAQO,WAAW,GAAG;AACtB,MAAM,EAAEC,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B,QAAQjB;IACZ,IAAIW,OAAO,OAAOO,WAAW,aAAa;QACxCD,QAAQ;YACN1B,QAAQ;YACR,GAAGa,OAAO;QACZ;IACF;IAEA,qBAAO,KAACN;QAASmB,OAAOA;kBAAQP;;AAClC"}
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @example Simple Example
3
3
  * ```tsx
4
- * import { useMediaQuery } from "@react-md/core";
5
- * import type { ReactElement } from "react";
4
+ * import { useMediaQuery } from "@react-md/core/media-queries/useMediaQuery";
5
+ * import { type ReactElement } from "react";
6
6
  *
7
7
  * function Example(): ReactElement {
8
8
  * const matches = useMediaQuery("screen and (min-width: 768px)");
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @param query - The media query to use
15
15
  * @param disabled - When `true`, the `window.matchMedia` API will not be
16
- * activated and the hook will always return `false`.
16
+ * activated and the hook will return the last cached value.
17
17
  * @returns `true` if the media query matches
18
18
  * @since 6.0.0 Removed the `defaultValue` and `checkImmediately` options.
19
19
  */
@@ -4,8 +4,8 @@ import { useSsr } from "../SsrProvider.js";
4
4
  /**
5
5
  * @example Simple Example
6
6
  * ```tsx
7
- * import { useMediaQuery } from "@react-md/core";
8
- * import type { ReactElement } from "react";
7
+ * import { useMediaQuery } from "@react-md/core/media-queries/useMediaQuery";
8
+ * import { type ReactElement } from "react";
9
9
  *
10
10
  * function Example(): ReactElement {
11
11
  * const matches = useMediaQuery("screen and (min-width: 768px)");
@@ -16,7 +16,7 @@ import { useSsr } from "../SsrProvider.js";
16
16
  *
17
17
  * @param query - The media query to use
18
18
  * @param disabled - When `true`, the `window.matchMedia` API will not be
19
- * activated and the hook will always return `false`.
19
+ * activated and the hook will return the last cached value.
20
20
  * @returns `true` if the media query matches
21
21
  * @since 6.0.0 Removed the `defaultValue` and `checkImmediately` options.
22
22
  */ export function useMediaQuery(query, disabled = false) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/media-queries/useMediaQuery.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useState } from \"react\";\nimport { useSsr } from \"../SsrProvider.js\";\n\n/**\n * @example Simple Example\n * ```tsx\n * import { useMediaQuery } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const matches = useMediaQuery(\"screen and (min-width: 768px)\");\n *\n * return <>{matches ? \"Matches\" : \"Doesn't\"}</>;\n * }\n * ```\n *\n * @param query - The media query to use\n * @param disabled - When `true`, the `window.matchMedia` API will not be\n * activated and the hook will always return `false`.\n * @returns `true` if the media query matches\n * @since 6.0.0 Removed the `defaultValue` and `checkImmediately` options.\n */\nexport function useMediaQuery(query: string, disabled = false): boolean {\n const ssr = useSsr();\n const [matches, setMatches] = useState(() => {\n if (typeof window === \"undefined\" || disabled || ssr) {\n return false;\n }\n\n return window.matchMedia(query).matches;\n });\n\n useEffect(() => {\n if (disabled || ssr) {\n return;\n }\n\n const result = window.matchMedia(query);\n setMatches(result.matches);\n\n const updater = ({ matches }: MediaQueryListEvent): void => {\n setMatches(matches);\n };\n\n result.addEventListener(\"change\", updater);\n return () => {\n result.removeEventListener(\"change\", updater);\n };\n }, [disabled, query, ssr]);\n\n return matches;\n}\n"],"names":["useEffect","useState","useSsr","useMediaQuery","query","disabled","ssr","matches","setMatches","window","matchMedia","result","updater","addEventListener","removeEventListener"],"mappings":"AAAA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAC5C,SAASC,MAAM,QAAQ,oBAAoB;AAE3C;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,cAAcC,KAAa,EAAEC,WAAW,KAAK;IAC3D,MAAMC,MAAMJ;IACZ,MAAM,CAACK,SAASC,WAAW,GAAGP,SAAS;QACrC,IAAI,OAAOQ,WAAW,eAAeJ,YAAYC,KAAK;YACpD,OAAO;QACT;QAEA,OAAOG,OAAOC,UAAU,CAACN,OAAOG,OAAO;IACzC;IAEAP,UAAU;QACR,IAAIK,YAAYC,KAAK;YACnB;QACF;QAEA,MAAMK,SAASF,OAAOC,UAAU,CAACN;QACjCI,WAAWG,OAAOJ,OAAO;QAEzB,MAAMK,UAAU,CAAC,EAAEL,OAAO,EAAuB;YAC/CC,WAAWD;QACb;QAEAI,OAAOE,gBAAgB,CAAC,UAAUD;QAClC,OAAO;YACLD,OAAOG,mBAAmB,CAAC,UAAUF;QACvC;IACF,GAAG;QAACP;QAAUD;QAAOE;KAAI;IAEzB,OAAOC;AACT"}
1
+ {"version":3,"sources":["../../src/media-queries/useMediaQuery.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nimport { useSsr } from \"../SsrProvider.js\";\n\n/**\n * @example Simple Example\n * ```tsx\n * import { useMediaQuery } from \"@react-md/core/media-queries/useMediaQuery\";\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const matches = useMediaQuery(\"screen and (min-width: 768px)\");\n *\n * return <>{matches ? \"Matches\" : \"Doesn't\"}</>;\n * }\n * ```\n *\n * @param query - The media query to use\n * @param disabled - When `true`, the `window.matchMedia` API will not be\n * activated and the hook will return the last cached value.\n * @returns `true` if the media query matches\n * @since 6.0.0 Removed the `defaultValue` and `checkImmediately` options.\n */\nexport function useMediaQuery(query: string, disabled = false): boolean {\n const ssr = useSsr();\n const [matches, setMatches] = useState(() => {\n if (typeof window === \"undefined\" || disabled || ssr) {\n return false;\n }\n\n return window.matchMedia(query).matches;\n });\n\n useEffect(() => {\n if (disabled || ssr) {\n return;\n }\n\n const result = window.matchMedia(query);\n setMatches(result.matches);\n\n const updater = ({ matches }: MediaQueryListEvent): void => {\n setMatches(matches);\n };\n\n result.addEventListener(\"change\", updater);\n return () => {\n result.removeEventListener(\"change\", updater);\n };\n }, [disabled, query, ssr]);\n\n return matches;\n}\n"],"names":["useEffect","useState","useSsr","useMediaQuery","query","disabled","ssr","matches","setMatches","window","matchMedia","result","updater","addEventListener","removeEventListener"],"mappings":"AAAA;AAEA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAE5C,SAASC,MAAM,QAAQ,oBAAoB;AAE3C;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,cAAcC,KAAa,EAAEC,WAAW,KAAK;IAC3D,MAAMC,MAAMJ;IACZ,MAAM,CAACK,SAASC,WAAW,GAAGP,SAAS;QACrC,IAAI,OAAOQ,WAAW,eAAeJ,YAAYC,KAAK;YACpD,OAAO;QACT;QAEA,OAAOG,OAAOC,UAAU,CAACN,OAAOG,OAAO;IACzC;IAEAP,UAAU;QACR,IAAIK,YAAYC,KAAK;YACnB;QACF;QAEA,MAAMK,SAASF,OAAOC,UAAU,CAACN;QACjCI,WAAWG,OAAOJ,OAAO;QAEzB,MAAMK,UAAU,CAAC,EAAEL,OAAO,EAAuB;YAC/CC,WAAWD;QACb;QAEAI,OAAOE,gBAAgB,CAAC,UAAUD;QAClC,OAAO;YACLD,OAAOG,mBAAmB,CAAC,UAAUF;QACvC;IACF,GAAG;QAACP;QAAUD;QAAOE;KAAI;IAEzB,OAAOC;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/DropdownMenu.tsx"],"sourcesContent":["\"use client\";\nimport {\n useCallback,\n useRef,\n type ReactElement,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { getLastFocusableIndex } from \"../movement/utils.js\";\nimport { type UseStateSetter } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useEnsuredState } from \"../useEnsuredState.js\";\nimport {\n Menu,\n type MenuConvenienceProps,\n type MenuListConvenienceProps,\n} from \"./Menu.js\";\nimport { MenuButton, type MenuButtonProps } from \"./MenuButton.js\";\nimport {\n MenuConfigurationProvider,\n type MenuConfiguration,\n} from \"./MenuConfigurationProvider.js\";\nimport { MenuItemButton, type MenuItemButtonProps } from \"./MenuItemButton.js\";\nimport { type MenuSheetConvenienceProps } from \"./MenuSheet.js\";\nimport { MenuVisibilityProvider } from \"./MenuVisibilityProvider.js\";\nimport { useMenuBarContext } from \"./useMenuBarProvider.js\";\n\nexport interface BaseDropdownMenuProps\n extends MenuConfiguration,\n MenuListConvenienceProps,\n MenuSheetConvenienceProps,\n MenuConvenienceProps {\n buttonChildren: ReactNode;\n}\n\nexport interface DropdownMenuButtonProps\n extends MenuButtonProps,\n BaseDropdownMenuProps {}\n\nexport interface DropdownMenuItemButtonProps\n extends MenuItemButtonProps,\n BaseDropdownMenuProps {}\n\n/**\n * @since 6.0.0\n */\nexport interface DropdownMenuStateProps {\n visible: boolean;\n setVisible: UseStateSetter<boolean>;\n}\n\n/**\n * @since 5.0.0\n * @since 6.0.0 Updated to use an `&` instead of `|` to allow autocompletion to\n * work better by default. It's up to the user to make sure they don't provide\n * incorrect props.\n */\nexport type DropdownMenuProps = DropdownMenuButtonProps &\n DropdownMenuItemButtonProps &\n (DropdownMenuStateProps | { visible?: never; setVisible?: never });\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { DropdownMenu, MenuItem } from \"@react-md/core\";\n *\n * function Example() {\n * return (\n * <DropdownMenu buttonChildren=\"Dropdown\">\n * <MenuItem onClick={() => console.log('Clicked Item 1')}>\n * Item 1\n * </MenuItem>\n * <MenuItem onClick={() => console.log('Clicked Item 2')}>\n * Item 2\n * </MenuItem>\n * </DropdownMenu>\n * );\n * }\n * ```\n *\n * @example Nested Dropdown Menus\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { DropdownMenu, MenuItem } from \"@react-md/core\";\n *\n * function Example() {\n * return (\n * <DropdownMenu buttonChildren=\"Dropdown\">\n * <MenuItem onClick={() => console.log('Clicked Item 1')}>\n * Item 1\n * </MenuItem>\n * <MenuItem onClick={() => console.log('Clicked Item 2')}>\n * Item 2\n * </MenuItem>\n * <DropdownMenu buttonChildren=\"Nested Dropdown\">\n * <MenuItem onClick={() => console.log('Clicked Item 1')}>\n * Nested Item 1\n * </MenuItem>\n * <MenuItem onClick={() => console.log('Clicked Item 2')}>\n * Nested Item 2\n * </MenuItem>\n * </DropdownMenu>\n * </DropdownMenu>\n * );\n * }\n * ```\n *\n * @since 5.0.0\n * @since 6.0.0 Updated to use the latest menu API.\n */\nexport function DropdownMenu(props: DropdownMenuProps): ReactElement {\n const {\n id: propId,\n horizontal,\n sheetHeader,\n sheetFooter,\n renderAsSheet,\n sheetPosition,\n sheetVerticalSize,\n buttonChildren,\n iconRotatorProps: propIconRotatorProps,\n disableTransition: propDisableTransition,\n floating,\n anchor,\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n initialX,\n initialY,\n width,\n transformOrigin,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n preventScroll,\n closeOnResize,\n closeOnScroll,\n getFixedPositionOptions,\n children,\n temporary,\n disablePortal,\n disableElevation,\n menuProps,\n menuStyle,\n menuClassName,\n sheetProps,\n sheetStyle,\n sheetClassName,\n visible: propVisible,\n setVisible: propSetVisible,\n ...remaining\n } = props;\n\n const fixedTo = useRef<HTMLElement | HTMLButtonElement>(null);\n const defaultFocusIndex = useRef(0);\n const [visible, setVisible] = useEnsuredState({\n value: propVisible,\n setValue: propSetVisible,\n defaultValue: false,\n });\n const { menubar, menuitem, activeIdRef, animatedOnceRef } =\n useMenuBarContext();\n const id = useEnsuredId(propId, `menu${menuitem ? \"item\" : \"button\"}`);\n const mode = useUserInteractionMode();\n const mouse = mode === \"mouse\";\n const keyboard = mode === \"keyboard\";\n const disableTransition =\n propDisableTransition ??\n (animatedOnceRef.current &&\n menubar &&\n !!activeIdRef.current &&\n (mouse || keyboard));\n\n const onRequestClose = useCallback(() => {\n setVisible(false);\n }, [setVisible]);\n\n let iconRotatorProps = propIconRotatorProps;\n if (disableTransition) {\n iconRotatorProps = {\n disableTransition,\n ...propIconRotatorProps,\n };\n }\n\n let toggle: ReactElement;\n if (menuitem) {\n toggle = (\n <MenuItemButton\n {...(remaining as DropdownMenuItemButtonProps)}\n id={id}\n ref={fixedTo as RefObject<HTMLLIElement>}\n iconRotatorProps={iconRotatorProps}\n >\n {buttonChildren}\n </MenuItemButton>\n );\n } else {\n toggle = (\n <MenuButton\n {...(remaining as DropdownMenuButtonProps)}\n id={id}\n ref={fixedTo as RefObject<HTMLButtonElement>}\n floating={floating}\n iconRotatorProps={iconRotatorProps}\n >\n {buttonChildren}\n </MenuButton>\n );\n }\n\n return (\n <MenuVisibilityProvider\n visible={visible}\n setVisible={setVisible}\n defaultFocusIndex={defaultFocusIndex}\n >\n <MenuConfigurationProvider\n horizontal={horizontal}\n renderAsSheet={renderAsSheet}\n sheetFooter={sheetFooter}\n sheetHeader={sheetHeader}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n >\n {toggle}\n </MenuConfigurationProvider>\n <Menu\n aria-labelledby={(menuProps?.[\"aria-label\"] ? undefined : id) as string}\n style={menuStyle}\n className={menuClassName}\n sheetProps={sheetProps}\n sheetStyle={sheetStyle}\n sheetClassName={sheetClassName}\n temporary={temporary}\n disablePortal={disablePortal}\n disableElevation={disableElevation}\n disableTransition={disableTransition}\n floating={floating}\n anchor={anchor}\n vwMargin={vwMargin}\n vhMargin={vhMargin}\n xMargin={xMargin}\n yMargin={yMargin}\n initialX={initialX}\n initialY={initialY}\n width={width}\n transformOrigin={transformOrigin}\n preventOverlap={preventOverlap}\n disableSwapping={disableSwapping}\n disableVHBounds={disableVHBounds}\n preventScroll={preventScroll}\n closeOnResize={closeOnResize}\n closeOnScroll={closeOnScroll}\n getFixedPositionOptions={getFixedPositionOptions}\n horizontal={horizontal}\n sheetHeader={sheetHeader}\n sheetFooter={sheetFooter}\n renderAsSheet={renderAsSheet}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n {...menuProps}\n fixedTo={fixedTo}\n visible={visible}\n getDefaultFocusedIndex={(options) => {\n const defaultIndex = defaultFocusIndex.current;\n if (defaultIndex < 0) {\n return getLastFocusableIndex(options);\n }\n\n return defaultIndex;\n }}\n onRequestClose={onRequestClose}\n onEntered={(appearing) => {\n menuProps?.onEntered?.(appearing);\n // this will be called before `getDefaultFocusedIndex`\n if (disableTransition) {\n return;\n }\n\n defaultFocusIndex.current = 0;\n }}\n >\n {children}\n </Menu>\n </MenuVisibilityProvider>\n );\n}\n"],"names":["useCallback","useRef","useUserInteractionMode","getLastFocusableIndex","useEnsuredId","useEnsuredState","Menu","MenuButton","MenuConfigurationProvider","MenuItemButton","MenuVisibilityProvider","useMenuBarContext","DropdownMenu","props","id","propId","horizontal","sheetHeader","sheetFooter","renderAsSheet","sheetPosition","sheetVerticalSize","buttonChildren","iconRotatorProps","propIconRotatorProps","disableTransition","propDisableTransition","floating","anchor","vwMargin","vhMargin","xMargin","yMargin","initialX","initialY","width","transformOrigin","preventOverlap","disableSwapping","disableVHBounds","preventScroll","closeOnResize","closeOnScroll","getFixedPositionOptions","children","temporary","disablePortal","disableElevation","menuProps","menuStyle","menuClassName","sheetProps","sheetStyle","sheetClassName","visible","propVisible","setVisible","propSetVisible","remaining","fixedTo","defaultFocusIndex","value","setValue","defaultValue","menubar","menuitem","activeIdRef","animatedOnceRef","mode","mouse","keyboard","current","onRequestClose","toggle","ref","aria-labelledby","undefined","style","className","getDefaultFocusedIndex","options","defaultIndex","onEntered","appearing"],"mappings":"AAAA;;AACA,SACEA,WAAW,EACXC,MAAM,QAID,QAAQ;AACf,SAASC,sBAAsB,QAAQ,gDAAgD;AACvF,SAASC,qBAAqB,QAAQ,uBAAuB;AAE7D,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SACEC,IAAI,QAGC,YAAY;AACnB,SAASC,UAAU,QAA8B,kBAAkB;AACnE,SACEC,yBAAyB,QAEpB,iCAAiC;AACxC,SAASC,cAAc,QAAkC,sBAAsB;AAE/E,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SAASC,iBAAiB,QAAQ,0BAA0B;AAoC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C/B;oBAEA,OAAOC;gBACT;gBACAT,gBAAgBA;gBAChBU,WAAW,CAACC;oBACVnC,WAAWkC,YAAYC;oBACvB,sDAAsD;oBACtD,IAAI1D,mBAAmB;wBACrB;oBACF;oBAEAmC,kBAAkBW,OAAO,GAAG;gBAC9B;0BAEC3B;;;;AAIT"}
1
+ {"version":3,"sources":["../../src/menu/DropdownMenu.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ReactElement,\n type ReactNode,\n type RefObject,\n useCallback,\n useRef,\n} from \"react\";\n\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { getLastFocusableIndex } from \"../movement/utils.js\";\nimport { type UseStateSetter } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useEnsuredState } from \"../useEnsuredState.js\";\nimport {\n Menu,\n type MenuConvenienceProps,\n type MenuListConvenienceProps,\n} from \"./Menu.js\";\nimport { MenuButton, type MenuButtonProps } from \"./MenuButton.js\";\nimport {\n type MenuConfiguration,\n MenuConfigurationProvider,\n} from \"./MenuConfigurationProvider.js\";\nimport { MenuItemButton, type MenuItemButtonProps } from \"./MenuItemButton.js\";\nimport { type MenuSheetConvenienceProps } from \"./MenuSheet.js\";\nimport { MenuVisibilityProvider } from \"./MenuVisibilityProvider.js\";\nimport { useMenuBarContext } from \"./useMenuBarProvider.js\";\n\nexport interface BaseDropdownMenuProps\n extends MenuConfiguration,\n MenuListConvenienceProps,\n MenuSheetConvenienceProps,\n MenuConvenienceProps {\n buttonChildren: ReactNode;\n}\n\nexport interface DropdownMenuButtonProps\n extends MenuButtonProps,\n BaseDropdownMenuProps {}\n\nexport interface DropdownMenuItemButtonProps\n extends MenuItemButtonProps,\n BaseDropdownMenuProps {}\n\n/**\n * @since 6.0.0\n */\nexport interface DropdownMenuStateProps {\n visible: boolean;\n setVisible: UseStateSetter<boolean>;\n}\n\n/**\n * @since 5.0.0\n * @since 6.0.0 Updated to use an `&` instead of `|` to allow autocompletion to\n * work better by default. It's up to the user to make sure they don't provide\n * incorrect props.\n */\nexport type DropdownMenuProps = DropdownMenuButtonProps &\n DropdownMenuItemButtonProps &\n (DropdownMenuStateProps | { visible?: never; setVisible?: never });\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { DropdownMenu, MenuItem } from \"@react-md/core\";\n *\n * function Example() {\n * return (\n * <DropdownMenu buttonChildren=\"Dropdown\">\n * <MenuItem onClick={() => console.log('Clicked Item 1')}>\n * Item 1\n * </MenuItem>\n * <MenuItem onClick={() => console.log('Clicked Item 2')}>\n * Item 2\n * </MenuItem>\n * </DropdownMenu>\n * );\n * }\n * ```\n *\n * @example Nested Dropdown Menus\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { DropdownMenu, MenuItem } from \"@react-md/core\";\n *\n * function Example() {\n * return (\n * <DropdownMenu buttonChildren=\"Dropdown\">\n * <MenuItem onClick={() => console.log('Clicked Item 1')}>\n * Item 1\n * </MenuItem>\n * <MenuItem onClick={() => console.log('Clicked Item 2')}>\n * Item 2\n * </MenuItem>\n * <DropdownMenu buttonChildren=\"Nested Dropdown\">\n * <MenuItem onClick={() => console.log('Clicked Item 1')}>\n * Nested Item 1\n * </MenuItem>\n * <MenuItem onClick={() => console.log('Clicked Item 2')}>\n * Nested Item 2\n * </MenuItem>\n * </DropdownMenu>\n * </DropdownMenu>\n * );\n * }\n * ```\n *\n * @since 5.0.0\n * @since 6.0.0 Updated to use the latest menu API.\n */\nexport function DropdownMenu(props: DropdownMenuProps): ReactElement {\n const {\n id: propId,\n horizontal,\n sheetHeader,\n sheetFooter,\n renderAsSheet,\n sheetPosition,\n sheetVerticalSize,\n buttonChildren,\n iconRotatorProps: propIconRotatorProps,\n disableTransition: propDisableTransition,\n floating,\n anchor,\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n initialX,\n initialY,\n width,\n transformOrigin,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n preventScroll,\n closeOnResize,\n closeOnScroll,\n getFixedPositionOptions,\n children,\n temporary,\n disablePortal,\n disableElevation,\n menuProps,\n menuStyle,\n menuClassName,\n sheetProps,\n sheetStyle,\n sheetClassName,\n visible: propVisible,\n setVisible: propSetVisible,\n ...remaining\n } = props;\n\n const fixedTo = useRef<HTMLElement | HTMLButtonElement>(null);\n const defaultFocusIndex = useRef(0);\n const [visible, setVisible] = useEnsuredState({\n value: propVisible,\n setValue: propSetVisible,\n defaultValue: false,\n });\n const { menubar, menuitem, activeIdRef, animatedOnceRef } =\n useMenuBarContext();\n const id = useEnsuredId(propId, `menu${menuitem ? \"item\" : \"button\"}`);\n const mode = useUserInteractionMode();\n const mouse = mode === \"mouse\";\n const keyboard = mode === \"keyboard\";\n const disableTransition =\n propDisableTransition ??\n (animatedOnceRef.current &&\n menubar &&\n !!activeIdRef.current &&\n (mouse || keyboard));\n\n const onRequestClose = useCallback(() => {\n setVisible(false);\n }, [setVisible]);\n\n let iconRotatorProps = propIconRotatorProps;\n if (disableTransition) {\n iconRotatorProps = {\n disableTransition,\n ...propIconRotatorProps,\n };\n }\n\n let toggle: ReactElement;\n if (menuitem) {\n toggle = (\n <MenuItemButton\n {...(remaining as DropdownMenuItemButtonProps)}\n id={id}\n ref={fixedTo as RefObject<HTMLLIElement>}\n iconRotatorProps={iconRotatorProps}\n >\n {buttonChildren}\n </MenuItemButton>\n );\n } else {\n toggle = (\n <MenuButton\n {...(remaining as DropdownMenuButtonProps)}\n id={id}\n ref={fixedTo as RefObject<HTMLButtonElement>}\n floating={floating}\n iconRotatorProps={iconRotatorProps}\n >\n {buttonChildren}\n </MenuButton>\n );\n }\n\n return (\n <MenuVisibilityProvider\n visible={visible}\n setVisible={setVisible}\n defaultFocusIndex={defaultFocusIndex}\n >\n <MenuConfigurationProvider\n horizontal={horizontal}\n renderAsSheet={renderAsSheet}\n sheetFooter={sheetFooter}\n sheetHeader={sheetHeader}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n >\n {toggle}\n </MenuConfigurationProvider>\n <Menu\n aria-labelledby={(menuProps?.[\"aria-label\"] ? undefined : id) as string}\n style={menuStyle}\n className={menuClassName}\n sheetProps={sheetProps}\n sheetStyle={sheetStyle}\n sheetClassName={sheetClassName}\n temporary={temporary}\n disablePortal={disablePortal}\n disableElevation={disableElevation}\n disableTransition={disableTransition}\n floating={floating}\n anchor={anchor}\n vwMargin={vwMargin}\n vhMargin={vhMargin}\n xMargin={xMargin}\n yMargin={yMargin}\n initialX={initialX}\n initialY={initialY}\n width={width}\n transformOrigin={transformOrigin}\n preventOverlap={preventOverlap}\n disableSwapping={disableSwapping}\n disableVHBounds={disableVHBounds}\n preventScroll={preventScroll}\n closeOnResize={closeOnResize}\n closeOnScroll={closeOnScroll}\n getFixedPositionOptions={getFixedPositionOptions}\n horizontal={horizontal}\n sheetHeader={sheetHeader}\n sheetFooter={sheetFooter}\n renderAsSheet={renderAsSheet}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n {...menuProps}\n fixedTo={fixedTo}\n visible={visible}\n getDefaultFocusedIndex={(options) => {\n const defaultIndex = defaultFocusIndex.current;\n if (defaultIndex < 0) {\n return getLastFocusableIndex(options);\n }\n\n return defaultIndex;\n }}\n onRequestClose={onRequestClose}\n onEntered={(appearing) => {\n menuProps?.onEntered?.(appearing);\n // this will be called before `getDefaultFocusedIndex`\n if (disableTransition) {\n return;\n }\n\n defaultFocusIndex.current = 0;\n }}\n >\n {children}\n </Menu>\n </MenuVisibilityProvider>\n );\n}\n"],"names":["useCallback","useRef","useUserInteractionMode","getLastFocusableIndex","useEnsuredId","useEnsuredState","Menu","MenuButton","MenuConfigurationProvider","MenuItemButton","MenuVisibilityProvider","useMenuBarContext","DropdownMenu","props","id","propId","horizontal","sheetHeader","sheetFooter","renderAsSheet","sheetPosition","sheetVerticalSize","buttonChildren","iconRotatorProps","propIconRotatorProps","disableTransition","propDisableTransition","floating","anchor","vwMargin","vhMargin","xMargin","yMargin","initialX","initialY","width","transformOrigin","preventOverlap","disableSwapping","disableVHBounds","preventScroll","closeOnResize","closeOnScroll","getFixedPositionOptions","children","temporary","disablePortal","disableElevation","menuProps","menuStyle","menuClassName","sheetProps","sheetStyle","sheetClassName","visible","propVisible","setVisible","propSetVisible","remaining","fixedTo","defaultFocusIndex","value","setValue","defaultValue","menubar","menuitem","activeIdRef","animatedOnceRef","mode","mouse","keyboard","current","onRequestClose","toggle","ref","aria-labelledby","undefined","style","className","getDefaultFocusedIndex","options","defaultIndex","onEntered","appearing"],"mappings":"AAAA;;AAEA,SAIEA,WAAW,EACXC,MAAM,QACD,QAAQ;AAEf,SAASC,sBAAsB,QAAQ,gDAAgD;AACvF,SAASC,qBAAqB,QAAQ,uBAAuB;AAE7D,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SACEC,IAAI,QAGC,YAAY;AACnB,SAASC,UAAU,QAA8B,kBAAkB;AACnE,SAEEC,yBAAyB,QACpB,iCAAiC;AACxC,SAASC,cAAc,QAAkC,sBAAsB;AAE/E,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SAASC,iBAAiB,QAAQ,0BAA0B;AAoC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDC,GACD,OAAO,SAASC,aAAaC,KAAwB;IACnD,MAAM,EACJC,IAAIC,MAAM,EACVC,UAAU,EACVC,WAAW,EACXC,WAAW,EACXC,aAAa,EACbC,aAAa,EACbC,iBAAiB,EACjBC,cAAc,EACdC,kBAAkBC,oBAAoB,EACtCC,mBAAmBC,qBAAqB,EACxCC,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRC,QAAQ,EACRC,OAAO,EACPC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,KAAK,EACLC,eAAe,EACfC,cAAc,EACdC,eAAe,EACfC,eAAe,EACfC,aAAa,EACbC,aAAa,EACbC,aAAa,EACbC,uBAAuB,EAC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;gBACfD,aAAaA;gBACbD,aAAaA;gBACbG,eAAeA;gBACfC,mBAAmBA;0BAElBoD;;0BAEH,KAACnE;gBACCqE,mBAAkB3B,WAAW,CAAC,aAAa,GAAG4B,YAAY9D;gBAC1D+D,OAAO5B;gBACP6B,WAAW5B;gBACXC,YAAYA;gBACZC,YAAYA;gBACZC,gBAAgBA;gBAChBR,WAAWA;gBACXC,eAAeA;gBACfC,kBAAkBA;gBAClBtB,mBAAmBA;gBACnBE,UAAUA;gBACVC,QAAQA;gBACRC,UAAUA;gBACVC,UAAUA;gBACVC,SAASA;gBACTC,SAASA;gBACTC,UAAUA;gBACVC,UAAUA;gBACVC,OAAOA;gBACPC,iBAAiBA;gBACjBC,gBAAgBA;gBAChBC,iBAAiBA;gBACjBC,iBAAiBA;gBACjBC,eAAeA;gBACfC,eAAeA;gBACfC,eAAeA;gBACfC,yBAAyBA;gBACzB3B,YAAYA;gBACZC,aAAaA;gBACbC,aAAaA;gBACbC,eAAeA;gBACfC,eAAeA;gBACfC,mBAAmBA;gBAClB,GAAG2B,SAAS;gBACbW,SAASA;gBACTL,SAASA;gBACTyB,wBAAwB,CAACC;oBACvB,MAAMC,eAAerB,kBAAkBW,OAAO;oBAC9C,IAAIU,eAAe,GAAG;wBACpB,OAAO9E,sBAAsB6E;oBAC/B;oBAEA,OAAOC;gBACT;gBACAT,gBAAgBA;gBAChBU,WAAW,CAACC;oBACVnC,WAAWkC,YAAYC;oBACvB,sDAAsD;oBACtD,IAAI1D,mBAAmB;wBACrB;oBACF;oBAEAmC,kBAAkBW,OAAO,GAAG;gBAC9B;0BAEC3B;;;;AAIT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/Menu.tsx"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n useEffect,\n useRef,\n type CSSProperties,\n type HTMLAttributes,\n} from \"react\";\nimport { type FloatingActionButtonPosition } from \"../button/FloatingActionButton.js\";\nimport { useFocusContainer } from \"../focus/useFocusContainer.js\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { type ListElement, type ListProps } from \"../list/List.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { type GetDefaultFocusedIndex } from \"../movement/types.js\";\nimport { Portal } from \"../portal/Portal.js\";\nimport { type CalculateFixedPositionOptions } from \"../positioning/types.js\";\nimport {\n useFixedPositioning,\n type FixedPositioningOptions,\n} from \"../positioning/useFixedPositioning.js\";\nimport { useScrollLock } from \"../scroll/useScrollLock.js\";\nimport {\n useScaleTransition,\n type ScaleTransitionHookOptions,\n} from \"../transition/useScaleTransition.js\";\nimport { type LabelRequiredForA11y, type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport {\n MenuConfigurationProvider,\n useMenuConfiguration,\n type MenuConfiguration,\n type MenuOrientationProps,\n} from \"./MenuConfigurationProvider.js\";\nimport { MenuSheet, type MenuSheetConvenienceProps } from \"./MenuSheet.js\";\nimport { MenuWidget } from \"./MenuWidget.js\";\nimport { useMenuBarContext } from \"./useMenuBarProvider.js\";\nimport { getDefaultAnchor } from \"./utils.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-menu-background-color\"?: string;\n \"--rmd-menu-color\"?: string;\n \"--rmd-menu-min-width\"?: string | number;\n \"--rmd-menu-spacing\"?: string | number;\n }\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\n/** @since 5.0.0 */\nexport type MenuTransitionProps = Omit<\n ScaleTransitionHookOptions<HTMLDivElement>,\n \"transitionIn\" | \"vertical\" | \"nodeRef\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface MenuConfigurationProps extends CalculateFixedPositionOptions {\n /**\n * @see {@link ScaleTransitionHookOptions.temporary}\n * @defaultValue `true`\n */\n temporary?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disablePortal?: boolean;\n\n /**\n * Boolean if the menu should not gain the elevation styles and should only be\n * set to `true` when rendering within a `Sheet`.\n *\n * @defaultValue `false`\n */\n disableElevation?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * @see {@link FixedPositioningOptions.transformOrigin}\n * @defaultValue `true`\n */\n transformOrigin?: boolean;\n\n /**\n * Boolean if the menu should close if the page is scrolled. The default\n * behavior is to just update the position of the menu relative to the menu\n * button until it can no longer be visible within the viewport.\n *\n * @defaultValue `false`\n */\n closeOnScroll?: boolean;\n\n /**\n * Boolean if the page should no longer be scrollable while the menu is\n * visible.\n *\n * @defaultValue `false`\n */\n preventScroll?: boolean;\n\n /**\n * Boolean if the menu should close instead of repositioning itself if the\n * browser window is resized.\n *\n * @defaultValue `false`\n */\n closeOnResize?: boolean;\n\n /** @see {@link FixedPositioningOptions.getFixedPositionOptions} */\n getFixedPositionOptions?: () => CalculateFixedPositionOptions;\n\n /**\n * @defaultValue `false`\n * @see {@link FixedPositioningOptions.disabled}\n */\n disableFixedPositioning?: boolean;\n}\n\n/**\n * @since 5.1.0\n * @since 6.0.0 Renamed from `MenuListProps` to `MenuListConvenienceProps`\n */\nexport interface MenuListConvenienceProps {\n /**\n * An optional style to provide to the `List` component that surrounds the\n * `MenuItem` within a `Menu`.\n */\n listStyle?: CSSProperties;\n\n /**\n * An optional className to provide to the `List` component that surrounds the\n * `MenuItem` within a `Menu`.\n */\n listClassName?: string;\n\n /**\n * Any additional props to pass to the `List` component that surrounds the\n * `Menu`'s `MenuItem`s.\n */\n listProps?: PropsWithRef<Omit<ListProps, \"horizontal\">, ListElement>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface MenuConvenienceProps extends MenuConfigurationProps {\n /**\n * This can be used to apply additional props to the `Menu` component.\n *\n * Note: You can override the `style` and `className` using\n * {@link menuStyle} and {@link menuClassName} instead for convenience.\n *\n * @example\n * ```tsx\n * <DropdownMenu\n * {...props}\n * menuProps={{\n * style: {\n * // custom inline style\n * },\n * className: \"come-class-name\",\n * getFixedPositionOptions: () => ({\n * preventOverlap: true,\n * }),\n * }}\n * />\n * ```\n */\n menuProps?: PropsWithRef<\n Omit<\n MenuProps,\n | \"children\"\n | \"fixedTo\"\n | \"visible\"\n | \"onRequestClose\"\n | \"getDefaultFocusedIndex\"\n >,\n HTMLDivElement\n >;\n\n /**\n * Convenience prop to apply custom style to the `Menu` component.\n */\n menuStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `Menu` component.\n */\n menuClassName?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport type MenuFixedPositioningOptions = Omit<\n FixedPositioningOptions<HTMLElement, HTMLDivElement>,\n \"onScroll\" | \"onResize\" | \"nodeRef\" | \"disabled\"\n>;\n\n/**\n * @since 5.0.0\n * @since 6.0.0 Updated to use the latest Menu, Transition, and Portal API.\n */\nexport interface MenuProps\n extends HTMLAttributes<HTMLDivElement>,\n MenuConfiguration,\n MenuConfigurationProps,\n MenuFixedPositioningOptions,\n MenuOrientationProps,\n MenuTransitionProps,\n MenuListConvenienceProps,\n MenuSheetConvenienceProps {\n visible: boolean;\n onRequestClose: () => void;\n\n /**\n * @defaultValue `\"menu-\" + useId()`\n */\n id?: string;\n\n /**\n * This is used to set the default focus index when the menu is visible.\n *\n * @internal\n */\n getDefaultFocusedIndex?: GetDefaultFocusedIndex;\n\n /**\n * Custom style that should be applied to the menu only while not rendered\n * within a sheet since the {@link style} would be applied to both versions.\n */\n menuStyle?: CSSProperties;\n\n /**\n * Custom class name that should be applied only while not rendered within a\n * sheet.\n */\n menuClassName?: string;\n\n /**\n * @internal\n *\n * This is only used to update the default anchor when the DropdownMenu's\n * toggle is a floating action button.\n */\n floating?: FloatingActionButtonPosition;\n}\n\n/**\n * **Client Component**\n *\n * This component should generally only be used to implement context menus with\n * the `useContextMenu` hook. Otherwise, the `DropdownMenu` component should be\n * used.\n *\n * @see The `useContextMenu` hook for an example.\n *\n * @since 5.0.0\n * @since 6.0.0 Updated this component to implement all the `Menu`\n * functionality instead of requiring the `useMenu` hook and `MenuWidget`\n * component. In addition, the `renderAsSheet` behavior has been moved into this\n * implementation so that the `MenuRenderer` is no longer required and context\n * menus can appear as a `Sheet`.\n */\nexport const Menu = forwardRef<HTMLDivElement, LabelRequiredForA11y<MenuProps>>(\n function Menu(props, propRef) {\n const {\n id: propId,\n style: propStyle,\n role = \"menu\",\n children,\n horizontal: _horizontal,\n sheetHeader: _sheetHeader,\n sheetFooter: _sheetFooter,\n renderAsSheet: _renderAsSheet,\n sheetPosition: _sheetPosition,\n sheetVerticalSize: _sheetVerticalSize,\n sheetProps,\n sheetStyle,\n sheetClassName,\n menuStyle,\n menuClassName,\n disableElevation = false,\n temporary = true,\n tabIndex = -1,\n fixedTo,\n className,\n classNames,\n timeout,\n appear,\n enter,\n exit,\n onEnter,\n onEntering = noop,\n onEntered = noop,\n onExit,\n onExiting,\n onExited = noop,\n onKeyDown = noop,\n listProps,\n listStyle,\n listClassName,\n visible,\n onRequestClose,\n floating,\n anchor,\n closeOnResize = false,\n closeOnScroll = false,\n preventScroll = false,\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n width,\n transformOrigin = true,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n disableFixedPositioning,\n getFixedPositionOptions,\n disablePortal: propDisablePortal,\n disableTransition,\n ...remaining\n } = props;\n const { \"aria-label\": ariaLabel, \"aria-labelledby\": ariaLabelledBy } =\n props;\n\n const id = useEnsuredId(propId, \"menu\");\n const {\n root,\n menubar,\n menuitem,\n activeId,\n animatedOnceRef,\n hoverTimeoutRef,\n disableHoverMode,\n } = useMenuBarContext();\n const {\n horizontal,\n sheetHeader,\n sheetFooter,\n renderAsSheet,\n sheetPosition,\n sheetVerticalSize,\n } = useMenuConfiguration(props);\n const { isPhone } = useAppSize();\n const isSheet =\n renderAsSheet === true || (renderAsSheet === \"phone\" && isPhone);\n\n const entered = useRef(false);\n const cancelUnmountFocus = useRef(false);\n const hideWithoutRefocus = (): void => {\n cancelUnmountFocus.current = true;\n onRequestClose();\n };\n const mode = useUserInteractionMode();\n const mouse = mode === \"mouse\";\n\n const { eventHandlers, transitionOptions } = useFocusContainer({\n nodeRef: propRef,\n activate: visible,\n onKeyDown(event) {\n onKeyDown(event);\n\n // when a menu is within a sheet, it should not trigger the custom\n // keyboard behavior\n if (isSheet) {\n return;\n }\n\n switch (event.key) {\n case \"Escape\":\n // prevent parent components that have an \"Escape\" keypress event\n // from being triggered as well\n event.stopPropagation();\n disableHoverMode();\n onRequestClose();\n break;\n case \"Tab\":\n // since menus are portalled, tab index is kinda broke so just close\n // the menu instead of doing default tab behavior\n event.preventDefault();\n\n if (!menuitem) {\n // pressing the tab key should still cascade close all menus\n event.stopPropagation();\n }\n disableHoverMode();\n onRequestClose();\n break;\n case \"ArrowUp\":\n if (!root && menuitem && horizontal) {\n event.stopPropagation();\n event.preventDefault();\n onRequestClose();\n }\n break;\n case \"ArrowLeft\":\n if (!root && menuitem && !horizontal) {\n event.stopPropagation();\n event.preventDefault();\n onRequestClose();\n }\n break;\n }\n },\n onEntering(appearing) {\n onEntering(appearing);\n entered.current = true;\n },\n onEntered(appearing) {\n onEntered(appearing);\n entered.current = true;\n cancelUnmountFocus.current = false;\n animatedOnceRef.current = true;\n },\n onExited() {\n onExited();\n entered.current = false;\n },\n onExiting,\n disableTransition,\n isFocusTypeDisabled(type) {\n if (role === \"listbox\") {\n return !isSheet;\n }\n\n if (type === \"keyboard\") {\n return isSheet;\n }\n\n const isHoverDisabled = mouse && hoverTimeoutRef.current === 0;\n if (type === \"mount\") {\n return isHoverDisabled;\n }\n\n return (\n isHoverDisabled ||\n cancelUnmountFocus.current ||\n (root && !!activeId && id !== activeId)\n );\n },\n });\n\n const { ref, style, callbacks, updateStyle } = useFixedPositioning({\n ...transitionOptions,\n disabled: disableFixedPositioning,\n onEnter,\n style: isSheet ? propStyle : menuStyle,\n fixedTo,\n anchor: getDefaultAnchor({\n anchor,\n menubar,\n floating,\n menuitem: !root && menuitem,\n horizontal,\n }),\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n width,\n transformOrigin,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n getFixedPositionOptions,\n onResize: closeOnResize ? hideWithoutRefocus : undefined,\n onScroll(_event, data) {\n if (!data.visible || closeOnScroll) {\n hideWithoutRefocus();\n }\n },\n });\n const { rendered, disablePortal, elementProps } = useScaleTransition({\n nodeRef: ref,\n className: cnb(!isSheet && menuClassName, className),\n transitionIn: visible,\n vertical: !horizontal,\n temporary,\n timeout: isSheet || disableTransition ? 0 : timeout,\n classNames,\n appear,\n enter,\n exit,\n onExit,\n onExiting: transitionOptions.onExiting,\n exitedHidden: true,\n ...callbacks,\n });\n useScrollLock(visible && preventScroll);\n\n // need to make sure that the useEffect does not refire for hiding on click\n // events because of the `window.requestAnimationFrame`. It'll make it so\n // that menu items that update state are unable to close when clicked\n const hide = useRef(onRequestClose);\n useEffect(() => {\n hide.current = onRequestClose;\n });\n useEffect(() => {\n if (!visible) {\n return;\n }\n\n const callback = (event: globalThis.MouseEvent): void => {\n // this is required for when the transition is disabled\n if (!entered.current) {\n return;\n }\n\n // if the user clicks outside of the menu to close it, the toggle button\n // should not be focused. instead the nearest focusable element from the\n // click event should be focused when Tab or Shift + tab is pressed\n cancelUnmountFocus.current =\n !(event.target instanceof HTMLElement) ||\n !event.target.closest(`[role=\"${role}\"]`);\n\n // this won't be called if `event.stopPropagation()` is called\n hide.current();\n disableHoverMode();\n };\n\n // wait an animation frame so the initial click event that caused the menu\n // to become visible does not immediately close the menu\n const frame = window.requestAnimationFrame(() => {\n window.addEventListener(\"click\", callback);\n });\n\n return () => {\n window.cancelAnimationFrame(frame);\n window.removeEventListener(\"click\", callback);\n };\n }, [disableHoverMode, role, visible]);\n useIsomorphicLayoutEffect(() => {\n if (!visible) {\n return;\n }\n\n updateStyle();\n }, [updateStyle, children, visible]);\n\n return (\n <MenuConfigurationProvider\n horizontal={horizontal}\n renderAsSheet={renderAsSheet}\n sheetFooter={sheetFooter}\n sheetHeader={sheetHeader}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n >\n <MenuSheet\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy as string}\n header={sheetHeader}\n footer={sheetFooter}\n position={sheetPosition}\n verticalSize={sheetVerticalSize}\n visible={visible}\n enabled={isSheet}\n onRequestClose={onRequestClose}\n style={sheetStyle}\n className={sheetClassName}\n disablePortal={propDisablePortal}\n temporary={temporary}\n disableTransition={disableTransition}\n {...sheetProps}\n >\n <Portal disabled={isSheet || (propDisablePortal ?? disablePortal)}>\n {(rendered || isSheet) && (\n <MenuWidget\n {...remaining}\n {...elementProps}\n {...eventHandlers}\n id={id}\n role={role}\n style={isSheet ? propStyle : style}\n isSheet={isSheet}\n tabIndex={tabIndex}\n horizontal={horizontal}\n listProps={listProps}\n listStyle={listStyle}\n listClassName={listClassName}\n disableElevation={disableElevation}\n cancelUnmountFocus={cancelUnmountFocus}\n >\n {children}\n </MenuWidget>\n )}\n </Portal>\n </MenuSheet>\n </MenuConfigurationProvider>\n );\n }\n);\n"],"names":["cnb","forwardRef","useEffect","useRef","useFocusContainer","useUserInteractionMode","useAppSize","Portal","useFixedPositioning","useScrollLock","useScaleTransition","useEnsuredId","useIsomorphicLayoutEffect","MenuConfigurationProvider","useMenuConfiguration","MenuSheet","MenuWidget","useMenuBarContext","getDefaultAnchor","noop","Menu","props","propRef","id","propId","style","propStyle","role","children","horizontal","_horizontal","sheetHeader","_sheetHeader","sheetFooter","_sheetFooter","renderAsSheet","_renderAsSheet","sheetPosition","_sheetPosition","sheetVerticalSize","_sheetVerticalSize","sheetProps","sheetStyle","sheetClassName","menuStyle","menuClassName","disableElevation","temporary","tabIndex","fixedTo","className","classNames","timeout","appear","enter","exit","onEnter","onEntering","onEntered","onExit","onExiting","onExited","onKeyDown","listProps","listStyle","listClassName","visible","onRequestClose","floating","anchor","closeOnResize","closeOnScroll","preventScroll","vwMargin","vhMargin","xMargin","yMargin","width","transformOrigin","preventOverlap","disableSwapping","disableVHBounds","initialX","initialY","disableFixedPositioning","getFixedPositionOptions","disablePortal","propDisablePortal","disableTransition","remaining","ariaLabel","ariaLabelledBy","root","menubar","menuitem","activeId","animatedOnceRef","hoverTimeoutRef","disableHoverMode","isPhone","isSheet","entered","cancelUnmountFocus","hideWithoutRefocus","current","mode","mouse","eventHandlers","transitionOptions","nodeRef","activate","event","key","stopPropagation","preventDefault","appearing","isFocusTypeDisabled","type","isHoverDisabled","ref","callbacks","updateStyle","disabled","onResize","undefined","onScroll","_event","data","rendered","elementProps","transitionIn","vertical","exitedHidden","hide","callback","target","HTMLElement","closest","frame","window","requestAnimationFrame","addEventListener","cancelAnimationFrame","removeEventListener","aria-label","aria-labelledby","header","footer","position","verticalSize","enabled"],"mappings":"AAAA;;AACA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,EACVC,SAAS,EACTC,MAAM,QAGD,QAAQ;AAEf,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,sBAAsB,QAAQ,gDAAgD;AAEvF,SAASC,UAAU,QAAQ,sCAAsC;AAEjE,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,SACEC,mBAAmB,QAEd,wCAAwC;AAC/C,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SACEC,kBAAkB,QAEb,sCAAsC;AAE7C,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,yBAAyB,QAAQ,kCAAkC;AAC5E,SACEC,yBAAyB,EACzBC,oBAAoB,QAGf,iCAAiC;AACxC,SAASC,SAAS,QAAwC,iBAAiB;AAC3E,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,gBAAgB,QAAQ,aAAa;AAW9C,MAAMC,OAAO;AACX,aAAa;AACf;AA+MA;;;;;;;;;;;;;;;CAeC,GACD,OAAO,MAAMC,qBAAOnB,WAClB,S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gBAAOmH,UAAUtB,WAAYb,CAAAA,qBAAqBD,aAAY;0BAC5D,AAAC0C,CAAAA,YAAY5B,OAAM,mBAClB,KAACpF;oBACE,GAAGyE,SAAS;oBACZ,GAAGwC,YAAY;oBACf,GAAGtB,aAAa;oBACjBpF,IAAIA;oBACJI,MAAMA;oBACNF,OAAO2E,UAAU1E,YAAYD;oBAC7B2E,SAASA;oBACTpD,UAAUA;oBACVnB,YAAYA;oBACZkC,WAAWA;oBACXC,WAAWA;oBACXC,eAAeA;oBACfnB,kBAAkBA;oBAClBwD,oBAAoBA;8BAEnB1E;;;;;AAOf,GACA"}
1
+ {"version":3,"sources":["../../src/menu/Menu.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport {\n type CSSProperties,\n type HTMLAttributes,\n forwardRef,\n useEffect,\n useRef,\n} from \"react\";\n\nimport { type FloatingActionButtonPosition } from \"../button/FloatingActionButton.js\";\nimport { useFocusContainer } from \"../focus/useFocusContainer.js\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { type ListElement, type ListProps } from \"../list/List.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { type GetDefaultFocusedIndex } from \"../movement/types.js\";\nimport { Portal } from \"../portal/Portal.js\";\nimport { type CalculateFixedPositionOptions } from \"../positioning/types.js\";\nimport {\n type FixedPositioningOptions,\n useFixedPositioning,\n} from \"../positioning/useFixedPositioning.js\";\nimport { useScrollLock } from \"../scroll/useScrollLock.js\";\nimport {\n type ScaleTransitionHookOptions,\n useScaleTransition,\n} from \"../transition/useScaleTransition.js\";\nimport { type LabelRequiredForA11y, type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport {\n type MenuConfiguration,\n MenuConfigurationProvider,\n type MenuOrientationProps,\n useMenuConfiguration,\n} from \"./MenuConfigurationProvider.js\";\nimport { MenuSheet, type MenuSheetConvenienceProps } from \"./MenuSheet.js\";\nimport { MenuWidget } from \"./MenuWidget.js\";\nimport { useMenuBarContext } from \"./useMenuBarProvider.js\";\nimport { getDefaultAnchor } from \"./utils.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-menu-background-color\"?: string;\n \"--rmd-menu-color\"?: string;\n \"--rmd-menu-min-width\"?: string | number;\n \"--rmd-menu-spacing\"?: string | number;\n }\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\n/** @since 5.0.0 */\nexport type MenuTransitionProps = Omit<\n ScaleTransitionHookOptions<HTMLDivElement>,\n \"transitionIn\" | \"vertical\" | \"nodeRef\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface MenuConfigurationProps extends CalculateFixedPositionOptions {\n /**\n * @see {@link ScaleTransitionHookOptions.temporary}\n * @defaultValue `true`\n */\n temporary?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disablePortal?: boolean;\n\n /**\n * Boolean if the menu should not gain the elevation styles and should only be\n * set to `true` when rendering within a `Sheet`.\n *\n * @defaultValue `false`\n */\n disableElevation?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * @see {@link FixedPositioningOptions.transformOrigin}\n * @defaultValue `true`\n */\n transformOrigin?: boolean;\n\n /**\n * Boolean if the menu should close if the page is scrolled. The default\n * behavior is to just update the position of the menu relative to the menu\n * button until it can no longer be visible within the viewport.\n *\n * @defaultValue `false`\n */\n closeOnScroll?: boolean;\n\n /**\n * Boolean if the page should no longer be scrollable while the menu is\n * visible.\n *\n * @defaultValue `false`\n */\n preventScroll?: boolean;\n\n /**\n * Boolean if the menu should close instead of repositioning itself if the\n * browser window is resized.\n *\n * @defaultValue `false`\n */\n closeOnResize?: boolean;\n\n /** @see {@link FixedPositioningOptions.getFixedPositionOptions} */\n getFixedPositionOptions?: () => CalculateFixedPositionOptions;\n\n /**\n * @defaultValue `false`\n * @see {@link FixedPositioningOptions.disabled}\n */\n disableFixedPositioning?: boolean;\n}\n\n/**\n * @since 5.1.0\n * @since 6.0.0 Renamed from `MenuListProps` to `MenuListConvenienceProps`\n */\nexport interface MenuListConvenienceProps {\n /**\n * An optional style to provide to the `List` component that surrounds the\n * `MenuItem` within a `Menu`.\n */\n listStyle?: CSSProperties;\n\n /**\n * An optional className to provide to the `List` component that surrounds the\n * `MenuItem` within a `Menu`.\n */\n listClassName?: string;\n\n /**\n * Any additional props to pass to the `List` component that surrounds the\n * `Menu`'s `MenuItem`s.\n */\n listProps?: PropsWithRef<Omit<ListProps, \"horizontal\">, ListElement>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface MenuConvenienceProps extends MenuConfigurationProps {\n /**\n * This can be used to apply additional props to the `Menu` component.\n *\n * Note: You can override the `style` and `className` using\n * {@link menuStyle} and {@link menuClassName} instead for convenience.\n *\n * @example\n * ```tsx\n * <DropdownMenu\n * {...props}\n * menuProps={{\n * style: {\n * // custom inline style\n * },\n * className: \"come-class-name\",\n * getFixedPositionOptions: () => ({\n * preventOverlap: true,\n * }),\n * }}\n * />\n * ```\n */\n menuProps?: PropsWithRef<\n Omit<\n MenuProps,\n | \"children\"\n | \"fixedTo\"\n | \"visible\"\n | \"onRequestClose\"\n | \"getDefaultFocusedIndex\"\n >,\n HTMLDivElement\n >;\n\n /**\n * Convenience prop to apply custom style to the `Menu` component.\n */\n menuStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `Menu` component.\n */\n menuClassName?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport type MenuFixedPositioningOptions = Omit<\n FixedPositioningOptions<HTMLElement, HTMLDivElement>,\n \"onScroll\" | \"onResize\" | \"nodeRef\" | \"disabled\"\n>;\n\n/**\n * @since 5.0.0\n * @since 6.0.0 Updated to use the latest Menu, Transition, and Portal API.\n */\nexport interface MenuProps\n extends HTMLAttributes<HTMLDivElement>,\n MenuConfiguration,\n MenuConfigurationProps,\n MenuFixedPositioningOptions,\n MenuOrientationProps,\n MenuTransitionProps,\n MenuListConvenienceProps,\n MenuSheetConvenienceProps {\n visible: boolean;\n onRequestClose: () => void;\n\n /**\n * @defaultValue `\"menu-\" + useId()`\n */\n id?: string;\n\n /**\n * This is used to set the default focus index when the menu is visible.\n *\n * @internal\n */\n getDefaultFocusedIndex?: GetDefaultFocusedIndex;\n\n /**\n * Custom style that should be applied to the menu only while not rendered\n * within a sheet since the {@link style} would be applied to both versions.\n */\n menuStyle?: CSSProperties;\n\n /**\n * Custom class name that should be applied only while not rendered within a\n * sheet.\n */\n menuClassName?: string;\n\n /**\n * @internal\n *\n * This is only used to update the default anchor when the DropdownMenu's\n * toggle is a floating action button.\n */\n floating?: FloatingActionButtonPosition;\n}\n\n/**\n * **Client Component**\n *\n * This component should generally only be used to implement context menus with\n * the `useContextMenu` hook. Otherwise, the `DropdownMenu` component should be\n * used.\n *\n * @see The `useContextMenu` hook for an example.\n *\n * @since 5.0.0\n * @since 6.0.0 Updated this component to implement all the `Menu`\n * functionality instead of requiring the `useMenu` hook and `MenuWidget`\n * component. In addition, the `renderAsSheet` behavior has been moved into this\n * implementation so that the `MenuRenderer` is no longer required and context\n * menus can appear as a `Sheet`.\n */\nexport const Menu = forwardRef<HTMLDivElement, LabelRequiredForA11y<MenuProps>>(\n function Menu(props, propRef) {\n const {\n id: propId,\n style: propStyle,\n role = \"menu\",\n children,\n horizontal: _horizontal,\n sheetHeader: _sheetHeader,\n sheetFooter: _sheetFooter,\n renderAsSheet: _renderAsSheet,\n sheetPosition: _sheetPosition,\n sheetVerticalSize: _sheetVerticalSize,\n sheetProps,\n sheetStyle,\n sheetClassName,\n menuStyle,\n menuClassName,\n disableElevation = false,\n temporary = true,\n tabIndex = -1,\n fixedTo,\n className,\n classNames,\n timeout,\n appear,\n enter,\n exit,\n onEnter,\n onEntering = noop,\n onEntered = noop,\n onExit,\n onExiting,\n onExited = noop,\n onKeyDown = noop,\n listProps,\n listStyle,\n listClassName,\n visible,\n onRequestClose,\n floating,\n anchor,\n closeOnResize = false,\n closeOnScroll = false,\n preventScroll = false,\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n width,\n transformOrigin = true,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n disableFixedPositioning,\n getFixedPositionOptions,\n disablePortal: propDisablePortal,\n disableTransition,\n ...remaining\n } = props;\n const { \"aria-label\": ariaLabel, \"aria-labelledby\": ariaLabelledBy } =\n props;\n\n const id = useEnsuredId(propId, \"menu\");\n const {\n root,\n menubar,\n menuitem,\n activeId,\n animatedOnceRef,\n hoverTimeoutRef,\n disableHoverMode,\n } = useMenuBarContext();\n const {\n horizontal,\n sheetHeader,\n sheetFooter,\n renderAsSheet,\n sheetPosition,\n sheetVerticalSize,\n } = useMenuConfiguration(props);\n const { isPhone } = useAppSize();\n const isSheet =\n renderAsSheet === true || (renderAsSheet === \"phone\" && isPhone);\n\n const entered = useRef(false);\n const cancelUnmountFocus = useRef(false);\n const hideWithoutRefocus = (): void => {\n cancelUnmountFocus.current = true;\n onRequestClose();\n };\n const mode = useUserInteractionMode();\n const mouse = mode === \"mouse\";\n\n const { eventHandlers, transitionOptions } = useFocusContainer({\n nodeRef: propRef,\n activate: visible,\n onKeyDown(event) {\n onKeyDown(event);\n\n // when a menu is within a sheet, it should not trigger the custom\n // keyboard behavior\n if (isSheet) {\n return;\n }\n\n switch (event.key) {\n case \"Escape\":\n // prevent parent components that have an \"Escape\" keypress event\n // from being triggered as well\n event.stopPropagation();\n disableHoverMode();\n onRequestClose();\n break;\n case \"Tab\":\n // since menus are portalled, tab index is kinda broke so just close\n // the menu instead of doing default tab behavior\n event.preventDefault();\n\n if (!menuitem) {\n // pressing the tab key should still cascade close all menus\n event.stopPropagation();\n }\n disableHoverMode();\n onRequestClose();\n break;\n case \"ArrowUp\":\n if (!root && menuitem && horizontal) {\n event.stopPropagation();\n event.preventDefault();\n onRequestClose();\n }\n break;\n case \"ArrowLeft\":\n if (!root && menuitem && !horizontal) {\n event.stopPropagation();\n event.preventDefault();\n onRequestClose();\n }\n break;\n }\n },\n onEntering(appearing) {\n onEntering(appearing);\n entered.current = true;\n },\n onEntered(appearing) {\n onEntered(appearing);\n entered.current = true;\n cancelUnmountFocus.current = false;\n animatedOnceRef.current = true;\n },\n onExited() {\n onExited();\n entered.current = false;\n },\n onExiting,\n disableTransition,\n isFocusTypeDisabled(type) {\n if (role === \"listbox\") {\n return !isSheet;\n }\n\n if (type === \"keyboard\") {\n return isSheet;\n }\n\n const isHoverDisabled = mouse && hoverTimeoutRef.current === 0;\n if (type === \"mount\") {\n return isHoverDisabled;\n }\n\n return (\n isHoverDisabled ||\n cancelUnmountFocus.current ||\n (root && !!activeId && id !== activeId)\n );\n },\n });\n\n const { ref, style, callbacks, updateStyle } = useFixedPositioning({\n ...transitionOptions,\n disabled: disableFixedPositioning,\n onEnter,\n style: isSheet ? propStyle : menuStyle,\n fixedTo,\n anchor: getDefaultAnchor({\n anchor,\n menubar,\n floating,\n menuitem: !root && menuitem,\n horizontal,\n }),\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n width,\n transformOrigin,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n getFixedPositionOptions,\n onResize: closeOnResize ? hideWithoutRefocus : undefined,\n onScroll(_event, data) {\n if (!data.visible || closeOnScroll) {\n hideWithoutRefocus();\n }\n },\n });\n const { rendered, disablePortal, elementProps } = useScaleTransition({\n nodeRef: ref,\n className: cnb(!isSheet && menuClassName, className),\n transitionIn: visible,\n vertical: !horizontal,\n temporary,\n timeout: isSheet || disableTransition ? 0 : timeout,\n classNames,\n appear,\n enter,\n exit,\n onExit,\n onExiting: transitionOptions.onExiting,\n exitedHidden: true,\n ...callbacks,\n });\n useScrollLock(visible && preventScroll);\n\n // need to make sure that the useEffect does not refire for hiding on click\n // events because of the `window.requestAnimationFrame`. It'll make it so\n // that menu items that update state are unable to close when clicked\n const hide = useRef(onRequestClose);\n useEffect(() => {\n hide.current = onRequestClose;\n });\n useEffect(() => {\n if (!visible) {\n return;\n }\n\n const callback = (event: globalThis.MouseEvent): void => {\n // this is required for when the transition is disabled\n if (!entered.current) {\n return;\n }\n\n // if the user clicks outside of the menu to close it, the toggle button\n // should not be focused. instead the nearest focusable element from the\n // click event should be focused when Tab or Shift + tab is pressed\n cancelUnmountFocus.current =\n !(event.target instanceof HTMLElement) ||\n !event.target.closest(`[role=\"${role}\"]`);\n\n // this won't be called if `event.stopPropagation()` is called\n hide.current();\n disableHoverMode();\n };\n\n // wait an animation frame so the initial click event that caused the menu\n // to become visible does not immediately close the menu\n const frame = window.requestAnimationFrame(() => {\n window.addEventListener(\"click\", callback);\n });\n\n return () => {\n window.cancelAnimationFrame(frame);\n window.removeEventListener(\"click\", callback);\n };\n }, [disableHoverMode, role, visible]);\n useIsomorphicLayoutEffect(() => {\n if (!visible) {\n return;\n }\n\n updateStyle();\n }, [updateStyle, children, visible]);\n\n return (\n <MenuConfigurationProvider\n horizontal={horizontal}\n renderAsSheet={renderAsSheet}\n sheetFooter={sheetFooter}\n sheetHeader={sheetHeader}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n >\n <MenuSheet\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy as string}\n header={sheetHeader}\n footer={sheetFooter}\n position={sheetPosition}\n verticalSize={sheetVerticalSize}\n visible={visible}\n enabled={isSheet}\n onRequestClose={onRequestClose}\n style={sheetStyle}\n className={sheetClassName}\n disablePortal={propDisablePortal}\n temporary={temporary}\n disableTransition={disableTransition}\n {...sheetProps}\n >\n <Portal disabled={isSheet || (propDisablePortal ?? disablePortal)}>\n {(rendered || isSheet) && (\n <MenuWidget\n {...remaining}\n {...elementProps}\n {...eventHandlers}\n id={id}\n role={role}\n style={isSheet ? propStyle : style}\n isSheet={isSheet}\n tabIndex={tabIndex}\n horizontal={horizontal}\n listProps={listProps}\n listStyle={listStyle}\n listClassName={listClassName}\n disableElevation={disableElevation}\n cancelUnmountFocus={cancelUnmountFocus}\n >\n {children}\n </MenuWidget>\n )}\n </Portal>\n </MenuSheet>\n </MenuConfigurationProvider>\n );\n }\n);\n"],"names":["cnb","forwardRef","useEffect","useRef","useFocusContainer","useUserInteractionMode","useAppSize","Portal","useFixedPositioning","useScrollLock","useScaleTransition","useEnsuredId","useIsomorphicLayoutEffect","MenuConfigurationProvider","useMenuConfiguration","MenuSheet","MenuWidget","useMenuBarContext","getDefaultAnchor","noop","Menu","props","propRef","id","propId","style","propStyle","role","children","horizontal","_horizontal","sheetHeader","_sheetHeader","sheetFooter","_sheetFooter","renderAsSheet","_renderAsSheet","sheetPosition","_sheetPosition","sheetVerticalSize","_sheetVerticalSize","sheetProps","sheetStyle","sheetClassName","menuStyle","menuClassName","disableElevation","temporary","tabIndex","fixedTo","className","classNames","timeout","appear","enter","exit","onEnter","onEntering","onEntered","onExit","onExiting","onExited","onKeyDown","listProps","listStyle","listClassName","visible","onRequestClose","floating","anchor","closeOnResize","closeOnScroll","preventScroll","vwMargin","vhMargin","xMargin","yMargin","width","transformOrigin","preventOverlap","disableSwapping","disableVHBounds","initialX","initialY","disableFixedPositioning","getFixedPositionOptions","disablePortal","propDisablePortal","disableTransition","remaining","ariaLabel","ariaLabelledBy","root","menubar","menuitem","activeId","animatedOnceRef","hoverTimeoutRef","disableHoverMode","isPhone","isSheet","entered","cancelUnmountFocus","hideWithoutRefocus","current","mode","mouse","eventHandlers","transitionOptions","nodeRef","activate","event","key","stopPropagation","preventDefault","appearing","isFocusTypeDisabled","type","isHoverDisabled","ref","callbacks","updateStyle","disabled","onResize","undefined","onScroll","_event","data","rendered","elementProps","transitionIn","vertical","exitedHidden","hide","callback","target","HTMLElement","closest","frame","window","requestAnimationFrame","addEventListener","cancelAnimationFrame","removeEventListener","aria-label","aria-labelledby","header","footer","position","verticalSize","enabled"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAGEC,UAAU,EACVC,SAAS,EACTC,MAAM,QACD,QAAQ;AAGf,SAASC,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O;YACLK,OAAOG,oBAAoB,CAACJ;YAC5BC,OAAOI,mBAAmB,CAAC,SAAST;QACtC;IACF,GAAG;QAACpC;QAAkBvE;QAAMuC;KAAQ;IACpCtD,0BAA0B;QACxB,IAAI,CAACsD,SAAS;YACZ;QACF;QAEAuD;IACF,GAAG;QAACA;QAAa7F;QAAUsC;KAAQ;IAEnC,qBACE,KAACrD;QACCgB,YAAYA;QACZM,eAAeA;QACfF,aAAaA;QACbF,aAAaA;QACbM,eAAeA;QACfE,mBAAmBA;kBAEnB,cAAA,KAACxB;YACCiI,cAAYtD;YACZuD,mBAAiBtD;YACjBuD,QAAQnH;YACRoH,QAAQlH;YACRmH,UAAU/G;YACVgH,cAAc9G;YACd2B,SAASA;YACToF,SAASlD;YACTjC,gBAAgBA;YAChB1C,OAAOiB;YACPQ,WAAWP;YACX2C,eAAeC;YACfxC,WAAWA;YACXyC,mBAAmBA;YAClB,GAAG/C,UAAU;sBAEd,cAAA,KAAClC;gBAAOmH,UAAUtB,WAAYb,CAAAA,qBAAqBD,aAAY;0BAC5D,AAAC0C,CAAAA,YAAY5B,OAAM,mBAClB,KAACpF;oBACE,GAAGyE,SAAS;oBACZ,GAAGwC,YAAY;oBACf,GAAGtB,aAAa;oBACjBpF,IAAIA;oBACJI,MAAMA;oBACNF,OAAO2E,UAAU1E,YAAYD;oBAC7B2E,SAASA;oBACTpD,UAAUA;oBACVnB,YAAYA;oBACZkC,WAAWA;oBACXC,WAAWA;oBACXC,eAAeA;oBACfnB,kBAAkBA;oBAClBwD,oBAAoBA;8BAEnB1E;;;;;AAOf,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/MenuBar.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef } from \"react\";\nimport { List, type ListProps } from \"../list/List.js\";\nimport {\n KeyboardMovementProvider,\n useKeyboardMovementProvider,\n} from \"../movement/useKeyboardMovementProvider.js\";\nimport { MenuBarProvider, useMenuBarProvider } from \"./useMenuBarProvider.js\";\n\nexport interface MenuBarProps extends Omit<ListProps, \"role\"> {\n /**\n * @defaultValue `true`\n */\n horizontal?: boolean;\n\n /**\n * Set this to a number greater than 0 to allow opening dropdown menus within\n * the menubar after hovering for the duration in milliseconds. Once a menu\n * becomes visible within the menubar, all subsequent menus will become\n * visible immediately on hover as well until the hover mode is ended.\n *\n * For example:\n *\n * - `0` - the dropdown menus become visible immediately on hover\n * - `1000` - the first dropdown menu becomes visible after hovering for 1\n * second\n * - `undefined` - the hover mode can only be activate after a click with\n * mouse, touch, or keyboard\n *\n * @defaultValue `undefined`\n */\n hoverTimeout?: number;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { DropdownMenu, MenuBar, MenuItem } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * export function SimpleExample(): ReactElement {\n * return (\n * <MenuBar>\n * <DropdownMenu buttonChildren=\"Item 1\">\n * <MenuItem>Menu Item 1</MenuItem>\n * <MenuItem>Menu Item 2</MenuItem>\n * <MenuItem>Menu Item 3</MenuItem>\n * </DropdownMenu>\n * <DropdownMenu buttonChildren=\"Item 2\">\n * <MenuItem>Menu Item 1</MenuItem>\n * <MenuItem>Menu Item 2</MenuItem>\n * <MenuItem>Menu Item 3</MenuItem>\n * </DropdownMenu>\n * <DropdownMenu buttonChildren=\"Item 3\">\n * <MenuItem>Menu Item 1</MenuItem>\n * <MenuItem>Menu Item 2</MenuItem>\n * <MenuItem>Menu Item 4</MenuItem>\n * </DropdownMenu>\n * </MenuBar>\n * );\n * }\n * ```\n *\n * @since 5.0.0\n * @since 6.0.0 Combined with the previous `MenuBarWidget`\n */\nexport const MenuBar = forwardRef<HTMLUListElement, MenuBarProps>(\n function MenuBar(props, ref) {\n const {\n onClick,\n onFocus,\n onKeyDown,\n horizontal = true,\n hoverTimeout,\n children,\n ...remaining\n } = props;\n const menuBarContext = useMenuBarProvider({\n root: true,\n menubar: true,\n hoverTimeout,\n });\n const { activeId, enableHoverMode } = menuBarContext;\n const { movementProps, movementContext } = useKeyboardMovementProvider({\n onClick,\n onFocus,\n onKeyDown,\n loopable: true,\n searchable: true,\n horizontal,\n includeDisabled: true,\n tabIndexBehavior: \"roving\",\n onFocusChange(event) {\n if (activeId) {\n enableHoverMode(event.element.id);\n }\n },\n });\n\n return (\n <KeyboardMovementProvider value={movementContext}>\n <MenuBarProvider value={menuBarContext}>\n <List\n {...remaining}\n {...movementProps}\n ref={ref}\n role=\"menubar\"\n horizontal={horizontal}\n >\n {children}\n </List>\n </MenuBarProvider>\n </KeyboardMovementProvider>\n );\n }\n);\n"],"names":["forwardRef","List","KeyboardMovementProvider","useKeyboardMovementProvider","MenuBarProvider","useMenuBarProvider","MenuBar","props","ref","onClick","onFocus","onKeyDown","horizontal","hoverTimeout","children","remaining","menuBarContext","root","menubar","activeId","enableHoverMode","movementProps","movementContext","loopable","searchable","includeDisabled","tabIndexBehavior","onFocusChange","event","element","id","value","role"],"mappings":"AAAA;;AACA,SAASA,UAAU,QAAQ,QAAQ;AACnC,SAASC,IAAI,QAAwB,kBAAkB;AACvD,SACEC,wBAAwB,EACxBC,2BAA2B,QACtB,6CAA6C;AACpD,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,0BAA0B;AA2B9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCC,GACD,OAAO,MAAMC,wBAAUN,WACrB,SAASM,QAAQC,KAAK,EAAEC,GAAG;IACzB,MAAM,EACJC,OAAO,EACPC,OAAO,EACPC,SAAS,EACTC,aAAa,IAAI,EACjBC,YAAY,EACZC,QAAQ,EACR,GAAGC,WACJ,GAAGR;IACJ,MAAMS,iBAAiBX,mBAAmB;QACxCY,MAAM;QACNC,SAAS;QACTL;IACF;IACA,MAAM,EAAEM,QAAQ,EAAEC,eAAe,EAAE,GAAGJ;IACtC,MAAM,EAAEK,aAAa,EAAEC,eAAe,EAAE,GAAGnB,4BAA4B;QACrEM;QACAC;QACAC;QACAY,UAAU;QACVC,YAAY;QACZZ;QACAa,iBAAiB;QACjBC,kBAAkB;QAClBC,eAAcC,KAAK;YACjB,IAAIT,UAAU;gBACZC,gBAAgBQ,MAAMC,OAAO,CAACC,EAAE;YAClC;QACF;IACF;IAEA,qBACE,KAAC5B;QAAyB6B,OAAOT;kBAC/B,cAAA,KAAClB;YAAgB2B,OAAOf;sBACtB,cAAA,KAACf;gBACE,GAAGc,SAAS;gBACZ,GAAGM,aAAa;gBACjBb,KAAKA;gBACLwB,MAAK;gBACLpB,YAAYA;0BAEXE;;;;AAKX,GACA"}
1
+ {"version":3,"sources":["../../src/menu/MenuBar.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\n\nimport { List, type ListProps } from \"../list/List.js\";\nimport {\n KeyboardMovementProvider,\n useKeyboardMovementProvider,\n} from \"../movement/useKeyboardMovementProvider.js\";\nimport { MenuBarProvider, useMenuBarProvider } from \"./useMenuBarProvider.js\";\n\nexport interface MenuBarProps extends Omit<ListProps, \"role\"> {\n /**\n * @defaultValue `true`\n */\n horizontal?: boolean;\n\n /**\n * Set this to a number greater than 0 to allow opening dropdown menus within\n * the menubar after hovering for the duration in milliseconds. Once a menu\n * becomes visible within the menubar, all subsequent menus will become\n * visible immediately on hover as well until the hover mode is ended.\n *\n * For example:\n *\n * - `0` - the dropdown menus become visible immediately on hover\n * - `1000` - the first dropdown menu becomes visible after hovering for 1\n * second\n * - `undefined` - the hover mode can only be activate after a click with\n * mouse, touch, or keyboard\n *\n * @defaultValue `undefined`\n */\n hoverTimeout?: number;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { DropdownMenu, MenuBar, MenuItem } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * export function SimpleExample(): ReactElement {\n * return (\n * <MenuBar>\n * <DropdownMenu buttonChildren=\"Item 1\">\n * <MenuItem>Menu Item 1</MenuItem>\n * <MenuItem>Menu Item 2</MenuItem>\n * <MenuItem>Menu Item 3</MenuItem>\n * </DropdownMenu>\n * <DropdownMenu buttonChildren=\"Item 2\">\n * <MenuItem>Menu Item 1</MenuItem>\n * <MenuItem>Menu Item 2</MenuItem>\n * <MenuItem>Menu Item 3</MenuItem>\n * </DropdownMenu>\n * <DropdownMenu buttonChildren=\"Item 3\">\n * <MenuItem>Menu Item 1</MenuItem>\n * <MenuItem>Menu Item 2</MenuItem>\n * <MenuItem>Menu Item 4</MenuItem>\n * </DropdownMenu>\n * </MenuBar>\n * );\n * }\n * ```\n *\n * @since 5.0.0\n * @since 6.0.0 Combined with the previous `MenuBarWidget`\n */\nexport const MenuBar = forwardRef<HTMLUListElement, MenuBarProps>(\n function MenuBar(props, ref) {\n const {\n onClick,\n onFocus,\n onKeyDown,\n horizontal = true,\n hoverTimeout,\n children,\n ...remaining\n } = props;\n const menuBarContext = useMenuBarProvider({\n root: true,\n menubar: true,\n hoverTimeout,\n });\n const { activeId, enableHoverMode } = menuBarContext;\n const { movementProps, movementContext } = useKeyboardMovementProvider({\n onClick,\n onFocus,\n onKeyDown,\n loopable: true,\n searchable: true,\n horizontal,\n includeDisabled: true,\n tabIndexBehavior: \"roving\",\n onFocusChange(event) {\n if (activeId) {\n enableHoverMode(event.element.id);\n }\n },\n });\n\n return (\n <KeyboardMovementProvider value={movementContext}>\n <MenuBarProvider value={menuBarContext}>\n <List\n {...remaining}\n {...movementProps}\n ref={ref}\n role=\"menubar\"\n horizontal={horizontal}\n >\n {children}\n </List>\n </MenuBarProvider>\n </KeyboardMovementProvider>\n );\n }\n);\n"],"names":["forwardRef","List","KeyboardMovementProvider","useKeyboardMovementProvider","MenuBarProvider","useMenuBarProvider","MenuBar","props","ref","onClick","onFocus","onKeyDown","horizontal","hoverTimeout","children","remaining","menuBarContext","root","menubar","activeId","enableHoverMode","movementProps","movementContext","loopable","searchable","includeDisabled","tabIndexBehavior","onFocusChange","event","element","id","value","role"],"mappings":"AAAA;;AAEA,SAASA,UAAU,QAAQ,QAAQ;AAEnC,SAASC,IAAI,QAAwB,kBAAkB;AACvD,SACEC,wBAAwB,EACxBC,2BAA2B,QACtB,6CAA6C;AACpD,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,0BAA0B;AA2B9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCC,GACD,OAAO,MAAMC,wBAAUN,WACrB,SAASM,QAAQC,KAAK,EAAEC,GAAG;IACzB,MAAM,EACJC,OAAO,EACPC,OAAO,EACPC,SAAS,EACTC,aAAa,IAAI,EACjBC,YAAY,EACZC,QAAQ,EACR,GAAGC,WACJ,GAAGR;IACJ,MAAMS,iBAAiBX,mBAAmB;QACxCY,MAAM;QACNC,SAAS;QACTL;IACF;IACA,MAAM,EAAEM,QAAQ,EAAEC,eAAe,EAAE,GAAGJ;IACtC,MAAM,EAAEK,aAAa,EAAEC,eAAe,EAAE,GAAGnB,4BAA4B;QACrEM;QACAC;QACAC;QACAY,UAAU;QACVC,YAAY;QACZZ;QACAa,iBAAiB;QACjBC,kBAAkB;QAClBC,eAAcC,KAAK;YACjB,IAAIT,UAAU;gBACZC,gBAAgBQ,MAAMC,OAAO,CAACC,EAAE;YAClC;QACF;IACF;IAEA,qBACE,KAAC5B;QAAyB6B,OAAOT;kBAC/B,cAAA,KAAClB;YAAgB2B,OAAOf;sBACtB,cAAA,KAACf;gBACE,GAAGc,SAAS;gBACZ,GAAGM,aAAa;gBACjBb,KAAKA;gBACLwB,MAAK;gBACLpB,YAAYA;0BAEXE;;;;AAKX,GACA"}
@@ -2,8 +2,8 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { forwardRef } from "react";
4
4
  import { Button } from "../button/Button.js";
5
- import { getIcon } from "../icon/iconConfig.js";
6
5
  import { IconRotator } from "../icon/IconRotator.js";
6
+ import { getIcon } from "../icon/config.js";
7
7
  import { useAppSize } from "../media-queries/AppSizeProvider.js";
8
8
  import { useEnsuredId } from "../useEnsuredId.js";
9
9
  import { useMenuConfiguration } from "./MenuConfigurationProvider.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/MenuButton.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef } from \"react\";\nimport { Button, type ButtonProps } from \"../button/Button.js\";\nimport { getIcon } from \"../icon/iconConfig.js\";\nimport { IconRotator, type IconRotatorProps } from \"../icon/IconRotator.js\";\nimport { type TextIconSpacingProps } from \"../icon/TextIconSpacing.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useMenuConfiguration } from \"./MenuConfigurationProvider.js\";\nimport { useMenuVisibility } from \"./MenuVisibilityProvider.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/** @since 5.0.0 */\nexport type MenuButtonTextIconSpacingProps = Pick<\n TextIconSpacingProps,\n \"icon\" | \"iconAfter\"\n>;\n\n/** @since 5.0.0 */\nexport type MenuButtonIconRotatorProps = Omit<\n IconRotatorProps,\n \"children\" | \"rotated\"\n>;\n\n/**\n * @since 5.0.0\n * @since 6.0.0 No longer extends the {@link ButtonProps}, no longer\n * requires an `id`, and no longer supports `textIconSpacingProps`.\n */\nexport interface BaseMenuButtonProps extends MenuButtonTextIconSpacingProps {\n /**\n * Any additional props to pass to the {@link IconRotator} component that\n * surrounds the {@link buttonChildren}\n */\n iconRotatorProps?: Readonly<MenuButtonIconRotatorProps>;\n\n /**\n * Boolean if the dropdown icon should be included with the button children.\n *\n * @defaultValue `buttonType === \"icon\"`\n */\n disableDropdownIcon?: boolean;\n}\n\n/**\n * @since 5.0.0\n * @since 6.0.0 See {@link BaseMenuButtonProps} for breaking changes.\n */\nexport interface MenuButtonProps extends ButtonProps, BaseMenuButtonProps {}\n\n/**\n * **Client Component**\n *\n * An internal component that handles rendering a button for the `DropdownMenu`\n * while implementing the correct accessibility and keyboard movement.\n *\n * @since 5.0.0\n * @since 6.0.0 See {@link BaseMenuButtonProps} for breaking changes.\n */\nexport const MenuButton = forwardRef<HTMLButtonElement, MenuButtonProps>(\n function MenuButton(props, ref) {\n const {\n id: propId,\n onClick = noop,\n onKeyDown = noop,\n icon: propIcon,\n iconAfter = true,\n iconRotatorProps,\n floating,\n buttonType = floating ? \"icon\" : \"text\",\n disableDropdownIcon = buttonType === \"icon\",\n children,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"menubutton\");\n const { visible, setVisible, defaultFocusIndex } = useMenuVisibility();\n const { renderAsSheet } = useMenuConfiguration();\n const { isPhone } = useAppSize();\n const isSheet =\n renderAsSheet === true || (renderAsSheet === \"phone\" && isPhone);\n\n const dropdownIcon = getIcon(\"dropdown\", propIcon);\n let icon = propIcon;\n if (!disableDropdownIcon) {\n icon = (\n <IconRotator {...iconRotatorProps} rotated={visible}>\n {dropdownIcon}\n </IconRotator>\n );\n }\n\n return (\n <Button\n {...remaining}\n aria-haspopup={isSheet ? \"dialog\" : \"menu\"}\n aria-expanded={visible || undefined}\n id={id}\n ref={ref}\n floating={floating}\n buttonType={buttonType}\n onClick={(event) => {\n onClick(event);\n\n defaultFocusIndex.current = 0;\n setVisible((prevVisible) => !prevVisible);\n }}\n onKeyDown={(event) => {\n onKeyDown(event);\n\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n event.stopPropagation();\n defaultFocusIndex.current = 0;\n setVisible(true);\n break;\n case \"ArrowUp\":\n event.preventDefault();\n event.stopPropagation();\n defaultFocusIndex.current = -1;\n setVisible(true);\n break;\n }\n }}\n >\n {!iconAfter && icon}\n {children}\n {iconAfter && icon}\n </Button>\n );\n }\n);\n"],"names":["forwardRef","Button","getIcon","IconRotator","useAppSize","useEnsuredId","useMenuConfiguration","useMenuVisibility","noop","MenuButton","props","ref","id","propId","onClick","onKeyDown","icon","propIcon","iconAfter","iconRotatorProps","floating","buttonType","disableDropdownIcon","children","remaining","visible","setVisible","defaultFocusIndex","renderAsSheet","isPhone","isSheet","dropdownIcon","rotated","aria-haspopup","aria-expanded","undefined","event","current","prevVisible","key","preventDefault","stopPropagation"],"mappings":"AAAA;;AACA,SAASA,UAAU,QA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CAACY,cAAgB,CAACA;QAC/B;QACAvB,WAAW,CAACqB;YACVrB,UAAUqB;YAEV,OAAQA,MAAMG,GAAG;gBACf,KAAK;oBACHH,MAAMI,cAAc;oBACpBJ,MAAMK,eAAe;oBACrBd,kBAAkBU,OAAO,GAAG;oBAC5BX,WAAW;oBACX;gBACF,KAAK;oBACHU,MAAMI,cAAc;oBACpBJ,MAAMK,eAAe;oBACrBd,kBAAkBU,OAAO,GAAG,CAAC;oBAC7BX,WAAW;oBACX;YACJ;QACF;;YAEC,CAACR,aAAaF;YACdO;YACAL,aAAaF;;;AAGpB,GACA"}
1
+ {"version":3,"sources":["../../src/menu/MenuButton.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\n\nimport { Button, type ButtonProps } from \"../button/Button.js\";\nimport { IconRotator, type IconRotatorProps } from \"../icon/IconRotator.js\";\nimport { type TextIconSpacingProps } from \"../icon/TextIconSpacing.js\";\nimport { getIcon } from \"../icon/config.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useMenuConfiguration } from \"./MenuConfigurationProvider.js\";\nimport { useMenuVisibility } from \"./MenuVisibilityProvider.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/** @since 5.0.0 */\nexport type MenuButtonTextIconSpacingProps = Pick<\n TextIconSpacingProps,\n \"icon\" | \"iconAfter\"\n>;\n\n/** @since 5.0.0 */\nexport type MenuButtonIconRotatorProps = Omit<\n IconRotatorProps,\n \"children\" | \"rotated\"\n>;\n\n/**\n * @since 5.0.0\n * @since 6.0.0 No longer extends the {@link ButtonProps}, no longer\n * requires an `id`, and no longer supports `textIconSpacingProps`.\n */\nexport interface BaseMenuButtonProps extends MenuButtonTextIconSpacingProps {\n /**\n * Any additional props to pass to the {@link IconRotator} component that\n * surrounds the {@link buttonChildren}\n */\n iconRotatorProps?: Readonly<MenuButtonIconRotatorProps>;\n\n /**\n * Boolean if the dropdown icon should be included with the button children.\n *\n * @defaultValue `buttonType === \"icon\"`\n */\n disableDropdownIcon?: boolean;\n}\n\n/**\n * @since 5.0.0\n * @since 6.0.0 See {@link BaseMenuButtonProps} for breaking changes.\n */\nexport interface MenuButtonProps extends ButtonProps, BaseMenuButtonProps {}\n\n/**\n * **Client Component**\n *\n * An internal component that handles rendering a button for the `DropdownMenu`\n * while implementing the correct accessibility and keyboard movement.\n *\n * @since 5.0.0\n * @since 6.0.0 See {@link BaseMenuButtonProps} for breaking changes.\n */\nexport const MenuButton = forwardRef<HTMLButtonElement, MenuButtonProps>(\n function MenuButton(props, ref) {\n const {\n id: propId,\n onClick = noop,\n onKeyDown = noop,\n icon: propIcon,\n iconAfter = true,\n iconRotatorProps,\n floating,\n buttonType = floating ? \"icon\" : \"text\",\n disableDropdownIcon = buttonType === \"icon\",\n children,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"menubutton\");\n const { visible, setVisible, defaultFocusIndex } = useMenuVisibility();\n const { renderAsSheet } = useMenuConfiguration();\n const { isPhone } = useAppSize();\n const isSheet =\n renderAsSheet === true || (renderAsSheet === \"phone\" && isPhone);\n\n const dropdownIcon = getIcon(\"dropdown\", propIcon);\n let icon = propIcon;\n if (!disableDropdownIcon) {\n icon = (\n <IconRotator {...iconRotatorProps} rotated={visible}>\n {dropdownIcon}\n </IconRotator>\n );\n }\n\n return (\n <Button\n {...remaining}\n aria-haspopup={isSheet ? \"dialog\" : \"menu\"}\n aria-expanded={visible || undefined}\n id={id}\n ref={ref}\n floating={floating}\n buttonType={buttonType}\n onClick={(event) => {\n onClick(event);\n\n defaultFocusIndex.current = 0;\n setVisible((prevVisible) => !prevVisible);\n }}\n onKeyDown={(event) => {\n onKeyDown(event);\n\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n event.stopPropagation();\n defaultFocusIndex.current = 0;\n setVisible(true);\n break;\n case \"ArrowUp\":\n event.preventDefault();\n event.stopPropagation();\n defaultFocusIndex.current = -1;\n setVisible(true);\n break;\n }\n }}\n >\n {!iconAfter && icon}\n {children}\n {iconAfter && icon}\n </Button>\n );\n }\n);\n"],"names":["forwardRef","Button","IconRotator","getIcon","useAppSize","useEnsuredId","useMenuConfiguration","useMenuVisibility","noop","MenuButton","props","ref","id","propId","onClick","onKeyDown","icon","propIcon","iconAfter","iconRotatorProps","floating","buttonType","disableDropdownIcon","children","remaining","visible","setVisible","defaultFocusIndex","renderAsSheet","isPhone","isSheet","dropdownIcon","rotated","aria-haspopup","aria-expanded","undefined","event","current","prevVisible","key","preventDefault","stopPropagation"],"mappings":"AAAA;;AAEA,SAASA,UAAU,QAAQ,QAAQ;AAEnC,SAASC,MAAM,QAA0B,sBAAsB;AAC/D,SAASC,WAAW,QAA+B,yBAAyB;AAE5E,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,UAAU,QAAQ,sCAAsC;AACjE,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,oBAAoB,QAAQ,iCAAiC;AACtE,SAASC,iBAAiB,QAAQ,8BAA8B;AAEhE,MAAMC,OAAO;AACX,aAAa;AACf;AAwCA;;;;;;;;CAQC,GACD,OAAO,MAAMC,2BAAaT,WACxB,SAASS,WAAWC,KAAK,EAAEC,GAAG;IAC5B,MAAM,EACJC,IAAIC,MAAM,EACVC,UAAUN,IAAI,EACdO,YAAYP,IAAI,EAChBQ,MAAMC,QAAQ,EACdC,YAAY,IAAI,EAChBC,gBAAgB,EAChBC,QAAQ,EACRC,aAAaD,WAAW,SAAS,MAAM,EACvCE,sBAAsBD,eAAe,MAAM,EAC3CE,QAAQ,EACR,GAAGC,WACJ,GAAGd;IACJ,MAAME,KAAKP,aAAaQ,QAAQ;IAChC,MAAM,EAAEY,OAAO,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GAAGpB;IACnD,MAAM,EAAEqB,aAAa,EAAE,GAAGtB;IAC1B,MAAM,EAAEuB,OAAO,EAAE,GAAGzB;IACpB,MAAM0B,UACJF,kBAAkB,QAASA,kBAAkB,WAAWC;IAE1D,MAAME,eAAe5B,QAAQ,YAAYc;IACzC,IAAID,OAAOC;IACX,IAAI,CAACK,qBAAqB;QACxBN,qBACE,KAACd;YAAa,GAAGiB,gBAAgB;YAAEa,SAASP;sBACzCM;;IAGP;IAEA,qBACE,MAAC9B;QACE,GAAGuB,SAAS;QACbS,iBAAeH,UAAU,WAAW;QACpCI,iBAAeT,WAAWU;QAC1BvB,IAAIA;QACJD,KAAKA;QACLS,UAAUA;QACVC,YAAYA;QACZP,SAAS,CAACsB;YACRtB,QAAQsB;YAERT,kBAAkBU,OAAO,GAAG;YAC5BX,WAAW,CAACY,cAAgB,CAACA;QAC/B;QACAvB,WAAW,CAACqB;YACVrB,UAAUqB;YAEV,OAAQA,MAAMG,GAAG;gBACf,KAAK;oBACHH,MAAMI,cAAc;oBACpBJ,MAAMK,eAAe;oBACrBd,kBAAkBU,OAAO,GAAG;oBAC5BX,WAAW;oBACX;gBACF,KAAK;oBACHU,MAAMI,cAAc;oBACpBJ,MAAMK,eAAe;oBACrBd,kBAAkBU,OAAO,GAAG,CAAC;oBAC7BX,WAAW;oBACX;YACJ;QACF;;YAEC,CAACR,aAAaF;YACdO;YACAL,aAAaF;;;AAGpB,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/MenuConfigurationProvider.tsx"],"sourcesContent":["\"use client\";\nimport {\n createContext,\n useContext,\n useMemo,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { type SheetPosition, type SheetVerticalSize } from \"../sheet/styles.js\";\n\n/** @since 5.0.0 */\nexport interface MenuOrientationProps {\n /**\n * Boolean if the menu should be rendered horizontally instead of vertically.\n * This will also update the `aria-orientation`.\n *\n * @defaultValue `false`\n */\n horizontal?: boolean;\n}\n\n/**\n * This allows the menu to be conditionally rendered as a `Sheet` instead of a\n * menu.\n *\n * - `false` - always render as a `Menu`\n * - `true` - always render as a `Sheet`\n * - `\"phone\"` - render as a sheet only when the {@link AppSize} is considered\n * phone (`isPhone === true`).\n *\n * @defaultValue `false`\n * @since 5.0.0\n */\nexport type RenderMenuAsSheet = boolean | \"phone\";\n\n/** @since 5.0.0 */\nexport interface MenuConfiguration extends MenuOrientationProps {\n /** {@inheritDoc RenderMenuAsSheet} */\n renderAsSheet?: RenderMenuAsSheet;\n\n /**\n * @see {@link SheetPosition}\n * @defaultValue `\"bottom\"`\n */\n sheetPosition?: SheetPosition;\n\n /**\n * @see {@link SheetVerticalSize}\n * @defaultValue `\"touch\"`\n */\n sheetVerticalSize?: SheetVerticalSize;\n\n /**\n * Any children to render above the sheet's menu implementation. This would\n * normally be something like a `<DialogHeader>` or `AppBar`.\n *\n * @defaultValue `null`\n */\n sheetHeader?: ReactNode;\n\n /**\n * Any children to render below the sheet's menu implementation. This would\n * normally be something like a `<DialogFooter>`.\n *\n * @defaultValue `null`\n */\n sheetFooter?: ReactNode;\n}\n\n/** @since 5.0.0 */\nexport type MenuConfigurationContext = Required<MenuConfiguration>;\n\n/** @since 5.0.0 */\nexport const DEFAULT_MENU_CONFIGURATION: Readonly<MenuConfiguration> = {\n horizontal: false,\n renderAsSheet: false,\n sheetHeader: null,\n sheetFooter: null,\n sheetPosition: \"bottom\",\n sheetVerticalSize: \"touch\",\n};\n\n/**\n * @internal\n * @since 5.0.0\n */\nconst context = createContext<MenuConfigurationContext>({\n horizontal: false,\n renderAsSheet: false,\n sheetHeader: null,\n sheetFooter: null,\n sheetPosition: \"bottom\",\n sheetVerticalSize: \"touch\",\n});\ncontext.displayName = \"MenuConfiguration\";\n\n/**\n * @internal\n * @since 5.0.0\n */\nconst { Provider } = context;\n\n/**\n * This is probably just an internal only hook that allows you to get the\n * {@link MenuConfigurationContext} with optional overrides.\n *\n * @param overrides - An object of {@link MenuConfiguration} that would override\n * the inherited context values if they are not `undefined`.\n * @returns the {@link MenuConfigurationContext} with any overrides that were\n * provided.\n * @since 5.0.0\n */\nexport function useMenuConfiguration(\n overrides: MenuConfiguration = {}\n): Readonly<MenuConfigurationContext> {\n const {\n horizontal,\n renderAsSheet,\n sheetHeader,\n sheetFooter,\n sheetPosition,\n sheetVerticalSize,\n } = overrides;\n const inherited = useContext(context);\n\n return {\n horizontal: horizontal ?? inherited.horizontal,\n renderAsSheet: renderAsSheet ?? inherited.renderAsSheet,\n sheetHeader:\n sheetHeader === null ? null : (sheetHeader ?? inherited.sheetHeader),\n sheetFooter:\n sheetFooter === null ? null : (sheetFooter ?? inherited.sheetFooter),\n sheetPosition: sheetPosition ?? inherited.sheetPosition,\n sheetVerticalSize: sheetVerticalSize ?? inherited.sheetVerticalSize,\n };\n}\n\n/** @since 5.0.0 */\nexport interface MenuConfigurationProviderProps extends MenuConfiguration {\n children: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * Note: This will always merge values with any parent\n * `MenuConfigurationProvider`s.\n *\n * @since 5.0.0\n */\nexport function MenuConfigurationProvider(\n props: MenuConfigurationProviderProps\n): ReactElement {\n const { children, ...configuration } = props;\n const {\n horizontal,\n renderAsSheet,\n sheetHeader,\n sheetFooter,\n sheetPosition,\n sheetVerticalSize,\n } = useMenuConfiguration(configuration);\n\n const value = useMemo<MenuConfigurationContext>(\n () => ({\n horizontal,\n renderAsSheet,\n sheetHeader,\n sheetFooter,\n sheetPosition,\n sheetVerticalSize,\n }),\n [\n horizontal,\n renderAsSheet,\n sheetFooter,\n sheetHeader,\n sheetPosition,\n sheetVerticalSize,\n ]\n );\n\n return <Provider value={value}>{children}</Provider>;\n}\n"],"names":["createContext","useContext","useMemo","DEFAULT_MENU_CONFIGURATION","horizontal","renderAsSheet","sheetHeader","sheetFooter","sheetPosition","sheetVerticalSize","context","displayName","Provider","useMenuConfiguration","overrides","inherited","MenuConfigurationProvider","props","children","configuration","value"],"mappings":"AAAA;;AACA,SACEA,aAAa,EACbC,UAAU,EACVC,OAAO,QAGF,QAAQ;AAiEf,iBAAiB,GACjB,OAAO,MAAMC,6BAA0D;IACrEC,YAAY;IACZC,eAAe;IACfC,aAAa;IACbC,aAAa;IACbC,eAAe;IACfC,mBAAmB;AACrB,EAAE;AAEF;;;CAGC,GACD,MAAMC,wBAAUV,cAAwC;IACtDI,YAAY;IACZC,eAAe;IACfC,aAAa;IACbC,aAAa;IACbC,eAAe;IACfC,mBAAmB;AACrB;AACAC,QAAQC,WAAW,GAAG;AAEtB;;;CAGC,GACD,MAAM,EAAEC,QAAQ,EAAE,GAAGF;AAErB;;;;;;;;;CASC,GACD,OAAO,SAASG,qBACdC,YAA+B,CAAC,CAAC;IAEjC,MAAM,EACJV,UAAU,EACVC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,aAAa,EACbC,iBAAiB,EAClB,GAAGK;IACJ,MAAMC,YAAYd,WAAWS;IAE7B,OAAO;QACLN,YAAYA,cAAcW,UAAUX,UAAU;QAC9CC,eAAeA,iBAAiBU,UAAUV,aAAa;QACvDC,aACEA,gBAAgB,OAAO,OAAQA,eAAeS,UAAUT,WAAW;QACrEC,aACEA,gBAAgB,OAAO,OAAQA,eAAeQ,UAAUR,WAAW;QACrEC,eAAeA,iBAAiBO,UAAUP,aAAa;QACvDC,mBAAmBA,qBAAqBM,UAAUN,iBAAiB;IACrE;AACF;AAOA;;;;;;;CAOC,GACD,OAAO,SAASO,0BACdC,KAAqC;IAErC,MAAM,EAAEC,QAAQ,EAAE,GAAGC,eAAe,GAAGF;IACvC,MAAM,EACJb,UAAU,EACVC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,aAAa,EACbC,iBAAiB,EAClB,GAAGI,qBAAqBM;IAEzB,MAAMC,QAAQlB,QACZ,IAAO,CAAA;YACLE;YACAC;YACAC;YACAC;YACAC;YACAC;QACF,CAAA,GACA;QACEL;QACAC;QACAE;QACAD;QACAE;QACAC;KACD;IAGH,qBAAO,KAACG;QAASQ,OAAOA;kBAAQF;;AAClC"}
1
+ {"version":3,"sources":["../../src/menu/MenuConfigurationProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ReactElement,\n type ReactNode,\n createContext,\n useContext,\n useMemo,\n} from \"react\";\n\nimport { type SheetPosition, type SheetVerticalSize } from \"../sheet/styles.js\";\n\n/** @since 5.0.0 */\nexport interface MenuOrientationProps {\n /**\n * Boolean if the menu should be rendered horizontally instead of vertically.\n * This will also update the `aria-orientation`.\n *\n * @defaultValue `false`\n */\n horizontal?: boolean;\n}\n\n/**\n * This allows the menu to be conditionally rendered as a `Sheet` instead of a\n * menu.\n *\n * - `false` - always render as a `Menu`\n * - `true` - always render as a `Sheet`\n * - `\"phone\"` - render as a sheet only when the {@link AppSize} is considered\n * phone (`isPhone === true`).\n *\n * @defaultValue `false`\n * @since 5.0.0\n */\nexport type RenderMenuAsSheet = boolean | \"phone\";\n\n/** @since 5.0.0 */\nexport interface MenuConfiguration extends MenuOrientationProps {\n /** {@inheritDoc RenderMenuAsSheet} */\n renderAsSheet?: RenderMenuAsSheet;\n\n /**\n * @see {@link SheetPosition}\n * @defaultValue `\"bottom\"`\n */\n sheetPosition?: SheetPosition;\n\n /**\n * @see {@link SheetVerticalSize}\n * @defaultValue `\"touch\"`\n */\n sheetVerticalSize?: SheetVerticalSize;\n\n /**\n * Any children to render above the sheet's menu implementation. This would\n * normally be something like a `<DialogHeader>` or `AppBar`.\n *\n * @defaultValue `null`\n */\n sheetHeader?: ReactNode;\n\n /**\n * Any children to render below the sheet's menu implementation. This would\n * normally be something like a `<DialogFooter>`.\n *\n * @defaultValue `null`\n */\n sheetFooter?: ReactNode;\n}\n\n/** @since 5.0.0 */\nexport type MenuConfigurationContext = Required<MenuConfiguration>;\n\n/** @since 5.0.0 */\nexport const DEFAULT_MENU_CONFIGURATION: Readonly<MenuConfiguration> = {\n horizontal: false,\n renderAsSheet: false,\n sheetHeader: null,\n sheetFooter: null,\n sheetPosition: \"bottom\",\n sheetVerticalSize: \"touch\",\n};\n\n/**\n * @internal\n * @since 5.0.0\n */\nconst context = createContext<MenuConfigurationContext>({\n horizontal: false,\n renderAsSheet: false,\n sheetHeader: null,\n sheetFooter: null,\n sheetPosition: \"bottom\",\n sheetVerticalSize: \"touch\",\n});\ncontext.displayName = \"MenuConfiguration\";\n\n/**\n * @internal\n * @since 5.0.0\n */\nconst { Provider } = context;\n\n/**\n * This is probably just an internal only hook that allows you to get the\n * {@link MenuConfigurationContext} with optional overrides.\n *\n * @param overrides - An object of {@link MenuConfiguration} that would override\n * the inherited context values if they are not `undefined`.\n * @returns the {@link MenuConfigurationContext} with any overrides that were\n * provided.\n * @since 5.0.0\n */\nexport function useMenuConfiguration(\n overrides: MenuConfiguration = {}\n): Readonly<MenuConfigurationContext> {\n const {\n horizontal,\n renderAsSheet,\n sheetHeader,\n sheetFooter,\n sheetPosition,\n sheetVerticalSize,\n } = overrides;\n const inherited = useContext(context);\n\n return {\n horizontal: horizontal ?? inherited.horizontal,\n renderAsSheet: renderAsSheet ?? inherited.renderAsSheet,\n sheetHeader:\n sheetHeader === null ? null : (sheetHeader ?? inherited.sheetHeader),\n sheetFooter:\n sheetFooter === null ? null : (sheetFooter ?? inherited.sheetFooter),\n sheetPosition: sheetPosition ?? inherited.sheetPosition,\n sheetVerticalSize: sheetVerticalSize ?? inherited.sheetVerticalSize,\n };\n}\n\n/** @since 5.0.0 */\nexport interface MenuConfigurationProviderProps extends MenuConfiguration {\n children: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * Note: This will always merge values with any parent\n * `MenuConfigurationProvider`s.\n *\n * @since 5.0.0\n */\nexport function MenuConfigurationProvider(\n props: MenuConfigurationProviderProps\n): ReactElement {\n const { children, ...configuration } = props;\n const {\n horizontal,\n renderAsSheet,\n sheetHeader,\n sheetFooter,\n sheetPosition,\n sheetVerticalSize,\n } = useMenuConfiguration(configuration);\n\n const value = useMemo<MenuConfigurationContext>(\n () => ({\n horizontal,\n renderAsSheet,\n sheetHeader,\n sheetFooter,\n sheetPosition,\n sheetVerticalSize,\n }),\n [\n horizontal,\n renderAsSheet,\n sheetFooter,\n sheetHeader,\n sheetPosition,\n sheetVerticalSize,\n ]\n );\n\n return <Provider value={value}>{children}</Provider>;\n}\n"],"names":["createContext","useContext","useMemo","DEFAULT_MENU_CONFIGURATION","horizontal","renderAsSheet","sheetHeader","sheetFooter","sheetPosition","sheetVerticalSize","context","displayName","Provider","useMenuConfiguration","overrides","inherited","MenuConfigurationProvider","props","children","configuration","value"],"mappings":"AAAA;;AAEA,SAGEA,aAAa,EACbC,UAAU,EACVC,OAAO,QACF,QAAQ;AAkEf,iBAAiB,GACjB,OAAO,MAAMC,6BAA0D;IACrEC,YAAY;IACZC,eAAe;IACfC,aAAa;IACbC,aAAa;IACbC,eAAe;IACfC,mBAAmB;AACrB,EAAE;AAEF;;;CAGC,GACD,MAAMC,wBAAUV,cAAwC;IACtDI,YAAY;IACZC,eAAe;IACfC,aAAa;IACbC,aAAa;IACbC,eAAe;IACfC,mBAAmB;AACrB;AACAC,QAAQC,WAAW,GAAG;AAEtB;;;CAGC,GACD,MAAM,EAAEC,QAAQ,EAAE,GAAGF;AAErB;;;;;;;;;CASC,GACD,OAAO,SAASG,qBACdC,YAA+B,CAAC,CAAC;IAEjC,MAAM,EACJV,UAAU,EACVC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,aAAa,EACbC,iBAAiB,EAClB,GAAGK;IACJ,MAAMC,YAAYd,WAAWS;IAE7B,OAAO;QACLN,YAAYA,cAAcW,UAAUX,UAAU;QAC9CC,eAAeA,iBAAiBU,UAAUV,aAAa;QACvDC,aACEA,gBAAgB,OAAO,OAAQA,eAAeS,UAAUT,WAAW;QACrEC,aACEA,gBAAgB,OAAO,OAAQA,eAAeQ,UAAUR,WAAW;QACrEC,eAAeA,iBAAiBO,UAAUP,aAAa;QACvDC,mBAAmBA,qBAAqBM,UAAUN,iBAAiB;IACrE;AACF;AAOA;;;;;;;CAOC,GACD,OAAO,SAASO,0BACdC,KAAqC;IAErC,MAAM,EAAEC,QAAQ,EAAE,GAAGC,eAAe,GAAGF;IACvC,MAAM,EACJb,UAAU,EACVC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,aAAa,EACbC,iBAAiB,EAClB,GAAGI,qBAAqBM;IAEzB,MAAMC,QAAQlB,QACZ,IAAO,CAAA;YACLE;YACAC;YACAC;YACAC;YACAC;YACAC;QACF,CAAA,GACA;QACEL;QACAC;QACAE;QACAD;QACAE;QACAC;KACD;IAGH,qBAAO,KAACG;QAASQ,OAAOA;kBAAQF;;AAClC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/MenuItem.tsx"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport { forwardRef } from \"react\";\nimport { ListItem, type ListItemProps } from \"../list/ListItem.js\";\nimport { useKeyboardMovementContext } from \"../movement/useKeyboardMovementProvider.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\n\n/**\n * @since 5.0.0\n */\nexport interface MenuItemProps extends Omit<ListItemProps, \"role\"> {\n /**\n * @defaultValue `\"menuitem\"`\n */\n role?: string;\n\n /**\n * @defaultValue `-1`\n */\n tabIndex?: number;\n}\n\n/**\n * **Client Component**\n *\n * This component is used as an \"action\" within a `Menu`/`DropdownMenu` that\n * implements some keyboard focus behavior. This component should generally have\n * an `onClick` event handler.\n *\n * @since 5.0.0\n */\nexport const MenuItem = forwardRef<HTMLLIElement, MenuItemProps>(\n function MenuItem(props, ref) {\n const {\n id: propId,\n role = \"menuitem\",\n tabIndex: propTabIndex,\n children,\n className,\n ...remaining\n } = props;\n\n const id = useEnsuredId(propId, \"menuitem\");\n const { tabIndexBehavior, activeDescendantId } =\n useKeyboardMovementContext();\n const focused = id === activeDescendantId;\n let tabIndex = propTabIndex ?? -1;\n if (tabIndexBehavior === \"roving\" && focused) {\n tabIndex = 0;\n }\n\n return (\n <ListItem\n {...remaining}\n id={id}\n ref={ref}\n role={role}\n tabIndex={tabIndex}\n className={cnb(\n \"rmd-menu-item\",\n tabIndexBehavior === \"virtual\" && focused && \"rmd-menu-item--focused\",\n className\n )}\n >\n {children}\n </ListItem>\n );\n }\n);\n"],"names":["cnb","forwardRef","ListItem","useKeyboardMovementContext","useEnsuredId","MenuItem","props","ref","id","propId","role","tabIndex","propTabIndex","children","className","remaining","tabIndexBehavior","activeDescendantId","focused"],"mappings":"AAAA;;AACA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAAQ,QAAQ;AACnC,SAASC,QAAQ,QAA4B,sBAAsB;AACnE,SAASC,0BAA0B,QAAQ,6CAA6C;AACxF,SAASC,YAAY,QAAQ,qBAAqB;AAiBlD;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAWJ,WACtB,SAASI,SAASC,KAAK,EAAEC,GAAG;IAC1B,MAAM,EACJC,IAAIC,MAAM,EACVC,OAAO,UAAU,EACjBC,UAAUC,YAAY,EACtBC,QAAQ,EACRC,SAAS,EACT,GAAGC,WACJ,GAAGT;IAEJ,MAAME,KAAKJ,aAAaK,QAAQ;IAChC,MAAM,EAAEO,gBAAgB,EAAEC,kBAAkB,EAAE,GAC5Cd;IACF,MAAMe,UAAUV,OAAOS;IACvB,IAAIN,WAAWC,gBAAgB,CAAC;IAChC,IAAII,qBAAqB,YAAYE,SAAS;QAC5CP,WAAW;IACb;IAEA,qBACE,KAACT;QACE,GAAGa,SAAS;QACbP,IAAIA;QACJD,KAAKA;QACLG,MAAMA;QACNC,UAAUA;QACVG,WAAWd,IACT,iBACAgB,qBAAqB,aAAaE,WAAW,0BAC7CJ;kBAGDD;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/menu/MenuItem.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport { forwardRef } from \"react\";\n\nimport { ListItem, type ListItemProps } from \"../list/ListItem.js\";\nimport { useKeyboardMovementContext } from \"../movement/useKeyboardMovementProvider.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\n\n/**\n * @since 5.0.0\n */\nexport interface MenuItemProps extends Omit<ListItemProps, \"role\"> {\n /**\n * @defaultValue `\"menuitem\"`\n */\n role?: string;\n\n /**\n * @defaultValue `-1`\n */\n tabIndex?: number;\n}\n\n/**\n * **Client Component**\n *\n * This component is used as an \"action\" within a `Menu`/`DropdownMenu` that\n * implements some keyboard focus behavior. This component should generally have\n * an `onClick` event handler.\n *\n * @since 5.0.0\n */\nexport const MenuItem = forwardRef<HTMLLIElement, MenuItemProps>(\n function MenuItem(props, ref) {\n const {\n id: propId,\n role = \"menuitem\",\n tabIndex: propTabIndex,\n children,\n className,\n ...remaining\n } = props;\n\n const id = useEnsuredId(propId, \"menuitem\");\n const { tabIndexBehavior, activeDescendantId } =\n useKeyboardMovementContext();\n const focused = id === activeDescendantId;\n let tabIndex = propTabIndex ?? -1;\n if (tabIndexBehavior === \"roving\" && focused) {\n tabIndex = 0;\n }\n\n return (\n <ListItem\n {...remaining}\n id={id}\n ref={ref}\n role={role}\n tabIndex={tabIndex}\n className={cnb(\n \"rmd-menu-item\",\n tabIndexBehavior === \"virtual\" && focused && \"rmd-menu-item--focused\",\n className\n )}\n >\n {children}\n </ListItem>\n );\n }\n);\n"],"names":["cnb","forwardRef","ListItem","useKeyboardMovementContext","useEnsuredId","MenuItem","props","ref","id","propId","role","tabIndex","propTabIndex","children","className","remaining","tabIndexBehavior","activeDescendantId","focused"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAAQ,QAAQ;AAEnC,SAASC,QAAQ,QAA4B,sBAAsB;AACnE,SAASC,0BAA0B,QAAQ,6CAA6C;AACxF,SAASC,YAAY,QAAQ,qBAAqB;AAiBlD;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAWJ,WACtB,SAASI,SAASC,KAAK,EAAEC,GAAG;IAC1B,MAAM,EACJC,IAAIC,MAAM,EACVC,OAAO,UAAU,EACjBC,UAAUC,YAAY,EACtBC,QAAQ,EACRC,SAAS,EACT,GAAGC,WACJ,GAAGT;IAEJ,MAAME,KAAKJ,aAAaK,QAAQ;IAChC,MAAM,EAAEO,gBAAgB,EAAEC,kBAAkB,EAAE,GAC5Cd;IACF,MAAMe,UAAUV,OAAOS;IACvB,IAAIN,WAAWC,gBAAgB,CAAC;IAChC,IAAII,qBAAqB,YAAYE,SAAS;QAC5CP,WAAW;IACb;IAEA,qBACE,KAACT;QACE,GAAGa,SAAS;QACbP,IAAIA;QACJD,KAAKA;QACLG,MAAMA;QACNC,UAAUA;QACVG,WAAWd,IACT,iBACAgB,qBAAqB,aAAaE,WAAW,0BAC7CJ;kBAGDD;;AAGP,GACA"}
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { forwardRef, useEffect } from "react";
4
4
  import { useHoverMode } from "../hoverMode/useHoverMode.js";
5
5
  import { IconRotator } from "../icon/IconRotator.js";
6
- import { getIcon } from "../icon/iconConfig.js";
6
+ import { getIcon } from "../icon/config.js";
7
7
  import { useUserInteractionMode } from "../interaction/UserInteractionModeProvider.js";
8
8
  import { useAppSize } from "../media-queries/AppSizeProvider.js";
9
9
  import { useEnsuredId } from "../useEnsuredId.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/MenuItemButton.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, useEffect } from \"react\";\nimport { useHoverMode } from \"../hoverMode/useHoverMode.js\";\nimport { IconRotator } from \"../icon/IconRotator.js\";\nimport { getIcon } from \"../icon/iconConfig.js\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { type BaseMenuButtonProps } from \"./MenuButton.js\";\nimport { useMenuConfiguration } from \"./MenuConfigurationProvider.js\";\nimport { MenuItem, type MenuItemProps } from \"./MenuItem.js\";\nimport { useMenuVisibility } from \"./MenuVisibilityProvider.js\";\nimport { useMenuBarContext } from \"./useMenuBarProvider.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @internal\n * @since 5.0.0\n */\nexport interface MenuItemButtonProps\n extends BaseMenuButtonProps,\n MenuItemProps {}\n\n/**\n * **Client Component**\n *\n * This is just an internal component that handles rendering a submenu as a\n * menuitem for a `DropdownMenu` with a conditional dropdown icon.\n *\n * @internal\n * @since 5.0.0\n */\nexport const MenuItemButton = forwardRef<HTMLLIElement, MenuItemButtonProps>(\n function MenuItemButton(props, ref) {\n const {\n id: propId,\n children,\n height: propHeight,\n onClick = noop,\n onKeyDown = noop,\n onMouseEnter = noop,\n onMouseLeave = noop,\n rightAddon: propRightAddon,\n iconRotatorProps,\n disableDropdownIcon = typeof propRightAddon !== \"undefined\",\n ...remaining\n } = props;\n const { disabled } = props;\n\n const id = useEnsuredId(propId, \"menuitem\");\n const mode = useUserInteractionMode();\n const { renderAsSheet } = useMenuConfiguration();\n const { isPhone } = useAppSize();\n const isSheet =\n renderAsSheet === true || (renderAsSheet === \"phone\" && isPhone);\n const {\n root,\n menubar,\n activeId,\n enableHoverMode,\n disableHoverMode,\n startDisableTimer,\n clearDisableTimer,\n leaveTimeoutRef,\n hoverTimeoutRef,\n } = useMenuBarContext();\n const { visible, setVisible, defaultFocusIndex } = useMenuVisibility();\n const { startShowFlow, clearVisibilityTimeout } = useHoverMode({\n setVisible,\n enableHoverMode,\n disableHoverMode,\n startDisableTimer,\n leaveTimeoutRef,\n hoverTimeoutRef,\n clearDisableTimer,\n });\n const { horizontal } = useMenuConfiguration();\n\n useEffect(() => {\n setVisible(id === activeId);\n }, [activeId, defaultFocusIndex, id, menubar, setVisible]);\n\n let height = propHeight;\n let rightAddon = propRightAddon;\n const dropdownIcon = getIcon(root ? \"dropdown\" : \"forward\");\n if (!disableDropdownIcon) {\n if (!height && !props.leftAddon) {\n height = \"normal\";\n }\n\n rightAddon = (\n <IconRotator {...iconRotatorProps} rotated={visible}>\n {dropdownIcon}\n </IconRotator>\n );\n }\n\n const updateVisibility = (nextVisible: boolean, focusIndex = 0): void => {\n defaultFocusIndex.current = focusIndex;\n setVisible(nextVisible);\n if (!menubar) {\n return;\n }\n\n if (nextVisible) {\n enableHoverMode(id);\n } else {\n disableHoverMode();\n }\n };\n\n return (\n <MenuItem\n {...remaining}\n aria-haspopup={isSheet ? \"dialog\" : \"menu\"}\n aria-expanded={visible || undefined}\n id={id}\n ref={ref}\n rightAddon={rightAddon}\n onClick={(event) => {\n onClick(event);\n\n event.stopPropagation();\n updateVisibility(!visible);\n }}\n onKeyDown={(event) => {\n onKeyDown(event);\n\n switch (event.key) {\n case \"ArrowDown\":\n if (horizontal || root) {\n event.preventDefault();\n event.stopPropagation();\n updateVisibility(true);\n }\n break;\n case \"ArrowRight\":\n if (!horizontal && !root) {\n event.preventDefault();\n event.stopPropagation();\n updateVisibility(true);\n }\n break;\n }\n }}\n onMouseEnter={(event) => {\n onMouseEnter(event);\n if (mode === \"touch\" || disabled || !menubar) {\n return;\n }\n\n defaultFocusIndex.current = 0;\n startShowFlow(id);\n }}\n onMouseLeave={(event) => {\n onMouseLeave(event);\n if (mode === \"touch\" || disabled || !menubar) {\n return;\n }\n\n clearVisibilityTimeout();\n }}\n >\n {children}\n </MenuItem>\n );\n }\n);\n"],"names":["forwardRef","useEffect","useHoverMode","IconRotator","getIcon","useUserInteractionMode","useAppSize","useEnsuredId","useMenuConfiguration","MenuItem","useMenuVisibility","useMenuBarContext","noop","MenuItemButton","props","ref","id","propId","children","height","propHeight","onClick","onKeyDown","onMouseEnter","onMouseLeave","rightAddon","propRightAddon","iconRotatorProps","disableDropdownIcon","remaining","disabled","mode","renderAsSheet","isPhone","isSheet","root","menubar","activeId","enableHoverMode","disableHoverMode","startDisableTimer","clearDisableTimer","leaveTimeoutRef","hoverTimeoutRef","visible","setVisible","defaultFocusIndex","startShowFlow","clearVisibilityTimeout","horizontal","dropdownIcon","leftAddon","rotated","updateVisibility","nextVisible","focusIndex","current","aria-haspopup","aria-expanded","undefined","event","stopPropagation","key","preventDefault"],"mappings":"AAAA;;AACA,SAASA,UAAU,EAAEC,SAAS,QAAQ,QAAQ;AAC9C,SAASC,YAAY,QAAQ,+BAA+B;AAC5D,SAASC,WAAW,QAAQ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,cAAc/B;QAChB;QACAQ,cAAc,CAACoC;YACbpC,aAAaoC;YACb,IAAI7B,SAAS,WAAWD,YAAY,CAACM,SAAS;gBAC5C;YACF;YAEAY;QACF;kBAEC9B;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/menu/MenuItemButton.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useEffect } from \"react\";\n\nimport { useHoverMode } from \"../hoverMode/useHoverMode.js\";\nimport { IconRotator } from \"../icon/IconRotator.js\";\nimport { getIcon } from \"../icon/config.js\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { type BaseMenuButtonProps } from \"./MenuButton.js\";\nimport { useMenuConfiguration } from \"./MenuConfigurationProvider.js\";\nimport { MenuItem, type MenuItemProps } from \"./MenuItem.js\";\nimport { useMenuVisibility } from \"./MenuVisibilityProvider.js\";\nimport { useMenuBarContext } from \"./useMenuBarProvider.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @internal\n * @since 5.0.0\n */\nexport interface MenuItemButtonProps\n extends BaseMenuButtonProps,\n MenuItemProps {}\n\n/**\n * **Client Component**\n *\n * This is just an internal component that handles rendering a submenu as a\n * menuitem for a `DropdownMenu` with a conditional dropdown icon.\n *\n * @internal\n * @since 5.0.0\n */\nexport const MenuItemButton = forwardRef<HTMLLIElement, MenuItemButtonProps>(\n function MenuItemButton(props, ref) {\n const {\n id: propId,\n children,\n height: propHeight,\n onClick = noop,\n onKeyDown = noop,\n onMouseEnter = noop,\n onMouseLeave = noop,\n rightAddon: propRightAddon,\n iconRotatorProps,\n disableDropdownIcon = typeof propRightAddon !== \"undefined\",\n ...remaining\n } = props;\n const { disabled } = props;\n\n const id = useEnsuredId(propId, \"menuitem\");\n const mode = useUserInteractionMode();\n const { renderAsSheet } = useMenuConfiguration();\n const { isPhone } = useAppSize();\n const isSheet =\n renderAsSheet === true || (renderAsSheet === \"phone\" && isPhone);\n const {\n root,\n menubar,\n activeId,\n enableHoverMode,\n disableHoverMode,\n startDisableTimer,\n clearDisableTimer,\n leaveTimeoutRef,\n hoverTimeoutRef,\n } = useMenuBarContext();\n const { visible, setVisible, defaultFocusIndex } = useMenuVisibility();\n const { startShowFlow, clearVisibilityTimeout } = useHoverMode({\n setVisible,\n enableHoverMode,\n disableHoverMode,\n startDisableTimer,\n leaveTimeoutRef,\n hoverTimeoutRef,\n clearDisableTimer,\n });\n const { horizontal } = useMenuConfiguration();\n\n useEffect(() => {\n setVisible(id === activeId);\n }, [activeId, defaultFocusIndex, id, menubar, setVisible]);\n\n let height = propHeight;\n let rightAddon = propRightAddon;\n const dropdownIcon = getIcon(root ? \"dropdown\" : \"forward\");\n if (!disableDropdownIcon) {\n if (!height && !props.leftAddon) {\n height = \"normal\";\n }\n\n rightAddon = (\n <IconRotator {...iconRotatorProps} rotated={visible}>\n {dropdownIcon}\n </IconRotator>\n );\n }\n\n const updateVisibility = (nextVisible: boolean, focusIndex = 0): void => {\n defaultFocusIndex.current = focusIndex;\n setVisible(nextVisible);\n if (!menubar) {\n return;\n }\n\n if (nextVisible) {\n enableHoverMode(id);\n } else {\n disableHoverMode();\n }\n };\n\n return (\n <MenuItem\n {...remaining}\n aria-haspopup={isSheet ? \"dialog\" : \"menu\"}\n aria-expanded={visible || undefined}\n id={id}\n ref={ref}\n rightAddon={rightAddon}\n onClick={(event) => {\n onClick(event);\n\n event.stopPropagation();\n updateVisibility(!visible);\n }}\n onKeyDown={(event) => {\n onKeyDown(event);\n\n switch (event.key) {\n case \"ArrowDown\":\n if (horizontal || root) {\n event.preventDefault();\n event.stopPropagation();\n updateVisibility(true);\n }\n break;\n case \"ArrowRight\":\n if (!horizontal && !root) {\n event.preventDefault();\n event.stopPropagation();\n updateVisibility(true);\n }\n break;\n }\n }}\n onMouseEnter={(event) => {\n onMouseEnter(event);\n if (mode === \"touch\" || disabled || !menubar) {\n return;\n }\n\n defaultFocusIndex.current = 0;\n startShowFlow(id);\n }}\n onMouseLeave={(event) => {\n onMouseLeave(event);\n if (mode === \"touch\" || disabled || !menubar) {\n return;\n }\n\n clearVisibilityTimeout();\n }}\n >\n {children}\n </MenuItem>\n );\n }\n);\n"],"names":["forwardRef","useEffect","useHoverMode","IconRotator","getIcon","useUserInteractionMode","useAppSize","useEnsuredId","useMenuConfiguration","MenuItem","useMenuVisibility","useMenuBarContext","noop","MenuItemButton","props","ref","id","propId","children","height","propHeight","onClick","onKeyDown","onMouseEnter","onMouseLeave","rightAddon","propRightAddon","iconRotatorProps","disableDropdownIcon","remaining","disabled","mode","renderAsSheet","isPhone","isSheet","root","menubar","activeId","enableHoverMode","disableHoverMode","startDisableTimer","clearDisableTimer","leaveTimeoutRef","hoverTimeoutRef","visible","setVisible","defaultFocusIndex","startShowFlow","clearVisibilityTimeout","horizontal","dropdownIcon","leftAddon","rotated","updateVisibility","nextVisible","focusIndex","current","aria-haspopup","aria-expanded","undefined","event","stopPropagation","key","preventDefault"],"mappings":"AAAA;;AAEA,SAASA,UAAU,EAAEC,SAAS,QAAQ,QAAQ;AAE9C,SAASC,YAAY,QAAQ,+BAA+B;AAC5D,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,sBAAsB,QAAQ,gDAAgD;AACvF,SAASC,UAAU,QAAQ,sCAAsC;AACjE,SAASC,YAAY,QAAQ,qBAAqB;AAElD,SAASC,oBAAoB,QAAQ,iCAAiC;AACtE,SAASC,QAAQ,QAA4B,gBAAgB;AAC7D,SAASC,iBAAiB,QAAQ,8BAA8B;AAChE,SAASC,iBAAiB,QAAQ,0BAA0B;AAE5D,MAAMC,OAAO;AACX,aAAa;AACf;AAUA;;;;;;;;CAQC,GACD,OAAO,MAAMC,+BAAiBb,WAC5B,SAASa,eAAeC,KAAK,EAAEC,GAAG;IAChC,MAAM,EACJC,IAAIC,MAAM,EACVC,QAAQ,EACRC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5BV,WAAWS;QACX,IAAI,CAAClB,SAAS;YACZ;QACF;QAEA,IAAIkB,aAAa;YACfhB,gBAAgBtB;QAClB,OAAO;YACLuB;QACF;IACF;IAEA,qBACE,KAAC9B;QACE,GAAGoB,SAAS;QACb4B,iBAAevB,UAAU,WAAW;QACpCwB,iBAAed,WAAWe;QAC1B3C,IAAIA;QACJD,KAAKA;QACLU,YAAYA;QACZJ,SAAS,CAACuC;YACRvC,QAAQuC;YAERA,MAAMC,eAAe;YACrBR,iBAAiB,CAACT;QACpB;QACAtB,WAAW,CAACsC;YACVtC,UAAUsC;YAEV,OAAQA,MAAME,GAAG;gBACf,KAAK;oBACH,IAAIb,cAAcd,MAAM;wBACtByB,MAAMG,cAAc;wBACpBH,MAAMC,eAAe;wBACrBR,iBAAiB;oBACnB;oBACA;gBACF,KAAK;oBACH,IAAI,CAACJ,cAAc,CAACd,MAAM;wBACxByB,MAAMG,cAAc;wBACpBH,MAAMC,eAAe;wBACrBR,iBAAiB;oBACnB;oBACA;YACJ;QACF;QACA9B,cAAc,CAACqC;YACbrC,aAAaqC;YACb,IAAI7B,SAAS,WAAWD,YAAY,CAACM,SAAS;gBAC5C;YACF;YAEAU,kBAAkBU,OAAO,GAAG;YAC5BT,cAAc/B;QAChB;QACAQ,cAAc,CAACoC;YACbpC,aAAaoC;YACb,IAAI7B,SAAS,WAAWD,YAAY,CAACM,SAAS;gBAC5C;YACF;YAEAY;QACF;kBAEC9B;;AAGP,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/MenuItemCircularProgress.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport { ListItemChildren } from \"../list/ListItemChildren.js\";\nimport { listItem } from \"../list/listItemStyles.js\";\nimport {\n type ListItemChildrenProps,\n type ListItemHeight,\n} from \"../list/types.js\";\nimport {\n CircularProgress,\n type CircularProgressProps,\n} from \"../progress/CircularProgress.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface MenuItemCircularProgressProps extends CircularProgressProps {\n /** @defaultValue `\"Loading\"` */\n \"aria-label\"?: string;\n\n /** @defaultValue `\"none\"` */\n role?: string;\n\n /** @defaultValue `true` */\n dense?: boolean;\n\n liProps?: HTMLAttributes<HTMLLIElement>;\n height?: ListItemHeight;\n leftAddon?: ReactNode;\n rightAddon?: ReactNode;\n listItemChildrenProps?: ListItemChildrenProps;\n}\n\n/**\n * @example Simple Example\n * ```tsx\n * \"use client\";\n * import {\n * DropdownMenu,\n * MenuItem,\n * MenuItemCircularProgress,\n * useAsyncFunction,\n * } from \"@react-md/core\";\n *\n * function Example() {\n * const { handleAsync, pending } = useAsyncFunction();\n * const [visible, setVisible] = useState(false);\n *\n * return (\n * <DropdownMenu buttonChildren=\"Options\" visible={visible} setVisible={setVisible}>\n * {pending && <MenuItemCircularProgress />}\n * <MenuItem\n * onClick={handleAsync(async (event) => {\n * // prevent menu from closing until action completes\n * event.stopPropagation()\n *\n * // do something async\n * await ...\n *\n * // close menu once completed\n * setVisible(false)\n * })}\n * >\n * Some Action\n * </MenuItem>\n * </DropdownMenu>\n * )\n * }\n * ```\n *\n * @since 6.0.0\n */\nexport const MenuItemCircularProgress = forwardRef<\n HTMLLIElement,\n MenuItemCircularProgressProps\n>(function MenuItemCircularProgress(props, ref) {\n const {\n \"aria-label\": propAriaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n role = \"none\",\n className,\n height,\n leftAddon,\n rightAddon,\n liProps,\n listItemChildrenProps,\n ...remaining\n } = props;\n let ariaLabel = propAriaLabel;\n if (!ariaLabel && !ariaLabelledBy) {\n ariaLabel = \"Loading\";\n }\n\n return (\n <li\n {...liProps}\n ref={ref}\n role={role}\n className={cnb(listItem({ height, className }), liProps?.className)}\n >\n <ListItemChildren\n {...listItemChildrenProps}\n leftAddon={leftAddon}\n rightAddon={rightAddon}\n >\n <CircularProgress\n aria-label={ariaLabel as string}\n aria-labelledby={ariaLabelledBy}\n dense\n {...remaining}\n />\n </ListItemChildren>\n </li>\n );\n});\n"],"names":["cnb","forwardRef","ListItemChildren","listItem","CircularProgress","MenuItemCircularProgress","props","ref","propAriaLabel","ariaLabelledBy","role","className","height","leftAddon","rightAddon","liProps","listItemChildrenProps","remaining","ariaLabel","li","aria-label","aria-labelledby","dense"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAA6C,QAAQ;AACxE,SAASC,gBAAgB,QAAQ,8BAA8B;AAC/D,SAASC,QAAQ,QAAQ,4BAA4B;AAKrD,SACEC,gBAAgB,QAEX,kCAAkC;AAsBzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCC,GACD,OAAO,MAAMC,yCAA2BJ,WAGtC,SAASI,yBAAyBC,KAAK,EAAEC,GAAG;IAC5C,MAAM,EACJ,cAAcC,aAAa,EAC3B,mBAAmBC,cAAc,EACjCC,OAAO,MAAM,EACbC,SAAS,EACTC,MAAM,EACNC,SAAS,EACTC,UAAU,EACVC,OAAO,EACPC,qBAAqB,EACrB,GAAGC,WACJ,GAAGX;IACJ,IAAIY,YAAYV;IAChB,IAAI,CAACU,aAAa,CAACT,gBAAgB;QACjCS,YAAY;IACd;IAEA,qBACE,KAACC;QACE,GAAGJ,OAAO;QACXR,KAAKA;QACLG,MAAMA;QACNC,WAAWX,IAAIG,SAAS;YAAES;YAAQD;QAAU,IAAII,SAASJ;kBAEzD,cAAA,KAACT;YACE,GAAGc,qBAAqB;YACzBH,WAAWA;YACXC,YAAYA;sBAEZ,cAAA,KAACV;gBACCgB,cAAYF;gBACZG,mBAAiBZ;gBACjBa,KAAK;gBACJ,GAAGL,SAAS;;;;AAKvB,GAAG"}
1
+ {"version":3,"sources":["../../src/menu/MenuItemCircularProgress.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { type HTMLAttributes, type ReactNode, forwardRef } from \"react\";\n\nimport { ListItemChildren } from \"../list/ListItemChildren.js\";\nimport { listItem } from \"../list/listItemStyles.js\";\nimport {\n type ListItemChildrenProps,\n type ListItemHeight,\n} from \"../list/types.js\";\nimport {\n CircularProgress,\n type CircularProgressProps,\n} from \"../progress/CircularProgress.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface MenuItemCircularProgressProps extends CircularProgressProps {\n /** @defaultValue `\"Loading\"` */\n \"aria-label\"?: string;\n\n /** @defaultValue `\"none\"` */\n role?: string;\n\n /** @defaultValue `true` */\n dense?: boolean;\n\n liProps?: HTMLAttributes<HTMLLIElement>;\n height?: ListItemHeight;\n leftAddon?: ReactNode;\n rightAddon?: ReactNode;\n listItemChildrenProps?: ListItemChildrenProps;\n}\n\n/**\n * @example Simple Example\n * ```tsx\n * \"use client\";\n * import {\n * DropdownMenu,\n * MenuItem,\n * MenuItemCircularProgress,\n * useAsyncFunction,\n * } from \"@react-md/core\";\n *\n * function Example() {\n * const { handleAsync, pending } = useAsyncFunction();\n * const [visible, setVisible] = useState(false);\n *\n * return (\n * <DropdownMenu buttonChildren=\"Options\" visible={visible} setVisible={setVisible}>\n * {pending && <MenuItemCircularProgress />}\n * <MenuItem\n * onClick={handleAsync(async (event) => {\n * // prevent menu from closing until action completes\n * event.stopPropagation()\n *\n * // do something async\n * await ...\n *\n * // close menu once completed\n * setVisible(false)\n * })}\n * >\n * Some Action\n * </MenuItem>\n * </DropdownMenu>\n * )\n * }\n * ```\n *\n * @since 6.0.0\n */\nexport const MenuItemCircularProgress = forwardRef<\n HTMLLIElement,\n MenuItemCircularProgressProps\n>(function MenuItemCircularProgress(props, ref) {\n const {\n \"aria-label\": propAriaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n role = \"none\",\n className,\n height,\n leftAddon,\n rightAddon,\n liProps,\n listItemChildrenProps,\n ...remaining\n } = props;\n let ariaLabel = propAriaLabel;\n if (!ariaLabel && !ariaLabelledBy) {\n ariaLabel = \"Loading\";\n }\n\n return (\n <li\n {...liProps}\n ref={ref}\n role={role}\n className={cnb(listItem({ height, className }), liProps?.className)}\n >\n <ListItemChildren\n {...listItemChildrenProps}\n leftAddon={leftAddon}\n rightAddon={rightAddon}\n >\n <CircularProgress\n aria-label={ariaLabel as string}\n aria-labelledby={ariaLabelledBy}\n dense\n {...remaining}\n />\n </ListItemChildren>\n </li>\n );\n});\n"],"names":["cnb","forwardRef","ListItemChildren","listItem","CircularProgress","MenuItemCircularProgress","props","ref","propAriaLabel","ariaLabelledBy","role","className","height","leftAddon","rightAddon","liProps","listItemChildrenProps","remaining","ariaLabel","li","aria-label","aria-labelledby","dense"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAA8CC,UAAU,QAAQ,QAAQ;AAExE,SAASC,gBAAgB,QAAQ,8BAA8B;AAC/D,SAASC,QAAQ,QAAQ,4BAA4B;AAKrD,SACEC,gBAAgB,QAEX,kCAAkC;AAsBzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCC,GACD,OAAO,MAAMC,yCAA2BJ,WAGtC,SAASI,yBAAyBC,KAAK,EAAEC,GAAG;IAC5C,MAAM,EACJ,cAAcC,aAAa,EAC3B,mBAAmBC,cAAc,EACjCC,OAAO,MAAM,EACbC,SAAS,EACTC,MAAM,EACNC,SAAS,EACTC,UAAU,EACVC,OAAO,EACPC,qBAAqB,EACrB,GAAGC,WACJ,GAAGX;IACJ,IAAIY,YAAYV;IAChB,IAAI,CAACU,aAAa,CAACT,gBAAgB;QACjCS,YAAY;IACd;IAEA,qBACE,KAACC;QACE,GAAGJ,OAAO;QACXR,KAAKA;QACLG,MAAMA;QACNC,WAAWX,IAAIG,SAAS;YAAES;YAAQD;QAAU,IAAII,SAASJ;kBAEzD,cAAA,KAACT;YACE,GAAGc,qBAAqB;YACzBH,WAAWA;YACXC,YAAYA;sBAEZ,cAAA,KAACV;gBACCgB,cAAYF;gBACZG,mBAAiBZ;gBACjBa,KAAK;gBACJ,GAAGL,SAAS;;;;AAKvB,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/MenuItemGroup.tsx"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport { List, type ListElement, type ListProps } from \"../list/List.js\";\nimport { type LabelRequiredForA11y } from \"../types.js\";\nimport { useMenuConfiguration } from \"./MenuConfigurationProvider.js\";\n\n/** @since 5.0.0 */\nexport type MenuItemGroupProps = LabelRequiredForA11y<\n Omit<ListProps, \"role\">\n> & {\n children: ReactNode;\n};\n\n/**\n * **Client Component**\n *\n * If a menu or menubar contains more than one group of menuitemradio elements,\n * or if the menu contains one group and other, unrelated menu items, authors\n * SHOULD nest each set of related menuitemradio elements in an element using\n * the group role, and authors SHOULD delimit the group from other menu items\n * with an element using the separator role.\n *\n * @see {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemradio}\n *\n * @example Simple Example\n * ```tsx\n * import { ReactElement, useState } from \"react\";\n * import {\n * DropdownMenu,\n * MenuItemGroup,\n * MenuItemRadio,\n * MenuItemSeparator,\n * MenuItemSwitch,\n * } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * const [value, setValue] = useState(\"value1\");\n * const [checked, setChecked] = useState(false);\n *\n * return (\n * <DropdownMenu id=\"dropdown-menu-id\" buttonChildren=\"Button\">\n * <MenuItemSwitch\n * id=\"switch-id\"\n * checked={checked}\n * onCheckedChange={nextChecked => setChecked(nextChecked)}\n * >\n * Light mode\n * </MenuItemSwitch>\n * <MenuItemSeparator />\n * <MenuItemGroup aria-label=\"My Group Label\">\n * <MenuItemRadio\n * id=\"radio-1\"\n * checked={value === \"value1\"}\n * onCheckedChange={() => setValue(\"value1\")}\n * >\n * Radio 1\n * </MenuItemRadio>\n * <MenuItemRadio\n * id=\"radio-2\"\n * checked={value === \"value2\"}\n * onCheckedChange={() => setValue(\"value2\")}\n * >\n * Radio 2\n * </MenuItemRadio>\n * <MenuItemRadio\n * id=\"radio-3\"\n * checked={value === \"value3\"}\n * onCheckedChange={() => setValue(\"value3\")}\n * >\n * Radio 3\n * </MenuItemRadio>\n * </MenuItemGroup>\n * </DropdownMenu>\n * );\n * }\n * ```\n *\n * @since 5.0.0\n */\nexport const MenuItemGroup = forwardRef<ListElement, MenuItemGroupProps>(\n function MenuItemGroup({ children, className, ...props }, ref) {\n const { horizontal } = useMenuConfiguration(props);\n return (\n <List\n {...props}\n ref={ref}\n role=\"group\"\n className={cnb(\"rmd-menu-item-group\", className)}\n horizontal={horizontal}\n >\n {children}\n </List>\n );\n }\n);\n"],"names":["cnb","forwardRef","List","useMenuConfiguration","MenuItemGroup","children","className","props","ref","horizontal","role"],"mappings":"AAAA;;AACA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAAwB,QAAQ;AACnD,SAASC,IAAI,QAA0C,kBAAkB;AAEzE,SAASC,oBAAoB,QAAQ,iCAAiC;AAStE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiEC,GACD,OAAO,MAAMC,8BAAgBH,WAC3B,SAASG,cAAc,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGC,OAAO,EAAEC,GAAG;IAC3D,MAAM,EAAEC,UAAU,EAAE,GAAGN,qBAAqBI;IAC5C,qBACE,KAACL;QACE,GAAGK,KAAK;QACTC,KAAKA;QACLE,MAAK;QACLJ,WAAWN,IAAI,uBAAuBM;QACtCG,YAAYA;kBAEXJ;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/menu/MenuItemGroup.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport { type ReactNode, forwardRef } from \"react\";\n\nimport { List, type ListElement, type ListProps } from \"../list/List.js\";\nimport { type LabelRequiredForA11y } from \"../types.js\";\nimport { useMenuConfiguration } from \"./MenuConfigurationProvider.js\";\n\n/** @since 5.0.0 */\nexport type MenuItemGroupProps = LabelRequiredForA11y<\n Omit<ListProps, \"role\">\n> & {\n children: ReactNode;\n};\n\n/**\n * **Client Component**\n *\n * If a menu or menubar contains more than one group of menuitemradio elements,\n * or if the menu contains one group and other, unrelated menu items, authors\n * SHOULD nest each set of related menuitemradio elements in an element using\n * the group role, and authors SHOULD delimit the group from other menu items\n * with an element using the separator role.\n *\n * @see {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemradio}\n *\n * @example Simple Example\n * ```tsx\n * import { ReactElement, useState } from \"react\";\n * import {\n * DropdownMenu,\n * MenuItemGroup,\n * MenuItemRadio,\n * MenuItemSeparator,\n * MenuItemSwitch,\n * } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * const [value, setValue] = useState(\"value1\");\n * const [checked, setChecked] = useState(false);\n *\n * return (\n * <DropdownMenu id=\"dropdown-menu-id\" buttonChildren=\"Button\">\n * <MenuItemSwitch\n * id=\"switch-id\"\n * checked={checked}\n * onCheckedChange={nextChecked => setChecked(nextChecked)}\n * >\n * Light mode\n * </MenuItemSwitch>\n * <MenuItemSeparator />\n * <MenuItemGroup aria-label=\"My Group Label\">\n * <MenuItemRadio\n * id=\"radio-1\"\n * checked={value === \"value1\"}\n * onCheckedChange={() => setValue(\"value1\")}\n * >\n * Radio 1\n * </MenuItemRadio>\n * <MenuItemRadio\n * id=\"radio-2\"\n * checked={value === \"value2\"}\n * onCheckedChange={() => setValue(\"value2\")}\n * >\n * Radio 2\n * </MenuItemRadio>\n * <MenuItemRadio\n * id=\"radio-3\"\n * checked={value === \"value3\"}\n * onCheckedChange={() => setValue(\"value3\")}\n * >\n * Radio 3\n * </MenuItemRadio>\n * </MenuItemGroup>\n * </DropdownMenu>\n * );\n * }\n * ```\n *\n * @since 5.0.0\n */\nexport const MenuItemGroup = forwardRef<ListElement, MenuItemGroupProps>(\n function MenuItemGroup({ children, className, ...props }, ref) {\n const { horizontal } = useMenuConfiguration(props);\n return (\n <List\n {...props}\n ref={ref}\n role=\"group\"\n className={cnb(\"rmd-menu-item-group\", className)}\n horizontal={horizontal}\n >\n {children}\n </List>\n );\n }\n);\n"],"names":["cnb","forwardRef","List","useMenuConfiguration","MenuItemGroup","children","className","props","ref","horizontal","role"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAAyBC,UAAU,QAAQ,QAAQ;AAEnD,SAASC,IAAI,QAA0C,kBAAkB;AAEzE,SAASC,oBAAoB,QAAQ,iCAAiC;AAStE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiEC,GACD,OAAO,MAAMC,8BAAgBH,WAC3B,SAASG,cAAc,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGC,OAAO,EAAEC,GAAG;IAC3D,MAAM,EAAEC,UAAU,EAAE,GAAGN,qBAAqBI;IAC5C,qBACE,KAACL;QACE,GAAGK,KAAK;QACTC,KAAKA;QACLE,MAAK;QACLJ,WAAWN,IAAI,uBAAuBM;QACtCG,YAAYA;kBAEXJ;;AAGP,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/MenuItemSeparator.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { type DividerProps } from \"../divider/Divider.js\";\nimport { divider } from \"../divider/styles.js\";\nimport { useMenuConfiguration } from \"./MenuConfigurationProvider.js\";\n\n/** @since 5.0.0 */\nexport interface MenuItemSeparatorProps\n extends HTMLAttributes<HTMLLIElement>,\n Pick<DividerProps, \"inset\" | \"vertical\"> {}\n\n/**\n * **Client Component**\n *\n * This component renders a `<li role=\"separator\">` with the divider styles. It\n * will also automatically render itself vertically instead of horizontally if\n * the menu is rendering horizontally.\n *\n * @since 5.0.0 Renders as an `<li>` instead of a `<div>` or `<hr />`.\n */\nexport const MenuItemSeparator = forwardRef<\n HTMLLIElement,\n MenuItemSeparatorProps\n>(function MenuItemSeparator(props, ref) {\n const {\n className,\n inset,\n vertical: propVertical,\n children,\n ...remaining\n } = props;\n\n const horizontal = useMenuConfiguration().horizontal;\n const vertical = propVertical ?? horizontal;\n\n return (\n <li\n {...remaining}\n aria-orientation={vertical ? \"vertical\" : undefined}\n ref={ref}\n role=\"separator\"\n className={divider({ inset: inset && !vertical, vertical, className })}\n >\n {children}\n </li>\n );\n});\n"],"names":["forwardRef","divider","useMenuConfiguration","MenuItemSeparator","props","ref","className","inset","vertical","propVertical","children","remaining","horizontal","li","aria-orientation","undefined","role"],"mappings":"AAAA;;AACA,SAASA,UAAU,QAA6B,QAAQ;AAExD,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,oBAAoB,QAAQ,iCAAiC;AAOtE;;;;;;;;CAQC,GACD,OAAO,MAAMC,kCAAoBH,WAG/B,SAASG,kBAAkBC,KAAK,EAAEC,GAAG;IACrC,MAAM,EACJC,SAAS,EACTC,KAAK,EACLC,UAAUC,YAAY,EACtBC,QAAQ,EACR,GAAGC,WACJ,GAAGP;IAEJ,MAAMQ,aAAaV,uBAAuBU,UAAU;IACpD,MAAMJ,WAAWC,gBAAgBG;IAEjC,qBACE,KAACC;QACE,GAAGF,SAAS;QACbG,oBAAkBN,WAAW,aAAaO;QAC1CV,KAAKA;QACLW,MAAK;QACLV,WAAWL,QAAQ;YAAEM,OAAOA,SAAS,CAACC;YAAUA;YAAUF;QAAU;kBAEnEI;;AAGP,GAAG"}
1
+ {"version":3,"sources":["../../src/menu/MenuItemSeparator.tsx"],"sourcesContent":["\"use client\";\n\nimport { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { type DividerProps } from \"../divider/Divider.js\";\nimport { divider } from \"../divider/styles.js\";\nimport { useMenuConfiguration } from \"./MenuConfigurationProvider.js\";\n\n/** @since 5.0.0 */\nexport interface MenuItemSeparatorProps\n extends HTMLAttributes<HTMLLIElement>,\n Pick<DividerProps, \"inset\" | \"vertical\"> {}\n\n/**\n * **Client Component**\n *\n * This component renders a `<li role=\"separator\">` with the divider styles. It\n * will also automatically render itself vertically instead of horizontally if\n * the menu is rendering horizontally.\n *\n * @since 5.0.0 Renders as an `<li>` instead of a `<div>` or `<hr />`.\n */\nexport const MenuItemSeparator = forwardRef<\n HTMLLIElement,\n MenuItemSeparatorProps\n>(function MenuItemSeparator(props, ref) {\n const {\n className,\n inset,\n vertical: propVertical,\n children,\n ...remaining\n } = props;\n\n const horizontal = useMenuConfiguration().horizontal;\n const vertical = propVertical ?? horizontal;\n\n return (\n <li\n {...remaining}\n aria-orientation={vertical ? \"vertical\" : undefined}\n ref={ref}\n role=\"separator\"\n className={divider({ inset: inset && !vertical, vertical, className })}\n >\n {children}\n </li>\n );\n});\n"],"names":["forwardRef","divider","useMenuConfiguration","MenuItemSeparator","props","ref","className","inset","vertical","propVertical","children","remaining","horizontal","li","aria-orientation","undefined","role"],"mappings":"AAAA;;AAEA,SAA8BA,UAAU,QAAQ,QAAQ;AAGxD,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,oBAAoB,QAAQ,iCAAiC;AAOtE;;;;;;;;CAQC,GACD,OAAO,MAAMC,kCAAoBH,WAG/B,SAASG,kBAAkBC,KAAK,EAAEC,GAAG;IACrC,MAAM,EACJC,SAAS,EACTC,KAAK,EACLC,UAAUC,YAAY,EACtBC,QAAQ,EACR,GAAGC,WACJ,GAAGP;IAEJ,MAAMQ,aAAaV,uBAAuBU,UAAU;IACpD,MAAMJ,WAAWC,gBAAgBG;IAEjC,qBACE,KAACC;QACE,GAAGF,SAAS;QACbG,oBAAkBN,WAAW,aAAaO;QAC1CV,KAAKA;QACLW,MAAK;QACLV,WAAWL,QAAQ;YAAEM,OAAOA,SAAS,CAACC;YAAUA;YAAUF;QAAU;kBAEnEI;;AAGP,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/MenuSheet.tsx"],"sourcesContent":["\"use client\";\nimport { type CSSProperties, type ReactElement, type ReactNode } from \"react\";\nimport { Sheet, type BaseSheetProps } from \"../sheet/Sheet.js\";\nimport { type LabelRequiredForA11y, type PropsWithRef } from \"../types.js\";\nimport { type RenderMenuAsSheet } from \"./MenuConfigurationProvider.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @since 6.0.0\n */\nexport type MenuSheetConfigurableProps = Omit<\n BaseSheetProps,\n \"visible\" | \"onRequestClose\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface MenuSheetConvenienceProps {\n /**\n * This can be used to apply additional props to the `Sheet` component when\n * the `Menu` is being rendered as a `Sheet`.\n *\n * Note: You can override the `style` and `className` using\n * {@link sheetStyle} and {@link sheetClassName} instead for convenience.\n *\n * @example\n * ```tsx\n * <Menu\n * {...props}\n * sheetProps={{\n * style: {\n * // custom inline style\n * },\n * className: \"come-class-name\",\n * horizontalSize: \"touch\",\n * }}\n * />\n * ```\n */\n sheetProps?: PropsWithRef<MenuSheetConfigurableProps, HTMLDivElement>;\n\n /**\n * Convenience prop to apply custom style to the `Sheet` component when the\n * `Menu` is being rendered as a `Sheet`.\n */\n sheetStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `Sheet` component when\n * the `Menu` is being rendered as a `Sheet`.\n */\n sheetClassName?: string;\n}\n\n/**\n * @internal\n * @since 5.0.0\n * @since 6.0.0 Updated to use the latest menu API.\n */\nexport interface MenuSheetProps extends BaseSheetProps {\n /** {@inheritDoc MenuConfiguration.sheetHeader} */\n header?: ReactNode;\n /** {@inheritDoc MenuConfiguration.sheetFooter} */\n footer?: ReactNode;\n children: ReactNode;\n\n /** @since 6.0.0 */\n enabled: RenderMenuAsSheet;\n}\n\n/**\n * **Client Component**\n *\n * Implements a `Menu` using the `Sheet` component that probably shouldn't\n * really be used externally.\n *\n * @internal\n * @since 5.0.0\n * @since 6.0.0 Added the `enabled` prop and does not render a custom `Menu`\n * implementation.\n */\nexport function MenuSheet(\n props: LabelRequiredForA11y<MenuSheetProps>\n): ReactElement {\n const {\n header,\n footer,\n children,\n onClick = noop,\n overlayProps,\n enabled,\n ...remaining\n } = props;\n const { onRequestClose } = props;\n\n if (!enabled) {\n return <>{children}</>;\n }\n\n return (\n <Sheet\n {...remaining}\n onClick={(event) => {\n onClick(event);\n\n // Prevent closing parent sheet/menus if an element in the header or\n // footer is clicked\n if (\n !(event.target instanceof HTMLElement) ||\n event.target\n .closest('.rmd-menu,[role=\"dialog\"]')\n ?.getAttribute(\"role\") === \"dialog\"\n ) {\n event.stopPropagation();\n }\n }}\n overlayProps={{\n ...overlayProps,\n onClick: (event) => {\n overlayProps?.onClick?.(event);\n\n // prevent closing parent menus if the overlay element is clicked.\n event.stopPropagation();\n onRequestClose();\n },\n }}\n >\n {header}\n {children}\n {footer}\n </Sheet>\n );\n}\n"],"names":["Sheet","noop","MenuSheet","props","header","footer","children","onClick","overlayProps","enabled","remaining","onRequestClose","event","target","HTMLElement","closest","getAttribute","stopPropagation"],"mappings":"AAAA;;AAEA,SAASA,KAAK,QAA6B,oBAAoB;AAI/D,MAAMC,OAAO;AACX,aAAa;AACf;AAkEA;;;;;;;;;;CAUC,GACD,OAAO,SAASC,UACdC,KAA2C;IAE3C,MAAM,EACJC,MAAM,EACNC,MAAM,EACNC,QAAQ,EACRC,UAAUN,IAAI,EACdO,YAAY,EACZC,OAAO,EACP,GAAGC,WACJ,GAAGP;IACJ,MAAM,EAAEQ,cAAc,EAAE,GAAGR;IAE3B,IAAI,CAACM,SAAS;QACZ,qBAAO;sBAAGH;;IACZ;IAEA,qBACE,MAACN;QACE,GAAGU,SAAS;QACbH,SAAS,CAACK;YACRL,QAAQK;YAER,oEAAoE;YACpE,oBAAoB;YACpB,IACE,CAAEA,CAAAA,MAAMC,MAAM,YAAYC,WAAU,KACpCF,MAAMC,MAAM,CACTE,OAAO,CAAC,8BACPC,aAAa,YAAY,UAC7B;gBACAJ,MAAMK,eAAe;YACvB;QACF;QACAT,cAAc;YACZ,GAAGA,YAAY;YACfD,SAAS,CAACK;gBACRJ,cAAcD,UAAUK;gBAExB,kEAAkE;gBAClEA,MAAMK,eAAe;gBACrBN;YACF;QACF;;YAECP;YACAE;YACAD;;;AAGP"}
1
+ {"version":3,"sources":["../../src/menu/MenuSheet.tsx"],"sourcesContent":["\"use client\";\n\nimport { type CSSProperties, type ReactElement, type ReactNode } from \"react\";\n\nimport { type BaseSheetProps, Sheet } from \"../sheet/Sheet.js\";\nimport { type LabelRequiredForA11y, type PropsWithRef } from \"../types.js\";\nimport { type RenderMenuAsSheet } from \"./MenuConfigurationProvider.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @since 6.0.0\n */\nexport type MenuSheetConfigurableProps = Omit<\n BaseSheetProps,\n \"visible\" | \"onRequestClose\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface MenuSheetConvenienceProps {\n /**\n * This can be used to apply additional props to the `Sheet` component when\n * the `Menu` is being rendered as a `Sheet`.\n *\n * Note: You can override the `style` and `className` using\n * {@link sheetStyle} and {@link sheetClassName} instead for convenience.\n *\n * @example\n * ```tsx\n * <Menu\n * {...props}\n * sheetProps={{\n * style: {\n * // custom inline style\n * },\n * className: \"come-class-name\",\n * horizontalSize: \"touch\",\n * }}\n * />\n * ```\n */\n sheetProps?: PropsWithRef<MenuSheetConfigurableProps, HTMLDivElement>;\n\n /**\n * Convenience prop to apply custom style to the `Sheet` component when the\n * `Menu` is being rendered as a `Sheet`.\n */\n sheetStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `Sheet` component when\n * the `Menu` is being rendered as a `Sheet`.\n */\n sheetClassName?: string;\n}\n\n/**\n * @internal\n * @since 5.0.0\n * @since 6.0.0 Updated to use the latest menu API.\n */\nexport interface MenuSheetProps extends BaseSheetProps {\n /** {@inheritDoc MenuConfiguration.sheetHeader} */\n header?: ReactNode;\n /** {@inheritDoc MenuConfiguration.sheetFooter} */\n footer?: ReactNode;\n children: ReactNode;\n\n /** @since 6.0.0 */\n enabled: RenderMenuAsSheet;\n}\n\n/**\n * **Client Component**\n *\n * Implements a `Menu` using the `Sheet` component that probably shouldn't\n * really be used externally.\n *\n * @internal\n * @since 5.0.0\n * @since 6.0.0 Added the `enabled` prop and does not render a custom `Menu`\n * implementation.\n */\nexport function MenuSheet(\n props: LabelRequiredForA11y<MenuSheetProps>\n): ReactElement {\n const {\n header,\n footer,\n children,\n onClick = noop,\n overlayProps,\n enabled,\n ...remaining\n } = props;\n const { onRequestClose } = props;\n\n if (!enabled) {\n return <>{children}</>;\n }\n\n return (\n <Sheet\n {...remaining}\n onClick={(event) => {\n onClick(event);\n\n // Prevent closing parent sheet/menus if an element in the header or\n // footer is clicked\n if (\n !(event.target instanceof HTMLElement) ||\n event.target\n .closest('.rmd-menu,[role=\"dialog\"]')\n ?.getAttribute(\"role\") === \"dialog\"\n ) {\n event.stopPropagation();\n }\n }}\n overlayProps={{\n ...overlayProps,\n onClick: (event) => {\n overlayProps?.onClick?.(event);\n\n // prevent closing parent menus if the overlay element is clicked.\n event.stopPropagation();\n onRequestClose();\n },\n }}\n >\n {header}\n {children}\n {footer}\n </Sheet>\n );\n}\n"],"names":["Sheet","noop","MenuSheet","props","header","footer","children","onClick","overlayProps","enabled","remaining","onRequestClose","event","target","HTMLElement","closest","getAttribute","stopPropagation"],"mappings":"AAAA;;AAIA,SAA8BA,KAAK,QAAQ,oBAAoB;AAI/D,MAAMC,OAAO;AACX,aAAa;AACf;AAkEA;;;;;;;;;;CAUC,GACD,OAAO,SAASC,UACdC,KAA2C;IAE3C,MAAM,EACJC,MAAM,EACNC,MAAM,EACNC,QAAQ,EACRC,UAAUN,IAAI,EACdO,YAAY,EACZC,OAAO,EACP,GAAGC,WACJ,GAAGP;IACJ,MAAM,EAAEQ,cAAc,EAAE,GAAGR;IAE3B,IAAI,CAACM,SAAS;QACZ,qBAAO;sBAAGH;;IACZ;IAEA,qBACE,MAACN;QACE,GAAGU,SAAS;QACbH,SAAS,CAACK;YACRL,QAAQK;YAER,oEAAoE;YACpE,oBAAoB;YACpB,IACE,CAAEA,CAAAA,MAAMC,MAAM,YAAYC,WAAU,KACpCF,MAAMC,MAAM,CACTE,OAAO,CAAC,8BACPC,aAAa,YAAY,UAC7B;gBACAJ,MAAMK,eAAe;YACvB;QACF;QACAT,cAAc;YACZ,GAAGA,YAAY;YACfD,SAAS,CAACK;gBACRJ,cAAcD,UAAUK;gBAExB,kEAAkE;gBAClEA,MAAMK,eAAe;gBACrBN;YACF;QACF;;YAECP;YACAE;YACAD;;;AAGP"}