@react-md/core 6.3.3 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (456) hide show
  1. package/dist/CoreProviders.d.ts +1 -0
  2. package/dist/CoreProviders.js.map +1 -1
  3. package/dist/_base.scss +3 -0
  4. package/dist/_core.scss +1 -0
  5. package/dist/_utils.scss +15 -7
  6. package/dist/app-bar/AppBar.js.map +1 -1
  7. package/dist/app-bar/AppBarTitle.js.map +1 -1
  8. package/dist/autocomplete/AutocompleteListboxChildren.js.map +1 -1
  9. package/dist/autocomplete/types.js.map +1 -1
  10. package/dist/autocomplete/utils.js.map +1 -1
  11. package/dist/avatar/Avatar.js.map +1 -1
  12. package/dist/box/_box.scss +20 -1
  13. package/dist/box/styles.d.ts +39 -0
  14. package/dist/box/styles.js +39 -0
  15. package/dist/box/styles.js.map +1 -1
  16. package/dist/button/Button.js.map +1 -1
  17. package/dist/button/FloatingActionButton.js.map +1 -1
  18. package/dist/card/Card.js.map +1 -1
  19. package/dist/card/CardContent.js.map +1 -1
  20. package/dist/card/ClickableCard.js.map +1 -1
  21. package/dist/chip/Chip.js.map +1 -1
  22. package/dist/datetime/NativeDateField.js.map +1 -1
  23. package/dist/datetime/NativeTimeField.js.map +1 -1
  24. package/dist/datetime/useDateField.js.map +1 -1
  25. package/dist/datetime/useTimeField.js.map +1 -1
  26. package/dist/dialog/Dialog.js.map +1 -1
  27. package/dist/dialog/DialogContainer.js.map +1 -1
  28. package/dist/dialog/DialogContent.js.map +1 -1
  29. package/dist/dialog/DialogFooter.js.map +1 -1
  30. package/dist/divider/Divider.js.map +1 -1
  31. package/dist/draggable/useDraggable.js.map +1 -1
  32. package/dist/draggable/utils.js.map +1 -1
  33. package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
  34. package/dist/files/FileInput.js.map +1 -1
  35. package/dist/files/useFileUpload.js.map +1 -1
  36. package/dist/files/validation.js.map +1 -1
  37. package/dist/focus/useFocusContainer.js.map +1 -1
  38. package/dist/form/Fieldset.d.ts +19 -0
  39. package/dist/form/Fieldset.js +22 -2
  40. package/dist/form/Fieldset.js.map +1 -1
  41. package/dist/form/FormMessageContainer.js.map +1 -1
  42. package/dist/form/FormMessageCounter.js.map +1 -1
  43. package/dist/form/InputToggle.js.map +1 -1
  44. package/dist/form/Legend.d.ts +27 -5
  45. package/dist/form/Legend.js +39 -6
  46. package/dist/form/Legend.js.map +1 -1
  47. package/dist/form/Listbox.js.map +1 -1
  48. package/dist/form/ListboxProvider.js.map +1 -1
  49. package/dist/form/NativeSelect.js.map +1 -1
  50. package/dist/form/Password.js.map +1 -1
  51. package/dist/form/ResizingTextAreaWrapper.js.map +1 -1
  52. package/dist/form/Select.js.map +1 -1
  53. package/dist/form/Slider.js.map +1 -1
  54. package/dist/form/SliderContainer.js.map +1 -1
  55. package/dist/form/SliderThumb.js.map +1 -1
  56. package/dist/form/SliderTrack.js.map +1 -1
  57. package/dist/form/SliderValueMarks.js.map +1 -1
  58. package/dist/form/Switch.js.map +1 -1
  59. package/dist/form/TextArea.js.map +1 -1
  60. package/dist/form/TextField.js.map +1 -1
  61. package/dist/form/TextFieldContainer.js.map +1 -1
  62. package/dist/form/_fieldset.scss +7 -0
  63. package/dist/form/_legend.scss +68 -0
  64. package/dist/form/_text-field.scss +39 -4
  65. package/dist/form/fieldsetStyles.d.ts +6 -1
  66. package/dist/form/fieldsetStyles.js +3 -2
  67. package/dist/form/fieldsetStyles.js.map +1 -1
  68. package/dist/form/inputToggleStyles.js.map +1 -1
  69. package/dist/form/labelStyles.d.ts +1 -1
  70. package/dist/form/labelStyles.js +1 -1
  71. package/dist/form/labelStyles.js.map +1 -1
  72. package/dist/form/legendStyles.d.ts +83 -0
  73. package/dist/form/legendStyles.js +25 -0
  74. package/dist/form/legendStyles.js.map +1 -0
  75. package/dist/form/selectUtils.js.map +1 -1
  76. package/dist/form/textFieldContainerStyles.js.map +1 -1
  77. package/dist/form/types.d.ts +28 -6
  78. package/dist/form/types.js.map +1 -1
  79. package/dist/form/useCheckboxGroup.js.map +1 -1
  80. package/dist/form/useCombobox.js.map +1 -1
  81. package/dist/form/useNumberField.js +16 -19
  82. package/dist/form/useNumberField.js.map +1 -1
  83. package/dist/form/useRangeSlider.js.map +1 -1
  84. package/dist/form/useSlider.js.map +1 -1
  85. package/dist/form/useTextField.d.ts +1 -1
  86. package/dist/form/useTextField.js.map +1 -1
  87. package/dist/hoverMode/useHoverMode.js.map +1 -1
  88. package/dist/icon/FontIcon.js.map +1 -1
  89. package/dist/icon/IconRotator.js.map +1 -1
  90. package/dist/icon/MaterialIcon.js.map +1 -1
  91. package/dist/icon/MaterialSymbol.js.map +1 -1
  92. package/dist/icon/SVGIcon.js.map +1 -1
  93. package/dist/icon/config.d.ts +0 -1
  94. package/dist/icon/config.js +10 -7
  95. package/dist/icon/config.js.map +1 -1
  96. package/dist/icon/materialConfig.js.map +1 -1
  97. package/dist/icon/styles.js.map +1 -1
  98. package/dist/interaction/UserInteractionModeProvider.js +6 -4
  99. package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
  100. package/dist/interaction/types.js.map +1 -1
  101. package/dist/interaction/useElementInteraction.js.map +1 -1
  102. package/dist/layout/LayoutAppBar.d.ts +6 -6
  103. package/dist/layout/LayoutAppBar.js +6 -6
  104. package/dist/layout/LayoutAppBar.js.map +1 -1
  105. package/dist/layout/LayoutNav.js.map +1 -1
  106. package/dist/layout/LayoutWindowSplitter.js.map +1 -1
  107. package/dist/layout/Main.js.map +1 -1
  108. package/dist/layout/useExpandableLayout.js +43 -0
  109. package/dist/layout/useExpandableLayout.js.map +1 -1
  110. package/dist/layout/useHorizontalLayoutTransition.js.map +1 -1
  111. package/dist/layout/useLayoutTree.js.map +1 -1
  112. package/dist/layout/useLayoutWindowSplitter.js.map +1 -1
  113. package/dist/layout/useResizableLayout.js.map +1 -1
  114. package/dist/link/Link.js.map +1 -1
  115. package/dist/link/SkipToMainContent.js +19 -21
  116. package/dist/link/SkipToMainContent.js.map +1 -1
  117. package/dist/list/List.js.map +1 -1
  118. package/dist/list/ListItem.js.map +1 -1
  119. package/dist/list/ListItemAddon.js.map +1 -1
  120. package/dist/list/ListItemLink.js.map +1 -1
  121. package/dist/list/ListSubheader.js.map +1 -1
  122. package/dist/list/getListItemHeight.js.map +1 -1
  123. package/dist/list/listItemStyles.js.map +1 -1
  124. package/dist/list/types.js.map +1 -1
  125. package/dist/media-queries/AppSizeProvider.d.ts +2 -0
  126. package/dist/media-queries/AppSizeProvider.js +3 -2
  127. package/dist/media-queries/AppSizeProvider.js.map +1 -1
  128. package/dist/media-queries/appSize.d.ts +3 -0
  129. package/dist/media-queries/appSize.js +3 -1
  130. package/dist/media-queries/appSize.js.map +1 -1
  131. package/dist/media-queries/config.d.ts +11 -0
  132. package/dist/media-queries/config.js +26 -0
  133. package/dist/media-queries/config.js.map +1 -0
  134. package/dist/menu/DropdownMenu.js.map +1 -1
  135. package/dist/menu/Menu.js.map +1 -1
  136. package/dist/menu/MenuItemButton.js.map +1 -1
  137. package/dist/menu/MenuItemFileInput.js.map +1 -1
  138. package/dist/menu/MenuItemInputToggle.js.map +1 -1
  139. package/dist/menu/MenuItemSeparator.js.map +1 -1
  140. package/dist/menu/MenuVisibilityProvider.js.map +1 -1
  141. package/dist/menu/MenuWidget.js.map +1 -1
  142. package/dist/menu/useContextMenu.js.map +1 -1
  143. package/dist/movement/types.d.ts +28 -3
  144. package/dist/movement/types.js.map +1 -1
  145. package/dist/movement/useKeyboardMovementProvider.js +96 -47
  146. package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
  147. package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
  148. package/dist/navigation/NavItem.js.map +1 -1
  149. package/dist/navigation/NavItemButton.js.map +1 -1
  150. package/dist/navigation/NavItemLink.js.map +1 -1
  151. package/dist/navigation/getTableOfContentsHeadings.js.map +1 -1
  152. package/dist/navigation/types.js.map +1 -1
  153. package/dist/overlay/Overlay.js.map +1 -1
  154. package/dist/positioning/createHorizontalPosition.js.map +1 -1
  155. package/dist/positioning/createVerticalPosition.js.map +1 -1
  156. package/dist/positioning/useFixedPositioning.js.map +1 -1
  157. package/dist/progress/CircularProgress.js.map +1 -1
  158. package/dist/progress/LinearProgress.js.map +1 -1
  159. package/dist/progress/linearProgressStyles.js.map +1 -1
  160. package/dist/responsive-item/ResponsiveItem.js.map +1 -1
  161. package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
  162. package/dist/searching/caseInsensitive.js.map +1 -1
  163. package/dist/segmented-button/SegmentedButton.js.map +1 -1
  164. package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -1
  165. package/dist/segmented-button/segmentedButtonStyles.js.map +1 -1
  166. package/dist/sheet/Sheet.js.map +1 -1
  167. package/dist/snackbar/Toast.js.map +1 -1
  168. package/dist/spinbutton/SpinButton.d.ts +16 -0
  169. package/dist/spinbutton/SpinButton.js +55 -0
  170. package/dist/spinbutton/SpinButton.js.map +1 -0
  171. package/dist/spinbutton/SpinButtonGroupProvider.d.ts +17 -0
  172. package/dist/spinbutton/SpinButtonGroupProvider.js +19 -0
  173. package/dist/spinbutton/SpinButtonGroupProvider.js.map +1 -0
  174. package/dist/spinbutton/defaults.d.ts +9 -0
  175. package/dist/spinbutton/defaults.js +25 -0
  176. package/dist/spinbutton/defaults.js.map +1 -0
  177. package/dist/spinbutton/types.d.ts +324 -0
  178. package/dist/spinbutton/types.js +5 -0
  179. package/dist/spinbutton/types.js.map +1 -0
  180. package/dist/spinbutton/useSpinButton.d.ts +5 -0
  181. package/dist/spinbutton/useSpinButton.js +260 -0
  182. package/dist/spinbutton/useSpinButton.js.map +1 -0
  183. package/dist/spinbutton/useSpinButtonGroupProvider.d.ts +27 -0
  184. package/dist/spinbutton/useSpinButtonGroupProvider.js +49 -0
  185. package/dist/spinbutton/useSpinButtonGroupProvider.js.map +1 -0
  186. package/dist/spinbutton/utils/deselectNode.d.ts +5 -0
  187. package/dist/spinbutton/utils/deselectNode.js +17 -0
  188. package/dist/spinbutton/utils/deselectNode.js.map +1 -0
  189. package/dist/spinbutton/utils/resolveInputEvent.d.ts +30 -0
  190. package/dist/spinbutton/utils/resolveInputEvent.js +53 -0
  191. package/dist/spinbutton/utils/resolveInputEvent.js.map +1 -0
  192. package/dist/spinbutton/utils/selectNode.d.ts +5 -0
  193. package/dist/spinbutton/utils/selectNode.js +15 -0
  194. package/dist/spinbutton/utils/selectNode.js.map +1 -0
  195. package/dist/table/StickyTableSection.js.map +1 -1
  196. package/dist/table/Table.js.map +1 -1
  197. package/dist/table/TableBody.js.map +1 -1
  198. package/dist/table/TableCellContent.js.map +1 -1
  199. package/dist/table/TableCheckbox.js.map +1 -1
  200. package/dist/table/TableFooter.js.map +1 -1
  201. package/dist/table/TableHeader.js.map +1 -1
  202. package/dist/table/TableRadio.js.map +1 -1
  203. package/dist/table/TableRow.js.map +1 -1
  204. package/dist/table/useStickyTableSection.js.map +1 -1
  205. package/dist/tabs/SimpleTabPanel.js.map +1 -1
  206. package/dist/tabs/SimpleTabPanels.js.map +1 -1
  207. package/dist/tabs/Tab.js.map +1 -1
  208. package/dist/tabs/TabList.js.map +1 -1
  209. package/dist/tabs/TabListScrollButton.js.map +1 -1
  210. package/dist/tabs/useMaxTabPanelHeight.js.map +1 -1
  211. package/dist/test-utils/data-testid.js.map +1 -1
  212. package/dist/test-utils/mocks/match-media.js +5 -5
  213. package/dist/test-utils/mocks/match-media.js.map +1 -1
  214. package/dist/test-utils/vitest/timers.d.ts +1 -1
  215. package/dist/test-utils/vitest/timers.js +1 -1
  216. package/dist/test-utils/vitest/timers.js.map +1 -1
  217. package/dist/tooltip/Tooltip.js.map +1 -1
  218. package/dist/tooltip/TooltipHoverModeProvider.js.map +1 -1
  219. package/dist/tooltip/useTooltip.js.map +1 -1
  220. package/dist/transition/CSSTransition.js.map +1 -1
  221. package/dist/transition/Collapse.js.map +1 -1
  222. package/dist/transition/CrossFade.js.map +1 -1
  223. package/dist/transition/ScaleTransition.js.map +1 -1
  224. package/dist/transition/SkeletonPlaceholder.js.map +1 -1
  225. package/dist/transition/Slide.js.map +1 -1
  226. package/dist/transition/SlideContainer.js.map +1 -1
  227. package/dist/transition/types.js.map +1 -1
  228. package/dist/transition/useCollapseTransition.js.map +1 -1
  229. package/dist/transition/useCrossFadeTransition.js.map +1 -1
  230. package/dist/transition/useMaxWidthTransition.js.map +1 -1
  231. package/dist/transition/useScaleTransition.js.map +1 -1
  232. package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
  233. package/dist/tree/Tree.js.map +1 -1
  234. package/dist/tree/TreeItem.js.map +1 -1
  235. package/dist/tree/TreeProvider.js.map +1 -1
  236. package/dist/tree/styles.js.map +1 -1
  237. package/dist/tree/types.js.map +1 -1
  238. package/dist/tree/useTreeMovement.js.map +1 -1
  239. package/dist/typography/HighlightTextMark.js.map +1 -1
  240. package/dist/typography/Mark.js.map +1 -1
  241. package/dist/typography/TextContainer.js.map +1 -1
  242. package/dist/typography/Typography.js.map +1 -1
  243. package/dist/typography/_typography.scss +0 -1
  244. package/dist/useElementSize.js.map +1 -1
  245. package/dist/useIntersectionObserver.js.map +1 -1
  246. package/dist/useMutationObserver.js.map +1 -1
  247. package/dist/useWindowSize.js.map +1 -1
  248. package/dist/utils/getNumberOfDigits.d.ts +7 -0
  249. package/dist/utils/getNumberOfDigits.js +11 -0
  250. package/dist/utils/getNumberOfDigits.js.map +1 -0
  251. package/dist/utils/nearest.js +2 -1
  252. package/dist/utils/nearest.js.map +1 -1
  253. package/dist/utils/useDevEffect.d.ts +7 -0
  254. package/dist/utils/useDevEffect.js +8 -0
  255. package/dist/utils/useDevEffect.js.map +1 -0
  256. package/dist/window-splitter/WindowSplitter.js +3 -2
  257. package/dist/window-splitter/WindowSplitter.js.map +1 -1
  258. package/dist/window-splitter/_window-splitter.scss +60 -12
  259. package/dist/window-splitter/styles.d.ts +9 -0
  260. package/dist/window-splitter/styles.js +3 -2
  261. package/dist/window-splitter/styles.js.map +1 -1
  262. package/dist/window-splitter/useWindowSplitter.js.map +1 -1
  263. package/package.json +38 -30
  264. package/src/CoreProviders.tsx +1 -0
  265. package/src/app-bar/AppBar.tsx +1 -2
  266. package/src/app-bar/AppBarTitle.tsx +1 -2
  267. package/src/autocomplete/AutocompleteListboxChildren.tsx +3 -1
  268. package/src/autocomplete/types.ts +24 -19
  269. package/src/autocomplete/utils.ts +9 -6
  270. package/src/avatar/Avatar.tsx +2 -1
  271. package/src/box/styles.ts +39 -0
  272. package/src/button/Button.tsx +2 -1
  273. package/src/button/FloatingActionButton.tsx +2 -1
  274. package/src/card/Card.tsx +2 -1
  275. package/src/card/CardContent.tsx +1 -2
  276. package/src/card/ClickableCard.tsx +1 -2
  277. package/src/chip/Chip.tsx +2 -1
  278. package/src/datetime/NativeDateField.tsx +2 -1
  279. package/src/datetime/NativeTimeField.tsx +2 -1
  280. package/src/datetime/useDateField.ts +13 -8
  281. package/src/datetime/useTimeField.ts +13 -8
  282. package/src/dialog/Dialog.tsx +2 -1
  283. package/src/dialog/DialogContainer.tsx +1 -2
  284. package/src/dialog/DialogContent.tsx +1 -2
  285. package/src/dialog/DialogFooter.tsx +1 -2
  286. package/src/divider/Divider.tsx +1 -2
  287. package/src/draggable/useDraggable.ts +4 -4
  288. package/src/draggable/utils.ts +4 -2
  289. package/src/expansion-panel/ExpansionPanelHeader.tsx +1 -2
  290. package/src/files/FileInput.tsx +2 -1
  291. package/src/files/useFileUpload.ts +6 -6
  292. package/src/files/validation.ts +1 -2
  293. package/src/focus/useFocusContainer.ts +4 -4
  294. package/src/form/Fieldset.tsx +25 -3
  295. package/src/form/FormMessageContainer.tsx +1 -2
  296. package/src/form/FormMessageCounter.tsx +1 -2
  297. package/src/form/InputToggle.tsx +3 -3
  298. package/src/form/Legend.tsx +55 -10
  299. package/src/form/Listbox.tsx +1 -2
  300. package/src/form/ListboxProvider.ts +3 -2
  301. package/src/form/NativeSelect.tsx +2 -1
  302. package/src/form/Password.tsx +4 -2
  303. package/src/form/ResizingTextAreaWrapper.tsx +1 -2
  304. package/src/form/Select.tsx +2 -1
  305. package/src/form/Slider.tsx +2 -1
  306. package/src/form/SliderContainer.tsx +1 -2
  307. package/src/form/SliderThumb.tsx +6 -3
  308. package/src/form/SliderTrack.tsx +2 -1
  309. package/src/form/SliderValueMarks.tsx +1 -2
  310. package/src/form/Switch.tsx +2 -1
  311. package/src/form/TextArea.tsx +1 -2
  312. package/src/form/TextField.tsx +2 -1
  313. package/src/form/TextFieldContainer.tsx +1 -2
  314. package/src/form/fieldsetStyles.ts +18 -3
  315. package/src/form/inputToggleStyles.ts +4 -2
  316. package/src/form/labelStyles.ts +1 -1
  317. package/src/form/legendStyles.ts +132 -0
  318. package/src/form/selectUtils.ts +3 -2
  319. package/src/form/textFieldContainerStyles.ts +1 -2
  320. package/src/form/types.ts +35 -17
  321. package/src/form/useCheckboxGroup.ts +3 -2
  322. package/src/form/useCombobox.ts +8 -3
  323. package/src/form/useNumberField.ts +36 -35
  324. package/src/form/useRangeSlider.ts +1 -2
  325. package/src/form/useSlider.ts +1 -2
  326. package/src/form/useTextField.ts +9 -4
  327. package/src/hoverMode/useHoverMode.ts +4 -8
  328. package/src/icon/FontIcon.tsx +1 -2
  329. package/src/icon/IconRotator.tsx +1 -2
  330. package/src/icon/MaterialIcon.tsx +2 -1
  331. package/src/icon/MaterialSymbol.tsx +2 -1
  332. package/src/icon/SVGIcon.tsx +1 -2
  333. package/src/icon/config.tsx +10 -7
  334. package/src/icon/materialConfig.ts +1 -2
  335. package/src/icon/styles.ts +1 -2
  336. package/src/interaction/UserInteractionModeProvider.tsx +9 -4
  337. package/src/interaction/types.ts +1 -2
  338. package/src/interaction/useElementInteraction.tsx +3 -2
  339. package/src/layout/LayoutAppBar.tsx +6 -6
  340. package/src/layout/LayoutNav.tsx +2 -1
  341. package/src/layout/LayoutWindowSplitter.tsx +2 -1
  342. package/src/layout/Main.tsx +1 -2
  343. package/src/layout/useExpandableLayout.ts +63 -5
  344. package/src/layout/useHorizontalLayoutTransition.ts +1 -2
  345. package/src/layout/useLayoutTree.ts +2 -2
  346. package/src/layout/useLayoutWindowSplitter.ts +6 -6
  347. package/src/layout/useResizableLayout.ts +3 -6
  348. package/src/link/Link.tsx +1 -2
  349. package/src/link/SkipToMainContent.tsx +20 -23
  350. package/src/list/List.tsx +1 -2
  351. package/src/list/ListItem.tsx +2 -1
  352. package/src/list/ListItemAddon.tsx +2 -1
  353. package/src/list/ListItemLink.tsx +2 -1
  354. package/src/list/ListSubheader.tsx +1 -2
  355. package/src/list/getListItemHeight.ts +8 -9
  356. package/src/list/listItemStyles.ts +1 -2
  357. package/src/list/types.ts +1 -2
  358. package/src/media-queries/AppSizeProvider.tsx +8 -10
  359. package/src/media-queries/appSize.ts +3 -0
  360. package/src/media-queries/config.ts +41 -0
  361. package/src/menu/DropdownMenu.tsx +4 -5
  362. package/src/menu/Menu.tsx +2 -1
  363. package/src/menu/MenuItemButton.tsx +1 -2
  364. package/src/menu/MenuItemFileInput.tsx +2 -1
  365. package/src/menu/MenuItemInputToggle.tsx +3 -3
  366. package/src/menu/MenuItemSeparator.tsx +2 -1
  367. package/src/menu/MenuVisibilityProvider.tsx +4 -2
  368. package/src/menu/MenuWidget.tsx +1 -2
  369. package/src/menu/useContextMenu.ts +4 -2
  370. package/src/movement/types.ts +52 -13
  371. package/src/movement/useKeyboardMovementProvider.ts +77 -38
  372. package/src/navigation/CollapsibleNavGroup.tsx +1 -2
  373. package/src/navigation/NavItem.tsx +1 -2
  374. package/src/navigation/NavItemButton.tsx +2 -1
  375. package/src/navigation/NavItemLink.tsx +2 -1
  376. package/src/navigation/getTableOfContentsHeadings.ts +1 -2
  377. package/src/navigation/types.ts +1 -2
  378. package/src/overlay/Overlay.tsx +2 -1
  379. package/src/positioning/createHorizontalPosition.ts +10 -12
  380. package/src/positioning/createVerticalPosition.ts +10 -11
  381. package/src/positioning/useFixedPositioning.ts +6 -3
  382. package/src/progress/CircularProgress.tsx +2 -1
  383. package/src/progress/LinearProgress.tsx +2 -1
  384. package/src/progress/linearProgressStyles.ts +1 -2
  385. package/src/responsive-item/ResponsiveItem.tsx +1 -2
  386. package/src/responsive-item/ResponsiveItemOverlay.tsx +2 -1
  387. package/src/searching/caseInsensitive.ts +2 -4
  388. package/src/segmented-button/SegmentedButton.tsx +2 -1
  389. package/src/segmented-button/SegmentedButtonContainer.tsx +2 -1
  390. package/src/segmented-button/segmentedButtonStyles.ts +1 -2
  391. package/src/sheet/Sheet.tsx +1 -2
  392. package/src/snackbar/Toast.tsx +2 -1
  393. package/src/spinbutton/SpinButton.tsx +98 -0
  394. package/src/spinbutton/SpinButtonGroupProvider.tsx +32 -0
  395. package/src/spinbutton/defaults.ts +45 -0
  396. package/src/spinbutton/types.ts +413 -0
  397. package/src/spinbutton/useSpinButton.ts +311 -0
  398. package/src/spinbutton/useSpinButtonGroupProvider.ts +104 -0
  399. package/src/spinbutton/utils/deselectNode.ts +17 -0
  400. package/src/spinbutton/utils/resolveInputEvent.ts +112 -0
  401. package/src/spinbutton/utils/selectNode.ts +15 -0
  402. package/src/table/StickyTableSection.tsx +2 -1
  403. package/src/table/Table.tsx +1 -2
  404. package/src/table/TableBody.tsx +2 -1
  405. package/src/table/TableCellContent.tsx +1 -2
  406. package/src/table/TableCheckbox.tsx +1 -2
  407. package/src/table/TableFooter.tsx +1 -2
  408. package/src/table/TableHeader.tsx +1 -2
  409. package/src/table/TableRadio.tsx +1 -2
  410. package/src/table/TableRow.tsx +1 -2
  411. package/src/table/useStickyTableSection.tsx +1 -2
  412. package/src/tabs/SimpleTabPanel.tsx +2 -1
  413. package/src/tabs/SimpleTabPanels.tsx +2 -1
  414. package/src/tabs/Tab.tsx +3 -6
  415. package/src/tabs/TabList.tsx +2 -1
  416. package/src/tabs/TabListScrollButton.tsx +1 -2
  417. package/src/tabs/useMaxTabPanelHeight.ts +7 -4
  418. package/src/test-utils/data-testid.ts +1 -2
  419. package/src/test-utils/mocks/match-media.ts +5 -10
  420. package/src/test-utils/vitest/timers.ts +1 -1
  421. package/src/tooltip/Tooltip.tsx +2 -1
  422. package/src/tooltip/TooltipHoverModeProvider.tsx +1 -2
  423. package/src/tooltip/useTooltip.ts +9 -5
  424. package/src/transition/CSSTransition.tsx +2 -1
  425. package/src/transition/Collapse.tsx +4 -2
  426. package/src/transition/CrossFade.tsx +2 -1
  427. package/src/transition/ScaleTransition.tsx +2 -1
  428. package/src/transition/SkeletonPlaceholder.tsx +1 -2
  429. package/src/transition/Slide.tsx +2 -1
  430. package/src/transition/SlideContainer.tsx +1 -2
  431. package/src/transition/types.ts +15 -16
  432. package/src/transition/useCollapseTransition.ts +6 -5
  433. package/src/transition/useCrossFadeTransition.ts +3 -2
  434. package/src/transition/useMaxWidthTransition.ts +1 -2
  435. package/src/transition/useScaleTransition.ts +3 -2
  436. package/src/transition/useSkeletonPlaceholder.ts +1 -2
  437. package/src/tree/Tree.tsx +2 -1
  438. package/src/tree/TreeItem.tsx +2 -1
  439. package/src/tree/TreeProvider.tsx +4 -4
  440. package/src/tree/styles.ts +1 -2
  441. package/src/tree/types.ts +1 -2
  442. package/src/tree/useTreeMovement.ts +1 -2
  443. package/src/typography/HighlightTextMark.tsx +1 -2
  444. package/src/typography/Mark.tsx +1 -2
  445. package/src/typography/TextContainer.tsx +1 -2
  446. package/src/typography/Typography.tsx +1 -2
  447. package/src/useElementSize.ts +7 -4
  448. package/src/useIntersectionObserver.ts +3 -2
  449. package/src/useMutationObserver.ts +3 -2
  450. package/src/useWindowSize.ts +4 -2
  451. package/src/utils/getNumberOfDigits.ts +18 -0
  452. package/src/utils/nearest.ts +2 -1
  453. package/src/utils/useDevEffect.ts +9 -0
  454. package/src/window-splitter/WindowSplitter.tsx +5 -2
  455. package/src/window-splitter/styles.ts +13 -2
  456. package/src/window-splitter/useWindowSplitter.ts +3 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/layout/Main.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ElementType,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n forwardRef,\n} from \"react\";\n\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { type MainClassNameOptions, main } from \"./mainStyles.js\";\nimport { useMainTabIndex } from \"./useMainTabIndex.js\";\n\n/**\n * @since 6.0.0\n */\nexport type CustomMainElement = ElementType<\n HTMLAttributes<HTMLElement> & {\n ref: Ref<HTMLElement>;\n className?: string;\n tabIndex?: number;\n }\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface MainProps\n extends HTMLAttributes<HTMLElement>,\n MainClassNameOptions {\n /**\n * @defaultValue `\"main\"`\n */\n as?: CustomMainElement;\n children: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * This component is really only used to dynamically set the `tabIndex` to `-1`\n * while using a keyboard for the `SkipToMainContent` component's focus behavior\n * to work correctly. If you don't need that functionality, use the {@link main}\n * style utility instead.\n *\n * @example Styles Only\n * ```tsx\n * import { main as mainStyles } from \"@react-md/core/layout/mainStyles\":\n *\n * function MyCustomMainElement({ children }) {\n * return (\n * <main\n * className={mainStyles({\n * navOffset: true,\n * appBarOffset: true,\n * })}\n * >\n * {children}\n * </main>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/getting-started/layout | Layout Demos}\n * @since 6.0.0 Renamed from `LayoutMain` removed a lot of\n * functionality to keep this component simple.\n */\nexport const Main = forwardRef<HTMLElement, MainProps>(\n function Main(props, ref) {\n const {\n as: Component = \"main\",\n id: propId,\n className,\n children,\n tabIndex: propTabIndex,\n navOffset,\n appBarOffset,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"main\");\n const tabIndex = useMainTabIndex(propTabIndex);\n\n return (\n <Component\n {...remaining}\n id={id}\n ref={ref}\n className={main({ navOffset, appBarOffset, className })}\n tabIndex={tabIndex}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["forwardRef","useEnsuredId","main","useMainTabIndex","Main","props","ref","as","Component","id","propId","className","children","tabIndex","propTabIndex","navOffset","appBarOffset","remaining"],"mappings":"AAAA;;AAEA,SAKEA,UAAU,QACL,QAAQ;AAEf,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAAoCC,IAAI,QAAQ,kBAAkB;AAClE,SAASC,eAAe,QAAQ,uBAAuB;AA0BvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BC,GACD,OAAO,MAAMC,qBAAOJ,WAClB,SAASI,KAAKC,KAAK,EAAEC,GAAG;IACtB,MAAM,EACJC,IAAIC,YAAY,MAAM,EACtBC,IAAIC,MAAM,EACVC,SAAS,EACTC,QAAQ,EACRC,UAAUC,YAAY,EACtBC,SAAS,EACTC,YAAY,EACZ,GAAGC,WACJ,GAAGZ;IACJ,MAAMI,KAAKR,aAAaS,QAAQ;IAChC,MAAMG,WAAWV,gBAAgBW;IAEjC,qBACE,KAACN;QACE,GAAGS,SAAS;QACbR,IAAIA;QACJH,KAAKA;QACLK,WAAWT,KAAK;YAAEa;YAAWC;YAAcL;QAAU;QACrDE,UAAUA;kBAETD;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/layout/Main.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ElementType,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n forwardRef,\n} from \"react\";\n\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { type MainClassNameOptions, main } from \"./mainStyles.js\";\nimport { useMainTabIndex } from \"./useMainTabIndex.js\";\n\n/**\n * @since 6.0.0\n */\nexport type CustomMainElement = ElementType<\n HTMLAttributes<HTMLElement> & {\n ref: Ref<HTMLElement>;\n className?: string;\n tabIndex?: number;\n }\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface MainProps\n extends HTMLAttributes<HTMLElement>, MainClassNameOptions {\n /**\n * @defaultValue `\"main\"`\n */\n as?: CustomMainElement;\n children: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * This component is really only used to dynamically set the `tabIndex` to `-1`\n * while using a keyboard for the `SkipToMainContent` component's focus behavior\n * to work correctly. If you don't need that functionality, use the {@link main}\n * style utility instead.\n *\n * @example Styles Only\n * ```tsx\n * import { main as mainStyles } from \"@react-md/core/layout/mainStyles\":\n *\n * function MyCustomMainElement({ children }) {\n * return (\n * <main\n * className={mainStyles({\n * navOffset: true,\n * appBarOffset: true,\n * })}\n * >\n * {children}\n * </main>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/getting-started/layout | Layout Demos}\n * @since 6.0.0 Renamed from `LayoutMain` removed a lot of\n * functionality to keep this component simple.\n */\nexport const Main = forwardRef<HTMLElement, MainProps>(\n function Main(props, ref) {\n const {\n as: Component = \"main\",\n id: propId,\n className,\n children,\n tabIndex: propTabIndex,\n navOffset,\n appBarOffset,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"main\");\n const tabIndex = useMainTabIndex(propTabIndex);\n\n return (\n <Component\n {...remaining}\n id={id}\n ref={ref}\n className={main({ navOffset, appBarOffset, className })}\n tabIndex={tabIndex}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["forwardRef","useEnsuredId","main","useMainTabIndex","Main","props","ref","as","Component","id","propId","className","children","tabIndex","propTabIndex","navOffset","appBarOffset","remaining"],"mappings":"AAAA;;AAEA,SAKEA,UAAU,QACL,QAAQ;AAEf,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAAoCC,IAAI,QAAQ,kBAAkB;AAClE,SAASC,eAAe,QAAQ,uBAAuB;AAyBvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BC,GACD,OAAO,MAAMC,qBAAOJ,WAClB,SAASI,KAAKC,KAAK,EAAEC,GAAG;IACtB,MAAM,EACJC,IAAIC,YAAY,MAAM,EACtBC,IAAIC,MAAM,EACVC,SAAS,EACTC,QAAQ,EACRC,UAAUC,YAAY,EACtBC,SAAS,EACTC,YAAY,EACZ,GAAGC,WACJ,GAAGZ;IACJ,MAAMI,KAAKR,aAAaS,QAAQ;IAChC,MAAMG,WAAWV,gBAAgBW;IAEjC,qBACE,KAACN;QACE,GAAGS,SAAS;QACbR,IAAIA;QACJH,KAAKA;QACLK,WAAWT,KAAK;YAAEa;YAAWC;YAAcL;QAAU;QACrDE,UAAUA;kBAETD;;AAGP,GACA"}
