@react-md/core 1.0.0-next.10 → 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 (423) hide show
  1. package/.turbo/turbo-build.log +22 -22
  2. package/.turbo/turbo-lint.log +3 -3
  3. package/.turbo/turbo-typecheck.log +1 -1
  4. package/CHANGELOG.md +12 -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 +2 -2
  99. package/dist/form/TextFieldContainer.js.map +1 -1
  100. package/dist/form/fileUtils.js.map +1 -1
  101. package/dist/form/formConfig.js.map +1 -1
  102. package/dist/form/formMessageStyles.js.map +1 -1
  103. package/dist/form/inputToggleStyles.js.map +1 -1
  104. package/dist/form/menuItemInputToggleStyles.js.map +1 -1
  105. package/dist/form/nativeSelectStyles.js.map +1 -1
  106. package/dist/form/optionStyles.js.map +1 -1
  107. package/dist/form/passwordStyles.js.map +1 -1
  108. package/dist/form/selectStyles.js.map +1 -1
  109. package/dist/form/selectUtils.js.map +1 -1
  110. package/dist/form/sliderUtils.js.map +1 -1
  111. package/dist/form/switchStyles.js.map +1 -1
  112. package/dist/form/textAreaStyles.js.map +1 -1
  113. package/dist/form/{TextFieldContainerStyles.js → textFieldContainerStyles.js} +1 -1
  114. package/dist/form/{TextFieldContainerStyles.js.map → textFieldContainerStyles.js.map} +1 -1
  115. package/dist/form/textFieldStyles.js.map +1 -1
  116. package/dist/form/types.js.map +1 -1
  117. package/dist/form/useCheckboxGroup.js.map +1 -1
  118. package/dist/form/useCombobox.js.map +1 -1
  119. package/dist/form/useEditableCombobox.js.map +1 -1
  120. package/dist/form/useFileUpload.js.map +1 -1
  121. package/dist/form/useFormReset.js.map +1 -1
  122. package/dist/form/useListboxProvider.js.map +1 -1
  123. package/dist/form/useNumberField.js.map +1 -1
  124. package/dist/form/useRadioGroup.js.map +1 -1
  125. package/dist/form/useRangeSlider.js.map +1 -1
  126. package/dist/form/useResizingTextArea.js.map +1 -1
  127. package/dist/form/useSelectCombobox.js.map +1 -1
  128. package/dist/form/useSlider.js.map +1 -1
  129. package/dist/form/useTextField.js.map +1 -1
  130. package/dist/form/utils.js.map +1 -1
  131. package/dist/form/validation.js.map +1 -1
  132. package/dist/hoverMode/useHoverMode.js.map +1 -1
  133. package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
  134. package/dist/icon/FontIcon.js.map +1 -1
  135. package/dist/icon/IconRotator.js.map +1 -1
  136. package/dist/icon/MaterialIcon.js.map +1 -1
  137. package/dist/icon/MaterialSymbol.js.map +1 -1
  138. package/dist/icon/SVGIcon.js.map +1 -1
  139. package/dist/icon/TextIconSpacing.js.map +1 -1
  140. package/dist/icon/iconConfig.js.map +1 -1
  141. package/dist/icon/material.js.map +1 -1
  142. package/dist/icon/materialConfig.js.map +1 -1
  143. package/dist/icon/styles.js.map +1 -1
  144. package/dist/index.d.ts +3 -1
  145. package/dist/index.js +3 -1
  146. package/dist/index.js.map +1 -1
  147. package/dist/interaction/Ripple.js.map +1 -1
  148. package/dist/interaction/RippleContainer.js.map +1 -1
  149. package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
  150. package/dist/interaction/config.js.map +1 -1
  151. package/dist/interaction/types.js.map +1 -1
  152. package/dist/interaction/useElementInteraction.js.map +1 -1
  153. package/dist/interaction/useHigherContrastChildren.js.map +1 -1
  154. package/dist/interaction/utils.js.map +1 -1
  155. package/dist/layout/LayoutAppBar.js.map +1 -1
  156. package/dist/layout/LayoutNav.js.map +1 -1
  157. package/dist/layout/LayoutWindowSplitter.js.map +1 -1
  158. package/dist/layout/Main.js.map +1 -1
  159. package/dist/layout/layoutNavStyles.js.map +1 -1
  160. package/dist/layout/layoutWindowSplitterStyles.js.map +1 -1
  161. package/dist/layout/mainStyles.js.map +1 -1
  162. package/dist/layout/useExpandableLayout.js.map +1 -1
  163. package/dist/layout/useHorizontalLayoutTransition.js.map +1 -1
  164. package/dist/layout/useLayoutAppBarHeight.js.map +1 -1
  165. package/dist/layout/useLayoutTree.js.map +1 -1
  166. package/dist/layout/useLayoutWindowSplitter.js.map +1 -1
  167. package/dist/layout/useMainTabIndex.js.map +1 -1
  168. package/dist/layout/useResizableLayout.js.map +1 -1
  169. package/dist/layout/useTemporaryLayout.js.map +1 -1
  170. package/dist/link/Link.js.map +1 -1
  171. package/dist/link/SkipToMainContent.js.map +1 -1
  172. package/dist/link/styles.js.map +1 -1
  173. package/dist/list/List.js.map +1 -1
  174. package/dist/list/ListItem.js.map +1 -1
  175. package/dist/list/ListItemAddon.js.map +1 -1
  176. package/dist/list/ListItemChildren.js.map +1 -1
  177. package/dist/list/ListItemLink.js.map +1 -1
  178. package/dist/list/ListItemText.js.map +1 -1
  179. package/dist/list/ListSubheader.js.map +1 -1
  180. package/dist/list/getListItemHeight.js.map +1 -1
  181. package/dist/list/listItemStyles.js.map +1 -1
  182. package/dist/list/types.js.map +1 -1
  183. package/dist/media-queries/AppSizeProvider.js.map +1 -1
  184. package/dist/media-queries/appSize.js.map +1 -1
  185. package/dist/media-queries/useMediaQuery.js.map +1 -1
  186. package/dist/menu/DropdownMenu.js.map +1 -1
  187. package/dist/menu/Menu.js.map +1 -1
  188. package/dist/menu/MenuBar.js.map +1 -1
  189. package/dist/menu/MenuButton.js.map +1 -1
  190. package/dist/menu/MenuConfigurationProvider.js.map +1 -1
  191. package/dist/menu/MenuItem.js.map +1 -1
  192. package/dist/menu/MenuItemButton.js.map +1 -1
  193. package/dist/menu/MenuItemCircularProgress.js.map +1 -1
  194. package/dist/menu/MenuItemGroup.js.map +1 -1
  195. package/dist/menu/MenuItemSeparator.js.map +1 -1
  196. package/dist/menu/MenuSheet.js.map +1 -1
  197. package/dist/menu/MenuVisibilityProvider.js.map +1 -1
  198. package/dist/menu/MenuWidget.js.map +1 -1
  199. package/dist/menu/MenuWidgetKeyboardProvider.js.map +1 -1
  200. package/dist/menu/useContextMenu.js.map +1 -1
  201. package/dist/menu/useMenuBarProvider.js.map +1 -1
  202. package/dist/menu/utils.js.map +1 -1
  203. package/dist/movement/constants.js.map +1 -1
  204. package/dist/movement/findMatchIndex.js.map +1 -1
  205. package/dist/movement/types.js.map +1 -1
  206. package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
  207. package/dist/movement/utils.js.map +1 -1
  208. package/dist/overlay/Overlay.js.map +1 -1
  209. package/dist/overlay/overlayStyles.js.map +1 -1
  210. package/dist/portal/Portal.js.map +1 -1
  211. package/dist/portal/PortalContainerProvider.js.map +1 -1
  212. package/dist/positioning/constants.js.map +1 -1
  213. package/dist/positioning/createHorizontalPosition.js.map +1 -1
  214. package/dist/positioning/createVerticalPosition.js.map +1 -1
  215. package/dist/positioning/getFixedPosition.js.map +1 -1
  216. package/dist/positioning/types.js.map +1 -1
  217. package/dist/positioning/useFixedPositioning.js.map +1 -1
  218. package/dist/positioning/utils.js.map +1 -1
  219. package/dist/progress/CircularProgress.js.map +1 -1
  220. package/dist/progress/LinearProgress.js.map +1 -1
  221. package/dist/progress/getProgressA11y.js.map +1 -1
  222. package/dist/progress/types.js.map +1 -1
  223. package/dist/responsive-item/ResponsiveItemContainer.js.map +1 -1
  224. package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
  225. package/dist/responsive-item/styles.js.map +1 -1
  226. package/dist/scroll/ScrollLock.js.map +1 -1
  227. package/dist/scroll/getScrollbarWidth.js.map +1 -1
  228. package/dist/scroll/useScrollLock.js.map +1 -1
  229. package/dist/searching/caseInsensitive.js.map +1 -1
  230. package/dist/searching/fuzzy.js.map +1 -1
  231. package/dist/searching/toSearchQuery.js.map +1 -1
  232. package/dist/searching/types.js.map +1 -1
  233. package/dist/searching/useFuzzyMatch.js.map +1 -1
  234. package/dist/searching/utils.js.map +1 -1
  235. package/dist/segmented-button/SegmentedButton.js.map +1 -1
  236. package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -1
  237. package/dist/segmented-button/segmentedButtonContainerStyles.js.map +1 -1
  238. package/dist/segmented-button/segmentedButtonStyles.js.map +1 -1
  239. package/dist/sheet/Sheet.js.map +1 -1
  240. package/dist/sheet/styles.js.map +1 -1
  241. package/dist/snackbar/DefaultToastRenderer.js.map +1 -1
  242. package/dist/snackbar/Snackbar.js.map +1 -1
  243. package/dist/snackbar/Toast.js.map +1 -1
  244. package/dist/snackbar/ToastActionButton.js.map +1 -1
  245. package/dist/snackbar/ToastCloseButton.js.map +1 -1
  246. package/dist/snackbar/ToastContent.js.map +1 -1
  247. package/dist/snackbar/ToastManager.js.map +1 -1
  248. package/dist/snackbar/ToastManagerProvider.js.map +1 -1
  249. package/dist/snackbar/snackbarStyles.js.map +1 -1
  250. package/dist/snackbar/toastContentStyles.js.map +1 -1
  251. package/dist/snackbar/toastStyles.js.map +1 -1
  252. package/dist/snackbar/useCurrentToastActions.js.map +1 -1
  253. package/dist/suspense/CircularProgressSuspense.js.map +1 -1
  254. package/dist/suspense/NullSuspense.js.map +1 -1
  255. package/dist/table/Table.js.map +1 -1
  256. package/dist/table/TableBody.js.map +1 -1
  257. package/dist/table/TableCell.js.map +1 -1
  258. package/dist/table/TableCellContent.js.map +1 -1
  259. package/dist/table/TableCheckbox.js.map +1 -1
  260. package/dist/table/TableConfigurationProvider.js.map +1 -1
  261. package/dist/table/TableContainer.js.map +1 -1
  262. package/dist/table/TableContainerProvider.js.map +1 -1
  263. package/dist/table/TableFooter.js.map +1 -1
  264. package/dist/table/TableHeader.js.map +1 -1
  265. package/dist/table/TableRadio.js.map +1 -1
  266. package/dist/table/TableRow.js.map +1 -1
  267. package/dist/table/tableCellStyles.js.map +1 -1
  268. package/dist/table/tableContainerStyles.js.map +1 -1
  269. package/dist/table/tableFooterStyles.js.map +1 -1
  270. package/dist/table/tableHeaderStyles.js.map +1 -1
  271. package/dist/table/tableRowStyles.js.map +1 -1
  272. package/dist/table/tableStyles.js.map +1 -1
  273. package/dist/table/types.js.map +1 -1
  274. package/dist/tabs/Tab.js.map +1 -1
  275. package/dist/tabs/TabList.js.map +1 -1
  276. package/dist/tabs/TabListScrollButton.js.map +1 -1
  277. package/dist/tabs/tabIndicatorStyles.js.map +1 -1
  278. package/dist/tabs/tabListScrollButtonStyles.js.map +1 -1
  279. package/dist/tabs/tabListStyles.js.map +1 -1
  280. package/dist/tabs/tabStyles.js.map +1 -1
  281. package/dist/tabs/useTabList.js.map +1 -1
  282. package/dist/tabs/useTabs.js.map +1 -1
  283. package/dist/tabs/utils.js.map +1 -1
  284. package/dist/test-utils/IntersectionObserver.js.map +1 -1
  285. package/dist/test-utils/ResizeObserver.js.map +1 -1
  286. package/dist/test-utils/data-testid.js.map +1 -1
  287. package/dist/test-utils/index.js.map +1 -1
  288. package/dist/test-utils/jest-setup.js.map +1 -1
  289. package/dist/test-utils/matchMedia.js.map +1 -1
  290. package/dist/test-utils/polyfills/IntersectionObserver.js.map +1 -1
  291. package/dist/test-utils/polyfills/ResizeObserver.js.map +1 -1
  292. package/dist/test-utils/polyfills/TextDecoder.js.map +1 -1
  293. package/dist/test-utils/polyfills/TextEncoder.js.map +1 -1
  294. package/dist/test-utils/polyfills/index.js.map +1 -1
  295. package/dist/test-utils/polyfills/matchMedia.js.map +1 -1
  296. package/dist/test-utils/polyfills/offsetParent.js.map +1 -1
  297. package/dist/test-utils/polyfills/scrollIntoView.js.map +1 -1
  298. package/dist/test-utils/render.js.map +1 -1
  299. package/dist/test-utils/timers.js.map +1 -1
  300. package/dist/theme/LocalStorageColorSchemeProvider.js.map +1 -1
  301. package/dist/theme/ThemeProvider.js.map +1 -1
  302. package/dist/theme/colors.js.map +1 -1
  303. package/dist/theme/cssVars.js.map +1 -1
  304. package/dist/theme/types.js.map +1 -1
  305. package/dist/theme/useCSSVariables.js.map +1 -1
  306. package/dist/theme/useColorScheme.js.map +1 -1
  307. package/dist/theme/useColorSchemeMetaTag.js.map +1 -1
  308. package/dist/theme/useColorSchemeProvider.js.map +1 -1
  309. package/dist/theme/usePrefersColorScheme.js.map +1 -1
  310. package/dist/theme/utils.js.map +1 -1
  311. package/dist/tooltip/Tooltip.js.map +1 -1
  312. package/dist/tooltip/TooltipHoverModeProvider.js.map +1 -1
  313. package/dist/tooltip/constants.js.map +1 -1
  314. package/dist/tooltip/tooltipStyles.js.map +1 -1
  315. package/dist/tooltip/useTooltip.js.map +1 -1
  316. package/dist/tooltip/useTooltipPosition.js.map +1 -1
  317. package/dist/tooltip/utils.js.map +1 -1
  318. package/dist/transition/CSSTransition.js.map +1 -1
  319. package/dist/transition/Collapse.js.map +1 -1
  320. package/dist/transition/CrossFade.js.map +1 -1
  321. package/dist/transition/ScaleTransition.js.map +1 -1
  322. package/dist/transition/SkeletonPlaceholder.js.map +1 -1
  323. package/dist/transition/Slide.js.map +1 -1
  324. package/dist/transition/SlideContainer.js.map +1 -1
  325. package/dist/transition/collapseStyles.js.map +1 -1
  326. package/dist/transition/config.js.map +1 -1
  327. package/dist/transition/maxWidthTransition.js.map +1 -1
  328. package/dist/transition/skeletonPlaceholderUtils.js.map +1 -1
  329. package/dist/transition/types.js.map +1 -1
  330. package/dist/transition/useCSSTransition.js.map +1 -1
  331. package/dist/transition/useCarousel.js.map +1 -1
  332. package/dist/transition/useCollapseTransition.js.map +1 -1
  333. package/dist/transition/useCrossFadeTransition.js.map +1 -1
  334. package/dist/transition/useMaxWidthTransition.js.map +1 -1
  335. package/dist/transition/useScaleTransition.js.map +1 -1
  336. package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
  337. package/dist/transition/useSlideTransition.js.map +1 -1
  338. package/dist/transition/useTransition.js.map +1 -1
  339. package/dist/transition/utils.js.map +1 -1
  340. package/dist/tree/DefaultTreeItemRenderer.js.map +1 -1
  341. package/dist/tree/Tree.js.map +1 -1
  342. package/dist/tree/TreeGroup.js.map +1 -1
  343. package/dist/tree/TreeItem.js.map +1 -1
  344. package/dist/tree/TreeItemExpander.js.map +1 -1
  345. package/dist/tree/TreeProvider.js.map +1 -1
  346. package/dist/tree/styles.js.map +1 -1
  347. package/dist/tree/types.js.map +1 -1
  348. package/dist/tree/useTree.js.map +1 -1
  349. package/dist/tree/useTreeExpansion.js.map +1 -1
  350. package/dist/tree/useTreeItems.js.map +1 -1
  351. package/dist/tree/useTreeMovement.js.map +1 -1
  352. package/dist/tree/useTreeSelection.js.map +1 -1
  353. package/dist/tree/utils.js.map +1 -1
  354. package/dist/types.js.map +1 -1
  355. package/dist/typography/SrOnly.js.map +1 -1
  356. package/dist/typography/TextContainer.d.ts +1 -40
  357. package/dist/typography/TextContainer.js +1 -30
  358. package/dist/typography/TextContainer.js.map +1 -1
  359. package/dist/typography/Typography.d.ts +1 -112
  360. package/dist/typography/Typography.js +1 -89
  361. package/dist/typography/Typography.js.map +1 -1
  362. package/dist/typography/WritingDirectionProvider.js.map +1 -1
  363. package/dist/typography/textContainerStyles.d.ts +40 -0
  364. package/dist/typography/textContainerStyles.js +32 -0
  365. package/dist/typography/textContainerStyles.js.map +1 -0
  366. package/dist/typography/typographyStyles.d.ts +112 -0
  367. package/dist/typography/typographyStyles.js +91 -0
  368. package/dist/typography/typographyStyles.js.map +1 -0
  369. package/dist/useAsyncAction.js.map +1 -1
  370. package/dist/useDebouncedFunction.js.map +1 -1
  371. package/dist/useDropzone.js.map +1 -1
  372. package/dist/useElementSize.js.map +1 -1
  373. package/dist/useEnsuredId.js.map +1 -1
  374. package/dist/useEnsuredRef.js.map +1 -1
  375. package/dist/useEnsuredState.js.map +1 -1
  376. package/dist/useHtmlClassName.js.map +1 -1
  377. package/dist/useIntersectionObserver.js.map +1 -1
  378. package/dist/useIsomorphicLayoutEffect.js.map +1 -1
  379. package/dist/useLocalStorage.js.map +1 -1
  380. package/dist/useOrientation.js.map +1 -1
  381. package/dist/usePageInactive.js.map +1 -1
  382. package/dist/useResizeListener.js.map +1 -1
  383. package/dist/useResizeObserver.js.map +1 -1
  384. package/dist/useThrottledFunction.js.map +1 -1
  385. package/dist/useToggle.js.map +1 -1
  386. package/dist/useUnmounted.js.map +1 -1
  387. package/dist/useWindowSize.js.map +1 -1
  388. package/dist/utils/RenderRecursively.js.map +1 -1
  389. package/dist/utils/alphaNumericSort.js.map +1 -1
  390. package/dist/utils/applyRef.js.map +1 -1
  391. package/dist/utils/bem.js.map +1 -1
  392. package/dist/utils/getClientPosition.js.map +1 -1
  393. package/dist/utils/getMiddleOfRange.js.map +1 -1
  394. package/dist/utils/getPercentage.js.map +1 -1
  395. package/dist/utils/getRangeDefaultValue.js.map +1 -1
  396. package/dist/utils/getRangeSteps.js.map +1 -1
  397. package/dist/utils/identity.js.map +1 -1
  398. package/dist/utils/isElementVisible.js.map +1 -1
  399. package/dist/utils/loop.js.map +1 -1
  400. package/dist/utils/nearest.js.map +1 -1
  401. package/dist/utils/parseCssLengthUnit.js.map +1 -1
  402. package/dist/utils/randomInt.js.map +1 -1
  403. package/dist/utils/wait.js.map +1 -1
  404. package/dist/utils/withinRange.js.map +1 -1
  405. package/dist/window-splitter/WindowSplitter.js.map +1 -1
  406. package/dist/window-splitter/useWindowSplitter.js.map +1 -1
  407. package/package.json +21 -13
  408. package/src/app-bar/AppBarTitle.tsx +2 -5
  409. package/src/dialog/DialogTitle.tsx +1 -1
  410. package/src/expansion-panel/ExpansionPanelHeader.tsx +3 -6
  411. package/src/form/SliderMarkLabel.tsx +1 -1
  412. package/src/form/TextFieldContainer.tsx +2 -2
  413. package/src/index.ts +3 -1
  414. package/src/typography/TextContainer.tsx +4 -53
  415. package/src/typography/Typography.tsx +5 -145
  416. package/src/typography/__tests__/TextContainer.tsx +2 -1
  417. package/src/typography/__tests__/Typography.tsx +2 -1
  418. package/src/typography/textContainerStyles.ts +53 -0
  419. package/src/typography/typographyStyles.ts +145 -0
  420. package/tsconfig.types.json +1 -1
  421. package/.turbo/turbo-test.log +0 -5512
  422. /package/dist/form/{TextFieldContainerStyles.d.ts → textFieldContainerStyles.d.ts} +0 -0
  423. /package/src/form/{TextFieldContainerStyles.ts → textFieldContainerStyles.ts} +0 -0
