@react-md/core 6.2.1 → 6.3.1

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 (345) hide show
  1. package/dist/_base.scss +1 -1
  2. package/dist/app-bar/styles.d.ts +0 -2
  3. package/dist/app-bar/styles.js.map +1 -1
  4. package/dist/autocomplete/types.d.ts +12 -0
  5. package/dist/autocomplete/types.js.map +1 -1
  6. package/dist/avatar/Avatar.d.ts +0 -10
  7. package/dist/avatar/Avatar.js.map +1 -1
  8. package/dist/avatar/styles.d.ts +10 -0
  9. package/dist/avatar/styles.js.map +1 -1
  10. package/dist/badge/Badge.d.ts +11 -0
  11. package/dist/badge/Badge.js.map +1 -1
  12. package/dist/badge/styles.d.ts +0 -8
  13. package/dist/badge/styles.js.map +1 -1
  14. package/dist/box/_box.scss +8 -8
  15. package/dist/box/styles.d.ts +9 -0
  16. package/dist/box/styles.js.map +1 -1
  17. package/dist/button/_button.scss +4 -0
  18. package/dist/button/styles.d.ts +5 -1
  19. package/dist/button/styles.js.map +1 -1
  20. package/dist/card/Card.d.ts +0 -7
  21. package/dist/card/Card.js.map +1 -1
  22. package/dist/card/styles.d.ts +6 -0
  23. package/dist/card/styles.js +8 -8
  24. package/dist/card/styles.js.map +1 -1
  25. package/dist/chip/Chip.d.ts +6 -13
  26. package/dist/chip/Chip.js.map +1 -1
  27. package/dist/chip/styles.d.ts +26 -1
  28. package/dist/chip/styles.js.map +1 -1
  29. package/dist/datetime/NativeDateField.d.ts +24 -0
  30. package/dist/datetime/NativeDateField.js +63 -0
  31. package/dist/datetime/NativeDateField.js.map +1 -0
  32. package/dist/datetime/NativeTimeField.d.ts +26 -0
  33. package/dist/datetime/NativeTimeField.js +63 -0
  34. package/dist/datetime/NativeTimeField.js.map +1 -0
  35. package/dist/datetime/useDateField.d.ts +120 -0
  36. package/dist/datetime/useDateField.js +35 -0
  37. package/dist/datetime/useDateField.js.map +1 -0
  38. package/dist/datetime/useTimeField.d.ts +124 -0
  39. package/dist/datetime/useTimeField.js +65 -0
  40. package/dist/datetime/useTimeField.js.map +1 -0
  41. package/dist/datetime/utils.d.ts +34 -0
  42. package/dist/datetime/utils.js +27 -0
  43. package/dist/datetime/utils.js.map +1 -0
  44. package/dist/dialog/styles.d.ts +5 -2
  45. package/dist/dialog/styles.js.map +1 -1
  46. package/dist/divider/styles.d.ts +1 -1
  47. package/dist/divider/styles.js.map +1 -1
  48. package/dist/draggable/utils.d.ts +3 -6
  49. package/dist/draggable/utils.js.map +1 -1
  50. package/dist/error-boundary/ErrorBoundary.js.map +1 -1
  51. package/dist/expansion-panel/ExpansionList.js +1 -1
  52. package/dist/expansion-panel/ExpansionList.js.map +1 -1
  53. package/dist/expansion-panel/useExpansionList.d.ts +2 -7
  54. package/dist/expansion-panel/useExpansionList.js.map +1 -1
  55. package/dist/files/validation.js.map +1 -1
  56. package/dist/form/FormMessage.js +3 -1
  57. package/dist/form/FormMessage.js.map +1 -1
  58. package/dist/form/FormMessageContainer.d.ts +2 -1
  59. package/dist/form/FormMessageContainer.js +3 -2
  60. package/dist/form/FormMessageContainer.js.map +1 -1
  61. package/dist/form/FormMessageCounter.d.ts +3 -2
  62. package/dist/form/FormMessageCounter.js +5 -2
  63. package/dist/form/FormMessageCounter.js.map +1 -1
  64. package/dist/form/InputToggle.js.map +1 -1
  65. package/dist/form/Label.d.ts +0 -10
  66. package/dist/form/Label.js.map +1 -1
  67. package/dist/form/Listbox.d.ts +3 -10
  68. package/dist/form/Listbox.js +8 -27
  69. package/dist/form/Listbox.js.map +1 -1
  70. package/dist/form/ListboxProvider.d.ts +17 -0
  71. package/dist/form/ListboxProvider.js +33 -1
  72. package/dist/form/ListboxProvider.js.map +1 -1
  73. package/dist/form/NativeSelect.js +1 -0
  74. package/dist/form/NativeSelect.js.map +1 -1
  75. package/dist/form/Slider.d.ts +4 -0
  76. package/dist/form/Slider.js.map +1 -1
  77. package/dist/form/Switch.js.map +1 -1
  78. package/dist/form/TextArea.js +1 -0
  79. package/dist/form/TextArea.js.map +1 -1
  80. package/dist/form/TextField.js +1 -0
  81. package/dist/form/TextField.js.map +1 -1
  82. package/dist/form/TextFieldContainer.d.ts +0 -13
  83. package/dist/form/TextFieldContainer.js.map +1 -1
  84. package/dist/form/_form-message.scss +13 -0
  85. package/dist/form/_select.scss +5 -1
  86. package/dist/form/_text-area.scss +2 -1
  87. package/dist/form/_text-field.scss +13 -3
  88. package/dist/form/formMessageContainerStyles.d.ts +7 -0
  89. package/dist/form/formMessageContainerStyles.js +4 -2
  90. package/dist/form/formMessageContainerStyles.js.map +1 -1
  91. package/dist/form/sliderUtils.d.ts +3 -7
  92. package/dist/form/sliderUtils.js.map +1 -1
  93. package/dist/form/types.d.ts +33 -0
  94. package/dist/form/types.js.map +1 -1
  95. package/dist/form/useCombobox.d.ts +6 -2
  96. package/dist/form/useCombobox.js +8 -9
  97. package/dist/form/useCombobox.js.map +1 -1
  98. package/dist/form/useFormReset.d.ts +4 -1
  99. package/dist/form/useFormReset.js +9 -4
  100. package/dist/form/useFormReset.js.map +1 -1
  101. package/dist/form/useNumberField.d.ts +5 -5
  102. package/dist/form/useNumberField.js +10 -2
  103. package/dist/form/useNumberField.js.map +1 -1
  104. package/dist/form/useSelectCombobox.js +2 -2
  105. package/dist/form/useSelectCombobox.js.map +1 -1
  106. package/dist/form/useTextField.d.ts +76 -59
  107. package/dist/form/useTextField.js +7 -1
  108. package/dist/form/useTextField.js.map +1 -1
  109. package/dist/interaction/types.d.ts +5 -1
  110. package/dist/interaction/types.js.map +1 -1
  111. package/dist/interaction/utils.d.ts +14 -0
  112. package/dist/interaction/utils.js +23 -12
  113. package/dist/interaction/utils.js.map +1 -1
  114. package/dist/link/Link.d.ts +0 -7
  115. package/dist/link/Link.js.map +1 -1
  116. package/dist/link/styles.d.ts +7 -0
  117. package/dist/link/styles.js.map +1 -1
  118. package/dist/list/List.d.ts +5 -20
  119. package/dist/list/List.js.map +1 -1
  120. package/dist/list/ListItem.d.ts +4 -38
  121. package/dist/list/ListItem.js.map +1 -1
  122. package/dist/list/listItemStyles.d.ts +24 -2
  123. package/dist/list/listItemStyles.js.map +1 -1
  124. package/dist/list/listStyles.d.ts +17 -2
  125. package/dist/list/listStyles.js.map +1 -1
  126. package/dist/menu/Menu.js.map +1 -1
  127. package/dist/menu/MenuBar.js +1 -1
  128. package/dist/menu/MenuBar.js.map +1 -1
  129. package/dist/menu/MenuItemTextField.d.ts +1 -2
  130. package/dist/menu/MenuItemTextField.js.map +1 -1
  131. package/dist/menu/MenuWidget.js +3 -2
  132. package/dist/menu/MenuWidget.js.map +1 -1
  133. package/dist/movement/constants.d.ts +10 -0
  134. package/dist/movement/constants.js +20 -4
  135. package/dist/movement/constants.js.map +1 -1
  136. package/dist/movement/types.d.ts +59 -10
  137. package/dist/movement/types.js.map +1 -1
  138. package/dist/movement/useKeyboardMovementProvider.d.ts +5 -1
  139. package/dist/movement/useKeyboardMovementProvider.js +171 -73
  140. package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
  141. package/dist/navigation/NavItem.d.ts +4 -1
  142. package/dist/navigation/NavItem.js.map +1 -1
  143. package/dist/navigation/navItemStyles.d.ts +7 -0
  144. package/dist/navigation/navItemStyles.js.map +1 -1
  145. package/dist/overlay/Overlay.d.ts +4 -23
  146. package/dist/overlay/Overlay.js.map +1 -1
  147. package/dist/overlay/styles.d.ts +26 -8
  148. package/dist/overlay/styles.js.map +1 -1
  149. package/dist/progress/LinearProgress.d.ts +4 -9
  150. package/dist/progress/LinearProgress.js.map +1 -1
  151. package/dist/progress/circularProgressStyles.d.ts +6 -0
  152. package/dist/progress/circularProgressStyles.js.map +1 -1
  153. package/dist/progress/linearProgressStyles.d.ts +20 -5
  154. package/dist/progress/linearProgressStyles.js.map +1 -1
  155. package/dist/progress/types.d.ts +0 -9
  156. package/dist/progress/types.js.map +1 -1
  157. package/dist/segmented-button/SegmentedButton.d.ts +7 -12
  158. package/dist/segmented-button/SegmentedButton.js.map +1 -1
  159. package/dist/segmented-button/segmentedButtonStyles.d.ts +26 -3
  160. package/dist/segmented-button/segmentedButtonStyles.js.map +1 -1
  161. package/dist/sheet/Sheet.d.ts +0 -12
  162. package/dist/sheet/Sheet.js.map +1 -1
  163. package/dist/sheet/styles.d.ts +12 -0
  164. package/dist/sheet/styles.js.map +1 -1
  165. package/dist/snackbar/Toast.d.ts +2 -13
  166. package/dist/snackbar/Toast.js.map +1 -1
  167. package/dist/snackbar/ToastManager.js.map +1 -1
  168. package/dist/snackbar/toastStyles.d.ts +17 -2
  169. package/dist/snackbar/toastStyles.js.map +1 -1
  170. package/dist/tabs/Tab.d.ts +2 -41
  171. package/dist/tabs/Tab.js.map +1 -1
  172. package/dist/tabs/tabStyles.d.ts +45 -4
  173. package/dist/tabs/tabStyles.js.map +1 -1
  174. package/dist/tabs/useTabList.js +1 -1
  175. package/dist/tabs/useTabList.js.map +1 -1
  176. package/dist/test-utils/drag.d.ts +6 -9
  177. package/dist/test-utils/mocks/IntersectionObserver.js.map +1 -1
  178. package/dist/test-utils/mocks/ResizeObserver.js.map +1 -1
  179. package/dist/test-utils/utils/createFileList.js.map +1 -1
  180. package/dist/theme/_theme.scss +0 -1
  181. package/dist/theme/getDerivedTheme.d.ts +0 -24
  182. package/dist/theme/getDerivedTheme.js.map +1 -1
  183. package/dist/theme/types.d.ts +25 -0
  184. package/dist/theme/types.js.map +1 -1
  185. package/dist/tooltip/Tooltip.d.ts +4 -32
  186. package/dist/tooltip/Tooltip.js.map +1 -1
  187. package/dist/tooltip/styles.d.ts +38 -1
  188. package/dist/tooltip/styles.js +1 -1
  189. package/dist/tooltip/styles.js.map +1 -1
  190. package/dist/transition/SkeletonPlaceholder.d.ts +0 -7
  191. package/dist/transition/SkeletonPlaceholder.js.map +1 -1
  192. package/dist/transition/Slide.js.map +1 -1
  193. package/dist/transition/skeletonPlaceholderUtils.d.ts +7 -0
  194. package/dist/transition/skeletonPlaceholderUtils.js.map +1 -1
  195. package/dist/transition/useCarousel.d.ts +2 -2
  196. package/dist/transition/useCarousel.js.map +1 -1
  197. package/dist/transition/useMaxWidthTransition.d.ts +14 -2
  198. package/dist/transition/useMaxWidthTransition.js.map +1 -1
  199. package/dist/transition/useSlideTransition.d.ts +5 -0
  200. package/dist/transition/useSlideTransition.js.map +1 -1
  201. package/dist/tree/Tree.d.ts +5 -9
  202. package/dist/tree/Tree.js +1 -1
  203. package/dist/tree/Tree.js.map +1 -1
  204. package/dist/tree/styles.d.ts +9 -1
  205. package/dist/tree/styles.js.map +1 -1
  206. package/dist/tree/useTreeMovement.d.ts +2 -1
  207. package/dist/tree/useTreeMovement.js +2 -1
  208. package/dist/tree/useTreeMovement.js.map +1 -1
  209. package/dist/types.d.ts +14 -0
  210. package/dist/types.js.map +1 -1
  211. package/dist/typography/Mark.d.ts +4 -1
  212. package/dist/typography/Mark.js.map +1 -1
  213. package/dist/typography/TextContainer.d.ts +0 -6
  214. package/dist/typography/TextContainer.js.map +1 -1
  215. package/dist/typography/markStyles.d.ts +5 -0
  216. package/dist/typography/markStyles.js.map +1 -1
  217. package/dist/typography/textContainerStyles.d.ts +6 -0
  218. package/dist/typography/textContainerStyles.js.map +1 -1
  219. package/dist/typography/typographyStyles.d.ts +9 -0
  220. package/dist/typography/typographyStyles.js.map +1 -1
  221. package/dist/useResizeObserver.js.map +1 -1
  222. package/dist/utils/getMiddleOfRange.d.ts +2 -3
  223. package/dist/utils/getMiddleOfRange.js.map +1 -1
  224. package/dist/utils/getPercentage.d.ts +2 -9
  225. package/dist/utils/getPercentage.js +1 -1
  226. package/dist/utils/getPercentage.js.map +1 -1
  227. package/dist/utils/getRangeSteps.d.ts +2 -3
  228. package/dist/utils/getRangeSteps.js +0 -3
  229. package/dist/utils/getRangeSteps.js.map +1 -1
  230. package/dist/utils/nearest.d.ts +2 -3
  231. package/dist/utils/nearest.js +0 -3
  232. package/dist/utils/nearest.js.map +1 -1
  233. package/dist/utils/trigonometry.d.ts +31 -0
  234. package/dist/utils/trigonometry.js +25 -0
  235. package/dist/utils/trigonometry.js.map +1 -0
  236. package/dist/window-splitter/WindowSplitter.d.ts +5 -19
  237. package/dist/window-splitter/WindowSplitter.js.map +1 -1
  238. package/dist/window-splitter/styles.d.ts +27 -3
  239. package/dist/window-splitter/styles.js.map +1 -1
  240. package/dist/window-splitter/useWindowSplitter.d.ts +1 -1
  241. package/dist/window-splitter/useWindowSplitter.js.map +1 -1
  242. package/package.json +8 -8
  243. package/src/app-bar/styles.ts +0 -2
  244. package/src/autocomplete/types.ts +17 -0
  245. package/src/avatar/Avatar.tsx +0 -11
  246. package/src/avatar/styles.ts +11 -0
  247. package/src/badge/Badge.tsx +12 -0
  248. package/src/badge/styles.ts +0 -9
  249. package/src/box/styles.ts +9 -0
  250. package/src/button/styles.ts +5 -1
  251. package/src/card/Card.tsx +0 -8
  252. package/src/card/styles.ts +15 -8
  253. package/src/chip/Chip.tsx +9 -15
  254. package/src/chip/styles.ts +29 -1
  255. package/src/datetime/NativeDateField.tsx +92 -0
  256. package/src/datetime/NativeTimeField.tsx +94 -0
  257. package/src/datetime/useDateField.ts +193 -0
  258. package/src/datetime/useTimeField.ts +233 -0
  259. package/src/datetime/utils.ts +48 -0
  260. package/src/dialog/styles.ts +5 -2
  261. package/src/divider/styles.ts +1 -1
  262. package/src/draggable/utils.ts +3 -6
  263. package/src/expansion-panel/ExpansionList.tsx +2 -1
  264. package/src/expansion-panel/useExpansionList.ts +6 -12
  265. package/src/form/FormMessage.tsx +4 -0
  266. package/src/form/FormMessageContainer.tsx +8 -4
  267. package/src/form/FormMessageCounter.tsx +17 -6
  268. package/src/form/InputToggle.tsx +2 -0
  269. package/src/form/Label.tsx +0 -11
  270. package/src/form/Listbox.tsx +18 -46
  271. package/src/form/ListboxProvider.ts +61 -1
  272. package/src/form/NativeSelect.tsx +1 -0
  273. package/src/form/Slider.tsx +6 -0
  274. package/src/form/Switch.tsx +2 -0
  275. package/src/form/TextArea.tsx +3 -0
  276. package/src/form/TextField.tsx +1 -0
  277. package/src/form/TextFieldContainer.tsx +0 -14
  278. package/src/form/formMessageContainerStyles.ts +10 -2
  279. package/src/form/sliderUtils.ts +3 -7
  280. package/src/form/types.ts +44 -0
  281. package/src/form/useCombobox.ts +15 -10
  282. package/src/form/useFormReset.ts +12 -5
  283. package/src/form/useNumberField.ts +17 -14
  284. package/src/form/useSelectCombobox.ts +2 -2
  285. package/src/form/useTextField.ts +102 -69
  286. package/src/interaction/types.ts +5 -1
  287. package/src/interaction/utils.ts +18 -20
  288. package/src/link/Link.tsx +0 -8
  289. package/src/link/styles.ts +8 -0
  290. package/src/list/List.tsx +7 -24
  291. package/src/list/ListItem.tsx +7 -43
  292. package/src/list/listItemStyles.ts +26 -2
  293. package/src/list/listStyles.ts +18 -2
  294. package/src/menu/Menu.tsx +2 -0
  295. package/src/menu/MenuBar.tsx +1 -1
  296. package/src/menu/MenuItemTextField.tsx +1 -3
  297. package/src/menu/MenuWidget.tsx +4 -2
  298. package/src/movement/constants.ts +26 -4
  299. package/src/movement/types.ts +84 -19
  300. package/src/movement/useKeyboardMovementProvider.ts +209 -95
  301. package/src/navigation/NavItem.tsx +6 -2
  302. package/src/navigation/navItemStyles.ts +8 -0
  303. package/src/overlay/Overlay.tsx +4 -26
  304. package/src/overlay/styles.ts +29 -10
  305. package/src/progress/LinearProgress.tsx +8 -10
  306. package/src/progress/circularProgressStyles.ts +7 -0
  307. package/src/progress/linearProgressStyles.ts +22 -5
  308. package/src/progress/types.ts +0 -10
  309. package/src/segmented-button/SegmentedButton.tsx +14 -15
  310. package/src/segmented-button/segmentedButtonStyles.ts +28 -3
  311. package/src/sheet/Sheet.tsx +0 -13
  312. package/src/sheet/styles.ts +13 -0
  313. package/src/snackbar/Toast.tsx +2 -15
  314. package/src/snackbar/toastStyles.ts +20 -2
  315. package/src/tabs/Tab.tsx +4 -49
  316. package/src/tabs/tabStyles.ts +52 -4
  317. package/src/tabs/useTabList.ts +1 -1
  318. package/src/test-utils/drag.ts +8 -12
  319. package/src/theme/getDerivedTheme.ts +0 -26
  320. package/src/theme/types.ts +26 -0
  321. package/src/tooltip/Tooltip.tsx +4 -36
  322. package/src/tooltip/styles.ts +43 -2
  323. package/src/transition/SkeletonPlaceholder.tsx +0 -8
  324. package/src/transition/Slide.tsx +2 -0
  325. package/src/transition/skeletonPlaceholderUtils.ts +8 -0
  326. package/src/transition/useCarousel.ts +2 -2
  327. package/src/transition/useMaxWidthTransition.ts +17 -2
  328. package/src/transition/useSlideTransition.ts +8 -0
  329. package/src/tree/Tree.tsx +6 -11
  330. package/src/tree/styles.ts +10 -1
  331. package/src/tree/useTreeMovement.ts +4 -0
  332. package/src/types.ts +16 -0
  333. package/src/typography/Mark.tsx +6 -2
  334. package/src/typography/TextContainer.tsx +0 -7
  335. package/src/typography/markStyles.ts +6 -0
  336. package/src/typography/textContainerStyles.ts +7 -0
  337. package/src/typography/typographyStyles.ts +10 -0
  338. package/src/utils/getMiddleOfRange.ts +2 -3
  339. package/src/utils/getPercentage.ts +3 -11
  340. package/src/utils/getRangeSteps.ts +3 -3
  341. package/src/utils/nearest.ts +3 -3
  342. package/src/utils/trigonometry.ts +46 -0
  343. package/src/window-splitter/WindowSplitter.tsx +9 -22
  344. package/src/window-splitter/styles.ts +31 -3
  345. package/src/window-splitter/useWindowSplitter.ts +3 -2