@@ -2,10 +2,13 @@
2
2
  import { cnb } from "cnbuilder";
3
3
  import { useSsr } from "../SsrProvider.js";
4
4
  import { useAppSize } from "../media-queries/AppSizeProvider.js";
5
+ import { MEDIA_QUERY_CONFIG } from "../media-queries/config.js";
5
6
  import { useMediaQuery } from "../media-queries/useMediaQuery.js";
6
7
  import { useToggle } from "../useToggle.js";
8
+ import { useDevEffect } from "../utils/useDevEffect.js";
7
9
  import { useHorizontalLayoutTransition } from "./useHorizontalLayoutTransition.js";
8
10
  import { useTemporaryLayout } from "./useTemporaryLayout.js";
11
+ let loggedOnce = false;
9
12
  /**
10
13
  * @example Main Usage
11
14
  * ```tsx
@@ -122,6 +125,46 @@ import { useTemporaryLayout } from "./useTemporaryLayout.js";
122
125
  const isAppSizeMatch = temporaryUntil === "tablet" || temporaryUntil === "desktop";
123
126
  const matches = useMediaQuery(temporaryUntil, isAppSizeMatch);
124
127
  const temporary = isAppSizeMatch ? isPhone || temporaryUntil === "desktop" && !isDesktop : !matches;
128
+ useDevEffect(()=>{
129
+ if (process.env.NODE_ENV === "test") {
130
+ return;
131
+ }
132
+ let query;
133
+ if (temporaryUntil === "tablet" || temporaryUntil === "desktop") {
134
+ const minWidth = temporaryUntil === "tablet" ? MEDIA_QUERY_CONFIG.tabletMinWidth : MEDIA_QUERY_CONFIG.desktopMinWidth;
135
+ query = `screen and (min-width: ${minWidth})`;
136
+ } else {
137
+ query = temporaryUntil;
138
+ }
139
+ const timeout = window.setTimeout(()=>{
140
+ let found = false;
141
+ for(let i = 0; i < document.styleSheets.length; i++){
142
+ const sheet = document.styleSheets[i];
143
+ try {
144
+ const rules = sheet.cssRules;
145
+ for(let j = 0; j < rules.length; j++){
146
+ const rule = rules[j];
147
+ if (rule.cssText.includes(".rmd-layout") && rule.cssText.includes(`@media ${query}`)) {
148
+ found = true;
149
+ return;
150
+ }
151
+ }
152
+ } catch {
153
+ //
154
+ }
155
+ }
156
+ if (!found && !loggedOnce) {
157
+ loggedOnce = true;
158
+ // eslint-disable-next-line no-console
159
+ console.error(`The react-md expandable layout has set \`temporaryUntil: "${temporaryUntil}"\` but the corresponding styles have not been found.` + " This usually means the `$layout-navigation-breakpoint` or `temporaryUntil` value should be updated match.\n\n" + "See https://react-md.dev/getting-started/layout#updating-the-layout-to-be-temporary-until-a-specific-breakpoint-optional " + "for more information.");
160
+ }
161
+ }, 3000);
162
+ return ()=>{
163
+ window.clearTimeout(timeout);
164
+ };
165
+ }, [
166
+ temporaryUntil
167
+ ]);
125
168
  return {
126
169
  visible,
127
170
  temporary,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/layout/useExpandableLayout.ts"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\n\nimport { useSsr } from \"../SsrProvider.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type AppSize } from \"../media-queries/appSize.js\";\nimport { useMediaQuery } from \"../media-queries/useMediaQuery.js\";\nimport { type CSSTransitionElementProps } from \"../transition/types.js\";\nimport { type CssPosition, type UseStateInitializer } from \"../types.js\";\nimport { useToggle } from \"../useToggle.js\";\nimport { type LayoutNavProps } from \"./LayoutNav.js\";\nimport {\n type HorizontalLayoutTransitionOptions,\n useHorizontalLayoutTransition,\n} from \"./useHorizontalLayoutTransition.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type useResizableLayout } from \"./useResizableLayout.js\";\nimport {\n type ProvidedLayoutNavToggleProps,\n type ProvidedTemporaryLayoutAppBarProps,\n type ProvidedTemporaryLayoutMainProps,\n type TemporaryLayoutImplementation,\n type TemporaryLayoutOptions,\n useTemporaryLayout,\n} from \"./useTemporaryLayout.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface ExpandableLayoutOptions extends TemporaryLayoutOptions {\n /** @defaultValue `\"fixed\"` */\n appBarPosition?: CssPosition;\n\n /** @defaultValue `false` */\n defaultExpanded?: UseStateInitializer<boolean>;\n\n /**\n * Set this to `true` if the expandable navigation should be the full height\n * of the screen. This will also update the app bar so that it is not covered\n * by the navigation. The default behavior is to place the navigation below\n * the fixed header.\n *\n * Set this to `\"static\"` to make the navigation span the full height of the\n * screen and hide the button until the screen shrinks to the temporary\n * layout type.\n *\n * @defaultValue `false`\n */\n fullHeightNav?: boolean | \"static\";\n\n /** @see {@link HorizontalLayoutTransitionOptions} */\n transitionProps?: Omit<HorizontalLayoutTransitionOptions, \"transitionIn\">;\n\n /**\n * The default behavior is to use the temporary layout until the\n * {@link AppSize.isTablet} is `true`. Set this to `\"desktop\"` to use the\n * temporary layout until {@link AppSize.isDesktop} is `true`. Otherwise,\n * provide a media query string to use the temporary layout until the media\n * query matches\n *\n * @example Custom Media Query\n * ```tsx\n * useExpandableLayout({\n * ...options,\n * // display the expandable layout once the min-width is at least 1201px\n * temporaryUntil: \"screen and (min-width: 1201px)\",\n * });\n * ```\n *\n * @defaultValue `\"tablet\"`\n */\n temporaryUntil?: \"tablet\" | \"desktop\" | (string & {});\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ProvidedLayoutMainProps\n extends ProvidedTemporaryLayoutMainProps,\n CSSTransitionElementProps<HTMLElement> {}\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedLayoutNavProps = Pick<\n LayoutNavProps,\n \"expanded\" | \"appBarOffset\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedLayoutAppBarProps = ProvidedTemporaryLayoutAppBarProps &\n Partial<CSSTransitionElementProps<HTMLElement>>;\n\n/**\n * @since 6.0.0\n */\nexport interface ProvidedExpandableLayoutNavToggleProps\n extends ProvidedLayoutNavToggleProps {\n className: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ExpandableLayoutImplementation\n extends TemporaryLayoutImplementation {\n temporary: boolean;\n persistent: boolean;\n expanded: boolean;\n expandNavigation: () => void;\n collapseNavigation: () => void;\n toggleNavigation: () => void;\n appBarProps: ProvidedLayoutAppBarProps;\n mainProps: ProvidedLayoutMainProps;\n navToggleProps: ProvidedExpandableLayoutNavToggleProps;\n expandableNavProps: ProvidedLayoutNavProps;\n}\n\n/**\n * @example Main Usage\n * ```tsx\n * import { AppBarTitle } from \"@react-md/core/app-bar/AppBarTitle\";\n * import { Button } from \"@react-md/core/button/Button\";\n * import { LayoutAppBar } from \"@react-md/core/layout/LayoutAppBar\";\n * import { LayoutNav } from \"@react-md/core/layout/LayoutNav\";\n * import { Main } from \"@react-md/core/layout/Main\";\n * import { useExpandableLayout } from \"@react-md/core/layout/useExpandableLayout\";\n * import { Sheet } from \"@react-md/core/sheet/Sheet\";\n * import { type ReactElement, type ReactNode } from \"react\";\n *\n * import { CustomNavigation } from \"./CustomNavigation\";\n *\n * export interface LayoutProps {\n * children: ReactNode;\n * }\n *\n * export function Layout(props: LayoutProps): ReactElement {\n * const { children } = props;\n *\n * // choose whichever one for your app\n * // nextjs app dir\n * const pathname = usePathname();\n * // nextjs pages\n * const { pathname } = useRouter();\n * // react router\n * const { pathname } = useHistory();\n *\n * const {\n * temporary,\n * appBarProps,\n * expandableNavProps,\n * mainProps,\n * navToggleProps,\n * temporaryNavProps,\n * windowSplitterProps,\n * } = useExpandableLayout({ pathname });\n *\n * return (\n * <>\n * <LayoutAppBar {...appBarProps}>\n * <Button {...navToggleProps} />\n * <AppBarTitle>Hello, world!</AppBarTitle>\n * </LayoutAppBar>\n * <LayoutNav {...expandableNavProps}>\n * <CustomNavigation />\n * </LayoutNav>\n * {temporary && (\n * <Sheet {...temporaryNavProps}>\n * <CustomNavigation />\n * </Sheet>\n * )}\n * <Main {...mainProps}>{children}</Main>\n * </>\n * );\n * }\n * ```\n *\n * If you have a large navigation panel, you can conditionally render the\n * `LayoutNav` with the `persistent` boolean returned by the hook which will\n * ensure that the DOM has rehydrated before unmounting to prevent SSR errors.\n *\n * @example Safely Conditionally Rendering\n * ```diff\n * const {\n * temporary,\n * + persistent,\n * appBarProps,\n * expandableNavProps,\n * mainProps,\n * navToggleProps,\n * temporaryNavProps,\n * windowSplitterProps,\n * } = useExpandableLayout({ pathname });\n *\n * return (\n * <>\n * <LayoutAppBar {...appBarProps}>\n * <Button {...navToggleProps} />\n * <AppBarTitle>Hello, world!</AppBarTitle>\n * </LayoutAppBar>\n * - <LayoutNav {...expandableNavProps}>\n * - <CustomNavigation />\n * - </LayoutNav>\n * + {persistent && (\n * + <LayoutNav {...expandableNavProps}>\n * + <CustomNavigation />\n * + </LayoutNav>\n * + )}\n * {temporary && (\n * <Sheet {...temporaryNavProps}>\n * <CustomNavigation />\n * </Sheet>\n * )}\n * <Main {...mainProps}>{children}</Main>\n * </>\n * );\n * ```\n *\n * @see {@link https://react-md.dev/getting-started/layout | Layout Demos}\n * @since 6.0.0\n * @see {@link useResizableLayout}\n */\nexport function useExpandableLayout(\n options: ExpandableLayoutOptions\n): ExpandableLayoutImplementation {\n const {\n fullHeightNav = false,\n temporaryUntil = \"tablet\",\n transitionProps,\n defaultExpanded = fullHeightNav === \"static\",\n ...temporaryOptions\n } = options;\n\n const ssr = useSsr();\n const {\n appBarProps,\n mainProps,\n navToggleProps,\n temporaryNavProps,\n hideTemporaryNav,\n showTemporaryNav,\n visible,\n } = useTemporaryLayout(temporaryOptions);\n\n const {\n toggled: expanded,\n enable: expandNavigation,\n disable: collapseNavigation,\n toggle: toggleNavigation,\n } = useToggle(defaultExpanded);\n const { elementProps } = useHorizontalLayoutTransition({\n ...transitionProps,\n transitionIn: expanded,\n });\n const { isPhone, isDesktop } = useAppSize();\n const isAppSizeMatch =\n temporaryUntil === \"tablet\" || temporaryUntil === \"desktop\";\n const matches = useMediaQuery(temporaryUntil, isAppSizeMatch);\n const temporary = isAppSizeMatch\n ? isPhone || (temporaryUntil === \"desktop\" && !isDesktop)\n : !matches;\n\n return {\n visible,\n temporary,\n persistent: ssr || !temporary,\n hideTemporaryNav,\n showTemporaryNav,\n expanded,\n expandNavigation,\n collapseNavigation,\n toggleNavigation,\n appBarProps: {\n ...appBarProps,\n ...(fullHeightNav ? elementProps : {}),\n },\n mainProps: {\n ...mainProps,\n ...elementProps,\n },\n temporaryNavProps,\n expandableNavProps: {\n expanded,\n appBarOffset: !fullHeightNav,\n },\n navToggleProps: {\n ...navToggleProps,\n onClick() {\n if (temporary) {\n showTemporaryNav();\n } else {\n toggleNavigation();\n }\n },\n className: cnb(fullHeightNav === \"static\" && \"rmd-layout-nav-toggle\"),\n },\n };\n}\n"],"names":["cnb","useSsr","useAppSize","useMediaQuery","useToggle","useHorizontalLayoutTransition","useTemporaryLayout","useExpandableLayout","options","fullHeightNav","temporaryUntil","transitionProps","defaultExpanded","temporaryOptions","ssr","appBarProps","mainProps","navToggleProps","temporaryNavProps","hideTemporaryNav","showTemporaryNav","visible","toggled","expanded","enable","expandNavigation","disable","collapseNavigation","toggle","toggleNavigation","elementProps","transitionIn","isPhone","isDesktop","isAppSizeMatch","matches","temporary","persistent","expandableNavProps","appBarOffset","onClick","className"],"mappings":"AAAA;AAEA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,UAAU,QAAQ,sCAAsC;AAGjE,SAASC,aAAa,QAAQ,oCAAoC;AAGlE,SAASC,SAAS,QAAQ,kBAAkB;AAE5C,SAEEC,6BAA6B,QACxB,qCAAqC;AAG5C,SAMEC,kBAAkB,QACb,0BAA0B;AAgGjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuGC,GACD,OAAO,SAASC,oBACdC,OAAgC;IAEhC,MAAM,EACJC,gBAAgB,KAAK,EACrBC,iBAAiB,QAAQ,EACzBC,eAAe,EACfC,kBAAkBH,kBAAkB,QAAQ,EAC5C,GAAGI,kBACJ,GAAGL;IAEJ,MAAMM,MAAMb;IACZ,MAAM,EACJc,WAAW,EACXC,SAAS,EACTC,cAAc,EACdC,iBAAiB,EACjBC,gBAAgB,EAChBC,gBAAgB,EAChBC,OAAO,EACR,GAAGf,mBAAmBO;IAEvB,MAAM,EACJS,SAASC,QAAQ,EACjBC,QAAQC,gBAAgB,EACxBC,SAASC,kBAAkB,EAC3BC,QAAQC,gBAAgB,EACzB,GAAGzB,UAAUQ;IACd,MAAM,EAAEkB,YAAY,EAAE,GAAGzB,8BAA8B;QACrD,GAAGM,eAAe;QAClBoB,cAAcR;IAChB;IACA,MAAM,EAAES,OAAO,EAAEC,SAAS,EAAE,GAAG/B;IAC/B,MAAMgC,iBACJxB,mBAAmB,YAAYA,mBAAmB;IACpD,MAAMyB,UAAUhC,cAAcO,gBAAgBwB;IAC9C,MAAME,YAAYF,iBACdF,WAAYtB,mBAAmB,aAAa,CAACuB,YAC7C,CAACE;IAEL,OAAO;QACLd;QACAe;QACAC,YAAYvB,OAAO,CAACsB;QACpBjB;QACAC;QACAG;QACAE;QACAE;QACAE;QACAd,aAAa;YACX,GAAGA,WAAW;YACd,GAAIN,gBAAgBqB,eAAe,CAAC,CAAC;QACvC;QACAd,WAAW;YACT,GAAGA,SAAS;YACZ,GAAGc,YAAY;QACjB;QACAZ;QACAoB,oBAAoB;YAClBf;YACAgB,cAAc,CAAC9B;QACjB;QACAQ,gBAAgB;YACd,GAAGA,cAAc;YACjBuB;gBACE,IAAIJ,WAAW;oBACbhB;gBACF,OAAO;oBACLS;gBACF;YACF;YACAY,WAAWzC,IAAIS,kBAAkB,YAAY;QAC/C;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/layout/useExpandableLayout.ts"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\n\nimport { useSsr } from \"../SsrProvider.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type AppSize } from \"../media-queries/appSize.js\";\nimport { MEDIA_QUERY_CONFIG } from \"../media-queries/config.js\";\nimport { useMediaQuery } from \"../media-queries/useMediaQuery.js\";\nimport { type CSSTransitionElementProps } from \"../transition/types.js\";\nimport { type CssPosition, type UseStateInitializer } from \"../types.js\";\nimport { useToggle } from \"../useToggle.js\";\nimport { useDevEffect } from \"../utils/useDevEffect.js\";\nimport { type LayoutNavProps } from \"./LayoutNav.js\";\nimport {\n type HorizontalLayoutTransitionOptions,\n useHorizontalLayoutTransition,\n} from \"./useHorizontalLayoutTransition.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type useResizableLayout } from \"./useResizableLayout.js\";\nimport {\n type ProvidedLayoutNavToggleProps,\n type ProvidedTemporaryLayoutAppBarProps,\n type ProvidedTemporaryLayoutMainProps,\n type TemporaryLayoutImplementation,\n type TemporaryLayoutOptions,\n useTemporaryLayout,\n} from \"./useTemporaryLayout.js\";\n\nlet loggedOnce = false;\n\n/**\n * @since 6.0.0\n */\nexport interface ExpandableLayoutOptions extends TemporaryLayoutOptions {\n /** @defaultValue `\"fixed\"` */\n appBarPosition?: CssPosition;\n\n /** @defaultValue `false` */\n defaultExpanded?: UseStateInitializer<boolean>;\n\n /**\n * Set this to `true` if the expandable navigation should be the full height\n * of the screen. This will also update the app bar so that it is not covered\n * by the navigation. The default behavior is to place the navigation below\n * the fixed header.\n *\n * Set this to `\"static\"` to make the navigation span the full height of the\n * screen and hide the button until the screen shrinks to the temporary\n * layout type.\n *\n * @defaultValue `false`\n */\n fullHeightNav?: boolean | \"static\";\n\n /** @see {@link HorizontalLayoutTransitionOptions} */\n transitionProps?: Omit<HorizontalLayoutTransitionOptions, \"transitionIn\">;\n\n /**\n * The default behavior is to use the temporary layout until the\n * {@link AppSize.isTablet} is `true`. Set this to `\"desktop\"` to use the\n * temporary layout until {@link AppSize.isDesktop} is `true`. Otherwise,\n * provide a media query string to use the temporary layout until the media\n * query matches\n *\n * @example Custom Media Query\n * ```tsx\n * useExpandableLayout({\n * ...options,\n * // display the expandable layout once the min-width is at least 1201px\n * temporaryUntil: \"screen and (min-width: 1201px)\",\n * });\n * ```\n *\n * @defaultValue `\"tablet\"`\n */\n temporaryUntil?: \"tablet\" | \"desktop\" | (string & {});\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ProvidedLayoutMainProps\n extends\n ProvidedTemporaryLayoutMainProps,\n CSSTransitionElementProps<HTMLElement> {}\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedLayoutNavProps = Pick<\n LayoutNavProps,\n \"expanded\" | \"appBarOffset\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedLayoutAppBarProps = ProvidedTemporaryLayoutAppBarProps &\n Partial<CSSTransitionElementProps<HTMLElement>>;\n\n/**\n * @since 6.0.0\n */\nexport interface ProvidedExpandableLayoutNavToggleProps extends ProvidedLayoutNavToggleProps {\n className: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ExpandableLayoutImplementation extends TemporaryLayoutImplementation {\n temporary: boolean;\n persistent: boolean;\n expanded: boolean;\n expandNavigation: () => void;\n collapseNavigation: () => void;\n toggleNavigation: () => void;\n appBarProps: ProvidedLayoutAppBarProps;\n mainProps: ProvidedLayoutMainProps;\n navToggleProps: ProvidedExpandableLayoutNavToggleProps;\n expandableNavProps: ProvidedLayoutNavProps;\n}\n\n/**\n * @example Main Usage\n * ```tsx\n * import { AppBarTitle } from \"@react-md/core/app-bar/AppBarTitle\";\n * import { Button } from \"@react-md/core/button/Button\";\n * import { LayoutAppBar } from \"@react-md/core/layout/LayoutAppBar\";\n * import { LayoutNav } from \"@react-md/core/layout/LayoutNav\";\n * import { Main } from \"@react-md/core/layout/Main\";\n * import { useExpandableLayout } from \"@react-md/core/layout/useExpandableLayout\";\n * import { Sheet } from \"@react-md/core/sheet/Sheet\";\n * import { type ReactElement, type ReactNode } from \"react\";\n *\n * import { CustomNavigation } from \"./CustomNavigation\";\n *\n * export interface LayoutProps {\n * children: ReactNode;\n * }\n *\n * export function Layout(props: LayoutProps): ReactElement {\n * const { children } = props;\n *\n * // choose whichever one for your app\n * // nextjs app dir\n * const pathname = usePathname();\n * // nextjs pages\n * const { pathname } = useRouter();\n * // react router\n * const { pathname } = useHistory();\n *\n * const {\n * temporary,\n * appBarProps,\n * expandableNavProps,\n * mainProps,\n * navToggleProps,\n * temporaryNavProps,\n * windowSplitterProps,\n * } = useExpandableLayout({ pathname });\n *\n * return (\n * <>\n * <LayoutAppBar {...appBarProps}>\n * <Button {...navToggleProps} />\n * <AppBarTitle>Hello, world!</AppBarTitle>\n * </LayoutAppBar>\n * <LayoutNav {...expandableNavProps}>\n * <CustomNavigation />\n * </LayoutNav>\n * {temporary && (\n * <Sheet {...temporaryNavProps}>\n * <CustomNavigation />\n * </Sheet>\n * )}\n * <Main {...mainProps}>{children}</Main>\n * </>\n * );\n * }\n * ```\n *\n * If you have a large navigation panel, you can conditionally render the\n * `LayoutNav` with the `persistent` boolean returned by the hook which will\n * ensure that the DOM has rehydrated before unmounting to prevent SSR errors.\n *\n * @example Safely Conditionally Rendering\n * ```diff\n * const {\n * temporary,\n * + persistent,\n * appBarProps,\n * expandableNavProps,\n * mainProps,\n * navToggleProps,\n * temporaryNavProps,\n * windowSplitterProps,\n * } = useExpandableLayout({ pathname });\n *\n * return (\n * <>\n * <LayoutAppBar {...appBarProps}>\n * <Button {...navToggleProps} />\n * <AppBarTitle>Hello, world!</AppBarTitle>\n * </LayoutAppBar>\n * - <LayoutNav {...expandableNavProps}>\n * - <CustomNavigation />\n * - </LayoutNav>\n * + {persistent && (\n * + <LayoutNav {...expandableNavProps}>\n * + <CustomNavigation />\n * + </LayoutNav>\n * + )}\n * {temporary && (\n * <Sheet {...temporaryNavProps}>\n * <CustomNavigation />\n * </Sheet>\n * )}\n * <Main {...mainProps}>{children}</Main>\n * </>\n * );\n * ```\n *\n * @see {@link https://react-md.dev/getting-started/layout | Layout Demos}\n * @since 6.0.0\n * @see {@link useResizableLayout}\n */\nexport function useExpandableLayout(\n options: ExpandableLayoutOptions\n): ExpandableLayoutImplementation {\n const {\n fullHeightNav = false,\n temporaryUntil = \"tablet\",\n transitionProps,\n defaultExpanded = fullHeightNav === \"static\",\n ...temporaryOptions\n } = options;\n\n const ssr = useSsr();\n const {\n appBarProps,\n mainProps,\n navToggleProps,\n temporaryNavProps,\n hideTemporaryNav,\n showTemporaryNav,\n visible,\n } = useTemporaryLayout(temporaryOptions);\n\n const {\n toggled: expanded,\n enable: expandNavigation,\n disable: collapseNavigation,\n toggle: toggleNavigation,\n } = useToggle(defaultExpanded);\n const { elementProps } = useHorizontalLayoutTransition({\n ...transitionProps,\n transitionIn: expanded,\n });\n const { isPhone, isDesktop } = useAppSize();\n const isAppSizeMatch =\n temporaryUntil === \"tablet\" || temporaryUntil === \"desktop\";\n const matches = useMediaQuery(temporaryUntil, isAppSizeMatch);\n const temporary = isAppSizeMatch\n ? isPhone || (temporaryUntil === \"desktop\" && !isDesktop)\n : !matches;\n\n useDevEffect(() => {\n if (process.env.NODE_ENV === \"test\") {\n return;\n }\n\n let query: string;\n if (temporaryUntil === \"tablet\" || temporaryUntil === \"desktop\") {\n const minWidth =\n temporaryUntil === \"tablet\"\n ? MEDIA_QUERY_CONFIG.tabletMinWidth\n : MEDIA_QUERY_CONFIG.desktopMinWidth;\n query = `screen and (min-width: ${minWidth})`;\n } else {\n query = temporaryUntil;\n }\n\n const timeout = window.setTimeout(() => {\n let found = false;\n for (let i = 0; i < document.styleSheets.length; i++) {\n const sheet = document.styleSheets[i];\n\n try {\n const rules = sheet.cssRules;\n for (let j = 0; j < rules.length; j++) {\n const rule = rules[j];\n if (\n rule.cssText.includes(\".rmd-layout\") &&\n rule.cssText.includes(`@media ${query}`)\n ) {\n found = true;\n return;\n }\n }\n } catch {\n //\n }\n }\n\n if (!found && !loggedOnce) {\n loggedOnce = true;\n // eslint-disable-next-line no-console\n console.error(\n `The react-md expandable layout has set \\`temporaryUntil: \"${temporaryUntil}\"\\` but the corresponding styles have not been found.` +\n \" This usually means the `$layout-navigation-breakpoint` or `temporaryUntil` value should be updated match.\\n\\n\" +\n \"See https://react-md.dev/getting-started/layout#updating-the-layout-to-be-temporary-until-a-specific-breakpoint-optional \" +\n \"for more information.\"\n );\n }\n }, 3000);\n\n return () => {\n window.clearTimeout(timeout);\n };\n }, [temporaryUntil]);\n\n return {\n visible,\n temporary,\n persistent: ssr || !temporary,\n hideTemporaryNav,\n showTemporaryNav,\n expanded,\n expandNavigation,\n collapseNavigation,\n toggleNavigation,\n appBarProps: {\n ...appBarProps,\n ...(fullHeightNav ? elementProps : {}),\n },\n mainProps: {\n ...mainProps,\n ...elementProps,\n },\n temporaryNavProps,\n expandableNavProps: {\n expanded,\n appBarOffset: !fullHeightNav,\n },\n navToggleProps: {\n ...navToggleProps,\n onClick() {\n if (temporary) {\n showTemporaryNav();\n } else {\n toggleNavigation();\n }\n },\n className: cnb(fullHeightNav === \"static\" && \"rmd-layout-nav-toggle\"),\n },\n };\n}\n"],"names":["cnb","useSsr","useAppSize","MEDIA_QUERY_CONFIG","useMediaQuery","useToggle","useDevEffect","useHorizontalLayoutTransition","useTemporaryLayout","loggedOnce","useExpandableLayout","options","fullHeightNav","temporaryUntil","transitionProps","defaultExpanded","temporaryOptions","ssr","appBarProps","mainProps","navToggleProps","temporaryNavProps","hideTemporaryNav","showTemporaryNav","visible","toggled","expanded","enable","expandNavigation","disable","collapseNavigation","toggle","toggleNavigation","elementProps","transitionIn","isPhone","isDesktop","isAppSizeMatch","matches","temporary","process","env","NODE_ENV","query","minWidth","tabletMinWidth","desktopMinWidth","timeout","window","setTimeout","found","i","document","styleSheets","length","sheet","rules","cssRules","j","rule","cssText","includes","console","error","clearTimeout","persistent","expandableNavProps","appBarOffset","onClick","className"],"mappings":"AAAA;AAEA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,UAAU,QAAQ,sCAAsC;AAGjE,SAASC,kBAAkB,QAAQ,6BAA6B;AAChE,SAASC,aAAa,QAAQ,oCAAoC;AAGlE,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,YAAY,QAAQ,2BAA2B;AAExD,SAEEC,6BAA6B,QACxB,qCAAqC;AAG5C,SAMEC,kBAAkB,QACb,0BAA0B;AAEjC,IAAIC,aAAa;AA+FjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuGC,GACD,OAAO,SAASC,oBACdC,OAAgC;IAEhC,MAAM,EACJC,gBAAgB,KAAK,EACrBC,iBAAiB,QAAQ,EACzBC,eAAe,EACfC,kBAAkBH,kBAAkB,QAAQ,EAC5C,GAAGI,kBACJ,GAAGL;IAEJ,MAAMM,MAAMhB;IACZ,MAAM,EACJiB,WAAW,EACXC,SAAS,EACTC,cAAc,EACdC,iBAAiB,EACjBC,gBAAgB,EAChBC,gBAAgB,EAChBC,OAAO,EACR,GAAGhB,mBAAmBQ;IAEvB,MAAM,EACJS,SAASC,QAAQ,EACjBC,QAAQC,gBAAgB,EACxBC,SAASC,kBAAkB,EAC3BC,QAAQC,gBAAgB,EACzB,GAAG3B,UAAUU;IACd,MAAM,EAAEkB,YAAY,EAAE,GAAG1B,8BAA8B;QACrD,GAAGO,eAAe;QAClBoB,cAAcR;IAChB;IACA,MAAM,EAAES,OAAO,EAAEC,SAAS,EAAE,GAAGlC;IAC/B,MAAMmC,iBACJxB,mBAAmB,YAAYA,mBAAmB;IACpD,MAAMyB,UAAUlC,cAAcS,gBAAgBwB;IAC9C,MAAME,YAAYF,iBACdF,WAAYtB,mBAAmB,aAAa,CAACuB,YAC7C,CAACE;IAELhC,aAAa;QACX,IAAIkC,QAAQC,GAAG,CAACC,QAAQ,KAAK,QAAQ;YACnC;QACF;QAEA,IAAIC;QACJ,IAAI9B,mBAAmB,YAAYA,mBAAmB,WAAW;YAC/D,MAAM+B,WACJ/B,mBAAmB,WACfV,mBAAmB0C,cAAc,GACjC1C,mBAAmB2C,eAAe;YACxCH,QAAQ,CAAC,uBAAuB,EAAEC,SAAS,CAAC,CAAC;QAC/C,OAAO;YACLD,QAAQ9B;QACV;QAEA,MAAMkC,UAAUC,OAAOC,UAAU,CAAC;YAChC,IAAIC,QAAQ;YACZ,IAAK,IAAIC,IAAI,GAAGA,IAAIC,SAASC,WAAW,CAACC,MAAM,EAAEH,IAAK;gBACpD,MAAMI,QAAQH,SAASC,WAAW,CAACF,EAAE;gBAErC,IAAI;oBACF,MAAMK,QAAQD,MAAME,QAAQ;oBAC5B,IAAK,IAAIC,IAAI,GAAGA,IAAIF,MAAMF,MAAM,EAAEI,IAAK;wBACrC,MAAMC,OAAOH,KAAK,CAACE,EAAE;wBACrB,IACEC,KAAKC,OAAO,CAACC,QAAQ,CAAC,kBACtBF,KAAKC,OAAO,CAACC,QAAQ,CAAC,CAAC,OAAO,EAAElB,OAAO,GACvC;4BACAO,QAAQ;4BACR;wBACF;oBACF;gBACF,EAAE,OAAM;gBACN,EAAE;gBACJ;YACF;YAEA,IAAI,CAACA,SAAS,CAACzC,YAAY;gBACzBA,aAAa;gBACb,sCAAsC;gBACtCqD,QAAQC,KAAK,CACX,CAAC,0DAA0D,EAAElD,eAAe,qDAAqD,CAAC,GAChI,oHACA,8HACA;YAEN;QACF,GAAG;QAEH,OAAO;YACLmC,OAAOgB,YAAY,CAACjB;QACtB;IACF,GAAG;QAAClC;KAAe;IAEnB,OAAO;QACLW;QACAe;QACA0B,YAAYhD,OAAO,CAACsB;QACpBjB;QACAC;QACAG;QACAE;QACAE;QACAE;QACAd,aAAa;YACX,GAAGA,WAAW;YACd,GAAIN,gBAAgBqB,eAAe,CAAC,CAAC;QACvC;QACAd,WAAW;YACT,GAAGA,SAAS;YACZ,GAAGc,YAAY;QACjB;QACAZ;QACA6C,oBAAoB;YAClBxC;YACAyC,cAAc,CAACvD;QACjB;QACAQ,gBAAgB;YACd,GAAGA,cAAc;YACjBgD;gBACE,IAAI7B,WAAW;oBACbhB;gBACF,OAAO;oBACLS;gBACF;YACF;YACAqC,WAAWrE,IAAIY,kBAAkB,YAAY;QAC/C;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/layout/useHorizontalLayoutTransition.ts"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\n\nimport { DEFAULT_SHEET_TIMEOUT } from \"../sheet/styles.js\";\nimport {\n type CSSTransitionClassNames,\n type CSSTransitionHookReturnValue,\n type PreconfiguredCSSTransitionOptions,\n type TransitionTimeout,\n} from \"../transition/types.js\";\nimport { useCSSTransition } from \"../transition/useCSSTransition.js\";\n\n/**\n * @since 6.0.0\n */\nexport const DEFAULT_HORIZONTAL_LAYOUT_TRANSITION_CLASSNAMES = {\n appearDone: \"rmd-layout-h--active\",\n enter: \"rmd-layout-h--enter\",\n enterActive: \"rmd-layout-h--active\",\n enterDone: \"rmd-layout-h--active\",\n exit: \"rmd-layout-h--exit\",\n} as const satisfies CSSTransitionClassNames;\n\n/**\n * @since 6.0.0\n */\nexport interface HorizontalLayoutTransitionOptions\n extends PreconfiguredCSSTransitionOptions<HTMLElement> {\n /**\n * @see {@link DEFAULT_SHEET_TIMEOUT}\n * @defaultValue `DEFAULT_SHEET_TIMEOUT`\n */\n timeout?: TransitionTimeout;\n /**\n * @see {@link DEFAULT_HORIZONTAL_LAYOUT_TRANSITION_CLASSNAMES}\n * @defaultValue `DEFAULT_HORIZONTAL_LAYOUT_TRANSITION_CLASSNAMES`\n */\n classNames?: CSSTransitionClassNames;\n}\n\n/**\n * @example\n * ```tsx\n * import { LayoutAppBar } from \"@react-md/core/layout/LayoutAppBar\";\n * import { Main } from \"@react-md/core/layout/Main\";\n * import { useHorizontalLayoutTransition } from \"@react-md/core/layout/useHorizontalLayoutTransition\";\n * import type { ReactElement, ReactNode } from \"react\";\n *\n * interface Props {\n * title: ReactNode;\n * children: ReactNode;\n * }\n *\n * export default function Example({ title, children }: Props): ReactElement {\n * const { toggled: staticNavExpanded, toggle: toggleStaticNav } = useToggle();\n * const { elementProps, className } = useHorizontalLayoutTransition({\n * transitionIn: staticNavExpanded,\n * });\n *\n * return (\n * <>\n * <LayoutAppBar className={className}>\n * <Button\n * aria-label=\"Navigation\"\n * buttonType=\"icon\"\n * onClick={toggleStaticNav}\n * >\n * <MenuOutlinedIcon />\n * '</Button>\n * {title}\n * </LayoutAppBar>\n * <Main {...elementProps}>\n * {children}\n * </Main>\n * </>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/getting-started/layout | Layout Demos}\n * @since 6.0.0\n */\nexport function useHorizontalLayoutTransition<\n E extends HTMLElement = HTMLElement,\n>(options: HorizontalLayoutTransitionOptions): CSSTransitionHookReturnValue<E> {\n return useCSSTransition({\n timeout: DEFAULT_SHEET_TIMEOUT,\n classNames: DEFAULT_HORIZONTAL_LAYOUT_TRANSITION_CLASSNAMES,\n ...options,\n className: cnb(\"rmd-layout-h\", options.className),\n });\n}\n"],"names":["cnb","DEFAULT_SHEET_TIMEOUT","useCSSTransition","DEFAULT_HORIZONTAL_LAYOUT_TRANSITION_CLASSNAMES","appearDone","enter","enterActive","enterDone","exit","useHorizontalLayoutTransition","options","timeout","classNames","className"],"mappings":"AAAA;AAEA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAASC,qBAAqB,QAAQ,qBAAqB;AAO3D,SAASC,gBAAgB,QAAQ,oCAAoC;AAErE;;CAEC,GACD,OAAO,MAAMC,kDAAkD;IAC7DC,YAAY;IACZC,OAAO;IACPC,aAAa;IACbC,WAAW;IACXC,MAAM;AACR,EAA6C;AAmB7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCC,GACD,OAAO,SAASC,8BAEdC,OAA0C;IAC1C,OAAOR,iBAAiB;QACtBS,SAASV;QACTW,YAAYT;QACZ,GAAGO,OAAO;QACVG,WAAWb,IAAI,gBAAgBU,QAAQG,SAAS;IAClD;AACF"}