@@ -1,116 +1,5 @@
1
1
  import { type ElementType, type HTMLAttributes } from "react";
2
- import { type TextCssUtilsOptions } from "../cssUtils.js";
3
- /**
4
- * A union of all the material design provided typography styles. When used with
5
- * the Typography component, this will generate the correct typography className
6
- * to apply and determine what component to be rendered as if none was provided.
7
- *
8
- * @remarks \@since 4.0.0
9
- */
10
- export type TypographyType = "headline-1" | "headline-2" | "headline-3" | "headline-4" | "headline-5" | "headline-6" | "subtitle-1" | "subtitle-2" | "body-1" | "body-2" | "caption" | "overline";
11
- /** @remarks \@since 6.0.0 */
12
- export interface TypographyClassNameOptions extends TextCssUtilsOptions {
13
- className?: string;
14
- /**
15
- * @see {@link TypographyType}
16
- * @defaultValue `"body-1"`
17
- */
18
- type?: TypographyType;
19
- }
20
- /** @remarks \@since 6.0.0 */
21
- export type NullableTypographyClassNameOptions = Omit<TypographyClassNameOptions, "type"> & {
22
- /**
23
- * When using the {@link typography} class name utility, the `type` can be set
24
- * to `null` to inherit font.
25
- *
26
- * @see {@link TypographyType}
27
- * @defaultValue `"body-1"`
28
- */
29
- type?: TypographyType | null;
30
- };
31
- /**
32
- * Get a typography class name based on different typography options. This is
33
- * only useful if you are unable to use the {@link Typography} component for
34
- * some reason.
35
- *
36
- * @example
37
- * Simple Example
38
- * ```ts
39
- * import { typography } from "@react-md/core";
40
- *
41
- * function Example() {
42
- * return (
43
- * <>
44
- * <h1 className={typography({ type: "headline-1" })} />
45
- * <h2 className={typography({ type: "headline-2" })} />
46
- * <h3 className={typography({ type: "headline-3" })} />
47
- * <h4 className={typography({ type: "headline-4" })} />
48
- * <h5 className={typography({ type: "headline-5" })} />
49
- * <h6 className={typography({ type: "headline-6" })} />
50
- * <h5 className={typography({ type: "subtitle-1" })} />
51
- * <h6 className={typography({ type: "subtitle-2" })} />
52
- * <p className={typography()} />
53
- * <p className={typography({ type "body-1" })} />
54
- * <p className={typography({ type "body-1" })} />
55
- * <caption className={typography({ type: "caption" })} />
56
- * <span className={typography({ type: "overline" })} />
57
- * </>
58
- * );
59
- * }
60
- * ```
61
- *
62
- * @example
63
- * Applying Additional Styles
64
- * ```ts
65
- * import { typography } from "@react-md/core";
66
- *
67
- * function Example() {
68
- * return (
69
- * <>
70
- * <h1
71
- * // only maintain the default margin-bottom
72
- * className={typography({
73
- * type: "headline-1",
74
- * margin: "bottom",
75
- * })}
76
- * />
77
- *
78
- * <h2
79
- * // remove all default margin
80
- * className={typography({
81
- * type: "headline-2",
82
- * margin: "none",
83
- * })}
84
- * />
85
- *
86
- * <h3
87
- * // only maintain the default margin-top
88
- * className={typography({
89
- * type: "headline-3",
90
- * margin: "top",
91
- * })}
92
- * />
93
- *
94
- * <p
95
- * // center the text, set to bold, and only maintain default margin-bottom
96
- * className={typography({
97
- * type "subtitle-1",
98
- * align: "center",
99
- * margin: "bottom",
100
- * })}
101
- * />
102
- * </>
103
- * );
104
- * }
105
- * ```
106
- *
107
- * @see {@link Typography}
108
- * @param options - An optional object of options used to create the typography
109
- * class name.
110
- * @returns a typography class name string
111
- * @remarks \@since 6.0.0
112
- */
113
- export declare function typography(options?: NullableTypographyClassNameOptions): string;
2
+ import { type TypographyClassNameOptions } from "./typographyStyles.js";
114
3
  /**
115
4
  * A union of the default supported elements that the `Typography` component can
116
5
  * be rendered as. This is mostly used for adding the correct `HTMLAttributes`
@@ -1,94 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cnb } from "cnbuilder";
3
2
  import { forwardRef } from "react";
4
- import { cssUtils } from "../cssUtils.js";
5
- /**
6
- * Get a typography class name based on different typography options. This is
7
- * only useful if you are unable to use the {@link Typography} component for
8
- * some reason.
9
- *
10
- * @example
11
- * Simple Example
12
- * ```ts
13
- * import { typography } from "@react-md/core";
14
- *
15
- * function Example() {
16
- * return (
17
- * <>
18
- * <h1 className={typography({ type: "headline-1" })} />
19
- * <h2 className={typography({ type: "headline-2" })} />
20
- * <h3 className={typography({ type: "headline-3" })} />
21
- * <h4 className={typography({ type: "headline-4" })} />
22
- * <h5 className={typography({ type: "headline-5" })} />
23
- * <h6 className={typography({ type: "headline-6" })} />
24
- * <h5 className={typography({ type: "subtitle-1" })} />
25
- * <h6 className={typography({ type: "subtitle-2" })} />
26
- * <p className={typography()} />
27
- * <p className={typography({ type "body-1" })} />
28
- * <p className={typography({ type "body-1" })} />
29
- * <caption className={typography({ type: "caption" })} />
30
- * <span className={typography({ type: "overline" })} />
31
- * </>
32
- * );
33
- * }
34
- * ```
35
- *
36
- * @example
37
- * Applying Additional Styles
38
- * ```ts
39
- * import { typography } from "@react-md/core";
40
- *
41
- * function Example() {
42
- * return (
43
- * <>
44
- * <h1
45
- * // only maintain the default margin-bottom
46
- * className={typography({
47
- * type: "headline-1",
48
- * margin: "bottom",
49
- * })}
50
- * />
51
- *
52
- * <h2
53
- * // remove all default margin
54
- * className={typography({
55
- * type: "headline-2",
56
- * margin: "none",
57
- * })}
58
- * />
59
- *
60
- * <h3
61
- * // only maintain the default margin-top
62
- * className={typography({
63
- * type: "headline-3",
64
- * margin: "top",
65
- * })}
66
- * />
67
- *
68
- * <p
69
- * // center the text, set to bold, and only maintain default margin-bottom
70
- * className={typography({
71
- * type "subtitle-1",
72
- * align: "center",
73
- * margin: "bottom",
74
- * })}
75
- * />
76
- * </>
77
- * );
78
- * }
79
- * ```
80
- *
81
- * @see {@link Typography}
82
- * @param options - An optional object of options used to create the typography
83
- * class name.
84
- * @returns a typography class name string
85
- * @remarks \@since 6.0.0
86
- */ export function typography(options = {}) {
87
- const { type = "body-1" } = options;
88
- // using `&&` instead of `bem` since the latest version of typescript does not
89
- // support setting the same object key (empty string)
90
- return cnb("rmd-typography", type && `rmd-typography--${type}`, cssUtils(options));
91
- }
3
+ import { typography } from "./typographyStyles.js";
92
4
  /** @internal */ function getComponent(as, type) {
93
5
  if (as) {
94
6
  return as;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/typography/Typography.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n type ElementType,\n type HTMLAttributes,\n type ReactElement,\n} from \"react\";\nimport { cssUtils, type TextCssUtilsOptions } from \"../cssUtils.js\";\n\n/**\n * A union of all the material design provided typography styles. When used with\n * the Typography component, this will generate the correct typography className\n * to apply and determine what component to be rendered as if none was provided.\n *\n * @remarks \\@since 4.0.0\n */\nexport type TypographyType =\n | \"headline-1\"\n | \"headline-2\"\n | \"headline-3\"\n | \"headline-4\"\n | \"headline-5\"\n | \"headline-6\"\n | \"subtitle-1\"\n | \"subtitle-2\"\n | \"body-1\"\n | \"body-2\"\n | \"caption\"\n | \"overline\";\n\n/** @remarks \\@since 6.0.0 */\nexport interface TypographyClassNameOptions extends TextCssUtilsOptions {\n className?: string;\n\n /**\n * @see {@link TypographyType}\n * @defaultValue `\"body-1\"`\n */\n type?: TypographyType;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport type NullableTypographyClassNameOptions = Omit<\n TypographyClassNameOptions,\n \"type\"\n> & {\n /**\n * When using the {@link typography} class name utility, the `type` can be set\n * to `null` to inherit font.\n *\n * @see {@link TypographyType}\n * @defaultValue `\"body-1\"`\n */\n type?: TypographyType | null;\n};\n\n/**\n * Get a typography class name based on different typography options. This is\n * only useful if you are unable to use the {@link Typography} component for\n * some reason.\n *\n * @example\n * Simple Example\n * ```ts\n * import { typography } from \"@react-md/core\";\n *\n * function Example() {\n * return (\n * <>\n * <h1 className={typography({ type: \"headline-1\" })} />\n * <h2 className={typography({ type: \"headline-2\" })} />\n * <h3 className={typography({ type: \"headline-3\" })} />\n * <h4 className={typography({ type: \"headline-4\" })} />\n * <h5 className={typography({ type: \"headline-5\" })} />\n * <h6 className={typography({ type: \"headline-6\" })} />\n * <h5 className={typography({ type: \"subtitle-1\" })} />\n * <h6 className={typography({ type: \"subtitle-2\" })} />\n * <p className={typography()} />\n * <p className={typography({ type \"body-1\" })} />\n * <p className={typography({ type \"body-1\" })} />\n * <caption className={typography({ type: \"caption\" })} />\n * <span className={typography({ type: \"overline\" })} />\n * </>\n * );\n * }\n * ```\n *\n * @example\n * Applying Additional Styles\n * ```ts\n * import { typography } from \"@react-md/core\";\n *\n * function Example() {\n * return (\n * <>\n * <h1\n * // only maintain the default margin-bottom\n * className={typography({\n * type: \"headline-1\",\n * margin: \"bottom\",\n * })}\n * />\n *\n * <h2\n * // remove all default margin\n * className={typography({\n * type: \"headline-2\",\n * margin: \"none\",\n * })}\n * />\n *\n * <h3\n * // only maintain the default margin-top\n * className={typography({\n * type: \"headline-3\",\n * margin: \"top\",\n * })}\n * />\n *\n * <p\n * // center the text, set to bold, and only maintain default margin-bottom\n * className={typography({\n * type \"subtitle-1\",\n * align: \"center\",\n * margin: \"bottom\",\n * })}\n * />\n * </>\n * );\n * }\n * ```\n *\n * @see {@link Typography}\n * @param options - An optional object of options used to create the typography\n * class name.\n * @returns a typography class name string\n * @remarks \\@since 6.0.0\n */\nexport function typography(\n options: NullableTypographyClassNameOptions = {}\n): string {\n const { type = \"body-1\" } = options;\n\n // using `&&` instead of `bem` since the latest version of typescript does not\n // support setting the same object key (empty string)\n return cnb(\n \"rmd-typography\",\n type && `rmd-typography--${type}`,\n cssUtils(options)\n );\n}\n\n/**\n * A union of the default supported elements that the `Typography` component can\n * be rendered as. This is mostly used for adding the correct `HTMLAttributes`\n * and enabling the forward ref.\n *\n * @remarks \\@since 4.0.0\n */\nexport type TypographyHTMLElement =\n | HTMLHeadingElement\n | HTMLParagraphElement\n | HTMLSpanElement\n | HTMLDivElement\n | HTMLAnchorElement\n | HTMLBodyElement\n | HTMLHtmlElement;\n\n/** @remarks \\@since 6.0.0 */\nexport type CustomTypographyComponent = ElementType<\n HTMLAttributes<TypographyHTMLElement> & { className: string }\n>;\n\n/** @internal */\nfunction getComponent(\n as: CustomTypographyComponent | undefined,\n type: TypographyType\n): ElementType {\n if (as) {\n return as;\n }\n\n switch (type) {\n case \"headline-1\":\n return \"h1\";\n case \"headline-2\":\n return \"h2\";\n case \"headline-3\":\n return \"h3\";\n case \"headline-4\":\n return \"h4\";\n case \"headline-5\":\n return \"h5\";\n case \"headline-6\":\n case \"subtitle-1\":\n case \"subtitle-2\":\n return \"h6\";\n case \"body-1\":\n case \"body-2\":\n return \"p\";\n case \"caption\":\n return \"caption\";\n default:\n return \"span\";\n }\n}\n\nexport interface TypographyProps\n extends HTMLAttributes<TypographyHTMLElement>,\n TypographyClassNameOptions {\n /**\n * The component to render as when the children are not a render function. If\n * this prop is omitted, the component will be determined by the `type` prop\n * where:\n *\n * - `\"headline-1\" -> <h1>`\n * - `\"headline-2\" -> <h2>`\n * - `\"headline-3\" -> <h3>`\n * - `\"headline-4\" -> <h4>`\n * - `\"headline-5\" -> <h5>`\n * - `\"headline-6\" -> <h6>`\n * - `\"subtitle-1\" -> <h5>`\n * - `\"subtitle-2\" -> <h6>`\n * - `\"body-1\" -> <p>`\n * - `\"body-2\" -> <p>`\n * - `\"caption\" -> <caption>`\n * - `\"overline\" -> <span>`\n */\n as?: CustomTypographyComponent;\n}\n\n/**\n * **Server Component**\n *\n * Render text with one of the material design typography styles applied and\n * optional styles like font-weight, font-style, text color, etc.\n *\n * @example\n * All Example\n * ```tsx\n * import { Typography } from \"@react-md/core\":\n *\n * export function Example() {\n * return (\n * <>\n * <Typography type=\"headline-1\">Headline 1</Typography>\n * <Typography type=\"headline-2\">Headline 2</Typography>\n * <Typography type=\"headline-3\">Headline 3</Typography>\n * <Typography type=\"headline-4\">Headline 4</Typography>\n * <Typography type=\"headline-5\">Headline 5</Typography>\n * <Typography type=\"headline-6\">Headline 6</Typography>\n * <Typography type=\"subtitle-1\">Subtitle 1</Typography>\n * <Typography type=\"subtitle-2\">Subtitle 2</Typography>\n * <Typography>\n * A paragraph of text.\n * </Typography>\n * <Typography type=\"body-1\">\n * A paragraph of text.\n * </Typography>\n * <Typography type=\"body-2\">\n * Another paragraph of text.\n * </Typography>\n * <Typography type=\"caption\" component=\"h5\">\n * Caption text\n * </Typography>\n * <Typography type=\"overline\" component=\"h5\">\n * Overline text\n * </Typography>\n * </>\n * ):\n * }\n * ```\n */\nexport const Typography = forwardRef<TypographyHTMLElement, TypographyProps>(\n function Typography(props, ref): ReactElement {\n const {\n as,\n type = \"body-1\",\n className,\n margin,\n fontStyle,\n fontWeight,\n textAlign,\n textColor,\n textDecoration,\n textTransform,\n textOverflow,\n children,\n ...remaining\n } = props;\n\n const Component = getComponent(as, type);\n return (\n <Component\n {...remaining}\n ref={ref}\n className={typography({\n type,\n margin,\n fontStyle,\n fontWeight,\n textAlign,\n textColor,\n textDecoration,\n textTransform,\n textOverflow,\n className,\n })}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["cnb","forwardRef","cssUtils","typography","options","type","getComponent","as","Typography","props","ref","className","margin","fontStyle","fontWeight","textAlign","textColor","textDecoration","textTransform","textOverflow","children","remaining","Component"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,QAIL,QAAQ;AACf,SAASC,QAAQ,QAAkC,iBAAiB;AAiDpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFC,GACD,OAAO,SAASC,WACdC,UAA8C,CAAC,CAAC;IAEhD,MAAM,EAAEC,OAAO,QAAQ,EAAE,GAAGD;IAE5B,8EAA8E;IAC9E,qDAAqD;IACrD,OAAOJ,IACL,kBACAK,QAAQ,CAAC,gBAAgB,EAAEA,KAAK,CAAC,EACjCH,SAASE;AAEb;AAuBA,cAAc,GACd,SAASE,aACPC,EAAyC,EACzCF,IAAoB;IAEpB,IAAIE,IAAI;QACN,OAAOA;IACT;IAEA,OAAQF;QACN,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAO;QACT,KAAK;QACL,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT;YACE,OAAO;IACX;AACF;AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCC,GACD,OAAO,MAAMG,2BAAaP,WACxB,SAASO,WAAWC,KAAK,EAAEC,GAAG;IAC5B,MAAM,EACJH,EAAE,EACFF,OAAO,QAAQ,EACfM,SAAS,EACTC,MAAM,EACNC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,cAAc,EACdC,aAAa,EACbC,YAAY,EACZC,QAAQ,EACR,GAAGC,WACJ,GAAGZ;IAEJ,MAAMa,YAAYhB,aAAaC,IAAIF;IACnC,qBACE,KAACiB;QACE,GAAGD,SAAS;QACbX,KAAKA;QACLC,WAAWR,WAAW;YACpBE;YACAO;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAR;QACF;kBAECS;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/typography/Typography.tsx"],"sourcesContent":["import {\n forwardRef,\n type ElementType,\n type HTMLAttributes,\n type ReactElement,\n} from \"react\";\nimport {\n typography,\n type TypographyClassNameOptions,\n type TypographyType,\n} from \"./typographyStyles.js\";\n\n/**\n * A union of the default supported elements that the `Typography` component can\n * be rendered as. This is mostly used for adding the correct `HTMLAttributes`\n * and enabling the forward ref.\n *\n * @remarks \\@since 4.0.0\n */\nexport type TypographyHTMLElement =\n | HTMLHeadingElement\n | HTMLParagraphElement\n | HTMLSpanElement\n | HTMLDivElement\n | HTMLAnchorElement\n | HTMLBodyElement\n | HTMLHtmlElement;\n\n/** @remarks \\@since 6.0.0 */\nexport type CustomTypographyComponent = ElementType<\n HTMLAttributes<TypographyHTMLElement> & { className: string }\n>;\n\n/** @internal */\nfunction getComponent(\n as: CustomTypographyComponent | undefined,\n type: TypographyType\n): ElementType {\n if (as) {\n return as;\n }\n\n switch (type) {\n case \"headline-1\":\n return \"h1\";\n case \"headline-2\":\n return \"h2\";\n case \"headline-3\":\n return \"h3\";\n case \"headline-4\":\n return \"h4\";\n case \"headline-5\":\n return \"h5\";\n case \"headline-6\":\n case \"subtitle-1\":\n case \"subtitle-2\":\n return \"h6\";\n case \"body-1\":\n case \"body-2\":\n return \"p\";\n case \"caption\":\n return \"caption\";\n default:\n return \"span\";\n }\n}\n\nexport interface TypographyProps\n extends HTMLAttributes<TypographyHTMLElement>,\n TypographyClassNameOptions {\n /**\n * The component to render as when the children are not a render function. If\n * this prop is omitted, the component will be determined by the `type` prop\n * where:\n *\n * - `\"headline-1\" -> <h1>`\n * - `\"headline-2\" -> <h2>`\n * - `\"headline-3\" -> <h3>`\n * - `\"headline-4\" -> <h4>`\n * - `\"headline-5\" -> <h5>`\n * - `\"headline-6\" -> <h6>`\n * - `\"subtitle-1\" -> <h5>`\n * - `\"subtitle-2\" -> <h6>`\n * - `\"body-1\" -> <p>`\n * - `\"body-2\" -> <p>`\n * - `\"caption\" -> <caption>`\n * - `\"overline\" -> <span>`\n */\n as?: CustomTypographyComponent;\n}\n\n/**\n * **Server Component**\n *\n * Render text with one of the material design typography styles applied and\n * optional styles like font-weight, font-style, text color, etc.\n *\n * @example\n * All Example\n * ```tsx\n * import { Typography } from \"@react-md/core\":\n *\n * export function Example() {\n * return (\n * <>\n * <Typography type=\"headline-1\">Headline 1</Typography>\n * <Typography type=\"headline-2\">Headline 2</Typography>\n * <Typography type=\"headline-3\">Headline 3</Typography>\n * <Typography type=\"headline-4\">Headline 4</Typography>\n * <Typography type=\"headline-5\">Headline 5</Typography>\n * <Typography type=\"headline-6\">Headline 6</Typography>\n * <Typography type=\"subtitle-1\">Subtitle 1</Typography>\n * <Typography type=\"subtitle-2\">Subtitle 2</Typography>\n * <Typography>\n * A paragraph of text.\n * </Typography>\n * <Typography type=\"body-1\">\n * A paragraph of text.\n * </Typography>\n * <Typography type=\"body-2\">\n * Another paragraph of text.\n * </Typography>\n * <Typography type=\"caption\" component=\"h5\">\n * Caption text\n * </Typography>\n * <Typography type=\"overline\" component=\"h5\">\n * Overline text\n * </Typography>\n * </>\n * ):\n * }\n * ```\n */\nexport const Typography = forwardRef<TypographyHTMLElement, TypographyProps>(\n function Typography(props, ref): ReactElement {\n const {\n as,\n type = \"body-1\",\n className,\n margin,\n fontStyle,\n fontWeight,\n textAlign,\n textColor,\n textDecoration,\n textTransform,\n textOverflow,\n children,\n ...remaining\n } = props;\n\n const Component = getComponent(as, type);\n return (\n <Component\n {...remaining}\n ref={ref}\n className={typography({\n type,\n margin,\n fontStyle,\n fontWeight,\n textAlign,\n textColor,\n textDecoration,\n textTransform,\n textOverflow,\n className,\n })}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["forwardRef","typography","getComponent","as","type","Typography","props","ref","className","margin","fontStyle","fontWeight","textAlign","textColor","textDecoration","textTransform","textOverflow","children","remaining","Component"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,SACEA,UAAU,QAIL,QAAQ;AACf,SACEC,UAAU,QAGL,wBAAwB;AAuB/B,cAAc,GACd,SAASC,aACPC,EAAyC,EACzCC,IAAoB;IAEpB,IAAID,IAAI;QACN,OAAOA;IACT;IAEA,OAAQC;QACN,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAO;QACT,KAAK;QACL,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT;YACE,OAAO;IACX;AACF;AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCC,GACD,OAAO,MAAMC,2BAAaL,WACxB,SAASK,WAAWC,KAAK,EAAEC,GAAG;IAC5B,MAAM,EACJJ,EAAE,EACFC,OAAO,QAAQ,EACfI,SAAS,EACTC,MAAM,EACNC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,cAAc,EACdC,aAAa,EACbC,YAAY,EACZC,QAAQ,EACR,GAAGC,WACJ,GAAGZ;IAEJ,MAAMa,YAAYjB,aAAaC,IAAIC;IACnC,qBACE,KAACe;QACE,GAAGD,SAAS;QACbX,KAAKA;QACLC,WAAWP,WAAW;YACpBG;YACAK;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAR;QACF;kBAECS;;AAGP,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/typography/WritingDirectionProvider.tsx"],"sourcesContent":["\"use client\";\nimport {\n Children,\n cloneElement,\n createContext,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { type UseStateInitializer } from \"../types.js\";\n\n/**\n * Note: unlike the `dir` DOM attribute, the `\"auto\"` value is not supported.\n *\n * @remarks \\@since 6.0.0\n */\nexport type Dir = \"ltr\" | \"rtl\";\n\n/** @remarks \\@since 6.0.0 */\nexport type DefaultDir = UseStateInitializer<Dir>;\n\n/** @remarks \\@since 2.3.0 */\nexport interface WritingDirectionContext {\n /**\n * The current writing direction that is being inherited.\n */\n dir: Dir;\n\n /**\n * Toggles the current writing direction for the first parent `Dir` component.\n */\n toggleDir(): void;\n}\n\n/** @internal */\ninterface InheritableContext extends WritingDirectionContext {\n root: boolean;\n}\n\nconst context = createContext<InheritableContext>({\n root: true,\n dir: \"ltr\",\n toggleDir: () => {\n if (process.env.NODE_ENV !== \"production\") {\n throw new Error(\n \"Tried to toggle the current writing direction without initializing the `Dir` component.\"\n );\n }\n },\n});\ncontext.displayName = \"WritingDirection\";\nconst { Provider } = context;\n\n/**\n * Gets the writing direction context which provides access to the current `dir`\n * and a `toggleDir` function.\n *\n * @example\n * Manually Changing the Writing Direction\n * ```tsx\n * import { useDir } from \"@react-md/core\";\n *\n * function Example() {\n * const { dir, toggleDir } = useDir();\n *\n * return (\n * <>\n * <p>{`The current dir is: \"${dir}\"`}</p>\n * <button type=\"button\" onClick={toggleDir}>Toggle</button>\n * </>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useDir(): Readonly<WritingDirectionContext> {\n const { root: _root, ...current } = useContext(context);\n return current;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface WritingDirectionProviderProps {\n /**\n * A single ReactElement child. If the `WritingDirection` has a parent\n * `WritingDirection`, the child will have the `dir` prop cloned into this\n * element.\n */\n children: ReactElement<{ dir?: Dir }> | ReactNode;\n\n /**\n * The default writing direction for your app or a subtree. To change the\n * current writing direction, use the `useDir` hook to get access to the\n * current `dir` and the `toggleDir` function.\n *\n * @defaultValue `\"ltr\"`\n * @see {@link DEFAULT_WRITING_DIRECTION}\n */\n defaultDir?: DefaultDir;\n}\n\n/**\n * In the browser, this will default to the `<html>`'s `dir` value if one\n * exists. If the `dir` attribute does not exist, it will default to `\"ltr\"`.\n *\n * In node environments, this will default to `\"ltr\"`.\n *\n * @remarks \\@since 6.0.0\n */\nexport const DEFAULT_WRITING_DIRECTION = (): Dir => {\n let dir: Dir = \"ltr\";\n if (typeof document !== \"undefined\") {\n const rootDir = document.documentElement.getAttribute(\"dir\");\n dir = rootDir === \"rtl\" ? \"rtl\" : \"ltr\";\n }\n\n return dir;\n};\n\n/**\n * **Client Component**\n *\n * The `WritingDirection` component is used to handle the current writing\n * direction within your app as well as conditionally updating the writing\n * direction for small sections in your app. When this component is used for the\n * first time near the root of your React component tree, the current direction\n * will be applied to the root `<html>` element. Otherwise the current dir will\n * be cloned into the child element so it can be passed as a prop.\n *\n * Note: Since the `dir` is cloned into the child element, you need to make sure\n * that the child is either a DOM element or the `dir` prop is passed from your\n * custom component.\n *\n * @example\n * Root Setup\n * ```tsx\n * import { createRoot } from \"react-dom/client\";\n * import { WritingDirection } from \"@react-md/core\";\n * import App from \"./App.js\":\n *\n * const container = document.getElementById(\"root\");\n * const root = createRoot(container);\n *\n * root.render(\n * <WritingDirection>\n * <App />\n * </WritingDirection>\n * );\n * ```\n *\n * @example\n * Supporting RTL Languages\n * ```tsx\n * import { createRoot } from \"react-dom/client\";\n * import { WritingDirection } from \"@react-md/core\";\n * import type { Dir } from \"@react-md/core\";\n * import App from \"./App.js\":\n *\n * const container = document.getElementById(\"root\");\n * const root = createRoot(container);\n *\n * // see https://meta.wikimedia.org/wiki/Template:List_of_language_names_ordered_by_code\n * const SUPPORTED_RTL_LANGUAGES = [\n * \"ar\",\n * \"arc\",\n * \"ckb\",\n * \"dv\",\n * \"fa\",\n * \"ha\",\n * \"he\",\n * \"khw\",\n * \"ks\",\n * \"ps\",\n * \"sd\",\n * \"ur\",\n * \"uz_AF\",\n * \"ti\",\n * ];\n *\n * const defaultDir = (): Dir => {\n * if (SUPPORTED_RTL_LANGUAGES.includes(navigator.language)) {\n * return \"rtl\"\n * }\n *\n * return \"ltr\";\n * }\n *\n * root.render(\n * <WritingDirection defaultDir={defaultDir}>\n * <App />\n * </WritingDirection>\n * );\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function WritingDirectionProvider(\n props: WritingDirectionProviderProps\n): ReactElement {\n const { children, defaultDir = DEFAULT_WRITING_DIRECTION } = props;\n const { root } = useContext(context);\n const [dir, setDir] = useState(defaultDir);\n useEffect(() => {\n if (!root || typeof document === \"undefined\") {\n return;\n }\n\n document.documentElement.setAttribute(\"dir\", dir);\n\n return () => {\n document.documentElement.removeAttribute(\"dir\");\n };\n }, [dir, root]);\n\n const toggleDir = useCallback(() => {\n setDir((prevDir) => (prevDir === \"ltr\" ? \"rtl\" : \"ltr\"));\n }, []);\n\n const value = useMemo<InheritableContext>(\n () => ({ root: false, dir, toggleDir }),\n [dir, toggleDir]\n );\n let child = Children.only(children);\n if (!root && isValidElement<{ dir: Dir }>(child)) {\n child = cloneElement(child, { dir });\n }\n\n return <Provider value={value}>{child}</Provider>;\n}\n"],"names":["Children","cloneElement","createContext","isValidElement","useCallback","useContext","useEffect","useMemo","useState","context","root","dir","toggleDir","process","env","NODE_ENV","Error","displayName","Provider","useDir","_root","current","DEFAULT_WRITING_DIRECTION","document","rootDir","documentElement","getAttribute","WritingDirectionProvider","props","children","defaultDir","setDir","setAttribute","removeAttribute","prevDir","value","child","only"],"mappings":"AAAA;;AACA,SACEA,QAAQ,EACRC,YAAY,EACZC,aAAa,EACbC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QAGH,QAAQ;AA+Bf,MAAMC,wBAAUP,cAAkC;IAChDQ,MAAM;IACNC,KAAK;IACLC,WAAW;QACT,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC,MAAM,IAAIC,MACR;QAEJ;IACF;AACF;AACAP,QAAQQ,WAAW,GAAG;AACtB,MAAM,EAAEC,QAAQ,EAAE,GAAGT;AAErB;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,SAASU;IACd,MAAM,EAAET,MAAMU,KAAK,EAAE,GAAGC,SAAS,GAAGhB,WAAWI;IAC/C,OAAOY;AACT;AAsBA;;;;;;;CAOC,GACD,OAAO,MAAMC,4BAA4B;IACvC,IAAIX,MAAW;IACf,IAAI,OAAOY,aAAa,aAAa;QACnC,MAAMC,UAAUD,SAASE,eAAe,CAACC,YAAY,CAAC;QACtDf,MAAMa,YAAY,QAAQ,QAAQ;IACpC;IAEA,OAAOb;AACT,EAAE;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4EC,GACD,OAAO,SAASgB,yBACdC,KAAoC;IAEpC,MAAM,EAAEC,QAAQ,EAAEC,aAAaR,yBAAyB,EAAE,GAAGM;IAC7D,MAAM,EAAElB,IAAI,EAAE,GAAGL,WAAWI;IAC5B,MAAM,CAACE,KAAKoB,OAAO,GAAGvB,SAASsB;IAC/BxB,UAAU;QACR,IAAI,CAACI,QAAQ,OAAOa,aAAa,aAAa;YAC5C;QACF;QAEAA,SAASE,eAAe,CAACO,YAAY,CAAC,OAAOrB;QAE7C,OAAO;YACLY,SAASE,eAAe,CAACQ,eAAe,CAAC;QAC3C;IACF,GAAG;QAACtB;QAAKD;KAAK;IAEd,MAAME,YAAYR,YAAY;QAC5B2B,OAAO,CAACG,UAAaA,YAAY,QAAQ,QAAQ;IACnD,GAAG,EAAE;IAEL,MAAMC,QAAQ5B,QACZ,IAAO,CAAA;YAAEG,MAAM;YAAOC;YAAKC;QAAU,CAAA,GACrC;QAACD;QAAKC;KAAU;IAElB,IAAIwB,QAAQpC,SAASqC,IAAI,CAACR;IAC1B,IAAI,CAACnB,sBAAQP,eAA6BiC,QAAQ;QAChDA,sBAAQnC,aAAamC,OAAO;YAAEzB;QAAI;IACpC;IAEA,qBAAO,KAACO;QAASiB,OAAOA;kBAAQC;;AAClC"}
