@react-md/core 1.0.0-next.14 → 1.0.0-next.15

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 (548) hide show
  1. package/.eslintrc.cjs +8 -0
  2. package/.turbo/turbo-build.log +22 -22
  3. package/.turbo/turbo-lint.log +3 -3
  4. package/.turbo/turbo-test.log +4000 -3982
  5. package/.turbo/turbo-typecheck.log +1 -23
  6. package/CHANGELOG.md +13 -0
  7. package/coverage/clover.xml +477 -410
  8. package/coverage/coverage-final.json +5 -4
  9. package/coverage/lcov-report/autocomplete/Autocomplete.tsx.html +81 -15
  10. package/coverage/lcov-report/autocomplete/AutocompleteClearButton.tsx.html +262 -0
  11. package/coverage/lcov-report/autocomplete/FilterAutocompleteOptions.tsx.html +364 -0
  12. package/coverage/lcov-report/autocomplete/index.html +48 -18
  13. package/coverage/lcov-report/card/Card.tsx.html +349 -0
  14. package/coverage/lcov-report/card/CardSubtitle.tsx.html +265 -0
  15. package/coverage/lcov-report/card/index.html +146 -0
  16. package/coverage/lcov-report/card/styles.ts.html +682 -0
  17. package/coverage/lcov-report/form/Option.tsx.html +727 -0
  18. package/coverage/lcov-report/form/index.html +131 -0
  19. package/coverage/lcov-report/form/useListboxProvider.ts.html +253 -0
  20. package/coverage/lcov-report/index.html +22 -37
  21. package/coverage/lcov-report/src/card/Card.tsx.html +349 -0
  22. package/coverage/lcov-report/src/card/CardSubtitle.tsx.html +277 -0
  23. package/coverage/lcov-report/src/card/index.html +146 -0
  24. package/coverage/lcov-report/src/card/styles.ts.html +682 -0
  25. package/coverage/lcov-report/src/cssUtils.ts.html +787 -0
  26. package/coverage/lcov-report/src/index.html +116 -0
  27. package/coverage/lcov-report/src/transition/index.html +116 -0
  28. package/coverage/lcov-report/src/transition/useCSSTransition.ts.html +766 -0
  29. package/coverage/lcov-report/transition/index.html +116 -0
  30. package/coverage/lcov-report/transition/useCSSTransition.ts.html +766 -0
  31. package/coverage/lcov.info +572 -456
  32. package/dist/CoreProviders.js.map +1 -1
  33. package/dist/NoSsr.js.map +1 -1
  34. package/dist/RootHtml.js.map +1 -1
  35. package/dist/SsrProvider.js.map +1 -1
  36. package/dist/app-bar/AppBar.js.map +1 -1
  37. package/dist/app-bar/AppBarTitle.d.ts +8 -4
  38. package/dist/app-bar/AppBarTitle.js +3 -2
  39. package/dist/app-bar/AppBarTitle.js.map +1 -1
  40. package/dist/autocomplete/Autocomplete.js.map +1 -1
  41. package/dist/autocomplete/AutocompleteCircularProgress.js.map +1 -1
  42. package/dist/autocomplete/AutocompleteDropdownButton.js.map +1 -1
  43. package/dist/autocomplete/FilterAutocompleteOptions.js.map +1 -1
  44. package/dist/autocomplete/autocompleteStyles.js.map +1 -1
  45. package/dist/autocomplete/defaults.d.ts +2 -2
  46. package/dist/autocomplete/defaults.js +3 -3
  47. package/dist/autocomplete/defaults.js.map +1 -1
  48. package/dist/autocomplete/types.js.map +1 -1
  49. package/dist/avatar/Avatar.d.ts +1 -2
  50. package/dist/avatar/Avatar.js +1 -2
  51. package/dist/avatar/Avatar.js.map +1 -1
  52. package/dist/avatar/styles.js.map +1 -1
  53. package/dist/badge/Badge.js.map +1 -1
  54. package/dist/box/Box.js.map +1 -1
  55. package/dist/box/styles.js.map +1 -1
  56. package/dist/button/AsyncButton.js.map +1 -1
  57. package/dist/button/Button.js.map +1 -1
  58. package/dist/button/ButtonUnstyled.js.map +1 -1
  59. package/dist/button/FloatingActionButton.js.map +1 -1
  60. package/dist/button/TooltippedButton.js.map +1 -1
  61. package/dist/button/buttonStyles.js.map +1 -1
  62. package/dist/button/buttonUnstyledStyles.js.map +1 -1
  63. package/dist/card/Card.d.ts +2 -1
  64. package/dist/card/Card.js.map +1 -1
  65. package/dist/card/CardContent.js.map +1 -1
  66. package/dist/card/CardFooter.js.map +1 -1
  67. package/dist/card/CardHeader.js.map +1 -1
  68. package/dist/card/CardSubtitle.d.ts +6 -0
  69. package/dist/card/CardSubtitle.js +2 -1
  70. package/dist/card/CardSubtitle.js.map +1 -1
  71. package/dist/card/CardTitle.js.map +1 -1
  72. package/dist/card/ClickableCard.js.map +1 -1
  73. package/dist/card/styles.js +2 -4
  74. package/dist/card/styles.js.map +1 -1
  75. package/dist/chip/Chip.js.map +1 -1
  76. package/dist/chip/styles.js.map +1 -1
  77. package/dist/cssUtils.d.ts +1 -1
  78. package/dist/cssUtils.js.map +1 -1
  79. package/dist/delegateEvent.js.map +1 -1
  80. package/dist/dialog/Dialog.js.map +1 -1
  81. package/dist/dialog/DialogContainer.js.map +1 -1
  82. package/dist/dialog/DialogContent.js.map +1 -1
  83. package/dist/dialog/DialogFooter.js.map +1 -1
  84. package/dist/dialog/DialogHeader.js.map +1 -1
  85. package/dist/dialog/DialogTitle.js.map +1 -1
  86. package/dist/dialog/FixedDialog.js.map +1 -1
  87. package/dist/dialog/NestedDialogProvider.js.map +1 -1
  88. package/dist/dialog/styles.js.map +1 -1
  89. package/dist/divider/Divider.js.map +1 -1
  90. package/dist/divider/styles.js.map +1 -1
  91. package/dist/draggable/useDraggable.js.map +1 -1
  92. package/dist/draggable/utils.js.map +1 -1
  93. package/dist/expansion-panel/ExpansionList.js.map +1 -1
  94. package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
  95. package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
  96. package/dist/expansion-panel/useExpansionList.js.map +1 -1
  97. package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
  98. package/dist/focus/useFocusContainer.js.map +1 -1
  99. package/dist/focus/utils.js.map +1 -1
  100. package/dist/form/Checkbox.js.map +1 -1
  101. package/dist/form/Fieldset.js.map +1 -1
  102. package/dist/form/FileInput.js.map +1 -1
  103. package/dist/form/Form.js.map +1 -1
  104. package/dist/form/FormMessage.js.map +1 -1
  105. package/dist/form/FormMessageContainer.js.map +1 -1
  106. package/dist/form/FormMessageCounter.js.map +1 -1
  107. package/dist/form/InputToggle.js.map +1 -1
  108. package/dist/form/InputToggleIcon.js.map +1 -1
  109. package/dist/form/Label.js.map +1 -1
  110. package/dist/form/Legend.js.map +1 -1
  111. package/dist/form/MenuItemCheckbox.js.map +1 -1
  112. package/dist/form/MenuItemFileInput.js.map +1 -1
  113. package/dist/form/MenuItemInputToggle.js.map +1 -1
  114. package/dist/form/MenuItemRadio.js.map +1 -1
  115. package/dist/form/MenuItemSwitch.js.map +1 -1
  116. package/dist/form/MenuItemTextField.js.map +1 -1
  117. package/dist/form/NativeSelect.js.map +1 -1
  118. package/dist/form/OptGroup.js.map +1 -1
  119. package/dist/form/Option.js.map +1 -1
  120. package/dist/form/Password.js.map +1 -1
  121. package/dist/form/Radio.js.map +1 -1
  122. package/dist/form/ResizingTextAreaWrapper.js.map +1 -1
  123. package/dist/form/Select.js.map +1 -1
  124. package/dist/form/SelectedOption.js.map +1 -1
  125. package/dist/form/Slider.js.map +1 -1
  126. package/dist/form/SliderContainer.js.map +1 -1
  127. package/dist/form/SliderMark.js.map +1 -1
  128. package/dist/form/SliderMarkLabel.js.map +1 -1
  129. package/dist/form/SliderThumb.js.map +1 -1
  130. package/dist/form/SliderTrack.js.map +1 -1
  131. package/dist/form/SliderValueMarks.js.map +1 -1
  132. package/dist/form/SliderValueTooltip.js.map +1 -1
  133. package/dist/form/Switch.js.map +1 -1
  134. package/dist/form/SwitchTrack.js.map +1 -1
  135. package/dist/form/TextArea.js.map +1 -1
  136. package/dist/form/TextField.js.map +1 -1
  137. package/dist/form/TextFieldAddon.js.map +1 -1
  138. package/dist/form/TextFieldContainer.js.map +1 -1
  139. package/dist/form/fileUtils.js.map +1 -1
  140. package/dist/form/formConfig.js.map +1 -1
  141. package/dist/form/formMessageStyles.js.map +1 -1
  142. package/dist/form/inputToggleStyles.js.map +1 -1
  143. package/dist/form/menuItemInputToggleStyles.js.map +1 -1
  144. package/dist/form/nativeSelectStyles.js.map +1 -1
  145. package/dist/form/optionStyles.js.map +1 -1
  146. package/dist/form/passwordStyles.js.map +1 -1
  147. package/dist/form/selectStyles.js.map +1 -1
  148. package/dist/form/selectUtils.js.map +1 -1
  149. package/dist/form/sliderUtils.js.map +1 -1
  150. package/dist/form/switchStyles.js.map +1 -1
  151. package/dist/form/textAreaStyles.js.map +1 -1
  152. package/dist/form/textFieldContainerStyles.js.map +1 -1
  153. package/dist/form/textFieldStyles.js.map +1 -1
  154. package/dist/form/types.js.map +1 -1
  155. package/dist/form/useCheckboxGroup.js.map +1 -1
  156. package/dist/form/useCombobox.js.map +1 -1
  157. package/dist/form/useEditableCombobox.js.map +1 -1
  158. package/dist/form/useFileUpload.js.map +1 -1
  159. package/dist/form/useFormReset.js.map +1 -1
  160. package/dist/form/useListboxProvider.js.map +1 -1
  161. package/dist/form/useNumberField.js.map +1 -1
  162. package/dist/form/useRadioGroup.js.map +1 -1
  163. package/dist/form/useRangeSlider.js.map +1 -1
  164. package/dist/form/useResizingTextArea.js.map +1 -1
  165. package/dist/form/useSelectCombobox.js.map +1 -1
  166. package/dist/form/useSlider.js.map +1 -1
  167. package/dist/form/useTextField.js.map +1 -1
  168. package/dist/form/useTextFieldContainerAddons.js.map +1 -1
  169. package/dist/form/utils.js.map +1 -1
  170. package/dist/form/validation.js.map +1 -1
  171. package/dist/hoverMode/useHoverMode.js.map +1 -1
  172. package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
  173. package/dist/icon/FontIcon.d.ts +10 -6
  174. package/dist/icon/FontIcon.js +1 -5
  175. package/dist/icon/FontIcon.js.map +1 -1
  176. package/dist/icon/IconRotator.js.map +1 -1
  177. package/dist/icon/MaterialIcon.d.ts +19 -2
  178. package/dist/icon/MaterialIcon.js +14 -2
  179. package/dist/icon/MaterialIcon.js.map +1 -1
  180. package/dist/icon/MaterialSymbol.js.map +1 -1
  181. package/dist/icon/SVGIcon.d.ts +3 -0
  182. package/dist/icon/SVGIcon.js.map +1 -1
  183. package/dist/icon/TextIconSpacing.js.map +1 -1
  184. package/dist/icon/iconConfig.d.ts +1 -0
  185. package/dist/icon/iconConfig.js +1 -0
  186. package/dist/icon/iconConfig.js.map +1 -1
  187. package/dist/icon/material.d.ts +1 -1
  188. package/dist/icon/material.js.map +1 -1
  189. package/dist/icon/materialConfig.js.map +1 -1
  190. package/dist/icon/styles.js.map +1 -1
  191. package/dist/interaction/Ripple.js.map +1 -1
  192. package/dist/interaction/RippleContainer.js.map +1 -1
  193. package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
  194. package/dist/interaction/config.js.map +1 -1
  195. package/dist/interaction/types.js.map +1 -1
  196. package/dist/interaction/useElementInteraction.js.map +1 -1
  197. package/dist/interaction/useHigherContrastChildren.js.map +1 -1
  198. package/dist/interaction/utils.js.map +1 -1
  199. package/dist/layout/LayoutAppBar.js.map +1 -1
  200. package/dist/layout/LayoutNav.js.map +1 -1
  201. package/dist/layout/LayoutWindowSplitter.js.map +1 -1
  202. package/dist/layout/Main.js.map +1 -1
  203. package/dist/layout/layoutNavStyles.js.map +1 -1
  204. package/dist/layout/layoutWindowSplitterStyles.js.map +1 -1
  205. package/dist/layout/mainStyles.js.map +1 -1
  206. package/dist/layout/useExpandableLayout.js.map +1 -1
  207. package/dist/layout/useHorizontalLayoutTransition.js.map +1 -1
  208. package/dist/layout/useLayoutAppBarHeight.js.map +1 -1
  209. package/dist/layout/useLayoutTree.js.map +1 -1
  210. package/dist/layout/useLayoutWindowSplitter.js.map +1 -1
  211. package/dist/layout/useMainTabIndex.js.map +1 -1
  212. package/dist/layout/useResizableLayout.js.map +1 -1
  213. package/dist/layout/useTemporaryLayout.js.map +1 -1
  214. package/dist/link/Link.d.ts +2 -4
  215. package/dist/link/Link.js +1 -2
  216. package/dist/link/Link.js.map +1 -1
  217. package/dist/link/SkipToMainContent.d.ts +10 -3
  218. package/dist/link/SkipToMainContent.js +4 -1
  219. package/dist/link/SkipToMainContent.js.map +1 -1
  220. package/dist/link/styles.d.ts +2 -2
  221. package/dist/link/styles.js.map +1 -1
  222. package/dist/list/List.js.map +1 -1
  223. package/dist/list/ListItem.js.map +1 -1
  224. package/dist/list/ListItemAddon.js.map +1 -1
  225. package/dist/list/ListItemChildren.js.map +1 -1
  226. package/dist/list/ListItemLink.js.map +1 -1
  227. package/dist/list/ListItemText.js.map +1 -1
  228. package/dist/list/ListSubheader.js.map +1 -1
  229. package/dist/list/getListItemHeight.js.map +1 -1
  230. package/dist/list/listItemStyles.js.map +1 -1
  231. package/dist/list/types.js.map +1 -1
  232. package/dist/media-queries/AppSizeProvider.js.map +1 -1
  233. package/dist/media-queries/appSize.js.map +1 -1
  234. package/dist/media-queries/useMediaQuery.js.map +1 -1
  235. package/dist/menu/DropdownMenu.js.map +1 -1
  236. package/dist/menu/Menu.js.map +1 -1
  237. package/dist/menu/MenuBar.js.map +1 -1
  238. package/dist/menu/MenuButton.js.map +1 -1
  239. package/dist/menu/MenuConfigurationProvider.js.map +1 -1
  240. package/dist/menu/MenuItem.js.map +1 -1
  241. package/dist/menu/MenuItemButton.js.map +1 -1
  242. package/dist/menu/MenuItemCircularProgress.js.map +1 -1
  243. package/dist/menu/MenuItemGroup.js.map +1 -1
  244. package/dist/menu/MenuItemSeparator.js.map +1 -1
  245. package/dist/menu/MenuSheet.js.map +1 -1
  246. package/dist/menu/MenuVisibilityProvider.js.map +1 -1
  247. package/dist/menu/MenuWidget.js.map +1 -1
  248. package/dist/menu/MenuWidgetKeyboardProvider.js.map +1 -1
  249. package/dist/menu/useContextMenu.js.map +1 -1
  250. package/dist/menu/useMenuBarProvider.js.map +1 -1
  251. package/dist/menu/utils.js.map +1 -1
  252. package/dist/movement/constants.js.map +1 -1
  253. package/dist/movement/findMatchIndex.js.map +1 -1
  254. package/dist/movement/types.js.map +1 -1
  255. package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
  256. package/dist/movement/utils.js.map +1 -1
  257. package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
  258. package/dist/navigation/DefaultNavigationRenderer.js.map +1 -1
  259. package/dist/navigation/NavGroup.js.map +1 -1
  260. package/dist/navigation/NavItem.js.map +1 -1
  261. package/dist/navigation/NavItemButton.js.map +1 -1
  262. package/dist/navigation/NavItemLink.js.map +1 -1
  263. package/dist/navigation/NavSubheader.js.map +1 -1
  264. package/dist/navigation/Navigation.js.map +1 -1
  265. package/dist/navigation/getHrefFromParents.js.map +1 -1
  266. package/dist/navigation/navGroupStyles.js.map +1 -1
  267. package/dist/navigation/navItemStyles.js.map +1 -1
  268. package/dist/navigation/types.js.map +1 -1
  269. package/dist/navigation/useActiveHeadingId.js.map +1 -1
  270. package/dist/overlay/Overlay.d.ts +1 -0
  271. package/dist/overlay/Overlay.js.map +1 -1
  272. package/dist/overlay/overlayStyles.js.map +1 -1
  273. package/dist/portal/Portal.d.ts +4 -0
  274. package/dist/portal/Portal.js.map +1 -1
  275. package/dist/portal/PortalContainerProvider.d.ts +8 -3
  276. package/dist/portal/PortalContainerProvider.js +1 -0
  277. package/dist/portal/PortalContainerProvider.js.map +1 -1
  278. package/dist/positioning/constants.js.map +1 -1
  279. package/dist/positioning/createHorizontalPosition.js.map +1 -1
  280. package/dist/positioning/createVerticalPosition.js.map +1 -1
  281. package/dist/positioning/getFixedPosition.js.map +1 -1
  282. package/dist/positioning/types.js.map +1 -1
  283. package/dist/positioning/useFixedPositioning.js.map +1 -1
  284. package/dist/positioning/utils.js.map +1 -1
  285. package/dist/progress/CircularProgress.d.ts +5 -4
  286. package/dist/progress/CircularProgress.js.map +1 -1
  287. package/dist/progress/LinearProgress.js.map +1 -1
  288. package/dist/progress/getProgressA11y.js.map +1 -1
  289. package/dist/progress/types.js.map +1 -1
  290. package/dist/responsive-item/ResponsiveItemContainer.js.map +1 -1
  291. package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
  292. package/dist/responsive-item/styles.js.map +1 -1
  293. package/dist/scroll/ScrollLock.js.map +1 -1
  294. package/dist/scroll/getScrollbarWidth.js.map +1 -1
  295. package/dist/scroll/useScrollLock.js.map +1 -1
  296. package/dist/searching/caseInsensitive.js.map +1 -1
  297. package/dist/searching/fuzzy.js.map +1 -1
  298. package/dist/searching/toSearchQuery.js.map +1 -1
  299. package/dist/searching/types.js.map +1 -1
  300. package/dist/searching/useFuzzyMatch.js.map +1 -1
  301. package/dist/searching/utils.js.map +1 -1
  302. package/dist/segmented-button/SegmentedButton.js.map +1 -1
  303. package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -1
  304. package/dist/segmented-button/segmentedButtonContainerStyles.js.map +1 -1
  305. package/dist/segmented-button/segmentedButtonStyles.js.map +1 -1
  306. package/dist/sheet/Sheet.js.map +1 -1
  307. package/dist/sheet/styles.js.map +1 -1
  308. package/dist/snackbar/DefaultToastRenderer.js.map +1 -1
  309. package/dist/snackbar/Snackbar.js.map +1 -1
  310. package/dist/snackbar/Toast.js.map +1 -1
  311. package/dist/snackbar/ToastActionButton.js.map +1 -1
  312. package/dist/snackbar/ToastCloseButton.js.map +1 -1
  313. package/dist/snackbar/ToastContent.js.map +1 -1
  314. package/dist/snackbar/ToastManager.js.map +1 -1
  315. package/dist/snackbar/ToastManagerProvider.js.map +1 -1
  316. package/dist/snackbar/snackbarStyles.js.map +1 -1
  317. package/dist/snackbar/toastContentStyles.js.map +1 -1
  318. package/dist/snackbar/toastStyles.js.map +1 -1
  319. package/dist/snackbar/useCurrentToastActions.js.map +1 -1
  320. package/dist/suspense/CircularProgressSuspense.js.map +1 -1
  321. package/dist/suspense/NullSuspense.js.map +1 -1
  322. package/dist/table/StickyTableSection.d.ts +23 -0
  323. package/dist/table/StickyTableSection.js +56 -0
  324. package/dist/table/StickyTableSection.js.map +1 -0
  325. package/dist/table/Table.d.ts +1 -1
  326. package/dist/table/Table.js.map +1 -1
  327. package/dist/table/TableBody.d.ts +1 -1
  328. package/dist/table/TableBody.js.map +1 -1
  329. package/dist/table/TableCell.d.ts +3 -2
  330. package/dist/table/TableCell.js.map +1 -1
  331. package/dist/table/TableCellContent.d.ts +1 -2
  332. package/dist/table/TableCellContent.js.map +1 -1
  333. package/dist/table/TableCheckbox.js.map +1 -1
  334. package/dist/table/TableConfigurationProvider.d.ts +1 -73
  335. package/dist/table/TableConfigurationProvider.js.map +1 -1
  336. package/dist/table/TableContainer.js.map +1 -1
  337. package/dist/table/TableContainerProvider.js.map +1 -1
  338. package/dist/table/TableFooter.d.ts +8 -17
  339. package/dist/table/TableFooter.js +17 -80
  340. package/dist/table/TableFooter.js.map +1 -1
  341. package/dist/table/TableHeader.d.ts +8 -17
  342. package/dist/table/TableHeader.js +20 -87
  343. package/dist/table/TableHeader.js.map +1 -1
  344. package/dist/table/TableRadio.js.map +1 -1
  345. package/dist/table/TableRow.d.ts +1 -1
  346. package/dist/table/TableRow.js.map +1 -1
  347. package/dist/table/tableCellStyles.d.ts +1 -1
  348. package/dist/table/tableCellStyles.js.map +1 -1
  349. package/dist/table/tableContainerStyles.js.map +1 -1
  350. package/dist/table/tableFooterStyles.js.map +1 -1
  351. package/dist/table/tableHeaderStyles.js.map +1 -1
  352. package/dist/table/tableRowStyles.js.map +1 -1
  353. package/dist/table/tableStyles.js.map +1 -1
  354. package/dist/table/types.d.ts +89 -9
  355. package/dist/table/types.js.map +1 -1
  356. package/dist/table/useStickyTableSection.d.ts +27 -0
  357. package/dist/table/useStickyTableSection.js +84 -0
  358. package/dist/table/useStickyTableSection.js.map +1 -0
  359. package/dist/table/useTableSectionConfig.d.ts +13 -0
  360. package/dist/table/useTableSectionConfig.js +33 -0
  361. package/dist/table/useTableSectionConfig.js.map +1 -0
  362. package/dist/tabs/Tab.js.map +1 -1
  363. package/dist/tabs/TabList.js.map +1 -1
  364. package/dist/tabs/TabListScrollButton.js.map +1 -1
  365. package/dist/tabs/tabIndicatorStyles.js.map +1 -1
  366. package/dist/tabs/tabListScrollButtonStyles.js.map +1 -1
  367. package/dist/tabs/tabListStyles.js.map +1 -1
  368. package/dist/tabs/tabStyles.js.map +1 -1
  369. package/dist/tabs/useTabList.js.map +1 -1
  370. package/dist/tabs/useTabs.js.map +1 -1
  371. package/dist/tabs/utils.js.map +1 -1
  372. package/dist/test-utils/IntersectionObserver.js.map +1 -1
  373. package/dist/test-utils/ResizeObserver.js.map +1 -1
  374. package/dist/test-utils/data-testid.js.map +1 -1
  375. package/dist/test-utils/index.js.map +1 -1
  376. package/dist/test-utils/jest-setup.js.map +1 -1
  377. package/dist/test-utils/matchMedia.js.map +1 -1
  378. package/dist/test-utils/polyfills/IntersectionObserver.js.map +1 -1
  379. package/dist/test-utils/polyfills/ResizeObserver.js.map +1 -1
  380. package/dist/test-utils/polyfills/TextDecoder.js.map +1 -1
  381. package/dist/test-utils/polyfills/TextEncoder.js.map +1 -1
  382. package/dist/test-utils/polyfills/index.js.map +1 -1
  383. package/dist/test-utils/polyfills/matchMedia.js.map +1 -1
  384. package/dist/test-utils/polyfills/offsetParent.js.map +1 -1
  385. package/dist/test-utils/polyfills/scrollIntoView.js.map +1 -1
  386. package/dist/test-utils/render.js.map +1 -1
  387. package/dist/test-utils/timers.js.map +1 -1
  388. package/dist/theme/LocalStorageColorSchemeProvider.js.map +1 -1
  389. package/dist/theme/ThemeProvider.js.map +1 -1
  390. package/dist/theme/_theme.scss +2 -1
  391. package/dist/theme/colors.js.map +1 -1
  392. package/dist/theme/cssVars.js.map +1 -1
  393. package/dist/theme/types.js.map +1 -1
  394. package/dist/theme/useCSSVariables.js.map +1 -1
  395. package/dist/theme/useColorScheme.js.map +1 -1
  396. package/dist/theme/useColorSchemeMetaTag.js.map +1 -1
  397. package/dist/theme/useColorSchemeProvider.js.map +1 -1
  398. package/dist/theme/usePrefersColorScheme.js.map +1 -1
  399. package/dist/theme/utils.js.map +1 -1
  400. package/dist/tooltip/Tooltip.d.ts +20 -9
  401. package/dist/tooltip/Tooltip.js.map +1 -1
  402. package/dist/tooltip/TooltipHoverModeProvider.js.map +1 -1
  403. package/dist/tooltip/constants.js.map +1 -1
  404. package/dist/tooltip/tooltipStyles.js.map +1 -1
  405. package/dist/tooltip/useTooltip.d.ts +30 -16
  406. package/dist/tooltip/useTooltip.js.map +1 -1
  407. package/dist/tooltip/useTooltipPosition.d.ts +2 -4
  408. package/dist/tooltip/useTooltipPosition.js.map +1 -1
  409. package/dist/tooltip/utils.js.map +1 -1
  410. package/dist/transition/CSSTransition.js.map +1 -1
  411. package/dist/transition/Collapse.js.map +1 -1
  412. package/dist/transition/CrossFade.js.map +1 -1
  413. package/dist/transition/ScaleTransition.js.map +1 -1
  414. package/dist/transition/SkeletonPlaceholder.js.map +1 -1
  415. package/dist/transition/Slide.js.map +1 -1
  416. package/dist/transition/SlideContainer.js.map +1 -1
  417. package/dist/transition/collapseStyles.js.map +1 -1
  418. package/dist/transition/config.js.map +1 -1
  419. package/dist/transition/maxWidthTransition.js.map +1 -1
  420. package/dist/transition/skeletonPlaceholderUtils.js.map +1 -1
  421. package/dist/transition/types.d.ts +19 -24
  422. package/dist/transition/types.js.map +1 -1
  423. package/dist/transition/useCSSTransition.js.map +1 -1
  424. package/dist/transition/useCarousel.js.map +1 -1
  425. package/dist/transition/useCollapseTransition.js.map +1 -1
  426. package/dist/transition/useCrossFadeTransition.js.map +1 -1
  427. package/dist/transition/useMaxWidthTransition.js.map +1 -1
  428. package/dist/transition/useScaleTransition.js.map +1 -1
  429. package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
  430. package/dist/transition/useSlideTransition.js.map +1 -1
  431. package/dist/transition/useTransition.d.ts +1 -0
  432. package/dist/transition/useTransition.js +1 -0
  433. package/dist/transition/useTransition.js.map +1 -1
  434. package/dist/transition/utils.js.map +1 -1
  435. package/dist/tree/DefaultTreeItemRenderer.js.map +1 -1
  436. package/dist/tree/Tree.js.map +1 -1
  437. package/dist/tree/TreeGroup.js.map +1 -1
  438. package/dist/tree/TreeItem.js.map +1 -1
  439. package/dist/tree/TreeItemExpander.js.map +1 -1
  440. package/dist/tree/TreeProvider.js.map +1 -1
  441. package/dist/tree/styles.js.map +1 -1
  442. package/dist/tree/types.js.map +1 -1
  443. package/dist/tree/useTree.d.ts +3 -3
  444. package/dist/tree/useTree.js.map +1 -1
  445. package/dist/tree/useTreeExpansion.js.map +1 -1
  446. package/dist/tree/useTreeItems.js.map +1 -1
  447. package/dist/tree/useTreeMovement.js.map +1 -1
  448. package/dist/tree/useTreeSelection.js.map +1 -1
  449. package/dist/tree/utils.js.map +1 -1
  450. package/dist/types.js.map +1 -1
  451. package/dist/typography/SrOnly.js.map +1 -1
  452. package/dist/typography/TextContainer.d.ts +4 -0
  453. package/dist/typography/TextContainer.js +2 -0
  454. package/dist/typography/TextContainer.js.map +1 -1
  455. package/dist/typography/Typography.d.ts +10 -0
  456. package/dist/typography/Typography.js +3 -0
  457. package/dist/typography/Typography.js.map +1 -1
  458. package/dist/typography/WritingDirectionProvider.js.map +1 -1
  459. package/dist/typography/textContainerStyles.js.map +1 -1
  460. package/dist/typography/typographyStyles.js.map +1 -1
  461. package/dist/useAsyncFunction.js.map +1 -1
  462. package/dist/useDebouncedFunction.js.map +1 -1
  463. package/dist/useDropzone.js.map +1 -1
  464. package/dist/useElementSize.js.map +1 -1
  465. package/dist/useEnsuredId.js.map +1 -1
  466. package/dist/useEnsuredRef.js.map +1 -1
  467. package/dist/useEnsuredState.js.map +1 -1
  468. package/dist/useHtmlClassName.js.map +1 -1
  469. package/dist/useIntersectionObserver.js.map +1 -1
  470. package/dist/useIsomorphicLayoutEffect.js.map +1 -1
  471. package/dist/useLocalStorage.js.map +1 -1
  472. package/dist/useMutationObserver.js.map +1 -1
  473. package/dist/useOrientation.js.map +1 -1
  474. package/dist/usePageInactive.js.map +1 -1
  475. package/dist/useResizeListener.js.map +1 -1
  476. package/dist/useResizeObserver.js.map +1 -1
  477. package/dist/useThrottledFunction.js.map +1 -1
  478. package/dist/useToggle.js.map +1 -1
  479. package/dist/useUnmounted.js.map +1 -1
  480. package/dist/useWindowSize.js.map +1 -1
  481. package/dist/utils/RenderRecursively.js.map +1 -1
  482. package/dist/utils/alphaNumericSort.js.map +1 -1
  483. package/dist/utils/applyRef.js.map +1 -1
  484. package/dist/utils/bem.js.map +1 -1
  485. package/dist/utils/getClientPosition.js.map +1 -1
  486. package/dist/utils/getMiddleOfRange.js.map +1 -1
  487. package/dist/utils/getPercentage.js.map +1 -1
  488. package/dist/utils/getRangeDefaultValue.js.map +1 -1
  489. package/dist/utils/getRangeSteps.js.map +1 -1
  490. package/dist/utils/identity.js.map +1 -1
  491. package/dist/utils/isElementVisible.js.map +1 -1
  492. package/dist/utils/loop.js.map +1 -1
  493. package/dist/utils/nearest.js.map +1 -1
  494. package/dist/utils/parseCssLengthUnit.js.map +1 -1
  495. package/dist/utils/randomInt.js.map +1 -1
  496. package/dist/utils/wait.js.map +1 -1
  497. package/dist/utils/withinRange.js.map +1 -1
  498. package/dist/window-splitter/WindowSplitter.js.map +1 -1
  499. package/dist/window-splitter/useWindowSplitter.js.map +1 -1
  500. package/package.json +21 -20
  501. package/scripts/getExportMap.ts +66 -0
  502. package/scripts/tsconfig.json +1 -1
  503. package/src/app-bar/AppBarTitle.tsx +8 -4
  504. package/src/autocomplete/defaults.ts +3 -3
  505. package/src/avatar/Avatar.tsx +1 -2
  506. package/src/card/Card.tsx +2 -1
  507. package/src/card/CardSubtitle.tsx +9 -0
  508. package/src/card/__tests__/__snapshots__/CardHeader.tsx.snap +1 -1
  509. package/src/card/__tests__/__snapshots__/CardSubtitle.tsx.snap +2 -2
  510. package/src/card/__tests__/__snapshots__/styles.ts.snap +1 -1
  511. package/src/card/styles.ts +2 -6
  512. package/src/cssUtils.ts +1 -1
  513. package/src/icon/FontIcon.tsx +19 -9
  514. package/src/icon/MaterialIcon.tsx +23 -4
  515. package/src/icon/SVGIcon.tsx +3 -0
  516. package/src/icon/iconConfig.tsx +1 -0
  517. package/src/icon/material.ts +276 -19
  518. package/src/link/Link.tsx +2 -4
  519. package/src/link/SkipToMainContent.tsx +11 -4
  520. package/src/link/styles.ts +2 -2
  521. package/src/overlay/Overlay.tsx +1 -0
  522. package/src/portal/Portal.tsx +5 -0
  523. package/src/portal/PortalContainerProvider.tsx +16 -7
  524. package/src/progress/CircularProgress.tsx +5 -4
  525. package/src/table/StickyTableSection.tsx +91 -0
  526. package/src/table/Table.tsx +2 -5
  527. package/src/table/TableBody.tsx +1 -2
  528. package/src/table/TableCell.tsx +3 -5
  529. package/src/table/TableCellContent.tsx +1 -3
  530. package/src/table/TableConfigurationProvider.tsx +1 -86
  531. package/src/table/TableFooter.tsx +19 -116
  532. package/src/table/TableHeader.tsx +20 -118
  533. package/src/table/TableRow.tsx +2 -4
  534. package/src/table/__tests__/Table.tsx +9 -8
  535. package/src/table/tableCellStyles.ts +1 -1
  536. package/src/table/types.ts +105 -10
  537. package/src/table/useStickyTableSection.tsx +126 -0
  538. package/src/table/useTableSectionConfig.ts +45 -0
  539. package/src/theme/_theme.scss +2 -1
  540. package/src/tooltip/Tooltip.tsx +24 -8
  541. package/src/tooltip/useTooltip.ts +52 -27
  542. package/src/tooltip/useTooltipPosition.ts +2 -4
  543. package/src/transition/types.ts +23 -27
  544. package/src/transition/useTransition.ts +1 -0
  545. package/src/tree/useTree.ts +3 -5
  546. package/src/typography/TextContainer.tsx +4 -0
  547. package/src/typography/Typography.tsx +10 -0
  548. package/src/useResizeListener.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/positioning/useFixedPositioning.ts"],"sourcesContent":["\"use client\";\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type Ref,\n type RefCallback,\n type RefObject,\n} from \"react\";\nimport { delegateEvent } from \"../delegateEvent.js\";\nimport { type TransitionCallbacks } from \"../transition/types.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport { BELOW_CENTER_ANCHOR } from \"./constants.js\";\nimport { getFixedPosition } from \"./getFixedPosition.js\";\nimport { type CalculateFixedPositionOptions } from \"./types.js\";\nimport { isWithinViewport } from \"./utils.js\";\n\nconst noop = (): undefined => undefined;\n\n/**\n * @since 4.0.0\n */\nexport type FixedPositioningTransitionCallbacks = Pick<\n TransitionCallbacks,\n \"onEnter\" | \"onEntering\" | \"onEntered\" | \"onExited\"\n>;\n\n/**\n * This options should be passed to the {@link useCSSTransition} for the styling\n * and positioning to work correctly.\n *\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface FixedPositioningTransitionOptions<E extends HTMLElement>\n extends FixedPositioningTransitionCallbacks {\n /** {@inheritDoc TransitionOptions.nodeRef} */\n nodeRef?: Ref<E>;\n}\n\n/**\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @since 4.0.0\n */\nexport interface FixedPositioningScrollData<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n> {\n fixedElement: FixedElement;\n fixedToElement: FixedToElement;\n\n /**\n * Boolean if the {@link fixedToElement} is visible within the viewport.\n */\n visible: boolean;\n}\n\n/**\n * This function is called when the page is scrolled while the fixed element is\n * visible. This is generally used to reposition the fixed element or hide it if\n * it is no longer visible within the viewport.\n *\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @param event - The scroll event\n * @param data - The {@link FixedPositioningScrollData} that can be used for\n * custom scroll behavior.\n * @since 4.0.0\n */\nexport type TransitionScrollCallback<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n> = (\n event: Event,\n data: Readonly<FixedPositioningScrollData<FixedToElement, FixedElement>>\n) => void;\n\n/**\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @since 4.0.0\n */\nexport interface FixedPositioningOptions<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n> extends FixedPositioningTransitionOptions<FixedElement>,\n CalculateFixedPositionOptions {\n /**\n * An optional style that will be merged with the fixed positioning required\n * styles.\n *\n * @see {@link FixedPositionStyle}\n */\n style?: CSSProperties;\n\n /**\n * A ref pointing to an element that another element should be fixed to. This\n * **must** be provided for the positioning to work.\n */\n fixedTo: RefObject<FixedToElement>;\n\n /**\n * An optional function that can be used to override positioning options if\n * some options require the element to be in the DOM for specific\n * calculations.\n */\n getFixedPositionOptions?(): CalculateFixedPositionOptions;\n\n /**\n * An optional function to call if the page resizes while the `FixedElement`\n * is visible.\n */\n onResize?: EventListener;\n /** @see {@link TransitionScrollCallback} */\n onScroll?: TransitionScrollCallback<FixedToElement, FixedElement>;\n}\n\n/**\n * @typeParam E - An HTMLElement type for the fixed element.\n * @since 4.0.0\n */\nexport interface FixedPositioningHookReturnValue<E extends HTMLElement> {\n /**\n * A ref that should be passed to a component for the fixed positioning\n * behavior to work correctly.\n *\n * This should really only be used if the {@link TransitionOptions} is not\n * being used.\n */\n ref: RefCallback<E>;\n\n /**\n * @see {@link FixedPositionStyle}\n */\n style: CSSProperties;\n\n /**\n * This should really only be used if the {@link transitionOptions} is not\n * being used.\n */\n callbacks: Readonly<Required<FixedPositioningTransitionCallbacks>>;\n\n /**\n * A function that can be called to update the style for the fixed element.\n */\n updateStyle(): void;\n\n /** {@inheritDoc FixedPositioningTransitionOptions} */\n transitionOptions: Readonly<Required<FixedPositioningTransitionOptions<E>>>;\n}\n\n/**\n * This hook is used to attach a temporary (fixed) element to another element\n * within the page. In other words, this is a way to have an element with\n * `position: fixed` as if it were `position: absolute` to a parent element that\n * had `position: relative`.\n *\n * @example Simple Example\n * ```tsx\n * import { ReactElement, useRef, useState } from \"react\";\n * import { Button, useCSSTransition, useFixedPositioning } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * const fixedTo = useRef<HTMLButtonElement>(null);\n * const [transitionIn, setTransitionIn] = useState(false);\n * const { style, transitionOptions } = useFixedPositioning({\n * fixedTo,\n * });\n * const { elementProps, rendered } = useCSSTransition({\n * ...transitionOptions,\n * transitionIn,\n * temporary: true,\n * timeout: {\n * enter: 200,\n * exit: 150,\n * },\n * classNames: {\n * enter: \"enter\",\n * enterActive: \"enter--active\",\n * exit: \"exit\",\n * exitActive: \"exit--active\",\n * },\n * });\n *\n * return (\n * <>\n * <Button\n * ref={fixedTo}\n * onClick={() => setTransitionIn(!transitionIn)}\n * >\n * Toggle\n * </Button>\n * {rendered && (\n * <div {...elementProps} style={style}>\n * Fixed Temporary Element\n * </div>\n * )}\n * </>\n * );\n * }\n * ```\n *\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @since 4.0.0\n */\nexport function useFixedPositioning<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n>(\n options: FixedPositioningOptions<FixedToElement, FixedElement>\n): FixedPositioningHookReturnValue<FixedElement> {\n const {\n style: propStyle,\n nodeRef,\n fixedTo,\n onEnter = noop,\n onEntering = noop,\n onEntered = noop,\n onExited = noop,\n anchor = BELOW_CENTER_ANCHOR,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions = noop,\n onScroll,\n onResize = noop,\n } = options;\n\n const [active, setActive] = useState(false);\n const [ref, refHandler] = useEnsuredRef(nodeRef);\n const optionsRef = useRef({\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n } as const);\n useIsomorphicLayoutEffect(() => {\n optionsRef.current = {\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n };\n }, [\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n ]);\n const [style, setStyle] = useState<CSSProperties | undefined>(\n () =>\n getFixedPosition({\n container: ref.current,\n element: fixedTo.current,\n anchor,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n ...getFixedPositionOptions(),\n }).style\n );\n\n const updateStyle = useCallback(() => {\n const {\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n } = optionsRef.current;\n const element = ref.current;\n const container = fixedTo.current;\n const { style } = getFixedPosition({\n container,\n element,\n anchor,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n ...getFixedPositionOptions(),\n });\n\n setStyle(style);\n setActive(!!element && !element.hidden);\n\n // Only changing the initialX and initialY should cause the useEffect below\n // to trigger, which is why everything else is set in a ref.\n }, [initialX, initialY]);\n\n useEffect(() => {\n if (!active) {\n return;\n }\n\n const resizeCallback = (event: Event): void => {\n onResize(event);\n updateStyle();\n };\n const scrollCallback = (event: Event): void => {\n const fixedElement = ref.current;\n const fixedToElement = fixedTo.current;\n if (onScroll && fixedElement && fixedToElement) {\n onScroll(event, {\n visible: isWithinViewport({ fixedElement, fixedToElement }),\n fixedElement,\n fixedToElement,\n });\n }\n\n updateStyle();\n };\n\n const resizeHandler = delegateEvent(\"resize\", window, true);\n const scrollHandler = delegateEvent(\"scroll\", window, true, {\n passive: true,\n });\n resizeHandler.add(resizeCallback);\n scrollHandler.add(scrollCallback);\n return () => {\n resizeHandler.remove(resizeCallback);\n scrollHandler.remove(scrollCallback);\n };\n }, [active, fixedTo, onResize, onScroll, ref, updateStyle]);\n\n const callbacks: Required<FixedPositioningTransitionCallbacks> = {\n onEnter(appearing) {\n onEnter(appearing);\n updateStyle();\n },\n onEntering(appearing) {\n onEntering(appearing);\n updateStyle();\n },\n onEntered(appearing) {\n onEntered(appearing);\n updateStyle();\n },\n onExited() {\n onExited();\n setActive(false);\n },\n };\n\n return {\n ref: refHandler,\n style: { ...style, ...propStyle },\n callbacks,\n updateStyle,\n transitionOptions: {\n ...callbacks,\n nodeRef: refHandler,\n },\n };\n}\n"],"names":["useCallback","useEffect","useRef","useState","delegateEvent","useEnsuredRef","useIsomorphicLayoutEffect","BELOW_CENTER_ANCHOR","getFixedPosition","isWithinViewport","noop","undefined","useFixedPositioning","options","style","propStyle","nodeRef","fixedTo","onEnter","onEntering","onEntered","onExited","anchor","disableSwapping","disableVHBounds","initialX","initialY","preventOverlap","transformOrigin","vhMargin","vwMargin","width","xMargin","yMargin","getFixedPositionOptions","onScroll","onResize","active","setActive","ref","refHandler","optionsRef","current","setStyle","container","element","updateStyle","hidden","resizeCallback","event","scrollCallback","fixedElement","fixedToElement","visible","resizeHandler","window","scrollHandler","passive","add","remove","callbacks","appearing","transitionOptions"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,SACEA,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QAKH,QAAQ;AACf,SAASC,aAAa,QAAQ,sBAAsB;AAEpD,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,yBAAyB,QAAQ,kCAAkC;AAC5E,SAASC,mBAAmB,QAAQ,iBAAiB;AACrD,SAASC,gBAAgB,QAAQ,wBAAwB;AAEzD,SAASC,gBAAgB,QAAQ,aAAa;AAE9C,MAAMC,OAAO,IAAiBC;AAwI9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDC,GACD,OAAO,SA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C,UAAUyC;YACVf;QACF;QACAzB;YACEA;YACAiB,UAAU;QACZ;IACF;IAEA,OAAO;QACLC,KAAKC;QACL1B,OAAO;YAAE,GAAGA,KAAK;YAAE,GAAGC,SAAS;QAAC;QAChC6C;QACAd;QACAgB,mBAAmB;YACjB,GAAGF,SAAS;YACZ5C,SAASwB;QACX;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/positioning/useFixedPositioning.ts"],"sourcesContent":["\"use client\";\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type Ref,\n type RefCallback,\n type RefObject,\n} from \"react\";\nimport { delegateEvent } from \"../delegateEvent.js\";\nimport { type TransitionCallbacks } from \"../transition/types.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport { BELOW_CENTER_ANCHOR } from \"./constants.js\";\nimport { getFixedPosition } from \"./getFixedPosition.js\";\nimport { type CalculateFixedPositionOptions } from \"./types.js\";\nimport { isWithinViewport } from \"./utils.js\";\n\nconst noop = (): undefined => undefined;\n\n/**\n * @since 4.0.0\n */\nexport type FixedPositioningTransitionCallbacks = Pick<\n TransitionCallbacks,\n \"onEnter\" | \"onEntering\" | \"onEntered\" | \"onExited\"\n>;\n\n/**\n * This options should be passed to the {@link useCSSTransition} for the styling\n * and positioning to work correctly.\n *\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface FixedPositioningTransitionOptions<E extends HTMLElement>\n extends FixedPositioningTransitionCallbacks {\n /** {@inheritDoc TransitionOptions.nodeRef} */\n nodeRef?: Ref<E>;\n}\n\n/**\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @since 4.0.0\n */\nexport interface FixedPositioningScrollData<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n> {\n fixedElement: FixedElement;\n fixedToElement: FixedToElement;\n\n /**\n * Boolean if the {@link fixedToElement} is visible within the viewport.\n */\n visible: boolean;\n}\n\n/**\n * This function is called when the page is scrolled while the fixed element is\n * visible. This is generally used to reposition the fixed element or hide it if\n * it is no longer visible within the viewport.\n *\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @param event - The scroll event\n * @param data - The {@link FixedPositioningScrollData} that can be used for\n * custom scroll behavior.\n * @since 4.0.0\n */\nexport type TransitionScrollCallback<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n> = (\n event: Event,\n data: Readonly<FixedPositioningScrollData<FixedToElement, FixedElement>>\n) => void;\n\n/**\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @since 4.0.0\n */\nexport interface FixedPositioningOptions<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n> extends FixedPositioningTransitionOptions<FixedElement>,\n CalculateFixedPositionOptions {\n /**\n * An optional style that will be merged with the fixed positioning required\n * styles.\n *\n * @see {@link FixedPositionStyle}\n */\n style?: CSSProperties;\n\n /**\n * A ref pointing to an element that another element should be fixed to. This\n * **must** be provided for the positioning to work.\n */\n fixedTo: RefObject<FixedToElement>;\n\n /**\n * An optional function that can be used to override positioning options if\n * some options require the element to be in the DOM for specific\n * calculations.\n */\n getFixedPositionOptions?(): CalculateFixedPositionOptions;\n\n /**\n * An optional function to call if the page resizes while the `FixedElement`\n * is visible.\n */\n onResize?: EventListener;\n /** @see {@link TransitionScrollCallback} */\n onScroll?: TransitionScrollCallback<FixedToElement, FixedElement>;\n}\n\n/**\n * @typeParam E - An HTMLElement type for the fixed element.\n * @since 4.0.0\n */\nexport interface FixedPositioningHookReturnValue<E extends HTMLElement> {\n /**\n * A ref that should be passed to a component for the fixed positioning\n * behavior to work correctly.\n *\n * This should really only be used if the {@link TransitionOptions} is not\n * being used.\n */\n ref: RefCallback<E>;\n\n /**\n * @see {@link FixedPositionStyle}\n */\n style: CSSProperties;\n\n /**\n * This should really only be used if the {@link transitionOptions} is not\n * being used.\n */\n callbacks: Readonly<Required<FixedPositioningTransitionCallbacks>>;\n\n /**\n * A function that can be called to update the style for the fixed element.\n */\n updateStyle(): void;\n\n /** {@inheritDoc FixedPositioningTransitionOptions} */\n transitionOptions: Readonly<Required<FixedPositioningTransitionOptions<E>>>;\n}\n\n/**\n * This hook is used to attach a temporary (fixed) element to another element\n * within the page. In other words, this is a way to have an element with\n * `position: fixed` as if it were `position: absolute` to a parent element that\n * had `position: relative`.\n *\n * @example Simple Example\n * ```tsx\n * import { ReactElement, useRef, useState } from \"react\";\n * import { Button, useCSSTransition, useFixedPositioning } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * const fixedTo = useRef<HTMLButtonElement>(null);\n * const [transitionIn, setTransitionIn] = useState(false);\n * const { style, transitionOptions } = useFixedPositioning({\n * fixedTo,\n * });\n * const { elementProps, rendered } = useCSSTransition({\n * ...transitionOptions,\n * transitionIn,\n * temporary: true,\n * timeout: {\n * enter: 200,\n * exit: 150,\n * },\n * classNames: {\n * enter: \"enter\",\n * enterActive: \"enter--active\",\n * exit: \"exit\",\n * exitActive: \"exit--active\",\n * },\n * });\n *\n * return (\n * <>\n * <Button\n * ref={fixedTo}\n * onClick={() => setTransitionIn(!transitionIn)}\n * >\n * Toggle\n * </Button>\n * {rendered && (\n * <div {...elementProps} style={style}>\n * Fixed Temporary Element\n * </div>\n * )}\n * </>\n * );\n * }\n * ```\n *\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @since 4.0.0\n */\nexport function useFixedPositioning<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n>(\n options: FixedPositioningOptions<FixedToElement, FixedElement>\n): FixedPositioningHookReturnValue<FixedElement> {\n const {\n style: propStyle,\n nodeRef,\n fixedTo,\n onEnter = noop,\n onEntering = noop,\n onEntered = noop,\n onExited = noop,\n anchor = BELOW_CENTER_ANCHOR,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions = noop,\n onScroll,\n onResize = noop,\n } = options;\n\n const [active, setActive] = useState(false);\n const [ref, refHandler] = useEnsuredRef(nodeRef);\n const optionsRef = useRef({\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n } as const);\n useIsomorphicLayoutEffect(() => {\n optionsRef.current = {\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n };\n }, [\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n ]);\n const [style, setStyle] = useState<CSSProperties | undefined>(\n () =>\n getFixedPosition({\n container: ref.current,\n element: fixedTo.current,\n anchor,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n ...getFixedPositionOptions(),\n }).style\n );\n\n const updateStyle = useCallback(() => {\n const {\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n } = optionsRef.current;\n const element = ref.current;\n const container = fixedTo.current;\n const { style } = getFixedPosition({\n container,\n element,\n anchor,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n ...getFixedPositionOptions(),\n });\n\n setStyle(style);\n setActive(!!element && !element.hidden);\n\n // Only changing the initialX and initialY should cause the useEffect below\n // to trigger, which is why everything else is set in a ref.\n }, [initialX, initialY]);\n\n useEffect(() => {\n if (!active) {\n return;\n }\n\n const resizeCallback = (event: Event): void => {\n onResize(event);\n updateStyle();\n };\n const scrollCallback = (event: Event): void => {\n const fixedElement = ref.current;\n const fixedToElement = fixedTo.current;\n if (onScroll && fixedElement && fixedToElement) {\n onScroll(event, {\n visible: isWithinViewport({ fixedElement, fixedToElement }),\n fixedElement,\n fixedToElement,\n });\n }\n\n updateStyle();\n };\n\n const resizeHandler = delegateEvent(\"resize\", window, true);\n const scrollHandler = delegateEvent(\"scroll\", window, true, {\n passive: true,\n });\n resizeHandler.add(resizeCallback);\n scrollHandler.add(scrollCallback);\n return () => {\n resizeHandler.remove(resizeCallback);\n scrollHandler.remove(scrollCallback);\n };\n }, [active, fixedTo, onResize, onScroll, ref, updateStyle]);\n\n const callbacks: Required<FixedPositioningTransitionCallbacks> = {\n onEnter(appearing) {\n onEnter(appearing);\n updateStyle();\n },\n onEntering(appearing) {\n onEntering(appearing);\n updateStyle();\n },\n onEntered(appearing) {\n onEntered(appearing);\n updateStyle();\n },\n onExited() {\n onExited();\n setActive(false);\n },\n };\n\n return {\n ref: refHandler,\n style: { ...style, ...propStyle },\n callbacks,\n updateStyle,\n transitionOptions: {\n ...callbacks,\n nodeRef: refHandler,\n },\n };\n}\n"],"names":["useCallback","useEffect","useRef","useState","delegateEvent","useEnsuredRef","useIsomorphicLayoutEffect","BELOW_CENTER_ANCHOR","getFixedPosition","isWithinViewport","noop","undefined","useFixedPositioning","options","style","propStyle","nodeRef","fixedTo","onEnter","onEntering","onEntered","onExited","anchor","disableSwapping","disableVHBounds","initialX","initialY","preventOverlap","transformOrigin","vhMargin","vwMargin","width","xMargin","yMargin","getFixedPositionOptions","onScroll","onResize","active","setActive","ref","refHandler","optionsRef","current","setStyle","container","element","updateStyle","hidden","resizeCallback","event","scrollCallback","fixedElement","fixedToElement","visible","resizeHandler","window","scrollHandler","passive","add","remove","callbacks","appearing","transitionOptions"],"mappings":"AAAA;AACA,SACEA,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QAKH,QAAQ;AACf,SAASC,aAAa,QAAQ,sBAAsB;AAEpD,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,yBAAyB,QAAQ,kCAAkC;AAC5E,SAASC,mBAAmB,QAAQ,iBAAiB;AACrD,SAASC,gBAAgB,QAAQ,wBAAwB;AAEzD,SAASC,gBAAgB,QAAQ,aAAa;AAE9C,MAAMC,OAAO,IAAiBC;AAwI9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDC,GACD,OAAO,SAASC,oBAIdC,OAA8D;IAE9D,MAAM,EACJC,OAAOC,SAAS,EAChBC,OAAO,EACPC,OAAO,EACPC,UAAUR,IAAI,EACdS,aAAaT,IAAI,EACjBU,YAAYV,IAAI,EAChBW,WAAWX,IAAI,EACfY,SAASf,mBAAmB,EAC5BgB,eAAe,EACfC,eAAe,EACfC,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACdC,eAAe,EACfC,QAAQ,EACRC,QAAQ,EACRC,KAAK,EACLC,OAAO,EACPC,OAAO,EACPC,0BAA0BxB,IAAI,EAC9ByB,QAAQ,EACRC,WAAW1B,IAAI,EAChB,GAAGG;IAEJ,MAAM,CAACwB,QAAQC,UAAU,GAAGnC,SAAS;IACrC,MAAM,CAACoC,KAAKC,WAAW,GAAGnC,cAAcW;IACxC,MAAMyB,aAAavC,OAAO;QACxBqC;QACAtB;QACAK;QACAC;QACAC;QACAG;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;IACF;IACA5B,0BAA0B;QACxBmC,WAAWC,OAAO,GAAG;YACnBH;YACAtB;YACAK;YACAC;YACAC;YACAG;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;QACF;IACF,GAAG;QACDK;QACAt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AC;gBACF;YACF;YAEAN;QACF;QAEA,MAAMQ,gBAAgBlD,cAAc,UAAUmD,QAAQ;QACtD,MAAMC,gBAAgBpD,cAAc,UAAUmD,QAAQ,MAAM;YAC1DE,SAAS;QACX;QACAH,cAAcI,GAAG,CAACV;QAClBQ,cAAcE,GAAG,CAACR;QAClB,OAAO;YACLI,cAAcK,MAAM,CAACX;YACrBQ,cAAcG,MAAM,CAACT;QACvB;IACF,GAAG;QAACb;QAAQpB;QAASmB;QAAUD;QAAUI;QAAKO;KAAY;IAE1D,MAAMc,YAA2D;QAC/D1C,SAAQ2C,SAAS;YACf3C,QAAQ2C;YACRf;QACF;QACA3B,YAAW0C,SAAS;YAClB1C,WAAW0C;YACXf;QACF;QACA1B,WAAUyC,SAAS;YACjBzC,UAAUyC;YACVf;QACF;QACAzB;YACEA;YACAiB,UAAU;QACZ;IACF;IAEA,OAAO;QACLC,KAAKC;QACL1B,OAAO;YAAE,GAAGA,KAAK;YAAE,GAAGC,SAAS;QAAC;QAChC6C;QACAd;QACAgB,mBAAmB;YACjB,GAAGF,SAAS;YACZ5C,SAASwB;QACX;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/positioning/utils.ts"],"sourcesContent":["import { type PositionAnchor } from \"./types.js\";\n\n/** @internal */\nexport interface XCoordConfig {\n xMargin: number;\n elWidth: number;\n initialX?: number;\n containerRect: DOMRect;\n}\n\n/** @internal */\nexport interface YCoordConfig {\n yMargin: number;\n elHeight: number;\n initialY?: number;\n containerRect: DOMRect;\n}\n\ntype Left = number;\ntype Top = number;\n\n/**\n * Creates the `left` style value for an element that should be fixed to the\n * (outer) left of the container element. So the right bounds of the fixed\n * element will be equal to the left bounds of the container element (before the\n * xMargin is applied).\n *\n * @internal\n */\nexport function getLeftCoord({\n xMargin,\n elWidth,\n initialX,\n containerRect,\n}: XCoordConfig): Left {\n return (initialX ?? containerRect.left) - elWidth - xMargin;\n}\n\n/**\n * Creates the `left` style value for an element that should be fixed to the\n * inner-left of the container element. So the left bounds of both the container\n * and fixed elements will overlap (before the xMargin is applied)\n *\n * @internal\n */\nexport function getInnerLeftCoord({\n xMargin,\n initialX,\n containerRect,\n}: XCoordConfig): Left {\n return (initialX ?? containerRect.left) + xMargin;\n}\n\n/**\n * Creates the `left` style value for an element that should be fixed to the\n * center of the container element. So the center point of the fixed element\n * should be the center point of the container element.\n *\n * Note: Unlike all the other horizontal positioning logic, the center position\n * does not use the xMargin.\n *\n * @internal\n */\nexport function getCenterXCoord({\n elWidth,\n initialX,\n containerRect,\n}: XCoordConfig): Left {\n const containerCenter = containerRect.width / 2;\n const elementCenter = elWidth / 2;\n return (initialX ?? containerRect.left + containerCenter) - elementCenter;\n}\n\n/**\n * Creates the `left` style value for an element that should be fixed to the\n * inner-right of the container element. So the right bounds for both the\n * container and fixed elements will overlap (before the xMargin is applied).\n *\n * @internal\n */\nexport function getInnerRightCoord({\n xMargin,\n elWidth,\n initialX,\n containerRect,\n}: XCoordConfig): Left {\n return (\n (initialX ?? containerRect.left + containerRect.width) - elWidth - xMargin\n );\n}\n\n/**\n * Creates the `left` style value for an element that should be fixed to the\n * (outer) right of the container element. So the left bounds of the fixed\n * element will overlap with the right bounds of the container element (before\n * the xMargin is applied).\n *\n * @internal\n */\nexport function getRightCoord({\n xMargin,\n initialX,\n containerRect,\n}: XCoordConfig): Left {\n return (initialX ?? containerRect.left + containerRect.width) + xMargin;\n}\n\n/**\n * Creates the `top` style value for an element that should be fixed above the\n * container element. So the bottom bounds of the fixed element will overlap\n * with the top bounds of the container element (before the yMargin is applied).\n *\n * @internal\n */\nexport function getAboveCoord({\n yMargin,\n initialY,\n elHeight,\n containerRect,\n}: YCoordConfig): Top {\n return (initialY ?? containerRect.top) - elHeight - yMargin;\n}\n\n/**\n * Creates the `top` style value for an element that should be fixed to the top\n * of the container element. So the top bounds for both the container and fixed\n * elements will overlap (before the yMargin is applied).\n *\n * @internal\n */\nexport function getTopCoord({\n yMargin,\n initialY,\n containerRect,\n}: YCoordConfig): Top {\n return (initialY ?? containerRect.top) + yMargin;\n}\n\n/**\n * Creates the `top` style value for an element that should be fixed vertically\n * centered relative to the container element. So the vertical center point for\n * the fixed element should overlap the vertical center point of the container\n * element.\n *\n * Note: Unlike all the other vertical positioning logic, the center position\n * does not use the yMargin.\n *\n * @internal\n */\nexport function getCenterYCoord({\n yMargin,\n elHeight,\n initialY,\n containerRect,\n}: YCoordConfig): Top {\n const containerCenter = containerRect.height / 2;\n const elementCenter = elHeight / 2;\n return (\n (initialY ?? containerRect.top + containerCenter + yMargin) - elementCenter\n );\n}\n\n/**\n * Creates the `top` style value for an element that should be fixed to the\n * bottom of the container element. So the top bounds of the fixed element\n * should overlap the bottom bounds of the container element (before the yMargin\n * is applied).\n *\n * @internal\n */\nexport function getBottomCoord({\n yMargin,\n initialY,\n elHeight,\n containerRect,\n}: YCoordConfig): Top {\n return (\n (initialY ?? containerRect.top + containerRect.height) - elHeight - yMargin\n );\n}\n\n/**\n * Creates the `top` style value for an element that should be fixed to the\n * bottom of the container element. So the bottom bounds of both the container\n * and fixed elements should overlap (before the yMargin is applied).\n *\n * @internal\n */\nexport function getBelowCoord({\n yMargin,\n initialY,\n containerRect,\n}: YCoordConfig): Top {\n return (initialY ?? containerRect.top + containerRect.height) + yMargin;\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport interface TransformOriginOptions extends PositionAnchor {\n transformOriginY?: number;\n}\n\n/**\n * This is a simple util that'll generate a css `transform-origin` string so\n * that the fixed element can animate from the correct point based on the\n * provided anchor.\n *\n * @param options - The anchor that should be used to create the transform origin\n * for.\n * @returns the transform origin string\n * @internal\n */\nexport function getTransformOrigin(options: TransformOriginOptions): string {\n const { transformOriginY: yPosition } = options;\n\n let x = \"0\";\n switch (options.x) {\n case \"right\":\n case \"inner-left\":\n x = \"0\";\n break;\n case \"center\":\n x = \"50%\";\n break;\n case \"left\":\n case \"inner-right\":\n x = \"100%\";\n break;\n default:\n x = \"0\";\n }\n\n let y = \"0\";\n if (typeof yPosition === \"number\") {\n y = `${yPosition}px`;\n } else {\n switch (options.y) {\n case \"above\":\n case \"bottom\":\n y = \"100%\";\n break;\n case \"center\":\n y = \"50%\";\n break;\n case \"below\":\n case \"top\":\n y = \"0\";\n break;\n default:\n y = \"0\";\n }\n }\n\n return `${x} ${y}`;\n}\n\n/**\n * Attempts to find a sizing container based on the provided HTMLElement. By\n * default, the sizing element will just be the provided element unless:\n * - the item has a known role within react-md that can target known classes\n * - the item has a `data-sizing-selector` attribute that is a valid query\n * selector for the nested item.\n *\n * NOTE: The `data-sizing-selector` will be run from the current element instead\n * of the `document`.\n *\n * @param el - The element to find a sizing container for.\n * @returns the sizing container relative to the provided element, or `null` if\n * none could be found.\n * @throws This error will be thrown if using the `data-query-selector` and the\n * query selector does not return an element on the page.\n * @internal\n */\nexport function findSizingContainer(\n el: HTMLElement | null\n): HTMLElement | null {\n if (!el) {\n return null;\n }\n\n if (/(tree|list)item/.test(el.getAttribute(\"role\") || \"\")) {\n const content = el.querySelector(\n \".rmd-tree-item__content, .rmd-item-text\"\n ) as HTMLElement;\n if (content) {\n return content;\n }\n } else if (el.getAttribute(\"type\") === \"file\") {\n const label = document.querySelector<HTMLLabelElement>(`[for=\"${el.id}\"]`);\n if (label) {\n return label;\n }\n }\n\n const data = el.getAttribute(\"data-sizing-selector\");\n if (data) {\n const content = el.querySelector(data) as HTMLElement;\n if (content) {\n return content;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n throw new Error(\n \"Unable to find a child element using the `data-sizing-selector`\"\n );\n }\n }\n\n return el;\n}\n\n/**\n * This util is used to get the \"true\" `element.getBoundingClientRect()` that\n * ensures that transitions using transforms don't mess up the sizing so that\n * position calculations are easier to do.\n *\n * @param element - The element to get a rect for.\n * @returns either a DOMRect for the element\n * @internal\n */\nexport function getElementRect(element: HTMLElement): DOMRect {\n const cloned = element.cloneNode(true) as HTMLElement;\n // remove the id so there won't be two elements with the same id on the page\n cloned.removeAttribute(\"id\");\n\n // remove the role just in case the role would alert screen readers once added\n // to the dom\n cloned.removeAttribute(\"role\");\n\n // ensure the cloned node won't shift the page or be visible\n cloned.style.position = \"fixed\";\n cloned.style.visibility = \"hidden\";\n\n // reset positioning to get a \"pure\" calculation. otherwise this will mess up\n // the height and width if the element is able to line wrap.\n cloned.style.left = \"\";\n cloned.style.top = \"\";\n cloned.style.right = \"\";\n cloned.style.bottom = \"\";\n\n // reset transforms so that custom animations don't mess with the sizing\n cloned.style.transform = \"none\";\n\n const parent = element.parentElement || document.body;\n parent.appendChild(cloned);\n\n const rect = cloned.getBoundingClientRect();\n parent.removeChild(cloned);\n\n return rect;\n}\n\n/**\n * @since 4.0.0\n * @internal\n */\ninterface IsWithinViewportOptions {\n fixedElement: HTMLElement;\n fixedToElement: HTMLElement;\n}\n\n/**\n * @since 4.0.0\n * @internal\n */\nexport function isWithinViewport(options: IsWithinViewportOptions): boolean {\n const { fixedElement, fixedToElement } = options;\n const fixedElementRect = fixedElement.getBoundingClientRect();\n const fixedToElementRect = fixedToElement.getBoundingClientRect();\n const vh = window.innerHeight;\n const vw = window.innerWidth;\n const top = Math.min(fixedElementRect.top, fixedToElementRect.top);\n const right = Math.max(fixedElementRect.right, fixedToElementRect.right);\n const bottom = Math.max(fixedElementRect.bottom, fixedToElementRect.bottom);\n const left = Math.min(fixedElementRect.left, fixedToElementRect.left);\n\n return bottom >= 0 && top <= vh && right >= 0 && left <= vw;\n}\n"],"names":["getLeftCoord","xMargin","elWidth","initialX","containerRect","left","getInnerLeftCoord","getCenterXCoord","containerCenter","width","elementCenter","getInnerRightCoord","getRightCoord","getAboveCoord","yMargin","initialY","elHeight","top","getTopCoord","getCenterYCoord","height","getBottomCoord","getBelowCoord","getTransformOrigin","options","transformOriginY","yPosition","x","y","findSizingContainer","el","test","getAttribute","content","querySelector","label","document","id","data","process","env","NODE_ENV","Error","getElementRect","element","cloned","cloneNode","removeAttribute","style","position","visibility","right","bottom","transform","parent","parentElement","body","appendChild","rect","getBoundingClientRect","removeChild","isWithinViewport","fixedElement","fixedToElement","fixedElementRect","fixedToElementRect","vh","window","innerHeight","vw","innerWidth","Math","min","max"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAqBA;;;;;;;CAOC,GACD,OAAO,SAASA,aAAa,EAC3BC,OAAO,EACPC,OAAO,EACPC,QAAQ,EACRC,aAAa,EACA;IACb,OAAO,AAACD,CAAAA,YAAYC,cAAcC,IAAI,AAAD,IAAKH,UAAUD;AACtD;AAEA;;;;;;CAMC,GACD,OAAO,SAASK,kBAAkB,EAChCL,OAAO,EACPE,QAAQ,EACRC,aAAa,EACA;IACb,OAAO,AAACD,CAAAA,YAAYC,cAAcC,IAAI,AAAD,IAAKJ;AAC5C;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASM,gBAAgB,EAC9BL,OAAO,EACPC,QAAQ,EACRC,aAAa,EACA;IACb,MAAMI,kBAAkBJ,cAAcK,KAAK,GAAG;IAC9C,MAAMC,gBAAgBR,UAAU;IAChC,OAAO,AAACC,CAAAA,YAAYC,cAAcC,IAAI,GAAGG,eAAc,IAAKE;AAC9D;AAEA;;;;;;CAMC,GACD,OAAO,SAASC,mBAAmB,EACjCV,OAAO,EACPC,OAAO,EACPC,QAAQ,EACRC,aAAa,EACA;IACb,OACE,AAACD,CAAAA,YAAYC,cAAcC,IAAI,GAAGD,cAAcK,KAAK,AAAD,IAAKP,UAAUD;AAEvE;AAEA;;;;;;;CAOC,GACD,OAAO,SAASW,cAAc,EAC5BX,OAAO,EACPE,QAAQ,EACRC,aAAa,EACA;IACb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ts"],"sourcesContent":["import { type PositionAnchor } from \"./types.js\";\n\n/** @internal */\nexport interface XCoordConfig {\n xMargin: number;\n elWidth: number;\n initialX?: number;\n containerRect: DOMRect;\n}\n\n/** @internal */\nexport interface YCoordConfig {\n yMargin: number;\n elHeight: number;\n initialY?: number;\n containerRect: DOMRect;\n}\n\ntype Left = number;\ntype Top = number;\n\n/**\n * Creates the `left` style value for an element that should be fixed to the\n * (outer) left of the container element. So the right bounds of the fixed\n * element will be equal to the left bounds of the container element (before the\n * xMargin is applied).\n *\n * @internal\n */\nexport function getLeftCoord({\n xMargin,\n elWidth,\n initialX,\n containerRect,\n}: XCoordConfig): Left {\n return (initialX ?? containerRect.left) - elWidth - xMargin;\n}\n\n/**\n * Creates the `left` style value for an element that should be fixed to the\n * inner-left of the container element. So the left bounds of both the container\n * and fixed elements will overlap (before the xMargin is applied)\n *\n * @internal\n */\nexport function getInnerLeftCoord({\n xMargin,\n initialX,\n containerRect,\n}: XCoordConfig): Left {\n return (initialX ?? containerRect.left) + xMargin;\n}\n\n/**\n * Creates the `left` style value for an element that should be fixed to the\n * center of the container element. So the center point of the fixed element\n * should be the center point of the container element.\n *\n * Note: Unlike all the other horizontal positioning logic, the center position\n * does not use the xMargin.\n *\n * @internal\n */\nexport function getCenterXCoord({\n elWidth,\n initialX,\n containerRect,\n}: XCoordConfig): Left {\n const containerCenter = containerRect.width / 2;\n const elementCenter = elWidth / 2;\n return (initialX ?? containerRect.left + containerCenter) - elementCenter;\n}\n\n/**\n * Creates the `left` style value for an element that should be fixed to the\n * inner-right of the container element. So the right bounds for both the\n * container and fixed elements will overlap (before the xMargin is applied).\n *\n * @internal\n */\nexport function getInnerRightCoord({\n xMargin,\n elWidth,\n initialX,\n containerRect,\n}: XCoordConfig): Left {\n return (\n (initialX ?? containerRect.left + containerRect.width) - elWidth - xMargin\n );\n}\n\n/**\n * Creates the `left` style value for an element that should be fixed to the\n * (outer) right of the container element. So the left bounds of the fixed\n * element will overlap with the right bounds of the container element (before\n * the xMargin is applied).\n *\n * @internal\n */\nexport function getRightCoord({\n xMargin,\n initialX,\n containerRect,\n}: XCoordConfig): Left {\n return (initialX ?? containerRect.left + containerRect.width) + xMargin;\n}\n\n/**\n * Creates the `top` style value for an element that should be fixed above the\n * container element. So the bottom bounds of the fixed element will overlap\n * with the top bounds of the container element (before the yMargin is applied).\n *\n * @internal\n */\nexport function getAboveCoord({\n yMargin,\n initialY,\n elHeight,\n containerRect,\n}: YCoordConfig): Top {\n return (initialY ?? containerRect.top) - elHeight - yMargin;\n}\n\n/**\n * Creates the `top` style value for an element that should be fixed to the top\n * of the container element. So the top bounds for both the container and fixed\n * elements will overlap (before the yMargin is applied).\n *\n * @internal\n */\nexport function getTopCoord({\n yMargin,\n initialY,\n containerRect,\n}: YCoordConfig): Top {\n return (initialY ?? containerRect.top) + yMargin;\n}\n\n/**\n * Creates the `top` style value for an element that should be fixed vertically\n * centered relative to the container element. So the vertical center point for\n * the fixed element should overlap the vertical center point of the container\n * element.\n *\n * Note: Unlike all the other vertical positioning logic, the center position\n * does not use the yMargin.\n *\n * @internal\n */\nexport function getCenterYCoord({\n yMargin,\n elHeight,\n initialY,\n containerRect,\n}: YCoordConfig): Top {\n const containerCenter = containerRect.height / 2;\n const elementCenter = elHeight / 2;\n return (\n (initialY ?? containerRect.top + containerCenter + yMargin) - elementCenter\n );\n}\n\n/**\n * Creates the `top` style value for an element that should be fixed to the\n * bottom of the container element. So the top bounds of the fixed element\n * should overlap the bottom bounds of the container element (before the yMargin\n * is applied).\n *\n * @internal\n */\nexport function getBottomCoord({\n yMargin,\n initialY,\n elHeight,\n containerRect,\n}: YCoordConfig): Top {\n return (\n (initialY ?? containerRect.top + containerRect.height) - elHeight - yMargin\n );\n}\n\n/**\n * Creates the `top` style value for an element that should be fixed to the\n * bottom of the container element. So the bottom bounds of both the container\n * and fixed elements should overlap (before the yMargin is applied).\n *\n * @internal\n */\nexport function getBelowCoord({\n yMargin,\n initialY,\n containerRect,\n}: YCoordConfig): Top {\n return (initialY ?? containerRect.top + containerRect.height) + yMargin;\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport interface TransformOriginOptions extends PositionAnchor {\n transformOriginY?: number;\n}\n\n/**\n * This is a simple util that'll generate a css `transform-origin` string so\n * that the fixed element can animate from the correct point based on the\n * provided anchor.\n *\n * @param options - The anchor that should be used to create the transform origin\n * for.\n * @returns the transform origin string\n * @internal\n */\nexport function getTransformOrigin(options: TransformOriginOptions): string {\n const { transformOriginY: yPosition } = options;\n\n let x = \"0\";\n switch (options.x) {\n case \"right\":\n case \"inner-left\":\n x = \"0\";\n break;\n case \"center\":\n x = \"50%\";\n break;\n case \"left\":\n case \"inner-right\":\n x = \"100%\";\n break;\n default:\n x = \"0\";\n }\n\n let y = \"0\";\n if (typeof yPosition === \"number\") {\n y = `${yPosition}px`;\n } else {\n switch (options.y) {\n case \"above\":\n case \"bottom\":\n y = \"100%\";\n break;\n case \"center\":\n y = \"50%\";\n break;\n case \"below\":\n case \"top\":\n y = \"0\";\n break;\n default:\n y = \"0\";\n }\n }\n\n return `${x} ${y}`;\n}\n\n/**\n * Attempts to find a sizing container based on the provided HTMLElement. By\n * default, the sizing element will just be the provided element unless:\n * - the item has a known role within react-md that can target known classes\n * - the item has a `data-sizing-selector` attribute that is a valid query\n * selector for the nested item.\n *\n * NOTE: The `data-sizing-selector` will be run from the current element instead\n * of the `document`.\n *\n * @param el - The element to find a sizing container for.\n * @returns the sizing container relative to the provided element, or `null` if\n * none could be found.\n * @throws This error will be thrown if using the `data-query-selector` and the\n * query selector does not return an element on the page.\n * @internal\n */\nexport function findSizingContainer(\n el: HTMLElement | null\n): HTMLElement | null {\n if (!el) {\n return null;\n }\n\n if (/(tree|list)item/.test(el.getAttribute(\"role\") || \"\")) {\n const content = el.querySelector(\n \".rmd-tree-item__content, .rmd-item-text\"\n ) as HTMLElement;\n if (content) {\n return content;\n }\n } else if (el.getAttribute(\"type\") === \"file\") {\n const label = document.querySelector<HTMLLabelElement>(`[for=\"${el.id}\"]`);\n if (label) {\n return label;\n }\n }\n\n const data = el.getAttribute(\"data-sizing-selector\");\n if (data) {\n const content = el.querySelector(data) as HTMLElement;\n if (content) {\n return content;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n throw new Error(\n \"Unable to find a child element using the `data-sizing-selector`\"\n );\n }\n }\n\n return el;\n}\n\n/**\n * This util is used to get the \"true\" `element.getBoundingClientRect()` that\n * ensures that transitions using transforms don't mess up the sizing so that\n * position calculations are easier to do.\n *\n * @param element - The element to get a rect for.\n * @returns either a DOMRect for the element\n * @internal\n */\nexport function getElementRect(element: HTMLElement): DOMRect {\n const cloned = element.cloneNode(true) as HTMLElement;\n // remove the id so there won't be two elements with the same id on the page\n cloned.removeAttribute(\"id\");\n\n // remove the role just in case the role would alert screen readers once added\n // to the dom\n cloned.removeAttribute(\"role\");\n\n // ensure the cloned node won't shift the page or be visible\n cloned.style.position = \"fixed\";\n cloned.style.visibility = \"hidden\";\n\n // reset positioning to get a \"pure\" calculation. otherwise this will mess up\n // the height and width if the element is able to line wrap.\n cloned.style.left = \"\";\n cloned.style.top = \"\";\n cloned.style.right = \"\";\n cloned.style.bottom = \"\";\n\n // reset transforms so that custom animations don't mess with the sizing\n cloned.style.transform = \"none\";\n\n const parent = element.parentElement || document.body;\n parent.appendChild(cloned);\n\n const rect = cloned.getBoundingClientRect();\n parent.removeChild(cloned);\n\n return rect;\n}\n\n/**\n * @since 4.0.0\n * @internal\n */\ninterface IsWithinViewportOptions {\n fixedElement: HTMLElement;\n fixedToElement: HTMLElement;\n}\n\n/**\n * @since 4.0.0\n * @internal\n */\nexport function isWithinViewport(options: IsWithinViewportOptions): boolean {\n const { fixedElement, fixedToElement } = options;\n const fixedElementRect = fixedElement.getBoundingClientRect();\n const fixedToElementRect = fixedToElement.getBoundingClientRect();\n const vh = window.innerHeight;\n const vw = window.innerWidth;\n const top = Math.min(fixedElementRect.top, fixedToElementRect.top);\n const right = Math.max(fixedElementRect.right, fixedToElementRect.right);\n const bottom = Math.max(fixedElementRect.bottom, fixedToElementRect.bottom);\n const left = Math.min(fixedElementRect.left, fixedToElementRect.left);\n\n return bottom >= 0 && top <= vh && right >= 0 && left <= vw;\n}\n"],"names":["getLeftCoord","xMargin","elWidth","initialX","containerRect","left","getInnerLeftCoord","getCenterXCoord","containerCenter","width","elementCenter","getInnerRightCoord","getRightCoord","getAboveCoord","yMargin","initialY","elHeight","top","getTopCoord","getCenterYCoord","height","getBottomCoord","getBelowCoord","getTransformOrigin","options","transformOriginY","yPosition","x","y","findSizingContainer","el","test","getAttribute","content","querySelector","label","document","id","data","process","env","NODE_ENV","Error","getElementRect","element","cloned","cloneNode","removeAttribute","style","position","visibility","right","bottom","transform","parent","parentElement","body","appendChild","rect","getBoundingClientRect","removeChild","isWithinViewport","fixedElement","fixedToElement","fixedElementRect","fixedToElementRect","vh","window","innerHeight","vw","innerWidth","Math","min","max"],"mappings":"AAqBA;;;;;;;CAOC,GACD,OAAO,SAASA,aAAa,EAC3BC,OAAO,EACPC,OAAO,EACPC,QAAQ,EACRC,aAAa,EACA;IACb,OAAO,AAACD,CAAAA,YAAYC,cAAcC,IAAI,AAAD,IAAKH,UAAUD;AACtD;AAEA;;;;;;CAMC,GACD,OAAO,SAASK,kBAAkB,EAChCL,OAAO,EACPE,QAAQ,EACRC,aAAa,EACA;IACb,OAAO,AAACD,CAAAA,YAAYC,cAAcC,IAAI,AAAD,IAAKJ;AAC5C;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASM,gBAAgB,EAC9BL,OAAO,EACPC,QAAQ,EACRC,aAAa,EACA;IACb,MAAMI,kBAAkBJ,cAAcK,KAAK,GAAG;IAC9C,MAAMC,gBAAgBR,UAAU;IAChC,OAAO,AAACC,CAAAA,YAAYC,cAAcC,IAAI,GAAGG,eAAc,IAAKE;AAC9D;AAEA;;;;;;CAMC,GACD,OAAO,SAASC,mBAAmB,EACjCV,OAAO,EACPC,OAAO,EACPC,QAAQ,EACRC,aAAa,EACA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/C,OAAOkE,KAAKC,GAAG,CAACR,iBAAiB3D,IAAI,EAAE4D,mBAAmB5D,IAAI;IAEpE,OAAO+C,UAAU,KAAKnC,OAAOiD,MAAMf,SAAS,KAAK9C,QAAQgE;AAC3D"}
