@react-md/core 1.0.0-next.11 → 1.0.0-next.12

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 (417) hide show
  1. package/.turbo/turbo-build.log +22 -22
  2. package/.turbo/turbo-lint.log +12 -0
  3. package/.turbo/turbo-typecheck.log +1 -1
  4. package/CHANGELOG.md +6 -0
  5. package/dist/CoreProviders.js.map +1 -1
  6. package/dist/NoSsr.js.map +1 -1
  7. package/dist/RootHtml.js.map +1 -1
  8. package/dist/SsrProvider.js.map +1 -1
  9. package/dist/app-bar/AppBar.js.map +1 -1
  10. package/dist/app-bar/AppBarTitle.d.ts +2 -1
  11. package/dist/app-bar/AppBarTitle.js.map +1 -1
  12. package/dist/avatar/Avatar.js.map +1 -1
  13. package/dist/avatar/styles.js.map +1 -1
  14. package/dist/badge/Badge.js.map +1 -1
  15. package/dist/box/Box.js.map +1 -1
  16. package/dist/box/styles.js.map +1 -1
  17. package/dist/button/AsyncButton.js.map +1 -1
  18. package/dist/button/Button.js.map +1 -1
  19. package/dist/button/ButtonUnstyled.js.map +1 -1
  20. package/dist/button/FloatingActionButton.js.map +1 -1
  21. package/dist/button/TooltippedButton.js.map +1 -1
  22. package/dist/button/buttonStyles.js.map +1 -1
  23. package/dist/button/buttonUnstyledStyles.js.map +1 -1
  24. package/dist/card/Card.js.map +1 -1
  25. package/dist/card/CardContent.js.map +1 -1
  26. package/dist/card/CardFooter.js.map +1 -1
  27. package/dist/card/CardHeader.js.map +1 -1
  28. package/dist/card/CardSubtitle.js.map +1 -1
  29. package/dist/card/CardTitle.js.map +1 -1
  30. package/dist/card/ClickableCard.js.map +1 -1
  31. package/dist/card/styles.js.map +1 -1
  32. package/dist/chip/Chip.js.map +1 -1
  33. package/dist/chip/styles.js.map +1 -1
  34. package/dist/cssUtils.js.map +1 -1
  35. package/dist/delegateEvent.js.map +1 -1
  36. package/dist/dialog/Dialog.js.map +1 -1
  37. package/dist/dialog/DialogContainer.js.map +1 -1
  38. package/dist/dialog/DialogContent.js.map +1 -1
  39. package/dist/dialog/DialogFooter.js.map +1 -1
  40. package/dist/dialog/DialogHeader.js.map +1 -1
  41. package/dist/dialog/DialogTitle.d.ts +2 -1
  42. package/dist/dialog/DialogTitle.js.map +1 -1
  43. package/dist/dialog/FixedDialog.js.map +1 -1
  44. package/dist/dialog/NestedDialogProvider.js.map +1 -1
  45. package/dist/dialog/styles.js.map +1 -1
  46. package/dist/divider/Divider.js.map +1 -1
  47. package/dist/divider/styles.js.map +1 -1
  48. package/dist/draggable/useDraggable.js.map +1 -1
  49. package/dist/draggable/utils.js.map +1 -1
  50. package/dist/expansion-panel/ExpansionList.js.map +1 -1
  51. package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
  52. package/dist/expansion-panel/ExpansionPanelHeader.d.ts +2 -1
  53. package/dist/expansion-panel/ExpansionPanelHeader.js +1 -1
  54. package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
  55. package/dist/expansion-panel/useExpansionList.js.map +1 -1
  56. package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
  57. package/dist/focus/useFocusContainer.js.map +1 -1
  58. package/dist/focus/utils.js.map +1 -1
  59. package/dist/form/Checkbox.js.map +1 -1
  60. package/dist/form/Fieldset.js.map +1 -1
  61. package/dist/form/FileInput.js.map +1 -1
  62. package/dist/form/Form.js.map +1 -1
  63. package/dist/form/FormMessage.js.map +1 -1
  64. package/dist/form/FormMessageContainer.js.map +1 -1
  65. package/dist/form/FormMessageCounter.js.map +1 -1
  66. package/dist/form/InputToggle.js.map +1 -1
  67. package/dist/form/InputToggleIcon.js.map +1 -1
  68. package/dist/form/Label.js.map +1 -1
  69. package/dist/form/Legend.js.map +1 -1
  70. package/dist/form/MenuItemCheckbox.js.map +1 -1
  71. package/dist/form/MenuItemFileInput.js.map +1 -1
  72. package/dist/form/MenuItemInputToggle.js.map +1 -1
  73. package/dist/form/MenuItemRadio.js.map +1 -1
  74. package/dist/form/MenuItemSwitch.js.map +1 -1
  75. package/dist/form/MenuItemTextField.js.map +1 -1
  76. package/dist/form/NativeSelect.js.map +1 -1
  77. package/dist/form/OptGroup.js.map +1 -1
  78. package/dist/form/Option.js.map +1 -1
  79. package/dist/form/Password.js.map +1 -1
  80. package/dist/form/Radio.js.map +1 -1
  81. package/dist/form/ResizingTextAreaWrapper.js.map +1 -1
  82. package/dist/form/Select.js.map +1 -1
  83. package/dist/form/SelectedOption.js.map +1 -1
  84. package/dist/form/Slider.js.map +1 -1
  85. package/dist/form/SliderContainer.js.map +1 -1
  86. package/dist/form/SliderMark.js.map +1 -1
  87. package/dist/form/SliderMarkLabel.d.ts +2 -1
  88. package/dist/form/SliderMarkLabel.js.map +1 -1
  89. package/dist/form/SliderThumb.js.map +1 -1
  90. package/dist/form/SliderTrack.js.map +1 -1
  91. package/dist/form/SliderValueMarks.js.map +1 -1
  92. package/dist/form/SliderValueTooltip.js.map +1 -1
  93. package/dist/form/Switch.js.map +1 -1
  94. package/dist/form/SwitchTrack.js.map +1 -1
  95. package/dist/form/TextArea.js.map +1 -1
  96. package/dist/form/TextField.js.map +1 -1
  97. package/dist/form/TextFieldAddon.js.map +1 -1
  98. package/dist/form/TextFieldContainer.js.map +1 -1
  99. package/dist/form/fileUtils.js.map +1 -1
  100. package/dist/form/formConfig.js.map +1 -1
  101. package/dist/form/formMessageStyles.js.map +1 -1
  102. package/dist/form/inputToggleStyles.js.map +1 -1
  103. package/dist/form/menuItemInputToggleStyles.js.map +1 -1
  104. package/dist/form/nativeSelectStyles.js.map +1 -1
  105. package/dist/form/optionStyles.js.map +1 -1
  106. package/dist/form/passwordStyles.js.map +1 -1
  107. package/dist/form/selectStyles.js.map +1 -1
  108. package/dist/form/selectUtils.js.map +1 -1
  109. package/dist/form/sliderUtils.js.map +1 -1
  110. package/dist/form/switchStyles.js.map +1 -1
  111. package/dist/form/textAreaStyles.js.map +1 -1
  112. package/dist/form/textFieldContainerStyles.js.map +1 -1
  113. package/dist/form/textFieldStyles.js.map +1 -1
  114. package/dist/form/types.js.map +1 -1
  115. package/dist/form/useCheckboxGroup.js.map +1 -1
  116. package/dist/form/useCombobox.js.map +1 -1
  117. package/dist/form/useEditableCombobox.js.map +1 -1
  118. package/dist/form/useFileUpload.js.map +1 -1
  119. package/dist/form/useFormReset.js.map +1 -1
  120. package/dist/form/useListboxProvider.js.map +1 -1
  121. package/dist/form/useNumberField.js.map +1 -1
  122. package/dist/form/useRadioGroup.js.map +1 -1
  123. package/dist/form/useRangeSlider.js.map +1 -1
  124. package/dist/form/useResizingTextArea.js.map +1 -1
  125. package/dist/form/useSelectCombobox.js.map +1 -1
  126. package/dist/form/useSlider.js.map +1 -1
  127. package/dist/form/useTextField.js.map +1 -1
  128. package/dist/form/utils.js.map +1 -1
  129. package/dist/form/validation.js.map +1 -1
  130. package/dist/hoverMode/useHoverMode.js.map +1 -1
  131. package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
  132. package/dist/icon/FontIcon.js.map +1 -1
  133. package/dist/icon/IconRotator.js.map +1 -1
  134. package/dist/icon/MaterialIcon.js.map +1 -1
  135. package/dist/icon/MaterialSymbol.js.map +1 -1
  136. package/dist/icon/SVGIcon.js.map +1 -1
  137. package/dist/icon/TextIconSpacing.js.map +1 -1
  138. package/dist/icon/iconConfig.js.map +1 -1
  139. package/dist/icon/material.js.map +1 -1
  140. package/dist/icon/materialConfig.js.map +1 -1
  141. package/dist/icon/styles.js.map +1 -1
  142. package/dist/index.d.ts +3 -1
  143. package/dist/index.js +3 -1
  144. package/dist/index.js.map +1 -1
  145. package/dist/interaction/Ripple.js.map +1 -1
  146. package/dist/interaction/RippleContainer.js.map +1 -1
  147. package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
  148. package/dist/interaction/config.js.map +1 -1
  149. package/dist/interaction/types.js.map +1 -1
  150. package/dist/interaction/useElementInteraction.js.map +1 -1
  151. package/dist/interaction/useHigherContrastChildren.js.map +1 -1
  152. package/dist/interaction/utils.js.map +1 -1
  153. package/dist/layout/LayoutAppBar.js.map +1 -1
  154. package/dist/layout/LayoutNav.js.map +1 -1
  155. package/dist/layout/LayoutWindowSplitter.js.map +1 -1
  156. package/dist/layout/Main.js.map +1 -1
  157. package/dist/layout/layoutNavStyles.js.map +1 -1
  158. package/dist/layout/layoutWindowSplitterStyles.js.map +1 -1
  159. package/dist/layout/mainStyles.js.map +1 -1
  160. package/dist/layout/useExpandableLayout.js.map +1 -1
  161. package/dist/layout/useHorizontalLayoutTransition.js.map +1 -1
  162. package/dist/layout/useLayoutAppBarHeight.js.map +1 -1
  163. package/dist/layout/useLayoutTree.js.map +1 -1
  164. package/dist/layout/useLayoutWindowSplitter.js.map +1 -1
  165. package/dist/layout/useMainTabIndex.js.map +1 -1
  166. package/dist/layout/useResizableLayout.js.map +1 -1
  167. package/dist/layout/useTemporaryLayout.js.map +1 -1
  168. package/dist/link/Link.js.map +1 -1
  169. package/dist/link/SkipToMainContent.js.map +1 -1
  170. package/dist/link/styles.js.map +1 -1
  171. package/dist/list/List.js.map +1 -1
  172. package/dist/list/ListItem.js.map +1 -1
  173. package/dist/list/ListItemAddon.js.map +1 -1
  174. package/dist/list/ListItemChildren.js.map +1 -1
  175. package/dist/list/ListItemLink.js.map +1 -1
  176. package/dist/list/ListItemText.js.map +1 -1
  177. package/dist/list/ListSubheader.js.map +1 -1
  178. package/dist/list/getListItemHeight.js.map +1 -1
  179. package/dist/list/listItemStyles.js.map +1 -1
  180. package/dist/list/types.js.map +1 -1
  181. package/dist/media-queries/AppSizeProvider.js.map +1 -1
  182. package/dist/media-queries/appSize.js.map +1 -1
  183. package/dist/media-queries/useMediaQuery.js.map +1 -1
  184. package/dist/menu/DropdownMenu.js.map +1 -1
  185. package/dist/menu/Menu.js.map +1 -1
  186. package/dist/menu/MenuBar.js.map +1 -1
  187. package/dist/menu/MenuButton.js.map +1 -1
  188. package/dist/menu/MenuConfigurationProvider.js.map +1 -1
  189. package/dist/menu/MenuItem.js.map +1 -1
  190. package/dist/menu/MenuItemButton.js.map +1 -1
  191. package/dist/menu/MenuItemCircularProgress.js.map +1 -1
  192. package/dist/menu/MenuItemGroup.js.map +1 -1
  193. package/dist/menu/MenuItemSeparator.js.map +1 -1
  194. package/dist/menu/MenuSheet.js.map +1 -1
  195. package/dist/menu/MenuVisibilityProvider.js.map +1 -1
  196. package/dist/menu/MenuWidget.js.map +1 -1
  197. package/dist/menu/MenuWidgetKeyboardProvider.js.map +1 -1
  198. package/dist/menu/useContextMenu.js.map +1 -1
  199. package/dist/menu/useMenuBarProvider.js.map +1 -1
  200. package/dist/menu/utils.js.map +1 -1
  201. package/dist/movement/constants.js.map +1 -1
  202. package/dist/movement/findMatchIndex.js.map +1 -1
  203. package/dist/movement/types.js.map +1 -1
  204. package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
  205. package/dist/movement/utils.js.map +1 -1
  206. package/dist/overlay/Overlay.js.map +1 -1
  207. package/dist/overlay/overlayStyles.js.map +1 -1
  208. package/dist/portal/Portal.js.map +1 -1
  209. package/dist/portal/PortalContainerProvider.js.map +1 -1
  210. package/dist/positioning/constants.js.map +1 -1
  211. package/dist/positioning/createHorizontalPosition.js.map +1 -1
  212. package/dist/positioning/createVerticalPosition.js.map +1 -1
  213. package/dist/positioning/getFixedPosition.js.map +1 -1
  214. package/dist/positioning/types.js.map +1 -1
  215. package/dist/positioning/useFixedPositioning.js.map +1 -1
  216. package/dist/positioning/utils.js.map +1 -1
  217. package/dist/progress/CircularProgress.js.map +1 -1
  218. package/dist/progress/LinearProgress.js.map +1 -1
  219. package/dist/progress/getProgressA11y.js.map +1 -1
  220. package/dist/progress/types.js.map +1 -1
  221. package/dist/responsive-item/ResponsiveItemContainer.js.map +1 -1
  222. package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
  223. package/dist/responsive-item/styles.js.map +1 -1
  224. package/dist/scroll/ScrollLock.js.map +1 -1
  225. package/dist/scroll/getScrollbarWidth.js.map +1 -1
  226. package/dist/scroll/useScrollLock.js.map +1 -1
  227. package/dist/searching/caseInsensitive.js.map +1 -1
  228. package/dist/searching/fuzzy.js.map +1 -1
  229. package/dist/searching/toSearchQuery.js.map +1 -1
  230. package/dist/searching/types.js.map +1 -1
  231. package/dist/searching/useFuzzyMatch.js.map +1 -1
  232. package/dist/searching/utils.js.map +1 -1
  233. package/dist/segmented-button/SegmentedButton.js.map +1 -1
  234. package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -1
  235. package/dist/segmented-button/segmentedButtonContainerStyles.js.map +1 -1
  236. package/dist/segmented-button/segmentedButtonStyles.js.map +1 -1
  237. package/dist/sheet/Sheet.js.map +1 -1
  238. package/dist/sheet/styles.js.map +1 -1
  239. package/dist/snackbar/DefaultToastRenderer.js.map +1 -1
  240. package/dist/snackbar/Snackbar.js.map +1 -1
  241. package/dist/snackbar/Toast.js.map +1 -1
  242. package/dist/snackbar/ToastActionButton.js.map +1 -1
  243. package/dist/snackbar/ToastCloseButton.js.map +1 -1
  244. package/dist/snackbar/ToastContent.js.map +1 -1
  245. package/dist/snackbar/ToastManager.js.map +1 -1
  246. package/dist/snackbar/ToastManagerProvider.js.map +1 -1
  247. package/dist/snackbar/snackbarStyles.js.map +1 -1
  248. package/dist/snackbar/toastContentStyles.js.map +1 -1
  249. package/dist/snackbar/toastStyles.js.map +1 -1
  250. package/dist/snackbar/useCurrentToastActions.js.map +1 -1
  251. package/dist/suspense/CircularProgressSuspense.js.map +1 -1
  252. package/dist/suspense/NullSuspense.js.map +1 -1
  253. package/dist/table/Table.js.map +1 -1
  254. package/dist/table/TableBody.js.map +1 -1
  255. package/dist/table/TableCell.js.map +1 -1
  256. package/dist/table/TableCellContent.js.map +1 -1
  257. package/dist/table/TableCheckbox.js.map +1 -1
  258. package/dist/table/TableConfigurationProvider.js.map +1 -1
  259. package/dist/table/TableContainer.js.map +1 -1
  260. package/dist/table/TableContainerProvider.js.map +1 -1
  261. package/dist/table/TableFooter.js.map +1 -1
  262. package/dist/table/TableHeader.js.map +1 -1
  263. package/dist/table/TableRadio.js.map +1 -1
  264. package/dist/table/TableRow.js.map +1 -1
  265. package/dist/table/tableCellStyles.js.map +1 -1
  266. package/dist/table/tableContainerStyles.js.map +1 -1
  267. package/dist/table/tableFooterStyles.js.map +1 -1
  268. package/dist/table/tableHeaderStyles.js.map +1 -1
  269. package/dist/table/tableRowStyles.js.map +1 -1
  270. package/dist/table/tableStyles.js.map +1 -1
  271. package/dist/table/types.js.map +1 -1
  272. package/dist/tabs/Tab.js.map +1 -1
  273. package/dist/tabs/TabList.js.map +1 -1
  274. package/dist/tabs/TabListScrollButton.js.map +1 -1
  275. package/dist/tabs/tabIndicatorStyles.js.map +1 -1
  276. package/dist/tabs/tabListScrollButtonStyles.js.map +1 -1
  277. package/dist/tabs/tabListStyles.js.map +1 -1
  278. package/dist/tabs/tabStyles.js.map +1 -1
  279. package/dist/tabs/useTabList.js.map +1 -1
  280. package/dist/tabs/useTabs.js.map +1 -1
  281. package/dist/tabs/utils.js.map +1 -1
  282. package/dist/test-utils/IntersectionObserver.js.map +1 -1
  283. package/dist/test-utils/ResizeObserver.js.map +1 -1
  284. package/dist/test-utils/data-testid.js.map +1 -1
  285. package/dist/test-utils/index.js.map +1 -1
  286. package/dist/test-utils/jest-setup.js.map +1 -1
  287. package/dist/test-utils/matchMedia.js.map +1 -1
  288. package/dist/test-utils/polyfills/IntersectionObserver.js.map +1 -1
  289. package/dist/test-utils/polyfills/ResizeObserver.js.map +1 -1
  290. package/dist/test-utils/polyfills/TextDecoder.js.map +1 -1
  291. package/dist/test-utils/polyfills/TextEncoder.js.map +1 -1
  292. package/dist/test-utils/polyfills/index.js.map +1 -1
  293. package/dist/test-utils/polyfills/matchMedia.js.map +1 -1
  294. package/dist/test-utils/polyfills/offsetParent.js.map +1 -1
  295. package/dist/test-utils/polyfills/scrollIntoView.js.map +1 -1
  296. package/dist/test-utils/render.js.map +1 -1
  297. package/dist/test-utils/timers.js.map +1 -1
  298. package/dist/theme/LocalStorageColorSchemeProvider.js.map +1 -1
  299. package/dist/theme/ThemeProvider.js.map +1 -1
  300. package/dist/theme/colors.js.map +1 -1
  301. package/dist/theme/cssVars.js.map +1 -1
  302. package/dist/theme/types.js.map +1 -1
  303. package/dist/theme/useCSSVariables.js.map +1 -1
  304. package/dist/theme/useColorScheme.js.map +1 -1
  305. package/dist/theme/useColorSchemeMetaTag.js.map +1 -1
  306. package/dist/theme/useColorSchemeProvider.js.map +1 -1
  307. package/dist/theme/usePrefersColorScheme.js.map +1 -1
  308. package/dist/theme/utils.js.map +1 -1
  309. package/dist/tooltip/Tooltip.js.map +1 -1
  310. package/dist/tooltip/TooltipHoverModeProvider.js.map +1 -1
  311. package/dist/tooltip/constants.js.map +1 -1
  312. package/dist/tooltip/tooltipStyles.js.map +1 -1
  313. package/dist/tooltip/useTooltip.js.map +1 -1
  314. package/dist/tooltip/useTooltipPosition.js.map +1 -1
  315. package/dist/tooltip/utils.js.map +1 -1
  316. package/dist/transition/CSSTransition.js.map +1 -1
  317. package/dist/transition/Collapse.js.map +1 -1
  318. package/dist/transition/CrossFade.js.map +1 -1
  319. package/dist/transition/ScaleTransition.js.map +1 -1
  320. package/dist/transition/SkeletonPlaceholder.js.map +1 -1
  321. package/dist/transition/Slide.js.map +1 -1
  322. package/dist/transition/SlideContainer.js.map +1 -1
  323. package/dist/transition/collapseStyles.js.map +1 -1
  324. package/dist/transition/config.js.map +1 -1
  325. package/dist/transition/maxWidthTransition.js.map +1 -1
  326. package/dist/transition/skeletonPlaceholderUtils.js.map +1 -1
  327. package/dist/transition/types.js.map +1 -1
  328. package/dist/transition/useCSSTransition.js.map +1 -1
  329. package/dist/transition/useCarousel.js.map +1 -1
  330. package/dist/transition/useCollapseTransition.js.map +1 -1
  331. package/dist/transition/useCrossFadeTransition.js.map +1 -1
  332. package/dist/transition/useMaxWidthTransition.js.map +1 -1
  333. package/dist/transition/useScaleTransition.js.map +1 -1
  334. package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
  335. package/dist/transition/useSlideTransition.js.map +1 -1
  336. package/dist/transition/useTransition.js.map +1 -1
  337. package/dist/transition/utils.js.map +1 -1
  338. package/dist/tree/DefaultTreeItemRenderer.js.map +1 -1
  339. package/dist/tree/Tree.js.map +1 -1
  340. package/dist/tree/TreeGroup.js.map +1 -1
  341. package/dist/tree/TreeItem.js.map +1 -1
  342. package/dist/tree/TreeItemExpander.js.map +1 -1
  343. package/dist/tree/TreeProvider.js.map +1 -1
  344. package/dist/tree/styles.js.map +1 -1
  345. package/dist/tree/types.js.map +1 -1
  346. package/dist/tree/useTree.js.map +1 -1
  347. package/dist/tree/useTreeExpansion.js.map +1 -1
  348. package/dist/tree/useTreeItems.js.map +1 -1
  349. package/dist/tree/useTreeMovement.js.map +1 -1
  350. package/dist/tree/useTreeSelection.js.map +1 -1
  351. package/dist/tree/utils.js.map +1 -1
  352. package/dist/types.js.map +1 -1
  353. package/dist/typography/SrOnly.js.map +1 -1
  354. package/dist/typography/TextContainer.d.ts +1 -40
  355. package/dist/typography/TextContainer.js +1 -30
  356. package/dist/typography/TextContainer.js.map +1 -1
  357. package/dist/typography/Typography.d.ts +1 -112
  358. package/dist/typography/Typography.js +1 -89
  359. package/dist/typography/Typography.js.map +1 -1
  360. package/dist/typography/WritingDirectionProvider.js.map +1 -1
  361. package/dist/typography/textContainerStyles.d.ts +40 -0
  362. package/dist/typography/textContainerStyles.js +32 -0
  363. package/dist/typography/textContainerStyles.js.map +1 -0
  364. package/dist/typography/typographyStyles.d.ts +112 -0
  365. package/dist/typography/typographyStyles.js +91 -0
  366. package/dist/typography/typographyStyles.js.map +1 -0
  367. package/dist/useAsyncAction.js.map +1 -1
  368. package/dist/useDebouncedFunction.js.map +1 -1
  369. package/dist/useDropzone.js.map +1 -1
  370. package/dist/useElementSize.js.map +1 -1
  371. package/dist/useEnsuredId.js.map +1 -1
  372. package/dist/useEnsuredRef.js.map +1 -1
  373. package/dist/useEnsuredState.js.map +1 -1
  374. package/dist/useHtmlClassName.js.map +1 -1
  375. package/dist/useIntersectionObserver.js.map +1 -1
  376. package/dist/useIsomorphicLayoutEffect.js.map +1 -1
  377. package/dist/useLocalStorage.js.map +1 -1
  378. package/dist/useOrientation.js.map +1 -1
  379. package/dist/usePageInactive.js.map +1 -1
  380. package/dist/useResizeListener.js.map +1 -1
  381. package/dist/useResizeObserver.js.map +1 -1
  382. package/dist/useThrottledFunction.js.map +1 -1
  383. package/dist/useToggle.js.map +1 -1
  384. package/dist/useUnmounted.js.map +1 -1
  385. package/dist/useWindowSize.js.map +1 -1
  386. package/dist/utils/RenderRecursively.js.map +1 -1
  387. package/dist/utils/alphaNumericSort.js.map +1 -1
  388. package/dist/utils/applyRef.js.map +1 -1
  389. package/dist/utils/bem.js.map +1 -1
  390. package/dist/utils/getClientPosition.js.map +1 -1
  391. package/dist/utils/getMiddleOfRange.js.map +1 -1
  392. package/dist/utils/getPercentage.js.map +1 -1
  393. package/dist/utils/getRangeDefaultValue.js.map +1 -1
  394. package/dist/utils/getRangeSteps.js.map +1 -1
  395. package/dist/utils/identity.js.map +1 -1
  396. package/dist/utils/isElementVisible.js.map +1 -1
  397. package/dist/utils/loop.js.map +1 -1
  398. package/dist/utils/nearest.js.map +1 -1
  399. package/dist/utils/parseCssLengthUnit.js.map +1 -1
  400. package/dist/utils/randomInt.js.map +1 -1
  401. package/dist/utils/wait.js.map +1 -1
  402. package/dist/utils/withinRange.js.map +1 -1
  403. package/dist/window-splitter/WindowSplitter.js.map +1 -1
  404. package/dist/window-splitter/useWindowSplitter.js.map +1 -1
  405. package/package.json +11 -350
  406. package/src/app-bar/AppBarTitle.tsx +2 -5
  407. package/src/dialog/DialogTitle.tsx +1 -1
  408. package/src/expansion-panel/ExpansionPanelHeader.tsx +3 -6
  409. package/src/form/SliderMarkLabel.tsx +1 -1
  410. package/src/index.ts +3 -1
  411. package/src/typography/TextContainer.tsx +4 -53
  412. package/src/typography/Typography.tsx +5 -145
  413. package/src/typography/__tests__/TextContainer.tsx +2 -1
  414. package/src/typography/__tests__/Typography.tsx +2 -1
  415. package/src/typography/textContainerStyles.ts +53 -0
  416. package/src/typography/typographyStyles.ts +145 -0
  417. package/tsconfig.types.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/divider/Divider.tsx"],"sourcesContent":["import { forwardRef, type ElementType, type HTMLAttributes } from \"react\";\nimport { divider, type DividerClassNameOptions } from \"./styles.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-divider-size\"?: string | number;\n \"--rmd-divider-vertical-size\"?: string | number;\n \"--rmd-divider-color\"?: string;\n \"--rmd-divider-spacing\"?: string | number;\n \"--rmd-divider-vertical-spacing\"?: string | number;\n \"--rmd-divider-inset\"?: string | number;\n \"--rmd-divider-max-size\"?: string | number;\n }\n}\n\nexport type DividerElement = HTMLHRElement | HTMLDivElement;\n\n/**\n * @remarks \\@since 6.0.0 Extends the {@Link DividerClassNameOptions}\n */\nexport interface DividerProps\n extends HTMLAttributes<DividerElement>,\n DividerClassNameOptions {}\n\n/**\n * **Server Component**\n *\n * @example\n * Simple Example\n * ```tsx\n * import { Divider } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return <Divider />;\n * }\n * ```\n */\nexport const Divider = forwardRef<DividerElement, DividerProps>(\n function Divider(props, ref) {\n const {\n inset = false,\n vertical = false,\n role = \"separator\",\n className,\n ...remaining\n } = props;\n\n const Component = (vertical ? \"div\" : \"hr\") as ElementType;\n\n return (\n <Component\n {...remaining}\n ref={ref}\n role={role}\n className={divider({\n inset,\n vertical,\n className,\n })}\n />\n );\n }\n);\n"],"names":["forwardRef","divider","Divider","props","ref","inset","vertical","role","className","remaining","Component"],"mappings":";AAAA,SAASA,UAAU,QAA+C,QAAQ;AAC1E,SAASC,OAAO,QAAsC,cAAc;AAuBpE;;;;;;;;;;;;;CAaC,GACD,OAAO,MAAMC,wBAAUF,WACrB,SAASE,QAAQC,KAAK,EAAEC,GAAG;IACzB,MAAM,EACJC,QAAQ,KAAK,EACbC,WAAW,KAAK,EAChBC,OAAO,WAAW,EAClBC,SAAS,EACT,GAAGC,WACJ,GAAGN;IAEJ,MAAMO,YAAaJ,WAAW,QAAQ;IAEtC,qBACE,KAACI;QACE,GAAGD,SAAS;QACbL,KAAKA;QACLG,MAAMA;QACNC,WAAWP,QAAQ;YACjBI;YACAC;YACAE;QACF;;AAGN,GACA"}