1
+ {"version":3,"sources":["../../src/typography/WritingDirectionProvider.tsx"],"sourcesContent":["\"use client\";\nimport {\n Children,\n cloneElement,\n createContext,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { type UseStateInitializer } from \"../types.js\";\n\n/**\n * Note: unlike the `dir` DOM attribute, the `\"auto\"` value is not supported.\n *\n * @remarks \\@since 6.0.0\n */\nexport type Dir = \"ltr\" | \"rtl\";\n\n/** @remarks \\@since 6.0.0 */\nexport type DefaultDir = UseStateInitializer<Dir>;\n\n/** @remarks \\@since 2.3.0 */\nexport interface WritingDirectionContext {\n /**\n * The current writing direction that is being inherited.\n */\n dir: Dir;\n\n /**\n * Toggles the current writing direction for the first parent `Dir` component.\n */\n toggleDir(): void;\n}\n\n/** @internal */\ninterface InheritableContext extends WritingDirectionContext {\n root: boolean;\n}\n\nconst context = createContext<InheritableContext>({\n root: true,\n dir: \"ltr\",\n toggleDir: () => {\n if (process.env.NODE_ENV !== \"production\") {\n throw new Error(\n \"Tried to toggle the current writing direction without initializing the `Dir` component.\"\n );\n }\n },\n});\ncontext.displayName = \"WritingDirection\";\nconst { Provider } = context;\n\n/**\n * Gets the writing direction context which provides access to the current `dir`\n * and a `toggleDir` function.\n *\n * @example\n * Manually Changing the Writing Direction\n * ```tsx\n * import { useDir } from \"@react-md/core\";\n *\n * function Example() {\n * const { dir, toggleDir } = useDir();\n *\n * return (\n * <>\n * <p>{`The current dir is: \"${dir}\"`}</p>\n * <button type=\"button\" onClick={toggleDir}>Toggle</button>\n * </>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useDir(): Readonly<WritingDirectionContext> {\n const { root: _root, ...current } = useContext(context);\n return current;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport interface WritingDirectionProviderProps {\n /**\n * A single ReactElement child. If the `WritingDirection` has a parent\n * `WritingDirection`, the child will have the `dir` prop cloned into this\n * element.\n */\n children: ReactElement<{ dir?: Dir }> | ReactNode;\n\n /**\n * The default writing direction for your app or a subtree. To change the\n * current writing direction, use the `useDir` hook to get access to the\n * current `dir` and the `toggleDir` function.\n *\n * @defaultValue `\"ltr\"`\n * @see {@link DEFAULT_WRITING_DIRECTION}\n */\n defaultDir?: DefaultDir;\n}\n\n/**\n * In the browser, this will default to the `<html>`'s `dir` value if one\n * exists. If the `dir` attribute does not exist, it will default to `\"ltr\"`.\n *\n * In node environments, this will default to `\"ltr\"`.\n *\n * @remarks \\@since 6.0.0\n */\nexport const DEFAULT_WRITING_DIRECTION = (): Dir => {\n let dir: Dir = \"ltr\";\n if (typeof document !== \"undefined\") {\n const rootDir = document.documentElement.getAttribute(\"dir\");\n dir = rootDir === \"rtl\" ? \"rtl\" : \"ltr\";\n }\n\n return dir;\n};\n\n/**\n * **Client Component**\n *\n * The `WritingDirection` component is used to handle the current writing\n * direction within your app as well as conditionally updating the writing\n * direction for small sections in your app. When this component is used for the\n * first time near the root of your React component tree, the current direction\n * will be applied to the root `<html>` element. Otherwise the current dir will\n * be cloned into the child element so it can be passed as a prop.\n *\n * Note: Since the `dir` is cloned into the child element, you need to make sure\n * that the child is either a DOM element or the `dir` prop is passed from your\n * custom component.\n *\n * @example\n * Root Setup\n * ```tsx\n * import { createRoot } from \"react-dom/client\";\n * import { WritingDirection } from \"@react-md/core\";\n * import App from \"./App.js\":\n *\n * const container = document.getElementById(\"root\");\n * const root = createRoot(container);\n *\n * root.render(\n * <WritingDirection>\n * <App />\n * </WritingDirection>\n * );\n * ```\n *\n * @example\n * Supporting RTL Languages\n * ```tsx\n * import { createRoot } from \"react-dom/client\";\n * import { WritingDirection } from \"@react-md/core\";\n * import type { Dir } from \"@react-md/core\";\n * import App from \"./App.js\":\n *\n * const container = document.getElementById(\"root\");\n * const root = createRoot(container);\n *\n * // see https://meta.wikimedia.org/wiki/Template:List_of_language_names_ordered_by_code\n * const SUPPORTED_RTL_LANGUAGES = [\n * \"ar\",\n * \"arc\",\n * \"ckb\",\n * \"dv\",\n * \"fa\",\n * \"ha\",\n * \"he\",\n * \"khw\",\n * \"ks\",\n * \"ps\",\n * \"sd\",\n * \"ur\",\n * \"uz_AF\",\n * \"ti\",\n * ];\n *\n * const defaultDir = (): Dir => {\n * if (SUPPORTED_RTL_LANGUAGES.includes(navigator.language)) {\n * return \"rtl\"\n * }\n *\n * return \"ltr\";\n * }\n *\n * root.render(\n * <WritingDirection defaultDir={defaultDir}>\n * <App />\n * </WritingDirection>\n * );\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function WritingDirectionProvider(\n props: WritingDirectionProviderProps\n): ReactElement {\n const { children, defaultDir = DEFAULT_WRITING_DIRECTION } = props;\n const { root } = useContext(context);\n const [dir, setDir] = useState(defaultDir);\n useEffect(() => {\n if (!root || typeof document === \"undefined\") {\n return;\n }\n\n document.documentElement.setAttribute(\"dir\", dir);\n\n return () => {\n document.documentElement.removeAttribute(\"dir\");\n };\n }, [dir, root]);\n\n const toggleDir = useCallback(() => {\n setDir((prevDir) => (prevDir === \"ltr\" ? \"rtl\" : \"ltr\"));\n }, []);\n\n const value = useMemo<InheritableContext>(\n () => ({ root: false, dir, toggleDir }),\n [dir, toggleDir]\n );\n let child = Children.only(children);\n if (!root && isValidElement<{ dir: Dir }>(child)) {\n child = cloneElement(child, { dir });\n }\n\n return <Provider value={value}>{child}</Provider>;\n}\n"],"names":["Children","cloneElement","createContext","isValidElement","useCallback","useContext","useEffect","useMemo","useState","context","root","dir","toggleDir","process","env","NODE_ENV","Error","displayName","Provider","useDir","_root","current","DEFAULT_WRITING_DIRECTION","document","rootDir","documentElement","getAttribute","WritingDirectionProvider","props","children","defaultDir","setDir","setAttribute","removeAttribute","prevDir","value","child","only"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SACEA,QAAQ,EACRC,YAAY,EACZC,aAAa,EACbC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QAGH,QAAQ;AA+Bf,MAAMC,wBAAUP,cAAkC;IAChDQ,MAAM;IACNC,KAAK;IACLC,WAAW;QACT,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC,MAAM,IAAIC,MACR;QAEJ;IACF;AACF;AACAP,QAAQQ,WAAW,GAAG;AACtB,MAAM,EAAEC,QAAQ,EAAE,GAAGT;AAErB;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,SAASU;IACd,MAAM,EAAET,MAAMU,KAAK,EAAE,GAAGC,SAAS,GAAGhB,WAAWI;IAC/C,OAAOY;AACT;AAsBA;;;;;;;CAOC,GACD,OAAO,MAAMC,4BAA4B;IACvC,IAAIX,MAAW;IACf,IAAI,OAAOY,aAAa,aAAa;QACnC,MAAMC,UAAUD,SAASE,eAAe,CAACC,YAAY,CAAC;QACtDf,MAAMa,YAAY,QAAQ,QAAQ;IACpC;IAEA,OAAOb;AACT,EAAE;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4EC,GACD,OAAO,SAASgB,yBACdC,KAAoC;IAEpC,MAAM,EAAEC,QAAQ,EAAEC,aAAaR,yBAAyB,EAAE,GAAGM;IAC7D,MAAM,EAAElB,IAAI,EAAE,GAAGL,WAAWI;IAC5B,MAAM,CAACE,KAAKoB,OAAO,GAAGvB,SAASsB;IAC/BxB,UAAU;QACR,IAAI,CAACI,QAAQ,OAAOa,aAAa,aAAa;YAC5C;QACF;QAEAA,SAASE,eAAe,CAACO,YAAY,CAAC,OAAOrB;QAE7C,OAAO;YACLY,SAASE,eAAe,CAACQ,eAAe,CAAC;QAC3C;IACF,GAAG;QAACtB;QAAKD;KAAK;IAEd,MAAME,YAAYR,YAAY;QAC5B2B,OAAO,CAACG,UAAaA,YAAY,QAAQ,QAAQ;IACnD,GAAG,EAAE;IAEL,MAAMC,QAAQ5B,QACZ,IAAO,CAAA;YAAEG,MAAM;YAAOC;YAAKC;QAAU,CAAA,GACrC;QAACD;QAAKC;KAAU;IAElB,IAAIwB,QAAQpC,SAASqC,IAAI,CAACR;IAC1B,IAAI,CAACnB,sBAAQP,eAA6BiC,QAAQ;QAChDA,sBAAQnC,aAAamC,OAAO;YAAEzB;QAAI;IACpC;IAEA,qBAAO,KAACO;QAASiB,OAAOA;kBAAQC;;AAClC"}
@@ -0,0 +1,40 @@
1
+ declare module "react" {
2
+ interface CSSProperties {
3
+ "--rmd-line-length"?: string | number;
4
+ "--rmd-text-container-padding"?: string | number;
5
+ }
6
+ }
7
+ /**
8
+ * @remarks \@since 6.0.0
9
+ */
10
+ export interface TextContainerClassNameOptions {
11
+ /**
12
+ * An optional className to merge with typography text container styles.
13
+ */
14
+ className?: string;
15
+ }
16
+ /**
17
+ * @example
18
+ * Simple Example
19
+ * ```tsx
20
+ * import { textContainer, Typography } from "@react-md/core";
21
+ *
22
+ * function Example() {
23
+ * return (
24
+ * <main className={textContainer()}>
25
+ * <Typography type="headline-1">Heading</Typography>
26
+ * <Typography>
27
+ * Pretend this is a giant paragraph of text that wraps multiple lines.
28
+ * </Typography>
29
+ * <Typography>
30
+ * Pretend this is another giant paragraph of text that wraps multiple
31
+ * lines.
32
+ * </Typography>
33
+ * </main>
34
+ * ):
35
+ * }
36
+ * ```
37
+ *
38
+ * @remarks \@since 6.0.0
39
+ */
40
+ export declare function textContainer(options?: TextContainerClassNameOptions): string;
@@ -0,0 +1,32 @@
1
+ import { cnb } from "cnbuilder";
2
+ import { bem } from "../utils/bem.js";
3
+ const styles = bem("rmd-text-container");
4
+ /**
5
+ * @example
6
+ * Simple Example
7
+ * ```tsx
8
+ * import { textContainer, Typography } from "@react-md/core";
9
+ *
10
+ * function Example() {
11
+ * return (
12
+ * <main className={textContainer()}>
13
+ * <Typography type="headline-1">Heading</Typography>
14
+ * <Typography>
15
+ * Pretend this is a giant paragraph of text that wraps multiple lines.
16
+ * </Typography>
17
+ * <Typography>
18
+ * Pretend this is another giant paragraph of text that wraps multiple
19
+ * lines.
20
+ * </Typography>
21
+ * </main>
22
+ * ):
23
+ * }
24
+ * ```
25
+ *
26
+ * @remarks \@since 6.0.0
27
+ */ export function textContainer(options = {}) {
28
+ const { className } = options;
29
+ return cnb(styles(), className);
30
+ }
31
+
32
+ //# sourceMappingURL=textContainerStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/typography/textContainerStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-line-length\"?: string | number;\n \"--rmd-text-container-padding\"?: string | number;\n }\n}\n\nconst styles = bem(\"rmd-text-container\");\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface TextContainerClassNameOptions {\n /**\n * An optional className to merge with typography text container styles.\n */\n className?: string;\n}\n\n/**\n * @example\n * Simple Example\n * ```tsx\n * import { textContainer, Typography } from \"@react-md/core\";\n *\n * function Example() {\n * return (\n * <main className={textContainer()}>\n * <Typography type=\"headline-1\">Heading</Typography>\n * <Typography>\n * Pretend this is a giant paragraph of text that wraps multiple lines.\n * </Typography>\n * <Typography>\n * Pretend this is another giant paragraph of text that wraps multiple\n * lines.\n * </Typography>\n * </main>\n * ):\n * }\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function textContainer(\n options: TextContainerClassNameOptions = {}\n): string {\n const { className } = options;\n\n return cnb(styles(), className);\n}\n"],"names":["cnb","bem","styles","textContainer","options","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAStC,MAAMC,SAASD,IAAI;AAYnB;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,SAASE,cACdC,UAAyC,CAAC,CAAC;IAE3C,MAAM,EAAEC,SAAS,EAAE,GAAGD;IAEtB,OAAOJ,IAAIE,UAAUG;AACvB"}
@@ -0,0 +1,112 @@
1
+ import { type TextCssUtilsOptions } from "../cssUtils.js";
2
+ /**
3
+ * A union of all the material design provided typography styles. When used with
4
+ * the Typography component, this will generate the correct typography className
5
+ * to apply and determine what component to be rendered as if none was provided.
6
+ *
7
+ * @remarks \@since 4.0.0
8
+ */
9
+ export type TypographyType = "headline-1" | "headline-2" | "headline-3" | "headline-4" | "headline-5" | "headline-6" | "subtitle-1" | "subtitle-2" | "body-1" | "body-2" | "caption" | "overline";
10
+ /** @remarks \@since 6.0.0 */
11
+ export interface TypographyClassNameOptions extends TextCssUtilsOptions {
12
+ className?: string;
13
+ /**
14
+ * @see {@link TypographyType}
15
+ * @defaultValue `"body-1"`
16
+ */
17
+ type?: TypographyType;
18
+ }
19
+ /** @remarks \@since 6.0.0 */
20
+ export type NullableTypographyClassNameOptions = Omit<TypographyClassNameOptions, "type"> & {
21
+ /**
22
+ * When using the {@link typography} class name utility, the `type` can be set
23
+ * to `null` to inherit font.
24
+ *
25
+ * @see {@link TypographyType}
26
+ * @defaultValue `"body-1"`
27
+ */
28
+ type?: TypographyType | null;
29
+ };
30
+ /**
31
+ * Get a typography class name based on different typography options. This is
32
+ * only useful if you are unable to use the {@link Typography} component for
33
+ * some reason.
34
+ *
35
+ * @example
36
+ * Simple Example
37
+ * ```ts
38
+ * import { typography } from "@react-md/core";
39
+ *
40
+ * function Example() {
41
+ * return (
42
+ * <>
43
+ * <h1 className={typography({ type: "headline-1" })} />
44
+ * <h2 className={typography({ type: "headline-2" })} />
45
+ * <h3 className={typography({ type: "headline-3" })} />
46
+ * <h4 className={typography({ type: "headline-4" })} />
47
+ * <h5 className={typography({ type: "headline-5" })} />
48
+ * <h6 className={typography({ type: "headline-6" })} />
49
+ * <h5 className={typography({ type: "subtitle-1" })} />
50
+ * <h6 className={typography({ type: "subtitle-2" })} />
51
+ * <p className={typography()} />
52
+ * <p className={typography({ type "body-1" })} />
53
+ * <p className={typography({ type "body-1" })} />
54
+ * <caption className={typography({ type: "caption" })} />
55
+ * <span className={typography({ type: "overline" })} />
56
+ * </>
57
+ * );
58
+ * }
59
+ * ```
60
+ *
61
+ * @example
62
+ * Applying Additional Styles
63
+ * ```ts
64
+ * import { typography } from "@react-md/core";
65
+ *
66
+ * function Example() {
67
+ * return (
68
+ * <>
69
+ * <h1
70
+ * // only maintain the default margin-bottom
71
+ * className={typography({
72
+ * type: "headline-1",
73
+ * margin: "bottom",
74
+ * })}
75
+ * />
76
+ *
77
+ * <h2
78
+ * // remove all default margin
79
+ * className={typography({
80
+ * type: "headline-2",
81
+ * margin: "none",
82
+ * })}
83
+ * />
84
+ *
85
+ * <h3
86
+ * // only maintain the default margin-top
87
+ * className={typography({
88
+ * type: "headline-3",
89
+ * margin: "top",
90
+ * })}
91
+ * />
92
+ *
93
+ * <p
94
+ * // center the text, set to bold, and only maintain default margin-bottom
95
+ * className={typography({
96
+ * type "subtitle-1",
97
+ * align: "center",
98
+ * margin: "bottom",
99
+ * })}
100
+ * />
101
+ * </>
102
+ * );
103
+ * }
104
+ * ```
105
+ *
106
+ * @see {@link Typography}
107
+ * @param options - An optional object of options used to create the typography
108
+ * class name.
109
+ * @returns a typography class name string
110
+ * @remarks \@since 6.0.0
111
+ */
112
+ export declare function typography(options?: NullableTypographyClassNameOptions): string;
@@ -0,0 +1,91 @@
1
+ import { cnb } from "cnbuilder";
2
+ import { cssUtils } from "../cssUtils.js";
3
+ /**
4
+ * Get a typography class name based on different typography options. This is
5
+ * only useful if you are unable to use the {@link Typography} component for
6
+ * some reason.
7
+ *
8
+ * @example
9
+ * Simple Example
10
+ * ```ts
11
+ * import { typography } from "@react-md/core";
12
+ *
13
+ * function Example() {
14
+ * return (
15
+ * <>
16
+ * <h1 className={typography({ type: "headline-1" })} />
17
+ * <h2 className={typography({ type: "headline-2" })} />
18
+ * <h3 className={typography({ type: "headline-3" })} />
19
+ * <h4 className={typography({ type: "headline-4" })} />
20
+ * <h5 className={typography({ type: "headline-5" })} />
21
+ * <h6 className={typography({ type: "headline-6" })} />
22
+ * <h5 className={typography({ type: "subtitle-1" })} />
23
+ * <h6 className={typography({ type: "subtitle-2" })} />
24
+ * <p className={typography()} />
25
+ * <p className={typography({ type "body-1" })} />
26
+ * <p className={typography({ type "body-1" })} />
27
+ * <caption className={typography({ type: "caption" })} />
28
+ * <span className={typography({ type: "overline" })} />
29
+ * </>
30
+ * );
31
+ * }
32
+ * ```
33
+ *
34
+ * @example
35
+ * Applying Additional Styles
36
+ * ```ts
37
+ * import { typography } from "@react-md/core";
38
+ *
39
+ * function Example() {
40
+ * return (
41
+ * <>
42
+ * <h1
43
+ * // only maintain the default margin-bottom
44
+ * className={typography({
45
+ * type: "headline-1",
46
+ * margin: "bottom",
47
+ * })}
48
+ * />
49
+ *
50
+ * <h2
51
+ * // remove all default margin
52
+ * className={typography({
53
+ * type: "headline-2",
54
+ * margin: "none",
55
+ * })}
56
+ * />
57
+ *
58
+ * <h3
59
+ * // only maintain the default margin-top
60
+ * className={typography({
61
+ * type: "headline-3",
62
+ * margin: "top",
63
+ * })}
64
+ * />
65
+ *
66
+ * <p
67
+ * // center the text, set to bold, and only maintain default margin-bottom
68
+ * className={typography({
69
+ * type "subtitle-1",
70
+ * align: "center",
71
+ * margin: "bottom",
72
+ * })}
73
+ * />
74
+ * </>
75
+ * );
76
+ * }
77
+ * ```
78
+ *
79
+ * @see {@link Typography}
80
+ * @param options - An optional object of options used to create the typography
81
+ * class name.
82
+ * @returns a typography class name string
83
+ * @remarks \@since 6.0.0
84
+ */ export function typography(options = {}) {
85
+ const { type = "body-1" } = options;
86
+ // using `&&` instead of `bem` since the latest version of typescript does not
87
+ // support setting the same object key (empty string)
88
+ return cnb("rmd-typography", type && `rmd-typography--${type}`, cssUtils(options));
89
+ }
90
+
91
+ //# sourceMappingURL=typographyStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/typography/typographyStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { cssUtils, type TextCssUtilsOptions } from \"../cssUtils.js\";\n\n/**\n * A union of all the material design provided typography styles. When used with\n * the Typography component, this will generate the correct typography className\n * to apply and determine what component to be rendered as if none was provided.\n *\n * @remarks \\@since 4.0.0\n */\nexport type TypographyType =\n | \"headline-1\"\n | \"headline-2\"\n | \"headline-3\"\n | \"headline-4\"\n | \"headline-5\"\n | \"headline-6\"\n | \"subtitle-1\"\n | \"subtitle-2\"\n | \"body-1\"\n | \"body-2\"\n | \"caption\"\n | \"overline\";\n\n/** @remarks \\@since 6.0.0 */\nexport interface TypographyClassNameOptions extends TextCssUtilsOptions {\n className?: string;\n\n /**\n * @see {@link TypographyType}\n * @defaultValue `\"body-1\"`\n */\n type?: TypographyType;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport type NullableTypographyClassNameOptions = Omit<\n TypographyClassNameOptions,\n \"type\"\n> & {\n /**\n * When using the {@link typography} class name utility, the `type` can be set\n * to `null` to inherit font.\n *\n * @see {@link TypographyType}\n * @defaultValue `\"body-1\"`\n */\n type?: TypographyType | null;\n};\n\n/**\n * Get a typography class name based on different typography options. This is\n * only useful if you are unable to use the {@link Typography} component for\n * some reason.\n *\n * @example\n * Simple Example\n * ```ts\n * import { typography } from \"@react-md/core\";\n *\n * function Example() {\n * return (\n * <>\n * <h1 className={typography({ type: \"headline-1\" })} />\n * <h2 className={typography({ type: \"headline-2\" })} />\n * <h3 className={typography({ type: \"headline-3\" })} />\n * <h4 className={typography({ type: \"headline-4\" })} />\n * <h5 className={typography({ type: \"headline-5\" })} />\n * <h6 className={typography({ type: \"headline-6\" })} />\n * <h5 className={typography({ type: \"subtitle-1\" })} />\n * <h6 className={typography({ type: \"subtitle-2\" })} />\n * <p className={typography()} />\n * <p className={typography({ type \"body-1\" })} />\n * <p className={typography({ type \"body-1\" })} />\n * <caption className={typography({ type: \"caption\" })} />\n * <span className={typography({ type: \"overline\" })} />\n * </>\n * );\n * }\n * ```\n *\n * @example\n * Applying Additional Styles\n * ```ts\n * import { typography } from \"@react-md/core\";\n *\n * function Example() {\n * return (\n * <>\n * <h1\n * // only maintain the default margin-bottom\n * className={typography({\n * type: \"headline-1\",\n * margin: \"bottom\",\n * })}\n * />\n *\n * <h2\n * // remove all default margin\n * className={typography({\n * type: \"headline-2\",\n * margin: \"none\",\n * })}\n * />\n *\n * <h3\n * // only maintain the default margin-top\n * className={typography({\n * type: \"headline-3\",\n * margin: \"top\",\n * })}\n * />\n *\n * <p\n * // center the text, set to bold, and only maintain default margin-bottom\n * className={typography({\n * type \"subtitle-1\",\n * align: \"center\",\n * margin: \"bottom\",\n * })}\n * />\n * </>\n * );\n * }\n * ```\n *\n * @see {@link Typography}\n * @param options - An optional object of options used to create the typography\n * class name.\n * @returns a typography class name string\n * @remarks \\@since 6.0.0\n */\nexport function typography(\n options: NullableTypographyClassNameOptions = {}\n): string {\n const { type = \"body-1\" } = options;\n\n // using `&&` instead of `bem` since the latest version of typescript does not\n // support setting the same object key (empty string)\n return cnb(\n \"rmd-typography\",\n type && `rmd-typography--${type}`,\n cssUtils(options)\n );\n}\n"],"names":["cnb","cssUtils","typography","options","type"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,QAAQ,QAAkC,iBAAiB;AAiDpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFC,GACD,OAAO,SAASC,WACdC,UAA8C,CAAC,CAAC;IAEhD,MAAM,EAAEC,OAAO,QAAQ,EAAE,GAAGD;IAE5B,8EAA8E;IAC9E,qDAAqD;IACrD,OAAOH,IACL,kBACAI,QAAQ,CAAC,gBAAgB,EAAEA,KAAK,CAAC,EACjCH,SAASE;AAEb"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/useAsyncAction.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useState } from \"react\";\nimport type { NonNullRef, UseStateSetter } from \"./types.js\";\nimport { useUnmounted } from \"./useUnmounted.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type AsyncActionFunction<Args extends unknown[]> = (\n ...args: Args\n) => Promise<void>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type HandleAsyncAction = <Args extends unknown[]>(\n action: AsyncActionFunction<Args>\n) => AsyncActionFunction<Args>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface AsyncActionOptions {\n /** @defaultValue `false` */\n disabled?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface AsyncActionImplementation {\n pending: boolean;\n unmounted: NonNullRef<boolean>;\n setPending: UseStateSetter<boolean>;\n handleAsync: HandleAsyncAction;\n}\n\n/**\n * A simple utility hook for triggering a pending state while an async function\n * is running. This is really only useful if you aren't using something like\n * `react-query`, `@reduxjs/toolkit/query`, `@apollo/client`, etc for API calls\n * which have a built-in pending state for mutations.\n *\n * @example\n * Simple Example (Async Button)\n * ```tsx\n * import type { ButtonProps } from \"@react-md/core\";\n * import { box, Button, CircularProgress, useAsyncAction } from \"@react-md/core\";\n * import { cnb } from \"cnbuilder\";\n * import type { MouseEvent, ReactElement } from \"react\";\n *\n * import styles from \"./AsyncButton.module.scss\";\n *\n * export interface AsyncButtonProps extends ButtonProps {\n * onClick(event: MouseEvent<HTMLButtonElement>): Promise<void>;\n * }\n *\n * export function AsyncButton(props: AsyncButtonProps): ReactElement {\n * const { onClick, children, theme, className, disabled, ...remaining } = props;\n * const { handleAsync, pending } = useAsyncAction({ disabled });\n *\n * return (\n * <Button\n * {...remaining}\n * aria-disabled={pending || undefined}\n * disabled={disabled}\n * className={cnb(pending && styles.loading, className)}\n * theme={pending ? \"disabled\" : theme}\n * onClick={handleAsync(onClick)}\n * >\n * {children}\n * {pending && (\n * <span\n * className={box({\n * align: \"center\",\n * disablePadding: true,\n * className: styles.overlay,\n * })}\n * >\n * <CircularProgress />\n * </span>\n * )}\n * </Button>\n * );\n * }\n *\n * // `AsyncButton.module.scss`\n * // hide everything in the button except for the overlay containing the circular\n * // progress\n * .loading > *:not(.overlay) {\n * opacity: 0;\n * }\n *\n * .overlay {\n * border-radius: inherit;\n * box-shadow: inherit;\n * inset: 0;\n * position: absolute;\n * z-index: 1;\n * }\n * ```\n *\n * @example\n * Confirmation Dialog with Overlay\n * ```tsx\n * import {\n * Button,\n * DialogHeader,\n * DialogContent,\n * DialogFooter,\n * Form,\n * useAsyncAction,\n * } from \"@react-md/core\";\n * import CloseIcon from \"@react-md/material-icons/CloseIcon\";\n * import type { ReactElement } from \"react\";\n * import { useId } from \"react\";\n *\n * interface ExampleProps {\n * hide(); void;\n * submit(): Promise<void>\n * }\n *\n * function Example({ hide, submit }: ExampleProps): ReactElement {\n * const { handleAsync, pending } = useAsyncAction();\n * const formId = useId();\n *\n * return (\n * <>\n * <DialogHeader>\n * <DialogTitle>Some Title</DialogTitle>\n * <Button aria-label=\"Close\" onClick={hide} disabled={pending}>\n * <CloseIcon />\n * </Button>\n * </DialogHeader>\n * <DialogContent>\n * <Form\n * id={formId}\n * onReset={hide}\n * onSubmit={handleAsync(submit)}\n * >\n * // pretend content\n * </Form>\n * </DialogContent>\n * <DialogFooter>\n * <Button\n * type=\"reset\"\n * form={formId}\n * disabled={pending}\n * >\n * Cancel\n * </Button>\n * <Button\n * type=\"submit\"\n * form={formId}\n * disabled={pending}\n * >\n * Confirm\n * </Button>\n * </DialogFooter>\n * </>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useAsyncAction(\n options: AsyncActionOptions = {}\n): AsyncActionImplementation {\n const { disabled } = options;\n\n const [pending, setPending] = useState(false);\n const unmounted = useUnmounted();\n\n const handleAsync = useCallback<HandleAsyncAction>(\n (action) =>\n async (...args) => {\n if (pending || disabled) {\n return;\n }\n\n setPending(true);\n try {\n await action(...args);\n } finally {\n if (!unmounted.current) {\n setPending(false);\n }\n }\n },\n [disabled, pending, unmounted]\n );\n\n return {\n pending,\n unmounted,\n setPending,\n handleAsync,\n };\n}\n"],"names":["useCallback","useState","useUnmounted","useAsyncAction","options","disabled","pending","setPending","unmounted","handleAsync","action","args","current"],"mappings":"AAAA;AACA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AAE9C,SAASC,YAAY,QAAQ,oBAAoB;AAkCjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgIC,GACD,OAAO,SAASC,eACdC,UAA8B,CAAC,CAAC;IAEhC,MAAM,EAAEC,QAAQ,EAAE,GAAGD;IAErB,MAAM,CAACE,SAASC,WAAW,GAAGN,SAAS;IACvC,MAAMO,YAAYN;IAElB,MAAMO,cAAcT,YAClB,CAACU,SACC,OAAO,GAAGC;YACR,IAAIL,WAAWD,UAAU;gBACvB;YACF;YAEAE,WAAW;YACX,IAAI;gBACF,MAAMG,UAAUC;YAClB,SAAU;gBACR,IAAI,CAACH,UAAUI,OAAO,EAAE;oBACtBL,WAAW;gBACb;YACF;QACF,GACF;QAACF;QAAUC;QAASE;KAAU;IAGhC,OAAO;QACLF;QACAE;QACAD;QACAE;IACF;AACF"}
1
+ {"version":3,"sources":["../src/useAsyncAction.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useState } from \"react\";\nimport type { NonNullRef, UseStateSetter } from \"./types.js\";\nimport { useUnmounted } from \"./useUnmounted.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type AsyncActionFunction<Args extends unknown[]> = (\n ...args: Args\n) => Promise<void>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type HandleAsyncAction = <Args extends unknown[]>(\n action: AsyncActionFunction<Args>\n) => AsyncActionFunction<Args>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface AsyncActionOptions {\n /** @defaultValue `false` */\n disabled?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface AsyncActionImplementation {\n pending: boolean;\n unmounted: NonNullRef<boolean>;\n setPending: UseStateSetter<boolean>;\n handleAsync: HandleAsyncAction;\n}\n\n/**\n * A simple utility hook for triggering a pending state while an async function\n * is running. This is really only useful if you aren't using something like\n * `react-query`, `@reduxjs/toolkit/query`, `@apollo/client`, etc for API calls\n * which have a built-in pending state for mutations.\n *\n * @example\n * Simple Example (Async Button)\n * ```tsx\n * import type { ButtonProps } from \"@react-md/core\";\n * import { box, Button, CircularProgress, useAsyncAction } from \"@react-md/core\";\n * import { cnb } from \"cnbuilder\";\n * import type { MouseEvent, ReactElement } from \"react\";\n *\n * import styles from \"./AsyncButton.module.scss\";\n *\n * export interface AsyncButtonProps extends ButtonProps {\n * onClick(event: MouseEvent<HTMLButtonElement>): Promise<void>;\n * }\n *\n * export function AsyncButton(props: AsyncButtonProps): ReactElement {\n * const { onClick, children, theme, className, disabled, ...remaining } = props;\n * const { handleAsync, pending } = useAsyncAction({ disabled });\n *\n * return (\n * <Button\n * {...remaining}\n * aria-disabled={pending || undefined}\n * disabled={disabled}\n * className={cnb(pending && styles.loading, className)}\n * theme={pending ? \"disabled\" : theme}\n * onClick={handleAsync(onClick)}\n * >\n * {children}\n * {pending && (\n * <span\n * className={box({\n * align: \"center\",\n * disablePadding: true,\n * className: styles.overlay,\n * })}\n * >\n * <CircularProgress />\n * </span>\n * )}\n * </Button>\n * );\n * }\n *\n * // `AsyncButton.module.scss`\n * // hide everything in the button except for the overlay containing the circular\n * // progress\n * .loading > *:not(.overlay) {\n * opacity: 0;\n * }\n *\n * .overlay {\n * border-radius: inherit;\n * box-shadow: inherit;\n * inset: 0;\n * position: absolute;\n * z-index: 1;\n * }\n * ```\n *\n * @example\n * Confirmation Dialog with Overlay\n * ```tsx\n * import {\n * Button,\n * DialogHeader,\n * DialogContent,\n * DialogFooter,\n * Form,\n * useAsyncAction,\n * } from \"@react-md/core\";\n * import CloseIcon from \"@react-md/material-icons/CloseIcon\";\n * import type { ReactElement } from \"react\";\n * import { useId } from \"react\";\n *\n * interface ExampleProps {\n * hide(); void;\n * submit(): Promise<void>\n * }\n *\n * function Example({ hide, submit }: ExampleProps): ReactElement {\n * const { handleAsync, pending } = useAsyncAction();\n * const formId = useId();\n *\n * return (\n * <>\n * <DialogHeader>\n * <DialogTitle>Some Title</DialogTitle>\n * <Button aria-label=\"Close\" onClick={hide} disabled={pending}>\n * <CloseIcon />\n * </Button>\n * </DialogHeader>\n * <DialogContent>\n * <Form\n * id={formId}\n * onReset={hide}\n * onSubmit={handleAsync(submit)}\n * >\n * // pretend content\n * </Form>\n * </DialogContent>\n * <DialogFooter>\n * <Button\n * type=\"reset\"\n * form={formId}\n * disabled={pending}\n * >\n * Cancel\n * </Button>\n * <Button\n * type=\"submit\"\n * form={formId}\n * disabled={pending}\n * >\n * Confirm\n * </Button>\n * </DialogFooter>\n * </>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useAsyncAction(\n options: AsyncActionOptions = {}\n): AsyncActionImplementation {\n const { disabled } = options;\n\n const [pending, setPending] = useState(false);\n const unmounted = useUnmounted();\n\n const handleAsync = useCallback<HandleAsyncAction>(\n (action) =>\n async (...args) => {\n if (pending || disabled) {\n return;\n }\n\n setPending(true);\n try {\n await action(...args);\n } finally {\n if (!unmounted.current) {\n setPending(false);\n }\n }\n },\n [disabled, pending, unmounted]\n );\n\n return {\n pending,\n unmounted,\n setPending,\n handleAsync,\n };\n}\n"],"names":["useCallback","useState","useUnmounted","useAsyncAction","options","disabled","pending","setPending","unmounted","handleAsync","action","args","current"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AAE9C,SAASC,YAAY,QAAQ,oBAAoB;AAkCjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgIC,GACD,OAAO,SAASC,eACdC,UAA8B,CAAC,CAAC;IAEhC,MAAM,EAAEC,QAAQ,EAAE,GAAGD;IAErB,MAAM,CAACE,SAASC,WAAW,GAAGN,SAAS;IACvC,MAAMO,YAAYN;IAElB,MAAMO,cAAcT,YAClB,CAACU,SACC,OAAO,GAAGC;YACR,IAAIL,WAAWD,UAAU;gBACvB;YACF;YAEAE,WAAW;YACX,IAAI;gBACF,MAAMG,UAAUC;YAClB,SAAU;gBACR,IAAI,CAACH,UAAUI,OAAO,EAAE;oBACtBL,WAAW;gBACb;YACF;QACF,GACF;QAACF;QAAUC;QAASE;KAAU;IAGhC,OAAO;QACLF;QACAE;QACAD;QACAE;IACF;AACF"}