1
+ {"version":3,"sources":["../../src/layout/useHorizontalLayoutTransition.ts"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\n\nimport { DEFAULT_SHEET_TIMEOUT } from \"../sheet/styles.js\";\nimport {\n type CSSTransitionClassNames,\n type CSSTransitionHookReturnValue,\n type PreconfiguredCSSTransitionOptions,\n type TransitionTimeout,\n} from \"../transition/types.js\";\nimport { useCSSTransition } from \"../transition/useCSSTransition.js\";\n\n/**\n * @since 6.0.0\n */\nexport const DEFAULT_HORIZONTAL_LAYOUT_TRANSITION_CLASSNAMES = {\n appearDone: \"rmd-layout-h--active\",\n enter: \"rmd-layout-h--enter\",\n enterActive: \"rmd-layout-h--active\",\n enterDone: \"rmd-layout-h--active\",\n exit: \"rmd-layout-h--exit\",\n} as const satisfies CSSTransitionClassNames;\n\n/**\n * @since 6.0.0\n */\nexport interface HorizontalLayoutTransitionOptions extends PreconfiguredCSSTransitionOptions<HTMLElement> {\n /**\n * @see {@link DEFAULT_SHEET_TIMEOUT}\n * @defaultValue `DEFAULT_SHEET_TIMEOUT`\n */\n timeout?: TransitionTimeout;\n /**\n * @see {@link DEFAULT_HORIZONTAL_LAYOUT_TRANSITION_CLASSNAMES}\n * @defaultValue `DEFAULT_HORIZONTAL_LAYOUT_TRANSITION_CLASSNAMES`\n */\n classNames?: CSSTransitionClassNames;\n}\n\n/**\n * @example\n * ```tsx\n * import { LayoutAppBar } from \"@react-md/core/layout/LayoutAppBar\";\n * import { Main } from \"@react-md/core/layout/Main\";\n * import { useHorizontalLayoutTransition } from \"@react-md/core/layout/useHorizontalLayoutTransition\";\n * import type { ReactElement, ReactNode } from \"react\";\n *\n * interface Props {\n * title: ReactNode;\n * children: ReactNode;\n * }\n *\n * export default function Example({ title, children }: Props): ReactElement {\n * const { toggled: staticNavExpanded, toggle: toggleStaticNav } = useToggle();\n * const { elementProps, className } = useHorizontalLayoutTransition({\n * transitionIn: staticNavExpanded,\n * });\n *\n * return (\n * <>\n * <LayoutAppBar className={className}>\n * <Button\n * aria-label=\"Navigation\"\n * buttonType=\"icon\"\n * onClick={toggleStaticNav}\n * >\n * <MenuOutlinedIcon />\n * '</Button>\n * {title}\n * </LayoutAppBar>\n * <Main {...elementProps}>\n * {children}\n * </Main>\n * </>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/getting-started/layout | Layout Demos}\n * @since 6.0.0\n */\nexport function useHorizontalLayoutTransition<\n E extends HTMLElement = HTMLElement,\n>(options: HorizontalLayoutTransitionOptions): CSSTransitionHookReturnValue<E> {\n return useCSSTransition({\n timeout: DEFAULT_SHEET_TIMEOUT,\n classNames: DEFAULT_HORIZONTAL_LAYOUT_TRANSITION_CLASSNAMES,\n ...options,\n className: cnb(\"rmd-layout-h\", options.className),\n });\n}\n"],"names":["cnb","DEFAULT_SHEET_TIMEOUT","useCSSTransition","DEFAULT_HORIZONTAL_LAYOUT_TRANSITION_CLASSNAMES","appearDone","enter","enterActive","enterDone","exit","useHorizontalLayoutTransition","options","timeout","classNames","className"],"mappings":"AAAA;AAEA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAASC,qBAAqB,QAAQ,qBAAqB;AAO3D,SAASC,gBAAgB,QAAQ,oCAAoC;AAErE;;CAEC,GACD,OAAO,MAAMC,kDAAkD;IAC7DC,YAAY;IACZC,OAAO;IACPC,aAAa;IACbC,WAAW;IACXC,MAAM;AACR,EAA6C;AAkB7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCC,GACD,OAAO,SAASC,8BAEdC,OAA0C;IAC1C,OAAOR,iBAAiB;QACtBS,SAASV;QACTW,YAAYT;QACZ,GAAGO,OAAO;QACVG,WAAWb,IAAI,gBAAgBU,QAAQG,SAAS;IAClD;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/layout/useLayoutTree.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo } from \"react\";\n\nimport { type TreeProps } from \"../tree/Tree.js\";\nimport {\n type DefaultTreeItemNode,\n type TreeData,\n type TreeDefaultIds,\n type TreeItemNode,\n} from \"../tree/types.js\";\nimport { type TreeImplementation } from \"../tree/useTree.js\";\nimport { useTreeExpansion } from \"../tree/useTreeExpansion.js\";\nimport { getTreeItemsFrom } from \"../tree/utils.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @internal\n */\nconst getParentIds = (\n itemId: string,\n navItems: TreeData<TreeItemNode>\n): readonly string[] =>\n getTreeItemsFrom(navItems, itemId).map(({ itemId }) => itemId);\n\n/**\n * @since 6.0.0 Removed the `linkComponent` option.\n */\nexport interface LayoutTreeOptions<\n T extends TreeItemNode = DefaultTreeItemNode,\n> {\n /**\n * The current pathname which is used as the tree `itemId`.\n */\n pathname: string;\n\n /**\n * @example\n * ```tsx\n * const navItems = {\n * \"/\": {\n * itemId: \"/\",\n * parentId: null,\n * children: \"Home\",\n * leftAddon: <HomeIcon />,\n * to: \"/\",\n * },\n * \"/route-1\": {\n * itemId: \"/route-1\",\n * parentId: null,\n * children: \"Route 1\",\n * leftAddon: <TvIcon />,\n * to: \"/route-1\",\n * },\n * \"/route-2\": {\n * itemId: \"/route-2\",\n * parentId: null,\n * children: \"Route 2\",\n * leftAddon: <AppsIcon />,\n * to: \"/route-2\",\n * },\n * \"/route-3\": {\n * itemId: \"/route-3\",\n * parentId: null,\n * children: \"Route 3\",\n * leftAddon: <BookIcon />,\n * to: \"/route-3\",\n * },\n * } satisfies TreeData;\n * ```\n */\n navItems: TreeData<T>;\n\n /**\n * @defaultValue `getParentIds(pathname, navItems)`\n */\n defaultExpandedIds?: TreeDefaultIds;\n}\n\n/**\n * @since 6.0.0 Renamed from `LayoutNavigationState`, removed the\n * `linkComponent`, and remap `navItems` to `data` so it can be passed to the\n * `Tree` component.\n */\nexport interface LayoutTreeImplementation<\n T extends TreeItemNode = DefaultTreeItemNode,\n> extends Pick<TreeProps<T>, \"data\">,\n TreeImplementation {}\n\n/**\n * Before considering to use a `Tree` for site navigation, it is important to\n * understand:\n * - There is a lot of functionality required to implement the tree widget so\n * your bundle size will increase\n * - A pattern more suited for typical site navigation with expandable groups of\n * links is the disclosure pattern.\n * - @see https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/\n *\n * @see https://www.w3.org/WAI/ARIA/apg/patterns/treeview/examples/treeview-navigation/\n *\n * This is a pretty reasonable default implementation for having a navigation\n * tree within the Layout component. The way it'll work is that the current\n * route will be the only selected item within the tree. When the pathname\n * changes, the selectedIds will be updated to only be the current pathname once\n * again.\n *\n * This means that you can use whatever routing library or history provider that\n * ensures that your layout re-renders on a path change.\n *\n * @example\n * ```tsx\n * import { useLayoutTree } from \"@react-md/core/layout/useLayoutTree\"\n * import { Tree } from \"@react-md/core/tree/Tree\";\n * import { type TreeData } from \"@react-md/core/tree/types\";\n * import { type ReactElement } from \"react\";\n *\n * // choose your routing library...\n * import { Link, useLocation } from \"react-router\";\n *\n * const navItems = {\n * \"/\": {\n * itemId: \"/\",\n * parentId: null,\n * children: \"Home\",\n * leftAddon: <HomeIcon />,\n * to: \"/\",\n * },\n * \"/route-1\": {\n * itemId: \"/route-1\",\n * parentId: null,\n * children: \"Route 1\",\n * leftAddon: <TvIcon />,\n * to: \"/route-1\",\n * },\n * \"/route-2\": {\n * itemId: \"/route-2\",\n * parentId: null,\n * children: \"Route 2\",\n * leftAddon: <AppsIcon />,\n * to: \"/route-2\",\n * },\n * \"/route-3\": {\n * itemId: \"/route-3\",\n * parentId: null,\n * children: \"Route 3\",\n * leftAddon: <BookIcon />,\n * to: \"/route-3\",\n * },\n * } satisfies TreeData;\n *\n * function Example(): ReactElement {\n * const { pathname } = useLocation();\n * const tree = useLayoutTree({\n * navItems,\n * pathname,\n * });\n *\n * return (\n * <Tree\n * {...tree}\n * aria-label=\"Navigation\"\n * linkComponent={Link}\n * />\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/getting-started/layout | Layout Demos}\n * @see {@link https://react-md.dev/components/tree | Tree Demos}\n * @see {@link https://react-md.dev/hooks/use-layout-tree | useLayoutTree Demos}\n * @since 6.0.0 Renamed from `useLayoutNavigation`.\n */\nexport function useLayoutTree(\n options: LayoutTreeOptions\n): LayoutTreeImplementation {\n const { defaultExpandedIds, navItems, pathname } = options;\n\n const selectedIds = useMemo(() => new Set([pathname]), [pathname]);\n const { expandedIds, expandMultipleTreeItems, toggleTreeItemExpansion } =\n useTreeExpansion(\n defaultExpandedIds ?? (() => getParentIds(pathname, navItems))\n );\n\n useEffect(() => {\n expandMultipleTreeItems((prevExpandedIds) => {\n const nextExpandedIds = new Set([\n ...prevExpandedIds,\n ...getParentIds(pathname, navItems),\n ]);\n\n return nextExpandedIds;\n });\n }, [expandMultipleTreeItems, pathname, navItems]);\n\n return {\n data: navItems,\n multiSelect: false,\n selectedIds,\n expandedIds,\n expandMultipleTreeItems,\n toggleTreeItemExpansion,\n toggleTreeItemSelection: noop,\n selectMultipleTreeItems: noop,\n };\n}\n"],"names":["useEffect","useMemo","useTreeExpansion","getTreeItemsFrom","noop","getParentIds","itemId","navItems","map","useLayoutTree","options","defaultExpandedIds","pathname","selectedIds","Set","expandedIds","expandMultipleTreeItems","toggleTreeItemExpansion","prevExpandedIds","nextExpandedIds","data","multiSelect","toggleTreeItemSelection","selectMultipleTreeItems"],"mappings":"AAAA;AAEA,SAASA,SAAS,EAAEC,OAAO,QAAQ,QAAQ;AAU3C,SAASC,gBAAgB,QAAQ,8BAA8B;AAC/D,SAASC,gBAAgB,QAAQ,mBAAmB;AAEpD,MAAMC,OAAO;AACX,aAAa;AACf;AAEA;;CAEC,GACD,MAAMC,eAAe,CACnBC,QACAC,WAEAJ,iBAAiBI,UAAUD,QAAQE,GAAG,CAAC,CAAC,EAAEF,MAAM,EAAE,GAAKA;AAkEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFC,GACD,OAAO,SAASG,cACdC,OAA0B;IAE1B,MAAM,EAAEC,kBAAkB,EAAEJ,QAAQ,EAAEK,QAAQ,EAAE,GAAGF;IAEnD,MAAMG,cAAcZ,QAAQ,IAAM,IAAIa,IAAI;YAACF;SAAS,GAAG;QAACA;KAAS;IACjE,MAAM,EAAEG,WAAW,EAAEC,uBAAuB,EAAEC,uBAAuB,EAAE,GACrEf,iBACES,sBAAuB,CAAA,IAAMN,aAAaO,UAAUL,SAAQ;IAGhEP,UAAU;QACRgB,wBAAwB,CAACE;YACvB,MAAMC,kBAAkB,IAAIL,IAAI;mBAC3BI;mBACAb,aAAaO,UAAUL;aAC3B;YAED,OAAOY;QACT;IACF,GAAG;QAACH;QAAyBJ;QAAUL;KAAS;IAEhD,OAAO;QACLa,MAAMb;QACNc,aAAa;QACbR;QACAE;QACAC;QACAC;QACAK,yBAAyBlB;QACzBmB,yBAAyBnB;IAC3B;AACF"}
1
+ {"version":3,"sources":["../../src/layout/useLayoutTree.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo } from \"react\";\n\nimport { type TreeProps } from \"../tree/Tree.js\";\nimport {\n type DefaultTreeItemNode,\n type TreeData,\n type TreeDefaultIds,\n type TreeItemNode,\n} from \"../tree/types.js\";\nimport { type TreeImplementation } from \"../tree/useTree.js\";\nimport { useTreeExpansion } from \"../tree/useTreeExpansion.js\";\nimport { getTreeItemsFrom } from \"../tree/utils.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @internal\n */\nconst getParentIds = (\n itemId: string,\n navItems: TreeData<TreeItemNode>\n): readonly string[] =>\n getTreeItemsFrom(navItems, itemId).map(({ itemId }) => itemId);\n\n/**\n * @since 6.0.0 Removed the `linkComponent` option.\n */\nexport interface LayoutTreeOptions<\n T extends TreeItemNode = DefaultTreeItemNode,\n> {\n /**\n * The current pathname which is used as the tree `itemId`.\n */\n pathname: string;\n\n /**\n * @example\n * ```tsx\n * const navItems = {\n * \"/\": {\n * itemId: \"/\",\n * parentId: null,\n * children: \"Home\",\n * leftAddon: <HomeIcon />,\n * to: \"/\",\n * },\n * \"/route-1\": {\n * itemId: \"/route-1\",\n * parentId: null,\n * children: \"Route 1\",\n * leftAddon: <TvIcon />,\n * to: \"/route-1\",\n * },\n * \"/route-2\": {\n * itemId: \"/route-2\",\n * parentId: null,\n * children: \"Route 2\",\n * leftAddon: <AppsIcon />,\n * to: \"/route-2\",\n * },\n * \"/route-3\": {\n * itemId: \"/route-3\",\n * parentId: null,\n * children: \"Route 3\",\n * leftAddon: <BookIcon />,\n * to: \"/route-3\",\n * },\n * } satisfies TreeData;\n * ```\n */\n navItems: TreeData<T>;\n\n /**\n * @defaultValue `getParentIds(pathname, navItems)`\n */\n defaultExpandedIds?: TreeDefaultIds;\n}\n\n/**\n * @since 6.0.0 Renamed from `LayoutNavigationState`, removed the\n * `linkComponent`, and remap `navItems` to `data` so it can be passed to the\n * `Tree` component.\n */\nexport interface LayoutTreeImplementation<\n T extends TreeItemNode = DefaultTreeItemNode,\n>\n extends Pick<TreeProps<T>, \"data\">, TreeImplementation {}\n\n/**\n * Before considering to use a `Tree` for site navigation, it is important to\n * understand:\n * - There is a lot of functionality required to implement the tree widget so\n * your bundle size will increase\n * - A pattern more suited for typical site navigation with expandable groups of\n * links is the disclosure pattern.\n * - @see https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/\n *\n * @see https://www.w3.org/WAI/ARIA/apg/patterns/treeview/examples/treeview-navigation/\n *\n * This is a pretty reasonable default implementation for having a navigation\n * tree within the Layout component. The way it'll work is that the current\n * route will be the only selected item within the tree. When the pathname\n * changes, the selectedIds will be updated to only be the current pathname once\n * again.\n *\n * This means that you can use whatever routing library or history provider that\n * ensures that your layout re-renders on a path change.\n *\n * @example\n * ```tsx\n * import { useLayoutTree } from \"@react-md/core/layout/useLayoutTree\"\n * import { Tree } from \"@react-md/core/tree/Tree\";\n * import { type TreeData } from \"@react-md/core/tree/types\";\n * import { type ReactElement } from \"react\";\n *\n * // choose your routing library...\n * import { Link, useLocation } from \"react-router\";\n *\n * const navItems = {\n * \"/\": {\n * itemId: \"/\",\n * parentId: null,\n * children: \"Home\",\n * leftAddon: <HomeIcon />,\n * to: \"/\",\n * },\n * \"/route-1\": {\n * itemId: \"/route-1\",\n * parentId: null,\n * children: \"Route 1\",\n * leftAddon: <TvIcon />,\n * to: \"/route-1\",\n * },\n * \"/route-2\": {\n * itemId: \"/route-2\",\n * parentId: null,\n * children: \"Route 2\",\n * leftAddon: <AppsIcon />,\n * to: \"/route-2\",\n * },\n * \"/route-3\": {\n * itemId: \"/route-3\",\n * parentId: null,\n * children: \"Route 3\",\n * leftAddon: <BookIcon />,\n * to: \"/route-3\",\n * },\n * } satisfies TreeData;\n *\n * function Example(): ReactElement {\n * const { pathname } = useLocation();\n * const tree = useLayoutTree({\n * navItems,\n * pathname,\n * });\n *\n * return (\n * <Tree\n * {...tree}\n * aria-label=\"Navigation\"\n * linkComponent={Link}\n * />\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/getting-started/layout | Layout Demos}\n * @see {@link https://react-md.dev/components/tree | Tree Demos}\n * @see {@link https://react-md.dev/hooks/use-layout-tree | useLayoutTree Demos}\n * @since 6.0.0 Renamed from `useLayoutNavigation`.\n */\nexport function useLayoutTree(\n options: LayoutTreeOptions\n): LayoutTreeImplementation {\n const { defaultExpandedIds, navItems, pathname } = options;\n\n const selectedIds = useMemo(() => new Set([pathname]), [pathname]);\n const { expandedIds, expandMultipleTreeItems, toggleTreeItemExpansion } =\n useTreeExpansion(\n defaultExpandedIds ?? (() => getParentIds(pathname, navItems))\n );\n\n useEffect(() => {\n expandMultipleTreeItems((prevExpandedIds) => {\n const nextExpandedIds = new Set([\n ...prevExpandedIds,\n ...getParentIds(pathname, navItems),\n ]);\n\n return nextExpandedIds;\n });\n }, [expandMultipleTreeItems, pathname, navItems]);\n\n return {\n data: navItems,\n multiSelect: false,\n selectedIds,\n expandedIds,\n expandMultipleTreeItems,\n toggleTreeItemExpansion,\n toggleTreeItemSelection: noop,\n selectMultipleTreeItems: noop,\n };\n}\n"],"names":["useEffect","useMemo","useTreeExpansion","getTreeItemsFrom","noop","getParentIds","itemId","navItems","map","useLayoutTree","options","defaultExpandedIds","pathname","selectedIds","Set","expandedIds","expandMultipleTreeItems","toggleTreeItemExpansion","prevExpandedIds","nextExpandedIds","data","multiSelect","toggleTreeItemSelection","selectMultipleTreeItems"],"mappings":"AAAA;AAEA,SAASA,SAAS,EAAEC,OAAO,QAAQ,QAAQ;AAU3C,SAASC,gBAAgB,QAAQ,8BAA8B;AAC/D,SAASC,gBAAgB,QAAQ,mBAAmB;AAEpD,MAAMC,OAAO;AACX,aAAa;AACf;AAEA;;CAEC,GACD,MAAMC,eAAe,CACnBC,QACAC,WAEAJ,iBAAiBI,UAAUD,QAAQE,GAAG,CAAC,CAAC,EAAEF,MAAM,EAAE,GAAKA;AAkEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFC,GACD,OAAO,SAASG,cACdC,OAA0B;IAE1B,MAAM,EAAEC,kBAAkB,EAAEJ,QAAQ,EAAEK,QAAQ,EAAE,GAAGF;IAEnD,MAAMG,cAAcZ,QAAQ,IAAM,IAAIa,IAAI;YAACF;SAAS,GAAG;QAACA;KAAS;IACjE,MAAM,EAAEG,WAAW,EAAEC,uBAAuB,EAAEC,uBAAuB,EAAE,GACrEf,iBACES,sBAAuB,CAAA,IAAMN,aAAaO,UAAUL,SAAQ;IAGhEP,UAAU;QACRgB,wBAAwB,CAACE;YACvB,MAAMC,kBAAkB,IAAIL,IAAI;mBAC3BI;mBACAb,aAAaO,UAAUL;aAC3B;YAED,OAAOY;QACT;IACF,GAAG;QAACH;QAAyBJ;QAAUL;KAAS;IAEhD,OAAO;QACLa,MAAMb;QACNc,aAAa;QACbR;QACAE;QACAC;QACAC;QACAK,yBAAyBlB;QACzBmB,yBAAyBnB;IAC3B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/layout/useLayoutWindowSplitter.ts"],"sourcesContent":["\"use client\";\n\nimport { type UncontrolledDraggableOptions } from \"../draggable/useDraggable.js\";\nimport { type UseStateInitializer } from \"../types.js\";\nimport { useWindowSize } from \"../useWindowSize.js\";\nimport {\n type WindowSplitterImplementation,\n type WindowSplitterOptions,\n type WindowSplitterWidgetProps,\n useWindowSplitter,\n} from \"../window-splitter/useWindowSplitter.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface LayoutWindowSplitterOptions\n extends Omit<WindowSplitterOptions, \"min\" | \"max\"> {\n /**\n * @see {@link WindowSplitterOptions.min}\n * @defaultValue `96`\n */\n min?: number;\n\n /**\n * This is the minimum max value that can be allowed while resizing the\n * browser. I don't know the best way to describe it, but the `max` value is\n * determined by:\n *\n * ```ts\n * const { width } = useWindowSize({ disableHeight: true });\n * const max = Math.max(maxMinimum, width * windowPercentage);\n * ```\n *\n * @defaultValue `600`\n */\n maxMinimum?: number;\n\n /**\n * This will be multiplied by the current window's width to determine the\n * dynamic max value for the window splitter.\n *\n * @see {@link maxMinimum}\n * @defaultValue `0.45`\n */\n windowPercentage?: number;\n\n /** @defaultValue `256` */\n defaultValue?: UseStateInitializer<number>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ProvidedLayoutWindowSplitterProps\n extends WindowSplitterWidgetProps<HTMLButtonElement> {\n /** @defaultValue {@link WindowSplitterImplementation.value} */\n navWidth: number;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface LayoutWindowSplitterImplementation\n extends WindowSplitterImplementation {\n splitterProps: ProvidedLayoutWindowSplitterProps;\n}\n\n/**\n * A custom window splitter implementation to be used with the\n * `LayoutWindowSplitter` that will dynamically configure the max width to be a\n * percentage of the current window's width.\n *\n * Note: This will automatically save the width in local storage as\n * `\"navWidth\"`. See the example below if you do not want to use local storage.\n *\n * @example Without this hook\n * ```tsx\n * import { type ProvidedLayoutWindowSplitterProps } from \"@react-md/core/layout/useLayoutWindowSplitter\";\n * import { useWindowSplitter } from \"@react-md/core/window-splitter/useWindowSplitter\";\n * import { useWindowSize } from \"@react-md/core/useWindowSize.js\";\n *\n * export function useMyLayoutWindowSplitter(): ProvidedLayoutWindowSplitterProps {\n * const { width } = useWindowSize({ disableHeight: true });\n * const { splitterProps, value } = useWindowSplitter({\n * min: 96,\n * max: Math.max(maxMinimum, width * 0.45),\n * maxMinimum: 600,\n * });\n *\n * return {\n * ...splitterProps,\n * navWidth: value,\n * };\n * }\n *\n * function MyLayout() {\n * const splitterProps = useMyLayoutWindowSplitter();\n *\n * return (\n * <LayoutWindowSplitter\n * {...splitterProps}\n * aria-controls=\"layout-nav-id\"\n * />\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/getting-started/layout | Layout Demos}\n * @see {@link useResizableLayout} For a pre-built solution.\n * @since 6.0.0\n */\nexport function useLayoutWindowSplitter(\n options: LayoutWindowSplitterOptions = {}\n): LayoutWindowSplitterImplementation {\n const {\n min = 96,\n maxMinimum = 600,\n windowPercentage = 0.45,\n defaultValue = 256,\n ...remaining\n } = options;\n const { width } = useWindowSize({ disableHeight: true });\n const implementation = useWindowSplitter({\n min,\n max: Math.max(maxMinimum, width * windowPercentage),\n defaultValue,\n // type cast so it doesn't complain about defaultValue being provided with\n // value. That's mostly for public api usage\n ...(remaining as UncontrolledDraggableOptions),\n });\n\n return {\n ...implementation,\n splitterProps: {\n ...implementation.splitterProps,\n navWidth: implementation.value,\n },\n };\n}\n"],"names":["useWindowSize","useWindowSplitter","useLayoutWindowSplitter","options","min","maxMinimum","windowPercentage","defaultValue","remaining","width","disableHeight","implementation","max","Math","splitterProps","navWidth","value"],"mappings":"AAAA;AAIA,SAASA,aAAa,QAAQ,sBAAsB;AACpD,SAIEC,iBAAiB,QACZ,0CAA0C;AAyDjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GACD,OAAO,SAASC,wBACdC,UAAuC,CAAC,CAAC;IAEzC,MAAM,EACJC,MAAM,EAAE,EACRC,aAAa,GAAG,EAChBC,mBAAmB,IAAI,EACvBC,eAAe,GAAG,EAClB,GAAGC,WACJ,GAAGL;IACJ,MAAM,EAAEM,KAAK,EAAE,GAAGT,cAAc;QAAEU,eAAe;IAAK;IACtD,MAAMC,iBAAiBV,kBAAkB;QACvCG;QACAQ,KAAKC,KAAKD,GAAG,CAACP,YAAYI,QAAQH;QAClCC;QACA,0EAA0E;QAC1E,4CAA4C;QAC5C,GAAIC,SAAS;IACf;IAEA,OAAO;QACL,GAAGG,cAAc;QACjBG,eAAe;YACb,GAAGH,eAAeG,aAAa;YAC/BC,UAAUJ,eAAeK,KAAK;QAChC;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/layout/useLayoutWindowSplitter.ts"],"sourcesContent":["\"use client\";\n\nimport { type UncontrolledDraggableOptions } from \"../draggable/useDraggable.js\";\nimport { type UseStateInitializer } from \"../types.js\";\nimport { useWindowSize } from \"../useWindowSize.js\";\nimport {\n type WindowSplitterImplementation,\n type WindowSplitterOptions,\n type WindowSplitterWidgetProps,\n useWindowSplitter,\n} from \"../window-splitter/useWindowSplitter.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface LayoutWindowSplitterOptions extends Omit<\n WindowSplitterOptions,\n \"min\" | \"max\"\n> {\n /**\n * @see {@link WindowSplitterOptions.min}\n * @defaultValue `96`\n */\n min?: number;\n\n /**\n * This is the minimum max value that can be allowed while resizing the\n * browser. I don't know the best way to describe it, but the `max` value is\n * determined by:\n *\n * ```ts\n * const { width } = useWindowSize({ disableHeight: true });\n * const max = Math.max(maxMinimum, width * windowPercentage);\n * ```\n *\n * @defaultValue `600`\n */\n maxMinimum?: number;\n\n /**\n * This will be multiplied by the current window's width to determine the\n * dynamic max value for the window splitter.\n *\n * @see {@link maxMinimum}\n * @defaultValue `0.45`\n */\n windowPercentage?: number;\n\n /** @defaultValue `256` */\n defaultValue?: UseStateInitializer<number>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ProvidedLayoutWindowSplitterProps extends WindowSplitterWidgetProps<HTMLButtonElement> {\n /** @defaultValue {@link WindowSplitterImplementation.value} */\n navWidth: number;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface LayoutWindowSplitterImplementation extends WindowSplitterImplementation {\n splitterProps: ProvidedLayoutWindowSplitterProps;\n}\n\n/**\n * A custom window splitter implementation to be used with the\n * `LayoutWindowSplitter` that will dynamically configure the max width to be a\n * percentage of the current window's width.\n *\n * Note: This will automatically save the width in local storage as\n * `\"navWidth\"`. See the example below if you do not want to use local storage.\n *\n * @example Without this hook\n * ```tsx\n * import { type ProvidedLayoutWindowSplitterProps } from \"@react-md/core/layout/useLayoutWindowSplitter\";\n * import { useWindowSplitter } from \"@react-md/core/window-splitter/useWindowSplitter\";\n * import { useWindowSize } from \"@react-md/core/useWindowSize.js\";\n *\n * export function useMyLayoutWindowSplitter(): ProvidedLayoutWindowSplitterProps {\n * const { width } = useWindowSize({ disableHeight: true });\n * const { splitterProps, value } = useWindowSplitter({\n * min: 96,\n * max: Math.max(maxMinimum, width * 0.45),\n * maxMinimum: 600,\n * });\n *\n * return {\n * ...splitterProps,\n * navWidth: value,\n * };\n * }\n *\n * function MyLayout() {\n * const splitterProps = useMyLayoutWindowSplitter();\n *\n * return (\n * <LayoutWindowSplitter\n * {...splitterProps}\n * aria-controls=\"layout-nav-id\"\n * />\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/getting-started/layout | Layout Demos}\n * @see {@link useResizableLayout} For a pre-built solution.\n * @since 6.0.0\n */\nexport function useLayoutWindowSplitter(\n options: LayoutWindowSplitterOptions = {}\n): LayoutWindowSplitterImplementation {\n const {\n min = 96,\n maxMinimum = 600,\n windowPercentage = 0.45,\n defaultValue = 256,\n ...remaining\n } = options;\n const { width } = useWindowSize({ disableHeight: true });\n const implementation = useWindowSplitter({\n min,\n max: Math.max(maxMinimum, width * windowPercentage),\n defaultValue,\n // type cast so it doesn't complain about defaultValue being provided with\n // value. That's mostly for public api usage\n ...(remaining as UncontrolledDraggableOptions),\n });\n\n return {\n ...implementation,\n splitterProps: {\n ...implementation.splitterProps,\n navWidth: implementation.value,\n },\n };\n}\n"],"names":["useWindowSize","useWindowSplitter","useLayoutWindowSplitter","options","min","maxMinimum","windowPercentage","defaultValue","remaining","width","disableHeight","implementation","max","Math","splitterProps","navWidth","value"],"mappings":"AAAA;AAIA,SAASA,aAAa,QAAQ,sBAAsB;AACpD,SAIEC,iBAAiB,QACZ,0CAA0C;AAyDjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GACD,OAAO,SAASC,wBACdC,UAAuC,CAAC,CAAC;IAEzC,MAAM,EACJC,MAAM,EAAE,EACRC,aAAa,GAAG,EAChBC,mBAAmB,IAAI,EACvBC,eAAe,GAAG,EAClB,GAAGC,WACJ,GAAGL;IACJ,MAAM,EAAEM,KAAK,EAAE,GAAGT,cAAc;QAAEU,eAAe;IAAK;IACtD,MAAMC,iBAAiBV,kBAAkB;QACvCG;QACAQ,KAAKC,KAAKD,GAAG,CAACP,YAAYI,QAAQH;QAClCC;QACA,0EAA0E;QAC1E,4CAA4C;QAC5C,GAAIC,SAAS;IACf;IAEA,OAAO;QACL,GAAGG,cAAc;QACjBG,eAAe;YACb,GAAGH,eAAeG,aAAa;YAC/BC,UAAUJ,eAAeK,KAAK;QAChC;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/layout/useResizableLayout.ts"],"sourcesContent":["import { useEnsuredId } from \"../useEnsuredId.js\";\nimport { DISPLAY_NONE_CLASS } from \"../utils/isElementVisible.js\";\nimport { type LayoutWindowSplitterProps } from \"./LayoutWindowSplitter.js\";\nimport {\n type ExpandableLayoutImplementation,\n type ExpandableLayoutOptions,\n type ProvidedLayoutNavProps,\n} from \"./useExpandableLayout.js\";\nimport { useExpandableLayout } from \"./useExpandableLayout.js\";\nimport {\n type LayoutWindowSplitterOptions,\n useLayoutWindowSplitter,\n} from \"./useLayoutWindowSplitter.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface ResizableLayoutOptions\n extends ExpandableLayoutOptions,\n LayoutWindowSplitterOptions {\n /**\n * This id will be used as the `aria-controls` prop for the\n * `LayoutWindowSplitter` and should be applied to the `LayoutNav` as an `id`.\n *\n * @defaultValue `\"layout-nav\" + useId()`\n */\n navId?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ProvidedResizableLayoutNavProps\n extends ProvidedLayoutNavProps {\n id: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ResizableLayoutImplementation\n extends ExpandableLayoutImplementation {\n expandableNavProps: ProvidedResizableLayoutNavProps;\n windowSplitterProps: LayoutWindowSplitterProps;\n}\n\n/**\n * @example Main Usage\n * ```tsx\n * import { AppBarTitle } from \"@react-md/core/app-bar/AppBarTitle\";\n * import { Button } from \"@react-md/core/button/Button\";\n * import { LayoutAppBar } from \"@react-md/core/layout/LayoutAppBar\";\n * import { LayoutNav } from \"@react-md/core/layout/LayoutNav\";\n * import { LayoutWindowSplitter } from \"@react-md/core/layout/LayoutWindowSplitter\";\n * import { Main } from \"@react-md/core/layout/Main\";\n * import { useResizableLayout } from \"@react-md/core/layout/useResizableLayout\";\n * import { Sheet } from \"@react-md/core/sheet/Sheet\";\n * import { type ReactElement, type ReactNode } from \"react\";\n *\n * import { CustomNavigation } from \"./CustomNavigation\";\n *\n * export interface LayoutProps {\n * children: ReactNode;\n * }\n *\n * export function Layout(props: LayoutProps): ReactElement {\n * const { children } = props;\n *\n * // choose whichever one for your app\n * // nextjs app dir\n * const pathname = usePathname();\n * // nextjs pages\n * const { pathname } = useRouter();\n * // react router\n * const { pathname } = useHistory();\n *\n * const {\n * temporary,\n * appBarProps,\n * expandableNavProps,\n * mainProps,\n * navToggleProps,\n * temporaryNavProps,\n * windowSplitterProps,\n * } = useResizableLayout({ pathname });\n *\n * return (\n * <>\n * <LayoutAppBar {...appBarProps}>\n * <Button {...navToggleProps} />\n * <AppBarTitle>Hello, world!</AppBarTitle>\n * </LayoutAppBar>\n * <LayoutNav {...expandableNavProps}>\n * <CustomNavigation />\n * </LayoutNav>\n * <LayoutWindowSplitter {...windowSplitterProps} />\n * {temporary && (\n * <Sheet {...temporaryNavProps}>\n * <CustomNavigation />\n * </Sheet>\n * )}\n * <Main {...mainProps}>{children}</Main>\n * </>\n * );\n * }\n * ```\n *\n * If you have a large navigation panel, you can conditionally render the\n * `LayoutNav` with the `persistent` boolean returned by the hook which will\n * ensure that the DOM has rehydrated before unmounting to prevent SSR errors.\n *\n * @example Conditionally Rendering\n * ```diff\n * const {\n * temporary,\n * + persistent,\n * appBarProps,\n * expandableNavProps,\n * mainProps,\n * navToggleProps,\n * temporaryNavProps,\n * windowSplitterProps,\n * } = useResizableLayout({ pathname });\n *\n * return (\n * <>\n * <LayoutAppBar {...appBarProps}>\n * <Button {...navToggleProps} />\n * <AppBarTitle>Hello, world!</AppBarTitle>\n * </LayoutAppBar>\n * - <LayoutNav {...expandableNavProps}>\n * - <CustomNavigation />\n * - </LayoutNav>\n * - <LayoutWindowSplitter {...windowSplitterProps} />\n * + {persistent && (\n * + <>\n * + <LayoutNav {...expandableNavProps}>\n * + <CustomNavigation />\n * + </LayoutNav>\n * + <LayoutWindowSplitter {...windowSplitterProps} />\n * + </>\n * + )}\n * {temporary && (\n * <Sheet {...temporaryNavProps}>\n * <CustomNavigation />\n * </Sheet>\n * )}\n * <Main {...mainProps}>{children}</Main>\n * </>\n * )\n * ```\n *\n * @see {@link https://react-md.dev/getting-started/layout | Layout Demos}\n * @since 6.0.0\n */\nexport function useResizableLayout(\n options: ResizableLayoutOptions\n): ResizableLayoutImplementation {\n const {\n navId: propNavId,\n pathname,\n appBarPosition = \"fixed\",\n fullHeightNav = false,\n temporaryUntil,\n defaultVisible,\n defaultExpanded,\n ...splitterOptions\n } = options;\n const navId = useEnsuredId(propNavId, \"layout-nav\");\n const { splitterProps, ...windowSplitter } =\n useLayoutWindowSplitter(splitterOptions);\n const expandableLayout = useExpandableLayout({\n pathname,\n appBarPosition,\n temporaryUntil,\n fullHeightNav,\n defaultExpanded,\n defaultVisible,\n });\n const { expandableNavProps, expanded } = expandableLayout;\n\n return {\n ...expandableLayout,\n ...windowSplitter,\n expandableNavProps: {\n id: navId,\n ...expandableNavProps,\n },\n windowSplitterProps: {\n ...splitterProps,\n \"aria-controls\": navId,\n appBarOffset: !fullHeightNav,\n className: (!expanded && DISPLAY_NONE_CLASS) || undefined,\n },\n };\n}\n"],"names":["useEnsuredId","DISPLAY_NONE_CLASS","useExpandableLayout","useLayoutWindowSplitter","useResizableLayout","options","navId","propNavId","pathname","appBarPosition","fullHeightNav","temporaryUntil","defaultVisible","defaultExpanded","splitterOptions","splitterProps","windowSplitter","expandableLayout","expandableNavProps","expanded","id","windowSplitterProps","appBarOffset","className","undefined"],"mappings":"AAAA,SAASA,YAAY,QAAQ,qBAAqB;AAClD,SAASC,kBAAkB,QAAQ,+BAA+B;AAOlE,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SAEEC,uBAAuB,QAClB,+BAA+B;AAkCtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4GC,GACD,OAAO,SAASC,mBACdC,OAA+B;IAE/B,MAAM,EACJC,OAAOC,SAAS,EAChBC,QAAQ,EACRC,iBAAiB,OAAO,EACxBC,gBAAgB,KAAK,EACrBC,cAAc,EACdC,cAAc,EACdC,eAAe,EACf,GAAGC,iBACJ,GAAGT;IACJ,MAAMC,QAAQN,aAAaO,WAAW;IACtC,MAAM,EAAEQ,aAAa,EAAE,GAAGC,gBAAgB,GACxCb,wBAAwBW;IAC1B,MAAMG,mBAAmBf,oBAAoB;QAC3CM;QACAC;QACAE;QACAD;QACAG;QACAD;IACF;IACA,MAAM,EAAEM,kBAAkB,EAAEC,QAAQ,EAAE,GAAGF;IAEzC,OAAO;QACL,GAAGA,gBAAgB;QACnB,GAAGD,cAAc;QACjBE,oBAAoB;YAClBE,IAAId;YACJ,GAAGY,kBAAkB;QACvB;QACAG,qBAAqB;YACnB,GAAGN,aAAa;YAChB,iBAAiBT;YACjBgB,cAAc,CAACZ;YACfa,WAAW,AAAC,CAACJ,YAAYlB,sBAAuBuB;QAClD;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/layout/useResizableLayout.ts"],"sourcesContent":["import { useEnsuredId } from \"../useEnsuredId.js\";\nimport { DISPLAY_NONE_CLASS } from \"../utils/isElementVisible.js\";\nimport { type LayoutWindowSplitterProps } from \"./LayoutWindowSplitter.js\";\nimport {\n type ExpandableLayoutImplementation,\n type ExpandableLayoutOptions,\n type ProvidedLayoutNavProps,\n} from \"./useExpandableLayout.js\";\nimport { useExpandableLayout } from \"./useExpandableLayout.js\";\nimport {\n type LayoutWindowSplitterOptions,\n useLayoutWindowSplitter,\n} from \"./useLayoutWindowSplitter.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface ResizableLayoutOptions\n extends ExpandableLayoutOptions, LayoutWindowSplitterOptions {\n /**\n * This id will be used as the `aria-controls` prop for the\n * `LayoutWindowSplitter` and should be applied to the `LayoutNav` as an `id`.\n *\n * @defaultValue `\"layout-nav\" + useId()`\n */\n navId?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ProvidedResizableLayoutNavProps extends ProvidedLayoutNavProps {\n id: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ResizableLayoutImplementation extends ExpandableLayoutImplementation {\n expandableNavProps: ProvidedResizableLayoutNavProps;\n windowSplitterProps: LayoutWindowSplitterProps;\n}\n\n/**\n * @example Main Usage\n * ```tsx\n * import { AppBarTitle } from \"@react-md/core/app-bar/AppBarTitle\";\n * import { Button } from \"@react-md/core/button/Button\";\n * import { LayoutAppBar } from \"@react-md/core/layout/LayoutAppBar\";\n * import { LayoutNav } from \"@react-md/core/layout/LayoutNav\";\n * import { LayoutWindowSplitter } from \"@react-md/core/layout/LayoutWindowSplitter\";\n * import { Main } from \"@react-md/core/layout/Main\";\n * import { useResizableLayout } from \"@react-md/core/layout/useResizableLayout\";\n * import { Sheet } from \"@react-md/core/sheet/Sheet\";\n * import { type ReactElement, type ReactNode } from \"react\";\n *\n * import { CustomNavigation } from \"./CustomNavigation\";\n *\n * export interface LayoutProps {\n * children: ReactNode;\n * }\n *\n * export function Layout(props: LayoutProps): ReactElement {\n * const { children } = props;\n *\n * // choose whichever one for your app\n * // nextjs app dir\n * const pathname = usePathname();\n * // nextjs pages\n * const { pathname } = useRouter();\n * // react router\n * const { pathname } = useHistory();\n *\n * const {\n * temporary,\n * appBarProps,\n * expandableNavProps,\n * mainProps,\n * navToggleProps,\n * temporaryNavProps,\n * windowSplitterProps,\n * } = useResizableLayout({ pathname });\n *\n * return (\n * <>\n * <LayoutAppBar {...appBarProps}>\n * <Button {...navToggleProps} />\n * <AppBarTitle>Hello, world!</AppBarTitle>\n * </LayoutAppBar>\n * <LayoutNav {...expandableNavProps}>\n * <CustomNavigation />\n * </LayoutNav>\n * <LayoutWindowSplitter {...windowSplitterProps} />\n * {temporary && (\n * <Sheet {...temporaryNavProps}>\n * <CustomNavigation />\n * </Sheet>\n * )}\n * <Main {...mainProps}>{children}</Main>\n * </>\n * );\n * }\n * ```\n *\n * If you have a large navigation panel, you can conditionally render the\n * `LayoutNav` with the `persistent` boolean returned by the hook which will\n * ensure that the DOM has rehydrated before unmounting to prevent SSR errors.\n *\n * @example Conditionally Rendering\n * ```diff\n * const {\n * temporary,\n * + persistent,\n * appBarProps,\n * expandableNavProps,\n * mainProps,\n * navToggleProps,\n * temporaryNavProps,\n * windowSplitterProps,\n * } = useResizableLayout({ pathname });\n *\n * return (\n * <>\n * <LayoutAppBar {...appBarProps}>\n * <Button {...navToggleProps} />\n * <AppBarTitle>Hello, world!</AppBarTitle>\n * </LayoutAppBar>\n * - <LayoutNav {...expandableNavProps}>\n * - <CustomNavigation />\n * - </LayoutNav>\n * - <LayoutWindowSplitter {...windowSplitterProps} />\n * + {persistent && (\n * + <>\n * + <LayoutNav {...expandableNavProps}>\n * + <CustomNavigation />\n * + </LayoutNav>\n * + <LayoutWindowSplitter {...windowSplitterProps} />\n * + </>\n * + )}\n * {temporary && (\n * <Sheet {...temporaryNavProps}>\n * <CustomNavigation />\n * </Sheet>\n * )}\n * <Main {...mainProps}>{children}</Main>\n * </>\n * )\n * ```\n *\n * @see {@link https://react-md.dev/getting-started/layout | Layout Demos}\n * @since 6.0.0\n */\nexport function useResizableLayout(\n options: ResizableLayoutOptions\n): ResizableLayoutImplementation {\n const {\n navId: propNavId,\n pathname,\n appBarPosition = \"fixed\",\n fullHeightNav = false,\n temporaryUntil,\n defaultVisible,\n defaultExpanded,\n ...splitterOptions\n } = options;\n const navId = useEnsuredId(propNavId, \"layout-nav\");\n const { splitterProps, ...windowSplitter } =\n useLayoutWindowSplitter(splitterOptions);\n const expandableLayout = useExpandableLayout({\n pathname,\n appBarPosition,\n temporaryUntil,\n fullHeightNav,\n defaultExpanded,\n defaultVisible,\n });\n const { expandableNavProps, expanded } = expandableLayout;\n\n return {\n ...expandableLayout,\n ...windowSplitter,\n expandableNavProps: {\n id: navId,\n ...expandableNavProps,\n },\n windowSplitterProps: {\n ...splitterProps,\n \"aria-controls\": navId,\n appBarOffset: !fullHeightNav,\n className: (!expanded && DISPLAY_NONE_CLASS) || undefined,\n },\n };\n}\n"],"names":["useEnsuredId","DISPLAY_NONE_CLASS","useExpandableLayout","useLayoutWindowSplitter","useResizableLayout","options","navId","propNavId","pathname","appBarPosition","fullHeightNav","temporaryUntil","defaultVisible","defaultExpanded","splitterOptions","splitterProps","windowSplitter","expandableLayout","expandableNavProps","expanded","id","windowSplitterProps","appBarOffset","className","undefined"],"mappings":"AAAA,SAASA,YAAY,QAAQ,qBAAqB;AAClD,SAASC,kBAAkB,QAAQ,+BAA+B;AAOlE,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SAEEC,uBAAuB,QAClB,+BAA+B;AA+BtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4GC,GACD,OAAO,SAASC,mBACdC,OAA+B;IAE/B,MAAM,EACJC,OAAOC,SAAS,EAChBC,QAAQ,EACRC,iBAAiB,OAAO,EACxBC,gBAAgB,KAAK,EACrBC,cAAc,EACdC,cAAc,EACdC,eAAe,EACf,GAAGC,iBACJ,GAAGT;IACJ,MAAMC,QAAQN,aAAaO,WAAW;IACtC,MAAM,EAAEQ,aAAa,EAAE,GAAGC,gBAAgB,GACxCb,wBAAwBW;IAC1B,MAAMG,mBAAmBf,oBAAoB;QAC3CM;QACAC;QACAE;QACAD;QACAG;QACAD;IACF;IACA,MAAM,EAAEM,kBAAkB,EAAEC,QAAQ,EAAE,GAAGF;IAEzC,OAAO;QACL,GAAGA,gBAAgB;QACnB,GAAGD,cAAc;QACjBE,oBAAoB;YAClBE,IAAId;YACJ,GAAGY,kBAAkB;QACvB;QACAG,qBAAqB;YACnB,GAAGN,aAAa;YAChB,iBAAiBT;YACjBgB,cAAc,CAACZ;YACfa,WAAW,AAAC,CAACJ,YAAYlB,sBAAuBuB;QAClD;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/link/Link.tsx"],"sourcesContent":["import {\n type AnchorHTMLAttributes,\n type ForwardRefExoticComponent,\n forwardRef,\n} from \"react\";\n\nimport { type LinkClassNameOptions, link } from \"./styles.js\";\n\n/**\n * @since 6.0.0\n */\nexport type CustomLinkComponent =\n | ForwardRefExoticComponent<{ href: string }>\n | ForwardRefExoticComponent<{ to: string }>\n | \"a\";\n\n/**\n * @since 6.0.0 Removed the `preventMaliciousTarget` prop since browsers\n * default to `rel=noopener` after updating the {@link https://github.com/whatwg/html/issues/4078|spec}.\n * @since 6.0.0 Removed the `component` prop since all you need for link\n * behavior is `className=\"rmd-link\"`.\n * @since 6.0.0 The `href` prop is required.\n * @since 6.0.0 Renamed `flexCentered` to `flex`.\n */\nexport interface LinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement>,\n LinkClassNameOptions {\n /**\n * All links **must** have a valid href.\n */\n href: string;\n\n /**\n * Set this to `true` if your link contains icons that should be centered and\n * spaced with additional text. This is not used by default so that links can\n * correctly line wrap while rendered within paragraphs of text.\n *\n * @defaultValue `false`\n */\n flex?: boolean;\n}\n\n/**\n * @example Simple Example\n * ```tsx\n * import { Link } from \"@react-md/core/link/Link\";\n * import { Typography } from \"@react-md/core/typography/Typography\";\n * import type { ReactElement } from \"react\";\n *\n * function Element(): ReactElement {\n * return (\n * <Typography>\n * Here is a paragraph of text with a {\" \"}\n * <Link href=\"/some-url\">link to some content</Link>.\n * </Typography>\n * );\n * }\n * ```\n *\n *\n * @see {@link https://react-md.dev/components/link | Link Demos}\n * @since 6.0.0 Removed the `preventMaliciousTarget` prop since browsers\n * default to `rel=noopener` after updating the {@link https://github.com/whatwg/html/issues/4078|spec}.\n * @since 6.0.0 Removed the `component` prop since all you need for link\n * behavior is `className=\"rmd-link\"`.\n * @since 6.0.0 The `href` prop is required.\n * @since 6.0.0 Renamed `flexCentered` to `flex`.\n */\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(\n function Link(props, ref) {\n const { className, flex, children, ...remaining } = props;\n\n return (\n <a {...remaining} ref={ref} className={link({ flex, className })}>\n {children}\n </a>\n );\n }\n);\n"],"names":["forwardRef","link","Link","props","ref","className","flex","children","remaining","a"],"mappings":";AAAA,SAGEA,UAAU,QACL,QAAQ;AAEf,SAAoCC,IAAI,QAAQ,cAAc;AAoC9D;;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,GACD,OAAO,MAAMC,qBAAOF,WAClB,SAASE,KAAKC,KAAK,EAAEC,GAAG;IACtB,MAAM,EAAEC,SAAS,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGC,WAAW,GAAGL;IAEpD,qBACE,KAACM;QAAG,GAAGD,SAAS;QAAEJ,KAAKA;QAAKC,WAAWJ,KAAK;YAAEK;YAAMD;QAAU;kBAC3DE;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/link/Link.tsx"],"sourcesContent":["import {\n type AnchorHTMLAttributes,\n type ForwardRefExoticComponent,\n forwardRef,\n} from \"react\";\n\nimport { type LinkClassNameOptions, link } from \"./styles.js\";\n\n/**\n * @since 6.0.0\n */\nexport type CustomLinkComponent =\n | ForwardRefExoticComponent<{ href: string }>\n | ForwardRefExoticComponent<{ to: string }>\n | \"a\";\n\n/**\n * @since 6.0.0 Removed the `preventMaliciousTarget` prop since browsers\n * default to `rel=noopener` after updating the {@link https://github.com/whatwg/html/issues/4078|spec}.\n * @since 6.0.0 Removed the `component` prop since all you need for link\n * behavior is `className=\"rmd-link\"`.\n * @since 6.0.0 The `href` prop is required.\n * @since 6.0.0 Renamed `flexCentered` to `flex`.\n */\nexport interface LinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement>, LinkClassNameOptions {\n /**\n * All links **must** have a valid href.\n */\n href: string;\n\n /**\n * Set this to `true` if your link contains icons that should be centered and\n * spaced with additional text. This is not used by default so that links can\n * correctly line wrap while rendered within paragraphs of text.\n *\n * @defaultValue `false`\n */\n flex?: boolean;\n}\n\n/**\n * @example Simple Example\n * ```tsx\n * import { Link } from \"@react-md/core/link/Link\";\n * import { Typography } from \"@react-md/core/typography/Typography\";\n * import type { ReactElement } from \"react\";\n *\n * function Element(): ReactElement {\n * return (\n * <Typography>\n * Here is a paragraph of text with a {\" \"}\n * <Link href=\"/some-url\">link to some content</Link>.\n * </Typography>\n * );\n * }\n * ```\n *\n *\n * @see {@link https://react-md.dev/components/link | Link Demos}\n * @since 6.0.0 Removed the `preventMaliciousTarget` prop since browsers\n * default to `rel=noopener` after updating the {@link https://github.com/whatwg/html/issues/4078|spec}.\n * @since 6.0.0 Removed the `component` prop since all you need for link\n * behavior is `className=\"rmd-link\"`.\n * @since 6.0.0 The `href` prop is required.\n * @since 6.0.0 Renamed `flexCentered` to `flex`.\n */\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(\n function Link(props, ref) {\n const { className, flex, children, ...remaining } = props;\n\n return (\n <a {...remaining} ref={ref} className={link({ flex, className })}>\n {children}\n </a>\n );\n }\n);\n"],"names":["forwardRef","link","Link","props","ref","className","flex","children","remaining","a"],"mappings":";AAAA,SAGEA,UAAU,QACL,QAAQ;AAEf,SAAoCC,IAAI,QAAQ,cAAc;AAmC9D;;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,GACD,OAAO,MAAMC,qBAAOF,WAClB,SAASE,KAAKC,KAAK,EAAEC,GAAG;IACtB,MAAM,EAAEC,SAAS,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGC,WAAW,GAAGL;IAEpD,qBACE,KAACM;QAAG,GAAGD,SAAS;QAAEJ,KAAKA;QAAKC,WAAWJ,KAAK;YAAEK;YAAMD;QAAU;kBAC3DE;;AAGP,GACA"}
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { forwardRef, useEffect, useRef } from "react";
3
+ import { forwardRef, useRef } from "react";
4
+ import { useDevEffect } from "../utils/useDevEffect.js";
4
5
  import { Link } from "./Link.js";