1
+ {"version":3,"sources":["../../src/divider/Divider.tsx"],"sourcesContent":["import { forwardRef, type ElementType, type HTMLAttributes } from \"react\";\nimport { divider, type DividerClassNameOptions } from \"./styles.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-divider-size\"?: string | number;\n \"--rmd-divider-vertical-size\"?: string | number;\n \"--rmd-divider-color\"?: string;\n \"--rmd-divider-spacing\"?: string | number;\n \"--rmd-divider-vertical-spacing\"?: string | number;\n \"--rmd-divider-inset\"?: string | number;\n \"--rmd-divider-max-size\"?: string | number;\n }\n}\n\nexport type DividerElement = HTMLHRElement | HTMLDivElement;\n\n/**\n * @remarks \\@since 6.0.0 Extends the {@Link DividerClassNameOptions}\n */\nexport interface DividerProps\n extends HTMLAttributes<DividerElement>,\n DividerClassNameOptions {}\n\n/**\n * **Server Component**\n *\n * @example\n * Simple Example\n * ```tsx\n * import { Divider } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return <Divider />;\n * }\n * ```\n */\nexport const Divider = forwardRef<DividerElement, DividerProps>(\n function Divider(props, ref) {\n const {\n inset = false,\n vertical = false,\n role = \"separator\",\n className,\n ...remaining\n } = props;\n\n const Component = (vertical ? \"div\" : \"hr\") as ElementType;\n\n return (\n <Component\n {...remaining}\n ref={ref}\n role={role}\n className={divider({\n inset,\n vertical,\n className,\n })}\n />\n );\n }\n);\n"],"names":["forwardRef","divider","Divider","props","ref","inset","vertical","role","className","remaining","Component"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,SAASA,UAAU,QAA+C,QAAQ;AAC1E,SAASC,OAAO,QAAsC,cAAc;AAuBpE;;;;;;;;;;;;;CAaC,GACD,OAAO,MAAMC,wBAAUF,WACrB,SAASE,QAAQC,KAAK,EAAEC,GAAG;IACzB,MAAM,EACJC,QAAQ,KAAK,EACbC,WAAW,KAAK,EAChBC,OAAO,WAAW,EAClBC,SAAS,EACT,GAAGC,WACJ,GAAGN;IAEJ,MAAMO,YAAaJ,WAAW,QAAQ;IAEtC,qBACE,KAACI;QACE,GAAGD,SAAS;QACbL,KAAKA;QACLG,MAAMA;QACNC,WAAWP,QAAQ;YACjBI;YACAC;YACAE;QACF;;AAGN,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/divider/styles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-divider\");\n\n/** @remarks \\@since 6.0.0 */\nexport interface DividerClassNameOptions {\n className?: string;\n\n /**\n * Boolean if the divider should appear inset instead of full width. This\n * really just applied a margin-left (or margin-right when dir=\"rtl\").\n *\n * If you want to create a divider that is centered, you most likely want to\n * use the `rmd-divider-theme-update-var` mixin instead to update the\n * `max-size` of the divider.\n *\n * @defaultValue `false`\n */\n inset?: boolean;\n\n /**\n * Boolean if the divider should be vertical instead of horizontal. This will\n * change the divider to be rendered as a `<div>` instead of an `<hr>`.\n *\n * Note: If your parent element of the divider does not have a static height\n * set, you **must** manually set the height of the divider to a static\n * non-percentage number OR use the `VerticalDivider` component instead to\n * automagically create a valid percentage height.\n *\n * @defaultValue `false`\n */\n vertical?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function divider(options: DividerClassNameOptions = {}): string {\n const { inset = false, vertical = false, className } = options;\n\n return cnb(\n styles({\n inset: inset && !vertical,\n vertical,\n }),\n className\n );\n}\n"],"names":["cnb","bem","styles","divider","options","inset","vertical","className"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAgCnB;;CAEC,GACD,OAAO,SAASE,QAAQC,UAAmC,CAAC,CAAC;IAC3D,MAAM,EAAEC,QAAQ,KAAK,EAAEC,WAAW,KAAK,EAAEC,SAAS,EAAE,GAAGH;IAEvD,OAAOJ,IACLE,OAAO;QACLG,OAAOA,SAAS,CAACC;QACjBA;IACF,IACAC;AAEJ"}
1
+ {"version":3,"sources":["../../src/divider/styles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-divider\");\n\n/** @remarks \\@since 6.0.0 */\nexport interface DividerClassNameOptions {\n className?: string;\n\n /**\n * Boolean if the divider should appear inset instead of full width. This\n * really just applied a margin-left (or margin-right when dir=\"rtl\").\n *\n * If you want to create a divider that is centered, you most likely want to\n * use the `rmd-divider-theme-update-var` mixin instead to update the\n * `max-size` of the divider.\n *\n * @defaultValue `false`\n */\n inset?: boolean;\n\n /**\n * Boolean if the divider should be vertical instead of horizontal. This will\n * change the divider to be rendered as a `<div>` instead of an `<hr>`.\n *\n * Note: If your parent element of the divider does not have a static height\n * set, you **must** manually set the height of the divider to a static\n * non-percentage number OR use the `VerticalDivider` component instead to\n * automagically create a valid percentage height.\n *\n * @defaultValue `false`\n */\n vertical?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function divider(options: DividerClassNameOptions = {}): string {\n const { inset = false, vertical = false, className } = options;\n\n return cnb(\n styles({\n inset: inset && !vertical,\n vertical,\n }),\n className\n );\n}\n"],"names":["cnb","bem","styles","divider","options","inset","vertical","className"],"rangeMappings":";;;;;;;;;;;","mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAgCnB;;CAEC,GACD,OAAO,SAASE,QAAQC,UAAmC,CAAC,CAAC;IAC3D,MAAM,EAAEC,QAAQ,KAAK,EAAEC,WAAW,KAAK,EAAEC,SAAS,EAAE,GAAGH;IAEvD,OAAOJ,IACLE,OAAO;QACLG,OAAOA,SAAS,CAACC;QACjBA;IACF,IACAC;AAEJ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/draggable/useDraggable.ts"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport type { HTMLAttributes, Ref, RefCallback } from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { useScrollLock } from \"../scroll/useScrollLock.js\";\nimport type {\n NonNullRef,\n UseStateInitializer,\n UseStateSetter,\n} from \"../types.js\";\nimport { useDir } from \"../typography/WritingDirectionProvider.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport { useEnsuredState } from \"../useEnsuredState.js\";\nimport { useHtmlClassName } from \"../useHtmlClassName.js\";\nimport { getPercentage } from \"../utils/getPercentage.js\";\nimport { getRangeDefaultValue } from \"../utils/getRangeDefaultValue.js\";\nimport { getRangeSteps } from \"../utils/getRangeSteps.js\";\nimport { nearest } from \"../utils/nearest.js\";\nimport { withinRange } from \"../utils/withinRange.js\";\nimport {\n isMouseDragStartEvent,\n isTouchDragStartEvent,\n updateDragPosition,\n} from \"./utils.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type DraggableTouchEventHandlers<E extends HTMLElement> = Pick<\n HTMLAttributes<E>,\n \"onTouchStart\" | \"onTouchMove\"\n>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type DraggableMouseEventHandlers<E extends HTMLElement> = Pick<\n HTMLAttributes<E>,\n \"onMouseDown\" | \"onMouseUp\" | \"onMouseMove\"\n>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type DraggableKeyboardEventHandlers<E extends HTMLElement> = Pick<\n HTMLAttributes<E>,\n \"onKeyDown\"\n>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type DraggableEventHandlers<E extends HTMLElement> =\n DraggableTouchEventHandlers<E> &\n DraggableMouseEventHandlers<E> &\n DraggableKeyboardEventHandlers<E>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface ControllableDraggableStateOptions {\n value?: number;\n setValue?: UseStateSetter<number>;\n defaultValue?: UseStateInitializer<number>;\n dragging?: boolean;\n setDragging?: UseStateSetter<boolean>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface BaseDraggableOptions<E extends HTMLElement>\n extends DraggableEventHandlers<E>,\n ControllableDraggableStateOptions {\n /**\n * An optional ref to merge with the returned\n * {@link DraggableImplementation.draggableRef}.\n */\n ref?: Ref<E>;\n\n /**\n * The minimum number of pixels allowed for the draggable element. This must\n * be a number greater than or equal to 0.\n *\n * When {@link withinOffsetParent} is set to `true`, this is the minimum value\n * allowed instead of pixels.\n */\n min: number;\n\n /**\n * The maximum number of pixels allowed for the draggable element. This must\n * be a number greater than the {@link min} and usually a number less than the\n * viewport size.\n *\n * When {@link withinOffsetParent} is set to `true`, this is the maximum value\n * allowed instead of pixels.\n */\n max: number;\n\n /**\n * The amount to increment or decrement the value with arrow keys.\n *\n * @defaultValue `1`\n */\n step?: number;\n\n /**\n * This was added to support range sliders where there are two (or more)\n * draggable elements within the same container element and their values\n * cannot pass each other. Without these overrides, the range would keep\n * changing as the other values change, so the drag percentage would be\n * incorrect.\n *\n * @example\n * Range Slider\n * ```ts\n * const min = 0;\n * const max = 100;\n * const minValue = 3;\n * const maxValue = 80;\n *\n * const minValueDraggable = useDraggable({\n * min,\n * max,\n * rangeMax: maxValue,\n * });\n * const maxValueDraggable = useDraggable({\n * min,\n * max,\n * rangeMin: minValue,\n * });\n * ```\n *\n * @defaultValue `min`\n */\n rangeMin?: number;\n\n /**\n * @see {@link rangeMin} for an explanation of this option.\n * @defaultValue `max`\n */\n rangeMax?: number;\n\n /**\n * Set this to `true` to enable dragging vertically instead of horizontally.\n *\n * @defaultValue `false`\n */\n vertical?: boolean;\n\n /**\n * The default drag behavior is to increase the value when:\n *\n * - dragging `\"right\"` and the writing direction is `\"ltr\"`\n * - dragging `\"left\"` and the writing direction is `\"rtl\"`\n * - dragging `\"upwards\"`\n *\n * When this is set to `true`, the value when increase when:\n *\n * - dragging `\"left\"` and the writing direction is `\"ltr\"`\n * - dragging `\"right\"` and the writing direction is `\"rtl\"`\n * - dragging `\"downwards\"`\n *\n * @defaultValue `false`\n */\n reversed?: boolean;\n\n /**\n * Set this to `true` to disable all drag behavior. This will still call any\n * of the provided {@link DraggableEventHandlers}.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * Set this to `true` if the dragging calculations should be to the\n * `draggableRef.current.offsetParent` instead of the entire window. The main\n * use case for this is sliders.\n *\n * @defaultValue `false`\n */\n withinOffsetParent?: boolean;\n\n /**\n * Set this to `true` to prevent the `document.documentElement` from gaining\n * the `.rmd-dragging` class names while dragging.\n *\n * This should normally remain as `false` to improve performance and prevent\n * other mouse events from firing while dragging.\n *\n * @defaultValue `false`\n */\n disableDraggingClassName?: boolean;\n\n /**\n * Set this to `true` to prevent the vertical or horizontal cursor from\n * appearing while dragging.\n *\n * @defaultValue `false`\n */\n disableDraggingCursorClassName?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface UncontrolledDraggableOptions {\n value?: never;\n setValue?: never;\n dragging?: never;\n setDragging?: never;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface ControlledValueDraggableOptions {\n value: number;\n setValue: UseStateSetter<number>;\n defaultValue?: never;\n dragging?: never;\n setDragging?: never;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface ControlledDraggingDraggableOptions {\n value?: never;\n setValue?: never;\n defaultValue?: never;\n dragging: boolean;\n setDragging: UseStateSetter<boolean>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface FullyControlledDraggableOptions {\n value: number;\n setValue: UseStateSetter<number>;\n dragging: boolean;\n setDragging: UseStateSetter<boolean>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type DraggableStateOptions =\n | UncontrolledDraggableOptions\n | ControlledValueDraggableOptions\n | ControlledDraggingDraggableOptions\n | FullyControlledDraggableOptions;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type DraggableOptions<E extends HTMLElement = HTMLElement> =\n BaseDraggableOptions<E> & DraggableStateOptions;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface DraggableImplementation<E extends HTMLElement = HTMLElement>\n extends Required<DraggableEventHandlers<E>> {\n mouseEventHandlers: Required<DraggableMouseEventHandlers<E>>;\n touchEventHandlers: Required<DraggableTouchEventHandlers<E>>;\n keyboardEventHandlers: Required<DraggableKeyboardEventHandlers<E>>;\n\n /**\n * Set the {@link value} to {@link DraggableOptions.min}.\n */\n minimum(): void;\n\n /**\n * Set the {@link value} to {@link DraggableOptions.max}.\n */\n maximum(): void;\n\n /**\n * Increment the {@link value} by {@link DraggableOptions.step}.\n */\n increment(): void;\n\n /**\n * Decrement the {@link value} by {@link DraggableOptions.step}.\n */\n decrement(): void;\n\n /**\n * THe current percentage the `value` is within the range.\n *\n * ```ts\n * const percentage =\n * dragging && withinOffsetParent\n * ? : dragPercentage\n * : getPercentage({ min, max, value });\n * ```\n */\n percentage: number;\n\n /**\n * A ref that **Must** be passed to the element that should be draggable.\n */\n draggableRef: RefCallback<E>;\n\n /**\n * This value will only update while dragging with a mouse or touch and should\n * be used for the positioning styles while dragging.\n *\n * Note: The {@Link percentage} will use this value while dragging.\n */\n dragPercentage: number;\n\n /**\n * Flag to determine if the user has dragged at least once. Used internally\n * for manually persisting the value into local storage once the user has\n * stopped dragging.\n */\n draggedOnce: NonNullRef<boolean>;\n\n value: number;\n setValue: UseStateSetter<number>;\n dragging: boolean;\n setDragging: UseStateSetter<boolean>;\n}\n\n/**\n * This is most likely an internal only hook that provides the functionality for\n * dragging an element through mouse, touch, and keyboard events. The main use\n * cases so far for this hook are:\n * - window splitters\n * - sliders\n *\n * @remarks \\@since 6.0.0\n */\nexport function useDraggable<E extends HTMLElement>(\n options: DraggableOptions<E>\n): DraggableImplementation<E> {\n const {\n ref: propRef,\n min,\n max,\n rangeMin = min,\n rangeMax = max,\n step = 1,\n reversed = false,\n vertical = false,\n onKeyDown = noop,\n onMouseUp = noop,\n onMouseDown = noop,\n onMouseMove = noop,\n onTouchStart = noop,\n onTouchMove = noop,\n dragging: propDragging,\n setDragging: propSetDragging,\n value: propValue,\n setValue: propSetValue,\n defaultValue,\n withinOffsetParent = false,\n disabled = false,\n disableDraggingClassName = false,\n disableDraggingCursorClassName = disableDraggingClassName,\n } = options;\n\n const [nodeRef, ref] = useEnsuredRef(propRef);\n const isTouch = useUserInteractionMode() === \"touch\";\n const draggingRef = useRef(false);\n const [dragPercentage, setDragPercentage] = useState(min);\n const [value, setValue] = useEnsuredState({\n value: propValue,\n setValue: propSetValue,\n defaultValue: getRangeDefaultValue({\n min,\n max,\n step: 1,\n defaultValue,\n }),\n });\n const [dragging, setDragging] = useEnsuredState({\n value: propDragging,\n setValue: propSetDragging,\n defaultValue: false,\n });\n\n const isRTL = useDir().dir === \"rtl\";\n const percentage =\n dragging && withinOffsetParent\n ? dragPercentage\n : getPercentage({ min, max, value });\n const maximum = useCallback(() => {\n setValue(max);\n }, [max, setValue]);\n const minimum = useCallback(() => {\n setValue(min);\n }, [min, setValue]);\n const increment = useCallback(() => {\n setValue((prevValue) => withinRange({ min, max, value: prevValue + step }));\n }, [max, min, setValue, step]);\n const decrement = useCallback(() => {\n setValue((prevValue) => withinRange({ min, max, value: prevValue - step }));\n }, [max, min, setValue, step]);\n\n const draggingClassName = dragging && !disableDraggingClassName;\n useHtmlClassName(cnb(draggingClassName && \"rmd-dragging\"));\n useHtmlClassName(\n cnb(\n !disableDraggingCursorClassName &&\n draggingClassName &&\n `rmd-dragging--${vertical ? \"v\" : \"h\"}`\n )\n );\n\n const draggedOnce = useRef(false);\n useEffect(() => {\n if (!dragging) {\n return;\n }\n\n draggedOnce.current = true;\n const updatePosition = (event: MouseEvent | TouchEvent): void => {\n if (!event.cancelable) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n updateDragPosition({\n event,\n nodeRef,\n min,\n max,\n step,\n rangeMin,\n rangeMax,\n isRTL,\n isDragStart: false,\n reversed,\n vertical,\n setValue,\n setDragging,\n setDragPercentage,\n withinOffsetParent,\n });\n };\n\n const stopDragging = (event: MouseEvent | TouchEvent): void => {\n updatePosition(event);\n draggingRef.current = false;\n setDragging(false);\n };\n\n const updateKey = isTouch ? \"touchmove\" : \"mousemove\";\n const stopKey = isTouch ? \"touchend\" : \"mouseup\";\n const passive = isTouch ? { passive: false } : undefined;\n\n window.addEventListener(updateKey, updatePosition, passive);\n window.addEventListener(stopKey, stopDragging);\n return () => {\n window.removeEventListener(updateKey, updatePosition);\n window.removeEventListener(stopKey, stopDragging);\n };\n }, [\n dragging,\n isRTL,\n isTouch,\n max,\n min,\n nodeRef,\n rangeMax,\n rangeMin,\n reversed,\n setDragging,\n setValue,\n step,\n vertical,\n withinOffsetParent,\n ]);\n\n const prevRange = useRef({ min, max, step });\n useEffect(() => {\n if (\n prevRange.current.min === min &&\n prevRange.current.max === max &&\n prevRange.current.step === step\n ) {\n return;\n }\n\n // ensure that if the `min`, `max`, or `step` value changes that the value\n // is updated as well. Without this, there will be a runtime error if the\n // value is not within the new range.\n prevRange.current = { min, max, step };\n setValue((prevValue) =>\n nearest({\n min,\n max,\n steps: getRangeSteps({ min, max, step }),\n value: prevValue,\n })\n );\n }, [max, min, setValue, step]);\n\n const mouseEventHandlers: Required<DraggableMouseEventHandlers<E>> = {\n onMouseDown: useCallback(\n (event) => {\n onMouseDown(event);\n if (disabled || isTouch || !isMouseDragStartEvent(event)) {\n return;\n }\n\n // dont' allow text to be selected\n event.preventDefault();\n updateDragPosition({\n isDragStart: true,\n event,\n nodeRef,\n min,\n max,\n step,\n rangeMin,\n rangeMax,\n isRTL,\n reversed,\n vertical,\n setValue,\n setDragging,\n setDragPercentage,\n withinOffsetParent,\n });\n\n // don't set dragging immediately so that click events can still happen\n draggingRef.current = true;\n },\n [\n disabled,\n isRTL,\n isTouch,\n max,\n min,\n nodeRef,\n onMouseDown,\n rangeMax,\n rangeMin,\n reversed,\n setDragging,\n setValue,\n step,\n vertical,\n withinOffsetParent,\n ]\n ),\n onMouseMove: useCallback(\n (event) => {\n onMouseMove(event);\n if (disabled || isTouch || !draggingRef.current || dragging) {\n return;\n }\n\n updateDragPosition({\n isDragStart: true,\n event,\n nodeRef,\n min,\n max,\n step,\n rangeMin,\n rangeMax,\n isRTL,\n reversed,\n vertical,\n setValue,\n setDragging,\n setDragPercentage,\n withinOffsetParent,\n });\n setDragging(true);\n },\n [\n disabled,\n dragging,\n isRTL,\n isTouch,\n max,\n min,\n nodeRef,\n onMouseMove,\n rangeMax,\n rangeMin,\n reversed,\n setDragging,\n setValue,\n step,\n vertical,\n withinOffsetParent,\n ]\n ),\n onMouseUp: useCallback(\n (event) => {\n onMouseUp(event);\n if (disabled || isTouch) {\n return;\n }\n\n draggingRef.current = false;\n },\n [disabled, isTouch, onMouseUp]\n ),\n };\n const keyboardEventHandlers: Required<DraggableKeyboardEventHandlers<E>> = {\n onKeyDown: useCallback(\n (event) => {\n onKeyDown(event);\n if (disabled) {\n return;\n }\n\n const decrementKey = vertical ? \"ArrowUp\" : \"ArrowLeft\";\n const incrementKey = vertical ? \"ArrowDown\" : \"ArrowRight\";\n\n switch (event.key) {\n case decrementKey:\n event.preventDefault();\n decrement();\n break;\n case incrementKey:\n event.preventDefault();\n increment();\n break;\n case \"Home\":\n event.preventDefault();\n minimum();\n break;\n case \"End\":\n event.preventDefault();\n maximum();\n break;\n }\n },\n [decrement, disabled, increment, maximum, minimum, onKeyDown, vertical]\n ),\n };\n\n // touch devices are a bit weird and cause issues since the \"start\" event is\n // also used for scrolling. If the user quickly grabs the draggable element\n // and drags vertically, most of the time it will try to scroll instead of\n // dragging the element. The workaround is to being the drag events\n // immediately on touchstart and disable scroll behavior for the page.\n //\n // There are also some issues with calling `event.preventDefault()` within\n // touch events even while `{ passive: false } is manually set, so need to\n // also attach a touchmove event.\n useScrollLock(isTouch && dragging);\n const touchEventHandlers: Required<DraggableTouchEventHandlers<E>> = {\n onTouchStart: useCallback(\n (event) => {\n onTouchStart(event);\n if (disabled || !isTouchDragStartEvent(event)) {\n return;\n }\n\n draggingRef.current = true;\n updateDragPosition({\n isDragStart: true,\n event,\n nodeRef,\n min,\n max,\n step,\n rangeMin,\n rangeMax,\n isRTL,\n reversed,\n vertical,\n setValue,\n setDragging,\n setDragPercentage,\n withinOffsetParent,\n });\n },\n [\n disabled,\n isRTL,\n max,\n min,\n nodeRef,\n onTouchStart,\n rangeMax,\n rangeMin,\n reversed,\n setDragging,\n setValue,\n step,\n vertical,\n withinOffsetParent,\n ]\n ),\n onTouchMove: useCallback(\n (event) => {\n onTouchMove(event);\n if (disabled || !draggingRef.current || !event.cancelable) {\n return;\n }\n\n // prevent the document's touchmove event from also firing\n event.stopPropagation();\n updateDragPosition({\n isDragStart: true,\n event,\n nodeRef,\n min,\n max,\n step,\n rangeMin,\n rangeMax,\n isRTL,\n reversed,\n vertical,\n setValue,\n setDragging,\n setDragPercentage,\n withinOffsetParent,\n });\n },\n [\n disabled,\n isRTL,\n max,\n min,\n nodeRef,\n onTouchMove,\n rangeMax,\n rangeMin,\n reversed,\n setDragging,\n setValue,\n step,\n vertical,\n withinOffsetParent,\n ]\n ),\n };\n\n return {\n ...touchEventHandlers,\n ...mouseEventHandlers,\n ...keyboardEventHandlers,\n value,\n setValue,\n dragging,\n setDragging,\n maximum,\n minimum,\n increment,\n decrement,\n draggedOnce,\n draggableRef: ref,\n percentage,\n dragPercentage,\n touchEventHandlers,\n mouseEventHandlers,\n keyboardEventHandlers,\n };\n}\n"],"names":["cnb","useCallback","useEffect","useRef","useState","useUserInteractionMode","useScrollLock","useDir","useEnsuredRef","useEnsuredState","useHtmlClassName","getPercentage","getRangeDefaultValue","getRangeSteps","nearest","withinRange","isMouseDragStartEvent","isTouchDragStartEvent","updateDragPosition","noop","useDraggable","options","ref","propRef","min","max","rangeMin","rangeMax","step","reversed","vertical","onKeyDown","onMouseUp","onMouseDown","onMouseMove","onTouchStart","onTouchMove","dragging","propDragging","setDragging","propSetDragging","value","propValue","setValue","propSetValue","defaultValue","withinOffsetParent","disabled","disableDraggingClassName","disableDraggingCursorClassName","nodeRef","isTouch","draggingRef","dragPercentage","setDragPercentage","isRTL","dir","percentage","maximum","minimum","increment","prevValue","decrement","draggingClassName","draggedOnce","current","updatePosition","event","cancelable","preventDefault","stopPropagation","isDragStart","stopDragging","updateKey","stopKey","passive","undefined","window","addEventListener","removeEventListener","prevRange","steps","mouseEventHandlers","keyboardEventHandlers","decrementKey","incrementKey","key","touchEventHandlers","draggableRef"],"mappings":"AAAA;AACA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AACjE,SAASC,sBAAsB,QAAQ,gDAAgD;AACvF,SAASC,aAAa,QAAQ,6BAA6B;AAM3D,SAASC,MAAM,QAAQ,4CAA4C;AACnE,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,oBAAoB,QAAQ,mCAAmC;AACxE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SACEC,qBAAqB,EACrBC,qBAAqB,EACrBC,kBAAkB,QACb,aAAa;AAEpB,MAAMC,OAAO;AACX,aAAa;AACf;AAiTA;;;;;;;;CAQC,GACD,OAAO,SAASC,aACdC,OAA4B;IAE5B,MAAM,EACJC,KAAKC,OAAO,EACZC,GAAG,EACHC,GAAG,EACHC,WAAWF,GAAG,EACdG,WAAWF,G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YACAE;YACAgB;SACD;QAEHV,aAAanC,YACX,CAACkE;YACC/B,YAAY+B;YACZ,IAAIpB,YAAY,CAACK,YAAYa,OAAO,IAAI,CAACE,MAAMC,UAAU,EAAE;gBACzD;YACF;YAEA,0DAA0D;YAC1DD,MAAMG,eAAe;YACrBpD,mBAAmB;gBACjBqD,aAAa;gBACbJ;gBACAjB;gBACA1B;gBACAC;gBACAG;gBACAF;gBACAC;gBACA4B;gBACA1B;gBACAC;gBACAa;gBACAJ;gBACAe;gBACAR;YACF;QACF,GACA;YACEC;YACAQ;YACA9B;YACAD;YACA0B;YACAd;YACAT;YACAD;YACAG;YACAU;YACAI;YACAf;YACAE;YACAgB;SACD;IAEL;IAEA,OAAO;QACL,GAAGyC,kBAAkB;QACrB,GAAGL,kBAAkB;QACrB,GAAGC,qBAAqB;QACxB1C;QACAE;QACAN;QACAE;QACAmB;QACAC;QACAC;QACAE;QACAE;QACAwB,cAAclE;QACdmC;QACAJ;QACAkC;QACAL;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/draggable/useDraggable.ts"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport type { HTMLAttributes, Ref, RefCallback } from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { useScrollLock } from \"../scroll/useScrollLock.js\";\nimport type {\n NonNullRef,\n UseStateInitializer,\n UseStateSetter,\n} from \"../types.js\";\nimport { useDir } from \"../typography/WritingDirectionProvider.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport { useEnsuredState } from \"../useEnsuredState.js\";\nimport { useHtmlClassName } from \"../useHtmlClassName.js\";\nimport { getPercentage } from \"../utils/getPercentage.js\";\nimport { getRangeDefaultValue } from \"../utils/getRangeDefaultValue.js\";\nimport { getRangeSteps } from \"../utils/getRangeSteps.js\";\nimport { nearest } from \"../utils/nearest.js\";\nimport { withinRange } from \"../utils/withinRange.js\";\nimport {\n isMouseDragStartEvent,\n isTouchDragStartEvent,\n updateDragPosition,\n} from \"./utils.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type DraggableTouchEventHandlers<E extends HTMLElement> = Pick<\n HTMLAttributes<E>,\n \"onTouchStart\" | \"onTouchMove\"\n>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type DraggableMouseEventHandlers<E extends HTMLElement> = Pick<\n HTMLAttributes<E>,\n \"onMouseDown\" | \"onMouseUp\" | \"onMouseMove\"\n>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type DraggableKeyboardEventHandlers<E extends HTMLElement> = Pick<\n HTMLAttributes<E>,\n \"onKeyDown\"\n>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type DraggableEventHandlers<E extends HTMLElement> =\n DraggableTouchEventHandlers<E> &\n DraggableMouseEventHandlers<E> &\n DraggableKeyboardEventHandlers<E>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface ControllableDraggableStateOptions {\n value?: number;\n setValue?: UseStateSetter<number>;\n defaultValue?: UseStateInitializer<number>;\n dragging?: boolean;\n setDragging?: UseStateSetter<boolean>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface BaseDraggableOptions<E extends HTMLElement>\n extends DraggableEventHandlers<E>,\n ControllableDraggableStateOptions {\n /**\n * An optional ref to merge with the returned\n * {@link DraggableImplementation.draggableRef}.\n */\n ref?: Ref<E>;\n\n /**\n * The minimum number of pixels allowed for the draggable element. This must\n * be a number greater than or equal to 0.\n *\n * When {@link withinOffsetParent} is set to `true`, this is the minimum value\n * allowed instead of pixels.\n */\n min: number;\n\n /**\n * The maximum number of pixels allowed for the draggable element. This must\n * be a number greater than the {@link min} and usually a number less than the\n * viewport size.\n *\n * When {@link withinOffsetParent} is set to `true`, this is the maximum value\n * allowed instead of pixels.\n */\n max: number;\n\n /**\n * The amount to increment or decrement the value with arrow keys.\n *\n * @defaultValue `1`\n */\n step?: number;\n\n /**\n * This was added to support range sliders where there are two (or more)\n * draggable elements within the same container element and their values\n * cannot pass each other. Without these overrides, the range would keep\n * changing as the other values change, so the drag percentage would be\n * incorrect.\n *\n * @example\n * Range Slider\n * ```ts\n * const min = 0;\n * const max = 100;\n * const minValue = 3;\n * const maxValue = 80;\n *\n * const minValueDraggable = useDraggable({\n * min,\n * max,\n * rangeMax: maxValue,\n * });\n * const maxValueDraggable = useDraggable({\n * min,\n * max,\n * rangeMin: minValue,\n * });\n * ```\n *\n * @defaultValue `min`\n */\n rangeMin?: number;\n\n /**\n * @see {@link rangeMin} for an explanation of this option.\n * @defaultValue `max`\n */\n rangeMax?: number;\n\n /**\n * Set this to `true` to enable dragging vertically instead of horizontally.\n *\n * @defaultValue `false`\n */\n vertical?: boolean;\n\n /**\n * The default drag behavior is to increase the value when:\n *\n * - dragging `\"right\"` and the writing direction is `\"ltr\"`\n * - dragging `\"left\"` and the writing direction is `\"rtl\"`\n * - dragging `\"upwards\"`\n *\n * When this is set to `true`, the value when increase when:\n *\n * - dragging `\"left\"` and the writing direction is `\"ltr\"`\n * - dragging `\"right\"` and the writing direction is `\"rtl\"`\n * - dragging `\"downwards\"`\n *\n * @defaultValue `false`\n */\n reversed?: boolean;\n\n /**\n * Set this to `true` to disable all drag behavior. This will still call any\n * of the provided {@link DraggableEventHandlers}.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * Set this to `true` if the dragging calculations should be to the\n * `draggableRef.current.offsetParent` instead of the entire window. The main\n * use case for this is sliders.\n *\n * @defaultValue `false`\n */\n withinOffsetParent?: boolean;\n\n /**\n * Set this to `true` to prevent the `document.documentElement` from gaining\n * the `.rmd-dragging` class names while dragging.\n *\n * This should normally remain as `false` to improve performance and prevent\n * other mouse events from firing while dragging.\n *\n * @defaultValue `false`\n */\n disableDraggingClassName?: boolean;\n\n /**\n * Set this to `true` to prevent the vertical or horizontal cursor from\n * appearing while dragging.\n *\n * @defaultValue `false`\n */\n disableDraggingCursorClassName?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface UncontrolledDraggableOptions {\n value?: never;\n setValue?: never;\n dragging?: never;\n setDragging?: never;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface ControlledValueDraggableOptions {\n value: number;\n setValue: UseStateSetter<number>;\n defaultValue?: never;\n dragging?: never;\n setDragging?: never;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface ControlledDraggingDraggableOptions {\n value?: never;\n setValue?: never;\n defaultValue?: never;\n dragging: boolean;\n setDragging: UseStateSetter<boolean>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface FullyControlledDraggableOptions {\n value: number;\n setValue: UseStateSetter<number>;\n dragging: boolean;\n setDragging: UseStateSetter<boolean>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type DraggableStateOptions =\n | UncontrolledDraggableOptions\n | ControlledValueDraggableOptions\n | ControlledDraggingDraggableOptions\n | FullyControlledDraggableOptions;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type DraggableOptions<E extends HTMLElement = HTMLElement> =\n BaseDraggableOptions<E> & DraggableStateOptions;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface DraggableImplementation<E extends HTMLElement = HTMLElement>\n extends Required<DraggableEventHandlers<E>> {\n mouseEventHandlers: Required<DraggableMouseEventHandlers<E>>;\n touchEventHandlers: Required<DraggableTouchEventHandlers<E>>;\n keyboardEventHandlers: Required<DraggableKeyboardEventHandlers<E>>;\n\n /**\n * Set the {@link value} to {@link DraggableOptions.min}.\n */\n minimum(): void;\n\n /**\n * Set the {@link value} to {@link DraggableOptions.max}.\n */\n maximum(): void;\n\n /**\n * Increment the {@link value} by {@link DraggableOptions.step}.\n */\n increment(): void;\n\n /**\n * Decrement the {@link value} by {@link DraggableOptions.step}.\n */\n decrement(): void;\n\n /**\n * THe current percentage the `value` is within the range.\n *\n * ```ts\n * const percentage =\n * dragging && withinOffsetParent\n * ? : dragPercentage\n * : getPercentage({ min, max, value });\n * ```\n */\n percentage: number;\n\n /**\n * A ref that **Must** be passed to the element that should be draggable.\n */\n draggableRef: RefCallback<E>;\n\n /**\n * This value will only update while dragging with a mouse or touch and should\n * be used for the positioning styles while dragging.\n *\n * Note: The {@Link percentage} will use this value while dragging.\n */\n dragPercentage: number;\n\n /**\n * Flag to determine if the user has dragged at least once. Used internally\n * for manually persisting the value into local storage once the user has\n * stopped dragging.\n */\n draggedOnce: NonNullRef<boolean>;\n\n value: number;\n setValue: UseStateSetter<number>;\n dragging: boolean;\n setDragging: UseStateSetter<boolean>;\n}\n\n/**\n * This is most likely an internal only hook that provides the functionality for\n * dragging an element through mouse, touch, and keyboard events. The main use\n * cases so far for this hook are:\n * - window splitters\n * - sliders\n *\n * @remarks \\@since 6.0.0\n */\nexport function useDraggable<E extends HTMLElement>(\n options: DraggableOptions<E>\n): DraggableImplementation<E> {\n const {\n ref: propRef,\n min,\n max,\n rangeMin = min,\n rangeMax = max,\n step = 1,\n reversed = false,\n vertical = false,\n onKeyDown = noop,\n onMouseUp = noop,\n onMouseDown = noop,\n onMouseMove = noop,\n onTouchStart = noop,\n onTouchMove = noop,\n dragging: propDragging,\n setDragging: propSetDragging,\n value: propValue,\n setValue: propSetValue,\n defaultValue,\n withinOffsetParent = false,\n disabled = false,\n disableDraggingClassName = false,\n disableDraggingCursorClassName = disableDraggingClassName,\n } = options;\n\n const [nodeRef, ref] = useEnsuredRef(propRef);\n const isTouch = useUserInteractionMode() === \"touch\";\n const draggingRef = useRef(false);\n const [dragPercentage, setDragPercentage] = useState(min);\n const [value, setValue] = useEnsuredState({\n value: propValue,\n setValue: propSetValue,\n defaultValue: getRangeDefaultValue({\n min,\n max,\n step: 1,\n defaultValue,\n }),\n });\n const [dragging, setDragging] = useEnsuredState({\n value: propDragging,\n setValue: propSetDragging,\n defaultValue: false,\n });\n\n const isRTL = useDir().dir === \"rtl\";\n const percentage =\n dragging && withinOffsetParent\n ? dragPercentage\n : getPercentage({ min, max, value });\n const maximum = useCallback(() => {\n setValue(max);\n }, [max, setValue]);\n const minimum = useCallback(() => {\n setValue(min);\n }, [min, setValue]);\n const increment = useCallback(() => {\n setValue((prevValue) => withinRange({ min, max, value: prevValue + step }));\n }, [max, min, setValue, step]);\n const decrement = useCallback(() => {\n setValue((prevValue) => withinRange({ min, max, value: prevValue - step }));\n }, [max, min, setValue, step]);\n\n const draggingClassName = dragging && !disableDraggingClassName;\n useHtmlClassName(cnb(draggingClassName && \"rmd-dragging\"));\n useHtmlClassName(\n cnb(\n !disableDraggingCursorClassName &&\n draggingClassName &&\n `rmd-dragging--${vertical ? \"v\" : \"h\"}`\n )\n );\n\n const draggedOnce = useRef(false);\n useEffect(() => {\n if (!dragging) {\n return;\n }\n\n draggedOnce.current = true;\n const updatePosition = (event: MouseEvent | TouchEvent): void => {\n if (!event.cancelable) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n updateDragPosition({\n event,\n nodeRef,\n min,\n max,\n step,\n rangeMin,\n rangeMax,\n isRTL,\n isDragStart: false,\n reversed,\n vertical,\n setValue,\n setDragging,\n setDragPercentage,\n withinOffsetParent,\n });\n };\n\n const stopDragging = (event: MouseEvent | TouchEvent): void => {\n updatePosition(event);\n draggingRef.current = false;\n setDragging(false);\n };\n\n const updateKey = isTouch ? \"touchmove\" : \"mousemove\";\n const stopKey = isTouch ? \"touchend\" : \"mouseup\";\n const passive = isTouch ? { passive: false } : undefined;\n\n window.addEventListener(updateKey, updatePosition, passive);\n window.addEventListener(stopKey, stopDragging);\n return () => {\n window.removeEventListener(updateKey, updatePosition);\n window.removeEventListener(stopKey, stopDragging);\n };\n }, [\n dragging,\n isRTL,\n isTouch,\n max,\n min,\n nodeRef,\n rangeMax,\n rangeMin,\n reversed,\n setDragging,\n setValue,\n step,\n vertical,\n withinOffsetParent,\n ]);\n\n const prevRange = useRef({ min, max, step });\n useEffect(() => {\n if (\n prevRange.current.min === min &&\n prevRange.current.max === max &&\n prevRange.current.step === step\n ) {\n return;\n }\n\n // ensure that if the `min`, `max`, or `step` value changes that the value\n // is updated as well. Without this, there will be a runtime error if the\n // value is not within the new range.\n prevRange.current = { min, max, step };\n setValue((prevValue) =>\n nearest({\n min,\n max,\n steps: getRangeSteps({ min, max, step }),\n value: prevValue,\n })\n );\n }, [max, min, setValue, step]);\n\n const mouseEventHandlers: Required<DraggableMouseEventHandlers<E>> = {\n onMouseDown: useCallback(\n (event) => {\n onMouseDown(event);\n if (disabled || isTouch || !isMouseDragStartEvent(event)) {\n return;\n }\n\n // dont' allow text to be selected\n event.preventDefault();\n updateDragPosition({\n isDragStart: true,\n event,\n nodeRef,\n min,\n max,\n step,\n rangeMin,\n rangeMax,\n isRTL,\n reversed,\n vertical,\n setValue,\n setDragging,\n setDragPercentage,\n withinOffsetParent,\n });\n\n // don't set dragging immediately so that click events can still happen\n draggingRef.current = true;\n },\n [\n disabled,\n isRTL,\n isTouch,\n max,\n min,\n nodeRef,\n onMouseDown,\n rangeMax,\n rangeMin,\n reversed,\n setDragging,\n setValue,\n step,\n vertical,\n withinOffsetParent,\n ]\n ),\n onMouseMove: useCallback(\n (event) => {\n onMouseMove(event);\n if (disabled || isTouch || !draggingRef.current || dragging) {\n return;\n }\n\n updateDragPosition({\n isDragStart: true,\n event,\n nodeRef,\n min,\n max,\n step,\n rangeMin,\n rangeMax,\n isRTL,\n reversed,\n vertical,\n setValue,\n setDragging,\n setDragPercentage,\n withinOffsetParent,\n });\n setDragging(true);\n },\n [\n disabled,\n dragging,\n isRTL,\n isTouch,\n max,\n min,\n nodeRef,\n onMouseMove,\n rangeMax,\n rangeMin,\n reversed,\n setDragging,\n setValue,\n step,\n vertical,\n withinOffsetParent,\n ]\n ),\n onMouseUp: useCallback(\n (event) => {\n onMouseUp(event);\n if (disabled || isTouch) {\n return;\n }\n\n draggingRef.current = false;\n },\n [disabled, isTouch, onMouseUp]\n ),\n };\n const keyboardEventHandlers: Required<DraggableKeyboardEventHandlers<E>> = {\n onKeyDown: useCallback(\n (event) => {\n onKeyDown(event);\n if (disabled) {\n return;\n }\n\n const decrementKey = vertical ? \"ArrowUp\" : \"ArrowLeft\";\n const incrementKey = vertical ? \"ArrowDown\" : \"ArrowRight\";\n\n switch (event.key) {\n case decrementKey:\n event.preventDefault();\n decrement();\n break;\n case incrementKey:\n event.preventDefault();\n increment();\n break;\n case \"Home\":\n event.preventDefault();\n minimum();\n break;\n case \"End\":\n event.preventDefault();\n maximum();\n break;\n }\n },\n [decrement, disabled, increment, maximum, minimum, onKeyDown, vertical]\n ),\n };\n\n // touch devices are a bit weird and cause issues since the \"start\" event is\n // also used for scrolling. If the user quickly grabs the draggable element\n // and drags vertically, most of the time it will try to scroll instead of\n // dragging the element. The workaround is to being the drag events\n // immediately on touchstart and disable scroll behavior for the page.\n //\n // There are also some issues with calling `event.preventDefault()` within\n // touch events even while `{ passive: false } is manually set, so need to\n // also attach a touchmove event.\n useScrollLock(isTouch && dragging);\n const touchEventHandlers: Required<DraggableTouchEventHandlers<E>> = {\n onTouchStart: useCallback(\n (event) => {\n onTouchStart(event);\n if (disabled || !isTouchDragStartEvent(event)) {\n return;\n }\n\n draggingRef.current = true;\n updateDragPosition({\n isDragStart: true,\n event,\n nodeRef,\n min,\n max,\n step,\n rangeMin,\n rangeMax,\n isRTL,\n reversed,\n vertical,\n setValue,\n setDragging,\n setDragPercentage,\n withinOffsetParent,\n });\n },\n [\n disabled,\n isRTL,\n max,\n min,\n nodeRef,\n onTouchStart,\n rangeMax,\n rangeMin,\n reversed,\n setDragging,\n setValue,\n step,\n vertical,\n withinOffsetParent,\n ]\n ),\n onTouchMove: useCallback(\n (event) => {\n onTouchMove(event);\n if (disabled || !draggingRef.current || !event.cancelable) {\n return;\n }\n\n // prevent the document's touchmove event from also firing\n event.stopPropagation();\n updateDragPosition({\n isDragStart: true,\n event,\n nodeRef,\n min,\n max,\n step,\n rangeMin,\n rangeMax,\n isRTL,\n reversed,\n vertical,\n setValue,\n setDragging,\n setDragPercentage,\n withinOffsetParent,\n });\n },\n [\n disabled,\n isRTL,\n max,\n min,\n nodeRef,\n onTouchMove,\n rangeMax,\n rangeMin,\n reversed,\n setDragging,\n setValue,\n step,\n vertical,\n withinOffsetParent,\n ]\n ),\n };\n\n return {\n ...touchEventHandlers,\n ...mouseEventHandlers,\n ...keyboardEventHandlers,\n value,\n setValue,\n dragging,\n setDragging,\n maximum,\n minimum,\n increment,\n decrement,\n draggedOnce,\n draggableRef: ref,\n percentage,\n dragPercentage,\n touchEventHandlers,\n mouseEventHandlers,\n keyboardEventHandlers,\n };\n}\n"],"names":["cnb","useCallback","useEffect","useRef","useState","useUserInteractionMode","useScrollLock","useDir","useEnsuredRef","useEnsuredState","useHtmlClassName","getPercentage","getRangeDefaultValue","getRangeSteps","nearest","withinRange","isMouseDragStartEvent","isTouchDragStartEvent","updateDragPosition","noop","useDraggable","options","ref","propRef","min","max","rangeMin","rangeMax","step","reversed","vertical","onKeyDown","onMouseUp","onMouseDown","onMouseMove","onTouchStart","onTouchMove","dragging","propDragging","setDragging","propSetDragging","value","propValue","setValue","propSetValue","defaultValue","withinOffsetParent","disabled","disableDraggingClassName","disableDraggingCursorClassName","nodeRef","isTouch","draggingRef","dragPercentage","setDragPercentage","isRTL","dir","percentage","maximum","minimum","increment","prevValue","decrement","draggingClassName","draggedOnce","current","updatePosition","event","cancelable","preventDefault","stopPropagation","isDragStart","stopDragging","updateKey","stopKey","passive","undefined","window","addEventListener","removeEventListener","prevRange","steps","mouseEventHandlers","keyboardEventHandlers","decrementKey","incrementKey","key","touchEventHandlers","draggableRef"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACjBqD,aAAa;gBACbJ;gBACAjB;gBACA1B;gBACAC;gBACAG;gBACAF;gBACAC;gBACA4B;gBACA1B;gBACAC;gBACAa;gBACAJ;gBACAe;gBACAR;YACF;QACF,GACA;YACEC;YACAQ;YACA9B;YACAD;YACA0B;YACAd;YACAT;YACAD;YACAG;YACAU;YACAI;YACAf;YACAE;YACAgB;SACD;IAEL;IAEA,OAAO;QACL,GAAGyC,kBAAkB;QACrB,GAAGL,kBAAkB;QACrB,GAAGC,qBAAqB;QACxB1C;QACAE;QACAN;QACAE;QACAmB;QACAC;QACAC;QACAE;QACAE;QACAwB,cAAclE;QACdmC;QACAJ;QACAkC;QACAL;QACAC;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/draggable/utils.ts"],"sourcesContent":["import { type MouseEvent, type RefObject, type TouchEvent } from \"react\";\nimport {\n getClientPosition,\n type ClientPositionEvent,\n type ClientPositionOptions,\n} from \"../utils/getClientPosition.js\";\nimport { getRangeSteps } from \"../utils/getRangeSteps.js\";\nimport { nearest } from \"../utils/nearest.js\";\nimport { withinRange } from \"../utils/withinRange.js\";\n\n/**\n * @internal\n */\nexport const isMouseDragStartEvent = (event: MouseEvent): boolean =>\n event.button === 0 &&\n !event.altKey &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey;\n\n/**\n * @internal\n */\nexport const isTouchDragStartEvent = (event: TouchEvent): boolean =>\n event.changedTouches.length === 1;\n\n/**\n * @internal\n */\ninterface DragPositionOptions extends ClientPositionOptions {\n isRTL: boolean;\n reversed: boolean;\n container: Element;\n}\n\n/**\n * @internal\n */\nexport const getDragPosition = (options: DragPositionOptions): number => {\n const { isRTL, reversed, vertical, container } = options;\n\n const clientPosition = getClientPosition(options);\n const { left, right, top } = container.getBoundingClientRect();\n if (vertical) {\n if (reversed) {\n return window.innerHeight - clientPosition;\n }\n\n // added `Math.max` since the `top` will be a negative number if rendered\n // within a portal element like a dialog/sheet\n return clientPosition - Math.max(0, top);\n }\n\n if (reversed ? !isRTL : isRTL) {\n return right - clientPosition;\n }\n\n return clientPosition - left;\n};\n\n/**\n * @internal\n */\ninterface RelativeDragPositionOptions extends DragPositionOptions {\n min: number;\n max: number;\n step: number;\n rangeMin: number;\n rangeMax: number;\n}\n\n/**\n * @internal\n */\ninterface RelativeDragPosition {\n value: number;\n dragPercentage: number;\n}\n\n/**\n * @internal\n */\nexport const getRelativeDragPosition = (\n options: RelativeDragPositionOptions\n): RelativeDragPosition => {\n const { min, max, rangeMin, rangeMax, step, isRTL, vertical, container } =\n options;\n\n const { height, width, left, top } = container.getBoundingClientRect();\n const containerSize = vertical ? height : width;\n const containerPosition = vertical ? top + height : left;\n const clientPosition = getClientPosition(options);\n\n const position = vertical\n ? containerPosition - clientPosition\n : clientPosition - containerPosition;\n const distanceDragged = Math.min(Math.max(0, position), containerSize);\n let dragPercentage = distanceDragged / containerSize;\n if (isRTL && !vertical) {\n dragPercentage = 1 - dragPercentage;\n }\n\n const range = rangeMax - rangeMin;\n const steps = getRangeSteps({ min: rangeMin, max: rangeMax, step });\n const value = dragPercentage * range + rangeMin;\n const nextValue = nearest({\n min,\n max,\n steps,\n range,\n value,\n });\n\n return {\n value: nextValue,\n dragPercentage,\n };\n};\n\n/**\n * @internal\n */\ninterface UpdateDragPositionOptions\n extends Omit<RelativeDragPositionOptions, \"container\"> {\n event: ClientPositionEvent;\n nodeRef: RefObject<HTMLElement>;\n focus?: boolean;\n isDragStart: boolean;\n setValue(value: number): void;\n setDragging(dragging: boolean): void;\n setDragPercentage(value: number): void;\n withinOffsetParent: boolean;\n}\n\n/**\n * @internal\n */\nexport const updateDragPosition = (\n options: UpdateDragPositionOptions\n): void => {\n const {\n event,\n nodeRef,\n min,\n max,\n step,\n rangeMin,\n rangeMax,\n isRTL,\n reversed,\n vertical,\n isDragStart,\n setValue,\n setDragging,\n setDragPercentage,\n withinOffsetParent,\n } = options;\n\n const element = nodeRef.current;\n if (!element) {\n return;\n }\n\n if (isDragStart) {\n // need to focus so that Chromium based browsers allow drag events. this\n // really appeared while trying to create a DnD tree\n element.focus({ preventScroll: true });\n\n if (!withinOffsetParent && !(\"changedTouches\" in event)) {\n return;\n }\n\n // unlike the other flow, start dragging immediately so that you can trigger\n // a mousedown or touchstart event on the container element and drag until\n // the user lets go\n setDragging(true);\n }\n\n // firefox defaults to `document.body` while chrome will return `null`\n const container = element.offsetParent || document.body;\n if (!withinOffsetParent) {\n const dragPosition = getDragPosition({\n event,\n isRTL,\n reversed,\n vertical,\n container,\n });\n const nextValue = withinRange({\n min,\n max,\n value: dragPosition,\n });\n setValue(nextValue);\n\n return;\n }\n\n const { value, dragPercentage } = getRelativeDragPosition({\n min,\n max,\n rangeMin,\n rangeMax,\n step,\n event,\n isRTL,\n reversed,\n vertical,\n container,\n });\n\n setValue(value);\n setDragPercentage(dragPercentage);\n};\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport interface DeserializeDraggableValueOptions {\n min: number;\n max: number;\n item: string;\n}\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport function deserializeDraggableValue(\n options: DeserializeDraggableValueOptions\n): number {\n const { item, min, max } = options;\n\n const value = parseFloat(item);\n if (Number.isNaN(item)) {\n return min;\n }\n\n return Math.max(min, Math.min(max, value));\n}\n"],"names":["getClientPosition","getRangeSteps","nearest","withinRange","isMouseDragStartEvent","event","button","altKey","metaKey","ctrlKey","shiftKey","isTouchDragStartEvent","changedTouches","length","getDragPosition","options","isRTL","reversed","vertical","container","clientPosition","left","right","top","getBoundingClientRect","window","innerHeight","Math","max","getRelativeDragPosition","min","rangeMin","rangeMax","step","height","width","containerSize","containerPosition","position","distanceDragged","dragPercentage","range","steps","value","nextValue","updateDragPosition","nodeRef","isDragStart","setValue","setDragging","setDragPercentage","withinOffsetParent","element","current","focus","preventScroll","offsetParent","document","body","dragPosition","deserializeDraggableValue","item","parseFloat","Number","isNaN"],"mappings":"AACA,SACEA,iBAAiB,QAGZ,gCAAgC;AACvC,SAASC,a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T;YACAW;YACAC;YACAC;YACAC;QACF;QACA,MAAMyB,YAAYzC,YAAY;YAC5B2B;YACAF;YACAe,OAAOgB;QACT;QACAX,SAASJ;QAET;IACF;IAEA,MAAM,EAAED,KAAK,EAAEH,cAAc,EAAE,GAAGX,wBAAwB;QACxDC;QACAF;QACAG;QACAC;QACAC;QACA5B;QACAW;QACAC;QACAC;QACAC;IACF;IAEA6B,SAASL;IACTO,kBAAkBV;AACpB,EAAE;AAYF;;;CAGC,GACD,OAAO,SAASoB,0BACd7C,OAAyC;IAEzC,MAAM,EAAE8C,IAAI,EAAE/B,GAAG,EAAEF,GAAG,EAAE,GAAGb;IAE3B,MAAM4B,QAAQmB,WAAWD;IACzB,IAAIE,OAAOC,KAAK,CAACH,OAAO;QACtB,OAAO/B;IACT;IAEA,OAAOH,KAAKC,GAAG,CAACE,KAAKH,KAAKG,GAAG,CAACF,KAAKe;AACrC"}
1
+ {"version":3,"sources":["../../src/draggable/utils.ts"],"sourcesContent":["import { type MouseEvent, type RefObject, type TouchEvent } from \"react\";\nimport {\n getClientPosition,\n type ClientPositionEvent,\n type ClientPositionOptions,\n} from \"../utils/getClientPosition.js\";\nimport { getRangeSteps } from \"../utils/getRangeSteps.js\";\nimport { nearest } from \"../utils/nearest.js\";\nimport { withinRange } from \"../utils/withinRange.js\";\n\n/**\n * @internal\n */\nexport const isMouseDragStartEvent = (event: MouseEvent): boolean =>\n event.button === 0 &&\n !event.altKey &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey;\n\n/**\n * @internal\n */\nexport const isTouchDragStartEvent = (event: TouchEvent): boolean =>\n event.changedTouches.length === 1;\n\n/**\n * @internal\n */\ninterface DragPositionOptions extends ClientPositionOptions {\n isRTL: boolean;\n reversed: boolean;\n container: Element;\n}\n\n/**\n * @internal\n */\nexport const getDragPosition = (options: DragPositionOptions): number => {\n const { isRTL, reversed, vertical, container } = options;\n\n const clientPosition = getClientPosition(options);\n const { left, right, top } = container.getBoundingClientRect();\n if (vertical) {\n if (reversed) {\n return window.innerHeight - clientPosition;\n }\n\n // added `Math.max` since the `top` will be a negative number if rendered\n // within a portal element like a dialog/sheet\n return clientPosition - Math.max(0, top);\n }\n\n if (reversed ? !isRTL : isRTL) {\n return right - clientPosition;\n }\n\n return clientPosition - left;\n};\n\n/**\n * @internal\n */\ninterface RelativeDragPositionOptions extends DragPositionOptions {\n min: number;\n max: number;\n step: number;\n rangeMin: number;\n rangeMax: number;\n}\n\n/**\n * @internal\n */\ninterface RelativeDragPosition {\n value: number;\n dragPercentage: number;\n}\n\n/**\n * @internal\n */\nexport const getRelativeDragPosition = (\n options: RelativeDragPositionOptions\n): RelativeDragPosition => {\n const { min, max, rangeMin, rangeMax, step, isRTL, vertical, container } =\n options;\n\n const { height, width, left, top } = container.getBoundingClientRect();\n const containerSize = vertical ? height : width;\n const containerPosition = vertical ? top + height : left;\n const clientPosition = getClientPosition(options);\n\n const position = vertical\n ? containerPosition - clientPosition\n : clientPosition - containerPosition;\n const distanceDragged = Math.min(Math.max(0, position), containerSize);\n let dragPercentage = distanceDragged / containerSize;\n if (isRTL && !vertical) {\n dragPercentage = 1 - dragPercentage;\n }\n\n const range = rangeMax - rangeMin;\n const steps = getRangeSteps({ min: rangeMin, max: rangeMax, step });\n const value = dragPercentage * range + rangeMin;\n const nextValue = nearest({\n min,\n max,\n steps,\n range,\n value,\n });\n\n return {\n value: nextValue,\n dragPercentage,\n };\n};\n\n/**\n * @internal\n */\ninterface UpdateDragPositionOptions\n extends Omit<RelativeDragPositionOptions, \"container\"> {\n event: ClientPositionEvent;\n nodeRef: RefObject<HTMLElement>;\n focus?: boolean;\n isDragStart: boolean;\n setValue(value: number): void;\n setDragging(dragging: boolean): void;\n setDragPercentage(value: number): void;\n withinOffsetParent: boolean;\n}\n\n/**\n * @internal\n */\nexport const updateDragPosition = (\n options: UpdateDragPositionOptions\n): void => {\n const {\n event,\n nodeRef,\n min,\n max,\n step,\n rangeMin,\n rangeMax,\n isRTL,\n reversed,\n vertical,\n isDragStart,\n setValue,\n setDragging,\n setDragPercentage,\n withinOffsetParent,\n } = options;\n\n const element = nodeRef.current;\n if (!element) {\n return;\n }\n\n if (isDragStart) {\n // need to focus so that Chromium based browsers allow drag events. this\n // really appeared while trying to create a DnD tree\n element.focus({ preventScroll: true });\n\n if (!withinOffsetParent && !(\"changedTouches\" in event)) {\n return;\n }\n\n // unlike the other flow, start dragging immediately so that you can trigger\n // a mousedown or touchstart event on the container element and drag until\n // the user lets go\n setDragging(true);\n }\n\n // firefox defaults to `document.body` while chrome will return `null`\n const container = element.offsetParent || document.body;\n if (!withinOffsetParent) {\n const dragPosition = getDragPosition({\n event,\n isRTL,\n reversed,\n vertical,\n container,\n });\n const nextValue = withinRange({\n min,\n max,\n value: dragPosition,\n });\n setValue(nextValue);\n\n return;\n }\n\n const { value, dragPercentage } = getRelativeDragPosition({\n min,\n max,\n rangeMin,\n rangeMax,\n step,\n event,\n isRTL,\n reversed,\n vertical,\n container,\n });\n\n setValue(value);\n setDragPercentage(dragPercentage);\n};\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport interface DeserializeDraggableValueOptions {\n min: number;\n max: number;\n item: string;\n}\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport function deserializeDraggableValue(\n options: DeserializeDraggableValueOptions\n): number {\n const { item, min, max } = options;\n\n const value = parseFloat(item);\n if (Number.isNaN(item)) {\n return min;\n }\n\n return Math.max(min, Math.min(max, value));\n}\n"],"names":["getClientPosition","getRangeSteps","nearest","withinRange","isMouseDragStartEvent","event","button","altKey","metaKey","ctrlKey","shiftKey","isTouchDragStartEvent","changedTouches","length","getDragPosition","options","isRTL","reversed","vertical","container","clientPosition","left","right","top","getBoundingClientRect","window","innerHeight","Math","max","getRelativeDragPosition","min","rangeMin","rangeMax","step","height","width","containerSize","containerPosition","position","distanceDragged","dragPercentage","range","steps","value","nextValue","updateDragPosition","nodeRef","isDragStart","setValue","setDragging","setDragPercentage","withinOffsetParent","element","current","focus","preventScroll","offsetParent","document","body","dragPosition","deserializeDraggableValue","item","parseFloat","Number","isNaN"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,SACEA,iBAAiB,QAGZ,gCAAgC;AACvC,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,SAASC,WAAW,QAAQ,0BAA0B;AAEtD;;CAEC,GACD,OAAO,MAAMC,wBAAwB,CAACC,QACpCA,MAAMC,MAAM,KAAK,KACjB,CAACD,MAAME,MAAM,IACb,CAACF,MAAMG,OAAO,IACd,CAACH,MAAMI,OAAO,IACd,CAACJ,MAAMK,QAAQ,CAAC;AAElB;;CAEC,GACD,OAAO,MAAMC,wBAAwB,CAACN,QACpCA,MAAMO,cAAc,CAACC,MAAM,KAAK,EAAE;AAWpC;;CAEC,GACD,OAAO,MAAMC,kBAAkB,CAACC;IAC9B,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGJ;IAEjD,MAAMK,iBAAiBpB,kBAAkBe;IACzC,MAAM,EAAEM,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAE,GAAGJ,UAAUK,qBAAqB;IAC5D,IAAIN,UAAU;QACZ,IAAID,UAAU;YACZ,OAAOQ,OAAOC,WAAW,GAAGN;QAC9B;QAEA,yEAAyE;QACzE,8CAA8C;QAC9C,OAAOA,iBAAiBO,KAAKC,GAAG,CAAC,GAAGL;IACtC;IAEA,IAAIN,WAAW,CAACD,QAAQA,OAAO;QAC7B,OAAOM,QAAQF;IACjB;IAEA,OAAOA,iBAAiBC;AAC1B,EAAE;AAqBF;;CAEC,GACD,OAAO,MAAMQ,0BAA0B,CACrCd;IAEA,MAAM,EAAEe,GAAG,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eAAe;QAAK;QAEpC,IAAI,CAACJ,sBAAsB,CAAE,CAAA,oBAAoB9C,KAAI,GAAI;YACvD;QACF;QAEA,4EAA4E;QAC5E,0EAA0E;QAC1E,mBAAmB;QACnB4C,YAAY;IACd;IAEA,sEAAsE;IACtE,MAAM9B,YAAYiC,QAAQI,YAAY,IAAIC,SAASC,IAAI;IACvD,IAAI,CAACP,oBAAoB;QACvB,MAAMQ,eAAe7C,gBAAgB;YACnCT;YACAW;YACAC;YACAC;YACAC;QACF;QACA,MAAMyB,YAAYzC,YAAY;YAC5B2B;YACAF;YACAe,OAAOgB;QACT;QACAX,SAASJ;QAET;IACF;IAEA,MAAM,EAAED,KAAK,EAAEH,cAAc,EAAE,GAAGX,wBAAwB;QACxDC;QACAF;QACAG;QACAC;QACAC;QACA5B;QACAW;QACAC;QACAC;QACAC;IACF;IAEA6B,SAASL;IACTO,kBAAkBV;AACpB,EAAE;AAYF;;;CAGC,GACD,OAAO,SAASoB,0BACd7C,OAAyC;IAEzC,MAAM,EAAE8C,IAAI,EAAE/B,GAAG,EAAEF,GAAG,EAAE,GAAGb;IAE3B,MAAM4B,QAAQmB,WAAWD;IACzB,IAAIE,OAAOC,KAAK,CAACH,OAAO;QACtB,OAAO/B;IACT;IAEA,OAAOH,KAAKC,GAAG,CAACE,KAAKH,KAAKG,GAAG,CAACF,KAAKe;AACrC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/expansion-panel/ExpansionList.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport { KeyboardMovementProvider } from \"../movement/useKeyboardMovementProvider.js\";\nimport { useExpansionList } from \"./useExpansionList.js\";\n\n/**\n * @remarks \\@since 6.0.0 No longer requires the `onKeyDown` prop.\n */\nexport interface ExpansionListProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * This component is only used to implement the keyboard movement behavior for\n * the `ExpansionPanel` components.\n *\n * @see {@link useExpansionList} for a custom implementation example if you do\n * not want to use a `<div>` for this wrapper component.\n * @remarks \\@since 6.0.0 Uses the new keyboard movement API and does not\n * require the `onKeyDOwn` prop to be provided.\n */\nexport const ExpansionList = forwardRef<HTMLDivElement, ExpansionListProps>(\n function ExpansionList(props, ref) {\n const { onClick, onFocus, onKeyDown, children, ...remaining } = props;\n\n const { movementContext, movementProps } = useExpansionList({\n onClick,\n onFocus,\n onKeyDown,\n });\n\n return (\n <KeyboardMovementProvider value={movementContext}>\n <div {...remaining} {...movementProps} ref={ref}>\n {children}\n </div>\n </KeyboardMovementProvider>\n );\n }\n);\n"],"names":["forwardRef","KeyboardMovementProvider","useExpansionList","ExpansionList","props","ref","onClick","onFocus","onKeyDown","children","remaining","movementContext","movementProps","value","div"],"mappings":"AAAA;;AACA,SAASA,UAAU,QAA6C,QAAQ;AACxE,SAASC,wBAAwB,QAAQ,6CAA6C;AACtF,SAASC,gBAAgB,QAAQ,wBAAwB;AASzD;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,8BAAgBH,WAC3B,SAASG,cAAcC,KAAK,EAAEC,GAAG;IAC/B,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGC,WAAW,GAAGN;IAEhE,MAAM,EAAEO,eAAe,EAAEC,aAAa,EAAE,GAAGV,iBAAiB;QAC1DI;QACAC;QACAC;IACF;IAEA,qBACE,KAACP;QAAyBY,OAAOF;kBAC/B,cAAA,KAACG;YAAK,GAAGJ,SAAS;YAAG,GAAGE,aAAa;YAAEP,KAAKA;sBACzCI;;;AAIT,GACA"}
1
+ {"version":3,"sources":["../../src/expansion-panel/ExpansionList.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport { KeyboardMovementProvider } from \"../movement/useKeyboardMovementProvider.js\";\nimport { useExpansionList } from \"./useExpansionList.js\";\n\n/**\n * @remarks \\@since 6.0.0 No longer requires the `onKeyDown` prop.\n */\nexport interface ExpansionListProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * This component is only used to implement the keyboard movement behavior for\n * the `ExpansionPanel` components.\n *\n * @see {@link useExpansionList} for a custom implementation example if you do\n * not want to use a `<div>` for this wrapper component.\n * @remarks \\@since 6.0.0 Uses the new keyboard movement API and does not\n * require the `onKeyDOwn` prop to be provided.\n */\nexport const ExpansionList = forwardRef<HTMLDivElement, ExpansionListProps>(\n function ExpansionList(props, ref) {\n const { onClick, onFocus, onKeyDown, children, ...remaining } = props;\n\n const { movementContext, movementProps } = useExpansionList({\n onClick,\n onFocus,\n onKeyDown,\n });\n\n return (\n <KeyboardMovementProvider value={movementContext}>\n <div {...remaining} {...movementProps} ref={ref}>\n {children}\n </div>\n </KeyboardMovementProvider>\n );\n }\n);\n"],"names":["forwardRef","KeyboardMovementProvider","useExpansionList","ExpansionList","props","ref","onClick","onFocus","onKeyDown","children","remaining","movementContext","movementProps","value","div"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SAASA,UAAU,QAA6C,QAAQ;AACxE,SAASC,wBAAwB,QAAQ,6CAA6C;AACtF,SAASC,gBAAgB,QAAQ,wBAAwB;AASzD;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,8BAAgBH,WAC3B,SAASG,cAAcC,KAAK,EAAEC,GAAG;IAC/B,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGC,WAAW,GAAGN;IAEhE,MAAM,EAAEO,eAAe,EAAEC,aAAa,EAAE,GAAGV,iBAAiB;QAC1DI;QACAC;QACAC;IACF;IAEA,qBACE,KAACP;QAAyBY,OAAOF;kBAC/B,cAAA,KAACG;YAAK,GAAGJ,SAAS;YAAG,GAAGE,aAAa;YAAEP,KAAKA;sBACzCI;;;AAIT,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/expansion-panel/ExpansionPanel.tsx"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport { forwardRef, type CSSProperties, type ReactNode } from \"react\";\nimport { Card, type CardProps } from \"../card/Card.js\";\nimport { CardContent, type CardContentProps } from \"../card/CardContent.js\";\nimport { useCollapseTransition } from \"../transition/useCollapseTransition.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { bem } from \"../utils/bem.js\";\nimport {\n ExpansionPanelHeader,\n type ExpansionPanelHeaderProps,\n} from \"./ExpansionPanelHeader.js\";\n\nconst styles = bem(\"rmd-expansion-panel\");\n\n/** @remarks \\@since 6.0.0 */\nexport interface ExpansionPanelClassNameOptions {\n className?: string;\n\n /**\n * @defaultValue `false`\n */\n expanded?: boolean;\n\n /**\n * Set this to `true` to disable the `margin-top` transition between multiple\n * panels\n *\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function expansionPanel(\n options: ExpansionPanelClassNameOptions = {}\n): string {\n const { className, expanded = false, disableTransition = false } = options;\n\n return cnb(styles({ expanded, animate: !disableTransition }), className);\n}\n\n/**\n * @remarks \\@since 6.0.0 Renamed some card props and updated for the latest\n * API.\n */\nexport interface ExpansionPanelProps extends CardProps {\n /**\n * Set this to `true` if the {@link children} should be visible. This should\n * generally be provided by the `useExpansionPanels` hook.\n */\n expanded: boolean;\n\n /**\n * A function that should toggle the {@link expanded} state. This should\n * generally be provided by the `useExpansionPanels` hook.\n */\n onExpandClick(): void;\n\n /**\n * Set this to `true` to prevent the panel from toggling the {@link expanded}\n * state. This should generally be provided by the `useExpansionPanels` hook.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * @defaultValue `true`\n * @see {@link CardProps.fullWidth}\n */\n fullWidth?: boolean;\n\n /**\n * This can be used to implement a custom header implementation, but it\n * probably shouldn't be needed.\n *\n * @remarks \\@since 6.0.0 This was renamed from `customHeader`\n * @see {@link headerProps}\n */\n header?: ReactNode;\n\n /**\n * This can be used to apply additional props to the header element.\n *\n * Note: You can override the `style` and `className` using\n * {@link headerStyle} and {@link headerClassName} instead for convenience.\n *\n * @example\n * ```tsx\n * <ExpansionPanel\n * {...props}\n * headerProps={{\n * style: {\n * // custom inline style\n * },\n * className: \"come-class-name\",\n * icon: <MyCustomIcon />,\n * iconRotatorProps: {\n * className: \"another-custom-class-name\",\n * },\n * }}\n * />\n * ```\n */\n headerProps?: Omit<\n ExpansionPanelHeaderProps,\n \"id\" | \"aria-disabled\" | \"onClick\" | \"expanded\"\n >;\n\n /**\n * Convenience prop to apply custom style to the `ExpansionPanelHeader`\n * component.\n */\n headerStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `ExpansionPanelHeader`\n * component.\n */\n headerClassName?: string;\n\n /**\n * Content to display within the header of the expansion panel that toggles\n * the expanded state. THis should generally contain some accessible text\n * describing the expansion panel's content.\n *\n * @remarks \\@since 6.0.0 THis was renamed from `header`\n */\n headerChildren?: ReactNode;\n\n /**\n * This can be used to apply additional props to the `CardContent` component\n * if needed.\n *\n * Note: The `disableLastChildPadding` defaults to `true` in this\n * implementation.\n *\n * @example\n * ```tsx\n * contentProps={{\n * style: {},\n * className: \"some-class-name\",\n * disablePadding: true,\n * disableSecondaryColor: true,\n * disableLastChildPadding: false,\n * // whatever else\n * }}\n * ```\n *\n * @see {@link contentStyle}\n * @see {@link contentClassName}\n * @see {@link disableContentPadding}\n */\n contentProps?: PropsWithRef<Omit<CardContentProps, \"role\">, HTMLDivElement>;\n\n /**\n * Convenience prop to apply custom style to the `CardContent` component.\n */\n contentStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `CardContent` component.\n */\n contentClassName?: string;\n\n /**\n * Set to `true` to disable the collapse transition for the card content\n * whenever the {@link expanded} state changes.\n *\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * @defaultValue `false`\n * @see {@link CardContentProps.disablePadding}\n */\n disableContentPadding?: boolean;\n\n /**\n * Set this to `true` to unmount the {@link children} when the\n * {@link expanded} state is `false`.\n *\n * @defaultValue `false`\n * @remarks \\@since 6.0.0 Renamed from `persistent` to match the\n * `useCollapseTransition` naming convention.\n */\n temporary?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * @see `useExpansionPanels` for examples.\n * @remarks\n * \\@since 6.0.0 The content will be persistent and invisible using `display: none`\n * instead of unmounting and also animate the `margin-top` style.\n */\nexport const ExpansionPanel = forwardRef<\n HTMLHeadingElement,\n ExpansionPanelProps\n>(function ExpansionPanel(props, ref) {\n const {\n id: propId,\n className,\n contentProps,\n contentStyle,\n contentClassName,\n header: propHeader,\n headerProps,\n headerStyle,\n headerClassName,\n headerChildren,\n children,\n expanded,\n onExpandClick,\n disabled = false,\n fullWidth = true,\n temporary = false,\n disableTransition = false,\n disableContentPadding = false,\n ...remaining\n } = props;\n\n const id = useEnsuredId(propId, \"expansion-panel\");\n const { elementProps, rendered } = useCollapseTransition({\n nodeRef: contentProps?.ref,\n style: contentStyle,\n className: contentClassName,\n timeout: disableTransition ? 0 : undefined,\n temporary,\n transitionIn: expanded,\n });\n\n let header = propHeader;\n if (typeof header === \"undefined\") {\n header = (\n <ExpansionPanelHeader\n style={headerStyle}\n className={headerClassName}\n disableTransition={disableTransition}\n {...headerProps}\n aria-disabled={disabled || undefined}\n id={id}\n onClick={onExpandClick}\n expanded={expanded}\n >\n {headerChildren}\n </ExpansionPanelHeader>\n );\n }\n\n return (\n <Card\n {...remaining}\n id={`${id}-container`}\n ref={ref}\n fullWidth={fullWidth}\n className={expansionPanel({\n expanded,\n disableTransition,\n className,\n })}\n >\n {header}\n {rendered && (\n <CardContent\n id={`${id}-content`}\n aria-labelledby={id}\n disablePadding={disableContentPadding}\n disableSecondaryColor\n disableLastChildPadding\n {...contentProps}\n {...elementProps}\n role=\"region\"\n >\n {children}\n </CardContent>\n )}\n </Card>\n );\n});\n"],"names":["cnb","forwardRef","Card","CardContent","useCollapseTransition","useEnsuredId","bem","ExpansionPanelHeader","styles","expansionPanel","options","className","expanded","disableTransition","animate","ExpansionPanel","props","ref","id","propId","contentProps","contentStyle","contentClassName","header","propHeader","headerProps","headerStyle","headerClassName","headerChildren","children","onExpandClick","disabled","fullWidth","temporary","disableContentPadding","remaining","elementProps","rendered","nodeRef","style","timeout","undefined","transitionIn","aria-disabled","onClick","aria-labelledby","disablePadding","disableSecondaryColor","disableLastChildPadding","role"],"mappings":"AAAA;;AACA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAA4C,QAAQ;AACvE,SAASC,IAAI,QAAwB,kBAAkB;AACvD,SAASC,WAAW,QAA+B,yBAAyB;AAC5E,SAASC,qBAAqB,QAAQ,yCAAyC;AAE/E,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,GAAG,QAAQ,kBAAkB;AACtC,SACEC,oBAAoB,QAEf,4BAA4B;AAEnC,MAAMC,SAASF,IAAI;AAoBnB;;CAEC,GACD,OAAO,SAASG,eACdC,UAA0C,CAAC,CAAC;IAE5C,MAAM,EAAEC,SAAS,EAAEC,WAAW,KAAK,EAAEC,oBAAoB,KAAK,EAAE,GAAGH;IAEnE,OAAOV,IAAIQ,OAAO;QAAEI;QAAUE,SAAS,CAACD;IAAkB,IAAIF;AAChE;AAuJA;;;;;;;CAOC,GACD,OAAO,MAAMI,+BAAiBd,WAG5B,SAASc,eAAeC,KAAK,EAAEC,GAAG;IAClC,MAAM,EACJC,IAAIC,MAAM,EACVR,SAAS,EACTS,YAAY,EACZC,YAAY,EACZC,gBAAgB,EAChBC,QAAQC,UAAU,EAClBC,WAAW,EACXC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,QAAQ,EACRjB,QAAQ,EACRkB,aAAa,EACbC,WAAW,KAAK,EAChBC,YAAY,IAAI,EAChBC,YAAY,KAAK,EACjBpB,oBAAoB,KAAK,EACzBqB,wBAAwB,KAAK,EAC7B,GAAGC,WACJ,GAAGnB;IAEJ,MAAME,KAAKb,aAAac,QAAQ;IAChC,MAAM,EAAEiB,YAAY,EAAEC,QAAQ,EAAE,GAAGjC,sBAAsB;QACvDkC,SAASlB,cAAcH;QACvBsB,OAAOlB;QACPV,WAAWW;QACXkB,SAAS3B,oBAAoB,IAAI4B;QACjCR;QACAS,cAAc9B;IAChB;IAEA,IAAIW,SAASC;IACb,IAAI,OAAOD,WAAW,aAAa;QACjCA,uBACE,KAAChB;YACCgC,OAAOb;YACPf,WAAWgB;YACXd,mBAAmBA;YAClB,GAAGY,WAAW;YACfkB,iBAAeZ,YAAYU;YAC3BvB,IAAIA;YACJ0B,SAASd;YACTlB,UAAUA;sBAETgB;;IAGP;IAEA,qBACE,MAAC1B;QACE,GAAGiC,SAAS;QACbjB,IAAI,CAAC,EAAEA,GAAG,UAAU,CAAC;QACrBD,KAAKA;QACLe,WAAWA;QACXrB,WAAWF,eAAe;YACxBG;YACAC;YACAF;QACF;;YAECY;YACAc,0BACC,KAAClC;gBACCe,IAAI,CAAC,EAAEA,GAAG,QAAQ,CAAC;gBACnB2B,mBAAiB3B;gBACjB4B,gBAAgBZ;gBAChBa,qBAAqB;gBACrBC,uBAAuB;gBACtB,GAAG5B,YAAY;gBACf,GAAGgB,YAAY;gBAChBa,MAAK;0BAEJpB;;;;AAKX,GAAG"}
1
+ {"version":3,"sources":["../../src/expansion-panel/ExpansionPanel.tsx"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport { forwardRef, type CSSProperties, type ReactNode } from \"react\";\nimport { Card, type CardProps } from \"../card/Card.js\";\nimport { CardContent, type CardContentProps } from \"../card/CardContent.js\";\nimport { useCollapseTransition } from \"../transition/useCollapseTransition.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { bem } from \"../utils/bem.js\";\nimport {\n ExpansionPanelHeader,\n type ExpansionPanelHeaderProps,\n} from \"./ExpansionPanelHeader.js\";\n\nconst styles = bem(\"rmd-expansion-panel\");\n\n/** @remarks \\@since 6.0.0 */\nexport interface ExpansionPanelClassNameOptions {\n className?: string;\n\n /**\n * @defaultValue `false`\n */\n expanded?: boolean;\n\n /**\n * Set this to `true` to disable the `margin-top` transition between multiple\n * panels\n *\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function expansionPanel(\n options: ExpansionPanelClassNameOptions = {}\n): string {\n const { className, expanded = false, disableTransition = false } = options;\n\n return cnb(styles({ expanded, animate: !disableTransition }), className);\n}\n\n/**\n * @remarks \\@since 6.0.0 Renamed some card props and updated for the latest\n * API.\n */\nexport interface ExpansionPanelProps extends CardProps {\n /**\n * Set this to `true` if the {@link children} should be visible. This should\n * generally be provided by the `useExpansionPanels` hook.\n */\n expanded: boolean;\n\n /**\n * A function that should toggle the {@link expanded} state. This should\n * generally be provided by the `useExpansionPanels` hook.\n */\n onExpandClick(): void;\n\n /**\n * Set this to `true` to prevent the panel from toggling the {@link expanded}\n * state. This should generally be provided by the `useExpansionPanels` hook.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * @defaultValue `true`\n * @see {@link CardProps.fullWidth}\n */\n fullWidth?: boolean;\n\n /**\n * This can be used to implement a custom header implementation, but it\n * probably shouldn't be needed.\n *\n * @remarks \\@since 6.0.0 This was renamed from `customHeader`\n * @see {@link headerProps}\n */\n header?: ReactNode;\n\n /**\n * This can be used to apply additional props to the header element.\n *\n * Note: You can override the `style` and `className` using\n * {@link headerStyle} and {@link headerClassName} instead for convenience.\n *\n * @example\n * ```tsx\n * <ExpansionPanel\n * {...props}\n * headerProps={{\n * style: {\n * // custom inline style\n * },\n * className: \"come-class-name\",\n * icon: <MyCustomIcon />,\n * iconRotatorProps: {\n * className: \"another-custom-class-name\",\n * },\n * }}\n * />\n * ```\n */\n headerProps?: Omit<\n ExpansionPanelHeaderProps,\n \"id\" | \"aria-disabled\" | \"onClick\" | \"expanded\"\n >;\n\n /**\n * Convenience prop to apply custom style to the `ExpansionPanelHeader`\n * component.\n */\n headerStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `ExpansionPanelHeader`\n * component.\n */\n headerClassName?: string;\n\n /**\n * Content to display within the header of the expansion panel that toggles\n * the expanded state. THis should generally contain some accessible text\n * describing the expansion panel's content.\n *\n * @remarks \\@since 6.0.0 THis was renamed from `header`\n */\n headerChildren?: ReactNode;\n\n /**\n * This can be used to apply additional props to the `CardContent` component\n * if needed.\n *\n * Note: The `disableLastChildPadding` defaults to `true` in this\n * implementation.\n *\n * @example\n * ```tsx\n * contentProps={{\n * style: {},\n * className: \"some-class-name\",\n * disablePadding: true,\n * disableSecondaryColor: true,\n * disableLastChildPadding: false,\n * // whatever else\n * }}\n * ```\n *\n * @see {@link contentStyle}\n * @see {@link contentClassName}\n * @see {@link disableContentPadding}\n */\n contentProps?: PropsWithRef<Omit<CardContentProps, \"role\">, HTMLDivElement>;\n\n /**\n * Convenience prop to apply custom style to the `CardContent` component.\n */\n contentStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `CardContent` component.\n */\n contentClassName?: string;\n\n /**\n * Set to `true` to disable the collapse transition for the card content\n * whenever the {@link expanded} state changes.\n *\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * @defaultValue `false`\n * @see {@link CardContentProps.disablePadding}\n */\n disableContentPadding?: boolean;\n\n /**\n * Set this to `true` to unmount the {@link children} when the\n * {@link expanded} state is `false`.\n *\n * @defaultValue `false`\n * @remarks \\@since 6.0.0 Renamed from `persistent` to match the\n * `useCollapseTransition` naming convention.\n */\n temporary?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * @see `useExpansionPanels` for examples.\n * @remarks\n * \\@since 6.0.0 The content will be persistent and invisible using `display: none`\n * instead of unmounting and also animate the `margin-top` style.\n */\nexport const ExpansionPanel = forwardRef<\n HTMLHeadingElement,\n ExpansionPanelProps\n>(function ExpansionPanel(props, ref) {\n const {\n id: propId,\n className,\n contentProps,\n contentStyle,\n contentClassName,\n header: propHeader,\n headerProps,\n headerStyle,\n headerClassName,\n headerChildren,\n children,\n expanded,\n onExpandClick,\n disabled = false,\n fullWidth = true,\n temporary = false,\n disableTransition = false,\n disableContentPadding = false,\n ...remaining\n } = props;\n\n const id = useEnsuredId(propId, \"expansion-panel\");\n const { elementProps, rendered } = useCollapseTransition({\n nodeRef: contentProps?.ref,\n style: contentStyle,\n className: contentClassName,\n timeout: disableTransition ? 0 : undefined,\n temporary,\n transitionIn: expanded,\n });\n\n let header = propHeader;\n if (typeof header === \"undefined\") {\n header = (\n <ExpansionPanelHeader\n style={headerStyle}\n className={headerClassName}\n disableTransition={disableTransition}\n {...headerProps}\n aria-disabled={disabled || undefined}\n id={id}\n onClick={onExpandClick}\n expanded={expanded}\n >\n {headerChildren}\n </ExpansionPanelHeader>\n );\n }\n\n return (\n <Card\n {...remaining}\n id={`${id}-container`}\n ref={ref}\n fullWidth={fullWidth}\n className={expansionPanel({\n expanded,\n disableTransition,\n className,\n })}\n >\n {header}\n {rendered && (\n <CardContent\n id={`${id}-content`}\n aria-labelledby={id}\n disablePadding={disableContentPadding}\n disableSecondaryColor\n disableLastChildPadding\n {...contentProps}\n {...elementProps}\n role=\"region\"\n >\n {children}\n </CardContent>\n )}\n </Card>\n );\n});\n"],"names":["cnb","forwardRef","Card","CardContent","useCollapseTransition","useEnsuredId","bem","ExpansionPanelHeader","styles","expansionPanel","options","className","expanded","disableTransition","animate","ExpansionPanel","props","ref","id","propId","contentProps","contentStyle","contentClassName","header","propHeader","headerProps","headerStyle","headerClassName","headerChildren","children","onExpandClick","disabled","fullWidth","temporary","disableContentPadding","remaining","elementProps","rendered","nodeRef","style","timeout","undefined","transitionIn","aria-disabled","onClick","aria-labelledby","disablePadding","disableSecondaryColor","disableLastChildPadding","role"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AA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WgB;YACXd,mBAAmBA;YAClB,GAAGY,WAAW;YACfkB,iBAAeZ,YAAYU;YAC3BvB,IAAIA;YACJ0B,SAASd;YACTlB,UAAUA;sBAETgB;;IAGP;IAEA,qBACE,MAAC1B;QACE,GAAGiC,SAAS;QACbjB,IAAI,CAAC,EAAEA,GAAG,UAAU,CAAC;QACrBD,KAAKA;QACLe,WAAWA;QACXrB,WAAWF,eAAe;YACxBG;YACAC;YACAF;QACF;;YAECY;YACAc,0BACC,KAAClC;gBACCe,IAAI,CAAC,EAAEA,GAAG,QAAQ,CAAC;gBACnB2B,mBAAiB3B;gBACjB4B,gBAAgBZ;gBAChBa,qBAAqB;gBACrBC,uBAAuB;gBACtB,GAAG5B,YAAY;gBACf,GAAGgB,YAAY;gBAChBa,MAAK;0BAEJpB;;;;AAKX,GAAG"}
@@ -1,7 +1,8 @@
1
1
  import { type ButtonHTMLAttributes, type MouseEventHandler, type ReactNode } from "react";
2
2
  import { type IconRotatorProps } from "../icon/IconRotator.js";
3
3
  import { type PropsWithRef } from "../types.js";
4
- import { type TypographyProps, type TypographyType } from "../typography/Typography.js";
4
+ import { type TypographyProps } from "../typography/Typography.js";
5
+ import { type TypographyType } from "../typography/typographyStyles.js";
5
6
  /**
6
7
  * @remarks \@since 6.0.0 Updated to include additional heading/Typography
7
8
  * props.
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cnb } from "cnbuilder";
3
3
  import { forwardRef } from "react";
4
4
  import { ButtonUnstyled } from "../button/ButtonUnstyled.js";
5
- import { getIcon } from "../icon/iconConfig.js";
6
5
  import { IconRotator } from "../icon/IconRotator.js";
6
+ import { getIcon } from "../icon/iconConfig.js";
7
7
  import { Typography } from "../typography/Typography.js";
8
8
  /**
9
9
  * **Server Component**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/expansion-panel/ExpansionPanelHeader.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n type ButtonHTMLAttributes,\n type MouseEventHandler,\n type ReactNode,\n} from \"react\";\nimport { ButtonUnstyled } from \"../button/ButtonUnstyled.js\";\nimport { getIcon } from \"../icon/iconConfig.js\";\nimport { IconRotator, type IconRotatorProps } from \"../icon/IconRotator.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport {\n Typography,\n type TypographyProps,\n type TypographyType,\n} from \"../typography/Typography.js\";\n\n/**\n * @remarks \\@since 6.0.0 Updated to include additional heading/Typography\n * props.\n */\nexport interface ExpansionPanelHeaderProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n id: string;\n\n /**\n * This should be a function that toggles the expansion state for the parent\n * `ExpansionPanel`.\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n expanded: boolean;\n\n /**\n * @defaultValue `\"h3\"`\n */\n as?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n\n /**\n * @defaultValue `getIcon(\"expander\")`\n */\n icon?: ReactNode;\n\n /**\n * @defaultValue `\"subtitle-1\"`\n */\n headingType?: TypographyType;\n\n /**\n * Any additional props to provide to the heading element that wraps the\n * expansion panel button.\n */\n headingProps?: PropsWithRef<TypographyProps, HTMLHeadingElement>;\n iconRotatorProps?: Omit<IconRotatorProps, \"rotated\" | \"disableTransition\">;\n\n /**\n * Any children to display **before** the button in the heading element. This\n * should really only be used if you need to add additional clickable elements\n * within the header.\n */\n beforeChildren?: ReactNode;\n\n /**\n * Any children to display **after** the button in the heading element.This\n * should really only be used if you need to add additional clickable elements\n * within the header.\n *\n * @example\n * ```tsx\n * afterChildren={\n * <DropdownMenu buttonType=\"icon\" ButtonChildren={<MoreVertSVGIcon />}>\n * <MenuItem>Item 1</MenuItem>\n * <MenuItem>Item 2</MenuItem>\n * <MenuItem>Item 3</MenuItem>\n * </DropdownMenu>\n * }\n * ```\n */\n afterChildren?: ReactNode;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n}\n\n/**\n * **Server Component**\n * This is mostly an internal component, but can also be used to implement a\n * custom header implementation if needed. This might really be a client\n * component in practice since the `onClick` prop must be provided.\n *\n * @example\n * Custom Header\n * ```tsx\n * import type { ExpansionPanelProps } from \"@react-md/core\";\n * import {\n * ExpansionPanel,\n * ExpansionPanelHeader,\n * } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n * const { useId } from \"react\";\n *\n * export type CustomExpansionPanelProps = ExpansionPanelProps & { id: string; };\n *\n * export function CustomExpansionPanel(props: CustomExpansionPanelProps): ReactElement {\n * const {\n * id,\n * disabled,\n * onExpandClick,\n * expanded,\n * disableTransition,\n * headerChildren,\n * } = props;\n *\n * return (\n * <ExpansionPanel\n * {...props}\n * header={(\n * <ExpansionPanelHeader\n * aria-disabled={disabled || undefined}\n * id={id}\n * onClick={onExpandClick}\n * expanded={expanded}\n * disableTransition={disableTransition}\n * // whatever props and any custom implementation\n * >\n * {headerChildren}\n * </ExpansionPanelHeader>\n * )}\n * />\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0 Updated to be wrapped by the {@link Typography}\n * component and rendered as an `<h6>`.\n */\nexport const ExpansionPanelHeader = forwardRef<\n HTMLHeadingElement,\n ExpansionPanelHeaderProps\n>(function ExpansionPanelHeader(props, ref) {\n const {\n id,\n headingType = \"subtitle-1\",\n headingProps,\n iconRotatorProps,\n icon: propIcon,\n expanded,\n className,\n children,\n beforeChildren,\n afterChildren,\n disableTransition = false,\n ...remaining\n } = props;\n\n const icon = getIcon(\"expander\", propIcon);\n\n return (\n <Typography\n ref={ref}\n type={headingType}\n margin=\"none\"\n {...headingProps}\n className={cnb(\"rmd-expansion-panel__heading\", headingProps?.className)}\n >\n {beforeChildren}\n <ButtonUnstyled\n {...remaining}\n aria-expanded={expanded}\n id={id}\n className={cnb(\"rmd-expansion-panel__button\", className)}\n >\n {children}\n {icon && (\n <IconRotator\n {...iconRotatorProps}\n rotated={expanded}\n disableTransition={disableTransition}\n >\n {icon}\n </IconRotator>\n )}\n </ButtonUnstyled>\n {afterChildren}\n </Typography>\n );\n});\n"],"names":["cnb","forwardRef","ButtonUnstyled","getIcon","IconRotator","Typography","ExpansionPanelHeader","props","ref","id","headingType","headingProps","iconRotatorProps","icon","propIcon","expanded","className","children","beforeChildren","afterChildren","disableTransition","remaining","type","margin","aria-expanded","rotated"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,QAIL,QAAQ;AACf,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,SAASC,OAAO,QAAQ,wBAAwB;AAChD,SAASC,WAAW,QAA+B,yBAAyB;AAE5E,SACEC,UAAU,QAGL,8BAA8B;AAsErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDC,GACD,OAAO,MAAMC,qCAAuBL,WAGlC,SAASK,qBAAqBC,KAAK,EAAEC,GAAG;IACxC,MAAM,EACJC,EAAE,EACFC,cAAc,YAAY,EAC1BC,YAAY,EACZC,gBAAgB,EAChBC,MAAMC,QAAQ,EACdC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,cAAc,EACdC,aAAa,EACbC,oBAAoB,KAAK,EACzB,GAAGC,WACJ,GAAGd;IAEJ,MAAMM,OAAOV,QAAQ,YAAYW;IAEjC,qBACE,MAACT;QACCG,KAAKA;QACLc,MAAMZ;QACNa,QAAO;QACN,GAAGZ,YAAY;QAChBK,WAAWhB,IAAI,gCAAgCW,cAAcK;;YAE5DE;0BACD,MAAChB;gBACE,GAAGmB,SAAS;gBACbG,iBAAeT;gBACfN,IAAIA;gBACJO,WAAWhB,IAAI,+BAA+BgB;;oBAE7CC;oBACAJ,sBACC,KAACT;wBACE,GAAGQ,gBAAgB;wBACpBa,SAASV;wBACTK,mBAAmBA;kCAElBP;;;;YAINM;;;AAGP,GAAG"}
1
+ {"version":3,"sources":["../../src/expansion-panel/ExpansionPanelHeader.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n type ButtonHTMLAttributes,\n type MouseEventHandler,\n type ReactNode,\n} from \"react\";\nimport { ButtonUnstyled } from \"../button/ButtonUnstyled.js\";\nimport { IconRotator, type IconRotatorProps } from \"../icon/IconRotator.js\";\nimport { getIcon } from \"../icon/iconConfig.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { Typography, type TypographyProps } from \"../typography/Typography.js\";\nimport { type TypographyType } from \"../typography/typographyStyles.js\";\n\n/**\n * @remarks \\@since 6.0.0 Updated to include additional heading/Typography\n * props.\n */\nexport interface ExpansionPanelHeaderProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n id: string;\n\n /**\n * This should be a function that toggles the expansion state for the parent\n * `ExpansionPanel`.\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n expanded: boolean;\n\n /**\n * @defaultValue `\"h3\"`\n */\n as?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n\n /**\n * @defaultValue `getIcon(\"expander\")`\n */\n icon?: ReactNode;\n\n /**\n * @defaultValue `\"subtitle-1\"`\n */\n headingType?: TypographyType;\n\n /**\n * Any additional props to provide to the heading element that wraps the\n * expansion panel button.\n */\n headingProps?: PropsWithRef<TypographyProps, HTMLHeadingElement>;\n iconRotatorProps?: Omit<IconRotatorProps, \"rotated\" | \"disableTransition\">;\n\n /**\n * Any children to display **before** the button in the heading element. This\n * should really only be used if you need to add additional clickable elements\n * within the header.\n */\n beforeChildren?: ReactNode;\n\n /**\n * Any children to display **after** the button in the heading element.This\n * should really only be used if you need to add additional clickable elements\n * within the header.\n *\n * @example\n * ```tsx\n * afterChildren={\n * <DropdownMenu buttonType=\"icon\" ButtonChildren={<MoreVertSVGIcon />}>\n * <MenuItem>Item 1</MenuItem>\n * <MenuItem>Item 2</MenuItem>\n * <MenuItem>Item 3</MenuItem>\n * </DropdownMenu>\n * }\n * ```\n */\n afterChildren?: ReactNode;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n}\n\n/**\n * **Server Component**\n * This is mostly an internal component, but can also be used to implement a\n * custom header implementation if needed. This might really be a client\n * component in practice since the `onClick` prop must be provided.\n *\n * @example\n * Custom Header\n * ```tsx\n * import type { ExpansionPanelProps } from \"@react-md/core\";\n * import {\n * ExpansionPanel,\n * ExpansionPanelHeader,\n * } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n * const { useId } from \"react\";\n *\n * export type CustomExpansionPanelProps = ExpansionPanelProps & { id: string; };\n *\n * export function CustomExpansionPanel(props: CustomExpansionPanelProps): ReactElement {\n * const {\n * id,\n * disabled,\n * onExpandClick,\n * expanded,\n * disableTransition,\n * headerChildren,\n * } = props;\n *\n * return (\n * <ExpansionPanel\n * {...props}\n * header={(\n * <ExpansionPanelHeader\n * aria-disabled={disabled || undefined}\n * id={id}\n * onClick={onExpandClick}\n * expanded={expanded}\n * disableTransition={disableTransition}\n * // whatever props and any custom implementation\n * >\n * {headerChildren}\n * </ExpansionPanelHeader>\n * )}\n * />\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0 Updated to be wrapped by the {@link Typography}\n * component and rendered as an `<h6>`.\n */\nexport const ExpansionPanelHeader = forwardRef<\n HTMLHeadingElement,\n ExpansionPanelHeaderProps\n>(function ExpansionPanelHeader(props, ref) {\n const {\n id,\n headingType = \"subtitle-1\",\n headingProps,\n iconRotatorProps,\n icon: propIcon,\n expanded,\n className,\n children,\n beforeChildren,\n afterChildren,\n disableTransition = false,\n ...remaining\n } = props;\n\n const icon = getIcon(\"expander\", propIcon);\n\n return (\n <Typography\n ref={ref}\n type={headingType}\n margin=\"none\"\n {...headingProps}\n className={cnb(\"rmd-expansion-panel__heading\", headingProps?.className)}\n >\n {beforeChildren}\n <ButtonUnstyled\n {...remaining}\n aria-expanded={expanded}\n id={id}\n className={cnb(\"rmd-expansion-panel__button\", className)}\n >\n {children}\n {icon && (\n <IconRotator\n {...iconRotatorProps}\n rotated={expanded}\n disableTransition={disableTransition}\n >\n {icon}\n </IconRotator>\n )}\n </ButtonUnstyled>\n {afterChildren}\n </Typography>\n );\n});\n"],"names":["cnb","forwardRef","ButtonUnstyled","IconRotator","getIcon","Typography","ExpansionPanelHeader","props","ref","id","headingType","headingProps","iconRotatorProps","icon","propIcon","expanded","className","children","beforeChildren","afterChildren","disableTransition","remaining","type","margin","aria-expanded","rotated"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,QAIL,QAAQ;AACf,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,SAASC,WAAW,QAA+B,yBAAyB;AAC5E,SAASC,OAAO,QAAQ,wBAAwB;AAEhD,SAASC,UAAU,QAA8B,8BAA8B;AAuE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDC,GACD,OAAO,MAAMC,qCAAuBL,WAGlC,SAASK,qBAAqBC,KAAK,EAAEC,GAAG;IACxC,MAAM,EACJC,EAAE,EACFC,cAAc,YAAY,EAC1BC,YAAY,EACZC,gBAAgB,EAChBC,MAAMC,QAAQ,EACdC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,cAAc,EACdC,aAAa,EACbC,oBAAoB,KAAK,EACzB,GAAGC,WACJ,GAAGd;IAEJ,MAAMM,OAAOT,QAAQ,YAAYU;IAEjC,qBACE,MAACT;QACCG,KAAKA;QACLc,MAAMZ;QACNa,QAAO;QACN,GAAGZ,YAAY;QAChBK,WAAWhB,IAAI,gCAAgCW,cAAcK;;YAE5DE;0BACD,MAAChB;gBACE,GAAGmB,SAAS;gBACbG,iBAAeT;gBACfN,IAAIA;gBACJO,WAAWhB,IAAI,+BAA+BgB;;oBAE7CC;oBACAJ,sBACC,KAACV;wBACE,GAAGS,gBAAgB;wBACpBa,SAASV;wBACTK,mBAAmBA;kCAElBP;;;;YAINM;;;AAGP,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/expansion-panel/useExpansionList.ts"],"sourcesContent":["\"use client\";\nimport type {\n FocusEventHandler,\n KeyboardEventHandler,\n MouseEventHandler,\n} from \"react\";\nimport type { KeyboardMovementProviderImplementation } from \"../movement/types.js\";\nimport { useKeyboardMovementProvider } from \"../movement/useKeyboardMovementProvider.js\";\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nconst getPanelsOnly = (container: HTMLElement): readonly HTMLElement[] => [\n ...container.querySelectorAll<HTMLElement>(\".rmd-expansion-panel__button\"),\n];\n\n/** @remarks \\@since 6.0.0 */\nexport interface ExpansionListHookOptions<E extends HTMLElement> {\n onClick?: MouseEventHandler<E>;\n onFocus?: FocusEventHandler<E>;\n onKeyDown?: KeyboardEventHandler<E>;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport type ExpansionListImplementation<E extends HTMLElement> =\n KeyboardMovementProviderImplementation<E>;\n\n/**\n * @example\n * Custom Implementation\n * ```tsx\n * import {\n * ExpansionPanel,\n * Form,\n * KeyboardMovementProvider,\n * useExpansionList,\n * useExpansionPanels,\n * } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * import { BillingAddress } from \"./BillingAddress\";\n * import { BillingInformation } from \"./BillingInformation\";\n * import { PersonalInformation } from \"./PersonalInformation\";\n *\n * function Example(): ReactElement {\n * const { movementContext, movementProps } = useExpansionList();\n * const { getPanelProps } = useExpansionPanels();\n *\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <Form {...movementProps}>\n * <ExpansionPanel {...getPanelProps(\"personal-information-panel\")}>\n * <PersonalInformation />\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(\"billing-information-panel\")}>\n * <BillingInformation />\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(\"billing-address-panel\")}>\n * <BillingAddress />\n * </ExpansionPanel>\n * </FOrm>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useExpansionList<E extends HTMLElement>(\n options: ExpansionListHookOptions<E> = {}\n): ExpansionListImplementation<E> {\n return useKeyboardMovementProvider({\n ...options,\n loopable: true,\n includeDisabled: true,\n getFocusableElements: getPanelsOnly,\n });\n}\n"],"names":["useKeyboardMovementProvider","getPanelsOnly","container","querySelectorAll","useExpansionList","options","loopable","includeDisabled","getFocusableElements"],"mappings":"AAAA;AAOA,SAASA,2BAA2B,QAAQ,6CAA6C;AAEzF;;;CAGC,GACD,MAAMC,gBAAgB,CAACC,YAAmD;WACrEA,UAAUC,gBAAgB,CAAc;KAC5C;AAaD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCC,GACD,OAAO,SAASC,iBACdC,UAAuC,CAAC,CAAC;IAEzC,OAAOL,4BAA4B;QACjC,GAAGK,OAAO;QACVC,UAAU;QACVC,iBAAiB;QACjBC,sBAAsBP;IACxB;AACF"}
1
+ {"version":3,"sources":["../../src/expansion-panel/useExpansionList.ts"],"sourcesContent":["\"use client\";\nimport type {\n FocusEventHandler,\n KeyboardEventHandler,\n MouseEventHandler,\n} from \"react\";\nimport type { KeyboardMovementProviderImplementation } from \"../movement/types.js\";\nimport { useKeyboardMovementProvider } from \"../movement/useKeyboardMovementProvider.js\";\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nconst getPanelsOnly = (container: HTMLElement): readonly HTMLElement[] => [\n ...container.querySelectorAll<HTMLElement>(\".rmd-expansion-panel__button\"),\n];\n\n/** @remarks \\@since 6.0.0 */\nexport interface ExpansionListHookOptions<E extends HTMLElement> {\n onClick?: MouseEventHandler<E>;\n onFocus?: FocusEventHandler<E>;\n onKeyDown?: KeyboardEventHandler<E>;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport type ExpansionListImplementation<E extends HTMLElement> =\n KeyboardMovementProviderImplementation<E>;\n\n/**\n * @example\n * Custom Implementation\n * ```tsx\n * import {\n * ExpansionPanel,\n * Form,\n * KeyboardMovementProvider,\n * useExpansionList,\n * useExpansionPanels,\n * } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * import { BillingAddress } from \"./BillingAddress\";\n * import { BillingInformation } from \"./BillingInformation\";\n * import { PersonalInformation } from \"./PersonalInformation\";\n *\n * function Example(): ReactElement {\n * const { movementContext, movementProps } = useExpansionList();\n * const { getPanelProps } = useExpansionPanels();\n *\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <Form {...movementProps}>\n * <ExpansionPanel {...getPanelProps(\"personal-information-panel\")}>\n * <PersonalInformation />\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(\"billing-information-panel\")}>\n * <BillingInformation />\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(\"billing-address-panel\")}>\n * <BillingAddress />\n * </ExpansionPanel>\n * </FOrm>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useExpansionList<E extends HTMLElement>(\n options: ExpansionListHookOptions<E> = {}\n): ExpansionListImplementation<E> {\n return useKeyboardMovementProvider({\n ...options,\n loopable: true,\n includeDisabled: true,\n getFocusableElements: getPanelsOnly,\n });\n}\n"],"names":["useKeyboardMovementProvider","getPanelsOnly","container","querySelectorAll","useExpansionList","options","loopable","includeDisabled","getFocusableElements"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAOA,SAASA,2BAA2B,QAAQ,6CAA6C;AAEzF;;;CAGC,GACD,MAAMC,gBAAgB,CAACC,YAAmD;WACrEA,UAAUC,gBAAgB,CAAc;KAC5C;AAaD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCC,GACD,OAAO,SAASC,iBACdC,UAAuC,CAAC,CAAC;IAEzC,OAAOL,4BAA4B;QACjC,GAAGK,OAAO;QACVC,UAAU;QACVC,iBAAiB;QACjBC,sBAAsBP;IACxB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/expansion-panel/useExpansionPanels.ts"],"sourcesContent":["\"use client\";\nimport { useState } from \"react\";\nimport type { UseStateInitializer, UseStateSetter } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport type { ExpansionPanelProps } from \"./ExpansionPanel.js\";\n\n/** @remarks \\@since 6.0.0 */\nexport interface ExpansionPanelHookOptions {\n /**\n * An optional id to prefix each panel with.\n *\n * @defaultValue `\"expansion-panel-\" + useId()`\n */\n baseId?: string;\n\n /**\n * Set this to `true` if multiple panels can be open at the same time.\n *\n * @defaultValue `false`\n */\n multiple?: boolean;\n\n /**\n * Set this to `true` to enforce that at least one panel must always be\n * expanded.\n *\n * @defaultValue `false`\n */\n preventAllCollapsed?: boolean;\n\n /**\n * This is a convenience option to disable the expansion transition for all\n * panels.\n *\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * @defaultValue `preventAllCollapsed ? [\"expansion-panel-\" + useId() + \"-1\"] : []`\n */\n defaultExpandedIds?: UseStateInitializer<string[]>;\n\n /**\n * This can only be used if the {@link defaultExpandedIds} was not provided\n * and using index based panels.\n *\n * @example\n * ```tsx\n * const { getPanelProps } = useExpansionPanels({\n * defaultExpandedIndex: 2,\n * });\n *\n * return (\n * <ExpansionPanel {...getPanelProps(0)} />\n * <ExpansionPanel {...getPanelProps(1)} />\n * // expanded on first render\n * <ExpansionPanel {...getPanelProps(2)} />\n * <ExpansionPanel {...getPanelProps(3)} />\n * );\n * ```\n */\n defaultExpandedIndex?: number;\n\n /**\n * @defaultValue `false`\n */\n disableContentPadding?: boolean;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport type ProvidedExpansionPanelProps = Pick<\n Required<ExpansionPanelProps>,\n | \"disabled\"\n | \"expanded\"\n | \"onExpandClick\"\n | \"disableTransition\"\n | \"disableContentPadding\"\n> & { id?: string };\n\n/**\n * @param indexOrPanelId - This should either be a DOM id to use for the panel\n * or the panel's index.\n * @returns Props to pass to an `ExpansionPanel` for it to work correctly.\n * @remarks \\@since 6.0.0\n */\nexport type GetExpansionPanelProps = (\n indexOrPanelId: string | number\n) => ProvidedExpansionPanelProps;\n\n/** @remarks \\@since 6.0.0 */\nexport interface ExpansionPanelImplementation {\n /**\n * The current set of expanded panel ids if you need this for some reason.\n */\n expandedIds: ReadonlySet<string>;\n\n /**\n * This can be used to manually control which panels are expanded if the\n * default behavior does not work for your use case.\n */\n setExpandedIds: UseStateSetter<ReadonlySet<string>>;\n\n /**\n * @example\n * Index Based Panels\n * ```tsx\n * <ExpansionPanel {...getPanelProps(0)} />\n * <ExpansionPanel {...getPanelProps(1)} />\n * <ExpansionPanel {...getPanelProps(2)} />\n * ```\n *\n * @example\n * Custom Panel Ids\n * ```tsx\n * <ExpansionPanel {...getPanelProps(\"address-panel\")} />\n * <ExpansionPanel {...getPanelProps(\"billing-panel\")} />\n * <ExpansionPanel {...getPanelProps(\"confirmation-panel\")} />\n * ```\n */\n getPanelProps: GetExpansionPanelProps;\n}\n\n/**\n * Use this hook to control the expanded state for a group of `ExpansionPanel`.\n *\n * @example\n * Index Based Panels\n * ```tsx\n * import {\n * ExpansionList,\n * ExpansionPanel,\n * useExpansionPanels,\n * } from \"@react-md/core\";\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { getPanelProps } = useExpansionPanels();\n *\n * return (\n * <ExpansionList>\n * <ExpansionPanel {...getPanelProps(0)} headerChildren=\"Panel 1\">\n * Panel 1 Contents\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(1)} headerChildren=\"Panel 2\">\n * Panel 2 Contents\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(2)} headerChildren=\"Panel 3\">\n * Panel 3 Contents\n * </ExpansionPanel>\n * </ExpansionList>\n * );\n * }\n * ```\n *\n * @example\n * Custom Panel Ids and Expand All Panels by Default\n * ```tsx\n * import {\n * ExpansionList,\n * ExpansionPanel,\n * useExpansionPanels,\n * } from \"@react-md/core\";\n * import { type ReactElement } from \"react\";\n *\n * import { BillingAddress } from \"./BillingAddress\";\n * import { BillingInformation } from \"./BillingInformation\";\n * import { PersonalInformation } from \"./PersonalInformation\";\n *\n * const panel1Id = \"personal-information-panel\";\n * const panel2Id = \"billing-information-panel\";\n * const panel3Id = \"billing-address-panel\";\n *\n * function Example(): ReactElement {\n * const { getPanelProps } = useExpansionPanels({\n * multiple: true,\n * defaultExpandedIds: () => [panel1Id, panel2Id, panel3Id],\n * });\n *\n * return (\n * <ExpansionList>\n * <ExpansionPanel {...getPanelProps(panel1Id)} headerChildren=\"Personal Information\">\n * <PersonalInformation />\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(panel2Id)} headerChildren=\"Billing Information\">\n * <BillingInformation />\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(panel3Id)} headerChildren=\"Billing Address\">\n * <BillingAddress />\n * </ExpansionPanel>\n * </ExpansionList>\n * );\n * }\n * ```\n *\n *\n * @remarks\n * \\@since 6.0.0 The hook was renamed from `usePanels` to `useExpansionPanels`,\n * the API changed to return `getPanelProps` instead of a generated list of\n * panel props based on the provided `count`, and the hook no longer supports\n * having all panels expanded by default.\n */\nexport function useExpansionPanels(\n options: ExpansionPanelHookOptions = {}\n): ExpansionPanelImplementation {\n const {\n baseId: propBaseId,\n multiple = false,\n preventAllCollapsed = false,\n disableTransition = false,\n defaultExpandedIds,\n defaultExpandedIndex,\n disableContentPadding = false,\n } = options;\n\n const baseId = useEnsuredId(propBaseId, \"expansion-panel\");\n const createId = (index: number): string => `${baseId}-${index + 1}`;\n const [expandedIds, setExpandedIds] = useState<ReadonlySet<string>>(() => {\n if (typeof defaultExpandedIds === \"undefined\") {\n const initialList: string[] = [];\n if (typeof defaultExpandedIndex === \"number\" || preventAllCollapsed) {\n initialList.push(createId(defaultExpandedIndex ?? 0));\n }\n\n return new Set(initialList);\n }\n\n const ids =\n typeof defaultExpandedIds === \"function\"\n ? defaultExpandedIds()\n : defaultExpandedIds;\n return new Set(ids);\n });\n\n return {\n expandedIds,\n setExpandedIds,\n getPanelProps(indexOrPanelId) {\n let id: string | undefined;\n let panelId: string;\n if (typeof indexOrPanelId === \"number\") {\n id = createId(indexOrPanelId);\n panelId = id;\n } else {\n panelId = indexOrPanelId;\n }\n\n const expanded = expandedIds.has(panelId);\n const disabled =\n expanded && preventAllCollapsed && expandedIds.size === 1;\n return {\n id,\n disabled,\n expanded,\n onExpandClick() {\n if (disabled) {\n return;\n }\n\n setExpandedIds((prevIds) => {\n const expanded = prevIds.has(panelId);\n if (!multiple) {\n return new Set(expanded ? [] : [panelId]);\n }\n\n const nextIds = new Set(prevIds);\n if (expanded) {\n nextIds.delete(panelId);\n } else {\n nextIds.add(panelId);\n }\n\n return nextIds;\n });\n },\n disableTransition,\n disableContentPadding,\n };\n },\n };\n}\n"],"names":["useState","useEnsuredId","useExpansionPanels","options","baseId","propBaseId","multiple","preventAllCollapsed","disableTransition","defaultExpandedIds","defaultExpandedIndex","disableContentPadding","createId","index","expandedIds","setExpandedIds","initialList","push","Set","ids","getPanelProps","indexOrPanelId","id","panelId","expanded","has","disabled","size","onExpandClick","prevIds","nextIds","delete","add"],"mappings":"AAAA;AACA,SAASA,QAAQ,QAAQ,QAAQ;AAEjC,SAASC,YAAY,QAAQ,qBAAqB;AAwHlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EC,GACD,OAAO,SAASC,mBACdC,UAAqC,CAAC,CAAC;IAEvC,MAAM,EACJC,QAAQC,UAAU,EAClBC,WAAW,KAAK,EAChBC,sBAAsB,KAAK,EAC3BC,oBAAoB,KAAK,EACzBC,kBAAkB,EAClBC,oBAAoB,EACpBC,wBAAwB,KAAK,EAC9B,GAAGR;IAEJ,MAAMC,SAASH,aAAaI,YAAY;IACxC,MAAMO,WAAW,CAACC,QAA0B,CAAC,EAAET,OAAO,CAAC,EAAES,QAAQ,EAAE,CAAC;IACpE,MAAM,CAACC,aAAaC,eAAe,GAAGf,SAA8B;QAClE,IAAI,OAAOS,uBAAuB,aAAa;YAC7C,MAAMO,cAAwB,EAAE;YAChC,IAAI,OAAON,yBAAyB,YAAYH,qBAAqB;gBACnES,YAAYC,IAAI,CAACL,SAASF,wBAAwB;YACpD;YAEA,OAAO,IAAIQ,IAAIF;QACjB;QAEA,MAAMG,MACJ,OAAOV,uBAAuB,aAC1BA,uBACAA;QACN,OAAO,IAAIS,IAAIC;IACjB;IAEA,OAAO;QACLL;QACAC;QACAK,eAAcC,cAAc;YAC1B,IAAIC;YACJ,IAAIC;YACJ,IAAI,OAAOF,mBAAmB,UAAU;gBACtCC,KAAKV,SAASS;gBACdE,UAAUD;YACZ,OAAO;gBACLC,UAAUF;YACZ;YAEA,MAAMG,WAAWV,YAAYW,GAAG,CAACF;YACjC,MAAMG,WACJF,YAAYjB,uBAAuBO,YAAYa,IAAI,KAAK;YAC1D,OAAO;gBACLL;gBACAI;gBACAF;gBACAI;oBACE,IAAIF,UAAU;wBACZ;oBACF;oBAEAX,eAAe,CAACc;wBACd,MAAML,WAAWK,QAAQJ,GAAG,CAACF;wBAC7B,IAAI,CAACjB,UAAU;4BACb,OAAO,IAAIY,IAAIM,WAAW,EAAE,GAAG;gCAACD;6BAAQ;wBAC1C;wBAEA,MAAMO,UAAU,IAAIZ,IAAIW;wBACxB,IAAIL,UAAU;4BACZM,QAAQC,MAAM,CAACR;wBACjB,OAAO;4BACLO,QAAQE,GAAG,CAACT;wBACd;wBAEA,OAAOO;oBACT;gBACF;gBACAtB;gBACAG;YACF;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/expansion-panel/useExpansionPanels.ts"],"sourcesContent":["\"use client\";\nimport { useState } from \"react\";\nimport type { UseStateInitializer, UseStateSetter } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport type { ExpansionPanelProps } from \"./ExpansionPanel.js\";\n\n/** @remarks \\@since 6.0.0 */\nexport interface ExpansionPanelHookOptions {\n /**\n * An optional id to prefix each panel with.\n *\n * @defaultValue `\"expansion-panel-\" + useId()`\n */\n baseId?: string;\n\n /**\n * Set this to `true` if multiple panels can be open at the same time.\n *\n * @defaultValue `false`\n */\n multiple?: boolean;\n\n /**\n * Set this to `true` to enforce that at least one panel must always be\n * expanded.\n *\n * @defaultValue `false`\n */\n preventAllCollapsed?: boolean;\n\n /**\n * This is a convenience option to disable the expansion transition for all\n * panels.\n *\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * @defaultValue `preventAllCollapsed ? [\"expansion-panel-\" + useId() + \"-1\"] : []`\n */\n defaultExpandedIds?: UseStateInitializer<string[]>;\n\n /**\n * This can only be used if the {@link defaultExpandedIds} was not provided\n * and using index based panels.\n *\n * @example\n * ```tsx\n * const { getPanelProps } = useExpansionPanels({\n * defaultExpandedIndex: 2,\n * });\n *\n * return (\n * <ExpansionPanel {...getPanelProps(0)} />\n * <ExpansionPanel {...getPanelProps(1)} />\n * // expanded on first render\n * <ExpansionPanel {...getPanelProps(2)} />\n * <ExpansionPanel {...getPanelProps(3)} />\n * );\n * ```\n */\n defaultExpandedIndex?: number;\n\n /**\n * @defaultValue `false`\n */\n disableContentPadding?: boolean;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport type ProvidedExpansionPanelProps = Pick<\n Required<ExpansionPanelProps>,\n | \"disabled\"\n | \"expanded\"\n | \"onExpandClick\"\n | \"disableTransition\"\n | \"disableContentPadding\"\n> & { id?: string };\n\n/**\n * @param indexOrPanelId - This should either be a DOM id to use for the panel\n * or the panel's index.\n * @returns Props to pass to an `ExpansionPanel` for it to work correctly.\n * @remarks \\@since 6.0.0\n */\nexport type GetExpansionPanelProps = (\n indexOrPanelId: string | number\n) => ProvidedExpansionPanelProps;\n\n/** @remarks \\@since 6.0.0 */\nexport interface ExpansionPanelImplementation {\n /**\n * The current set of expanded panel ids if you need this for some reason.\n */\n expandedIds: ReadonlySet<string>;\n\n /**\n * This can be used to manually control which panels are expanded if the\n * default behavior does not work for your use case.\n */\n setExpandedIds: UseStateSetter<ReadonlySet<string>>;\n\n /**\n * @example\n * Index Based Panels\n * ```tsx\n * <ExpansionPanel {...getPanelProps(0)} />\n * <ExpansionPanel {...getPanelProps(1)} />\n * <ExpansionPanel {...getPanelProps(2)} />\n * ```\n *\n * @example\n * Custom Panel Ids\n * ```tsx\n * <ExpansionPanel {...getPanelProps(\"address-panel\")} />\n * <ExpansionPanel {...getPanelProps(\"billing-panel\")} />\n * <ExpansionPanel {...getPanelProps(\"confirmation-panel\")} />\n * ```\n */\n getPanelProps: GetExpansionPanelProps;\n}\n\n/**\n * Use this hook to control the expanded state for a group of `ExpansionPanel`.\n *\n * @example\n * Index Based Panels\n * ```tsx\n * import {\n * ExpansionList,\n * ExpansionPanel,\n * useExpansionPanels,\n * } from \"@react-md/core\";\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { getPanelProps } = useExpansionPanels();\n *\n * return (\n * <ExpansionList>\n * <ExpansionPanel {...getPanelProps(0)} headerChildren=\"Panel 1\">\n * Panel 1 Contents\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(1)} headerChildren=\"Panel 2\">\n * Panel 2 Contents\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(2)} headerChildren=\"Panel 3\">\n * Panel 3 Contents\n * </ExpansionPanel>\n * </ExpansionList>\n * );\n * }\n * ```\n *\n * @example\n * Custom Panel Ids and Expand All Panels by Default\n * ```tsx\n * import {\n * ExpansionList,\n * ExpansionPanel,\n * useExpansionPanels,\n * } from \"@react-md/core\";\n * import { type ReactElement } from \"react\";\n *\n * import { BillingAddress } from \"./BillingAddress\";\n * import { BillingInformation } from \"./BillingInformation\";\n * import { PersonalInformation } from \"./PersonalInformation\";\n *\n * const panel1Id = \"personal-information-panel\";\n * const panel2Id = \"billing-information-panel\";\n * const panel3Id = \"billing-address-panel\";\n *\n * function Example(): ReactElement {\n * const { getPanelProps } = useExpansionPanels({\n * multiple: true,\n * defaultExpandedIds: () => [panel1Id, panel2Id, panel3Id],\n * });\n *\n * return (\n * <ExpansionList>\n * <ExpansionPanel {...getPanelProps(panel1Id)} headerChildren=\"Personal Information\">\n * <PersonalInformation />\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(panel2Id)} headerChildren=\"Billing Information\">\n * <BillingInformation />\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(panel3Id)} headerChildren=\"Billing Address\">\n * <BillingAddress />\n * </ExpansionPanel>\n * </ExpansionList>\n * );\n * }\n * ```\n *\n *\n * @remarks\n * \\@since 6.0.0 The hook was renamed from `usePanels` to `useExpansionPanels`,\n * the API changed to return `getPanelProps` instead of a generated list of\n * panel props based on the provided `count`, and the hook no longer supports\n * having all panels expanded by default.\n */\nexport function useExpansionPanels(\n options: ExpansionPanelHookOptions = {}\n): ExpansionPanelImplementation {\n const {\n baseId: propBaseId,\n multiple = false,\n preventAllCollapsed = false,\n disableTransition = false,\n defaultExpandedIds,\n defaultExpandedIndex,\n disableContentPadding = false,\n } = options;\n\n const baseId = useEnsuredId(propBaseId, \"expansion-panel\");\n const createId = (index: number): string => `${baseId}-${index + 1}`;\n const [expandedIds, setExpandedIds] = useState<ReadonlySet<string>>(() => {\n if (typeof defaultExpandedIds === \"undefined\") {\n const initialList: string[] = [];\n if (typeof defaultExpandedIndex === \"number\" || preventAllCollapsed) {\n initialList.push(createId(defaultExpandedIndex ?? 0));\n }\n\n return new Set(initialList);\n }\n\n const ids =\n typeof defaultExpandedIds === \"function\"\n ? defaultExpandedIds()\n : defaultExpandedIds;\n return new Set(ids);\n });\n\n return {\n expandedIds,\n setExpandedIds,\n getPanelProps(indexOrPanelId) {\n let id: string | undefined;\n let panelId: string;\n if (typeof indexOrPanelId === \"number\") {\n id = createId(indexOrPanelId);\n panelId = id;\n } else {\n panelId = indexOrPanelId;\n }\n\n const expanded = expandedIds.has(panelId);\n const disabled =\n expanded && preventAllCollapsed && expandedIds.size === 1;\n return {\n id,\n disabled,\n expanded,\n onExpandClick() {\n if (disabled) {\n return;\n }\n\n setExpandedIds((prevIds) => {\n const expanded = prevIds.has(panelId);\n if (!multiple) {\n return new Set(expanded ? [] : [panelId]);\n }\n\n const nextIds = new Set(prevIds);\n if (expanded) {\n nextIds.delete(panelId);\n } else {\n nextIds.add(panelId);\n }\n\n return nextIds;\n });\n },\n disableTransition,\n disableContentPadding,\n };\n },\n };\n}\n"],"names":["useState","useEnsuredId","useExpansionPanels","options","baseId","propBaseId","multiple","preventAllCollapsed","disableTransition","defaultExpandedIds","defaultExpandedIndex","disableContentPadding","createId","index","expandedIds","setExpandedIds","initialList","push","Set","ids","getPanelProps","indexOrPanelId","id","panelId","expanded","has","disabled","size","onExpandClick","prevIds","nextIds","delete","add"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,SAASA,QAAQ,QAAQ,QAAQ;AAEjC,SAASC,YAAY,QAAQ,qBAAqB;AAwHlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EC,GACD,OAAO,SAASC,mBACdC,UAAqC,CAAC,CAAC;IAEvC,MAAM,EACJC,QAAQC,UAAU,EAClBC,WAAW,KAAK,EAChBC,sBAAsB,KAAK,EAC3BC,oBAAoB,KAAK,EACzBC,kBAAkB,EAClBC,oBAAoB,EACpBC,wBAAwB,KAAK,EAC9B,GAAGR;IAEJ,MAAMC,SAASH,aAAaI,YAAY;IACxC,MAAMO,WAAW,CAACC,QAA0B,CAAC,EAAET,OAAO,CAAC,EAAES,QAAQ,EAAE,CAAC;IACpE,MAAM,CAACC,aAAaC,eAAe,GAAGf,SAA8B;QAClE,IAAI,OAAOS,uBAAuB,aAAa;YAC7C,MAAMO,cAAwB,EAAE;YAChC,IAAI,OAAON,yBAAyB,YAAYH,qBAAqB;gBACnES,YAAYC,IAAI,CAACL,SAASF,wBAAwB;YACpD;YAEA,OAAO,IAAIQ,IAAIF;QACjB;QAEA,MAAMG,MACJ,OAAOV,uBAAuB,aAC1BA,uBACAA;QACN,OAAO,IAAIS,IAAIC;IACjB;IAEA,OAAO;QACLL;QACAC;QACAK,eAAcC,cAAc;YAC1B,IAAIC;YACJ,IAAIC;YACJ,IAAI,OAAOF,mBAAmB,UAAU;gBACtCC,KAAKV,SAASS;gBACdE,UAAUD;YACZ,OAAO;gBACLC,UAAUF;YACZ;YAEA,MAAMG,WAAWV,YAAYW,GAAG,CAACF;YACjC,MAAMG,WACJF,YAAYjB,uBAAuBO,YAAYa,IAAI,KAAK;YAC1D,OAAO;gBACLL;gBACAI;gBACAF;gBACAI;oBACE,IAAIF,UAAU;wBACZ;oBACF;oBAEAX,eAAe,CAACc;wBACd,MAAML,WAAWK,QAAQJ,GAAG,CAACF;wBAC7B,IAAI,CAACjB,UAAU;4BACb,OAAO,IAAIY,IAAIM,WAAW,EAAE,GAAG;gCAACD;6BAAQ;wBAC1C;wBAEA,MAAMO,UAAU,IAAIZ,IAAIW;wBACxB,IAAIL,UAAU;4BACZM,QAAQC,MAAM,CAACR;wBACjB,OAAO;4BACLO,QAAQE,GAAG,CAACT;wBACd;wBAEA,OAAOO;oBACT;gBACF;gBACAtB;gBACAG;YACF;QACF;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/focus/useFocusContainer.ts"],"sourcesContent":["\"use client\";\nimport type { KeyboardEventHandler, Ref, RefObject } from \"react\";\nimport { useEffect, useRef } from \"react\";\nimport { TRANSITION_CONFIG } from \"../transition/config.js\";\nimport type {\n TransitionCallbacks,\n TransitionEnterHandler,\n TransitionExitHandler,\n} from \"../transition/types.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport type { FocusElementWithinType } from \"./utils.js\";\nimport { focusElementWithin, getFocusableElements } from \"./utils.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * `\"mount\"` - this will attempt to focus the container element if:\n * - there is no `document.activeElement`\n * - the container element does not contain the `document.activeElement`\n *\n * `\"unmount\"` - attempts to re-focus the element that was focused before the\n * focus container became active. The previous focus element is captured\n * whenever the `activate` option on the `useFocusContainer` hook is set to\n * `true`. This is normally when an element becomes `visible`.\n *\n * `\"keyboard\"` - refocuses the first focusable element if pressing `Tab` would\n * move the focus outside of the container element. If `Shift + Tab` was used,\n * the last focusable element will be used instead.\n *\n * @remarks \\@since 6.0.0\n */\nexport type FocusType = \"mount\" | \"unmount\" | \"keyboard\";\n\n/** @remarks \\@since 6.0.0 */\nexport type FocusContainerTransitionCallbacks = Pick<\n TransitionCallbacks,\n \"onEntering\" | \"onEntered\" | \"onExiting\" | \"onExited\"\n>;\n\n/** @remarks \\@since 6.0.0 */\nexport interface FocusContainerTransitionOptions<E extends HTMLElement>\n extends FocusContainerTransitionCallbacks {\n /**\n * An optional ref that will be merged with the\n * {@link FocusContainerImplementation.nodeRef}\n */\n nodeRef?: Ref<E>;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface FocusContainerEventHandlers<E extends HTMLElement> {\n onKeyDown?: KeyboardEventHandler<E>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type IsFocusTypeDisabled = (type: FocusType) => boolean;\n\nexport interface FocusContainerComponentProps {\n /**\n * @defaultValue `() => false`\n */\n isFocusTypeDisabled?: IsFocusTypeDisabled;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface FocusContainerOptions<E extends HTMLElement>\n extends FocusContainerTransitionOptions<E>,\n FocusContainerComponentProps {\n onKeyDown?: KeyboardEventHandler<E>;\n /**\n * This to `true` will capture the current focused element as a focus target\n * once the `onExited` hook is fired. This should usually be set to the\n * `transitionIn` prop for `useTransition`.\n */\n activate: boolean;\n\n /**\n * Set this to true if elements that can be programmatically focused should be\n * included. These would be elements with a `tabIndex={-1}`.\n *\n * @defaultValue `false`\n */\n programmatic?: boolean;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface FocusContainerImplementation<E extends HTMLElement> {\n nodeRef: RefObject<E>;\n eventHandlers: Required<FocusContainerEventHandlers<E>>;\n transitionOptions: Required<FocusContainerTransitionOptions<E>>;\n}\n\n/**\n * This hook is mostly for internal use only for dialog accessibility behavior\n * to prevent the focus from moving outside of the dialog while it is visible.\n * This API was developed to be used with the `useCSSTransition`/`useTransition`\n * hooks as well.\n *\n * @example\n * Main Usage\n * ```tsx\n * import {\n * Button,\n * useFocusContainer,\n * useScaleTransition,\n * useToggle,\n * } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { toggled, enable, disable } = useToggle(false);\n *\n * const { eventHandlers, transitionOptions } = useFocusContainer({\n * activate: toggled,\n * });\n * const { elementProps, rendered } = useScaleTransition({\n * transitionIn: toggled,\n * temporary: true,\n * ...transitionOptions,\n * });\n *\n * return (\n * <>\n * <Button onClick={enable}>Toggle</Button>\n * {rendered && (\n * <div {...eventHandlers} {...elementProps}>\n * <Button onClick={disable}>Button 1</Button>\n * <Button onClick={disable}>Button 2</Button>\n * <Button onClick={disable}>Button 3</Button>\n * <Button onClick={disable}>Button 4</Button>\n * </div>\n * )}\n * </>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useFocusContainer<E extends HTMLElement>(\n options: FocusContainerOptions<E>\n): FocusContainerImplementation<E> {\n const {\n nodeRef,\n activate,\n onEntering = noop,\n onEntered = noop,\n onExiting = noop,\n onExited = noop,\n onKeyDown = noop,\n programmatic = false,\n disableTransition = false,\n isFocusTypeDisabled = noop,\n } = options;\n\n const [ref, refCallback] = useEnsuredRef(nodeRef);\n const prevFocus = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n if (!activate || !(document.activeElement instanceof HTMLElement)) {\n return;\n }\n\n prevFocus.current = document.activeElement;\n }, [activate]);\n\n const handleMountFocus =\n (callback: TransitionEnterHandler, skipped: boolean) =>\n (appearing: boolean) => {\n callback(appearing);\n const instance = ref.current;\n if (\n instance &&\n !skipped &&\n !isFocusTypeDisabled(\"mount\") &&\n (!document.activeElement || !instance.contains(document.activeElement))\n ) {\n instance.focus();\n }\n };\n\n const handleUnmountFocus =\n (callback: TransitionExitHandler, skipped: boolean) => (): void => {\n callback();\n if (skipped || isFocusTypeDisabled(\"unmount\")) {\n return;\n }\n\n // For some reason, the `\"Enter\"` keydown event fires at a different timing\n // than the Space keydown event.\n window.requestAnimationFrame(() => {\n prevFocus.current?.focus();\n });\n };\n\n return {\n nodeRef: ref,\n transitionOptions: {\n nodeRef: refCallback,\n onEntering: handleMountFocus(onEntering, false),\n onEntered: handleMountFocus(\n onEntered,\n !disableTransition && !TRANSITION_CONFIG.disabled\n ),\n onExiting: handleUnmountFocus(onExiting, false),\n onExited: handleUnmountFocus(\n onExited,\n !disableTransition && !TRANSITION_CONFIG.disabled\n ),\n },\n eventHandlers: {\n onKeyDown(event) {\n onKeyDown(event);\n if (\n event.isPropagationStopped() ||\n event.key !== \"Tab\" ||\n isFocusTypeDisabled(\"keyboard\")\n ) {\n return;\n }\n\n const { target, shiftKey, currentTarget } = event;\n const elements = getFocusableElements(currentTarget, programmatic);\n const count = elements.length;\n if (count === 0) {\n event.preventDefault();\n return;\n }\n\n // if the container element is the current focus, need to either focus\n // the first or last element so focus doesn't escape\n let type: FocusElementWithinType | undefined;\n if (\n count === 1 ||\n (!shiftKey &&\n (target === currentTarget || target === elements[count - 1]))\n ) {\n type = \"first\";\n } else if (\n shiftKey &&\n (target === currentTarget || target === elements[0])\n ) {\n type = \"last\";\n }\n\n if (type) {\n event.preventDefault();\n focusElementWithin({\n type,\n elements,\n container: currentTarget,\n });\n }\n },\n },\n };\n}\n"],"names":["useEffect","useRef","TRANSITION_CONFIG","useEnsuredRef","focusElementWithin","getFocusableElements","noop","useFocusContainer","options","nodeRef","activate","onEntering","onEntered","onExiting","onExited","onKeyDown","programmatic","disableTransition","isFocusTypeDisabled","ref","refCallback","prevFocus","document","activeElement","HTMLElement","current","handleMountFocus","callback","skipped","appearing","instance","contains","focus","handleUnmountFocus","window","requestAnimationFrame","transitionOptions","disabled","eventHandlers","event","isPropagationStopped","key","target","shiftKey","currentTarget","elements","count","length","preventDefault","type","container"],"mappings":"AAAA;AAEA,SAASA,SAAS,EAAEC,MAAM,QAAQ,QAAQ;AAC1C,SAASC,iBAAiB,QAAQ,0BAA0B;AAM5D,SAASC,aAAa,QAAQ,sBAAsB;AAEpD,SAASC,kBAAkB,EAAEC,oBAAoB,QAAQ,aAAa;AAEtE,MAAMC,OAAO;AACX,aAAa;AACf;AAsFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CC,GACD,OAAO,SAASC,kBACdC,OAAiC;IAEjC,MAAM,EACJC,OAAO,EACPC,QAAQ,EACRC,aAAaL,IAAI,EACjBM,YAAYN,IAAI,EAChBO,YAAYP,IAAI,EAChBQ,WAAWR,IAAI,EACfS,YAAYT,IAAI,EAChBU,eAAe,KAAK,EACpBC,oBAAoB,KAAK,EACzBC,sBAAsBZ,IAAI,EAC3B,GAAGE;IAEJ,MAAM,CAACW,KAAKC,YAAY,GAAGjB,cAAcM;IACzC,MAAMY,YAAYpB,OAA2B;IAE7CD,UAAU;QACR,IAAI,CAACU,YAAY,CAAEY,CAAAA,SAASC,aAAa,YAAYC,WAAU,GAAI;YACjE;QACF;QAEAH,UAAUI,OAAO,GAAGH,SAASC,aAAa;IAC5C,GAAG;QAACb;KAAS;IAEb,MAAMgB,mBACJ,CAACC,UAAkCC,UACnC,CAACC;YACCF,SAASE;YACT,MAAMC,WAAWX,IAAIM,OAAO;YAC5B,IACEK,YACA,CAACF,WACD,CAACV,oBAAoB,YACpB,CAAA,CAACI,SAASC,aAAa,IAAI,CAACO,SAASC,QAAQ,C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ACF;YACF;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/focus/useFocusContainer.ts"],"sourcesContent":["\"use client\";\nimport type { KeyboardEventHandler, Ref, RefObject } from \"react\";\nimport { useEffect, useRef } from \"react\";\nimport { TRANSITION_CONFIG } from \"../transition/config.js\";\nimport type {\n TransitionCallbacks,\n TransitionEnterHandler,\n TransitionExitHandler,\n} from \"../transition/types.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport type { FocusElementWithinType } from \"./utils.js\";\nimport { focusElementWithin, getFocusableElements } from \"./utils.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * `\"mount\"` - this will attempt to focus the container element if:\n * - there is no `document.activeElement`\n * - the container element does not contain the `document.activeElement`\n *\n * `\"unmount\"` - attempts to re-focus the element that was focused before the\n * focus container became active. The previous focus element is captured\n * whenever the `activate` option on the `useFocusContainer` hook is set to\n * `true`. This is normally when an element becomes `visible`.\n *\n * `\"keyboard\"` - refocuses the first focusable element if pressing `Tab` would\n * move the focus outside of the container element. If `Shift + Tab` was used,\n * the last focusable element will be used instead.\n *\n * @remarks \\@since 6.0.0\n */\nexport type FocusType = \"mount\" | \"unmount\" | \"keyboard\";\n\n/** @remarks \\@since 6.0.0 */\nexport type FocusContainerTransitionCallbacks = Pick<\n TransitionCallbacks,\n \"onEntering\" | \"onEntered\" | \"onExiting\" | \"onExited\"\n>;\n\n/** @remarks \\@since 6.0.0 */\nexport interface FocusContainerTransitionOptions<E extends HTMLElement>\n extends FocusContainerTransitionCallbacks {\n /**\n * An optional ref that will be merged with the\n * {@link FocusContainerImplementation.nodeRef}\n */\n nodeRef?: Ref<E>;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface FocusContainerEventHandlers<E extends HTMLElement> {\n onKeyDown?: KeyboardEventHandler<E>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type IsFocusTypeDisabled = (type: FocusType) => boolean;\n\nexport interface FocusContainerComponentProps {\n /**\n * @defaultValue `() => false`\n */\n isFocusTypeDisabled?: IsFocusTypeDisabled;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface FocusContainerOptions<E extends HTMLElement>\n extends FocusContainerTransitionOptions<E>,\n FocusContainerComponentProps {\n onKeyDown?: KeyboardEventHandler<E>;\n /**\n * This to `true` will capture the current focused element as a focus target\n * once the `onExited` hook is fired. This should usually be set to the\n * `transitionIn` prop for `useTransition`.\n */\n activate: boolean;\n\n /**\n * Set this to true if elements that can be programmatically focused should be\n * included. These would be elements with a `tabIndex={-1}`.\n *\n * @defaultValue `false`\n */\n programmatic?: boolean;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface FocusContainerImplementation<E extends HTMLElement> {\n nodeRef: RefObject<E>;\n eventHandlers: Required<FocusContainerEventHandlers<E>>;\n transitionOptions: Required<FocusContainerTransitionOptions<E>>;\n}\n\n/**\n * This hook is mostly for internal use only for dialog accessibility behavior\n * to prevent the focus from moving outside of the dialog while it is visible.\n * This API was developed to be used with the `useCSSTransition`/`useTransition`\n * hooks as well.\n *\n * @example\n * Main Usage\n * ```tsx\n * import {\n * Button,\n * useFocusContainer,\n * useScaleTransition,\n * useToggle,\n * } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { toggled, enable, disable } = useToggle(false);\n *\n * const { eventHandlers, transitionOptions } = useFocusContainer({\n * activate: toggled,\n * });\n * const { elementProps, rendered } = useScaleTransition({\n * transitionIn: toggled,\n * temporary: true,\n * ...transitionOptions,\n * });\n *\n * return (\n * <>\n * <Button onClick={enable}>Toggle</Button>\n * {rendered && (\n * <div {...eventHandlers} {...elementProps}>\n * <Button onClick={disable}>Button 1</Button>\n * <Button onClick={disable}>Button 2</Button>\n * <Button onClick={disable}>Button 3</Button>\n * <Button onClick={disable}>Button 4</Button>\n * </div>\n * )}\n * </>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useFocusContainer<E extends HTMLElement>(\n options: FocusContainerOptions<E>\n): FocusContainerImplementation<E> {\n const {\n nodeRef,\n activate,\n onEntering = noop,\n onEntered = noop,\n onExiting = noop,\n onExited = noop,\n onKeyDown = noop,\n programmatic = false,\n disableTransition = false,\n isFocusTypeDisabled = noop,\n } = options;\n\n const [ref, refCallback] = useEnsuredRef(nodeRef);\n const prevFocus = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n if (!activate || !(document.activeElement instanceof HTMLElement)) {\n return;\n }\n\n prevFocus.current = document.activeElement;\n }, [activate]);\n\n const handleMountFocus =\n (callback: TransitionEnterHandler, skipped: boolean) =>\n (appearing: boolean) => {\n callback(appearing);\n const instance = ref.current;\n if (\n instance &&\n !skipped &&\n !isFocusTypeDisabled(\"mount\") &&\n (!document.activeElement || !instance.contains(document.activeElement))\n ) {\n instance.focus();\n }\n };\n\n const handleUnmountFocus =\n (callback: TransitionExitHandler, skipped: boolean) => (): void => {\n callback();\n if (skipped || isFocusTypeDisabled(\"unmount\")) {\n return;\n }\n\n // For some reason, the `\"Enter\"` keydown event fires at a different timing\n // than the Space keydown event.\n window.requestAnimationFrame(() => {\n prevFocus.current?.focus();\n });\n };\n\n return {\n nodeRef: ref,\n transitionOptions: {\n nodeRef: refCallback,\n onEntering: handleMountFocus(onEntering, false),\n onEntered: handleMountFocus(\n onEntered,\n !disableTransition && !TRANSITION_CONFIG.disabled\n ),\n onExiting: handleUnmountFocus(onExiting, false),\n onExited: handleUnmountFocus(\n onExited,\n !disableTransition && !TRANSITION_CONFIG.disabled\n ),\n },\n eventHandlers: {\n onKeyDown(event) {\n onKeyDown(event);\n if (\n event.isPropagationStopped() ||\n event.key !== \"Tab\" ||\n isFocusTypeDisabled(\"keyboard\")\n ) {\n return;\n }\n\n const { target, shiftKey, currentTarget } = event;\n const elements = getFocusableElements(currentTarget, programmatic);\n const count = elements.length;\n if (count === 0) {\n event.preventDefault();\n return;\n }\n\n // if the container element is the current focus, need to either focus\n // the first or last element so focus doesn't escape\n let type: FocusElementWithinType | undefined;\n if (\n count === 1 ||\n (!shiftKey &&\n (target === currentTarget || target === elements[count - 1]))\n ) {\n type = \"first\";\n } else if (\n shiftKey &&\n (target === currentTarget || target === elements[0])\n ) {\n type = \"last\";\n }\n\n if (type) {\n event.preventDefault();\n focusElementWithin({\n type,\n elements,\n container: currentTarget,\n });\n }\n },\n },\n };\n}\n"],"names":["useEffect","useRef","TRANSITION_CONFIG","useEnsuredRef","focusElementWithin","getFocusableElements","noop","useFocusContainer","options","nodeRef","activate","onEntering","onEntered","onExiting","onExited","onKeyDown","programmatic","disableTransition","isFocusTypeDisabled","ref","refCallback","prevFocus","document","activeElement","HTMLElement","current","handleMountFocus","callback","skipped","appearing","instance","contains","focus","handleUnmountFocus","window","requestAnimationFrame","transitionOptions","disabled","eventHandlers","event","isPropagationStopped","key","target","shiftKey","currentTarget","elements","count","length","preventDefault","type","container"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,SAAS,EAAEC,MAAM,QAAQ,QAAQ;AAC1C,SAASC,iBAAiB,QAAQ,0BAA0B;AAM5D,SAASC,aAAa,QAAQ,sBAAsB;AAEpD,SAASC,kBAAkB,EAAEC,oBAAoB,QAAQ,aAAa;AAEtE,MAAMC,OAAO;AACX,aAAa;AACf;AAsFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CC,GACD,OAAO,SAASC,kBACdC,OAAiC;IAEjC,MAAM,EACJC,OAAO,EACPC,QAAQ,EACRC,aAAaL,IAAI,EACjBM,YAAYN,IAAI,EAChBO,YAAYP,IAAI,EAChBQ,WAAWR,IAAI,EACfS,YAAYT,IAAI,EAChBU,eAAe,KAAK,EACpBC,oBAAoB,KAAK,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gBACrD,MAAM8B,QAAQD,SAASE,MAAM;gBAC7B,IAAID,UAAU,GAAG;oBACfP,MAAMS,cAAc;oBACpB;gBACF;gBAEA,sEAAsE;gBACtE,oDAAoD;gBACpD,IAAIC;gBACJ,IACEH,UAAU,KACT,CAACH,YACCD,CAAAA,WAAWE,iBAAiBF,WAAWG,QAAQ,CAACC,QAAQ,EAAE,AAAD,GAC5D;oBACAG,OAAO;gBACT,OAAO,IACLN,YACCD,CAAAA,WAAWE,iBAAiBF,WAAWG,QAAQ,CAAC,EAAE,AAAD,GAClD;oBACAI,OAAO;gBACT;gBAEA,IAAIA,MAAM;oBACRV,MAAMS,cAAc;oBACpB5C,mBAAmB;wBACjB6C;wBACAJ;wBACAK,WAAWN;oBACb;gBACF;YACF;QACF;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/focus/utils.ts"],"sourcesContent":["const queries = [\n 'input:not([type=\"hidden\"]):not([disabled])',\n \"button:not([disabled])\",\n \"textarea:not([disabled])\",\n \"select:not([disabled])\",\n \"a[href]\",\n \"area[href]\",\n \"[tabindex]\",\n] as const;\n\n/**\n * A query selector to find elements that are programmatically focusable.\n *\n * Example:\n *\n * ```ts\n * const focusableElements = document.querySelectorAll(PROGRAMMATICALLY_FOCUSABLE);\n * // do something with elements\n * ```\n */\nexport const PROGRAMMATICALLY_FOCUSABLE = queries.join(\",\");\n\n/**\n * A query selector to find elements that are focusable only with tab and shift+tab.\n *\n * Example:\n *\n * ```ts\n * const focusableElements = document.querySelectorAll(TAB_FOCUSABLE);\n * // do something with elements\n * ```\n *\n * @remarks \\@since 6.0.0 This was updated to remove ALL elements that have a\n * `tabindex=\"-1\"` applied instead of only elements that had a manual tab index\n * applied.\n */\nexport const TAB_FOCUSABLE = queries.reduce((fullQuery, query) => {\n const prefix = `${fullQuery}${fullQuery ? \",\" : \"\"}`;\n const notProgrammaticQuery = `${query}:not([tabindex=\"-1\"])`;\n\n return `${prefix}${notProgrammaticQuery}`;\n}, \"\");\n\n/**\n * A simple util that will find all the tab focusable elements within a\n * container element. The container should normally be a specific HTMLElement,\n * but it can also be the entire document if you want to find **all** focusable\n * elements within your page.\n *\n * @remarks\n * \\@since 6.0.0 This function will be used for all keyboard focus behavior\n * instead of trying to use refs. I did some performance testing in Firefox and\n * Chrome and the `querySelectorAll` takes 4ms with 5000 elements for my use\n * cases. There is more of a performance issue around rendering all 5000\n * elements and since this is only used for specific keydown events, this is\n * good enough for me.\n *\n * @param container - The container element/document to find focusable elements\n * within.\n * @param programmatic - Boolean if programmatically focusable elements should be\n * included instead of only tab focusable.\n * @returns A list of HTMLElements that are focusable within the container.\n */\nexport function getFocusableElements(\n container: HTMLElement | Document,\n programmatic = false\n): readonly HTMLElement[] {\n // spread operator is faster than Array.from\n return [\n ...container.querySelectorAll<HTMLElement>(\n programmatic ? PROGRAMMATICALLY_FOCUSABLE : TAB_FOCUSABLE\n ),\n ];\n}\n\n/**\n * Attempts to find the first focusable element within a container.\n *\n * @remarks \\@since 6.0.0\n * @param container - The container element/document to find focusable elements\n * within.\n * @param programmatic - Boolean if programmatically focusable elements should be\n * included instead of only tab focusable.\n * @returns A list of HTMLElements that are focusable within the container.\n */\nexport function getFocusableElement(\n container: HTMLElement | Document,\n programmatic = false\n): HTMLElement | null {\n return container.querySelector<HTMLElement>(\n programmatic ? PROGRAMMATICALLY_FOCUSABLE : TAB_FOCUSABLE\n );\n}\n\n/**\n * An element can be tab focused if it is:\n * - an anchor or area with an `href`\n * - a non-disabled `input` element that is not `type=\"hidden\"`\n * - a non-disabled `button`, `textarea`, or `select` element\n * - an element with a `tabIndex >= 0`\n *\n * An element can be noted as \"programmatically focusable only\" has the above\n * rules, but the `tabIndex` will be set to `-1`.\n *\n * @remarks \\@since 2.8.0\n */\nexport type ElementFocusType = \"tab\" | \"programmatic\";\n\nexport function isFocusable(\n element: HTMLElement | Document | Window,\n type: ElementFocusType = \"programmatic\"\n): element is HTMLElement {\n const selector = type === \"tab\" ? TAB_FOCUSABLE : PROGRAMMATICALLY_FOCUSABLE;\n\n return \"matches\" in element && element.matches(selector);\n}\n\nexport type FocusElementWithinType =\n | \"first\"\n | \"last\"\n | \"query\"\n | \"self\"\n | \"none\";\n\nexport interface FocusElementWithinOptions {\n type: FocusElementWithinType;\n query?: string;\n elements: readonly HTMLElement[];\n container: HTMLElement | Document;\n}\n\nexport function focusElementWithin(options: FocusElementWithinOptions): void {\n const { type, query = \"\", container, elements } = options;\n if (type === \"none\") {\n return;\n }\n\n let element: HTMLElement | null = null;\n if (type === \"first\") {\n [element] = elements;\n } else if (type === \"last\") {\n element = elements[elements.length - 1];\n } else if (type === \"query\") {\n element = document.querySelector<HTMLElement>(query);\n }\n\n if (!element && isFocusable(container)) {\n element = container;\n }\n\n // TODO: Why did I add preventScroll?\n element?.focus();\n}\n"],"names":["queries","PROGRAMMATICALLY_FOCUSABLE","join","TAB_FOCUSABLE","reduce","fullQuery","query","prefix","notProgrammaticQuery","getFocusableElements","container","programmatic","querySelectorAll","getFocusableElement","querySelector","isFocusable","element","type","selector","matches","focusElementWithin","options","elements","length","document","focus"],"mappings":"AAAA,MAAMA,UAAU;IACd;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED;;;;;;;;;CASC,GACD,OAAO,MAAMC,6BAA6BD,QAAQE,IAAI,CAAC,KAAK;AAE5D;;;;;;;;;;;;;CAaC,GACD,OAAO,MAAMC,gBAAgBH,QAAQI,MAAM,CAAC,CAACC,WAAWC;IACtD,MAAMC,SAAS,CAAC,EAAEF,UAAU,EAAEA,YAAY,MAAM,GAAG,CAAC;IACpD,MAAMG,uBAAuB,CAAC,EAAEF,MAAM,qBAAqB,CAAC;IAE5D,OAAO,CAAC,EAAEC,OAAO,EAAEC,qBAAqB,CAAC;AAC3C,GAAG,IAAI;AAEP;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,SAASC,qBACdC,SAAiC,EACjCC,eAAe,KAAK;IAEpB,4CAA4C;IAC5C,OAAO;WACFD,UAAUE,gBAAgB,CAC3BD,eAAeV,6BAA6BE;KAE/C;AACH;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASU,oBACdH,SAAiC,EACjCC,eAAe,KAAK;IAEpB,OAAOD,UAAUI,aAAa,CAC5BH,eAAeV,6BAA6BE;AAEhD;AAgBA,OAAO,SAASY,YACdC,OAAwC,EACxCC,OAAyB,cAAc;IAEvC,MAAMC,WAAWD,SAAS,QAAQd,gBAAgBF;IAElD,OAAO,aAAae,WAAWA,QAAQG,OAAO,CAACD;AACjD;AAgBA,OAAO,SAASE,mBAAmBC,OAAkC;IACnE,MAAM,EAAEJ,IAAI,EAAEX,QAAQ,EAAE,EAAEI,SAAS,EAAEY,QAAQ,EAAE,GAAGD;IAClD,IAAIJ,SAAS,QAAQ;QACnB;IACF;IAEA,IAAID,UAA8B;IAClC,IAAIC,SAAS,SAAS;QACpB,CAACD,QAAQ,GAAGM;IACd,OAAO,IAAIL,SAAS,QAAQ;QAC1BD,UAAUM,QAAQ,CAACA,SAASC,MAAM,GAAG,EAAE;IACzC,OAAO,IAAIN,SAAS,SAAS;QAC3BD,UAAUQ,SAASV,aAAa,CAAcR;IAChD;IAEA,IAAI,CAACU,WAAWD,YAAYL,YAAY;QACtCM,UAAUN;IACZ;IAEA,qCAAqC;IACrCM,SAASS;AACX"}
1
+ {"version":3,"sources":["../../src/focus/utils.ts"],"sourcesContent":["const queries = [\n 'input:not([type=\"hidden\"]):not([disabled])',\n \"button:not([disabled])\",\n \"textarea:not([disabled])\",\n \"select:not([disabled])\",\n \"a[href]\",\n \"area[href]\",\n \"[tabindex]\",\n] as const;\n\n/**\n * A query selector to find elements that are programmatically focusable.\n *\n * Example:\n *\n * ```ts\n * const focusableElements = document.querySelectorAll(PROGRAMMATICALLY_FOCUSABLE);\n * // do something with elements\n * ```\n */\nexport const PROGRAMMATICALLY_FOCUSABLE = queries.join(\",\");\n\n/**\n * A query selector to find elements that are focusable only with tab and shift+tab.\n *\n * Example:\n *\n * ```ts\n * const focusableElements = document.querySelectorAll(TAB_FOCUSABLE);\n * // do something with elements\n * ```\n *\n * @remarks \\@since 6.0.0 This was updated to remove ALL elements that have a\n * `tabindex=\"-1\"` applied instead of only elements that had a manual tab index\n * applied.\n */\nexport const TAB_FOCUSABLE = queries.reduce((fullQuery, query) => {\n const prefix = `${fullQuery}${fullQuery ? \",\" : \"\"}`;\n const notProgrammaticQuery = `${query}:not([tabindex=\"-1\"])`;\n\n return `${prefix}${notProgrammaticQuery}`;\n}, \"\");\n\n/**\n * A simple util that will find all the tab focusable elements within a\n * container element. The container should normally be a specific HTMLElement,\n * but it can also be the entire document if you want to find **all** focusable\n * elements within your page.\n *\n * @remarks\n * \\@since 6.0.0 This function will be used for all keyboard focus behavior\n * instead of trying to use refs. I did some performance testing in Firefox and\n * Chrome and the `querySelectorAll` takes 4ms with 5000 elements for my use\n * cases. There is more of a performance issue around rendering all 5000\n * elements and since this is only used for specific keydown events, this is\n * good enough for me.\n *\n * @param container - The container element/document to find focusable elements\n * within.\n * @param programmatic - Boolean if programmatically focusable elements should be\n * included instead of only tab focusable.\n * @returns A list of HTMLElements that are focusable within the container.\n */\nexport function getFocusableElements(\n container: HTMLElement | Document,\n programmatic = false\n): readonly HTMLElement[] {\n // spread operator is faster than Array.from\n return [\n ...container.querySelectorAll<HTMLElement>(\n programmatic ? PROGRAMMATICALLY_FOCUSABLE : TAB_FOCUSABLE\n ),\n ];\n}\n\n/**\n * Attempts to find the first focusable element within a container.\n *\n * @remarks \\@since 6.0.0\n * @param container - The container element/document to find focusable elements\n * within.\n * @param programmatic - Boolean if programmatically focusable elements should be\n * included instead of only tab focusable.\n * @returns A list of HTMLElements that are focusable within the container.\n */\nexport function getFocusableElement(\n container: HTMLElement | Document,\n programmatic = false\n): HTMLElement | null {\n return container.querySelector<HTMLElement>(\n programmatic ? PROGRAMMATICALLY_FOCUSABLE : TAB_FOCUSABLE\n );\n}\n\n/**\n * An element can be tab focused if it is:\n * - an anchor or area with an `href`\n * - a non-disabled `input` element that is not `type=\"hidden\"`\n * - a non-disabled `button`, `textarea`, or `select` element\n * - an element with a `tabIndex >= 0`\n *\n * An element can be noted as \"programmatically focusable only\" has the above\n * rules, but the `tabIndex` will be set to `-1`.\n *\n * @remarks \\@since 2.8.0\n */\nexport type ElementFocusType = \"tab\" | \"programmatic\";\n\nexport function isFocusable(\n element: HTMLElement | Document | Window,\n type: ElementFocusType = \"programmatic\"\n): element is HTMLElement {\n const selector = type === \"tab\" ? TAB_FOCUSABLE : PROGRAMMATICALLY_FOCUSABLE;\n\n return \"matches\" in element && element.matches(selector);\n}\n\nexport type FocusElementWithinType =\n | \"first\"\n | \"last\"\n | \"query\"\n | \"self\"\n | \"none\";\n\nexport interface FocusElementWithinOptions {\n type: FocusElementWithinType;\n query?: string;\n elements: readonly HTMLElement[];\n container: HTMLElement | Document;\n}\n\nexport function focusElementWithin(options: FocusElementWithinOptions): void {\n const { type, query = \"\", container, elements } = options;\n if (type === \"none\") {\n return;\n }\n\n let element: HTMLElement | null = null;\n if (type === \"first\") {\n [element] = elements;\n } else if (type === \"last\") {\n element = elements[elements.length - 1];\n } else if (type === \"query\") {\n element = document.querySelector<HTMLElement>(query);\n }\n\n if (!element && isFocusable(container)) {\n element = container;\n }\n\n // TODO: Why did I add preventScroll?\n element?.focus();\n}\n"],"names":["queries","PROGRAMMATICALLY_FOCUSABLE","join","TAB_FOCUSABLE","reduce","fullQuery","query","prefix","notProgrammaticQuery","getFocusableElements","container","programmatic","querySelectorAll","getFocusableElement","querySelector","isFocusable","element","type","selector","matches","focusElementWithin","options","elements","length","document","focus"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,MAAMA,UAAU;IACd;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED;;;;;;;;;CASC,GACD,OAAO,MAAMC,6BAA6BD,QAAQE,IAAI,CAAC,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 -1 +1 @@
1
- {"version":3,"sources":["../../src/form/Checkbox.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { InputToggle, type CheckboxProps } from \"./InputToggle.js\";\n\n/**\n * **Client Component**\n *\n * You'll generally want to use the `useCheckboxGroup` hook for managing the\n * checked state for groups of checkboxes and indeterminate checkbox behavior.\n *\n * @example\n * Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { Checkbox } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * return <Checkbox label=\"Checkbox\" value=\"a\" />;\n * }\n * ```\n */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n function Checkbox(props, ref) {\n return <InputToggle {...props} ref={ref} type=\"checkbox\" />;\n }\n);\n"],"names":["forwardRef","InputToggle","Checkbox","props","ref","type"],"mappings":";AAAA,SAASA,UAAU,QAAQ,QAAQ;AACnC,SAASC,WAAW,QAA4B,mBAAmB;AAEnE;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAMC,yBAAWF,WACtB,SAASE,SAASC,KAAK,EAAEC,GAAG;IAC1B,qBAAO,KAACH;QAAa,GAAGE,KAAK;QAAEC,KAAKA;QAAKC,MAAK;;AAChD,GACA"}
1
+ {"version":3,"sources":["../../src/form/Checkbox.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { InputToggle, type CheckboxProps } from \"./InputToggle.js\";\n\n/**\n * **Client Component**\n *\n * You'll generally want to use the `useCheckboxGroup` hook for managing the\n * checked state for groups of checkboxes and indeterminate checkbox behavior.\n *\n * @example\n * Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { Checkbox } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * return <Checkbox label=\"Checkbox\" value=\"a\" />;\n * }\n * ```\n */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n function Checkbox(props, ref) {\n return <InputToggle {...props} ref={ref} type=\"checkbox\" />;\n }\n);\n"],"names":["forwardRef","InputToggle","Checkbox","props","ref","type"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,SAASA,UAAU,QAAQ,QAAQ;AACnC,SAASC,WAAW,QAA4B,mBAAmB;AAEnE;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAMC,yBAAWF,WACtB,SAASE,SAASC,KAAK,EAAEC,GAAG;IAC1B,qBAAO,KAACH;QAAa,GAAGE,KAAK;QAAEC,KAAKA;QAAKC,MAAK;;AAChD,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/Fieldset.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { forwardRef, type FieldsetHTMLAttributes } from \"react\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-fieldset\");\n\n/** @remarks \\@since 6.0.0 */\nexport interface FieldsetClassNameOptions {\n className?: string;\n\n /**\n * Set this to `true` to enable the default browser styles for a fieldset.\n *\n * @remarks \\@since 6.0.0 This was renamed from `unstyled`.\n * @defaultValue `false`\n */\n browserStyles?: boolean;\n\n /**\n * @defaultValue `false`\n */\n fullWidth?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function fieldset(options: FieldsetClassNameOptions = {}): string {\n const { className, fullWidth, browserStyles = false } = options;\n\n return cnb(\n styles({ unstyled: !browserStyles, \"full-width\": fullWidth }),\n className\n );\n}\n\n/**\n * **Server Component**\n *\n * @remarks \\@since 6.0.0 Removed the `legend`, `legendStyle`,\n * `legendClassName`, and `legendSROnly` props. You must provide a `Legend`\n * yourself manually instead of using a prop.\n */\nexport interface FieldsetProps\n extends FieldsetHTMLAttributes<HTMLFieldSetElement>,\n FieldsetClassNameOptions {}\n\n/**\n * @example\n * Simple Example\n * ```tsx\n * import { Form, Fieldset, Legend } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * return (\n * <Form>\n * <Fieldset>\n * <Legend>Some Title</Legend>\n * // form components\n * </Fieldset>\n * </Form>\n * );\n * }\n * ```\n */\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(\n function Fieldset(props, ref) {\n const {\n className,\n fullWidth = false,\n browserStyles = false,\n children,\n ...remaining\n } = props;\n\n return (\n <fieldset\n {...remaining}\n ref={ref}\n className={fieldset({\n className,\n fullWidth,\n browserStyles,\n })}\n >\n {children}\n </fieldset>\n );\n }\n);\n"],"names":["cnb","forwardRef","bem","styles","fieldset","options","className","fullWidth","browserStyles","unstyled","Fieldset","props","ref","children","remaining"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAAqC,QAAQ;AAChE,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAoBnB;;CAEC,GACD,OAAO,SAASE,SAASC,UAAoC,CAAC,CAAC;IAC7D,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAEC,gBAAgB,KAAK,EAAE,GAAGH;IAExD,OAAOL,IACLG,OAAO;QAAEM,UAAU,CAACD;QAAe,cAAcD;IAAU,IAC3DD;AAEJ;AAaA;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,MAAMI,yBAAWT,WACtB,SAASS,SAASC,KAAK,EAAEC,GAAG;IAC1B,MAAM,EACJN,SAAS,EACTC,YAAY,KAAK,EACjBC,gBAAgB,KAAK,EACrBK,QAAQ,EACR,GAAGC,WACJ,GAAGH;IAEJ,qBACE,KAACP;QACE,GAAGU,SAAS;QACbF,KAAKA;QACLN,WAAWF,SAAS;YAClBE;YACAC;YACAC;QACF;kBAECK;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/form/Fieldset.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { forwardRef, type FieldsetHTMLAttributes } from \"react\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-fieldset\");\n\n/** @remarks \\@since 6.0.0 */\nexport interface FieldsetClassNameOptions {\n className?: string;\n\n /**\n * Set this to `true` to enable the default browser styles for a fieldset.\n *\n * @remarks \\@since 6.0.0 This was renamed from `unstyled`.\n * @defaultValue `false`\n */\n browserStyles?: boolean;\n\n /**\n * @defaultValue `false`\n */\n fullWidth?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function fieldset(options: FieldsetClassNameOptions = {}): string {\n const { className, fullWidth, browserStyles = false } = options;\n\n return cnb(\n styles({ unstyled: !browserStyles, \"full-width\": fullWidth }),\n className\n );\n}\n\n/**\n * **Server Component**\n *\n * @remarks \\@since 6.0.0 Removed the `legend`, `legendStyle`,\n * `legendClassName`, and `legendSROnly` props. You must provide a `Legend`\n * yourself manually instead of using a prop.\n */\nexport interface FieldsetProps\n extends FieldsetHTMLAttributes<HTMLFieldSetElement>,\n FieldsetClassNameOptions {}\n\n/**\n * @example\n * Simple Example\n * ```tsx\n * import { Form, Fieldset, Legend } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * return (\n * <Form>\n * <Fieldset>\n * <Legend>Some Title</Legend>\n * // form components\n * </Fieldset>\n * </Form>\n * );\n * }\n * ```\n */\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(\n function Fieldset(props, ref) {\n const {\n className,\n fullWidth = false,\n browserStyles = false,\n children,\n ...remaining\n } = props;\n\n return (\n <fieldset\n {...remaining}\n ref={ref}\n className={fieldset({\n className,\n fullWidth,\n browserStyles,\n })}\n >\n {children}\n </fieldset>\n );\n }\n);\n"],"names":["cnb","forwardRef","bem","styles","fieldset","options","className","fullWidth","browserStyles","unstyled","Fieldset","props","ref","children","remaining"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAAqC,QAAQ;AAChE,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAoBnB;;CAEC,GACD,OAAO,SAASE,SAASC,UAAoC,CAAC,CAAC;IAC7D,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAEC,gBAAgB,KAAK,EAAE,GAAGH;IAExD,OAAOL,IACLG,OAAO;QAAEM,UAAU,CAACD;QAAe,cAAcD;IAAU,IAC3DD;AAEJ;AAaA;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,MAAMI,yBAAWT,WACtB,SAASS,SAASC,KAAK,EAAEC,GAAG;IAC1B,MAAM,EACJN,SAAS,EACTC,YAAY,KAAK,EACjBC,gBAAgB,KAAK,EACrBK,QAAQ,EACR,GAAGC,WACJ,GAAGH;IAEJ,qBACE,KAACP;QACE,GAAGU,SAAS;QACbF,KAAKA;QACLN,WAAWF,SAAS;YAClBE;YACAC;YACAC;QACF;kBAECK;;AAGP,GACA"}