@@ -1,23 +1,14 @@
1
1
  import { type HTMLAttributes } from "react";
2
- declare module "react" {
3
- interface CSSProperties {
4
- "--rmd-list-padding-h"?: string | number;
5
- "--rmd-list-padding-v"?: string | number;
6
- }
7
- }
2
+ import { type ListClassNameOptions } from "./listStyles.js";
8
3
  export type ListElement = HTMLUListElement | HTMLOListElement;
9
- export interface ListProps extends HTMLAttributes<ListElement> {
4
+ /**
5
+ * @since 6.3.1 Extends the ListClassNameOptions
6
+ */
7
+ export interface ListProps extends HTMLAttributes<ListElement>, ListClassNameOptions {
10
8
  /**
11
9
  * @defaultValue `"none"`
12
10
  */
13
11
  role?: HTMLAttributes<ListElement>["role"];
14
- /**
15
- * Set to `true` to decrease the amount of padding and font size within the
16
- * list.
17
- *
18
- * @defaultValue `false`
19
- */
20
- dense?: boolean;
21
12
  /**
22
13
  * Set this to `true` to render as `<ol>` instead of `<ul>` when the children
23
14
  * are in a specific order. For example: steps within a recipe.
@@ -25,12 +16,6 @@ export interface ListProps extends HTMLAttributes<ListElement> {
25
16
  * @defaultValue `false`
26
17
  */
27
18
  ordered?: boolean;
28
- /**
29
- * Set this to `true` to render horizontally instead of vertically.
30
- *
31
- * @defaultValue `false`
32
- */
33
- horizontal?: boolean;
34
19
  }
35
20
  /**
36
21
  * The `List` component is used to render a collection of clickable actions
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/list/List.tsx"],"sourcesContent":["import { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { list } from \"./listStyles.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-list-padding-h\"?: string | number;\n \"--rmd-list-padding-v\"?: string | number;\n }\n}\n\nexport type ListElement = HTMLUListElement | HTMLOListElement;\n\nexport interface ListProps extends HTMLAttributes<ListElement> {\n /**\n * @defaultValue `\"none\"`\n */\n role?: HTMLAttributes<ListElement>[\"role\"];\n\n /**\n * Set to `true` to decrease the amount of padding and font size within the\n * list.\n *\n * @defaultValue `false`\n */\n dense?: boolean;\n\n /**\n * Set this to `true` to render as `<ol>` instead of `<ul>` when the children\n * are in a specific order. For example: steps within a recipe.\n *\n * @defaultValue `false`\n */\n ordered?: boolean;\n\n /**\n * Set this to `true` to render horizontally instead of vertically.\n *\n * @defaultValue `false`\n */\n horizontal?: boolean;\n}\n\n/**\n * The `List` component is used to render a collection of clickable actions\n * vertically or horizontally and does not include the default `ol`/`ul` styles.\n *\n * @example Simple Example\n * ```tsx\n * import { List } from \"@react-md/core/list/List\";\n * import { ListItem } from \"@react-md/core/list/ListItem\";\n * import { ListItemLink } from \"@react-md/core/list/ListItemLink\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <List>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * >\n * Item 1\n * </ListItem>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * >\n * Item 2\n * </ListItem>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * >\n * Item 3\n * </ListItem>\n * <ListItemLink href=\"/some-route\">Link Example</ListItemLink>\n * </List>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/list | List Demos}\n */\nexport const List = forwardRef<ListElement, ListProps>(\n function List(props, ref) {\n const {\n className,\n children,\n role = \"none\",\n dense = false,\n ordered = false,\n horizontal = false,\n ...remaining\n } = props;\n const Component = (ordered ? \"ol\" : \"ul\") as \"ul\";\n return (\n <Component\n {...remaining}\n ref={ref}\n role={role}\n className={list({\n dense,\n horizontal,\n className,\n })}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["forwardRef","list","List","props","ref","className","children","role","dense","ordered","horizontal","remaining","Component"],"mappings":";AAAA,SAA8BA,UAAU,QAAQ,QAAQ;AAExD,SAASC,IAAI,QAAQ,kBAAkB;AAyCvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CC,GACD,OAAO,MAAMC,qBAAOF,WAClB,SAASE,KAAKC,KAAK,EAAEC,GAAG;IACtB,MAAM,EACJC,SAAS,EACTC,QAAQ,EACRC,OAAO,MAAM,EACbC,QAAQ,KAAK,EACbC,UAAU,KAAK,EACfC,aAAa,KAAK,EAClB,GAAGC,WACJ,GAAGR;IACJ,MAAMS,YAAaH,UAAU,OAAO;IACpC,qBACE,KAACG;QACE,GAAGD,SAAS;QACbP,KAAKA;QACLG,MAAMA;QACNF,WAAWJ,KAAK;YACdO;YACAE;YACAL;QACF;kBAECC;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/list/List.tsx"],"sourcesContent":["import { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { type ListClassNameOptions, list } from \"./listStyles.js\";\n\nexport type ListElement = HTMLUListElement | HTMLOListElement;\n\n/**\n * @since 6.3.1 Extends the ListClassNameOptions\n */\nexport interface ListProps\n extends HTMLAttributes<ListElement>,\n ListClassNameOptions {\n /**\n * @defaultValue `\"none\"`\n */\n role?: HTMLAttributes<ListElement>[\"role\"];\n\n /**\n * Set this to `true` to render as `<ol>` instead of `<ul>` when the children\n * are in a specific order. For example: steps within a recipe.\n *\n * @defaultValue `false`\n */\n ordered?: boolean;\n}\n\n/**\n * The `List` component is used to render a collection of clickable actions\n * vertically or horizontally and does not include the default `ol`/`ul` styles.\n *\n * @example Simple Example\n * ```tsx\n * import { List } from \"@react-md/core/list/List\";\n * import { ListItem } from \"@react-md/core/list/ListItem\";\n * import { ListItemLink } from \"@react-md/core/list/ListItemLink\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <List>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * >\n * Item 1\n * </ListItem>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * >\n * Item 2\n * </ListItem>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * >\n * Item 3\n * </ListItem>\n * <ListItemLink href=\"/some-route\">Link Example</ListItemLink>\n * </List>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/list | List Demos}\n */\nexport const List = forwardRef<ListElement, ListProps>(\n function List(props, ref) {\n const {\n className,\n children,\n role = \"none\",\n dense = false,\n ordered = false,\n horizontal = false,\n ...remaining\n } = props;\n const Component = (ordered ? \"ol\" : \"ul\") as \"ul\";\n return (\n <Component\n {...remaining}\n ref={ref}\n role={role}\n className={list({\n dense,\n horizontal,\n className,\n })}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["forwardRef","list","List","props","ref","className","children","role","dense","ordered","horizontal","remaining","Component"],"mappings":";AAAA,SAA8BA,UAAU,QAAQ,QAAQ;AAExD,SAAoCC,IAAI,QAAQ,kBAAkB;AAwBlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CC,GACD,OAAO,MAAMC,qBAAOF,WAClB,SAASE,KAAKC,KAAK,EAAEC,GAAG;IACtB,MAAM,EACJC,SAAS,EACTC,QAAQ,EACRC,OAAO,MAAM,EACbC,QAAQ,KAAK,EACbC,UAAU,KAAK,EACfC,aAAa,KAAK,EAClB,GAAGC,WACJ,GAAGR;IACJ,MAAMS,YAAaH,UAAU,OAAO;IACpC,qBACE,KAACG;QACE,GAAGD,SAAS;QACbP,KAAKA;QACLG,MAAMA;QACNF,WAAWJ,KAAK;YACdO;YACAE;YACAL;QACF;kBAECC;;AAGP,GACA"}
@@ -1,27 +1,13 @@
1
1
  import { type HTMLAttributes } from "react";
2
2
  import { type ComponentWithRippleProps } from "../interaction/types.js";
3
- import { type ListItemChildrenProps, type ListItemHeight } from "./types.js";
4
- declare module "react" {
5
- interface CSSProperties {
6
- "--rmd-list-item-keyline"?: string | number;
7
- "--rmd-list-item-padding-h"?: string | number;
8
- "--rmd-list-item-padding-v"?: string | number;
9
- "--rmd-list-item-height"?: string | number;
10
- "--rmd-list-item-medium-height"?: string | number;
11
- "--rmd-list-item-large-height"?: string | number;
12
- "--rmd-list-item-extra-large-height"?: string | number;
13
- "--rmd-list-item-multiline-clamp"?: string | number;
14
- "--rmd-list-item-multiline-height"?: string | number;
15
- "--rmd-list-item-media-size"?: string | number;
16
- "--rmd-list-item-media-spacing"?: string | number;
17
- "--rmd-list-item-text-multiline-height"?: string | number;
18
- }
19
- }
3
+ import { type BaseListItemClassNameOptions } from "./listItemStyles.js";
4
+ import { type ListItemChildrenProps } from "./types.js";
20
5
  /**
21
6
  * @since 6.0.0 Renamed `threeLines` to `multiline` since it can
22
7
  * support more than three lines of text.
8
+ * @since 6.3.1 Extends the BaseListItemClassNameOptions
23
9
  */
24
- export interface ListItemProps extends HTMLAttributes<HTMLLIElement>, ListItemChildrenProps, ComponentWithRippleProps {
10
+ export interface ListItemProps extends HTMLAttributes<HTMLLIElement>, ListItemChildrenProps, BaseListItemClassNameOptions, ComponentWithRippleProps {
25
11
  /**
26
12
  * @defaultValue `"button"`
27
13
  */
@@ -30,26 +16,6 @@ export interface ListItemProps extends HTMLAttributes<HTMLLIElement>, ListItemCh
30
16
  * @defaultValue `disabled ? -1 : 0`
31
17
  */
32
18
  tabIndex?: number;
33
- /**
34
- * @see {@link ListItemHeight}
35
- * @defaultValue `"auto"`
36
- */
37
- height?: ListItemHeight;
38
- /**
39
- * @defaultValue `false`
40
- */
41
- multiline?: boolean;
42
- /**
43
- * @defaultValue `false`
44
- */
45
- disabled?: boolean;
46
- /**
47
- * Note: This does nothing if the `disabled` prop is not enabled.
48
- *
49
- * @defaultValue `false`
50
- * @since 2.4.3
51
- */
52
- disabledOpacity?: boolean;
53
19
  /**
54
20
  * Set this to `false` if the list item should not gain the interaction
55
21
  * states: hover, focus, press, etc. This is kind of like being disabled
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/list/ListItem.tsx"],"sourcesContent":["\"use client\";\n\nimport { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { ListItemChildren } from \"./ListItemChildren.js\";\nimport { getListItemHeight } from \"./getListItemHeight.js\";\nimport { listItem } from \"./listItemStyles.js\";\nimport { type ListItemChildrenProps, type ListItemHeight } from \"./types.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-list-item-keyline\"?: string | number;\n \"--rmd-list-item-padding-h\"?: string | number;\n \"--rmd-list-item-padding-v\"?: string | number;\n \"--rmd-list-item-height\"?: string | number;\n \"--rmd-list-item-medium-height\"?: string | number;\n \"--rmd-list-item-large-height\"?: string | number;\n \"--rmd-list-item-extra-large-height\"?: string | number;\n \"--rmd-list-item-multiline-clamp\"?: string | number;\n \"--rmd-list-item-multiline-height\"?: string | number;\n \"--rmd-list-item-media-size\"?: string | number;\n \"--rmd-list-item-media-spacing\"?: string | number;\n \"--rmd-list-item-text-multiline-height\"?: string | number;\n }\n}\n\n/**\n * @since 6.0.0 Renamed `threeLines` to `multiline` since it can\n * support more than three lines of text.\n */\nexport interface ListItemProps\n extends HTMLAttributes<HTMLLIElement>,\n ListItemChildrenProps,\n ComponentWithRippleProps {\n /**\n * @defaultValue `\"button\"`\n */\n role?: HTMLAttributes<HTMLLIElement>[\"role\"];\n\n /**\n * @defaultValue `disabled ? -1 : 0`\n */\n tabIndex?: number;\n\n /**\n * @see {@link ListItemHeight}\n * @defaultValue `\"auto\"`\n */\n height?: ListItemHeight;\n\n /**\n * @defaultValue `false`\n */\n multiline?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * Note: This does nothing if the `disabled` prop is not enabled.\n *\n * @defaultValue `false`\n * @since 2.4.3\n */\n disabledOpacity?: boolean;\n\n /**\n * Set this to `false` if the list item should not gain the interaction\n * states: hover, focus, press, etc. This is kind of like being disabled\n * without the disabled styles being applied.\n *\n * @defaultValue `role === \"presentation\"`\n */\n presentational?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * The `ListItem` is used to create a clickable/focusable button within a\n * `List` and removes the normal `<li>` styles.\n *\n * @example Simple Example\n * ```tsx\n * import { List } from \"@react-md/core/list/List\";\n * import { ListItem } from \"@react-md/core/list/ListItem\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <List>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * >\n * Item 1\n * </ListItem>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * secondaryText={<span>Some <strong>additional</strong> content.</span>}\n * >\n * Item 2\n * </ListItem>\n * </List>\n * );\n * );\n * }\n * ```\n *\n * @example Applying Addons Example\n * ```tsx\n * import { List } from \"@react-md/core/list/List\";\n * import { ListItem } from \"@react-md/core/list/ListItem\";\n * import FavoriteIcon from \"@react-md/material-icons/FavoriteIcon\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <List>\n * <ListItem leftAddon={<FavoriteIcon />}>\n * Item 1\n * </ListItem>\n * <ListItem rightAddon={<FavoriteIcon />}>\n * Item 2\n * </ListItem>\n * <ListItem\n * leftAddon={<FavoriteIcon />}\n * rightAddon={<img alt=\"\" src=\"/some-image.png\" />}\n * rightAddonType=\"media\"\n * >\n * Item 3\n * </ListItem>\n * </List>\n * );\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/list | List Demos}\n */\nexport const ListItem = forwardRef<HTMLLIElement, ListItemProps>(\n function ListItem(props, ref) {\n const {\n className,\n textProps,\n textClassName,\n secondaryTextClassName,\n primaryText,\n secondaryText,\n secondaryTextProps,\n disableTextChildren = false,\n height: propHeight,\n leftAddon,\n leftAddonType,\n leftAddonPosition,\n leftAddonClassName,\n leftAddonForceWrap,\n rightAddon,\n rightAddonType,\n rightAddonPosition,\n rightAddonClassName,\n rightAddonForceWrap,\n disableLeftAddonSpacing,\n disableLeftAddonCenteredMedia,\n disableRightAddonCenteredMedia,\n multiline = false,\n disabled = false,\n disableRipple,\n disabledOpacity = false,\n role = \"button\",\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n tabIndex: propTabIndex,\n children: propChildren,\n presentational = role === \"presentation\",\n ...remaining\n } = props;\n\n let tabIndex = propTabIndex;\n if (!presentational && typeof tabIndex === \"undefined\") {\n tabIndex = disabled ? -1 : 0;\n }\n\n const { pressedClassName, ripples, handlers } = useElementInteraction({\n mode: disableRipple ? \"none\" : undefined,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled: disabled || presentational,\n });\n const children = useHigherContrastChildren(\n propChildren,\n !disableTextChildren\n );\n\n const height = getListItemHeight({\n height: propHeight,\n leftAddon,\n leftAddonType,\n rightAddon,\n rightAddonType,\n secondaryText,\n });\n\n return (\n <li\n {...remaining}\n {...handlers}\n aria-disabled={disabled || undefined}\n ref={ref}\n role={role}\n tabIndex={tabIndex}\n className={listItem({\n className,\n height,\n disabled,\n disabledOpacity,\n multiline,\n clickable: !presentational,\n pressedClassName,\n })}\n >\n <ListItemChildren\n multiline={multiline}\n textClassName={textClassName}\n secondaryTextClassName={secondaryTextClassName}\n disableTextChildren={disableTextChildren}\n primaryText={primaryText}\n textProps={textProps}\n secondaryText={secondaryText}\n secondaryTextProps={secondaryTextProps}\n leftAddon={leftAddon}\n leftAddonType={leftAddonType}\n leftAddonPosition={leftAddonPosition}\n leftAddonClassName={leftAddonClassName}\n leftAddonForceWrap={leftAddonForceWrap}\n rightAddon={rightAddon}\n rightAddonType={rightAddonType}\n rightAddonPosition={rightAddonPosition}\n rightAddonClassName={rightAddonClassName}\n rightAddonForceWrap={rightAddonForceWrap}\n disableLeftAddonSpacing={disableLeftAddonSpacing}\n disableLeftAddonCenteredMedia={disableLeftAddonCenteredMedia}\n disableRightAddonCenteredMedia={disableRightAddonCenteredMedia}\n >\n {children}\n </ListItemChildren>\n {ripples}\n </li>\n );\n }\n);\n"],"names":["forwardRef","useElementInteraction","useHigherContrastChildren","ListItemChildren","getListItemHeight","listItem","ListItem","props","ref","className","textProps","textClassName","secondaryTextClassName","primaryText","secondaryText","secondaryTextProps","disableTextChildren","height","propHeight","leftAddon","leftAddonType","leftAddonPosition","leftAddonClassName","leftAddonForceWrap","rightAddon","rightAddonType","rightAddonPosition","rightAddonClassName","rightAddonForceWrap","disableLeftAddonSpacing","disableLeftAddonCenteredMedia","disableRightAddonCenteredMedia","multiline","disabled","disableRipple","disabledOpacity","role","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","tabIndex","propTabIndex","children","propChildren","presentational","remaining","pressedClassName","ripples","handlers","mode","undefined","li","aria-disabled","clickable"],"mappings":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QACpEwD,MAAMvB,gBAAgB,SAASwB;QAC/BrB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAd,UAAUA,YAAYmB;IACxB;IACA,MAAMF,WAAWhD,0BACfiD,cACA,CAACnC;IAGH,MAAMC,SAASb,kBAAkB;QAC/Ba,QAAQC;QACRC;QACAC;QACAI;QACAC;QACAX;IACF;IAEA,qBACE,MAAC6C;QACE,GAAGN,SAAS;QACZ,GAAGG,QAAQ;QACZI,iBAAe3B,YAAYyB;QAC3BlD,KAAKA;QACL4B,MAAMA;QACNY,UAAUA;QACVvC,WAAWJ,SAAS;YAClBI;YACAQ;YACAgB;YACAE;YACAH;YACA6B,WAAW,CAACT;YACZE;QACF;;0BAEA,KAACnD;gBACC6B,WAAWA;gBACXrB,eAAeA;gBACfC,wBAAwBA;gBACxBI,qBAAqBA;gBACrBH,aAAaA;gBACbH,WAAWA;gBACXI,eAAeA;gBACfC,oBAAoBA;gBACpBI,WAAWA;gBACXC,eAAeA;gBACfC,mBAAmBA;gBACnBC,oBAAoBA;gBACpBC,oBAAoBA;gBACpBC,YAAYA;gBACZC,gBAAgBA;gBAChBC,oBAAoBA;gBACpBC,qBAAqBA;gBACrBC,qBAAqBA;gBACrBC,yBAAyBA;gBACzBC,+BAA+BA;gBAC/BC,gCAAgCA;0BAE/BmB;;YAEFK;;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/list/ListItem.tsx"],"sourcesContent":["\"use client\";\n\nimport { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { ListItemChildren } from \"./ListItemChildren.js\";\nimport { getListItemHeight } from \"./getListItemHeight.js\";\nimport {\n type BaseListItemClassNameOptions,\n listItem,\n} from \"./listItemStyles.js\";\nimport { type ListItemChildrenProps } from \"./types.js\";\n\n/**\n * @since 6.0.0 Renamed `threeLines` to `multiline` since it can\n * support more than three lines of text.\n * @since 6.3.1 Extends the BaseListItemClassNameOptions\n */\nexport interface ListItemProps\n extends HTMLAttributes<HTMLLIElement>,\n ListItemChildrenProps,\n BaseListItemClassNameOptions,\n ComponentWithRippleProps {\n /**\n * @defaultValue `\"button\"`\n */\n role?: HTMLAttributes<HTMLLIElement>[\"role\"];\n\n /**\n * @defaultValue `disabled ? -1 : 0`\n */\n tabIndex?: number;\n\n /**\n * Set this to `false` if the list item should not gain the interaction\n * states: hover, focus, press, etc. This is kind of like being disabled\n * without the disabled styles being applied.\n *\n * @defaultValue `role === \"presentation\"`\n */\n presentational?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * The `ListItem` is used to create a clickable/focusable button within a\n * `List` and removes the normal `<li>` styles.\n *\n * @example Simple Example\n * ```tsx\n * import { List } from \"@react-md/core/list/List\";\n * import { ListItem } from \"@react-md/core/list/ListItem\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <List>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * >\n * Item 1\n * </ListItem>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * secondaryText={<span>Some <strong>additional</strong> content.</span>}\n * >\n * Item 2\n * </ListItem>\n * </List>\n * );\n * );\n * }\n * ```\n *\n * @example Applying Addons Example\n * ```tsx\n * import { List } from \"@react-md/core/list/List\";\n * import { ListItem } from \"@react-md/core/list/ListItem\";\n * import FavoriteIcon from \"@react-md/material-icons/FavoriteIcon\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <List>\n * <ListItem leftAddon={<FavoriteIcon />}>\n * Item 1\n * </ListItem>\n * <ListItem rightAddon={<FavoriteIcon />}>\n * Item 2\n * </ListItem>\n * <ListItem\n * leftAddon={<FavoriteIcon />}\n * rightAddon={<img alt=\"\" src=\"/some-image.png\" />}\n * rightAddonType=\"media\"\n * >\n * Item 3\n * </ListItem>\n * </List>\n * );\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/list | List Demos}\n */\nexport const ListItem = forwardRef<HTMLLIElement, ListItemProps>(\n function ListItem(props, ref) {\n const {\n className,\n textProps,\n textClassName,\n secondaryTextClassName,\n primaryText,\n secondaryText,\n secondaryTextProps,\n disableTextChildren = false,\n height: propHeight,\n leftAddon,\n leftAddonType,\n leftAddonPosition,\n leftAddonClassName,\n leftAddonForceWrap,\n rightAddon,\n rightAddonType,\n rightAddonPosition,\n rightAddonClassName,\n rightAddonForceWrap,\n disableLeftAddonSpacing,\n disableLeftAddonCenteredMedia,\n disableRightAddonCenteredMedia,\n multiline = false,\n disabled = false,\n disableRipple,\n disabledOpacity = false,\n role = \"button\",\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n tabIndex: propTabIndex,\n children: propChildren,\n presentational = role === \"presentation\",\n ...remaining\n } = props;\n\n let tabIndex = propTabIndex;\n if (!presentational && typeof tabIndex === \"undefined\") {\n tabIndex = disabled ? -1 : 0;\n }\n\n const { pressedClassName, ripples, handlers } = useElementInteraction({\n mode: disableRipple ? \"none\" : undefined,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled: disabled || presentational,\n });\n const children = useHigherContrastChildren(\n propChildren,\n !disableTextChildren\n );\n\n const height = getListItemHeight({\n height: propHeight,\n leftAddon,\n leftAddonType,\n rightAddon,\n rightAddonType,\n secondaryText,\n });\n\n return (\n <li\n {...remaining}\n {...handlers}\n aria-disabled={disabled || undefined}\n ref={ref}\n role={role}\n tabIndex={tabIndex}\n className={listItem({\n className,\n height,\n disabled,\n disabledOpacity,\n multiline,\n clickable: !presentational,\n pressedClassName,\n })}\n >\n <ListItemChildren\n multiline={multiline}\n textClassName={textClassName}\n secondaryTextClassName={secondaryTextClassName}\n disableTextChildren={disableTextChildren}\n primaryText={primaryText}\n textProps={textProps}\n secondaryText={secondaryText}\n secondaryTextProps={secondaryTextProps}\n leftAddon={leftAddon}\n leftAddonType={leftAddonType}\n leftAddonPosition={leftAddonPosition}\n leftAddonClassName={leftAddonClassName}\n leftAddonForceWrap={leftAddonForceWrap}\n rightAddon={rightAddon}\n rightAddonType={rightAddonType}\n rightAddonPosition={rightAddonPosition}\n rightAddonClassName={rightAddonClassName}\n rightAddonForceWrap={rightAddonForceWrap}\n disableLeftAddonSpacing={disableLeftAddonSpacing}\n disableLeftAddonCenteredMedia={disableLeftAddonCenteredMedia}\n disableRightAddonCenteredMedia={disableRightAddonCenteredMedia}\n >\n {children}\n </ListItemChildren>\n {ripples}\n </li>\n );\n }\n);\n"],"names":["forwardRef","useElementInteraction","useHigherContrastChildren","ListItemChildren","getListItemHeight","listItem","ListItem","props","ref","className","textProps","textClassName","secondaryTextClassName","primaryText","secondaryText","secondaryTextProps","disableTextChildren","height","propHeight","leftAddon","leftAddonType","leftAddonPosition","leftAddonClassName","leftAddonForceWrap","rightAddon","rightAddonType","rightAddonPosition","rightAddonClassName","rightAddonForceWrap","disableLeftAddonSpacing","disableLeftAddonCenteredMedia","disableRightAddonCenteredMedia","multiline","disabled","disableRipple","disabledOpacity","role","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","tabIndex","propTabIndex","children","propChildren","presentational","remaining","pressedClassName","ripples","handlers","mode","undefined","li","aria-disabled","clickable"],"mappings":"AAAA;;AAEA,SAA8BA,UAAU,QAAQ,QAAQ;AAGxD,SAASC,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AACxF,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAEEC,QAAQ,QACH,sB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C;QACAC;QACAI;QACAC;QACAX;IACF;IAEA,qBACE,MAAC6C;QACE,GAAGN,SAAS;QACZ,GAAGG,QAAQ;QACZI,iBAAe3B,YAAYyB;QAC3BlD,KAAKA;QACL4B,MAAMA;QACNY,UAAUA;QACVvC,WAAWJ,SAAS;YAClBI;YACAQ;YACAgB;YACAE;YACAH;YACA6B,WAAW,CAACT;YACZE;QACF;;0BAEA,KAACnD;gBACC6B,WAAWA;gBACXrB,eAAeA;gBACfC,wBAAwBA;gBACxBI,qBAAqBA;gBACrBH,aAAaA;gBACbH,WAAWA;gBACXI,eAAeA;gBACfC,oBAAoBA;gBACpBI,WAAWA;gBACXC,eAAeA;gBACfC,mBAAmBA;gBACnBC,oBAAoBA;gBACpBC,oBAAoBA;gBACpBC,YAAYA;gBACZC,gBAAgBA;gBAChBC,oBAAoBA;gBACpBC,qBAAqBA;gBACrBC,qBAAqBA;gBACrBC,yBAAyBA;gBACzBC,+BAA+BA;gBAC/BC,gCAAgCA;0BAE/BmB;;YAEFK;;;AAGP,GACA"}
@@ -1,6 +1,22 @@
1
1
  import { type ListItemAddonPosition, type ListItemAddonType, type ListItemHeight } from "./types.js";
2
- /** @since 6.0.0 */
3
- export interface ListItemClassNameOptions {
2
+ declare module "react" {
3
+ interface CSSProperties {
4
+ "--rmd-list-item-keyline"?: string | number;
5
+ "--rmd-list-item-padding-h"?: string | number;
6
+ "--rmd-list-item-padding-v"?: string | number;
7
+ "--rmd-list-item-height"?: string | number;
8
+ "--rmd-list-item-medium-height"?: string | number;
9
+ "--rmd-list-item-large-height"?: string | number;
10
+ "--rmd-list-item-extra-large-height"?: string | number;
11
+ "--rmd-list-item-multiline-height"?: string | number;
12
+ "--rmd-list-item-media-size"?: string | number;
13
+ "--rmd-list-item-media-spacing"?: string | number;
14
+ "--rmd-list-item-text-multiline-height"?: string | number;
15
+ "--rmd-list-item-multiline-clamp"?: string | number;
16
+ }
17
+ }
18
+ /** @since 6.3.1 */
19
+ export interface BaseListItemClassNameOptions {
4
20
  className?: string;
5
21
  /**
6
22
  * @see {@link ListItemHeight}
@@ -12,7 +28,10 @@ export interface ListItemClassNameOptions {
12
28
  */
13
29
  multiline?: boolean;
14
30
  /**
31
+ * Note: This does nothing if the `disabled` prop is not enabled.
32
+ *
15
33
  * @defaultValue `false`
34
+ * @since 2.4.3
16
35
  */
17
36
  disabled?: boolean;
18
37
  /**
@@ -22,6 +41,9 @@ export interface ListItemClassNameOptions {
22
41
  * @since 2.4.3
23
42
  */
24
43
  disabledOpacity?: boolean;
44
+ }
45
+ /** @since 6.0.0 */
46
+ export interface ListItemClassNameOptions extends BaseListItemClassNameOptions {
25
47
  /**
26
48
  * Set this to `false` if the list item should not gain the interaction
27
49
  * states: hover, focus, press, etc. This is kind of like being disabled
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/list/listItemStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\nimport { cssUtils } from \"../cssUtils.js\";\nimport { bem } from \"../utils/bem.js\";\nimport {\n type ListItemAddonPosition,\n type ListItemAddonType,\n type ListItemHeight,\n} from \"./types.js\";\n\nconst styles = bem(\"rmd-list-item\");\n\n/** @since 6.0.0 */\nexport interface ListItemClassNameOptions {\n className?: string;\n /**\n * @see {@link ListItemHeight}\n * @defaultValue `\"auto\"`\n */\n height?: ListItemHeight;\n\n /**\n * @defaultValue `false`\n */\n multiline?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * Note: This does nothing if the `disabled` prop is not enabled.\n *\n * @defaultValue `false`\n * @since 2.4.3\n */\n disabledOpacity?: boolean;\n\n /**\n * Set this to `false` if the list item should not gain the interaction\n * states: hover, focus, press, etc. This is kind of like being disabled\n * without the disabled styles being applied.\n *\n * @defaultValue `true`\n */\n clickable?: boolean;\n}\n\n/** @since 6.0.0 */\nexport interface InternalListItemClassNameOptions\n extends ListItemClassNameOptions {\n /**\n * @defaultValue `false`\n */\n link?: boolean;\n\n /**\n * This is prop is used internally when integrating with the\n * {@link useElementInteraction} hook.\n */\n pressedClassName?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport function listItem(\n options: InternalListItemClassNameOptions = {}\n): string {\n const {\n className,\n link = false,\n height = \"auto\",\n clickable = true,\n multiline = false,\n disabled = false,\n disabledOpacity = false,\n pressedClassName,\n } = options;\n\n return cnb(\n styles({\n link,\n [height]: height !== \"auto\",\n multiline,\n \"disabled-color\": disabled && !disabledOpacity,\n \"disabled-opacity\": disabled && disabledOpacity,\n }),\n cssUtils({ surface: clickable }),\n pressedClassName,\n className\n );\n}\n\n/** @since 6.0.0 */\nexport interface ListItemTextClassNameOptions {\n className?: string;\n /**\n * @defaultValue `false`\n */\n clamped?: boolean;\n\n /**\n * @defaultValue `false`\n */\n secondary?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function listItemText(\n options: ListItemTextClassNameOptions = {}\n): string {\n const { className, secondary = false, clamped = false } = options;\n\n return cnb(\n styles(\"text\", {\n clamped: secondary && clamped,\n secondary,\n }),\n className\n );\n}\n\n/** @since 6.0.0 */\nexport interface ListItemAddonClassNameOptions {\n className?: string;\n\n /**\n * The addon type that is used to adjust the spacing styles.\n *\n * @defaultValue `\"icon\"`\n */\n type?: ListItemAddonType;\n\n /**\n * The vertical position to use for the addon.\n *\n * @defaultValue `\"middle\"`\n */\n position?: ListItemAddonPosition;\n\n /**\n * Boolean if the addon should appear after the `children`.\n *\n * @defaultValue `false`\n */\n addonAfter?: boolean;\n\n /**\n * The media items are centered by default using:\n * ```scss\n * align-items: center;\n * display: flex;\n * justify-content: center;\n * ```\n *\n * When this is set to `true`, the flex styles will not be applied.\n *\n * @defaultValue `false`\n * @since 6.0.0\n */\n disableCenteredMedia?: boolean;\n\n /**\n * Set this to `true` to disable the additional spacing applied to the addons\n * that appear before the `children` and the normal `--rmd-text-icon-spacing`\n * value is used instead.\n *\n * @defaultValue `false`\n */\n disableBeforeSpacing?: boolean;\n}\n\n/**\n *\n * @since 6.0.0\n */\nexport function listItemAddon(\n options: ListItemAddonClassNameOptions = {}\n): string {\n const {\n type = \"icon\",\n position = \"middle\",\n className,\n addonAfter = false,\n disableCenteredMedia = false,\n disableBeforeSpacing = false,\n } = options;\n\n const isMedia = type === \"media\" || type === \"large-media\";\n const isAvatar = type === \"avatar\";\n\n return cnb(\n styles(\"addon\", {\n [position]: position !== \"middle\",\n before: !disableBeforeSpacing && !addonAfter,\n \"avatar-before\": !disableBeforeSpacing && !addonAfter && isAvatar,\n media: isMedia,\n \"media-large\": type === \"large-media\",\n \"media-centered\": isMedia && !disableCenteredMedia,\n }),\n className\n );\n}\n"],"names":["cnb","cssUtils","bem","styles","listItem","options","className","link","height","clickable","multiline","disabled","disabledOpacity","pressedClassName","surface","listItemText","secondary","clamped","listItemAddon","type","position","addonAfter","disableCenteredMedia","disableBeforeSpacing","isMedia","isAvatar","before","media"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,GAAG,QAAQ,kBAAkB;AAOtC,MAAMC,SAASD,IAAI;AAsDnB;;CAEC,GACD,OAAO,SAASE,SACdC,UAA4C,CAAC,CAAC;IAE9C,MAAM,EACJC,SAAS,EACTC,OAAO,KAAK,EACZC,SAAS,MAAM,EACfC,YAAY,IAAI,EAChBC,YAAY,KAAK,EACjBC,WAAW,KAAK,EAChBC,kBAAkB,KAAK,EACvBC,gBAAgB,EACjB,GAAGR;IAEJ,OAAOL,IACLG,OAAO;QACLI;QACA,CAACC,OAAO,EAAEA,WAAW;QACrBE;QACA,kBAAkBC,YAAY,CAACC;QAC/B,oBAAoBD,YAAYC;IAClC,IACAX,SAAS;QAAEa,SAASL;IAAU,IAC9BI,kBACAP;AAEJ;AAgBA;;CAEC,GACD,OAAO,SAASS,aACdV,UAAwC,CAAC,CAAC;IAE1C,MAAM,EAAEC,SAAS,EAAEU,YAAY,KAAK,EAAEC,UAAU,KAAK,EAAE,GAAGZ;IAE1D,OAAOL,IACLG,OAAO,QAAQ;QACbc,SAASD,aAAaC;QACtBD;IACF,IACAV;AAEJ;AAoDA;;;CAGC,GACD,OAAO,SAASY,cACdb,UAAyC,CAAC,CAAC;IAE3C,MAAM,EACJc,OAAO,MAAM,EACbC,WAAW,QAAQ,EACnBd,SAAS,EACTe,aAAa,KAAK,EAClBC,uBAAuB,KAAK,EAC5BC,uBAAuB,KAAK,EAC7B,GAAGlB;IAEJ,MAAMmB,UAAUL,SAAS,WAAWA,SAAS;IAC7C,MAAMM,WAAWN,SAAS;IAE1B,OAAOnB,IACLG,OAAO,SAAS;QACd,CAACiB,SAAS,EAAEA,aAAa;QACzBM,QAAQ,CAACH,wBAAwB,CAACF;QAClC,iBAAiB,CAACE,wBAAwB,CAACF,cAAcI;QACzDE,OAAOH;QACP,eAAeL,SAAS;QACxB,kBAAkBK,WAAW,CAACF;IAChC,IACAhB;AAEJ"}
1
+ {"version":3,"sources":["../../src/list/listItemStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\nimport { cssUtils } from \"../cssUtils.js\";\nimport { bem } from \"../utils/bem.js\";\nimport {\n type ListItemAddonPosition,\n type ListItemAddonType,\n type ListItemHeight,\n} from \"./types.js\";\n\nconst styles = bem(\"rmd-list-item\");\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-list-item-keyline\"?: string | number;\n \"--rmd-list-item-padding-h\"?: string | number;\n \"--rmd-list-item-padding-v\"?: string | number;\n \"--rmd-list-item-height\"?: string | number;\n \"--rmd-list-item-medium-height\"?: string | number;\n \"--rmd-list-item-large-height\"?: string | number;\n \"--rmd-list-item-extra-large-height\"?: string | number;\n \"--rmd-list-item-multiline-height\"?: string | number;\n \"--rmd-list-item-media-size\"?: string | number;\n \"--rmd-list-item-media-spacing\"?: string | number;\n \"--rmd-list-item-text-multiline-height\"?: string | number;\n \"--rmd-list-item-multiline-clamp\"?: string | number;\n }\n}\n\n/** @since 6.3.1 */\nexport interface BaseListItemClassNameOptions {\n className?: string;\n\n /**\n * @see {@link ListItemHeight}\n * @defaultValue `\"auto\"`\n */\n height?: ListItemHeight;\n\n /**\n * @defaultValue `false`\n */\n multiline?: boolean;\n\n /**\n * Note: This does nothing if the `disabled` prop is not enabled.\n *\n * @defaultValue `false`\n * @since 2.4.3\n */\n disabled?: boolean;\n\n /**\n * Note: This does nothing if the `disabled` prop is not enabled.\n *\n * @defaultValue `false`\n * @since 2.4.3\n */\n disabledOpacity?: boolean;\n}\n\n/** @since 6.0.0 */\nexport interface ListItemClassNameOptions extends BaseListItemClassNameOptions {\n /**\n * Set this to `false` if the list item should not gain the interaction\n * states: hover, focus, press, etc. This is kind of like being disabled\n * without the disabled styles being applied.\n *\n * @defaultValue `true`\n */\n clickable?: boolean;\n}\n\n/** @since 6.0.0 */\nexport interface InternalListItemClassNameOptions\n extends ListItemClassNameOptions {\n /**\n * @defaultValue `false`\n */\n link?: boolean;\n\n /**\n * This is prop is used internally when integrating with the\n * {@link useElementInteraction} hook.\n */\n pressedClassName?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport function listItem(\n options: InternalListItemClassNameOptions = {}\n): string {\n const {\n className,\n link = false,\n height = \"auto\",\n clickable = true,\n multiline = false,\n disabled = false,\n disabledOpacity = false,\n pressedClassName,\n } = options;\n\n return cnb(\n styles({\n link,\n [height]: height !== \"auto\",\n multiline,\n \"disabled-color\": disabled && !disabledOpacity,\n \"disabled-opacity\": disabled && disabledOpacity,\n }),\n cssUtils({ surface: clickable }),\n pressedClassName,\n className\n );\n}\n\n/** @since 6.0.0 */\nexport interface ListItemTextClassNameOptions {\n className?: string;\n /**\n * @defaultValue `false`\n */\n clamped?: boolean;\n\n /**\n * @defaultValue `false`\n */\n secondary?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function listItemText(\n options: ListItemTextClassNameOptions = {}\n): string {\n const { className, secondary = false, clamped = false } = options;\n\n return cnb(\n styles(\"text\", {\n clamped: secondary && clamped,\n secondary,\n }),\n className\n );\n}\n\n/** @since 6.0.0 */\nexport interface ListItemAddonClassNameOptions {\n className?: string;\n\n /**\n * The addon type that is used to adjust the spacing styles.\n *\n * @defaultValue `\"icon\"`\n */\n type?: ListItemAddonType;\n\n /**\n * The vertical position to use for the addon.\n *\n * @defaultValue `\"middle\"`\n */\n position?: ListItemAddonPosition;\n\n /**\n * Boolean if the addon should appear after the `children`.\n *\n * @defaultValue `false`\n */\n addonAfter?: boolean;\n\n /**\n * The media items are centered by default using:\n * ```scss\n * align-items: center;\n * display: flex;\n * justify-content: center;\n * ```\n *\n * When this is set to `true`, the flex styles will not be applied.\n *\n * @defaultValue `false`\n * @since 6.0.0\n */\n disableCenteredMedia?: boolean;\n\n /**\n * Set this to `true` to disable the additional spacing applied to the addons\n * that appear before the `children` and the normal `--rmd-text-icon-spacing`\n * value is used instead.\n *\n * @defaultValue `false`\n */\n disableBeforeSpacing?: boolean;\n}\n\n/**\n *\n * @since 6.0.0\n */\nexport function listItemAddon(\n options: ListItemAddonClassNameOptions = {}\n): string {\n const {\n type = \"icon\",\n position = \"middle\",\n className,\n addonAfter = false,\n disableCenteredMedia = false,\n disableBeforeSpacing = false,\n } = options;\n\n const isMedia = type === \"media\" || type === \"large-media\";\n const isAvatar = type === \"avatar\";\n\n return cnb(\n styles(\"addon\", {\n [position]: position !== \"middle\",\n before: !disableBeforeSpacing && !addonAfter,\n \"avatar-before\": !disableBeforeSpacing && !addonAfter && isAvatar,\n media: isMedia,\n \"media-large\": type === \"large-media\",\n \"media-centered\": isMedia && !disableCenteredMedia,\n }),\n className\n );\n}\n"],"names":["cnb","cssUtils","bem","styles","listItem","options","className","link","height","clickable","multiline","disabled","disabledOpacity","pressedClassName","surface","listItemText","secondary","clamped","listItemAddon","type","position","addonAfter","disableCenteredMedia","disableBeforeSpacing","isMedia","isAvatar","before","media"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,GAAG,QAAQ,kBAAkB;AAOtC,MAAMC,SAASD,IAAI;AA8EnB;;CAEC,GACD,OAAO,SAASE,SACdC,UAA4C,CAAC,CAAC;IAE9C,MAAM,EACJC,SAAS,EACTC,OAAO,KAAK,EACZC,SAAS,MAAM,EACfC,YAAY,IAAI,EAChBC,YAAY,KAAK,EACjBC,WAAW,KAAK,EAChBC,kBAAkB,KAAK,EACvBC,gBAAgB,EACjB,GAAGR;IAEJ,OAAOL,IACLG,OAAO;QACLI;QACA,CAACC,OAAO,EAAEA,WAAW;QACrBE;QACA,kBAAkBC,YAAY,CAACC;QAC/B,oBAAoBD,YAAYC;IAClC,IACAX,SAAS;QAAEa,SAASL;IAAU,IAC9BI,kBACAP;AAEJ;AAgBA;;CAEC,GACD,OAAO,SAASS,aACdV,UAAwC,CAAC,CAAC;IAE1C,MAAM,EAAEC,SAAS,EAAEU,YAAY,KAAK,EAAEC,UAAU,KAAK,EAAE,GAAGZ;IAE1D,OAAOL,IACLG,OAAO,QAAQ;QACbc,SAASD,aAAaC;QACtBD;IACF,IACAV;AAEJ;AAoDA;;;CAGC,GACD,OAAO,SAASY,cACdb,UAAyC,CAAC,CAAC;IAE3C,MAAM,EACJc,OAAO,MAAM,EACbC,WAAW,QAAQ,EACnBd,SAAS,EACTe,aAAa,KAAK,EAClBC,uBAAuB,KAAK,EAC5BC,uBAAuB,KAAK,EAC7B,GAAGlB;IAEJ,MAAMmB,UAAUL,SAAS,WAAWA,SAAS;IAC7C,MAAMM,WAAWN,SAAS;IAE1B,OAAOnB,IACLG,OAAO,SAAS;QACd,CAACiB,SAAS,EAAEA,aAAa;QACzBM,QAAQ,CAACH,wBAAwB,CAACF;QAClC,iBAAiB,CAACE,wBAAwB,CAACF,cAAcI;QACzDE,OAAOH;QACP,eAAeL,SAAS;QACxB,kBAAkBK,WAAW,CAACF;IAChC,IACAhB;AAEJ"}
@@ -1,9 +1,24 @@
1
+ declare module "react" {
2
+ interface CSSProperties {
3
+ "--rmd-list-padding-h"?: string | number;
4
+ "--rmd-list-padding-v"?: string | number;
5
+ }
6
+ }
1
7
  /** @since 6.0.0 */
2
8
  export interface ListClassNameOptions {
3
9
  className?: string;
4
- /** @defaultValue `false` */
10
+ /**
11
+ * Set to `true` to decrease the amount of padding and font size within the
12
+ * list.
13
+ *
14
+ * @defaultValue `false`
15
+ */
5
16
  dense?: boolean;
6
- /** @defaultValue `false` */
17
+ /**
18
+ * Set this to `true` to render horizontally instead of vertically.
19
+ *
20
+ * @defaultValue `false`
21
+ */
7
22
  horizontal?: boolean;
8
23
  }
9
24
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/list/listStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-list\");\n\n/** @since 6.0.0 */\nexport interface ListClassNameOptions {\n className?: string;\n\n /** @defaultValue `false` */\n dense?: boolean;\n\n /** @defaultValue `false` */\n horizontal?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function list(options: ListClassNameOptions = {}): string {\n const { dense = false, horizontal = false, className } = options;\n\n return cnb(styles({ dense, horizontal }), className);\n}\n"],"names":["cnb","bem","styles","list","options","dense","horizontal","className"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAanB;;CAEC,GACD,OAAO,SAASE,KAAKC,UAAgC,CAAC,CAAC;IACrD,MAAM,EAAEC,QAAQ,KAAK,EAAEC,aAAa,KAAK,EAAEC,SAAS,EAAE,GAAGH;IAEzD,OAAOJ,IAAIE,OAAO;QAAEG;QAAOC;IAAW,IAAIC;AAC5C"}
1
+ {"version":3,"sources":["../../src/list/listStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-list\");\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-list-padding-h\"?: string | number;\n \"--rmd-list-padding-v\"?: string | number;\n }\n}\n\n/** @since 6.0.0 */\nexport interface ListClassNameOptions {\n className?: string;\n\n /**\n * Set to `true` to decrease the amount of padding and font size within the\n * list.\n *\n * @defaultValue `false`\n */\n dense?: boolean;\n\n /**\n * Set this to `true` to render horizontally instead of vertically.\n *\n * @defaultValue `false`\n */\n horizontal?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function list(options: ListClassNameOptions = {}): string {\n const { dense = false, horizontal = false, className } = options;\n\n return cnb(styles({ dense, horizontal }), className);\n}\n"],"names":["cnb","bem","styles","list","options","dense","horizontal","className"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AA6BnB;;CAEC,GACD,OAAO,SAASE,KAAKC,UAAgC,CAAC,CAAC;IACrD,MAAM,EAAEC,QAAQ,KAAK,EAAEC,aAAa,KAAK,EAAEC,SAAS,EAAE,GAAGH;IAEzD,OAAOJ,IAAIE,OAAO;QAAEG;QAAOC;IAAW,IAAIC;AAC5C"}
@@ -1 +1 @@
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 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\">>;\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 >;\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 * @see {@link https://react-md.dev/components/menu | Menu Demos}\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,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,sBAAsB,QAAQ,gDAAgD;AAEvF,SAASC,UAAU,QAAQ,sCAAsC;AAEjE,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,SAEEC,mBAAmB,QACd,wCAAwC;AAC/C,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAEEC,kBAAkB,QACb,sCAAsC;AAE7C,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,yBAAyB,QAAQ,kCAAkC;AAC5E,SAEEC,yBAAyB,EAEzBC,oBAAoB,QACf,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;AA8MA;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAMC,qBAAOnB,WAClB,SAASmB,KAAKC,KAAK,EAAEC,OAAO;IAC1B,MAAM,EACJC,IAAIC,MAAM,EACVC,OAAOC,SAAS,EAChBC,OAAO,MAAM,EACbC,QAAQ,EACRC,YAAYC,WAAW,EACvBC,aAAaC,YAAY,EACzBC,aAAaC,YAAY,EACzBC,eAAeC,cAAc,EAC7BC,eAAeC,cAAc,EAC7BC,mBAAmBC,kBAAkB,EACrCC,UAAU,EACVC,UAAU,EACVC,cAAc,EACdC,SAAS,EACTC,aAAa,EACbC,mBAAmB,KAAK,EACxB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kBA;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 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\n// NOTE: The augmentation is in this file since no types are imported from the\n// `styles` file at this time\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\">>;\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 >;\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 * @see {@link https://react-md.dev/components/menu | Menu Demos}\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,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,sBAAsB,QAAQ,gDAAgD;AAEvF,SAASC,UAAU,QAAQ,sCAAsC;AAEjE,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,SAEEC,mBAAmB,QACd,wCAAwC;AAC/C,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAEEC,kBAAkB,QACb,sCAAsC;AAE7C,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SA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A;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"}
@@ -49,6 +49,7 @@ import { MenuBarProvider, useMenuBarProvider } from "./useMenuBarProvider.js";
49
49
  });
50
50
  const { activeId, enableHoverMode } = menuBarContext;
51
51
  const { movementProps, movementContext } = useKeyboardMovementProvider({
52
+ ref,
52
53
  onClick,
53
54
  onFocus,
54
55
  onKeyDown,
@@ -70,7 +71,6 @@ import { MenuBarProvider, useMenuBarProvider } from "./useMenuBarProvider.js";
70
71
  children: /*#__PURE__*/ _jsx(List, {
71
72
  ...remaining,
72
73
  ...movementProps,
73
- ref: ref,
74
74
  role: "menubar",
75
75
  horizontal: horizontal,
76
76
  children: children
@@ -1 +1 @@
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 } from \"@react-md/core/menu/DropdownMenu\";\n * import { MenuBar } from \"@react-md/core/menu/MenuBar\";\n * import { MenuItem } from \"@react-md/core/menu/MenuItem\";\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 * @see {@link https://react-md.dev/components/menu | Menu Demos}\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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCC,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 } from \"@react-md/core/menu/DropdownMenu\";\n * import { MenuBar } from \"@react-md/core/menu/MenuBar\";\n * import { MenuItem } from \"@react-md/core/menu/MenuItem\";\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 * @see {@link https://react-md.dev/components/menu | Menu Demos}\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 ref,\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 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCC,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;QACrEK;QACAC;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;gBACjBW,MAAK;gBACLpB,YAAYA;0BAEXE;;;;AAKX,GACA"}
@@ -3,14 +3,13 @@ import { type TextFieldProps } from "../form/TextField.js";
3
3
  import { type PropsWithRef } from "../types.js";
4
4
  /**
5
5
  * @since 5.0.0
6
+ * @since 6.3.0 Removed the invalid `stretch` prop
6
7
  */
7
8
  export interface MenuItemTextFieldProps extends TextFieldProps {
8
9
  /**
9
10
  * Any additional props or a `ref` to apply to the surrounding `<li>` element.
10
11
  */
11
12
  liProps?: PropsWithRef<HTMLAttributes<HTMLLIElement>>;
12
- /** @defaultValue `true` */
13
- stretch?: boolean;
14
13
  }
15
14
  /**
16
15
  * **Client Component**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/MenuItemTextField.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { TextField, type TextFieldProps } from \"../form/TextField.js\";\nimport { type PropsWithRef } from \"../types.js\";\n\n/**\n * @since 5.0.0\n */\nexport interface MenuItemTextFieldProps extends TextFieldProps {\n /**\n * Any additional props or a `ref` to apply to the surrounding `<li>` element.\n */\n liProps?: PropsWithRef<HTMLAttributes<HTMLLIElement>>;\n\n /** @defaultValue `true` */\n stretch?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * This is a wrapper for the `TextField` component that can be used within\n * `Menu`s by updating the `onKeyDown` and `onClick` behavior.\n *\n * Note: This is **not** the `TextFieldWithMessage` since the message part is\n * hard to style nicely within menus. You'd most likely want to use another menu\n * for displaying errors.\n *\n * @see {@link https://react-md.dev/components/menu#menuitemtextfield-example | DropdownMenu Demos}\n * @since 5.0.0\n */\nexport const MenuItemTextField = forwardRef<\n HTMLInputElement,\n MenuItemTextFieldProps\n>(function MenuItemTextField(props, ref) {\n const { liProps, onKeyDown, ...remaining } = props;\n return (\n <li\n role=\"none\"\n {...liProps}\n onClick={(event) => {\n liProps?.onClick?.(event);\n event.stopPropagation();\n }}\n className={cnb(\"rmd-list-item rmd-menu-item\", liProps?.className)}\n >\n <TextField\n {...remaining}\n ref={ref}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n switch (event.key) {\n case \"Tab\":\n case \"Escape\":\n case \" \":\n // do default behavior\n break;\n default:\n if (event.key.length === 1 || event.currentTarget.value) {\n event.stopPropagation();\n }\n }\n }}\n />\n </li>\n );\n});\n"],"names":["cnb","forwardRef","TextField","MenuItemTextField","props","ref","liProps","onKeyDown","remaining","li","role","onClick","event","stopPropagation","className","key","length","currentTarget","value"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAA8BC,UAAU,QAAQ,QAAQ;AAExD,SAASC,SAAS,QAA6B,uBAAuB;AAgBtE;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMC,kCAAoBF,WAG/B,SAASE,kBAAkBC,KAAK,EAAEC,GAAG;IACrC,MAAM,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGC,WAAW,GAAGJ;IAC7C,qBACE,KAACK;QACCC,MAAK;QACJ,GAAGJ,OAAO;QACXK,SAAS,CAACC;YACRN,SAASK,UAAUC;YACnBA,MAAMC,eAAe;QACvB;QACAC,WAAWd,IAAI,+BAA+BM,SAASQ;kBAEvD,cAAA,KAACZ;YACE,GAAGM,SAAS;YACbH,KAAKA;YACLE,WAAW,CAACK;gBACVL,YAAYK;gBACZ,OAAQA,MAAMG,GAAG;oBACf,KAAK;oBACL,KAAK;oBACL,KAAK;wBAEH;oBACF;wBACE,IAAIH,MAAMG,GAAG,CAACC,MAAM,KAAK,KAAKJ,MAAMK,aAAa,CAACC,KAAK,EAAE;4BACvDN,MAAMC,eAAe;wBACvB;gBACJ;YACF;;;AAIR,GAAG"}
1
+ {"version":3,"sources":["../../src/menu/MenuItemTextField.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { TextField, type TextFieldProps } from \"../form/TextField.js\";\nimport { type PropsWithRef } from \"../types.js\";\n\n/**\n * @since 5.0.0\n * @since 6.3.0 Removed the invalid `stretch` prop\n */\nexport interface MenuItemTextFieldProps extends TextFieldProps {\n /**\n * Any additional props or a `ref` to apply to the surrounding `<li>` element.\n */\n liProps?: PropsWithRef<HTMLAttributes<HTMLLIElement>>;\n}\n\n/**\n * **Client Component**\n *\n * This is a wrapper for the `TextField` component that can be used within\n * `Menu`s by updating the `onKeyDown` and `onClick` behavior.\n *\n * Note: This is **not** the `TextFieldWithMessage` since the message part is\n * hard to style nicely within menus. You'd most likely want to use another menu\n * for displaying errors.\n *\n * @see {@link https://react-md.dev/components/menu#menuitemtextfield-example | DropdownMenu Demos}\n * @since 5.0.0\n */\nexport const MenuItemTextField = forwardRef<\n HTMLInputElement,\n MenuItemTextFieldProps\n>(function MenuItemTextField(props, ref) {\n const { liProps, onKeyDown, ...remaining } = props;\n return (\n <li\n role=\"none\"\n {...liProps}\n onClick={(event) => {\n liProps?.onClick?.(event);\n event.stopPropagation();\n }}\n className={cnb(\"rmd-list-item rmd-menu-item\", liProps?.className)}\n >\n <TextField\n {...remaining}\n ref={ref}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n switch (event.key) {\n case \"Tab\":\n case \"Escape\":\n case \" \":\n // do default behavior\n break;\n default:\n if (event.key.length === 1 || event.currentTarget.value) {\n event.stopPropagation();\n }\n }\n }}\n />\n </li>\n );\n});\n"],"names":["cnb","forwardRef","TextField","MenuItemTextField","props","ref","liProps","onKeyDown","remaining","li","role","onClick","event","stopPropagation","className","key","length","currentTarget","value"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAA8BC,UAAU,QAAQ,QAAQ;AAExD,SAASC,SAAS,QAA6B,uBAAuB;AActE;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMC,kCAAoBF,WAG/B,SAASE,kBAAkBC,KAAK,EAAEC,GAAG;IACrC,MAAM,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGC,WAAW,GAAGJ;IAC7C,qBACE,KAACK;QACCC,MAAK;QACJ,GAAGJ,OAAO;QACXK,SAAS,CAACC;YACRN,SAASK,UAAUC;YACnBA,MAAMC,eAAe;QACvB;QACAC,WAAWd,IAAI,+BAA+BM,SAASQ;kBAEvD,cAAA,KAACZ;YACE,GAAGM,SAAS;YACbH,KAAKA;YACLE,WAAW,CAACK;gBACVL,YAAYK;gBACZ,OAAQA,MAAMG,GAAG;oBACf,KAAK;oBACL,KAAK;oBACL,KAAK;wBAEH;oBACF;wBACE,IAAIH,MAAMG,GAAG,CAACC,MAAM,KAAK,KAAKJ,MAAMK,aAAa,CAACC,KAAK,EAAE;4BACvDN,MAAMC,eAAe;wBACvB;gBACJ;YACF;;;AAIR,GAAG"}
@@ -39,6 +39,7 @@ const noop = ()=>{
39
39
  defaultActiveId: id
40
40
  });
41
41
  const { movementProps, movementContext } = useKeyboardMovementProvider({
42
+ ref,
42
43
  onClick,
43
44
  onFocus (event) {
44
45
  onFocus(event);
@@ -67,10 +68,10 @@ const noop = ()=>{
67
68
  ...isListbox ? {
68
69
  onClick,
69
70
  onFocus,
70
- onKeyDown
71
+ onKeyDown,
72
+ ref
71
73
  } : movementProps,
72
74
  id: id,
73
- ref: ref,
74
75
  role: role,
75
76
  className: menu({
76
77
  className,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/MenuWidget.tsx"],"sourcesContent":["\"use client\";\n\nimport { type HTMLAttributes, forwardRef, useRef, useState } from \"react\";\n\nimport { List } from \"../list/List.js\";\nimport { type GetDefaultFocusedIndex } from \"../movement/types.js\";\nimport { useKeyboardMovementProvider } from \"../movement/useKeyboardMovementProvider.js\";\nimport { type NonNullMutableRef } from \"../types.js\";\nimport { type MenuListConvenienceProps } from \"./Menu.js\";\nimport { MenuWidgetKeyboardProvider } from \"./MenuWidgetKeyboardProvider.js\";\nimport { menu } from \"./styles.js\";\nimport {\n MenuBarProvider,\n useMenuBarContext,\n useMenuBarProvider,\n} from \"./useMenuBarProvider.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @internal\n */\nexport interface MenuWidgetProps\n extends HTMLAttributes<HTMLDivElement>,\n MenuListConvenienceProps {\n isSheet: boolean;\n horizontal: boolean;\n disableElevation?: boolean;\n cancelUnmountFocus: NonNullMutableRef<boolean>;\n getDefaultFocusedIndex?: GetDefaultFocusedIndex;\n}\n\n/**\n * **Client Component**\n *\n * This component was added to support the listbox role and the `useId()` hook.\n * If the `temporary` prop is set, the `MenuItem`'s ids will not be the same the\n * next time the menu opens, so the aria-activedescendant will point to a\n * non-existing id\n *\n * @internal\n */\nexport const MenuWidget = forwardRef<HTMLDivElement, MenuWidgetProps>(\n function MenuWidget(props, ref) {\n const {\n id,\n role = \"menu\",\n className,\n listStyle,\n listClassName,\n listProps,\n children,\n onClick,\n onBlur = noop,\n onFocus = noop,\n onKeyDown = noop,\n tabIndex = -1,\n isSheet,\n horizontal,\n disableElevation,\n cancelUnmountFocus,\n getDefaultFocusedIndex,\n ...remaining\n } = props;\n const isListbox = role === \"listbox\";\n const { menubar } = useMenuBarContext();\n\n // Since there is the possibility of other tab focusable elements within the\n // sheet and the menu items are programmatically focused, the menu's\n // tabIndex needs to be set to `-1` while one of the child menu items are\n // focused. This allows Shift+Tab correctly focuses the previous focusable\n // element within the sheet. Since `onFocus` and `onBlur` will be bubbled up\n // to the menu widget each time a new MenuItem is focused, only disable the\n // focused state if the blur event is fired without another focus event\n // within an animation frame.\n const [sheetMenuFocused, setSheetMenuFocused] = useState(false);\n const sheetBlurredFame = useRef(0);\n const menuBarContext = useMenuBarProvider({\n root: false,\n menubar,\n hoverTimeout: menubar ? 0 : undefined,\n defaultActiveId: id,\n });\n const { movementProps, movementContext } = useKeyboardMovementProvider({\n onClick,\n onFocus(event) {\n onFocus(event);\n\n if (!isSheet) {\n return;\n }\n\n window.cancelAnimationFrame(sheetBlurredFame.current);\n setSheetMenuFocused(true);\n },\n onKeyDown,\n horizontal,\n loopable: true,\n searchable: true,\n programmatic: true,\n includeDisabled: true,\n getDefaultFocusedIndex,\n });\n\n return (\n <MenuWidgetKeyboardProvider disabled={isListbox} value={movementContext}>\n <MenuBarProvider value={menuBarContext}>\n <div\n aria-orientation={horizontal ? \"horizontal\" : undefined}\n {...remaining}\n {...(isListbox ? { onClick, onFocus, onKeyDown } : movementProps)}\n id={id}\n ref={ref}\n role={role}\n className={menu({\n className,\n elevated: !disableElevation && !isSheet,\n horizontal,\n })}\n tabIndex={isSheet && !sheetMenuFocused ? 0 : tabIndex}\n onBlur={(event) => {\n onBlur(event);\n if (!isSheet) {\n return;\n }\n\n sheetBlurredFame.current = window.requestAnimationFrame(() => {\n setSheetMenuFocused(false);\n });\n }}\n >\n <List\n {...listProps}\n style={listStyle ?? listProps?.style}\n className={listClassName || listProps?.className}\n horizontal={horizontal}\n onClick={(event) => {\n listProps?.onClick?.(event);\n\n // this makes it so you can click on the menu/list without\n // closing the menu\n if (event.target === event.currentTarget) {\n event.stopPropagation();\n }\n\n // This might be a test only workaround since clicking links move focus\n // somewhere else\n if (event.target instanceof HTMLElement) {\n cancelUnmountFocus.current = event.currentTarget.contains(\n event.target.closest(\"a\")\n );\n }\n }}\n >\n {children}\n </List>\n </div>\n </MenuBarProvider>\n </MenuWidgetKeyboardProvider>\n );\n }\n);\n"],"names":["forwardRef","useRef","useState","List","useKeyboardMovementProvider","MenuWidgetKeyboardProvider","menu","MenuBarProvider","useMenuBarContext","useMenuBarProvider","noop","MenuWidget","props","ref","id","role","className","listStyle","listClassName","listProps","children","onClick","onBlur","onFocus","onKeyDown","tabIndex","isSheet","horizontal","disableElevation","cancelUnmountFocus","getDefaultFocusedIndex","remaining","isListbox","menubar","sheetMenuFocused","setSheetMenuFocused","sheetBlurredFame","menuBarContext","root","hoverTimeout","undefined","defaultActiveId","movementProps","movementContext","event","window","cancelAnimationFrame","current","loopable","searchable","programmatic","includeDisabled","disabled","value","div","aria-orientation","elevated","requestAnimationFrame","style","target","currentTarget","stopPropagation","HTMLElement","contains","closest"],"mappings":"AAAA;;AAEA,SAA8BA,UAAU,EAAEC,MAAM,EAAEC,QAAQ,QAAQ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ACAG;QACAqB,UAAU;QACVC,YAAY;QACZC,cAAc;QACdC,iBAAiB;QACjBrB;IACF;IAEA,qBACE,KAACzB;QAA2B+C,UAAUpB;QAAWqB,OAAOV;kBACtD,cAAA,KAACpC;YAAgB8C,OAAOhB;sBACtB,cAAA,KAACiB;gBACCC,oBAAkB5B,aAAa,eAAea;gBAC7C,GAAGT,SAAS;gBACZ,GAAIC,YAAY;oBAAEX;oBAASE;oBAASC;gBAAU,IAAIkB,aAAa;gBAChE5B,IAAIA;gBACJD,KAAKA;gBACLE,MAAMA;gBACNC,WAAWV,KAAK;oBACdU;oBACAwC,UAAU,CAAC5B,oBAAoB,CAACF;oBAChCC;gBACF;gBACAF,UAAUC,WAAW,CAACQ,mBAAmB,IAAIT;gBAC7CH,QAAQ,CAACsB;oBACPtB,OAAOsB;oBACP,IAAI,CAAClB,SAAS;wBACZ;oBACF;oBAEAU,iBAAiBW,OAAO,GAAGF,OAAOY,qBAAqB,CAAC;wBACtDtB,oBAAoB;oBACtB;gBACF;0BAEA,cAAA,KAAChC;oBACE,GAAGgB,SAAS;oBACbuC,OAAOzC,aAAaE,WAAWuC;oBAC/B1C,WAAWE,iBAAiBC,WAAWH;oBACvCW,YAAYA;oBACZN,SAAS,CAACuB;wBACRzB,WAAWE,UAAUuB;wBAErB,0DAA0D;wBAC1D,mBAAmB;wBACnB,IAAIA,MAAMe,MAAM,KAAKf,MAAMgB,aAAa,EAAE;4BACxChB,MAAMiB,eAAe;wBACvB;wBAEA,uEAAuE;wBACvE,iBAAiB;wBACjB,IAAIjB,MAAMe,MAAM,YAAYG,aAAa;4BACvCjC,mBAAmBkB,OAAO,GAAGH,MAAMgB,aAAa,CAACG,QAAQ,CACvDnB,MAAMe,MAAM,CAACK,OAAO,CAAC;wBAEzB;oBACF;8BAEC5C;;;;;AAMb,GACA"}
1
+ {"version":3,"sources":["../../src/menu/MenuWidget.tsx"],"sourcesContent":["\"use client\";\n\nimport { type HTMLAttributes, forwardRef, useRef, useState } from \"react\";\n\nimport { List } from \"../list/List.js\";\nimport { type GetDefaultFocusedIndex } from \"../movement/types.js\";\nimport { useKeyboardMovementProvider } from \"../movement/useKeyboardMovementProvider.js\";\nimport { type NonNullMutableRef } from \"../types.js\";\nimport { type MenuListConvenienceProps } from \"./Menu.js\";\nimport { MenuWidgetKeyboardProvider } from \"./MenuWidgetKeyboardProvider.js\";\nimport { menu } from \"./styles.js\";\nimport {\n MenuBarProvider,\n useMenuBarContext,\n useMenuBarProvider,\n} from \"./useMenuBarProvider.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @internal\n */\nexport interface MenuWidgetProps\n extends HTMLAttributes<HTMLDivElement>,\n MenuListConvenienceProps {\n isSheet: boolean;\n horizontal: boolean;\n disableElevation?: boolean;\n cancelUnmountFocus: NonNullMutableRef<boolean>;\n getDefaultFocusedIndex?: GetDefaultFocusedIndex;\n}\n\n/**\n * **Client Component**\n *\n * This component was added to support the listbox role and the `useId()` hook.\n * If the `temporary` prop is set, the `MenuItem`'s ids will not be the same the\n * next time the menu opens, so the aria-activedescendant will point to a\n * non-existing id\n *\n * @internal\n */\nexport const MenuWidget = forwardRef<HTMLDivElement, MenuWidgetProps>(\n function MenuWidget(props, ref) {\n const {\n id,\n role = \"menu\",\n className,\n listStyle,\n listClassName,\n listProps,\n children,\n onClick,\n onBlur = noop,\n onFocus = noop,\n onKeyDown = noop,\n tabIndex = -1,\n isSheet,\n horizontal,\n disableElevation,\n cancelUnmountFocus,\n getDefaultFocusedIndex,\n ...remaining\n } = props;\n const isListbox = role === \"listbox\";\n const { menubar } = useMenuBarContext();\n\n // Since there is the possibility of other tab focusable elements within the\n // sheet and the menu items are programmatically focused, the menu's\n // tabIndex needs to be set to `-1` while one of the child menu items are\n // focused. This allows Shift+Tab correctly focuses the previous focusable\n // element within the sheet. Since `onFocus` and `onBlur` will be bubbled up\n // to the menu widget each time a new MenuItem is focused, only disable the\n // focused state if the blur event is fired without another focus event\n // within an animation frame.\n const [sheetMenuFocused, setSheetMenuFocused] = useState(false);\n const sheetBlurredFame = useRef(0);\n const menuBarContext = useMenuBarProvider({\n root: false,\n menubar,\n hoverTimeout: menubar ? 0 : undefined,\n defaultActiveId: id,\n });\n const { movementProps, movementContext } = useKeyboardMovementProvider({\n ref,\n onClick,\n onFocus(event) {\n onFocus(event);\n\n if (!isSheet) {\n return;\n }\n\n window.cancelAnimationFrame(sheetBlurredFame.current);\n setSheetMenuFocused(true);\n },\n onKeyDown,\n horizontal,\n loopable: true,\n searchable: true,\n programmatic: true,\n includeDisabled: true,\n getDefaultFocusedIndex,\n });\n\n return (\n <MenuWidgetKeyboardProvider disabled={isListbox} value={movementContext}>\n <MenuBarProvider value={menuBarContext}>\n <div\n aria-orientation={horizontal ? \"horizontal\" : undefined}\n {...remaining}\n {...(isListbox\n ? { onClick, onFocus, onKeyDown, ref }\n : movementProps)}\n id={id}\n role={role}\n className={menu({\n className,\n elevated: !disableElevation && !isSheet,\n horizontal,\n })}\n tabIndex={isSheet && !sheetMenuFocused ? 0 : tabIndex}\n onBlur={(event) => {\n onBlur(event);\n if (!isSheet) {\n return;\n }\n\n sheetBlurredFame.current = window.requestAnimationFrame(() => {\n setSheetMenuFocused(false);\n });\n }}\n >\n <List\n {...listProps}\n style={listStyle ?? listProps?.style}\n className={listClassName || listProps?.className}\n horizontal={horizontal}\n onClick={(event) => {\n listProps?.onClick?.(event);\n\n // this makes it so you can click on the menu/list without\n // closing the menu\n if (event.target === event.currentTarget) {\n event.stopPropagation();\n }\n\n // This might be a test only workaround since clicking links move focus\n // somewhere else\n if (event.target instanceof HTMLElement) {\n cancelUnmountFocus.current = event.currentTarget.contains(\n event.target.closest(\"a\")\n );\n }\n }}\n >\n {children}\n </List>\n </div>\n </MenuBarProvider>\n </MenuWidgetKeyboardProvider>\n );\n }\n);\n"],"names":["forwardRef","useRef","useState","List","useKeyboardMovementProvider","MenuWidgetKeyboardProvider","menu","MenuBarProvider","useMenuBarContext","useMenuBarProvider","noop","MenuWidget","props","ref","id","role","className","listStyle","listClassName","listProps","children","onClick","onBlur","onFocus","onKeyDown","tabIndex","isSheet","horizontal","disableElevation","cancelUnmountFocus","getDefaultFocusedIndex","remaining","isListbox","menubar","sheetMenuFocused","setSheetMenuFocused","sheetBlurredFame","menuBarContext","root","hoverTimeout","undefined","defaultActiveId","movementProps","movementContext","event","window","cancelAnimationFrame","current","loopable","searchable","programmatic","includeDisabled","disabled","value","div","aria-orientation","elevated","requestAnimationFrame","style","target","currentTarget","stopPropagation","HTMLElement","contains","closest"],"mappings":"AAAA;;AAEA,SAA8BA,UAAU,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAE1E,SAASC,IAAI,QAAQ,kBAAkB;AAEvC,SAASC,2BAA2B,QAAQ,6CAA6C;AAGzF,SAASC,0BAA0B,QAAQ,kCAAkC;AAC7E,SAASC,IAAI,QAAQ,cAAc;AACnC,SACEC,eAAe,EACfC,iBAAiB,EACjBC,kBAAkB,QACb,0BAA0B;AAEjC,MAAMC,OAAO;AACX,aAAa;AACf;AAeA;;;;;;;;;CASC,GACD,OAAO,MAAMC,2BAAaX,WACxB,SAASW,WAAWC,KAAK,EAAEC,GAAG;IAC5B,MAAM,EACJC,EAAE,EACFC,OAAO,MAAM,EACbC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACPC,SAASZ,IAAI,EACba,UAAUb,IAAI,EACdc,YAAYd,IAAI,EAChBe,WAAW,CAAC,CAAC,EACbC,OAAO,EACPC,UAAU,EACVC,gBAAgB,EAChBC,kBAAkB,EAClBC,sBAAsB,EACtB,GAAGC,WACJ,GAAGnB;IACJ,MAAMoB,YAAYjB,SAAS;IAC3B,MAAM,EAAEkB,OAAO,EAAE,GAAGzB;IAEpB,4EAA4E;IAC5E,oEAAoE;IACpE,yEAAyE;IACzE,0EAA0E;IAC1E,4EAA4E;IAC5E,2EAA2E;IAC3E,uEAAuE;IACvE,6BAA6B;IAC7B,MAA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B,IAAIA,MAAMe,MAAM,KAAKf,MAAMgB,aAAa,EAAE;4BACxChB,MAAMiB,eAAe;wBACvB;wBAEA,uEAAuE;wBACvE,iBAAiB;wBACjB,IAAIjB,MAAMe,MAAM,YAAYG,aAAa;4BACvCjC,mBAAmBkB,OAAO,GAAGH,MAAMgB,aAAa,CAACG,QAAQ,CACvDnB,MAAMe,MAAM,CAACK,OAAO,CAAC;wBAEzB;oBACF;8BAEC5C;;;;;AAMb,GACA"}
@@ -6,11 +6,21 @@ import type { KeyboardMovementConfig } from "./types.js";
6
6
  * @internal
7
7
  */
8
8
  export declare const DEFAULT_KEYBOARD_MOVEMENT: Readonly<KeyboardMovementConfig>;
9
+ /**
10
+ * @since 6.3.0
11
+ * @internal
12
+ */
13
+ export declare const DEFAULT_LTR_KEYBOARD_MOVEMENT_WITHOUT_JUMP: Readonly<KeyboardMovementConfig>;
9
14
  /**
10
15
  * @since 5.1.2
11
16
  * @internal
12
17
  */
13
18
  export declare const DEFAULT_LTR_KEYBOARD_MOVEMENT: Readonly<KeyboardMovementConfig>;
19
+ /**
20
+ * @since 6.3.0
21
+ * @internal
22
+ */
23
+ export declare const DEFAULT_RTL_KEYBOARD_MOVEMENT_WITHOUT_JUMP: Readonly<KeyboardMovementConfig>;
14
24
  /**
15
25
  * @since 5.1.2
16
26
  * @internal