5
6
  import { skipToMainContent } from "./styles.js";
6
7
  const noop = ()=>{
@@ -44,28 +45,25 @@ const getMainElement = (mainId)=>mainId ? document.getElementById(mainId) : docu
44
45
  // want to warn the developer about missing main element in development
45
46
  // immediately to help prevent errors, but in production this can be lazy
46
47
  // initialized only once a keyboard user focuses and clicks this element
47
- if (process.env.NODE_ENV !== "production") {
48
- // eslint-disable-next-line react-hooks/rules-of-hooks
49
- useEffect(()=>{
50
- mainNodeRef.current = getMainElement(mainId);
51
- if (!mainNodeRef.current) {
52
- const foundMainId = document.querySelector('main,[role="main"]')?.id;
53
- let message = `Unable to find a main element to focus`;
54
- if (mainId) {
55
- message += ` with an id of "${mainId}"`;
56
- if (foundMainId) {
57
- message += ` but a main element was found with an id of "${foundMainId}".`;
58
- }
48
+ useDevEffect(()=>{
49
+ mainNodeRef.current = getMainElement(mainId);
50
+ if (!mainNodeRef.current) {
51
+ const foundMainId = document.querySelector('main,[role="main"]')?.id;
52
+ let message = `Unable to find a main element to focus`;
53
+ if (mainId) {
54
+ message += ` with an id of "${mainId}"`;
55
+ if (foundMainId) {
56
+ message += ` but a main element was found with an id of "${foundMainId}".`;
59
57
  }
60
- if (!foundMainId) {
61
- message += '. There should be at least one <main> element or an element with role="main" on the page for accessibility.';
62
- }
63
- throw new Error(message);
64
58
  }
65
- }, [
66
- mainId
67
- ]);
68
- }
59
+ if (!foundMainId) {
60
+ message += '. There should be at least one <main> element or an element with role="main" on the page for accessibility.';
61
+ }
62
+ throw new Error(message);
63
+ }
64
+ }, [
65
+ mainId
66
+ ]);
69
67
  return /*#__PURE__*/ _jsx(Link, {
70
68
  ...remaining,
71
69
  id: id,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/link/SkipToMainContent.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, forwardRef, useEffect, useRef } from \"react\";\n\nimport { Link, type LinkProps } from \"./Link.js\";\nimport {\n type SkipToMainContentClassNameOptions,\n skipToMainContent,\n} from \"./styles.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\nconst getMainElement = (mainId: string): HTMLElement | null =>\n mainId\n ? document.getElementById(mainId)\n : document.querySelector<HTMLElement>('main,[role=\"main\"]');\n\n/**\n * @since 6.0.0 The `mainId` is optional\n */\nexport interface SkipToMainContentProps\n extends Omit<LinkProps, \"href\">,\n SkipToMainContentClassNameOptions {\n /**\n * @since 6.0.0 Changed default value from `\"skip-to-main-content\"`\n * @defaultValue `\"skip-to-main\"`\n */\n id?: string;\n\n /**\n * An optional id for the main element. When this is not provided, the main\n * element will be found by:\n *\n * ```ts\n * document.querySelector('main,[role=\"main\"]');\n * ```\n */\n mainId?: string;\n\n /**\n * @defaultValue `\"Skip to main content\"`\n */\n children?: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * This component is used to allow keyboard users a quick way to skip directly\n * to the main content instead of needing to tab through all navigation items.\n *\n * This component should not be used if using the LayoutAppBar component since\n * it is already built-in.\n *\n * @example Simple Example\n * ```tsx\n * import { AppBar } from \"@react-md/core/app-bar/AppBar\";\n * import { SkipToMainContent } from \"@react-md/core/link/SkipToMainContent\";\n * import { type ReactElement } from \"react\";\n *\n * export default function SimpleSkipToMainContentExample(): ReactElement {\n * return (\n * <AppBar style={{ position: \"relative\" }}>\n * <SkipToMainContent />\n * </AppBar>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/skip-to-main-content | SkipToMainContent Demos}\n * @since 6.0.0 Changed the default `id` from `\"skip-to-main-content\"` to\n * `\"skip-to-main\"`.\n * @since 6.0.0 The `mainId` prop is optional\n * @since 6.0.0 Throws an error after rendering if no main element can be found\n * with the provided `mainId` in development mode. The previous behavior would\n * only log an error after being clicked.\n */\nexport const SkipToMainContent = forwardRef<\n HTMLAnchorElement,\n SkipToMainContentProps\n>(function SkipToMainContent(props, ref) {\n const {\n id = \"skip-to-main\",\n className,\n children = \"Skip to main content\",\n mainId = \"\",\n onClick = noop,\n unstyled,\n ...remaining\n } = props;\n\n const mainNodeRef = useRef<HTMLElement | null>(null);\n // want to warn the developer about missing main element in development\n // immediately to help prevent errors, but in production this can be lazy\n // initialized only once a keyboard user focuses and clicks this element\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n mainNodeRef.current = getMainElement(mainId);\n\n if (!mainNodeRef.current) {\n const foundMainId = document.querySelector('main,[role=\"main\"]')?.id;\n let message = `Unable to find a main element to focus`;\n if (mainId) {\n message += ` with an id of \"${mainId}\"`;\n\n if (foundMainId) {\n message += ` but a main element was found with an id of \"${foundMainId}\".`;\n }\n }\n if (!foundMainId) {\n message +=\n '. There should be at least one <main> element or an element with role=\"main\" on the page for accessibility.';\n }\n\n throw new Error(message);\n }\n }, [mainId]);\n }\n\n return (\n <Link\n {...remaining}\n id={id}\n ref={ref}\n href={`#${mainId}`}\n onClick={(event) => {\n onClick(event);\n if (event.isPropagationStopped()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n // see comment above useEffect\n mainNodeRef.current ||= getMainElement(mainId);\n mainNodeRef.current?.focus();\n }}\n className={skipToMainContent({\n unstyled,\n className,\n })}\n >\n {children}\n </Link>\n );\n});\n"],"names":["forwardRef","useEffect","useRef","Link","skipToMainContent","noop","getMainElement","mainId","document","getElementById","querySelector","SkipToMainContent","props","ref","id","className","children","onClick","unstyled","remaining","mainNodeRef","process","env","NODE_ENV","current","foundMainId","message","Error","href","event","isPropagationStopped","preventDefault","stopPropagation","focus"],"mappings":"AAAA;;AAEA,SAAyBA,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,QAAQ;AAEtE,SAASC,IAAI,QAAwB,YAAY;AACjD,SAEEC,iBAAiB,QACZ,cAAc;AAErB,MAAMC,OAAO;AACX,aAAa;AACf;AAEA,MAAMC,iBAAiB,CAACC,SACtBA,SACIC,SAASC,cAAc,CAACF,UACxBC,SAASE,aAAa,CAAc;AA8B1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BC,GACD,OAAO,MAAMC,kCAAoBX,WAG/B,SAASW,kBAAkBC,KAAK,EAAEC,GAAG;IACrC,MAAM,EACJC,KAAK,cAAc,EACnBC,SAAS,EACTC,WAAW,sBAAsB,EACjCT,SAAS,EAAE,EACXU,UAAUZ,IAAI,EACda,QAAQ,EACR,GAAGC,WACJ,GAAGP;IAEJ,MAAMQ,cAAclB,OAA2B;IAC/C,uEAAuE;IACvE,yEAAyE;IACzE,wEAAwE;IACxE,IAAImB,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,sDAAsD;QACtDtB,UAAU;YACRmB,YAAYI,OAAO,GAAGlB,eAAeC;YAErC,IAAI,CAACa,YAAYI,OAAO,EAAE;gBACxB,MAAMC,cAAcjB,SAASE,aAAa,CAAC,uBAAuBI;gBAClE,IAAIY,UAAU,CAAC,sCAAsC,CAAC;gBACtD,IAAInB,QAAQ;oBACVmB,WAAW,CAAC,gBAAgB,EAAEnB,OAAO,CAAC,CAAC;oBAEvC,IAAIkB,aAAa;wBACfC,WAAW,CAAC,6CAA6C,EAAED,YAAY,EAAE,CAAC;oBAC5E;gBACF;gBACA,IAAI,CAACA,aAAa;oBAChBC,WACE;gBACJ;gBAEA,MAAM,IAAIC,MAAMD;YAClB;QACF,GAAG;YAACnB;SAAO;IACb;IAEA,qBACE,KAACJ;QACE,GAAGgB,SAAS;QACbL,IAAIA;QACJD,KAAKA;QACLe,MAAM,CAAC,CAAC,EAAErB,QAAQ;QAClBU,SAAS,CAACY;YACRZ,QAAQY;YACR,IAAIA,MAAMC,oBAAoB,IAAI;gBAChC;YACF;YAEAD,MAAME,cAAc;YACpBF,MAAMG,eAAe;YAErB,8BAA8B;YAC9BZ,YAAYI,OAAO,KAAKlB,eAAeC;YACvCa,YAAYI,OAAO,EAAES;QACvB;QACAlB,WAAWX,kBAAkB;YAC3Bc;YACAH;QACF;kBAECC;;AAGP,GAAG"}
1
+ {"version":3,"sources":["../../src/link/SkipToMainContent.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, forwardRef, useRef } from \"react\";\n\nimport { useDevEffect } from \"../utils/useDevEffect.js\";\nimport { Link, type LinkProps } from \"./Link.js\";\nimport {\n type SkipToMainContentClassNameOptions,\n skipToMainContent,\n} from \"./styles.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\nconst getMainElement = (mainId: string): HTMLElement | null =>\n mainId\n ? document.getElementById(mainId)\n : document.querySelector<HTMLElement>('main,[role=\"main\"]');\n\n/**\n * @since 6.0.0 The `mainId` is optional\n */\nexport interface SkipToMainContentProps\n extends Omit<LinkProps, \"href\">, SkipToMainContentClassNameOptions {\n /**\n * @since 6.0.0 Changed default value from `\"skip-to-main-content\"`\n * @defaultValue `\"skip-to-main\"`\n */\n id?: string;\n\n /**\n * An optional id for the main element. When this is not provided, the main\n * element will be found by:\n *\n * ```ts\n * document.querySelector('main,[role=\"main\"]');\n * ```\n */\n mainId?: string;\n\n /**\n * @defaultValue `\"Skip to main content\"`\n */\n children?: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * This component is used to allow keyboard users a quick way to skip directly\n * to the main content instead of needing to tab through all navigation items.\n *\n * This component should not be used if using the LayoutAppBar component since\n * it is already built-in.\n *\n * @example Simple Example\n * ```tsx\n * import { AppBar } from \"@react-md/core/app-bar/AppBar\";\n * import { SkipToMainContent } from \"@react-md/core/link/SkipToMainContent\";\n * import { type ReactElement } from \"react\";\n *\n * export default function SimpleSkipToMainContentExample(): ReactElement {\n * return (\n * <AppBar style={{ position: \"relative\" }}>\n * <SkipToMainContent />\n * </AppBar>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/skip-to-main-content | SkipToMainContent Demos}\n * @since 6.0.0 Changed the default `id` from `\"skip-to-main-content\"` to\n * `\"skip-to-main\"`.\n * @since 6.0.0 The `mainId` prop is optional\n * @since 6.0.0 Throws an error after rendering if no main element can be found\n * with the provided `mainId` in development mode. The previous behavior would\n * only log an error after being clicked.\n */\nexport const SkipToMainContent = forwardRef<\n HTMLAnchorElement,\n SkipToMainContentProps\n>(function SkipToMainContent(props, ref) {\n const {\n id = \"skip-to-main\",\n className,\n children = \"Skip to main content\",\n mainId = \"\",\n onClick = noop,\n unstyled,\n ...remaining\n } = props;\n\n const mainNodeRef = useRef<HTMLElement | null>(null);\n // want to warn the developer about missing main element in development\n // immediately to help prevent errors, but in production this can be lazy\n // initialized only once a keyboard user focuses and clicks this element\n useDevEffect(() => {\n mainNodeRef.current = getMainElement(mainId);\n\n if (!mainNodeRef.current) {\n const foundMainId = document.querySelector('main,[role=\"main\"]')?.id;\n let message = `Unable to find a main element to focus`;\n if (mainId) {\n message += ` with an id of \"${mainId}\"`;\n\n if (foundMainId) {\n message += ` but a main element was found with an id of \"${foundMainId}\".`;\n }\n }\n if (!foundMainId) {\n message +=\n '. There should be at least one <main> element or an element with role=\"main\" on the page for accessibility.';\n }\n\n throw new Error(message);\n }\n }, [mainId]);\n\n return (\n <Link\n {...remaining}\n id={id}\n ref={ref}\n href={`#${mainId}`}\n onClick={(event) => {\n onClick(event);\n if (event.isPropagationStopped()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n // see comment above useEffect\n mainNodeRef.current ||= getMainElement(mainId);\n mainNodeRef.current?.focus();\n }}\n className={skipToMainContent({\n unstyled,\n className,\n })}\n >\n {children}\n </Link>\n );\n});\n"],"names":["forwardRef","useRef","useDevEffect","Link","skipToMainContent","noop","getMainElement","mainId","document","getElementById","querySelector","SkipToMainContent","props","ref","id","className","children","onClick","unstyled","remaining","mainNodeRef","current","foundMainId","message","Error","href","event","isPropagationStopped","preventDefault","stopPropagation","focus"],"mappings":"AAAA;;AAEA,SAAyBA,UAAU,EAAEC,MAAM,QAAQ,QAAQ;AAE3D,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,IAAI,QAAwB,YAAY;AACjD,SAEEC,iBAAiB,QACZ,cAAc;AAErB,MAAMC,OAAO;AACX,aAAa;AACf;AAEA,MAAMC,iBAAiB,CAACC,SACtBA,SACIC,SAASC,cAAc,CAACF,UACxBC,SAASE,aAAa,CAAc;AA6B1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BC,GACD,OAAO,MAAMC,kCAAoBX,WAG/B,SAASW,kBAAkBC,KAAK,EAAEC,GAAG;IACrC,MAAM,EACJC,KAAK,cAAc,EACnBC,SAAS,EACTC,WAAW,sBAAsB,EACjCT,SAAS,EAAE,EACXU,UAAUZ,IAAI,EACda,QAAQ,EACR,GAAGC,WACJ,GAAGP;IAEJ,MAAMQ,cAAcnB,OAA2B;IAC/C,uEAAuE;IACvE,yEAAyE;IACzE,wEAAwE;IACxEC,aAAa;QACXkB,YAAYC,OAAO,GAAGf,eAAeC;QAErC,IAAI,CAACa,YAAYC,OAAO,EAAE;YACxB,MAAMC,cAAcd,SAASE,aAAa,CAAC,uBAAuBI;YAClE,IAAIS,UAAU,CAAC,sCAAsC,CAAC;YACtD,IAAIhB,QAAQ;gBACVgB,WAAW,CAAC,gBAAgB,EAAEhB,OAAO,CAAC,CAAC;gBAEvC,IAAIe,aAAa;oBACfC,WAAW,CAAC,6CAA6C,EAAED,YAAY,EAAE,CAAC;gBAC5E;YACF;YACA,IAAI,CAACA,aAAa;gBAChBC,WACE;YACJ;YAEA,MAAM,IAAIC,MAAMD;QAClB;IACF,GAAG;QAAChB;KAAO;IAEX,qBACE,KAACJ;QACE,GAAGgB,SAAS;QACbL,IAAIA;QACJD,KAAKA;QACLY,MAAM,CAAC,CAAC,EAAElB,QAAQ;QAClBU,SAAS,CAACS;YACRT,QAAQS;YACR,IAAIA,MAAMC,oBAAoB,IAAI;gBAChC;YACF;YAEAD,MAAME,cAAc;YACpBF,MAAMG,eAAe;YAErB,8BAA8B;YAC9BT,YAAYC,OAAO,KAAKf,eAAeC;YACvCa,YAAYC,OAAO,EAAES;QACvB;QACAf,WAAWX,kBAAkB;YAC3Bc;YACAH;QACF;kBAECC;;AAGP,GAAG"}
@@ -1 +1 @@
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
+ {"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>, 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;AAuBlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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 +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 {\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,sBAAsB;AAiC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEC,GACD,OAAO,MAAMC,yBAAWN,WACtB,SAASM,SAASC,KAAK,EAAEC,GAAG;IAC1B,MAAM,EACJC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,sBAAsB,EACtBC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,sBAAsB,KAAK,EAC3BC,QAAQC,UAAU,EAClBC,SAAS,EACTC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,kBAAkB,EAClBC,UAAU,EACVC,cAAc,EACdC,kBAAkB,EAClBC,mBAAmB,EACnBC,mBAAmB,EACnBC,uBAAuB,EACvBC,6BAA6B,EAC7BC,8BAA8B,EAC9BC,YAAY,KAAK,EACjBC,WAAW,KAAK,EAChBC,aAAa,EACbC,kBAAkB,KAAK,EACvBC,OAAO,QAAQ,EACfC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,WAAW,EACXC,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,UAAUC,YAAY,EACtBC,UAAUC,YAAY,EACtBC,iBAAiBhB,SAAS,cAAc,EACxC,GAAGiB,WACJ,GAAG9C;IAEJ,IAAIyC,WAAWC;IACf,IAAI,CAACG,kBAAkB,OAAOJ,aAAa,aAAa;QACtDA,WAAWf,WAAW,CAAC,IAAI;IAC7B;IAEA,MAAM,EAAEqB,gBAAgB,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGvD,sBAAsB;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\n 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,sBAAsB;AAkC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEC,GACD,OAAO,MAAMC,yBAAWN,WACtB,SAASM,SAASC,KAAK,EAAEC,GAAG;IAC1B,MAAM,EACJC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,sBAAsB,EACtBC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,sBAAsB,KAAK,EAC3BC,QAAQC,UAAU,EAClBC,SAAS,EACTC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,kBAAkB,EAClBC,UAAU,EACVC,cAAc,EACdC,kBAAkB,EAClBC,mBAAmB,EACnBC,mBAAmB,EACnBC,uBAAuB,EACvBC,6BAA6B,EAC7BC,8BAA8B,EAC9BC,YAAY,KAAK,EACjBC,WAAW,KAAK,EAChBC,aAAa,EACbC,kBAAkB,KAAK,EACvBC,OAAO,QAAQ,EACfC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,WAAW,EACXC,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,UAAUC,YAAY,EACtBC,UAAUC,YAAY,EACtBC,iBAAiBhB,SAAS,cAAc,EACxC,GAAGiB,WACJ,GAAG9C;IAEJ,IAAIyC,WAAWC;IACf,IAAI,CAACG,kBAAkB,OAAOJ,aAAa,aAAa;QACtDA,WAAWf,WAAW,CAAC,IAAI;IAC7B;IAEA,MAAM,EAAEqB,gBAAgB,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGvD,sBAAsB;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 +1 @@
1
- {"version":3,"sources":["../../src/list/ListItemAddon.tsx"],"sourcesContent":["import { type ReactElement, type ReactNode } from \"react\";\n\nimport {\n TextIconSpacing,\n type TextIconSpacingProps,\n} from \"../icon/TextIconSpacing.js\";\nimport {\n type ListItemAddonClassNameOptions,\n listItemAddon,\n} from \"./listItemStyles.js\";\n\nexport interface ListItemAddonProps\n extends Omit<TextIconSpacingProps, \"icon\" | \"iconAfter\" | \"forceIconWrap\">,\n ListItemAddonClassNameOptions {\n /**\n * The addon that should be rendered.\n */\n addon: ReactNode;\n\n /**\n * @defaultValue `type === \"media\" || type === \"large-media\"`\n */\n forceAddonWrap?: boolean;\n}\n\n/**\n * The `ListItemAddon` is used to create an addon to the left or right of the\n * text/children of a `ListItem`.\n *\n * @internal\n */\nexport function ListItemAddon(props: ListItemAddonProps): ReactElement {\n const {\n className,\n children,\n addon,\n addonAfter,\n type = \"icon\",\n position,\n forceAddonWrap,\n disableCenteredMedia,\n disableBeforeSpacing,\n ...remaining\n } = props;\n\n const isMedia = type === \"media\" || type === \"large-media\";\n\n return (\n <TextIconSpacing\n {...remaining}\n icon={addon}\n forceIconWrap={forceAddonWrap ?? isMedia}\n className={listItemAddon({\n type,\n position,\n className,\n addonAfter,\n disableBeforeSpacing,\n disableCenteredMedia,\n })}\n iconAfter={addonAfter}\n >\n {children}\n </TextIconSpacing>\n );\n}\n"],"names":["TextIconSpacing","listItemAddon","ListItemAddon","props","className","children","addon","addonAfter","type","position","forceAddonWrap","disableCenteredMedia","disableBeforeSpacing","remaining","isMedia","icon","forceIconWrap","iconAfter"],"mappings":";AAEA,SACEA,eAAe,QAEV,6BAA6B;AACpC,SAEEC,aAAa,QACR,sBAAsB;AAgB7B;;;;;CAKC,GACD,OAAO,SAASC,cAAcC,KAAyB;IACrD,MAAM,EACJC,SAAS,EACTC,QAAQ,EACRC,KAAK,EACLC,UAAU,EACVC,OAAO,MAAM,EACbC,QAAQ,EACRC,cAAc,EACdC,oBAAoB,EACpBC,oBAAoB,EACpB,GAAGC,WACJ,GAAGV;IAEJ,MAAMW,UAAUN,SAAS,WAAWA,SAAS;IAE7C,qBACE,KAACR;QACE,GAAGa,SAAS;QACbE,MAAMT;QACNU,eAAeN,kBAAkBI;QACjCV,WAAWH,cAAc;YACvBO;YACAC;YACAL;YACAG;YACAK;YACAD;QACF;QACAM,WAAWV;kBAEVF;;AAGP"}
1
+ {"version":3,"sources":["../../src/list/ListItemAddon.tsx"],"sourcesContent":["import { type ReactElement, type ReactNode } from \"react\";\n\nimport {\n TextIconSpacing,\n type TextIconSpacingProps,\n} from \"../icon/TextIconSpacing.js\";\nimport {\n type ListItemAddonClassNameOptions,\n listItemAddon,\n} from \"./listItemStyles.js\";\n\nexport interface ListItemAddonProps\n extends\n Omit<TextIconSpacingProps, \"icon\" | \"iconAfter\" | \"forceIconWrap\">,\n ListItemAddonClassNameOptions {\n /**\n * The addon that should be rendered.\n */\n addon: ReactNode;\n\n /**\n * @defaultValue `type === \"media\" || type === \"large-media\"`\n */\n forceAddonWrap?: boolean;\n}\n\n/**\n * The `ListItemAddon` is used to create an addon to the left or right of the\n * text/children of a `ListItem`.\n *\n * @internal\n */\nexport function ListItemAddon(props: ListItemAddonProps): ReactElement {\n const {\n className,\n children,\n addon,\n addonAfter,\n type = \"icon\",\n position,\n forceAddonWrap,\n disableCenteredMedia,\n disableBeforeSpacing,\n ...remaining\n } = props;\n\n const isMedia = type === \"media\" || type === \"large-media\";\n\n return (\n <TextIconSpacing\n {...remaining}\n icon={addon}\n forceIconWrap={forceAddonWrap ?? isMedia}\n className={listItemAddon({\n type,\n position,\n className,\n addonAfter,\n disableBeforeSpacing,\n disableCenteredMedia,\n })}\n iconAfter={addonAfter}\n >\n {children}\n </TextIconSpacing>\n );\n}\n"],"names":["TextIconSpacing","listItemAddon","ListItemAddon","props","className","children","addon","addonAfter","type","position","forceAddonWrap","disableCenteredMedia","disableBeforeSpacing","remaining","isMedia","icon","forceIconWrap","iconAfter"],"mappings":";AAEA,SACEA,eAAe,QAEV,6BAA6B;AACpC,SAEEC,aAAa,QACR,sBAAsB;AAiB7B;;;;;CAKC,GACD,OAAO,SAASC,cAAcC,KAAyB;IACrD,MAAM,EACJC,SAAS,EACTC,QAAQ,EACRC,KAAK,EACLC,UAAU,EACVC,OAAO,MAAM,EACbC,QAAQ,EACRC,cAAc,EACdC,oBAAoB,EACpBC,oBAAoB,EACpB,GAAGC,WACJ,GAAGV;IAEJ,MAAMW,UAAUN,SAAS,WAAWA,SAAS;IAE7C,qBACE,KAACR;QACE,GAAGa,SAAS;QACbE,MAAMT;QACNU,eAAeN,kBAAkBI;QACjCV,WAAWH,cAAc;YACvBO;YACAC;YACAL;YACAG;YACAK;YACAD;QACF;QACAM,WAAWV;kBAEVF;;AAGP"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/list/ListItemLink.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type AnchorHTMLAttributes,\n type HTMLAttributes,\n forwardRef,\n} from \"react\";\n\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { type CustomLinkComponent } from \"../link/Link.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { ListItemChildren } from \"./ListItemChildren.js\";\nimport { getListItemHeight } from \"./getListItemHeight.js\";\nimport { type ListItemClassNameOptions, listItem } from \"./listItemStyles.js\";\nimport { type ListItemChildrenProps } from \"./types.js\";\n\nexport interface ListItemLinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement>,\n ListItemClassNameOptions,\n ListItemChildrenProps,\n ComponentWithRippleProps {\n /** @defaultValue `\"a\"` */\n as?: CustomLinkComponent;\n\n /**\n * This should only be used if the {@link as} {@link CustomLinkComponent}\n * accepts a `to` prop instead of {@link href}.\n */\n to?: string;\n\n /**\n * The link's href. Either this or the {@link to} prop **should** be provided.\n */\n href?: string;\n\n /**\n * Any additional props to provide the wrapping `<li>` element such as\n * `style`, `className`, and `ref`.\n */\n liProps?: PropsWithRef<HTMLAttributes<HTMLLIElement>>;\n\n /**\n * @defaultValue `disabled ? -1 : undefined`\n */\n tabIndex?: number;\n}\n\n/**\n * **Client Component**\n *\n * The `ListItemLink` should be used to render links within the `List`, `Menu`,\n * or `DropdownMenu` components.\n *\n * @example Simple Example\n * ```tsx\n * import { List } from \"@react-md/core/list/list\";\n * import { ListItemLink } from \"@react-md/core/list/ListItemLink\";\n *\n * function Example() {\n * return (\n * <List>\n * <ListItemLink href=\"#\">Some Link</ListItemLink>\n * </List>\n * );\n * }\n * ```\n *\n * @example In Menus\n * ```tsx\n * import { ListItemLink } from \"@react-md/core/list/ListItemLink\";\n * import { DropdownMenu } from \"@react-md/core/menu/DropdownMenu\";\n *\n * function Example() {\n * return (\n * <DropdownMenu buttonChildren=\"Hello\">\n * <ListItemLink role=\"menuitem\" href=\"#\">Some Link</ListItemLink>\n * </List>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/list | List Demos}\n */\nexport const ListItemLink = forwardRef<HTMLAnchorElement, ListItemLinkProps>(\n function ListItemLink(props, ref) {\n const {\n as: Link = \"a\",\n to,\n href,\n className,\n liProps,\n textProps,\n textClassName,\n secondaryTextClassName,\n primaryText,\n secondaryText,\n secondaryTextProps,\n disableTextChildren = false,\n height: propHeight,\n leftAddon,\n leftAddonType = \"icon\",\n leftAddonPosition = \"middle\",\n leftAddonClassName,\n leftAddonForceWrap,\n rightAddon,\n rightAddonType = \"icon\",\n rightAddonPosition = \"middle\",\n rightAddonClassName,\n rightAddonForceWrap,\n disableLeftAddonCenteredMedia = false,\n disableRightAddonCenteredMedia = false,\n multiline = false,\n disabled = false,\n disabledOpacity = false,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n role,\n tabIndex = disabled || role === \"menuitem\" ? -1 : undefined,\n children: propChildren,\n disableRipple,\n ...remaining\n } = props;\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,\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 {...liProps} role=\"none\">\n <Link\n ref={ref}\n {...remaining}\n {...handlers}\n role={role}\n className={listItem({\n className,\n link: true,\n height,\n disabled,\n disabledOpacity,\n multiline,\n pressedClassName,\n })}\n // TODO: Figure out a better type for the CustomLinkComponent to fix this\n to={to as string}\n href={href as string}\n tabIndex={tabIndex}\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 disableLeftAddonCenteredMedia={disableLeftAddonCenteredMedia}\n disableRightAddonCenteredMedia={disableRightAddonCenteredMedia}\n >\n {children}\n </ListItemChildren>\n {ripples}\n </Link>\n </li>\n );\n }\n);\n"],"names":["forwardRef","useElementInteraction","useHigherContrastChildren","ListItemChildren","getListItemHeight","listItem","ListItemLink","props","ref","as","Link","to","href","className","liProps","textProps","textClassName","secondaryTextClassName","primaryText","secondaryText","secondaryTextProps","disableTextChildren","height","propHeight","leftAddon","leftAddonType","leftAddonPosition","leftAddonClassName","leftAddonForceWrap","rightAddon","rightAddonType","rightAddonPosition","rightAddonClassName","rightAddonForceWrap","disableLeftAddonCenteredMedia","disableRightAddonCenteredMedia","multiline","disabled","disabledOpacity","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","role","tabIndex","undefined","children","propChildren","disableRipple","remaining","pressedClassName","ripples","handlers","mode","li","link"],"mappings":"AAAA;;AAEA,SAGEA,UAAU,QACL,QAAQ;AAGf,SAASC,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AAGxF,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAAwCC,QAAQ,QAAQ,sBAAsB;AAkC9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCC,GACD,OAAO,MAAMC,6BAAeN,WAC1B,SAASM,aAAaC,KAAK,EAAEC,GAAG;IAC9B,MAAM,EACJC,IAAIC,OAAO,GAAG,EACdC,EAAE,EACFC,IAAI,EACJC,SAAS,EACTC,OAAO,EACPC,SAAS,EACTC,aAAa,EACbC,sBAAsB,EACtBC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,sBAAsB,KAAK,EAC3BC,QAAQC,UAAU,EAClBC,SAAS,EACTC,gBAAgB,MAAM,EACtBC,oBAAoB,QAAQ,EAC5BC,kBAAkB,EAClBC,kBAAkB,EAClBC,UAAU,EACVC,iBAAiB,MAAM,EACvBC,qBAAqB,QAAQ,EAC7BC,mBAAmB,EACnBC,mBAAmB,EACnBC,gCAAgC,KAAK,EACrCC,iCAAiC,KAAK,EACtCC,YAAY,KAAK,EACjBC,WAAW,KAAK,EAChBC,kBAAkB,KAAK,EACvBC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,WAAW,EACXC,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,IAAI,EACJC,WAAWd,YAAYa,SAAS,aAAa,CAAC,IAAIE,SAAS,EAC3DC,UAAUC,YAAY,EACtBC,aAAa,EACb,GAAGC,WACJ,GAAGjD;IAEJ,MAAM,EAAEkD,gBAAgB,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAG1D,sBAAsB;QACpE2D,MAAML,gBAAgB,SAASH;QAC/Bb;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAZ;IACF;IACA,MAAMgB,WAAWnD,0BACfoD,cACA,CAACjC;IAGH,MAAMC,SAASlB,kBAAkB;QAC/BkB,QAAQC;QACRC;QACAC;QACAI;QACAC;QACAX;IACF;IAEA,qBACE,KAAC0C;QAAI,GAAG/C,OAAO;QAAEoC,MAAK;kBACpB,cAAA,MAACxC;YACCF,KAAKA;YACJ,GAAGgD,SAAS;YACZ,GAAGG,QAAQ;YACZT,MAAMA;YACNrC,WAAWR,SAAS;gBAClBQ;gBACAiD,MAAM;gBACNxC;gBACAe;gBACAC;gBACAF;gBACAqB;YACF;YACA,yEAAyE;YACzE9C,IAAIA;YACJC,MAAMA;YACNuC,UAAUA;;8BAEV,KAAChD;oBACCiC,WAAWA;oBACXpB,eAAeA;oBACfC,wBAAwBA;oBACxBI,qBAAqBA;oBACrBH,aAAaA;oBACbH,WAAWA;oBACXI,eAAeA;oBACfC,oBAAoBA;oBACpBI,WAAWA;oBACXC,eAAeA;oBACfC,mBAAmBA;oBACnBC,oBAAoBA;oBACpBC,oBAAoBA;oBACpBC,YAAYA;oBACZC,gBAAgBA;oBAChBC,oBAAoBA;oBACpBC,qBAAqBA;oBACrBC,qBAAqBA;oBACrBC,+BAA+BA;oBAC/BC,gCAAgCA;8BAE/BkB;;gBAEFK;;;;AAIT,GACA"}
1
+ {"version":3,"sources":["../../src/list/ListItemLink.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type AnchorHTMLAttributes,\n type HTMLAttributes,\n forwardRef,\n} from \"react\";\n\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { type CustomLinkComponent } from \"../link/Link.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { ListItemChildren } from \"./ListItemChildren.js\";\nimport { getListItemHeight } from \"./getListItemHeight.js\";\nimport { type ListItemClassNameOptions, listItem } from \"./listItemStyles.js\";\nimport { type ListItemChildrenProps } from \"./types.js\";\n\nexport interface ListItemLinkProps\n extends\n AnchorHTMLAttributes<HTMLAnchorElement>,\n ListItemClassNameOptions,\n ListItemChildrenProps,\n ComponentWithRippleProps {\n /** @defaultValue `\"a\"` */\n as?: CustomLinkComponent;\n\n /**\n * This should only be used if the {@link as} {@link CustomLinkComponent}\n * accepts a `to` prop instead of {@link href}.\n */\n to?: string;\n\n /**\n * The link's href. Either this or the {@link to} prop **should** be provided.\n */\n href?: string;\n\n /**\n * Any additional props to provide the wrapping `<li>` element such as\n * `style`, `className`, and `ref`.\n */\n liProps?: PropsWithRef<HTMLAttributes<HTMLLIElement>>;\n\n /**\n * @defaultValue `disabled ? -1 : undefined`\n */\n tabIndex?: number;\n}\n\n/**\n * **Client Component**\n *\n * The `ListItemLink` should be used to render links within the `List`, `Menu`,\n * or `DropdownMenu` components.\n *\n * @example Simple Example\n * ```tsx\n * import { List } from \"@react-md/core/list/list\";\n * import { ListItemLink } from \"@react-md/core/list/ListItemLink\";\n *\n * function Example() {\n * return (\n * <List>\n * <ListItemLink href=\"#\">Some Link</ListItemLink>\n * </List>\n * );\n * }\n * ```\n *\n * @example In Menus\n * ```tsx\n * import { ListItemLink } from \"@react-md/core/list/ListItemLink\";\n * import { DropdownMenu } from \"@react-md/core/menu/DropdownMenu\";\n *\n * function Example() {\n * return (\n * <DropdownMenu buttonChildren=\"Hello\">\n * <ListItemLink role=\"menuitem\" href=\"#\">Some Link</ListItemLink>\n * </List>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/list | List Demos}\n */\nexport const ListItemLink = forwardRef<HTMLAnchorElement, ListItemLinkProps>(\n function ListItemLink(props, ref) {\n const {\n as: Link = \"a\",\n to,\n href,\n className,\n liProps,\n textProps,\n textClassName,\n secondaryTextClassName,\n primaryText,\n secondaryText,\n secondaryTextProps,\n disableTextChildren = false,\n height: propHeight,\n leftAddon,\n leftAddonType = \"icon\",\n leftAddonPosition = \"middle\",\n leftAddonClassName,\n leftAddonForceWrap,\n rightAddon,\n rightAddonType = \"icon\",\n rightAddonPosition = \"middle\",\n rightAddonClassName,\n rightAddonForceWrap,\n disableLeftAddonCenteredMedia = false,\n disableRightAddonCenteredMedia = false,\n multiline = false,\n disabled = false,\n disabledOpacity = false,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n role,\n tabIndex = disabled || role === \"menuitem\" ? -1 : undefined,\n children: propChildren,\n disableRipple,\n ...remaining\n } = props;\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,\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 {...liProps} role=\"none\">\n <Link\n ref={ref}\n {...remaining}\n {...handlers}\n role={role}\n className={listItem({\n className,\n link: true,\n height,\n disabled,\n disabledOpacity,\n multiline,\n pressedClassName,\n })}\n // TODO: Figure out a better type for the CustomLinkComponent to fix this\n to={to as string}\n href={href as string}\n tabIndex={tabIndex}\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 disableLeftAddonCenteredMedia={disableLeftAddonCenteredMedia}\n disableRightAddonCenteredMedia={disableRightAddonCenteredMedia}\n >\n {children}\n </ListItemChildren>\n {ripples}\n </Link>\n </li>\n );\n }\n);\n"],"names":["forwardRef","useElementInteraction","useHigherContrastChildren","ListItemChildren","getListItemHeight","listItem","ListItemLink","props","ref","as","Link","to","href","className","liProps","textProps","textClassName","secondaryTextClassName","primaryText","secondaryText","secondaryTextProps","disableTextChildren","height","propHeight","leftAddon","leftAddonType","leftAddonPosition","leftAddonClassName","leftAddonForceWrap","rightAddon","rightAddonType","rightAddonPosition","rightAddonClassName","rightAddonForceWrap","disableLeftAddonCenteredMedia","disableRightAddonCenteredMedia","multiline","disabled","disabledOpacity","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","role","tabIndex","undefined","children","propChildren","disableRipple","remaining","pressedClassName","ripples","handlers","mode","li","link"],"mappings":"AAAA;;AAEA,SAGEA,UAAU,QACL,QAAQ;AAGf,SAASC,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AAGxF,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAAwCC,QAAQ,QAAQ,sBAAsB;AAmC9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCC,GACD,OAAO,MAAMC,6BAAeN,WAC1B,SAASM,aAAaC,KAAK,EAAEC,GAAG;IAC9B,MAAM,EACJC,IAAIC,OAAO,GAAG,EACdC,EAAE,EACFC,IAAI,EACJC,SAAS,EACTC,OAAO,EACPC,SAAS,EACTC,aAAa,EACbC,sBAAsB,EACtBC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,sBAAsB,KAAK,EAC3BC,QAAQC,UAAU,EAClBC,SAAS,EACTC,gBAAgB,MAAM,EACtBC,oBAAoB,QAAQ,EAC5BC,kBAAkB,EAClBC,kBAAkB,EAClBC,UAAU,EACVC,iBAAiB,MAAM,EACvBC,qBAAqB,QAAQ,EAC7BC,mBAAmB,EACnBC,mBAAmB,EACnBC,gCAAgC,KAAK,EACrCC,iCAAiC,KAAK,EACtCC,YAAY,KAAK,EACjBC,WAAW,KAAK,EAChBC,kBAAkB,KAAK,EACvBC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,WAAW,EACXC,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,IAAI,EACJC,WAAWd,YAAYa,SAAS,aAAa,CAAC,IAAIE,SAAS,EAC3DC,UAAUC,YAAY,EACtBC,aAAa,EACb,GAAGC,WACJ,GAAGjD;IAEJ,MAAM,EAAEkD,gBAAgB,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAG1D,sBAAsB;QACpE2D,MAAML,gBAAgB,SAASH;QAC/Bb;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAZ;IACF;IACA,MAAMgB,WAAWnD,0BACfoD,cACA,CAACjC;IAGH,MAAMC,SAASlB,kBAAkB;QAC/BkB,QAAQC;QACRC;QACAC;QACAI;QACAC;QACAX;IACF;IAEA,qBACE,KAAC0C;QAAI,GAAG/C,OAAO;QAAEoC,MAAK;kBACpB,cAAA,MAACxC;YACCF,KAAKA;YACJ,GAAGgD,SAAS;YACZ,GAAGG,QAAQ;YACZT,MAAMA;YACNrC,WAAWR,SAAS;gBAClBQ;gBACAiD,MAAM;gBACNxC;gBACAe;gBACAC;gBACAF;gBACAqB;YACF;YACA,yEAAyE;YACzE9C,IAAIA;YACJC,MAAMA;YACNuC,UAAUA;;8BAEV,KAAChD;oBACCiC,WAAWA;oBACXpB,eAAeA;oBACfC,wBAAwBA;oBACxBI,qBAAqBA;oBACrBH,aAAaA;oBACbH,WAAWA;oBACXI,eAAeA;oBACfC,oBAAoBA;oBACpBI,WAAWA;oBACXC,eAAeA;oBACfC,mBAAmBA;oBACnBC,oBAAoBA;oBACpBC,oBAAoBA;oBACpBC,YAAYA;oBACZC,gBAAgBA;oBAChBC,oBAAoBA;oBACpBC,qBAAqBA;oBACrBC,qBAAqBA;oBACrBC,+BAA+BA;oBAC/BC,gCAAgCA;8BAE/BkB;;gBAEFK;;;;AAIT,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/list/ListSubheader.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { bem } from \"../utils/bem.js\";\nimport { ListItemText } from \"./ListItemText.js\";\n\nconst styles = bem(\"rmd-list-subheader\");\n\n/** @since 6.0.0 */\nexport interface ListSubheaderClassNameOptions {\n className?: string;\n\n /**\n * Boolean if the subheader should be inset to match the `ListItem` text\n * keyline.\n *\n * @defaultValue `false`\n */\n inset?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function listSubheader(\n options: ListSubheaderClassNameOptions = {}\n): string {\n const { inset = false, className } = options;\n\n return cnb(styles({ inset }), className);\n}\n\n/**\n * @since 6.0.0 The `role` prop defaults to `\"presentation\"`\n */\nexport interface ListSubheaderProps\n extends HTMLAttributes<HTMLLIElement>,\n ListSubheaderClassNameOptions {\n /**\n * @defaultValue `\"presentation\"`\n */\n role?: HTMLAttributes<HTMLLIElement>[\"role\"];\n\n /**\n * @since 6.0.0\n */\n textProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;\n}\n\n/**\n * The `ListSubheader` is a wrapper for the `<li>` element to apply subheader\n * typography styles and {@link ListItemText} layout.\n *\n * @see {@link https://react-md.dev/components/list | List Demos}\n */\nexport const ListSubheader = forwardRef<HTMLLIElement, ListSubheaderProps>(\n function ListSubheader(props, ref) {\n const {\n role = \"presentation\",\n inset = false,\n className,\n children,\n textProps,\n ...remaining\n } = props;\n\n return (\n <li\n {...remaining}\n ref={ref}\n role={role}\n className={listSubheader({\n inset,\n className,\n })}\n >\n <ListItemText {...textProps}>{children}</ListItemText>\n </li>\n );\n }\n);\n"],"names":["cnb","forwardRef","bem","ListItemText","styles","listSubheader","options","inset","className","ListSubheader","props","ref","role","children","textProps","remaining","li"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAA8BC,UAAU,QAAQ,QAAQ;AAGxD,SAASC,GAAG,QAAQ,kBAAkB;AACtC,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,MAAMC,SAASF,IAAI;AAenB;;CAEC,GACD,OAAO,SAASG,cACdC,UAAyC,CAAC,CAAC;IAE3C,MAAM,EAAEC,QAAQ,KAAK,EAAEC,SAAS,EAAE,GAAGF;IAErC,OAAON,IAAII,OAAO;QAAEG;IAAM,IAAIC;AAChC;AAmBA;;;;;CAKC,GACD,OAAO,MAAMC,8BAAgBR,WAC3B,SAASQ,cAAcC,KAAK,EAAEC,GAAG;IAC/B,MAAM,EACJC,OAAO,cAAc,EACrBL,QAAQ,KAAK,EACbC,SAAS,EACTK,QAAQ,EACRC,SAAS,EACT,GAAGC,WACJ,GAAGL;IAEJ,qBACE,KAACM;QACE,GAAGD,SAAS;QACbJ,KAAKA;QACLC,MAAMA;QACNJ,WAAWH,cAAc;YACvBE;YACAC;QACF;kBAEA,cAAA,KAACL;YAAc,GAAGW,SAAS;sBAAGD;;;AAGpC,GACA"}
1
+ {"version":3,"sources":["../../src/list/ListSubheader.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { bem } from \"../utils/bem.js\";\nimport { ListItemText } from \"./ListItemText.js\";\n\nconst styles = bem(\"rmd-list-subheader\");\n\n/** @since 6.0.0 */\nexport interface ListSubheaderClassNameOptions {\n className?: string;\n\n /**\n * Boolean if the subheader should be inset to match the `ListItem` text\n * keyline.\n *\n * @defaultValue `false`\n */\n inset?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function listSubheader(\n options: ListSubheaderClassNameOptions = {}\n): string {\n const { inset = false, className } = options;\n\n return cnb(styles({ inset }), className);\n}\n\n/**\n * @since 6.0.0 The `role` prop defaults to `\"presentation\"`\n */\nexport interface ListSubheaderProps\n extends HTMLAttributes<HTMLLIElement>, ListSubheaderClassNameOptions {\n /**\n * @defaultValue `\"presentation\"`\n */\n role?: HTMLAttributes<HTMLLIElement>[\"role\"];\n\n /**\n * @since 6.0.0\n */\n textProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;\n}\n\n/**\n * The `ListSubheader` is a wrapper for the `<li>` element to apply subheader\n * typography styles and {@link ListItemText} layout.\n *\n * @see {@link https://react-md.dev/components/list | List Demos}\n */\nexport const ListSubheader = forwardRef<HTMLLIElement, ListSubheaderProps>(\n function ListSubheader(props, ref) {\n const {\n role = \"presentation\",\n inset = false,\n className,\n children,\n textProps,\n ...remaining\n } = props;\n\n return (\n <li\n {...remaining}\n ref={ref}\n role={role}\n className={listSubheader({\n inset,\n className,\n })}\n >\n <ListItemText {...textProps}>{children}</ListItemText>\n </li>\n );\n }\n);\n"],"names":["cnb","forwardRef","bem","ListItemText","styles","listSubheader","options","inset","className","ListSubheader","props","ref","role","children","textProps","remaining","li"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAA8BC,UAAU,QAAQ,QAAQ;AAGxD,SAASC,GAAG,QAAQ,kBAAkB;AACtC,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,MAAMC,SAASF,IAAI;AAenB;;CAEC,GACD,OAAO,SAASG,cACdC,UAAyC,CAAC,CAAC;IAE3C,MAAM,EAAEC,QAAQ,KAAK,EAAEC,SAAS,EAAE,GAAGF;IAErC,OAAON,IAAII,OAAO;QAAEG;IAAM,IAAIC;AAChC;AAkBA;;;;;CAKC,GACD,OAAO,MAAMC,8BAAgBR,WAC3B,SAASQ,cAAcC,KAAK,EAAEC,GAAG;IAC/B,MAAM,EACJC,OAAO,cAAc,EACrBL,QAAQ,KAAK,EACbC,SAAS,EACTK,QAAQ,EACRC,SAAS,EACT,GAAGC,WACJ,GAAGL;IAEJ,qBACE,KAACM;QACE,GAAGD,SAAS;QACbJ,KAAKA;QACLC,MAAMA;QACNJ,WAAWH,cAAc;YACvBE;YACAC;QACF;kBAEA,cAAA,KAACL;YAAc,GAAGW,SAAS;sBAAGD;;;AAGpC,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/list/getListItemHeight.ts"],"sourcesContent":["import type { ListItemChildrenProps, ListItemHeight } from \"./types.js\";\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport interface ListItemHeightOptions\n extends Pick<\n ListItemChildrenProps,\n | \"leftAddon\"\n | \"rightAddon\"\n | \"leftAddonType\"\n | \"rightAddonType\"\n | \"secondaryText\"\n > {\n /**\n * @see {@link ListItemHeight}\n */\n height?: ListItemHeight;\n}\n\n/**\n * Gets the expected height for the `ListItem` based on the addons and\n * `secondaryText` props.\n *\n * @see {@link ListItemHeight}\n * @internal\n */\nexport function getListItemHeight(\n options: ListItemHeightOptions = {}\n): ListItemHeight {\n const {\n height,\n leftAddon,\n leftAddonType = \"icon\",\n rightAddon,\n rightAddonType = \"icon\",\n secondaryText,\n } = options;\n\n if (height) {\n return height;\n }\n\n const isIcon =\n (leftAddon && leftAddonType === \"icon\") ||\n (rightAddon && rightAddonType === \"icon\");\n const isAvatar =\n (leftAddon && leftAddonType === \"avatar\") ||\n (rightAddon && rightAddonType === \"avatar\");\n const isGraphic =\n (leftAddon &&\n (leftAddonType === \"media\" || leftAddonType === \"large-media\")) ||\n (rightAddon &&\n (rightAddonType === \"media\" || rightAddonType === \"large-media\"));\n\n // secondary text will always be extra large due to the default `line-height`\n if (isGraphic || secondaryText) {\n return \"extra-large\";\n }\n\n if (isAvatar) {\n return \"large\";\n }\n\n if (isIcon) {\n return \"medium\";\n }\n\n return \"normal\";\n}\n"],"names":["getListItemHeight","options","height","leftAddon","leftAddonType","rightAddon","rightAddonType","secondaryText","isIcon","isAvatar","isGraphic"],"mappings":"AAqBA;;;;;;CAMC,GACD,OAAO,SAASA,kBACdC,UAAiC,CAAC,CAAC;IAEnC,MAAM,EACJC,MAAM,EACNC,SAAS,EACTC,gBAAgB,MAAM,EACtBC,UAAU,EACVC,iBAAiB,MAAM,EACvBC,aAAa,EACd,GAAGN;IAEJ,IAAIC,QAAQ;QACV,OAAOA;IACT;IAEA,MAAMM,SACJ,AAACL,aAAaC,kBAAkB,UAC/BC,cAAcC,mBAAmB;IACpC,MAAMG,WACJ,AAACN,aAAaC,kBAAkB,YAC/BC,cAAcC,mBAAmB;IACpC,MAAMI,YACJ,AAACP,aACEC,CAAAA,kBAAkB,WAAWA,kBAAkB,aAAY,KAC7DC,cACEC,CAAAA,mBAAmB,WAAWA,mBAAmB,aAAY;IAElE,6EAA6E;IAC7E,IAAII,aAAaH,eAAe;QAC9B,OAAO;IACT;IAEA,IAAIE,UAAU;QACZ,OAAO;IACT;IAEA,IAAID,QAAQ;QACV,OAAO;IACT;IAEA,OAAO;AACT"}
1
+ {"version":3,"sources":["../../src/list/getListItemHeight.ts"],"sourcesContent":["import type { ListItemChildrenProps, ListItemHeight } from \"./types.js\";\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport interface ListItemHeightOptions extends Pick<\n ListItemChildrenProps,\n | \"leftAddon\"\n | \"rightAddon\"\n | \"leftAddonType\"\n | \"rightAddonType\"\n | \"secondaryText\"\n> {\n /**\n * @see {@link ListItemHeight}\n */\n height?: ListItemHeight;\n}\n\n/**\n * Gets the expected height for the `ListItem` based on the addons and\n * `secondaryText` props.\n *\n * @see {@link ListItemHeight}\n * @internal\n */\nexport function getListItemHeight(\n options: ListItemHeightOptions = {}\n): ListItemHeight {\n const {\n height,\n leftAddon,\n leftAddonType = \"icon\",\n rightAddon,\n rightAddonType = \"icon\",\n secondaryText,\n } = options;\n\n if (height) {\n return height;\n }\n\n const isIcon =\n (leftAddon && leftAddonType === \"icon\") ||\n (rightAddon && rightAddonType === \"icon\");\n const isAvatar =\n (leftAddon && leftAddonType === \"avatar\") ||\n (rightAddon && rightAddonType === \"avatar\");\n const isGraphic =\n (leftAddon &&\n (leftAddonType === \"media\" || leftAddonType === \"large-media\")) ||\n (rightAddon &&\n (rightAddonType === \"media\" || rightAddonType === \"large-media\"));\n\n // secondary text will always be extra large due to the default `line-height`\n if (isGraphic || secondaryText) {\n return \"extra-large\";\n }\n\n if (isAvatar) {\n return \"large\";\n }\n\n if (isIcon) {\n return \"medium\";\n }\n\n return \"normal\";\n}\n"],"names":["getListItemHeight","options","height","leftAddon","leftAddonType","rightAddon","rightAddonType","secondaryText","isIcon","isAvatar","isGraphic"],"mappings":"AAoBA;;;;;;CAMC,GACD,OAAO,SAASA,kBACdC,UAAiC,CAAC,CAAC;IAEnC,MAAM,EACJC,MAAM,EACNC,SAAS,EACTC,gBAAgB,MAAM,EACtBC,UAAU,EACVC,iBAAiB,MAAM,EACvBC,aAAa,EACd,GAAGN;IAEJ,IAAIC,QAAQ;QACV,OAAOA;IACT;IAEA,MAAMM,SACJ,AAACL,aAAaC,kBAAkB,UAC/BC,cAAcC,mBAAmB;IACpC,MAAMG,WACJ,AAACN,aAAaC,kBAAkB,YAC/BC,cAAcC,mBAAmB;IACpC,MAAMI,YACJ,AAACP,aACEC,CAAAA,kBAAkB,WAAWA,kBAAkB,aAAY,KAC7DC,cACEC,CAAAA,mBAAmB,WAAWA,mBAAmB,aAAY;IAElE,6EAA6E;IAC7E,IAAII,aAAaH,eAAe;QAC9B,OAAO;IACT;IAEA,IAAIE,UAAU;QACZ,OAAO;IACT;IAEA,IAAID,QAAQ;QACV,OAAO;IACT;IAEA,OAAO;AACT"}