@@ -2,11 +2,11 @@ import { type CSSProperties, type HTMLAttributes } from "react";
2
2
  import { type LabelRequiredForA11y } from "../types.js";
3
3
  import { type ProgressProps } from "./types.js";
4
4
  /**
5
- * @since 6.0.0
6
- * Removed the `determinateRotateDegrees` prop since the determinate state no
5
+ * @since 6.0.0 Added the `disableShrink` prop.
6
+ * @since 6.0.0 Renamed `small` to `dense`.
7
+ * @since 6.0.0 Renamed `centered` to `disableCentered`.
8
+ * @since 6.0.0 Removed the `maxRotation` prop since the determinate state no
7
9
  * longer rotates while increasing value.
8
- * Added the `disableShrink` prop.
9
- * Renamed the `small` prop to `dense` to match other components.
10
10
  */
11
11
  export interface CircularProgressProps extends Omit<HTMLAttributes<HTMLSpanElement>, "id">, ProgressProps {
12
12
  /**
@@ -67,6 +67,7 @@ export interface CircularProgressProps extends Omit<HTMLAttributes<HTMLSpanEleme
67
67
  * margins.
68
68
  *
69
69
  * @defaultValue `false`
70
+ * @since 6.0.0 Renamed from `centered`
70
71
  */
71
72
  disableCentered?: boolean;
72
73
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/progress/CircularProgress.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n useMemo,\n type CSSProperties,\n type HTMLAttributes,\n} from \"react\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport { type LabelRequiredForA11y } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { bem } from \"../utils/bem.js\";\nimport { getPercentage } from \"../utils/getPercentage.js\";\nimport { type ProgressProps } from \"./types.js\";\n\n/**\n * @since 6.0.0\n * Removed the `determinateRotateDegrees` prop since the determinate state no\n * longer rotates while increasing value.\n * Added the `disableShrink` prop.\n * Renamed the `small` prop to `dense` to match other components.\n */\nexport interface CircularProgressProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, \"id\">,\n ProgressProps {\n /**\n * An optional style to apply to the svg within the circular progress. The\n * values of this style object will be merged with the current determinate\n * style (if it exists).\n */\n svgStyle?: CSSProperties;\n\n /**\n * An optional className to apply to the svg within the circular progress.\n */\n svgClassName?: string;\n\n /**\n * An optional style to apply to the circle within the circular progress. The\n * values of this style object will be merged with the current determinate\n * style (if it exists).\n */\n circleStyle?: CSSProperties;\n\n /**\n * An optional className to apply to the circle within the circular progress.\n */\n circleClassName?: string;\n\n /**\n * The radius for the circle. It is generally recommended to have the radius\n * be 1/2 of the viewbox and minus a few more pixels so that there is some\n * surrounding padding. You probably shouldn't really be changing this prop\n * though.\n *\n * @defaultValue `30`\n */\n radius?: number;\n\n /**\n * The center point for the circle. This should be half of the `viewBox` prop\n * 99% of the time and probably won't be changed.\n *\n * @defaultValue `33`\n */\n center?: number;\n\n /**\n * The viewbox for the child svg. I wouldn't recommend changing this value as\n * you will also need to update the `dashoffset` in both Sass and this prop to\n * get the animation to look nice again.\n *\n * @defaultValue `0 0 66 66`\n */\n viewBox?: string;\n\n /**\n * The `stroke-dashoffset` for the circle within the SVG. You probably won't\n * be changing this value that much as it should match the\n * `$rmd-progress-circle-dashoffset` Sass variable. This is really just used\n * to help to create the determinate progress animation.\n *\n * @defaultValue `187`\n */\n dashoffset?: number;\n\n /**\n * Boolean if the circular progress should be centered using left and right\n * margins.\n *\n * @defaultValue `false`\n */\n disableCentered?: boolean;\n\n /**\n * Set to `true` to render as a smaller size.\n *\n * @defaultValue `false`\n * @since 2.3.0\n * @since 6.0.0 Renamed from `small`\n */\n dense?: boolean;\n\n /**\n * Set this to `true` to update the indeterminate behavior to only rotate\n * which will increase performance during CPU-intensive tasks or when many\n * loading spinners are displayed at once on the page.\n *\n * @defaultValue `false`\n * @since 6.0.0\n */\n disableShrink?: boolean;\n}\n\nconst styles = bem(\"rmd-circular-progress\");\n\n/**\n * **Server Component**\n *\n * @example Indeterminate Example\n * ```tsx\n * import { CircularProgress } from \"@react-md/core\":\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return <CircularProgress aria-label=\"Loading\" />;\n * }\n * ```\n *\n * @example Determinate Example\n * ```tsx\n * import { CircularProgress } from \"@react-md/core\":\n * import { useState, type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * // a number from 0 - 100\n * const [progress, setProgress] = useState(0);\n *\n * return <CircularProgress aria-label=\"File upload\" value={progress} />;\n * }\n * ```\n *\n * @since 6.0.0 Updated the determinate circular progress to no longer\n * rotate while increasing the value and require a label for accessibility.\n */\nexport const CircularProgress = forwardRef<\n HTMLSpanElement,\n LabelRequiredForA11y<CircularProgressProps>\n>(function CircularProgress(props, ref) {\n const {\n id: propId,\n className,\n svgStyle,\n svgClassName,\n circleStyle: propCircleStyle,\n circleClassName,\n value,\n min = 0,\n max = 100,\n radius = 30,\n center = 33,\n viewBox = \"0 0 66 66\",\n theme = \"primary\",\n dense = false,\n dashoffset = 187,\n disableShrink = false,\n disableCentered = false,\n disableTransition = false,\n ...remaining\n } = props;\n\n const id = useEnsuredId(propId, \"circular-progress\");\n let progress: number | undefined;\n if (typeof value === \"number\") {\n progress = getPercentage({ min, max, value, validate: true });\n }\n\n const circleStyle = useMemo(() => {\n if (typeof progress !== \"number\") {\n return propCircleStyle;\n }\n\n return {\n ...propCircleStyle,\n strokeDashoffset: dashoffset - dashoffset * progress,\n };\n }, [progress, propCircleStyle, dashoffset]);\n\n const determinate = typeof progress === \"number\";\n const indeterminate = !determinate;\n return (\n <span\n {...remaining}\n id={id}\n ref={ref}\n role=\"progressbar\"\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuenow={value}\n className={cnb(\n styles({ dense, centered: !disableCentered }),\n theme !== \"current-color\" && cssUtils({ textColor: theme }),\n className\n )}\n >\n <svg\n style={svgStyle}\n className={cnb(\n styles(\"svg\", {\n determinate,\n indeterminate: indeterminate && !disableShrink,\n \"rotate-only\": indeterminate && disableShrink,\n }),\n svgClassName\n )}\n viewBox={viewBox}\n >\n <circle\n style={circleStyle}\n className={cnb(\n styles(\"circle\", {\n animate: !disableTransition && determinate,\n determinate,\n indeterminate: indeterminate && !disableShrink,\n \"rotate-only\": indeterminate && disableShrink,\n }),\n circleClassName\n )}\n r={radius}\n cx={center}\n cy={center}\n />\n </svg>\n </span>\n );\n});\n"],"names":["cnb","forwardRef","useMemo","cssUtils","useEnsuredId","bem","getPercentage","styles","CircularProgress","props","ref","id","propId","className","svgStyle","svgClassName","circleStyle","propCircleStyle","circleClassName","value","min","max","radius","center","viewBox","theme","dense","dashoffset","disableShrink","disableCentered","disableTransition","remaining","progress","validate","strokeDashoffset","determinate","indeterminate","span","role","aria-valuemin","aria-valuemax","aria-valuenow","centered","textColor","svg","style","circle","animate","r","cx","cy"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,EACVC,OAAO,QAGF,QAAQ;AACf,SAASC,QAAQ,QAAQ,iBAAiB;AAE1C,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,GAAG,QAAQ,kBAAkB;AACtC,SAASC,aAAa,QAAQ,4BAA4B;AAsG1D,MAAMC,SAASF,IAAI;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BC,GACD,OAAO,MAAMG,iCAAmBP,WAG9B,SAASO,iBAAiBC,KAAK,EAAEC,GAAG;IACpC,MAAM,EACJC,IAAIC,MAAM,EACVC,SAAS,EACTC,QAAQ,EACRC,YAAY,EACZC,aAAaC,eAAe,EAC5BC,eAAe,EACfC,KAAK,EACLC,MAAM,CAAC,EACPC,MAAM,GAAG,EACTC,SAAS,EAAE,EACXC,SAAS,EAAE,EACXC,UAAU,WAAW,EACrBC,QA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.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n useMemo,\n type CSSProperties,\n type HTMLAttributes,\n} from \"react\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport { type LabelRequiredForA11y } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { bem } from \"../utils/bem.js\";\nimport { getPercentage } from \"../utils/getPercentage.js\";\nimport { type ProgressProps } from \"./types.js\";\n\n/**\n * @since 6.0.0 Added the `disableShrink` prop.\n * @since 6.0.0 Renamed `small` to `dense`.\n * @since 6.0.0 Renamed `centered` to `disableCentered`.\n * @since 6.0.0 Removed the `maxRotation` prop since the determinate state no\n * longer rotates while increasing value.\n */\nexport interface CircularProgressProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, \"id\">,\n ProgressProps {\n /**\n * An optional style to apply to the svg within the circular progress. The\n * values of this style object will be merged with the current determinate\n * style (if it exists).\n */\n svgStyle?: CSSProperties;\n\n /**\n * An optional className to apply to the svg within the circular progress.\n */\n svgClassName?: string;\n\n /**\n * An optional style to apply to the circle within the circular progress. The\n * values of this style object will be merged with the current determinate\n * style (if it exists).\n */\n circleStyle?: CSSProperties;\n\n /**\n * An optional className to apply to the circle within the circular progress.\n */\n circleClassName?: string;\n\n /**\n * The radius for the circle. It is generally recommended to have the radius\n * be 1/2 of the viewbox and minus a few more pixels so that there is some\n * surrounding padding. You probably shouldn't really be changing this prop\n * though.\n *\n * @defaultValue `30`\n */\n radius?: number;\n\n /**\n * The center point for the circle. This should be half of the `viewBox` prop\n * 99% of the time and probably won't be changed.\n *\n * @defaultValue `33`\n */\n center?: number;\n\n /**\n * The viewbox for the child svg. I wouldn't recommend changing this value as\n * you will also need to update the `dashoffset` in both Sass and this prop to\n * get the animation to look nice again.\n *\n * @defaultValue `0 0 66 66`\n */\n viewBox?: string;\n\n /**\n * The `stroke-dashoffset` for the circle within the SVG. You probably won't\n * be changing this value that much as it should match the\n * `$rmd-progress-circle-dashoffset` Sass variable. This is really just used\n * to help to create the determinate progress animation.\n *\n * @defaultValue `187`\n */\n dashoffset?: number;\n\n /**\n * Boolean if the circular progress should be centered using left and right\n * margins.\n *\n * @defaultValue `false`\n * @since 6.0.0 Renamed from `centered`\n */\n disableCentered?: boolean;\n\n /**\n * Set to `true` to render as a smaller size.\n *\n * @defaultValue `false`\n * @since 2.3.0\n * @since 6.0.0 Renamed from `small`\n */\n dense?: boolean;\n\n /**\n * Set this to `true` to update the indeterminate behavior to only rotate\n * which will increase performance during CPU-intensive tasks or when many\n * loading spinners are displayed at once on the page.\n *\n * @defaultValue `false`\n * @since 6.0.0\n */\n disableShrink?: boolean;\n}\n\nconst styles = bem(\"rmd-circular-progress\");\n\n/**\n * **Server Component**\n *\n * @example Indeterminate Example\n * ```tsx\n * import { CircularProgress } from \"@react-md/core\":\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return <CircularProgress aria-label=\"Loading\" />;\n * }\n * ```\n *\n * @example Determinate Example\n * ```tsx\n * import { CircularProgress } from \"@react-md/core\":\n * import { useState, type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * // a number from 0 - 100\n * const [progress, setProgress] = useState(0);\n *\n * return <CircularProgress aria-label=\"File upload\" value={progress} />;\n * }\n * ```\n *\n * @since 6.0.0 Updated the determinate circular progress to no longer\n * rotate while increasing the value and require a label for accessibility.\n */\nexport const CircularProgress = forwardRef<\n HTMLSpanElement,\n LabelRequiredForA11y<CircularProgressProps>\n>(function CircularProgress(props, ref) {\n const {\n id: propId,\n className,\n svgStyle,\n svgClassName,\n circleStyle: propCircleStyle,\n circleClassName,\n value,\n min = 0,\n max = 100,\n radius = 30,\n center = 33,\n viewBox = \"0 0 66 66\",\n theme = \"primary\",\n dense = false,\n dashoffset = 187,\n disableShrink = false,\n disableCentered = false,\n disableTransition = false,\n ...remaining\n } = props;\n\n const id = useEnsuredId(propId, \"circular-progress\");\n let progress: number | undefined;\n if (typeof value === \"number\") {\n progress = getPercentage({ min, max, value, validate: true });\n }\n\n const circleStyle = useMemo(() => {\n if (typeof progress !== \"number\") {\n return propCircleStyle;\n }\n\n return {\n ...propCircleStyle,\n strokeDashoffset: dashoffset - dashoffset * progress,\n };\n }, [progress, propCircleStyle, dashoffset]);\n\n const determinate = typeof progress === \"number\";\n const indeterminate = !determinate;\n return (\n <span\n {...remaining}\n id={id}\n ref={ref}\n role=\"progressbar\"\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuenow={value}\n className={cnb(\n styles({ dense, centered: !disableCentered }),\n theme !== \"current-color\" && cssUtils({ textColor: theme }),\n className\n )}\n >\n <svg\n style={svgStyle}\n className={cnb(\n styles(\"svg\", {\n determinate,\n indeterminate: indeterminate && !disableShrink,\n \"rotate-only\": indeterminate && disableShrink,\n }),\n svgClassName\n )}\n viewBox={viewBox}\n >\n <circle\n style={circleStyle}\n className={cnb(\n styles(\"circle\", {\n animate: !disableTransition && determinate,\n determinate,\n indeterminate: indeterminate && !disableShrink,\n \"rotate-only\": indeterminate && disableShrink,\n }),\n circleClassName\n )}\n r={radius}\n cx={center}\n cy={center}\n />\n </svg>\n </span>\n );\n});\n"],"names":["cnb","forwardRef","useMemo","cssUtils","useEnsuredId","bem","getPercentage","styles","CircularProgress","props","ref","id","propId","className","svgStyle","svgClassName","circleStyle","propCircleStyle","circleClassName","value","min","max","radius","center","viewBox","theme","dense","dashoffset","disableShrink","disableCentered","disableTransition","remaining","progress","validate","strokeDashoffset","determinate","indeterminate","span","role","aria-valuemin","aria-valuemax","aria-valuenow","centered","textColor","svg","style","circle","animate","r","cx","cy"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,EACVC,OAAO,QAGF,QAAQ;AACf,SAASC,QAAQ,QAAQ,iBAAiB;AAE1C,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,GAAG,QAAQ,kBAAkB;AACtC,SAASC,aAAa,QAAQ,4BAA4B;AAuG1D,MAAMC,SAASF,IAAI;AAEnB;;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AAeQ,iBAAiBR;YAClC,IACAb;YAEFS,SAASA;sBAET,cAAA,KAACsB;gBACCD,OAAO7B;gBACPH,WAAWb,IACTO,OAAO,UAAU;oBACfwC,SAAS,CAACjB,qBAAqBK;oBAC/BA;oBACAC,eAAeA,iBAAiB,CAACR;oBACjC,eAAeQ,iBAAiBR;gBAClC,IACAV;gBAEF8B,GAAG1B;gBACH2B,IAAI1B;gBACJ2B,IAAI3B;;;;AAKd,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/progress/LinearProgress.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n useMemo,\n type CSSProperties,\n type HTMLAttributes,\n} from \"react\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport { type LabelRequiredForA11y } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { bem } from \"../utils/bem.js\";\nimport { getPercentage } from \"../utils/getPercentage.js\";\nimport { type ProgressProps } from \"./types.js\";\n\n/**\n * @since 6.0.0 Added the `theme` prop\n */\nexport interface LinearProgressProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, \"id\" | \"children\">,\n ProgressProps {\n /**\n * An optional style to apply to the progress bar. This will be merged with\n * the current width or height tracking the progress when a `value` is also\n * provided.\n */\n barStyle?: CSSProperties;\n\n /**\n * An optional className to apply to the progress bar.\n */\n barClassName?: string;\n\n /**\n * Boolean if the progress should be reversed. This will change the progress\n * direction from `left-to-right` to be `right-to-left`. If the current\n * language is a rtl language and this prop is enabled, the direction will\n * still be `left-to-right`.\n *\n * @defaultValue `false`\n */\n reverse?: boolean;\n\n /**\n * Boolean if the progress should be vertical instead of horizontal. When\n * this prop is set, you should also set the `verticalHeight` prop to a height\n * value you want for your progress bar.\n *\n * @defaultValue `false`\n */\n vertical?: boolean;\n\n /**\n * Since there isn't really a good way to have \"auto height\", you'll need to\n * manually set the progress bar's height with this prop to some pixel value.\n * If you'd prefer to set the height in Sass/css, set this value to `null`\n * instead since this value would be passed down as a `height` inline style.\n *\n * @defaultValue `240`\n */\n verticalHeight?: number | null;\n}\n\nconst styles = bem(\"rmd-linear-progress\");\n\n/**\n * **Server Component**\n *\n * @example Indeterminate Example\n * ```tsx\n * import { LinearProgress } from \"@react-md/core\";\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return <LinearProgress aria-label=\"Loading\" />;\n * }\n * ```\n *\n * @example Determinate Example\n * ```tsx\n * import { LinearProgress } from \"@react-md/core\";\n * import { useState, type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * // a number from 0 - 100\n * const [progress, setProgress] = useState(0);\n *\n * return <LinearProgress aria-label=\"File upload\" value={progress} />;\n * }\n * ```\n *\n * @since 6.0.0 Supports rendering as any of the theme colors and\n * requires a label for accessibility.\n */\nexport const LinearProgress = forwardRef<\n HTMLSpanElement,\n LabelRequiredForA11y<LinearProgressProps>\n>(function LinearProgress(props, ref) {\n const {\n id: propId,\n style: propStyle,\n className,\n barStyle: propBarStyle,\n barClassName,\n min = 0,\n max = 100,\n value,\n reverse = false,\n theme = \"primary\",\n disableTransition = false,\n vertical = false,\n verticalHeight = 240,\n ...remaining\n } = props;\n\n const id = useEnsuredId(propId, \"linear-progress\");\n const style = useMemo(() => {\n if (!vertical || verticalHeight === null) {\n return propStyle;\n }\n\n return {\n ...propStyle,\n height: verticalHeight,\n };\n }, [propStyle, vertical, verticalHeight]);\n\n let progress: number | undefined;\n if (typeof value === \"number\") {\n progress = getPercentage({ min, max, value, validate: true });\n }\n const barStyle = useMemo(() => {\n if (typeof progress !== \"number\") {\n return propBarStyle;\n }\n\n const key = vertical ? \"height\" : \"width\";\n return {\n ...propBarStyle,\n [key]: `${progress * 100}%`,\n };\n }, [progress, propBarStyle, vertical]);\n\n const determinate = typeof progress === \"number\";\n const indeterminate = !determinate;\n return (\n <span\n {...remaining}\n id={id}\n ref={ref}\n style={style}\n role=\"progressbar\"\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuenow={value}\n className={cnb(\n styles({\n vertical,\n horizontal: !vertical,\n determinate,\n indeterminate,\n }),\n theme !== \"current-color\" && cssUtils({ textColor: theme }),\n className\n )}\n >\n <span\n style={barStyle}\n className={cnb(\n styles(\"bar\", {\n vertical,\n \"vertical-reverse\": vertical && reverse,\n horizontal: !vertical,\n \"horizontal-reverse\": !vertical && reverse,\n animate: !disableTransition && determinate,\n determinate,\n indeterminate,\n \"determinate-reverse\": determinate && reverse && !vertical,\n \"determinate-vertical-reverse\": determinate && reverse && vertical,\n \"indeterminate-reverse\": indeterminate && reverse && !vertical,\n \"indeterminate-vertical\": indeterminate && vertical,\n \"indeterminate-vertical-reverse\":\n indeterminate && reverse && vertical,\n }),\n barClassName\n )}\n />\n </span>\n );\n});\n"],"names":["cnb","forwardRef","useMemo","cssUtils","useEnsuredId","bem","getPercentage","styles","LinearProgress","props","ref","id","propId","style","propStyle","className","barStyle","propBarStyle","barClassName","min","max","value","reverse","theme","disableTransition","vertical","verticalHeight","remaining","height","progress","validate","key","determinate","indeterminate","span","role","aria-valuemin","aria-valuemax","aria-valuenow","horizontal","textColor","animate"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,EACVC,OAAO,QAGF,QAAQ;AACf,SAASC,QAAQ,QAAQ,iBAAiB;AAE1C,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,GAAG,QAAQ,kBAAkB;AACtC,SAASC,aAAa,QAAQ,4BAA4B;AAmD1D,MAAMC,SAASF,IAAI;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BC,GACD,OAAO,MAAMG,+BAAiBP,WAG5B,SAASO,eAAeC,KAAK,EAAEC,GAAG;IAClC,MAAM,EACJC,IAAIC,MAAM,EACVC,OA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CiB,YAAY,CAACd;gBACb,sBAAsB,CAACA,YAAYH;gBACnCmB,SAAS,CAACjB,qBAAqBQ;gBAC/BA;gBACAC;gBACA,uBAAuBD,eAAeV,WAAW,CAACG;gBAClD,gCAAgCO,eAAeV,WAAWG;gBAC1D,yBAAyBQ,iBAAiBX,WAAW,CAACG;gBACtD,0BAA0BQ,iBAAiBR;gBAC3C,kCACEQ,iBAAiBX,WAAWG;YAChC,IACAP;;;AAKV,GAAG"}
1
+ {"version":3,"sources":["../../src/progress/LinearProgress.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n useMemo,\n type CSSProperties,\n type HTMLAttributes,\n} from \"react\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport { type LabelRequiredForA11y } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { bem } from \"../utils/bem.js\";\nimport { getPercentage } from \"../utils/getPercentage.js\";\nimport { type ProgressProps } from \"./types.js\";\n\n/**\n * @since 6.0.0 Added the `theme` prop\n */\nexport interface LinearProgressProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, \"id\" | \"children\">,\n ProgressProps {\n /**\n * An optional style to apply to the progress bar. This will be merged with\n * the current width or height tracking the progress when a `value` is also\n * provided.\n */\n barStyle?: CSSProperties;\n\n /**\n * An optional className to apply to the progress bar.\n */\n barClassName?: string;\n\n /**\n * Boolean if the progress should be reversed. This will change the progress\n * direction from `left-to-right` to be `right-to-left`. If the current\n * language is a rtl language and this prop is enabled, the direction will\n * still be `left-to-right`.\n *\n * @defaultValue `false`\n */\n reverse?: boolean;\n\n /**\n * Boolean if the progress should be vertical instead of horizontal. When\n * this prop is set, you should also set the `verticalHeight` prop to a height\n * value you want for your progress bar.\n *\n * @defaultValue `false`\n */\n vertical?: boolean;\n\n /**\n * Since there isn't really a good way to have \"auto height\", you'll need to\n * manually set the progress bar's height with this prop to some pixel value.\n * If you'd prefer to set the height in Sass/css, set this value to `null`\n * instead since this value would be passed down as a `height` inline style.\n *\n * @defaultValue `240`\n */\n verticalHeight?: number | null;\n}\n\nconst styles = bem(\"rmd-linear-progress\");\n\n/**\n * **Server Component**\n *\n * @example Indeterminate Example\n * ```tsx\n * import { LinearProgress } from \"@react-md/core\";\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return <LinearProgress aria-label=\"Loading\" />;\n * }\n * ```\n *\n * @example Determinate Example\n * ```tsx\n * import { LinearProgress } from \"@react-md/core\";\n * import { useState, type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * // a number from 0 - 100\n * const [progress, setProgress] = useState(0);\n *\n * return <LinearProgress aria-label=\"File upload\" value={progress} />;\n * }\n * ```\n *\n * @since 6.0.0 Supports rendering as any of the theme colors and\n * requires a label for accessibility.\n */\nexport const LinearProgress = forwardRef<\n HTMLSpanElement,\n LabelRequiredForA11y<LinearProgressProps>\n>(function LinearProgress(props, ref) {\n const {\n id: propId,\n style: propStyle,\n className,\n barStyle: propBarStyle,\n barClassName,\n min = 0,\n max = 100,\n value,\n reverse = false,\n theme = \"primary\",\n disableTransition = false,\n vertical = false,\n verticalHeight = 240,\n ...remaining\n } = props;\n\n const id = useEnsuredId(propId, \"linear-progress\");\n const style = useMemo(() => {\n if (!vertical || verticalHeight === null) {\n return propStyle;\n }\n\n return {\n ...propStyle,\n height: verticalHeight,\n };\n }, [propStyle, vertical, verticalHeight]);\n\n let progress: number | undefined;\n if (typeof value === \"number\") {\n progress = getPercentage({ min, max, value, validate: true });\n }\n const barStyle = useMemo(() => {\n if (typeof progress !== \"number\") {\n return propBarStyle;\n }\n\n const key = vertical ? \"height\" : \"width\";\n return {\n ...propBarStyle,\n [key]: `${progress * 100}%`,\n };\n }, [progress, propBarStyle, vertical]);\n\n const determinate = typeof progress === \"number\";\n const indeterminate = !determinate;\n return (\n <span\n {...remaining}\n id={id}\n ref={ref}\n style={style}\n role=\"progressbar\"\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuenow={value}\n className={cnb(\n styles({\n vertical,\n horizontal: !vertical,\n determinate,\n indeterminate,\n }),\n theme !== \"current-color\" && cssUtils({ textColor: theme }),\n className\n )}\n >\n <span\n style={barStyle}\n className={cnb(\n styles(\"bar\", {\n vertical,\n \"vertical-reverse\": vertical && reverse,\n horizontal: !vertical,\n \"horizontal-reverse\": !vertical && reverse,\n animate: !disableTransition && determinate,\n determinate,\n indeterminate,\n \"determinate-reverse\": determinate && reverse && !vertical,\n \"determinate-vertical-reverse\": determinate && reverse && vertical,\n \"indeterminate-reverse\": indeterminate && reverse && !vertical,\n \"indeterminate-vertical\": indeterminate && vertical,\n \"indeterminate-vertical-reverse\":\n indeterminate && reverse && vertical,\n }),\n barClassName\n )}\n />\n </span>\n );\n});\n"],"names":["cnb","forwardRef","useMemo","cssUtils","useEnsuredId","bem","getPercentage","styles","LinearProgress","props","ref","id","propId","style","propStyle","className","barStyle","propBarStyle","barClassName","min","max","value","reverse","theme","disableTransition","vertical","verticalHeight","remaining","height","progress","validate","key","determinate","indeterminate","span","role","aria-valuemin","aria-valuemax","aria-valuenow","horizontal","textColor","animate"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,EACVC,OAAO,QAGF,QAAQ;AACf,SAASC,QAAQ,QAAQ,iBAAiB;AAE1C,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,GAAG,QAAQ,kBAAkB;AACtC,SAASC,aAAa,QAAQ,4BAA4B;AAmD1D,MAAMC,SAASF,IAAI;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BC,GACD,OAAO,MAAMG,+BAAiBP,WAG5B,SAASO,eAAeC,KAAK,EAAEC,GAAG;IAClC,MAAM,EACJC,IAAIC,MAAM,EACVC,OAAOC,SAAS,EAChBC,SAAS,EACTC,UAAUC,YAAY,EACtBC,YAAY,EACZC,MAAM,CAAC,EACPC,MAAM,GAAG,EACTC,KAAK,EACLC,UAAU,KAAK,EACfC,QAAQ,SAAS,EACjBC,oBAA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WAAWG;gBAC1D,yBAAyBQ,iBAAiBX,WAAW,CAACG;gBACtD,0BAA0BQ,iBAAiBR;gBAC3C,kCACEQ,iBAAiBX,WAAWG;YAChC,IACAP;;;AAKV,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/progress/getProgressA11y.ts"],"sourcesContent":["export interface ProgressA11y {\n \"aria-busy\": true;\n \"aria-describedby\": string;\n}\n\n/**\n * An extremely simple util that can be used to get the required a11y props for\n * another component that relies on a progress component.\n *\n * @param progressId - The id for the progress bar\n * @param progressing - Boolean if the progress bar is visible and progressing\n */\nexport function getProgressA11y(\n progressId: string,\n progressing: boolean\n): ProgressA11y | undefined {\n if (!progressing) {\n return undefined;\n }\n\n return {\n \"aria-busy\": true,\n \"aria-describedby\": progressId,\n };\n}\n"],"names":["getProgressA11y","progressId","progressing","undefined"],"rangeMappings":";;;;;;;;;;;;;;","mappings":"AAKA;;;;;;CAMC,GACD,OAAO,SAASA,gBACdC,UAAkB,EAClBC,WAAoB;IAEpB,IAAI,CAACA,aAAa;QAChB,OAAOC;IACT;IAEA,OAAO;QACL,aAAa;QACb,oBAAoBF;IACtB;AACF"}
1
+ {"version":3,"sources":["../../src/progress/getProgressA11y.ts"],"sourcesContent":["export interface ProgressA11y {\n \"aria-busy\": true;\n \"aria-describedby\": string;\n}\n\n/**\n * An extremely simple util that can be used to get the required a11y props for\n * another component that relies on a progress component.\n *\n * @param progressId - The id for the progress bar\n * @param progressing - Boolean if the progress bar is visible and progressing\n */\nexport function getProgressA11y(\n progressId: string,\n progressing: boolean\n): ProgressA11y | undefined {\n if (!progressing) {\n return undefined;\n }\n\n return {\n \"aria-busy\": true,\n \"aria-describedby\": progressId,\n };\n}\n"],"names":["getProgressA11y","progressId","progressing","undefined"],"mappings":"AAKA;;;;;;CAMC,GACD,OAAO,SAASA,gBACdC,UAAkB,EAClBC,WAAoB;IAEpB,IAAI,CAACA,aAAa;QAChB,OAAOC;IACT;IAEA,OAAO;QACL,aAAa;QACb,oBAAoBF;IACtB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/progress/types.ts"],"sourcesContent":["import { type ThemeColor } from \"../cssUtils.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-progress-background-color\"?: string;\n \"--rmd-progress-color\"?: string;\n \"--rmd-progress-circular-size\"?: string | number;\n \"--rmd-progress-circular-stroke-width\"?: number;\n \"--rmd-progress-linear-size\"?: string | number;\n }\n}\n\n/**\n * @since 6.0.0\n */\nexport type ProgressTheme = ThemeColor | \"current-color\";\n\n/**\n * The base progress props for both the linear and circular progress components.\n *\n * @since 6.0.0 Added the `theme` prop.\n */\nexport interface ProgressProps {\n /**\n * The id for the progress component. This is required for accessibility since\n * the progress will 99% of the time be describing the progress of something\n * else within the page. The element that is loading or tracking progress\n * should also be updated to have `aria-busy=\"true\"` and\n * `aria-describedby=\"THIS_ID\"`.\n *\n * @defaultValue `\"circular-progress-\" useId() || \"linear-progress-\" + useId()`\n * @since 6.0.0 This prop is now optional.\n */\n id?: string;\n\n /**\n * The min value for the progress component. This is used to determine the\n * current progress percentage for screen readers and styles.\n *\n * @defaultValue `0`\n */\n min?: number;\n\n /**\n * The max value for the progress component. This is used to determine the\n * current progress percentage for screen readers and styles.\n *\n * @defaultValue `100`\n */\n max?: number;\n\n /**\n * The current value for the progress component. If this prop is omitted, the\n * progress component will be put in an \"indeterminate\" state which will just\n * infinitely loop an animation until it is unmounted.\n *\n * This value will be passed down as a percentage based on the `min` and `max`\n * props so that screen readers can be notified of changes.\n */\n value?: number;\n\n /**\n * Boolean if the determinate progress versions should animate when the value\n * changes. This should really only be enabled if you aren't getting quick\n * progress updates or the updates happen in chunks.\n *\n * @defaultValue `false`\n * @since 6.0.0 This was renamed from `animate` to\n * `disableTransition`.\n */\n disableTransition?: boolean;\n\n /**\n * @defaultValue `\"primary\"`\n * @since 6.0.0\n */\n theme?: ProgressTheme;\n}\n"],"names":[],"rangeMappings":";;;;","mappings":"AAiBA;;;;CAIC,GACD,WAuDC"}
1
+ {"version":3,"sources":["../../src/progress/types.ts"],"sourcesContent":["import { type ThemeColor } from \"../cssUtils.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-progress-background-color\"?: string;\n \"--rmd-progress-color\"?: string;\n \"--rmd-progress-circular-size\"?: string | number;\n \"--rmd-progress-circular-stroke-width\"?: number;\n \"--rmd-progress-linear-size\"?: string | number;\n }\n}\n\n/**\n * @since 6.0.0\n */\nexport type ProgressTheme = ThemeColor | \"current-color\";\n\n/**\n * The base progress props for both the linear and circular progress components.\n *\n * @since 6.0.0 Added the `theme` prop.\n */\nexport interface ProgressProps {\n /**\n * The id for the progress component. This is required for accessibility since\n * the progress will 99% of the time be describing the progress of something\n * else within the page. The element that is loading or tracking progress\n * should also be updated to have `aria-busy=\"true\"` and\n * `aria-describedby=\"THIS_ID\"`.\n *\n * @defaultValue `\"circular-progress-\" useId() || \"linear-progress-\" + useId()`\n * @since 6.0.0 This prop is now optional.\n */\n id?: string;\n\n /**\n * The min value for the progress component. This is used to determine the\n * current progress percentage for screen readers and styles.\n *\n * @defaultValue `0`\n */\n min?: number;\n\n /**\n * The max value for the progress component. This is used to determine the\n * current progress percentage for screen readers and styles.\n *\n * @defaultValue `100`\n */\n max?: number;\n\n /**\n * The current value for the progress component. If this prop is omitted, the\n * progress component will be put in an \"indeterminate\" state which will just\n * infinitely loop an animation until it is unmounted.\n *\n * This value will be passed down as a percentage based on the `min` and `max`\n * props so that screen readers can be notified of changes.\n */\n value?: number;\n\n /**\n * Boolean if the determinate progress versions should animate when the value\n * changes. This should really only be enabled if you aren't getting quick\n * progress updates or the updates happen in chunks.\n *\n * @defaultValue `false`\n * @since 6.0.0 This was renamed from `animate` to\n * `disableTransition`.\n */\n disableTransition?: boolean;\n\n /**\n * @defaultValue `\"primary\"`\n * @since 6.0.0\n */\n theme?: ProgressTheme;\n}\n"],"names":[],"mappings":"AAiBA;;;;CAIC,GACD,WAuDC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/responsive-item/ResponsiveItemContainer.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-responsive-item-container\");\n\n/** @since 6.0.0 */\nexport interface ResponsiveItemContainerClassNameOptions {\n className?: string;\n\n /**\n * Set this to `true` if the container should gain the following styles:\n *\n * ```scss\n * display: block;\n * width: 100%;\n * ```\n *\n * @defaultValue `false`\n */\n fullWidth?: boolean;\n\n /**\n * Set this to a custom aspect ratio to use.\n *\n * @example Valid Aspect Ratios\n * ```tsx\n * aspectRatio=\"16-9\"\n * aspectRatio=\"9-16\"\n * aspectRatio=\"3-4\"\n * aspectRatio=\"4-3\"\n * aspectRatio=\"1-1\"\n * ```\n *\n * These values are based on the `core.$responsive-item-aspect-ratios` map.\n *\n * @defaultValue `\"\"`\n */\n aspectRatio?: `${number}-${number}`;\n\n /**\n * Set this to `\"manual\"` if you want to manually specify which elements are\n * responsive items using custom class names. You probably don't really want\n * to use this.\n *\n * Set this to `\"auto\"` to automatically update all visual media that appear\n * as a child in this component to a responsive item.\n *\n * Set this to `\"container\"` to automatically update all visual media that\n * appear as a child in this component to be a responsive item that scales to\n * the container's dimensions.\n *\n * Note: The `\"auto\"` and `\"container\"` values use the\n * `core.$responsive-item-selectors` value for their behavior.\n *\n * @defaultValue `\"auto\"`\n */\n responsive?: \"auto\" | \"manual\" | \"container\";\n}\n\n/** @since 6.0.0 */\nexport function responsiveItemContainer(\n options: ResponsiveItemContainerClassNameOptions = {}\n): string {\n const {\n className,\n fullWidth = false,\n aspectRatio = \"\",\n responsive = \"auto\",\n } = options;\n\n return cnb(\n styles({\n auto: responsive !== \"manual\",\n \"auto-scale\": responsive === \"container\",\n \"aspect-ratio\": aspectRatio,\n [aspectRatio]: aspectRatio,\n \"full-width\": fullWidth,\n }),\n className\n );\n}\n\n/**\n * @since 6.0.0 Renamed from `MediaContainerProps` to\n * `ResponsiveItemContainerProps`\n * @since 6.0.0 The `height` and `width` props were removed in favor of the\n * `aspectRatio` props since the latest typescript string interpolation supports\n * enforcing the correct format.\n * @since 6.0.0 The `auto` prop was removed in favor of the new\n * {@link ResponsiveItemContainerProps.responsive} prop.\n */\nexport interface ResponsiveItemContainerProps\n extends HTMLAttributes<HTMLSpanElement>,\n ResponsiveItemContainerClassNameOptions {}\n\n/**\n * **Server Component**\n *\n * @example Image Example\n * ```tsx\n * import { ResponsiveItemContainer } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <ResponsiveItemContainer>\n * <img alt=\"\" src=\"/some-image.png\" />\n * </ResponsiveItemContainer>\n * );\n * }\n * ```\n *\n * @example Iframe Example\n * ```tsx\n * import { ResponsiveItemContainer } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <ResponsiveItemContainer>\n * <iframe\n * src=\"https://youtube.com/some-video-url\"\n * title=\"Some YouTube video\"\n * allowFullScreen\n * />\n * </ResponsiveItemContainer>\n * );\n * }\n * ```\n *\n * @example Forced Aspect Ratio\n * ```tsx\n * import { ResponsiveItemContainer } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <ResponsiveItemContainer aspectRatio=\"16-9\">\n * <img alt=\"\" src=\"/some-image.png\" />\n * </ResponsiveItemContainer>\n * );\n * }\n * ```\n *\n * @since 6.0.0 Renamed from `MediaContainer` to\n * `ResponsiveItemContainer` and renders a `<span>` instead of a `<div>`.\n */\nexport const ResponsiveItemContainer = forwardRef<\n HTMLSpanElement,\n ResponsiveItemContainerProps\n>(function ResponsiveItemContainer(props, ref) {\n const {\n className,\n fullWidth = false,\n aspectRatio,\n responsive = \"auto\",\n children,\n ...remaining\n } = props;\n\n return (\n <span\n {...remaining}\n ref={ref}\n className={responsiveItemContainer({\n className,\n fullWidth,\n aspectRatio,\n responsive,\n })}\n >\n {children}\n </span>\n );\n});\n"],"names":["cnb","forwardRef","bem","styles","responsiveItemContainer","options","className","fullWidth","aspectRatio","responsive","auto","ResponsiveItemContainer","props","ref","children","remaining","span"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAA6B,QAAQ;AACxD,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAwDnB,iBAAiB,GACjB,OAAO,SAASE,wBACdC,UAAmD,CAAC,CAAC;IAErD,MAAM,EACJC,SAAS,EACTC,YAAY,KAAK,EACjBC,cAAc,EAAE,EAChBC,aAAa,MAAM,EACpB,GAAGJ;IAEJ,OAAOL,IACLG,OAAO;QACLO,MAAMD,eAAe;QACrB,cAAcA,eAAe;QAC7B,gBAAgBD;QAChB,CAACA,YAAY,EAAEA;QACf,cAAcD;IAChB,IACAD;AAEJ;AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDC,GACD,OAAO,MAAMK,wCAA0BV,WAGrC,SAASU,wBAAwBC,KAAK,EAAEC,GAAG;IAC3C,MAAM,EACJP,SAAS,EACTC,YAAY,KAAK,EACjBC,WAAW,EACXC,aAAa,MAAM,EACnBK,QAAQ,EACR,GAAGC,WACJ,GAAGH;IAEJ,qBACE,KAACI;QACE,GAAGD,SAAS;QACbF,KAAKA;QACLP,WAAWF,wBAAwB;YACjCE;YACAC;YACAC;YACAC;QACF;kBAECK;;AAGP,GAAG"}
1
+ {"version":3,"sources":["../../src/responsive-item/ResponsiveItemContainer.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-responsive-item-container\");\n\n/** @since 6.0.0 */\nexport interface ResponsiveItemContainerClassNameOptions {\n className?: string;\n\n /**\n * Set this to `true` if the container should gain the following styles:\n *\n * ```scss\n * display: block;\n * width: 100%;\n * ```\n *\n * @defaultValue `false`\n */\n fullWidth?: boolean;\n\n /**\n * Set this to a custom aspect ratio to use.\n *\n * @example Valid Aspect Ratios\n * ```tsx\n * aspectRatio=\"16-9\"\n * aspectRatio=\"9-16\"\n * aspectRatio=\"3-4\"\n * aspectRatio=\"4-3\"\n * aspectRatio=\"1-1\"\n * ```\n *\n * These values are based on the `core.$responsive-item-aspect-ratios` map.\n *\n * @defaultValue `\"\"`\n */\n aspectRatio?: `${number}-${number}`;\n\n /**\n * Set this to `\"manual\"` if you want to manually specify which elements are\n * responsive items using custom class names. You probably don't really want\n * to use this.\n *\n * Set this to `\"auto\"` to automatically update all visual media that appear\n * as a child in this component to a responsive item.\n *\n * Set this to `\"container\"` to automatically update all visual media that\n * appear as a child in this component to be a responsive item that scales to\n * the container's dimensions.\n *\n * Note: The `\"auto\"` and `\"container\"` values use the\n * `core.$responsive-item-selectors` value for their behavior.\n *\n * @defaultValue `\"auto\"`\n */\n responsive?: \"auto\" | \"manual\" | \"container\";\n}\n\n/** @since 6.0.0 */\nexport function responsiveItemContainer(\n options: ResponsiveItemContainerClassNameOptions = {}\n): string {\n const {\n className,\n fullWidth = false,\n aspectRatio = \"\",\n responsive = \"auto\",\n } = options;\n\n return cnb(\n styles({\n auto: responsive !== \"manual\",\n \"auto-scale\": responsive === \"container\",\n \"aspect-ratio\": aspectRatio,\n [aspectRatio]: aspectRatio,\n \"full-width\": fullWidth,\n }),\n className\n );\n}\n\n/**\n * @since 6.0.0 Renamed from `MediaContainerProps` to\n * `ResponsiveItemContainerProps`\n * @since 6.0.0 The `height` and `width` props were removed in favor of the\n * `aspectRatio` props since the latest typescript string interpolation supports\n * enforcing the correct format.\n * @since 6.0.0 The `auto` prop was removed in favor of the new\n * {@link ResponsiveItemContainerProps.responsive} prop.\n */\nexport interface ResponsiveItemContainerProps\n extends HTMLAttributes<HTMLSpanElement>,\n ResponsiveItemContainerClassNameOptions {}\n\n/**\n * **Server Component**\n *\n * @example Image Example\n * ```tsx\n * import { ResponsiveItemContainer } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <ResponsiveItemContainer>\n * <img alt=\"\" src=\"/some-image.png\" />\n * </ResponsiveItemContainer>\n * );\n * }\n * ```\n *\n * @example Iframe Example\n * ```tsx\n * import { ResponsiveItemContainer } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <ResponsiveItemContainer>\n * <iframe\n * src=\"https://youtube.com/some-video-url\"\n * title=\"Some YouTube video\"\n * allowFullScreen\n * />\n * </ResponsiveItemContainer>\n * );\n * }\n * ```\n *\n * @example Forced Aspect Ratio\n * ```tsx\n * import { ResponsiveItemContainer } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <ResponsiveItemContainer aspectRatio=\"16-9\">\n * <img alt=\"\" src=\"/some-image.png\" />\n * </ResponsiveItemContainer>\n * );\n * }\n * ```\n *\n * @since 6.0.0 Renamed from `MediaContainer` to\n * `ResponsiveItemContainer` and renders a `<span>` instead of a `<div>`.\n */\nexport const ResponsiveItemContainer = forwardRef<\n HTMLSpanElement,\n ResponsiveItemContainerProps\n>(function ResponsiveItemContainer(props, ref) {\n const {\n className,\n fullWidth = false,\n aspectRatio,\n responsive = \"auto\",\n children,\n ...remaining\n } = props;\n\n return (\n <span\n {...remaining}\n ref={ref}\n className={responsiveItemContainer({\n className,\n fullWidth,\n aspectRatio,\n responsive,\n })}\n >\n {children}\n </span>\n );\n});\n"],"names":["cnb","forwardRef","bem","styles","responsiveItemContainer","options","className","fullWidth","aspectRatio","responsive","auto","ResponsiveItemContainer","props","ref","children","remaining","span"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAA6B,QAAQ;AACxD,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAwDnB,iBAAiB,GACjB,OAAO,SAASE,wBACdC,UAAmD,CAAC,CAAC;IAErD,MAAM,EACJC,SAAS,EACTC,YAAY,KAAK,EACjBC,cAAc,EAAE,EAChBC,aAAa,MAAM,EACpB,GAAGJ;IAEJ,OAAOL,IACLG,OAAO;QACLO,MAAMD,eAAe;QACrB,cAAcA,eAAe;QAC7B,gBAAgBD;QAChB,CAACA,YAAY,EAAEA;QACf,cAAcD;IAChB,IACAD;AAEJ;AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDC,GACD,OAAO,MAAMK,wCAA0BV,WAGrC,SAASU,wBAAwBC,KAAK,EAAEC,GAAG;IAC3C,MAAM,EACJP,SAAS,EACTC,YAAY,KAAK,EACjBC,WAAW,EACXC,aAAa,MAAM,EACnBK,QAAQ,EACR,GAAGC,WACJ,GAAGH;IAEJ,qBACE,KAACI;QACE,GAAGD,SAAS;QACbF,KAAKA;QACLP,WAAWF,wBAAwB;YACjCE;YACAC;YACAC;YACAC;QACF;kBAECK;;AAGP,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/responsive-item/ResponsiveItemOverlay.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-responsive-item-overlay\");\n\n/**\n * The overlay positions relative to the `MediaContainer` component. Most of\n * the sizes are self-explanatory, but the `middle` position will be centered\n * vertically while `center` will be centered `horizontally`.\n *\n * @since 6.0.0 Renamed from `MediaOverlayPosition` to\n * `ResponsiveItemOverlayProps`.\n */\nexport type ResponsiveItemOverlayPosition =\n | \"top\"\n | \"right\"\n | \"bottom\"\n | \"left\"\n | \"middle\"\n | \"center\"\n | \"absolute-center\";\n\n/** @since 6.0.0 */\nexport interface ResponsiveItemOverlayClassNameOptions {\n className?: string;\n /** @defaultValue `\"bottom\"` */\n position?: ResponsiveItemOverlayPosition;\n}\n\n/**\n * @since 6.0.0\n */\nexport function responsiveItemOverlay(\n options: ResponsiveItemOverlayClassNameOptions = {}\n): string {\n const { className, position = \"bottom\" } = options;\n\n return cnb(\n styles({\n [position]: true,\n horizontal:\n position !== \"top\" && position !== \"bottom\" && position !== \"middle\",\n }),\n className\n );\n}\n\n/**\n * @since 6.0.0 Renamed from `MediaOverlayProps` to\n * `ResponsiveItemOverlayProps`.\n */\nexport interface ResponsiveItemOverlayProps\n extends HTMLAttributes<HTMLSpanElement>,\n ResponsiveItemOverlayClassNameOptions {}\n\n/**\n * **Server Component**\n *\n * @example Simple Example\n * ```tsx\n * import { ResponsiveItemContainer, ResponsiveItemOverlay } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <ResponsiveItemContainer>\n * <img alt=\"\" src=\"/some-image.png\" />\n * <ResponsiveItemOverlay>\n * <Typography type=\"headline-5\" margin=\"none\">\n * This appears at the bottom by default.\n * </Typography>\n * </ResponsiveItemOverlay>\n * </ResponsiveItemContainer>\n * );\n * }\n * ```\n *\n * @see {@link ResponsiveItemOverlayPosition}\n *\n * @since 6.0.0 Renamed from `MediaOverlay` to `ResponsiveItemOverlay`\n * and renders as a `<span>` instead of a `<div>`.\n */\nexport const ResponsiveItemOverlay = forwardRef<\n HTMLSpanElement,\n ResponsiveItemOverlayProps\n>(function ResponsiveItemOverlay(props, ref) {\n const { className, children, position = \"bottom\", ...remaining } = props;\n\n return (\n <span\n {...remaining}\n ref={ref}\n className={responsiveItemOverlay({ className, position })}\n >\n {children}\n </span>\n );\n});\n"],"names":["cnb","forwardRef","bem","styles","responsiveItemOverlay","options","className","position","horizontal","ResponsiveItemOverlay","props","ref","children","remaining","span"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAA6B,QAAQ;AACxD,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AA0BnB;;CAEC,GACD,OAAO,SAASE,sBACdC,UAAiD,CAAC,CAAC;IAEnD,MAAM,EAAEC,SAAS,EAAEC,WAAW,QAAQ,EAAE,GAAGF;IAE3C,OAAOL,IACLG,OAAO;QACL,CAACI,SAAS,EAAE;QACZC,YACED,aAAa,SAASA,aAAa,YAAYA,aAAa;IAChE,IACAD;AAEJ;AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BC,GACD,OAAO,MAAMG,sCAAwBR,WAGnC,SAASQ,sBAAsBC,KAAK,EAAEC,GAAG;IACzC,MAAM,EAAEL,SAAS,EAAEM,QAAQ,EAAEL,WAAW,QAAQ,EAAE,GAAGM,WAAW,GAAGH;IAEnE,qBACE,KAACI;QACE,GAAGD,SAAS;QACbF,KAAKA;QACLL,WAAWF,sBAAsB;YAAEE;YAAWC;QAAS;kBAEtDK;;AAGP,GAAG"}
1
+ {"version":3,"sources":["../../src/responsive-item/ResponsiveItemOverlay.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-responsive-item-overlay\");\n\n/**\n * The overlay positions relative to the `MediaContainer` component. Most of\n * the sizes are self-explanatory, but the `middle` position will be centered\n * vertically while `center` will be centered `horizontally`.\n *\n * @since 6.0.0 Renamed from `MediaOverlayPosition` to\n * `ResponsiveItemOverlayProps`.\n */\nexport type ResponsiveItemOverlayPosition =\n | \"top\"\n | \"right\"\n | \"bottom\"\n | \"left\"\n | \"middle\"\n | \"center\"\n | \"absolute-center\";\n\n/** @since 6.0.0 */\nexport interface ResponsiveItemOverlayClassNameOptions {\n className?: string;\n /** @defaultValue `\"bottom\"` */\n position?: ResponsiveItemOverlayPosition;\n}\n\n/**\n * @since 6.0.0\n */\nexport function responsiveItemOverlay(\n options: ResponsiveItemOverlayClassNameOptions = {}\n): string {\n const { className, position = \"bottom\" } = options;\n\n return cnb(\n styles({\n [position]: true,\n horizontal:\n position !== \"top\" && position !== \"bottom\" && position !== \"middle\",\n }),\n className\n );\n}\n\n/**\n * @since 6.0.0 Renamed from `MediaOverlayProps` to\n * `ResponsiveItemOverlayProps`.\n */\nexport interface ResponsiveItemOverlayProps\n extends HTMLAttributes<HTMLSpanElement>,\n ResponsiveItemOverlayClassNameOptions {}\n\n/**\n * **Server Component**\n *\n * @example Simple Example\n * ```tsx\n * import { ResponsiveItemContainer, ResponsiveItemOverlay } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <ResponsiveItemContainer>\n * <img alt=\"\" src=\"/some-image.png\" />\n * <ResponsiveItemOverlay>\n * <Typography type=\"headline-5\" margin=\"none\">\n * This appears at the bottom by default.\n * </Typography>\n * </ResponsiveItemOverlay>\n * </ResponsiveItemContainer>\n * );\n * }\n * ```\n *\n * @see {@link ResponsiveItemOverlayPosition}\n *\n * @since 6.0.0 Renamed from `MediaOverlay` to `ResponsiveItemOverlay`\n * and renders as a `<span>` instead of a `<div>`.\n */\nexport const ResponsiveItemOverlay = forwardRef<\n HTMLSpanElement,\n ResponsiveItemOverlayProps\n>(function ResponsiveItemOverlay(props, ref) {\n const { className, children, position = \"bottom\", ...remaining } = props;\n\n return (\n <span\n {...remaining}\n ref={ref}\n className={responsiveItemOverlay({ className, position })}\n >\n {children}\n </span>\n );\n});\n"],"names":["cnb","forwardRef","bem","styles","responsiveItemOverlay","options","className","position","horizontal","ResponsiveItemOverlay","props","ref","children","remaining","span"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAA6B,QAAQ;AACxD,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AA0BnB;;CAEC,GACD,OAAO,SAASE,sBACdC,UAAiD,CAAC,CAAC;IAEnD,MAAM,EAAEC,SAAS,EAAEC,WAAW,QAAQ,EAAE,GAAGF;IAE3C,OAAOL,IACLG,OAAO;QACL,CAACI,SAAS,EAAE;QACZC,YACED,aAAa,SAASA,aAAa,YAAYA,aAAa;IAChE,IACAD;AAEJ;AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BC,GACD,OAAO,MAAMG,sCAAwBR,WAGnC,SAASQ,sBAAsBC,KAAK,EAAEC,GAAG;IACzC,MAAM,EAAEL,SAAS,EAAEM,QAAQ,EAAEL,WAAW,QAAQ,EAAE,GAAGM,WAAW,GAAGH;IAEnE,qBACE,KAACI;QACE,GAAGD,SAAS;QACbF,KAAKA;QACLL,WAAWF,sBAAsB;YAAEE;YAAWC;QAAS;kBAEtDK;;AAGP,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/responsive-item/styles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-responsive-item\");\n\n/** @since 6.0.0 */\nexport interface ResponsiveItemClassNameOptions {\n className?: string;\n\n /**\n * Set this to `true` to apply the following styles:\n * ```scss\n * max-height: 100%;\n * max-width: 100%;\n * object-fit: contain;\n * ```\n *\n * This is useful for displaying images in a full page dialog so that scroll\n * bars do not appear while maintaining the correct aspect ratio for the item.\n *\n * @defaultValue `false`\n */\n scaleToContainer?: boolean;\n\n /**\n * Set this to `true` to force a specific aspect ratio.\n *\n * Note: This will only work if the parent element has applied the correct\n * {@link ResponsiveItemContainerStyles} as well.\n *\n * @defaultValue `false`\n */\n forcedAspectRatio?: boolean;\n}\n\n/**\n * Applies the visual media responsive styles manually if you cannot use the\n * `ResponsiveItemContainer` component.\n *\n * @since 6.0.0\n */\nexport function responsiveItem(\n options: ResponsiveItemClassNameOptions = {}\n): string {\n const {\n className,\n scaleToContainer = false,\n forcedAspectRatio = false,\n } = options;\n\n return cnb(\n styles({\n scale: scaleToContainer,\n \"aspect-ratio\": forcedAspectRatio,\n }),\n className\n );\n}\n"],"names":["cnb","bem","styles","responsiveItem","options","className","scaleToContainer","forcedAspectRatio","scale"],"rangeMappings":";;;;;;;;;;;;;;","mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAgCnB;;;;;CAKC,GACD,OAAO,SAASE,eACdC,UAA0C,CAAC,CAAC;IAE5C,MAAM,EACJC,SAAS,EACTC,mBAAmB,KAAK,EACxBC,oBAAoB,KAAK,EAC1B,GAAGH;IAEJ,OAAOJ,IACLE,OAAO;QACLM,OAAOF;QACP,gBAAgBC;IAClB,IACAF;AAEJ"}
1
+ {"version":3,"sources":["../../src/responsive-item/styles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-responsive-item\");\n\n/** @since 6.0.0 */\nexport interface ResponsiveItemClassNameOptions {\n className?: string;\n\n /**\n * Set this to `true` to apply the following styles:\n * ```scss\n * max-height: 100%;\n * max-width: 100%;\n * object-fit: contain;\n * ```\n *\n * This is useful for displaying images in a full page dialog so that scroll\n * bars do not appear while maintaining the correct aspect ratio for the item.\n *\n * @defaultValue `false`\n */\n scaleToContainer?: boolean;\n\n /**\n * Set this to `true` to force a specific aspect ratio.\n *\n * Note: This will only work if the parent element has applied the correct\n * {@link ResponsiveItemContainerStyles} as well.\n *\n * @defaultValue `false`\n */\n forcedAspectRatio?: boolean;\n}\n\n/**\n * Applies the visual media responsive styles manually if you cannot use the\n * `ResponsiveItemContainer` component.\n *\n * @since 6.0.0\n */\nexport function responsiveItem(\n options: ResponsiveItemClassNameOptions = {}\n): string {\n const {\n className,\n scaleToContainer = false,\n forcedAspectRatio = false,\n } = options;\n\n return cnb(\n styles({\n scale: scaleToContainer,\n \"aspect-ratio\": forcedAspectRatio,\n }),\n className\n );\n}\n"],"names":["cnb","bem","styles","responsiveItem","options","className","scaleToContainer","forcedAspectRatio","scale"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAgCnB;;;;;CAKC,GACD,OAAO,SAASE,eACdC,UAA0C,CAAC,CAAC;IAE5C,MAAM,EACJC,SAAS,EACTC,mBAAmB,KAAK,EACxBC,oBAAoB,KAAK,EAC1B,GAAGH;IAEJ,OAAOJ,IACLE,OAAO;QACLM,OAAOF;QACP,gBAAgBC;IAClB,IACAF;AAEJ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/scroll/ScrollLock.tsx"],"sourcesContent":["\"use client\";\nimport { useScrollLock } from \"./useScrollLock.js\";\n\n/**\n * **Client Component**\n *\n * This is a convenience component that can be used within transitionable\n * components to ensure the scroll lock is active only while the element is\n * rendered.\n *\n * @since 6.0.0\n */\nexport function ScrollLock(): null {\n useScrollLock(true);\n return null;\n}\n"],"names":["useScrollLock","ScrollLock"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAAA;AACA,SAASA,aAAa,QAAQ,qBAAqB;AAEnD;;;;;;;;CAQC,GACD,OAAO,SAASC;IACdD,cAAc;IACd,OAAO;AACT"}
1
+ {"version":3,"sources":["../../src/scroll/ScrollLock.tsx"],"sourcesContent":["\"use client\";\nimport { useScrollLock } from \"./useScrollLock.js\";\n\n/**\n * **Client Component**\n *\n * This is a convenience component that can be used within transitionable\n * components to ensure the scroll lock is active only while the element is\n * rendered.\n *\n * @since 6.0.0\n */\nexport function ScrollLock(): null {\n useScrollLock(true);\n return null;\n}\n"],"names":["useScrollLock","ScrollLock"],"mappings":"AAAA;AACA,SAASA,aAAa,QAAQ,qBAAqB;AAEnD;;;;;;;;CAQC,GACD,OAAO,SAASC;IACdD,cAAc;IACd,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/scroll/getScrollbarWidth.ts"],"sourcesContent":["let cache: number | undefined;\n\n/**\n * @internal\n */\nexport function getScrollbarWidth(force = false): number {\n /* istanbul ignore if */\n if (typeof window === \"undefined\") {\n return 0;\n }\n\n let value = cache;\n if (!force && typeof value === \"number\") {\n return value;\n }\n\n const outer = document.createElement(\"div\");\n outer.style.visibility = \"hidden\";\n outer.style.overflow = \"scroll\";\n document.body.appendChild(outer);\n\n const inner = document.createElement(\"div\");\n outer.appendChild(inner);\n\n // the scrollbar width can be determined by comparing the width of the parent\n // element that has scrollbars to the child element that does not.\n value = outer.offsetWidth - inner.offsetWidth;\n cache = value;\n document.body.removeChild(outer);\n\n return value;\n}\n"],"names":["cache","getScrollbarWidth","force","window","value","outer","document","createElement","style","visibility","overflow","body","appendChild","inner","offsetWidth","removeChild"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,IAAIA;AAEJ;;CAEC,GACD,OAAO,SAASC,kBAAkBC,QAAQ,KAAK;IAC7C,sBAAsB,GACtB,IAAI,OAAOC,WAAW,aAAa;QACjC,OAAO;IACT;IAEA,IAAIC,QAAQJ;IACZ,IAAI,CAACE,SAAS,OAAOE,UAAU,UAAU;QACvC,OAAOA;IACT;IAEA,MAAMC,QAAQC,SAASC,aAAa,CAAC;IACrCF,MAAMG,KAAK,CAACC,UAAU,GAAG;IACzBJ,MAAMG,KAAK,CAACE,QAAQ,GAAG;IACvBJ,SAASK,IAAI,CAACC,WAAW,CAACP;IAE1B,MAAMQ,QAAQP,SAASC,aAAa,CAAC;IACrCF,MAAMO,WAAW,CAACC;IAElB,6EAA6E;IAC7E,kEAAkE;IAClET,QAAQC,MAAMS,WAAW,GAAGD,MAAMC,WAAW;IAC7Cd,QAAQI;IACRE,SAASK,IAAI,CAACI,WAAW,CAACV;IAE1B,OAAOD;AACT"}
1
+ {"version":3,"sources":["../../src/scroll/getScrollbarWidth.ts"],"sourcesContent":["let cache: number | undefined;\n\n/**\n * @internal\n */\nexport function getScrollbarWidth(force = false): number {\n /* istanbul ignore if */\n if (typeof window === \"undefined\") {\n return 0;\n }\n\n let value = cache;\n if (!force && typeof value === \"number\") {\n return value;\n }\n\n const outer = document.createElement(\"div\");\n outer.style.visibility = \"hidden\";\n outer.style.overflow = \"scroll\";\n document.body.appendChild(outer);\n\n const inner = document.createElement(\"div\");\n outer.appendChild(inner);\n\n // the scrollbar width can be determined by comparing the width of the parent\n // element that has scrollbars to the child element that does not.\n value = outer.offsetWidth - inner.offsetWidth;\n cache = value;\n document.body.removeChild(outer);\n\n return value;\n}\n"],"names":["cache","getScrollbarWidth","force","window","value","outer","document","createElement","style","visibility","overflow","body","appendChild","inner","offsetWidth","removeChild"],"mappings":"AAAA,IAAIA;AAEJ;;CAEC,GACD,OAAO,SAASC,kBAAkBC,QAAQ,KAAK;IAC7C,sBAAsB,GACtB,IAAI,OAAOC,WAAW,aAAa;QACjC,OAAO;IACT;IAEA,IAAIC,QAAQJ;IACZ,IAAI,CAACE,SAAS,OAAOE,UAAU,UAAU;QACvC,OAAOA;IACT;IAEA,MAAMC,QAAQC,SAASC,aAAa,CAAC;IACrCF,MAAMG,KAAK,CAACC,UAAU,GAAG;IACzBJ,MAAMG,KAAK,CAACE,QAAQ,GAAG;IACvBJ,SAASK,IAAI,CAACC,WAAW,CAACP;IAE1B,MAAMQ,QAAQP,SAASC,aAAa,CAAC;IACrCF,MAAMO,WAAW,CAACC;IAElB,6EAA6E;IAC7E,kEAAkE;IAClET,QAAQC,MAAMS,WAAW,GAAGD,MAAMC,WAAW;IAC7Cd,QAAQI;IACRE,SAASK,IAAI,CAACI,WAAW,CAACV;IAE1B,OAAOD;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/scroll/useScrollLock.ts"],"sourcesContent":["\"use client\";\nimport { useEffect } from \"react\";\nimport { getScrollbarWidth } from \"./getScrollbarWidth.js\";\n\nexport const SCROLLBAR_SIZE_VAR = \"--rmd-scrollbar-size\";\n\n// this is really just so that nested dialogs will work correctly. Only the\n// first created dialog should prevent scroll locking on the `document.body`\nlet isLocked = false;\n\n/**\n *\n * @internal\n * @since 6.0.0 No longer support scroll locking elements other than\n * the `document.body` since it's more reliable to scroll lock with an overlay.\n * @since 6.0.0 Now applies `paddingRight` equal to the current OS's\n * scrollbar width if there is a full page scrollbar to prevent layout shifting.\n *\n * @param locked - The `document.body` will not be scrollable when this is\n * `true`.\n */\nexport function useScrollLock(locked: boolean): void {\n useEffect(() => {\n if (isLocked || !locked) {\n return;\n }\n\n isLocked = true;\n\n const size = `${getScrollbarWidth()}px`;\n const el = document.body;\n const { paddingRight } = el.style;\n const isScrollbarVisible = el.scrollHeight > el.offsetHeight;\n\n el.style.overflow = \"hidden\";\n if (isScrollbarVisible) {\n el.style.setProperty(SCROLLBAR_SIZE_VAR, size);\n el.style.paddingRight = `var(${SCROLLBAR_SIZE_VAR})`;\n }\n\n return () => {\n isLocked = false;\n\n el.style.removeProperty(SCROLLBAR_SIZE_VAR);\n el.style.overflow = \"\";\n if (isScrollbarVisible) {\n el.style.paddingRight = paddingRight;\n }\n };\n }, [locked]);\n}\n"],"names":["useEffect","getScrollbarWidth","SCROLLBAR_SIZE_VAR","isLocked","useScrollLock","locked","size","el","document","body","paddingRight","style","isScrollbarVisible","scrollHeight","offsetHeight","overflow","setProperty","removeProperty"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,iBAAiB,QAAQ,yBAAyB;AAE3D,OAAO,MAAMC,qBAAqB,uBAAuB;AAEzD,2EAA2E;AAC3E,4EAA4E;AAC5E,IAAIC,WAAW;AAEf;;;;;;;;;;CAUC,GACD,OAAO,SAASC,cAAcC,MAAe;IAC3CL,UAAU;QACR,IAAIG,YAAY,CAACE,QAAQ;YACvB;QACF;QAEAF,WAAW;QAEX,MAAMG,OAAO,CAAC,EAAEL,oBAAoB,EAAE,CAAC;QACvC,MAAMM,KAAKC,SAASC,IAAI;QACxB,MAAM,EAAEC,YAAY,EAAE,GAAGH,GAAGI,KAAK;QACjC,MAAMC,qBAAqBL,GAAGM,YAAY,GAAGN,GAAGO,YAAY;QAE5DP,GAAGI,KAAK,CAACI,QAAQ,GAAG;QACpB,IAAIH,oBAAoB;YACtBL,GAAGI,KAAK,CAACK,WAAW,CAACd,oBAAoBI;YACzCC,GAAGI,KAAK,CAACD,YAAY,GAAG,CAAC,IAAI,EAAER,mBAAmB,CAAC,CAAC;QACtD;QAEA,OAAO;YACLC,WAAW;YAEXI,GAAGI,KAAK,CAACM,cAAc,CAACf;YACxBK,GAAGI,KAAK,CAACI,QAAQ,GAAG;YACpB,IAAIH,oBAAoB;gBACtBL,GAAGI,KAAK,CAACD,YAAY,GAAGA;YAC1B;QACF;IACF,GAAG;QAACL;KAAO;AACb"}
1
+ {"version":3,"sources":["../../src/scroll/useScrollLock.ts"],"sourcesContent":["\"use client\";\nimport { useEffect } from \"react\";\nimport { getScrollbarWidth } from \"./getScrollbarWidth.js\";\n\nexport const SCROLLBAR_SIZE_VAR = \"--rmd-scrollbar-size\";\n\n// this is really just so that nested dialogs will work correctly. Only the\n// first created dialog should prevent scroll locking on the `document.body`\nlet isLocked = false;\n\n/**\n *\n * @internal\n * @since 6.0.0 No longer support scroll locking elements other than\n * the `document.body` since it's more reliable to scroll lock with an overlay.\n * @since 6.0.0 Now applies `paddingRight` equal to the current OS's\n * scrollbar width if there is a full page scrollbar to prevent layout shifting.\n *\n * @param locked - The `document.body` will not be scrollable when this is\n * `true`.\n */\nexport function useScrollLock(locked: boolean): void {\n useEffect(() => {\n if (isLocked || !locked) {\n return;\n }\n\n isLocked = true;\n\n const size = `${getScrollbarWidth()}px`;\n const el = document.body;\n const { paddingRight } = el.style;\n const isScrollbarVisible = el.scrollHeight > el.offsetHeight;\n\n el.style.overflow = \"hidden\";\n if (isScrollbarVisible) {\n el.style.setProperty(SCROLLBAR_SIZE_VAR, size);\n el.style.paddingRight = `var(${SCROLLBAR_SIZE_VAR})`;\n }\n\n return () => {\n isLocked = false;\n\n el.style.removeProperty(SCROLLBAR_SIZE_VAR);\n el.style.overflow = \"\";\n if (isScrollbarVisible) {\n el.style.paddingRight = paddingRight;\n }\n };\n }, [locked]);\n}\n"],"names":["useEffect","getScrollbarWidth","SCROLLBAR_SIZE_VAR","isLocked","useScrollLock","locked","size","el","document","body","paddingRight","style","isScrollbarVisible","scrollHeight","offsetHeight","overflow","setProperty","removeProperty"],"mappings":"AAAA;AACA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,iBAAiB,QAAQ,yBAAyB;AAE3D,OAAO,MAAMC,qBAAqB,uBAAuB;AAEzD,2EAA2E;AAC3E,4EAA4E;AAC5E,IAAIC,WAAW;AAEf;;;;;;;;;;CAUC,GACD,OAAO,SAASC,cAAcC,MAAe;IAC3CL,UAAU;QACR,IAAIG,YAAY,CAACE,QAAQ;YACvB;QACF;QAEAF,WAAW;QAEX,MAAMG,OAAO,CAAC,EAAEL,oBAAoB,EAAE,CAAC;QACvC,MAAMM,KAAKC,SAASC,IAAI;QACxB,MAAM,EAAEC,YAAY,EAAE,GAAGH,GAAGI,KAAK;QACjC,MAAMC,qBAAqBL,GAAGM,YAAY,GAAGN,GAAGO,YAAY;QAE5DP,GAAGI,KAAK,CAACI,QAAQ,GAAG;QACpB,IAAIH,oBAAoB;YACtBL,GAAGI,KAAK,CAACK,WAAW,CAACd,oBAAoBI;YACzCC,GAAGI,KAAK,CAACD,YAAY,GAAG,CAAC,IAAI,EAAER,mBAAmB,CAAC,CAAC;QACtD;QAEA,OAAO;YACLC,WAAW;YAEXI,GAAGI,KAAK,CAACM,cAAc,CAACf;YACxBK,GAAGI,KAAK,CAACI,QAAQ,GAAG;YACpB,IAAIH,oBAAoB;gBACtBL,GAAGI,KAAK,CAACD,YAAY,GAAGA;YAC1B;QACF;IACF,GAAG;QAACL;KAAO;AACb"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/searching/caseInsensitive.ts"],"sourcesContent":["import { type TextExtractor } from \"../types.js\";\nimport { type BaseSearchOptions } from \"./types.js\";\nimport { defaultExtractor, search } from \"./utils.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface CaseInsensitiveStartsWithOptions {\n /**\n * Set this to `true` if the item in the list must start with the query\n * instead of only including it.\n *\n * @example Search Example\n * ```ts\n * const fruits = [\"Banana\", \"Grape\", \"Apple\", \"Orange\"];\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * type: \"search\",\n * });\n * // \"Grape\"\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * type: \"search\",\n * startsWith: true,\n * });\n * // \"Apple\"\n * ```\n *\n * @example Filter Example\n * ```ts\n * const fruits = [\"Apple\", \"Banana\", \"Grape\", \"Orange\"];\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * });\n * // [\"Apple\", \"Grape\"]\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * startsWith: true,\n * });\n * // [\"Apple\"]\n * ```\n *\n * @defaultValue `false`\n */\n startsWith?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface IsCaseInsensitiveMatchOptions\n extends CaseInsensitiveStartsWithOptions {\n /**\n * The current search query.\n */\n query: string;\n\n /**\n * The current value to compare against.\n */\n value: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport function isCaseInsensitiveMatch(\n options: IsCaseInsensitiveMatchOptions\n): boolean {\n const { query, value, startsWith } = options;\n const matchIndex = value.indexOf(query);\n if (startsWith) {\n return matchIndex === 0;\n }\n\n return matchIndex !== -1;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface CaseInsensitiveOptions<T>\n extends BaseSearchOptions<T>,\n CaseInsensitiveStartsWithOptions {}\n\n/**\n * @example String list\n * ```ts\n * const fruits = [\"Apple\", \"Banana\", \"Grape\", \"Orange\"];\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * });\n * // [\"Apple\", \"Grape\"]\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * startsWith: true,\n * });\n * // [\"Apple\"]\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \" a p\",\n * });\n * // []\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \" a p\",\n * whitespace: \"ignore\",\n * });\n * // [\"Apple\", \"Grape\"]\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \" ap \",\n * whitespace: \"trim\",\n * });\n * // [\"Apple\", \"Grape\"]\n * ```\n *\n * @example Objects\n * ```ts\n * const fruits = [\n * { name: \"Apple\", value: 0 },\n * { name: \"Banana\", value: 1 },\n * { name: \"Grape\", value: 2 },\n * { name: \"Orange\", value: 3 },\n * ];\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * extractor: (item) => item.name,\n * });\n * // [{ name: \"Apple\", value: 0 }, { name: \"Grape\", value: 2 }]\n * ```\n *\n * @since 6.0.0\n */\nexport function caseInsensitiveSearch<T extends string>(\n options: Omit<CaseInsensitiveOptions<T>, \"extractor\"> & { type?: \"filter\" }\n): readonly T[];\nexport function caseInsensitiveSearch<T extends string>(\n options: Omit<CaseInsensitiveOptions<T>, \"extractor\"> & { type: \"search\" }\n): T | undefined;\nexport function caseInsensitiveSearch<T>(\n options: CaseInsensitiveOptions<T> & {\n extractor: TextExtractor<T>;\n type?: \"filter\";\n }\n): readonly T[];\nexport function caseInsensitiveSearch<T>(\n options: CaseInsensitiveOptions<T> & {\n extractor: TextExtractor<T>;\n type: \"search\";\n }\n): T | undefined;\nexport function caseInsensitiveSearch<T>(\n options: CaseInsensitiveOptions<T>\n): readonly T[] | T | undefined {\n const {\n list,\n type = \"filter\",\n query,\n extractor = defaultExtractor(\"caseInsensitiveSearch\"),\n startsWith,\n whitespace,\n } = options;\n\n return search({\n type,\n list,\n query,\n extractor,\n whitespace,\n filter(q, value) {\n return isCaseInsensitiveMatch({\n query: q,\n value,\n startsWith,\n });\n },\n });\n}\n"],"names":["defaultExtractor","search","isCaseInsensitiveMatch","options","query","value","startsWith","matchIndex","indexOf","caseInsensitiveSearch","list","type","extractor","whitespace","filter","q"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,gBAAgB,EAAEC,MAAM,QAAQ,aAAa;AAqEtD;;CAEC,GACD,OAAO,SAASC,uBACdC,OAAsC;IAEtC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGH;IACrC,MAAMI,aAAaF,MAAMG,OAAO,CAACJ;IACjC,IAAIE,YAAY;QACd,OAAOC,eAAe;IACxB;IAEA,OAAOA,eAAe,CAAC;AACzB;AAqFA,OAAO,SAASE,sBACdN,OAAkC;IAElC,MAAM,EACJO,IAAI,EACJC,OAAO,QAAQ,EACfP,KAAK,EACLQ,YAAYZ,iBAAiB,wBAAwB,EACrDM,UAAU,EACVO,UAAU,EACX,GAAGV;IAEJ,OAAOF,OAAO;QACZU;QACAD;QACAN;QACAQ;QACAC;QACAC,QAAOC,CAAC,EAAEV,KAAK;YACb,OAAOH,uBAAuB;gBAC5BE,OAAOW;gBACPV;gBACAC;YACF;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/searching/caseInsensitive.ts"],"sourcesContent":["import { type TextExtractor } from \"../types.js\";\nimport { type BaseSearchOptions } from \"./types.js\";\nimport { defaultExtractor, search } from \"./utils.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface CaseInsensitiveStartsWithOptions {\n /**\n * Set this to `true` if the item in the list must start with the query\n * instead of only including it.\n *\n * @example Search Example\n * ```ts\n * const fruits = [\"Banana\", \"Grape\", \"Apple\", \"Orange\"];\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * type: \"search\",\n * });\n * // \"Grape\"\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * type: \"search\",\n * startsWith: true,\n * });\n * // \"Apple\"\n * ```\n *\n * @example Filter Example\n * ```ts\n * const fruits = [\"Apple\", \"Banana\", \"Grape\", \"Orange\"];\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * });\n * // [\"Apple\", \"Grape\"]\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * startsWith: true,\n * });\n * // [\"Apple\"]\n * ```\n *\n * @defaultValue `false`\n */\n startsWith?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface IsCaseInsensitiveMatchOptions\n extends CaseInsensitiveStartsWithOptions {\n /**\n * The current search query.\n */\n query: string;\n\n /**\n * The current value to compare against.\n */\n value: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport function isCaseInsensitiveMatch(\n options: IsCaseInsensitiveMatchOptions\n): boolean {\n const { query, value, startsWith } = options;\n const matchIndex = value.indexOf(query);\n if (startsWith) {\n return matchIndex === 0;\n }\n\n return matchIndex !== -1;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface CaseInsensitiveOptions<T>\n extends BaseSearchOptions<T>,\n CaseInsensitiveStartsWithOptions {}\n\n/**\n * @example String list\n * ```ts\n * const fruits = [\"Apple\", \"Banana\", \"Grape\", \"Orange\"];\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * });\n * // [\"Apple\", \"Grape\"]\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * startsWith: true,\n * });\n * // [\"Apple\"]\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \" a p\",\n * });\n * // []\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \" a p\",\n * whitespace: \"ignore\",\n * });\n * // [\"Apple\", \"Grape\"]\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \" ap \",\n * whitespace: \"trim\",\n * });\n * // [\"Apple\", \"Grape\"]\n * ```\n *\n * @example Objects\n * ```ts\n * const fruits = [\n * { name: \"Apple\", value: 0 },\n * { name: \"Banana\", value: 1 },\n * { name: \"Grape\", value: 2 },\n * { name: \"Orange\", value: 3 },\n * ];\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * extractor: (item) => item.name,\n * });\n * // [{ name: \"Apple\", value: 0 }, { name: \"Grape\", value: 2 }]\n * ```\n *\n * @since 6.0.0\n */\nexport function caseInsensitiveSearch<T extends string>(\n options: Omit<CaseInsensitiveOptions<T>, \"extractor\"> & { type?: \"filter\" }\n): readonly T[];\nexport function caseInsensitiveSearch<T extends string>(\n options: Omit<CaseInsensitiveOptions<T>, \"extractor\"> & { type: \"search\" }\n): T | undefined;\nexport function caseInsensitiveSearch<T>(\n options: CaseInsensitiveOptions<T> & {\n extractor: TextExtractor<T>;\n type?: \"filter\";\n }\n): readonly T[];\nexport function caseInsensitiveSearch<T>(\n options: CaseInsensitiveOptions<T> & {\n extractor: TextExtractor<T>;\n type: \"search\";\n }\n): T | undefined;\nexport function caseInsensitiveSearch<T>(\n options: CaseInsensitiveOptions<T>\n): readonly T[] | T | undefined {\n const {\n list,\n type = \"filter\",\n query,\n extractor = defaultExtractor(\"caseInsensitiveSearch\"),\n startsWith,\n whitespace,\n } = options;\n\n return search({\n type,\n list,\n query,\n extractor,\n whitespace,\n filter(q, value) {\n return isCaseInsensitiveMatch({\n query: q,\n value,\n startsWith,\n });\n },\n });\n}\n"],"names":["defaultExtractor","search","isCaseInsensitiveMatch","options","query","value","startsWith","matchIndex","indexOf","caseInsensitiveSearch","list","type","extractor","whitespace","filter","q"],"mappings":"AAEA,SAASA,gBAAgB,EAAEC,MAAM,QAAQ,aAAa;AAqEtD;;CAEC,GACD,OAAO,SAASC,uBACdC,OAAsC;IAEtC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGH;IACrC,MAAMI,aAAaF,MAAMG,OAAO,CAACJ;IACjC,IAAIE,YAAY;QACd,OAAOC,eAAe;IACxB;IAEA,OAAOA,eAAe,CAAC;AACzB;AAqFA,OAAO,SAASE,sBACdN,OAAkC;IAElC,MAAM,EACJO,IAAI,EACJC,OAAO,QAAQ,EACfP,KAAK,EACLQ,YAAYZ,iBAAiB,wBAAwB,EACrDM,UAAU,EACVO,UAAU,EACX,GAAGV;IAEJ,OAAOF,OAAO;QACZU;QACAD;QACAN;QACAQ;QACAC;QACAC,QAAOC,CAAC,EAAEV,KAAK;YACb,OAAOH,uBAAuB;gBAC5BE,OAAOW;gBACPV;gBACAC;YACF;QACF;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/searching/fuzzy.ts"],"sourcesContent":["import { type TextExtractor } from \"../types.js\";\nimport { type BaseSearchOptions } from \"./types.js\";\nimport { defaultExtractor, search } from \"./utils.js\";\n\n/**\n * @example\n * ```tsx\n * import { createFuzzyRegExp, toSearchQuery } from \"@react-md/core\":\n * import { useDeferredValue, useMemo, useState, type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const [value, setValue] = useState(\"\");\n * const deferredValue = useDeferredValue(value)\n *\n * const match = useMemo(() => {\n * const query = toSearchQuery(deferredValue);\n * if (!query) {\n * return;\n * }\n *\n * const fuzzyRegExp = createFuzzyRegExp(query);\n * return options.find(option => fuzzyRegExp.test(option.label)):\n * }, [options])\n *\n * if (match) {\n * // do something\n * }\n * }\n *\n * ```\n *\n * @since 6.0.0\n * @see {@link fuzzySearch}\n */\nexport function createFuzzyRegExp(query: string): RegExp {\n return new RegExp(\n query\n .split(\"\")\n .join(\"\\\\w*\")\n .replace(/(\\(|\\||\\)|\\\\(?!w\\*)|\\[|\\|-|\\.|\\^|\\+|\\$|\\?|^(?!w)\\*)/g, \"\\\\$1\")\n // Couldn't get the matching of two '*' working, so replace them here..\n .replace(/\\*\\*/g, \"*\\\\*\"),\n \"i\"\n );\n}\n\n/**\n * @since 6.0.0\n */\nexport type FuzzySearchOptions<T> = BaseSearchOptions<T>;\n\n/**\n * Filters a list by making sure that all the letters appear in order ignoring\n * case, punctuation, whitespace, and special characters. This is kind of the\n * same filtering that appears in text editors.\n *\n * @example Simple Example\n * ```ts\n * const list = [\n * \"at\",\n * \"charAt\",\n * \"charCodeAt\",\n * \"codePointAt\",\n * \"concat\",\n * \"constructor\",\n * \"endsWith\",\n * \"includes\",\n * \"indexOf\",\n * \"lastIndexOf\",\n * \"length\",\n * \"localeCompare\",\n * \"match\",\n * \"matchAll\",\n * \"normalize\",\n * \"padEnd\",\n * \"padStart\",\n * \"repeat\",\n * \"replace\",\n * \"replaceAll\",\n * \"search\",\n * \"slice\",\n * \"split\",\n * \"startsWith\",\n * \"substring\",\n * \"toLocaleLowerCase\",\n * \"toLocaleUpperCase\",\n * \"toLowerCase\",\n * \"toString\",\n * \"toUpperCase\",\n * \"trim\",\n * \"trimEnd\",\n * \"trimStart\",\n * \"valueOf\",\n * ];\n *\n * fuzzySearch({\n * list,\n * query: \"la\",\n * });\n * // [\n * // \"lastIndexOf\",\n * // ^^\n * // \"localeCompare\",\n * // ^ ^\n * // \"replace\",\n * // ^^\n * // \"replaceAll\",\n * // ^^\n * // \"toLocaleLowerCase\",\n * // ^ ^\n * // \"toLocaleUpperCase\",\n * // ^ ^\n * // \"toLowerCase\",\n * // ^ ^\n * // ]\n *\n * fuzzySearch({\n * list,\n * query: \"ad\",\n * type: \"search\",\n * });\n * // \"charCodeAt\"\n * // ^ ^\n * ```\n *\n * @since 6.0.0\n */\nexport function fuzzySearch<T extends string>(\n options: Omit<FuzzySearchOptions<T>, \"extractor\"> & { type?: \"filter\" }\n): readonly T[];\nexport function fuzzySearch<T extends string>(\n options: Omit<FuzzySearchOptions<T>, \"extractor\"> & { type?: \"search\" }\n): T | undefined;\nexport function fuzzySearch<T>(\n option: FuzzySearchOptions<T> & {\n extractor: TextExtractor<T>;\n type?: \"filter\";\n }\n): readonly T[];\nexport function fuzzySearch<T>(\n option: FuzzySearchOptions<T> & {\n extractor: TextExtractor<T>;\n type?: \"search\";\n }\n): T | undefined;\nexport function fuzzySearch<T>(\n options: FuzzySearchOptions<T>\n): readonly T[] | T | undefined {\n const {\n list,\n type = \"filter\",\n query,\n extractor = defaultExtractor(\"fuzzySearch\"),\n whitespace,\n } = options;\n\n // lazy initialize the RegExp since the base `filter` function will modify the\n // query and never call the filter function if:\n // - there is no query\n // - the list is empty\n let regexp: RegExp;\n return search({\n type,\n list,\n query,\n extractor,\n whitespace,\n filter(query, value) {\n return (\n value.length > 0 && (regexp ??= createFuzzyRegExp(query)).test(value)\n );\n },\n });\n}\n"],"names":["defaultExtractor","search","createFuzzyRegExp","query","RegExp","split","join","replace","fuzzySearch","options","list","type","extractor","whitespace","regexp","filter","value","length","test"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,gBAAgB,EAAEC,MAAM,QAAQ,aAAa;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BC,GACD,OAAO,SAASC,kBAAkBC,KAAa;IAC7C,OAAO,IAAIC,OACTD,MACGE,KAAK,CAAC,IACNC,IAAI,CAAC,QACLC,OAAO,CAAC,wDAAwD,OACjE,uEAAuE;KACtEA,OAAO,CAAC,SAAS,SACpB;AAEJ;AAqGA,OAAO,SAASC,YACdC,OAA8B;IAE9B,MAAM,EACJC,IAAI,EACJC,OAAO,QAAQ,EACfR,KAAK,EACLS,YAAYZ,iBAAiB,cAAc,EAC3Ca,UAAU,EACX,GAAGJ;IAEJ,8EAA8E;IAC9E,+CAA+C;IAC/C,sBAAsB;IACtB,sBAAsB;IACtB,IAAIK;IACJ,OAAOb,OAAO;QACZU;QACAD;QACAP;QACAS;QACAC;QACAE,QAAOZ,KAAK,EAAEa,KAAK;YACjB,OACEA,MAAMC,MAAM,GAAG,KAAK,AAACH,CAAAA,WAAWZ,kBAAkBC,MAAK,EAAGe,IAAI,CAACF;QAEnE;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/searching/fuzzy.ts"],"sourcesContent":["import { type TextExtractor } from \"../types.js\";\nimport { type BaseSearchOptions } from \"./types.js\";\nimport { defaultExtractor, search } from \"./utils.js\";\n\n/**\n * @example\n * ```tsx\n * import { createFuzzyRegExp, toSearchQuery } from \"@react-md/core\":\n * import { useDeferredValue, useMemo, useState, type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const [value, setValue] = useState(\"\");\n * const deferredValue = useDeferredValue(value)\n *\n * const match = useMemo(() => {\n * const query = toSearchQuery(deferredValue);\n * if (!query) {\n * return;\n * }\n *\n * const fuzzyRegExp = createFuzzyRegExp(query);\n * return options.find(option => fuzzyRegExp.test(option.label)):\n * }, [options])\n *\n * if (match) {\n * // do something\n * }\n * }\n *\n * ```\n *\n * @since 6.0.0\n * @see {@link fuzzySearch}\n */\nexport function createFuzzyRegExp(query: string): RegExp {\n return new RegExp(\n query\n .split(\"\")\n .join(\"\\\\w*\")\n .replace(/(\\(|\\||\\)|\\\\(?!w\\*)|\\[|\\|-|\\.|\\^|\\+|\\$|\\?|^(?!w)\\*)/g, \"\\\\$1\")\n // Couldn't get the matching of two '*' working, so replace them here..\n .replace(/\\*\\*/g, \"*\\\\*\"),\n \"i\"\n );\n}\n\n/**\n * @since 6.0.0\n */\nexport type FuzzySearchOptions<T> = BaseSearchOptions<T>;\n\n/**\n * Filters a list by making sure that all the letters appear in order ignoring\n * case, punctuation, whitespace, and special characters. This is kind of the\n * same filtering that appears in text editors.\n *\n * @example Simple Example\n * ```ts\n * const list = [\n * \"at\",\n * \"charAt\",\n * \"charCodeAt\",\n * \"codePointAt\",\n * \"concat\",\n * \"constructor\",\n * \"endsWith\",\n * \"includes\",\n * \"indexOf\",\n * \"lastIndexOf\",\n * \"length\",\n * \"localeCompare\",\n * \"match\",\n * \"matchAll\",\n * \"normalize\",\n * \"padEnd\",\n * \"padStart\",\n * \"repeat\",\n * \"replace\",\n * \"replaceAll\",\n * \"search\",\n * \"slice\",\n * \"split\",\n * \"startsWith\",\n * \"substring\",\n * \"toLocaleLowerCase\",\n * \"toLocaleUpperCase\",\n * \"toLowerCase\",\n * \"toString\",\n * \"toUpperCase\",\n * \"trim\",\n * \"trimEnd\",\n * \"trimStart\",\n * \"valueOf\",\n * ];\n *\n * fuzzySearch({\n * list,\n * query: \"la\",\n * });\n * // [\n * // \"lastIndexOf\",\n * // ^^\n * // \"localeCompare\",\n * // ^ ^\n * // \"replace\",\n * // ^^\n * // \"replaceAll\",\n * // ^^\n * // \"toLocaleLowerCase\",\n * // ^ ^\n * // \"toLocaleUpperCase\",\n * // ^ ^\n * // \"toLowerCase\",\n * // ^ ^\n * // ]\n *\n * fuzzySearch({\n * list,\n * query: \"ad\",\n * type: \"search\",\n * });\n * // \"charCodeAt\"\n * // ^ ^\n * ```\n *\n * @since 6.0.0\n */\nexport function fuzzySearch<T extends string>(\n options: Omit<FuzzySearchOptions<T>, \"extractor\"> & { type?: \"filter\" }\n): readonly T[];\nexport function fuzzySearch<T extends string>(\n options: Omit<FuzzySearchOptions<T>, \"extractor\"> & { type?: \"search\" }\n): T | undefined;\nexport function fuzzySearch<T>(\n option: FuzzySearchOptions<T> & {\n extractor: TextExtractor<T>;\n type?: \"filter\";\n }\n): readonly T[];\nexport function fuzzySearch<T>(\n option: FuzzySearchOptions<T> & {\n extractor: TextExtractor<T>;\n type?: \"search\";\n }\n): T | undefined;\nexport function fuzzySearch<T>(\n options: FuzzySearchOptions<T>\n): readonly T[] | T | undefined {\n const {\n list,\n type = \"filter\",\n query,\n extractor = defaultExtractor(\"fuzzySearch\"),\n whitespace,\n } = options;\n\n // lazy initialize the RegExp since the base `filter` function will modify the\n // query and never call the filter function if:\n // - there is no query\n // - the list is empty\n let regexp: RegExp;\n return search({\n type,\n list,\n query,\n extractor,\n whitespace,\n filter(query, value) {\n return (\n value.length > 0 && (regexp ??= createFuzzyRegExp(query)).test(value)\n );\n },\n });\n}\n"],"names":["defaultExtractor","search","createFuzzyRegExp","query","RegExp","split","join","replace","fuzzySearch","options","list","type","extractor","whitespace","regexp","filter","value","length","test"],"mappings":"AAEA,SAASA,gBAAgB,EAAEC,MAAM,QAAQ,aAAa;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BC,GACD,OAAO,SAASC,kBAAkBC,KAAa;IAC7C,OAAO,IAAIC,OACTD,MACGE,KAAK,CAAC,IACNC,IAAI,CAAC,QACLC,OAAO,CAAC,wDAAwD,OACjE,uEAAuE;KACtEA,OAAO,CAAC,SAAS,SACpB;AAEJ;AAqGA,OAAO,SAASC,YACdC,OAA8B;IAE9B,MAAM,EACJC,IAAI,EACJC,OAAO,QAAQ,EACfR,KAAK,EACLS,YAAYZ,iBAAiB,cAAc,EAC3Ca,UAAU,EACX,GAAGJ;IAEJ,8EAA8E;IAC9E,+CAA+C;IAC/C,sBAAsB;IACtB,sBAAsB;IACtB,IAAIK;IACJ,OAAOb,OAAO;QACZU;QACAD;QACAP;QACAS;QACAC;QACAE,QAAOZ,KAAK,EAAEa,KAAK;YACjB,OACEA,MAAMC,MAAM,GAAG,KAAK,AAACH,CAAAA,WAAWZ,kBAAkBC,MAAK,EAAGe,IAAI,CAACF;QAEnE;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/searching/toSearchQuery.ts"],"sourcesContent":["import { type WhitespaceFilter } from \"./types.js\";\n\n/**\n * @param s - The string to convert\n * @param whitespace - (default: `\"keep\"`)\n * @since 6.0.0\n */\nexport function toSearchQuery(\n s: string,\n whitespace: WhitespaceFilter = \"keep\"\n): string {\n let q = s.toLowerCase();\n if (whitespace === \"ignore\") {\n q = q.replace(/\\s/g, \"\");\n } else if (whitespace === \"trim\") {\n q = q.trim();\n }\n\n return q;\n}\n"],"names":["toSearchQuery","s","whitespace","q","toLowerCase","replace","trim"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAEA;;;;CAIC,GACD,OAAO,SAASA,cACdC,CAAS,EACTC,aAA+B,MAAM;IAErC,IAAIC,IAAIF,EAAEG,WAAW;IACrB,IAAIF,eAAe,UAAU;QAC3BC,IAAIA,EAAEE,OAAO,CAAC,OAAO;IACvB,OAAO,IAAIH,eAAe,QAAQ;QAChCC,IAAIA,EAAEG,IAAI;IACZ;IAEA,OAAOH;AACT"}
1
+ {"version":3,"sources":["../../src/searching/toSearchQuery.ts"],"sourcesContent":["import { type WhitespaceFilter } from \"./types.js\";\n\n/**\n * @param s - The string to convert\n * @param whitespace - (default: `\"keep\"`)\n * @since 6.0.0\n */\nexport function toSearchQuery(\n s: string,\n whitespace: WhitespaceFilter = \"keep\"\n): string {\n let q = s.toLowerCase();\n if (whitespace === \"ignore\") {\n q = q.replace(/\\s/g, \"\");\n } else if (whitespace === \"trim\") {\n q = q.trim();\n }\n\n return q;\n}\n"],"names":["toSearchQuery","s","whitespace","q","toLowerCase","replace","trim"],"mappings":"AAEA;;;;CAIC,GACD,OAAO,SAASA,cACdC,CAAS,EACTC,aAA+B,MAAM;IAErC,IAAIC,IAAIF,EAAEG,WAAW;IACrB,IAAIF,eAAe,UAAU;QAC3BC,IAAIA,EAAEE,OAAO,CAAC,OAAO;IACvB,OAAO,IAAIH,eAAe,QAAQ;QAChCC,IAAIA,EAAEG,IAAI;IACZ;IAEA,OAAOH;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/searching/types.ts"],"sourcesContent":["import { type TextExtractor } from \"../types.js\";\n\n/**\n * @since 6.0.0\n */\nexport type WhitespaceFilter = \"ignore\" | \"trim\" | \"keep\";\n\n/**\n * @since 6.0.0\n */\nexport interface BaseSearchOptions<T> {\n list: readonly T[];\n\n /**\n * @defaultValue `\"filter\"`\n */\n type?: \"search\" | \"filter\";\n\n /**\n * The current query string. i.e. `\"SeArch\"`\n */\n query: string;\n\n /**\n * This is required if the list includes anything other than strings.\n * @see {@link TextExtractor}\n */\n extractor?: TextExtractor<T>;\n\n /**\n * @defaultValue `\"keep\"`\n */\n whitespace?: WhitespaceFilter;\n}\n"],"names":[],"rangeMappings":";;","mappings":"AAOA;;CAEC,GACD,WAuBC"}
1
+ {"version":3,"sources":["../../src/searching/types.ts"],"sourcesContent":["import { type TextExtractor } from \"../types.js\";\n\n/**\n * @since 6.0.0\n */\nexport type WhitespaceFilter = \"ignore\" | \"trim\" | \"keep\";\n\n/**\n * @since 6.0.0\n */\nexport interface BaseSearchOptions<T> {\n list: readonly T[];\n\n /**\n * @defaultValue `\"filter\"`\n */\n type?: \"search\" | \"filter\";\n\n /**\n * The current query string. i.e. `\"SeArch\"`\n */\n query: string;\n\n /**\n * This is required if the list includes anything other than strings.\n * @see {@link TextExtractor}\n */\n extractor?: TextExtractor<T>;\n\n /**\n * @defaultValue `\"keep\"`\n */\n whitespace?: WhitespaceFilter;\n}\n"],"names":[],"mappings":"AAOA;;CAEC,GACD,WAuBC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/searching/useFuzzyMatch.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useRef } from \"react\";\nimport { createFuzzyRegExp } from \"./fuzzy.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface FuzzyMatchOptions {\n value: string;\n query: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport type FuzzyMatch = (options: FuzzyMatchOptions) => boolean;\n\n/**\n * This hook implements a few optimizations for fuzzy searching and filtering\n * together for large datasets (10,000 or more items) and was really created\n * for the autocomplete component.\n *\n * @since 6.0.0\n */\nexport function useFuzzyMatch(): FuzzyMatch {\n const prevQuery = useRef(\"\");\n const fuzzyRegExp = useRef<RegExp | null>(null);\n\n return useCallback((options: FuzzyMatchOptions) => {\n const { query, value } = options;\n if (!query) {\n return true;\n }\n\n if (!fuzzyRegExp.current || prevQuery.current !== query) {\n prevQuery.current = query;\n fuzzyRegExp.current = createFuzzyRegExp(query);\n }\n\n return value.length > 0 && fuzzyRegExp.current.test(value);\n }, []);\n}\n"],"names":["useCallback","useRef","createFuzzyRegExp","useFuzzyMatch","prevQuery","fuzzyRegExp","options","query","value","current","length","test"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,SAASA,WAAW,EAAEC,MAAM,QAAQ,QAAQ;AAC5C,SAASC,iBAAiB,QAAQ,aAAa;AAe/C;;;;;;CAMC,GACD,OAAO,SAASC;IACd,MAAMC,YAAYH,OAAO;IACzB,MAAMI,cAAcJ,OAAsB;IAE1C,OAAOD,YAAY,CAACM;QAClB,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGF;QACzB,IAAI,CAACC,OAAO;YACV,OAAO;QACT;QAEA,IAAI,CAACF,YAAYI,OAAO,IAAIL,UAAUK,OAAO,KAAKF,OAAO;YACvDH,UAAUK,OAAO,GAAGF;YACpBF,YAAYI,OAAO,GAAGP,kBAAkBK;QAC1C;QAEA,OAAOC,MAAME,MAAM,GAAG,KAAKL,YAAYI,OAAO,CAACE,IAAI,CAACH;IACtD,GAAG,EAAE;AACP"}
1
+ {"version":3,"sources":["../../src/searching/useFuzzyMatch.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useRef } from \"react\";\nimport { createFuzzyRegExp } from \"./fuzzy.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface FuzzyMatchOptions {\n value: string;\n query: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport type FuzzyMatch = (options: FuzzyMatchOptions) => boolean;\n\n/**\n * This hook implements a few optimizations for fuzzy searching and filtering\n * together for large datasets (10,000 or more items) and was really created\n * for the autocomplete component.\n *\n * @since 6.0.0\n */\nexport function useFuzzyMatch(): FuzzyMatch {\n const prevQuery = useRef(\"\");\n const fuzzyRegExp = useRef<RegExp | null>(null);\n\n return useCallback((options: FuzzyMatchOptions) => {\n const { query, value } = options;\n if (!query) {\n return true;\n }\n\n if (!fuzzyRegExp.current || prevQuery.current !== query) {\n prevQuery.current = query;\n fuzzyRegExp.current = createFuzzyRegExp(query);\n }\n\n return value.length > 0 && fuzzyRegExp.current.test(value);\n }, []);\n}\n"],"names":["useCallback","useRef","createFuzzyRegExp","useFuzzyMatch","prevQuery","fuzzyRegExp","options","query","value","current","length","test"],"mappings":"AAAA;AACA,SAASA,WAAW,EAAEC,MAAM,QAAQ,QAAQ;AAC5C,SAASC,iBAAiB,QAAQ,aAAa;AAe/C;;;;;;CAMC,GACD,OAAO,SAASC;IACd,MAAMC,YAAYH,OAAO;IACzB,MAAMI,cAAcJ,OAAsB;IAE1C,OAAOD,YAAY,CAACM;QAClB,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGF;QACzB,IAAI,CAACC,OAAO;YACV,OAAO;QACT;QAEA,IAAI,CAACF,YAAYI,OAAO,IAAIL,UAAUK,OAAO,KAAKF,OAAO;YACvDH,UAAUK,OAAO,GAAGF;YACpBF,YAAYI,OAAO,GAAGP,kBAAkBK;QAC1C;QAEA,OAAOC,MAAME,MAAM,GAAG,KAAKL,YAAYI,OAAO,CAACE,IAAI,CAACH;IACtD,GAAG,EAAE;AACP"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/searching/utils.ts"],"sourcesContent":["import { type TextExtractor } from \"../types.js\";\nimport { toSearchQuery } from \"./toSearchQuery.js\";\nimport { type BaseSearchOptions } from \"./types.js\";\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport const defaultExtractor =\n <T>(name: string) =>\n (item: T): string => {\n if (typeof item === \"string\") {\n return item;\n }\n\n throw new Error(\n `A \\`TextExtractor\\` must be provided to \\`${name}\\` for lists that do not contain strings`\n );\n };\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport interface SearchOptions<T> extends BaseSearchOptions<T> {\n type: \"search\" | \"filter\";\n filter(query: string, value: string): boolean;\n extractor: TextExtractor<T>;\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport function search<T>(\n options: SearchOptions<T>\n): readonly T[] | T | undefined {\n const { list, type, query, filter, extractor, whitespace = \"keep\" } = options;\n const fallback = type === \"search\" ? undefined : list;\n if (!list.length) {\n return fallback;\n }\n\n const q = toSearchQuery(query, whitespace);\n if (!q) {\n return fallback;\n }\n\n const fn = type === \"search\" ? \"find\" : \"filter\";\n return list[fn]((item) =>\n filter(q, toSearchQuery(extractor(item), whitespace))\n );\n}\n"],"names":["toSearchQuery","defaultExtractor","name","item","Error","search","options","list","type","query","filter","extractor","whitespace","fallback","undefined","length","q","fn"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,SAASA,aAAa,QAAQ,qBAAqB;AAGnD;;;CAGC,GACD,OAAO,MAAMC,mBACX,CAAIC,OACJ,CAACC;QACC,IAAI,OAAOA,SAAS,UAAU;YAC5B,OAAOA;QACT;QAEA,MAAM,IAAIC,MACR,CAAC,0CAA0C,EAAEF,KAAK,wCAAwC,CAAC;IAE/F,EAAE;AAYJ;;;CAGC,GACD,OAAO,SAASG,OACdC,OAAyB;IAEzB,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAEC,MAAM,EAAEC,SAAS,EAAEC,aAAa,MAAM,EAAE,GAAGN;IACtE,MAAMO,WAAWL,SAAS,WAAWM,YAAYP;IACjD,IAAI,CAACA,KAAKQ,MAAM,EAAE;QAChB,OAAOF;IACT;IAEA,MAAMG,IAAIhB,cAAcS,OAAOG;IAC/B,IAAI,CAACI,GAAG;QACN,OAAOH;IACT;IAEA,MAAMI,KAAKT,SAAS,WAAW,SAAS;IACxC,OAAOD,IAAI,CAACU,GAAG,CAAC,CAACd,OACfO,OAAOM,GAAGhB,cAAcW,UAAUR,OAAOS;AAE7C"}
1
+ {"version":3,"sources":["../../src/searching/utils.ts"],"sourcesContent":["import { type TextExtractor } from \"../types.js\";\nimport { toSearchQuery } from \"./toSearchQuery.js\";\nimport { type BaseSearchOptions } from \"./types.js\";\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport const defaultExtractor =\n <T>(name: string) =>\n (item: T): string => {\n if (typeof item === \"string\") {\n return item;\n }\n\n throw new Error(\n `A \\`TextExtractor\\` must be provided to \\`${name}\\` for lists that do not contain strings`\n );\n };\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport interface SearchOptions<T> extends BaseSearchOptions<T> {\n type: \"search\" | \"filter\";\n filter(query: string, value: string): boolean;\n extractor: TextExtractor<T>;\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport function search<T>(\n options: SearchOptions<T>\n): readonly T[] | T | undefined {\n const { list, type, query, filter, extractor, whitespace = \"keep\" } = options;\n const fallback = type === \"search\" ? undefined : list;\n if (!list.length) {\n return fallback;\n }\n\n const q = toSearchQuery(query, whitespace);\n if (!q) {\n return fallback;\n }\n\n const fn = type === \"search\" ? \"find\" : \"filter\";\n return list[fn]((item) =>\n filter(q, toSearchQuery(extractor(item), whitespace))\n );\n}\n"],"names":["toSearchQuery","defaultExtractor","name","item","Error","search","options","list","type","query","filter","extractor","whitespace","fallback","undefined","length","q","fn"],"mappings":"AACA,SAASA,aAAa,QAAQ,qBAAqB;AAGnD;;;CAGC,GACD,OAAO,MAAMC,mBACX,CAAIC,OACJ,CAACC;QACC,IAAI,OAAOA,SAAS,UAAU;YAC5B,OAAOA;QACT;QAEA,MAAM,IAAIC,MACR,CAAC,0CAA0C,EAAEF,KAAK,wCAAwC,CAAC;IAE/F,EAAE;AAYJ;;;CAGC,GACD,OAAO,SAASG,OACdC,OAAyB;IAEzB,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAEC,MAAM,EAAEC,SAAS,EAAEC,aAAa,MAAM,EAAE,GAAGN;IACtE,MAAMO,WAAWL,SAAS,WAAWM,YAAYP;IACjD,IAAI,CAACA,KAAKQ,MAAM,EAAE;QAChB,OAAOF;IACT;IAEA,MAAMG,IAAIhB,cAAcS,OAAOG;IAC/B,IAAI,CAACI,GAAG;QACN,OAAOH;IACT;IAEA,MAAMI,KAAKT,SAAS,WAAW,SAAS;IACxC,OAAOD,IAAI,CAACU,GAAG,CAAC,CAACd,OACfO,OAAOM,GAAGhB,cAAcW,UAAUR,OAAOS;AAE7C"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/segmented-button/SegmentedButton.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { getIcon } from \"../icon/iconConfig.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { useMaxWidthTransition } from \"../transition/useMaxWidthTransition.js\";\nimport { segmentedButton } from \"./segmentedButtonStyles.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface SegmentedButtonProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * Set this to `true` to apply selected styles and an optional\n * {@link selectedIcon}\n *\n * @defaultValue `false`\n */\n selected?: boolean;\n\n /** @defaultValue `getIcon(\"selected\")` */\n selectedIcon?: ReactNode;\n\n /**\n * An optional className to apply when {@link selected} is `true`.\n */\n selectedClassName?: string;\n\n /**\n * Set this to `true` to not render the {@link selectedIcon} when\n * {@link selected} is `true`.\n *\n * @defaultValue `false`\n */\n disableSelectedIcon?: boolean;\n\n /**\n * Set this to `true` to disable the {@link selectedIcon} enter/exit\n * transition and instead just use `display: none`.\n *\n * @defaultValue `false`\n */\n disableSelectedTransition?: boolean;\n\n /**\n * An optional addon to render before the {@link children} and after the\n * {@link selectedIcon}. This is only useful when rendering text children so\n * it can appear above the interaction states.\n */\n leftAddon?: ReactNode;\n\n /**\n * An optional addon to render after the {@link children}. This is only useful\n * when rendering text children so it can appear above the interaction states.\n */\n rightAddon?: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import {\n * SegmentedButton,\n * SegmentedButtonContainer,\n * } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n * import { useState } from \"react\";\n *\n * function Example(): ReactElement {\n * const [value, setValue] = useState(\"a\");\n * return (\n * <SegmentedButtonContainer>\n * <SegmentedButton\n * onClick={() => setValue(\"a\")}\n * selected={value === \"a\"}\n * >\n * First\n * </SegmentedButton>\n * <SegmentedButton\n * onClick={() => setValue(\"b\")}\n * selected={value === \"b\"}\n * >\n * Second\n * </SegmentedButton>\n * <SegmentedButton\n * onClick={() => setValue(\"c\")}\n * selected={value === \"c\"}\n * disableSelectedIcon\n * >\n * Third\n * </SegmentedButton>\n * </SegmentedButtonContainer>\n * );\n * }\n * ```\n *\n * @since 6.0.0\n */\nexport const SegmentedButton = forwardRef<\n HTMLButtonElement,\n SegmentedButtonProps\n>(function SegmentedButton(props, ref) {\n const {\n className,\n type = \"button\",\n leftAddon,\n rightAddon,\n children: propChildren,\n selected,\n selectedIcon: propSelectedIcon,\n selectedClassName,\n disableSelectedIcon,\n disableSelectedTransition,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled,\n ...remaining\n } = props;\n\n const children = useHigherContrastChildren(propChildren);\n const selectedIconNode = getIcon(\"selected\", propSelectedIcon);\n const selectedIcon = useMaxWidthTransition({\n element: selectedIconNode,\n transitionIn: !!selected,\n disabled: disableSelectedIcon,\n disableTransition: disableSelectedTransition,\n });\n const { pressedClassName, handlers, ripples } = useElementInteraction({\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled,\n });\n\n return (\n <button\n {...remaining}\n {...handlers}\n aria-pressed={selected}\n ref={ref}\n type={type}\n disabled={disabled}\n className={segmentedButton({\n className,\n selected,\n selectedClassName,\n pressedClassName,\n })}\n >\n {!disableSelectedIcon && selectedIcon}\n {leftAddon}\n {children}\n {rightAddon}\n {ripples}\n </button>\n );\n});\n"],"names":["forwardRef","getIcon","useElementInteraction","useHigherContrastChildren","useMaxWidthTransition","segmentedButton","SegmentedButton","props","ref","className","type","leftAddon","rightAddon","children","propChildren","selected","selectedIcon","propSelectedIcon","selectedClassName","disableSelectedIcon","disableSelectedTransition","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","disabled","remaining","selectedIconNode","element","transitionIn","disableTransition","pressedClassName","handlers","ripples","button","aria-pressed"],"rangeMappings":";;;;;;;;;;;;;;;;;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A;QACNsB,UAAUA;QACVvB,WAAWJ,gBAAgB;YACzBI;YACAM;YACAG;YACAoB;QACF;;YAEC,CAACnB,uBAAuBH;YACxBL;YACAE;YACAD;YACA4B;;;AAGP,GAAG"}
1
+ {"version":3,"sources":["../../src/segmented-button/SegmentedButton.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { getIcon } from \"../icon/iconConfig.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { useMaxWidthTransition } from \"../transition/useMaxWidthTransition.js\";\nimport { segmentedButton } from \"./segmentedButtonStyles.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface SegmentedButtonProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * Set this to `true` to apply selected styles and an optional\n * {@link selectedIcon}\n *\n * @defaultValue `false`\n */\n selected?: boolean;\n\n /** @defaultValue `getIcon(\"selected\")` */\n selectedIcon?: ReactNode;\n\n /**\n * An optional className to apply when {@link selected} is `true`.\n */\n selectedClassName?: string;\n\n /**\n * Set this to `true` to not render the {@link selectedIcon} when\n * {@link selected} is `true`.\n *\n * @defaultValue `false`\n */\n disableSelectedIcon?: boolean;\n\n /**\n * Set this to `true` to disable the {@link selectedIcon} enter/exit\n * transition and instead just use `display: none`.\n *\n * @defaultValue `false`\n */\n disableSelectedTransition?: boolean;\n\n /**\n * An optional addon to render before the {@link children} and after the\n * {@link selectedIcon}. This is only useful when rendering text children so\n * it can appear above the interaction states.\n */\n leftAddon?: ReactNode;\n\n /**\n * An optional addon to render after the {@link children}. This is only useful\n * when rendering text children so it can appear above the interaction states.\n */\n rightAddon?: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import {\n * SegmentedButton,\n * SegmentedButtonContainer,\n * } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n * import { useState } from \"react\";\n *\n * function Example(): ReactElement {\n * const [value, setValue] = useState(\"a\");\n * return (\n * <SegmentedButtonContainer>\n * <SegmentedButton\n * onClick={() => setValue(\"a\")}\n * selected={value === \"a\"}\n * >\n * First\n * </SegmentedButton>\n * <SegmentedButton\n * onClick={() => setValue(\"b\")}\n * selected={value === \"b\"}\n * >\n * Second\n * </SegmentedButton>\n * <SegmentedButton\n * onClick={() => setValue(\"c\")}\n * selected={value === \"c\"}\n * disableSelectedIcon\n * >\n * Third\n * </SegmentedButton>\n * </SegmentedButtonContainer>\n * );\n * }\n * ```\n *\n * @since 6.0.0\n */\nexport const SegmentedButton = forwardRef<\n HTMLButtonElement,\n SegmentedButtonProps\n>(function SegmentedButton(props, ref) {\n const {\n className,\n type = \"button\",\n leftAddon,\n rightAddon,\n children: propChildren,\n selected,\n selectedIcon: propSelectedIcon,\n selectedClassName,\n disableSelectedIcon,\n disableSelectedTransition,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled,\n ...remaining\n } = props;\n\n const children = useHigherContrastChildren(propChildren);\n const selectedIconNode = getIcon(\"selected\", propSelectedIcon);\n const selectedIcon = useMaxWidthTransition({\n element: selectedIconNode,\n transitionIn: !!selected,\n disabled: disableSelectedIcon,\n disableTransition: disableSelectedTransition,\n });\n const { pressedClassName, handlers, ripples } = useElementInteraction({\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled,\n });\n\n return (\n <button\n {...remaining}\n {...handlers}\n aria-pressed={selected}\n ref={ref}\n type={type}\n disabled={disabled}\n className={segmentedButton({\n className,\n selected,\n selectedClassName,\n pressedClassName,\n })}\n >\n {!disableSelectedIcon && selectedIcon}\n {leftAddon}\n {children}\n {rightAddon}\n {ripples}\n </button>\n );\n});\n"],"names":["forwardRef","getIcon","useElementInteraction","useHigherContrastChildren","useMaxWidthTransition","segmentedButton","SegmentedButton","props","ref","className","type","leftAddon","rightAddon","children","propChildren","selected","selectedIcon","propSelectedIcon","selectedClassName","disableSelectedIcon","disableSelectedTransition","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","disabled","remaining","selectedIconNode","element","transitionIn","disableTransition","pressedClassName","handlers","ripples","button","aria-pressed"],"mappings":"AAAA;;AACA,SAASA,UAAU,QAAmD,QAAQ;AAC9E,SAASC,OAAO,QAAQ,wBAAwB;AAChD,SAASC,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AACxF,SAASC,qBAAqB,QAAQ,yCAAyC;AAC/E,SAASC,eAAe,QAAQ,6BAA6B;AAqD7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCC,GACD,OAAO,MAAMC,gCAAkBN,WAG7B,SAASM,gBAAgBC,KAAK,EAAEC,GAAG;IACnC,MAAM,EACJC,SAAS,EACTC,OAAO,QAAQ,EACfC,SAAS,EACTC,UAAU,EACVC,UAAUC,YAAY,EACtBC,QAAQ,EACRC,cAAcC,gBAAgB,EAC9BC,iBAAiB,EACjBC,mBAAmB,EACnBC,yBAAyB,EACzBC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,WAAW,EACXC,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,QAAQ,EACR,GAAGC,WACJ,GAAG1B;IAEJ,MAAMM,WAAWV,0BAA0BW;IAC3C,MAAMoB,mBAAmBjC,QAAQ,YAAYgB;IAC7C,MAAMD,eAAeZ,sBAAsB;QACzC+B,SAASD;QACTE,cAAc,CAAC,CAACrB;QAChBiB,UAAUb;QACVkB,mBAAmBjB;IACrB;IACA,MAAM,EAAEkB,gBAAgB,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAGtC,sBAAsB;QACpEmB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,qBACE,MAACS;QACE,GAAGR,SAAS;QACZ,GAAGM,QAAQ;QACZG,gBAAc3B;QACdP,KAAKA;QACLE,MAAMA;QACNsB,UAAUA;QACVvB,WAAWJ,gBAAgB;YACzBI;YACAM;YACAG;YACAoB;QACF;;YAEC,CAACnB,uBAAuBH;YACxBL;YACAE;YACAD;YACA4B;;;AAGP,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/segmented-button/SegmentedButtonContainer.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport {\n segmentedButtonContainerStyles,\n type SegmentedButtonContainerClassNameOptions,\n} from \"./segmentedButtonContainerStyles.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface SegmentedButtonContainerProps\n extends HTMLAttributes<HTMLDivElement>,\n SegmentedButtonContainerClassNameOptions {\n children: ReactNode;\n}\n\n/**\n * **Server Component**\n *\n * Simple wrapper `div` to apply the segmented button container styles. You can\n * just use the {@link segmentedButtonContainerStyles} util function instead.\n *\n * @example Without This Component\n * ```tsx\n * import {\n * SegmentedButton,\n * segmentedButtonContainerStyles,\n * } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * import { CustomWrapperComponent } from \"./CustomWrapperComponent.jsx\";\n *\n * function Example(): ReactElement {\n * return (\n * <CustomWrapperComponent className={segmentedButtonContainerStyles()}>\n * <SegmentedButton>One</SegmentedButton>\n * <SegmentedButton>Two</SegmentedButton>\n * <SegmentedButton>Three</SegmentedButton>\n * </CustomWrapperComponent>\n * );\n * }\n * ```\n *\n * @since 6.0.0\n */\nexport const SegmentedButtonContainer = forwardRef<\n HTMLDivElement,\n SegmentedButtonContainerProps\n>(function SegmentedButtonContainer(props, ref) {\n const { className, disableFullWidth, children, ...remaining } = props;\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={segmentedButtonContainerStyles({\n className,\n disableFullWidth,\n })}\n >\n {children}\n </div>\n );\n});\n"],"names":["forwardRef","segmentedButtonContainerStyles","SegmentedButtonContainer","props","ref","className","disableFullWidth","children","remaining","div"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,SAASA,UAAU,QAA6C,QAAQ;AACxE,SACEC,8BAA8B,QAEzB,sCAAsC;AAW7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BC,GACD,OAAO,MAAMC,yCAA2BF,WAGtC,SAASE,yBAAyBC,KAAK,EAAEC,GAAG;IAC5C,MAAM,EAAEC,SAAS,EAAEC,gBAAgB,EAAEC,QAAQ,EAAE,GAAGC,WAAW,GAAGL;IAEhE,qBACE,KAACM;QACE,GAAGD,SAAS;QACbJ,KAAKA;QACLC,WAAWJ,+BAA+B;YACxCI;YACAC;QACF;kBAECC;;AAGP,GAAG"}
1
+ {"version":3,"sources":["../../src/segmented-button/SegmentedButtonContainer.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport {\n segmentedButtonContainerStyles,\n type SegmentedButtonContainerClassNameOptions,\n} from \"./segmentedButtonContainerStyles.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface SegmentedButtonContainerProps\n extends HTMLAttributes<HTMLDivElement>,\n SegmentedButtonContainerClassNameOptions {\n children: ReactNode;\n}\n\n/**\n * **Server Component**\n *\n * Simple wrapper `div` to apply the segmented button container styles. You can\n * just use the {@link segmentedButtonContainerStyles} util function instead.\n *\n * @example Without This Component\n * ```tsx\n * import {\n * SegmentedButton,\n * segmentedButtonContainerStyles,\n * } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * import { CustomWrapperComponent } from \"./CustomWrapperComponent.jsx\";\n *\n * function Example(): ReactElement {\n * return (\n * <CustomWrapperComponent className={segmentedButtonContainerStyles()}>\n * <SegmentedButton>One</SegmentedButton>\n * <SegmentedButton>Two</SegmentedButton>\n * <SegmentedButton>Three</SegmentedButton>\n * </CustomWrapperComponent>\n * );\n * }\n * ```\n *\n * @since 6.0.0\n */\nexport const SegmentedButtonContainer = forwardRef<\n HTMLDivElement,\n SegmentedButtonContainerProps\n>(function SegmentedButtonContainer(props, ref) {\n const { className, disableFullWidth, children, ...remaining } = props;\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={segmentedButtonContainerStyles({\n className,\n disableFullWidth,\n })}\n >\n {children}\n </div>\n );\n});\n"],"names":["forwardRef","segmentedButtonContainerStyles","SegmentedButtonContainer","props","ref","className","disableFullWidth","children","remaining","div"],"mappings":";AAAA,SAASA,UAAU,QAA6C,QAAQ;AACxE,SACEC,8BAA8B,QAEzB,sCAAsC;AAW7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BC,GACD,OAAO,MAAMC,yCAA2BF,WAGtC,SAASE,yBAAyBC,KAAK,EAAEC,GAAG;IAC5C,MAAM,EAAEC,SAAS,EAAEC,gBAAgB,EAAEC,QAAQ,EAAE,GAAGC,WAAW,GAAGL;IAEhE,qBACE,KAACM;QACE,GAAGD,SAAS;QACbJ,KAAKA;QACLC,WAAWJ,+BAA+B;YACxCI;YACAC;QACF;kBAECC;;AAGP,GAAG"}