@react-md/core 1.0.0-next.16 → 1.0.0-next.18

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 (665) hide show
  1. package/dist/_box-shadows.scss +76 -0
  2. package/dist/_colors.scss +279 -277
  3. package/dist/_core.scss +107 -16
  4. package/dist/_object-fit.scss +86 -0
  5. package/dist/_utils.scss +246 -72
  6. package/dist/app-bar/AppBar.d.ts +1 -90
  7. package/dist/app-bar/AppBar.js +1 -40
  8. package/dist/app-bar/AppBar.js.map +1 -1
  9. package/dist/app-bar/AppBarTitle.d.ts +1 -27
  10. package/dist/app-bar/AppBarTitle.js +1 -15
  11. package/dist/app-bar/AppBarTitle.js.map +1 -1
  12. package/dist/app-bar/_app-bar.scss +156 -25
  13. package/dist/app-bar/styles.d.ts +117 -0
  14. package/dist/app-bar/styles.js +55 -0
  15. package/dist/app-bar/styles.js.map +1 -0
  16. package/dist/autocomplete/Autocomplete.d.ts +8 -79
  17. package/dist/autocomplete/Autocomplete.js +112 -83
  18. package/dist/autocomplete/Autocomplete.js.map +1 -1
  19. package/dist/autocomplete/AutocompleteChip.d.ts +8 -0
  20. package/dist/autocomplete/AutocompleteChip.js +34 -0
  21. package/dist/autocomplete/AutocompleteChip.js.map +1 -0
  22. package/dist/autocomplete/AutocompleteCircularProgress.d.ts +5 -11
  23. package/dist/autocomplete/AutocompleteCircularProgress.js +4 -0
  24. package/dist/autocomplete/AutocompleteCircularProgress.js.map +1 -1
  25. package/dist/autocomplete/AutocompleteClearButton.d.ts +9 -0
  26. package/dist/autocomplete/AutocompleteClearButton.js +29 -0
  27. package/dist/autocomplete/AutocompleteClearButton.js.map +1 -0
  28. package/dist/autocomplete/AutocompleteDropdownButton.d.ts +4 -26
  29. package/dist/autocomplete/AutocompleteDropdownButton.js +5 -1
  30. package/dist/autocomplete/AutocompleteDropdownButton.js.map +1 -1
  31. package/dist/autocomplete/AutocompleteListboxChildren.d.ts +22 -0
  32. package/dist/autocomplete/AutocompleteListboxChildren.js +37 -0
  33. package/dist/autocomplete/AutocompleteListboxChildren.js.map +1 -0
  34. package/dist/autocomplete/_autocomplete.scss +362 -34
  35. package/dist/autocomplete/autocompleteStyles.d.ts +22 -0
  36. package/dist/autocomplete/autocompleteStyles.js +17 -8
  37. package/dist/autocomplete/autocompleteStyles.js.map +1 -1
  38. package/dist/autocomplete/defaults.d.ts +9 -9
  39. package/dist/autocomplete/defaults.js +13 -13
  40. package/dist/autocomplete/defaults.js.map +1 -1
  41. package/dist/autocomplete/types.d.ts +554 -56
  42. package/dist/autocomplete/types.js.map +1 -1
  43. package/dist/autocomplete/useAutocomplete.d.ts +22 -0
  44. package/dist/autocomplete/useAutocomplete.js +281 -0
  45. package/dist/autocomplete/useAutocomplete.js.map +1 -0
  46. package/dist/autocomplete/utils.d.ts +81 -0
  47. package/dist/autocomplete/utils.js +108 -0
  48. package/dist/autocomplete/utils.js.map +1 -0
  49. package/dist/avatar/_avatar.scss +93 -2
  50. package/dist/badge/Badge.d.ts +1 -20
  51. package/dist/badge/Badge.js +1 -14
  52. package/dist/badge/Badge.js.map +1 -1
  53. package/dist/badge/_badge.scss +90 -3
  54. package/dist/badge/styles.d.ts +26 -0
  55. package/dist/badge/styles.js +18 -0
  56. package/dist/badge/styles.js.map +1 -0
  57. package/dist/box/Box.js +2 -1
  58. package/dist/box/Box.js.map +1 -1
  59. package/dist/box/_box.scss +130 -17
  60. package/dist/box/styles.d.ts +6 -0
  61. package/dist/box/styles.js +2 -1
  62. package/dist/box/styles.js.map +1 -1
  63. package/dist/button/AsyncButton.d.ts +1 -1
  64. package/dist/button/AsyncButton.js.map +1 -1
  65. package/dist/button/Button.d.ts +2 -1
  66. package/dist/button/Button.js +2 -1
  67. package/dist/button/Button.js.map +1 -1
  68. package/dist/button/_button.scss +157 -25
  69. package/dist/card/Card.d.ts +16 -0
  70. package/dist/card/Card.js +11 -3
  71. package/dist/card/Card.js.map +1 -1
  72. package/dist/card/ClickableCard.d.ts +2 -1
  73. package/dist/card/ClickableCard.js +5 -2
  74. package/dist/card/ClickableCard.js.map +1 -1
  75. package/dist/card/_card.scss +90 -19
  76. package/dist/card/styles.d.ts +0 -7
  77. package/dist/card/styles.js +2 -3
  78. package/dist/card/styles.js.map +1 -1
  79. package/dist/chip/Chip.d.ts +2 -1
  80. package/dist/chip/Chip.js +2 -1
  81. package/dist/chip/Chip.js.map +1 -1
  82. package/dist/chip/_chip.scss +45 -22
  83. package/dist/chip/styles.d.ts +12 -10
  84. package/dist/chip/styles.js.map +1 -1
  85. package/dist/cssUtils.js.map +1 -1
  86. package/dist/delegateEvent.d.ts +2 -2
  87. package/dist/delegateEvent.js.map +1 -1
  88. package/dist/dialog/Dialog.d.ts +8 -21
  89. package/dist/dialog/Dialog.js +27 -27
  90. package/dist/dialog/Dialog.js.map +1 -1
  91. package/dist/dialog/FixedDialog.d.ts +1 -3
  92. package/dist/dialog/FixedDialog.js +0 -8
  93. package/dist/dialog/FixedDialog.js.map +1 -1
  94. package/dist/dialog/_dialog.scss +67 -13
  95. package/dist/dialog/styles.d.ts +56 -0
  96. package/dist/dialog/styles.js +29 -2
  97. package/dist/dialog/styles.js.map +1 -1
  98. package/dist/divider/Divider.d.ts +0 -11
  99. package/dist/divider/Divider.js.map +1 -1
  100. package/dist/divider/_divider.scss +7 -1
  101. package/dist/divider/styles.d.ts +11 -0
  102. package/dist/divider/styles.js.map +1 -1
  103. package/dist/draggable/useDraggable.d.ts +6 -6
  104. package/dist/draggable/useDraggable.js.map +1 -1
  105. package/dist/draggable/utils.d.ts +3 -3
  106. package/dist/draggable/utils.js.map +1 -1
  107. package/dist/expansion-panel/ExpansionPanel.d.ts +1 -1
  108. package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
  109. package/dist/expansion-panel/_expansion-panel.scss +5 -1
  110. package/dist/expansion-panel/useExpansionPanels.js +12 -24
  111. package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
  112. package/dist/{form → files}/FileInput.d.ts +3 -6
  113. package/dist/{form → files}/FileInput.js +3 -6
  114. package/dist/files/FileInput.js.map +1 -0
  115. package/dist/files/_files.scss +22 -0
  116. package/dist/files/styles.d.ts +5 -0
  117. package/dist/files/styles.js +7 -0
  118. package/dist/files/styles.js.map +1 -0
  119. package/dist/{form → files}/useFileUpload.d.ts +7 -9
  120. package/dist/{form → files}/useFileUpload.js +5 -7
  121. package/dist/files/useFileUpload.js.map +1 -0
  122. package/dist/files/utils.d.ts +169 -0
  123. package/dist/files/utils.js +114 -0
  124. package/dist/files/utils.js.map +1 -0
  125. package/dist/{form/fileUtils.d.ts → files/validation.d.ts} +11 -176
  126. package/dist/{form/fileUtils.js → files/validation.js} +10 -135
  127. package/dist/files/validation.js.map +1 -0
  128. package/dist/focus/useFocusContainer.d.ts +2 -2
  129. package/dist/focus/useFocusContainer.js.map +1 -1
  130. package/dist/focus/utils.js.map +1 -1
  131. package/dist/form/FormMessage.js.map +1 -1
  132. package/dist/form/FormMessageContainer.js +4 -2
  133. package/dist/form/FormMessageContainer.js.map +1 -1
  134. package/dist/form/InputToggle.d.ts +2 -1
  135. package/dist/form/InputToggle.js +2 -1
  136. package/dist/form/InputToggle.js.map +1 -1
  137. package/dist/form/InputToggleIcon.js.map +1 -1
  138. package/dist/form/Label.js +2 -2
  139. package/dist/form/Label.js.map +1 -1
  140. package/dist/form/Listbox.d.ts +24 -0
  141. package/dist/form/Listbox.js +46 -0
  142. package/dist/form/Listbox.js.map +1 -0
  143. package/dist/form/ListboxProvider.d.ts +21 -0
  144. package/dist/form/{useListboxProvider.js → ListboxProvider.js} +1 -1
  145. package/dist/form/ListboxProvider.js.map +1 -0
  146. package/dist/form/MenuItemTextField.js +1 -2
  147. package/dist/form/MenuItemTextField.js.map +1 -1
  148. package/dist/form/NativeSelect.js +7 -4
  149. package/dist/form/NativeSelect.js.map +1 -1
  150. package/dist/form/Option.d.ts +49 -10
  151. package/dist/form/Option.js +11 -9
  152. package/dist/form/Option.js.map +1 -1
  153. package/dist/form/Password.js.map +1 -1
  154. package/dist/form/Select.d.ts +2 -2
  155. package/dist/form/Select.js +81 -85
  156. package/dist/form/Select.js.map +1 -1
  157. package/dist/form/SelectedOption.js +2 -1
  158. package/dist/form/SelectedOption.js.map +1 -1
  159. package/dist/form/Slider.d.ts +4 -4
  160. package/dist/form/Slider.js +6 -2
  161. package/dist/form/Slider.js.map +1 -1
  162. package/dist/form/SliderThumb.d.ts +3 -3
  163. package/dist/form/SliderThumb.js.map +1 -1
  164. package/dist/form/SliderValueMarks.d.ts +2 -2
  165. package/dist/form/SliderValueMarks.js.map +1 -1
  166. package/dist/form/SliderValueTooltip.js.map +1 -1
  167. package/dist/form/TextArea.js +1 -2
  168. package/dist/form/TextArea.js.map +1 -1
  169. package/dist/form/TextField.js +1 -2
  170. package/dist/form/TextField.js.map +1 -1
  171. package/dist/form/TextFieldContainer.js +1 -2
  172. package/dist/form/TextFieldContainer.js.map +1 -1
  173. package/dist/form/_form.scss +193 -124
  174. package/dist/form/formMessageContainerStyles.d.ts +10 -0
  175. package/dist/form/formMessageContainerStyles.js +11 -0
  176. package/dist/form/formMessageContainerStyles.js.map +1 -0
  177. package/dist/form/inputToggleStyles.js.map +1 -1
  178. package/dist/form/optionStyles.d.ts +1 -0
  179. package/dist/form/optionStyles.js +2 -2
  180. package/dist/form/optionStyles.js.map +1 -1
  181. package/dist/form/selectUtils.js.map +1 -1
  182. package/dist/form/sliderUtils.d.ts +1 -1
  183. package/dist/form/sliderUtils.js.map +1 -1
  184. package/dist/form/textFieldContainerStyles.d.ts +0 -2
  185. package/dist/form/textFieldContainerStyles.js +1 -2
  186. package/dist/form/textFieldContainerStyles.js.map +1 -1
  187. package/dist/form/types.d.ts +3 -10
  188. package/dist/form/types.js.map +1 -1
  189. package/dist/form/useCheckboxGroup.d.ts +17 -17
  190. package/dist/form/useCheckboxGroup.js +9 -17
  191. package/dist/form/useCheckboxGroup.js.map +1 -1
  192. package/dist/form/useCombobox.d.ts +56 -21
  193. package/dist/form/useCombobox.js +19 -4
  194. package/dist/form/useCombobox.js.map +1 -1
  195. package/dist/form/useEditableCombobox.d.ts +24 -4
  196. package/dist/form/useEditableCombobox.js +5 -0
  197. package/dist/form/useEditableCombobox.js.map +1 -1
  198. package/dist/form/useNumberField.js.map +1 -1
  199. package/dist/form/useRadioGroup.d.ts +6 -6
  200. package/dist/form/useRadioGroup.js.map +1 -1
  201. package/dist/form/useResizingTextArea.js.map +1 -1
  202. package/dist/form/useSelectCombobox.d.ts +3 -4
  203. package/dist/form/useSelectCombobox.js.map +1 -1
  204. package/dist/form/useTextField.d.ts +1 -1
  205. package/dist/form/useTextField.js.map +1 -1
  206. package/dist/form/useTextFieldContainerAddons.js.map +1 -1
  207. package/dist/hoverMode/useHoverMode.d.ts +3 -3
  208. package/dist/hoverMode/useHoverMode.js.map +1 -1
  209. package/dist/hoverMode/useHoverModeProvider.d.ts +4 -4
  210. package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
  211. package/dist/icon/FontIcon.d.ts +4 -2
  212. package/dist/icon/FontIcon.js.map +1 -1
  213. package/dist/icon/TextIconSpacing.d.ts +3 -1
  214. package/dist/icon/TextIconSpacing.js.map +1 -1
  215. package/dist/icon/_icon.scss +151 -2
  216. package/dist/icon/iconConfig.d.ts +10 -0
  217. package/dist/icon/iconConfig.js +7 -0
  218. package/dist/icon/iconConfig.js.map +1 -1
  219. package/dist/icon/materialConfig.js.map +1 -1
  220. package/dist/icon/styles.js.map +1 -1
  221. package/dist/interaction/UserInteractionModeProvider.d.ts +5 -5
  222. package/dist/interaction/UserInteractionModeProvider.js +12 -8
  223. package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
  224. package/dist/interaction/types.d.ts +20 -2
  225. package/dist/interaction/types.js.map +1 -1
  226. package/dist/interaction/useElementInteraction.d.ts +7 -1
  227. package/dist/interaction/useElementInteraction.js +1 -2
  228. package/dist/interaction/useElementInteraction.js.map +1 -1
  229. package/dist/interaction/utils.d.ts +2 -2
  230. package/dist/interaction/utils.js +2 -2
  231. package/dist/interaction/utils.js.map +1 -1
  232. package/dist/layout/LayoutWindowSplitter.js.map +1 -1
  233. package/dist/layout/_layout.scss +23 -10
  234. package/dist/layout/useExpandableLayout.d.ts +3 -3
  235. package/dist/layout/useExpandableLayout.js.map +1 -1
  236. package/dist/layout/useLayoutAppBarHeight.d.ts +2 -3
  237. package/dist/layout/useLayoutAppBarHeight.js.map +1 -1
  238. package/dist/layout/useTemporaryLayout.d.ts +2 -2
  239. package/dist/layout/useTemporaryLayout.js.map +1 -1
  240. package/dist/link/SkipToMainContent.js.map +1 -1
  241. package/dist/list/ListItem.d.ts +2 -1
  242. package/dist/list/ListItem.js +2 -1
  243. package/dist/list/ListItem.js.map +1 -1
  244. package/dist/list/ListItemChildren.js.map +1 -1
  245. package/dist/list/ListItemLink.d.ts +2 -1
  246. package/dist/list/ListItemLink.js +2 -1
  247. package/dist/list/ListItemLink.js.map +1 -1
  248. package/dist/list/_list.scss +6 -5
  249. package/dist/media-queries/_media-queries.scss +12 -0
  250. package/dist/media-queries/appSize.js.map +1 -1
  251. package/dist/media-queries/useMediaQuery.js +3 -1
  252. package/dist/media-queries/useMediaQuery.js.map +1 -1
  253. package/dist/menu/DropdownMenu.js.map +1 -1
  254. package/dist/menu/Menu.d.ts +8 -3
  255. package/dist/menu/Menu.js +2 -1
  256. package/dist/menu/Menu.js.map +1 -1
  257. package/dist/menu/MenuItemButton.js +6 -2
  258. package/dist/menu/MenuItemButton.js.map +1 -1
  259. package/dist/menu/useContextMenu.d.ts +3 -3
  260. package/dist/menu/useContextMenu.js.map +1 -1
  261. package/dist/movement/types.d.ts +5 -5
  262. package/dist/movement/types.js.map +1 -1
  263. package/dist/navigation/CollapsibleNavGroup.d.ts +5 -3
  264. package/dist/navigation/CollapsibleNavGroup.js +3 -4
  265. package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
  266. package/dist/navigation/DefaultNavigationRenderer.d.ts +1 -2
  267. package/dist/navigation/DefaultNavigationRenderer.js +6 -2
  268. package/dist/navigation/DefaultNavigationRenderer.js.map +1 -1
  269. package/dist/navigation/NavItemButton.d.ts +1 -1
  270. package/dist/navigation/NavItemButton.js +1 -0
  271. package/dist/navigation/NavItemButton.js.map +1 -1
  272. package/dist/navigation/NavItemLink.d.ts +3 -2
  273. package/dist/navigation/NavItemLink.js +6 -2
  274. package/dist/navigation/NavItemLink.js.map +1 -1
  275. package/dist/navigation/NavSubheader.d.ts +2 -3
  276. package/dist/navigation/NavSubheader.js.map +1 -1
  277. package/dist/navigation/Navigation.d.ts +1 -1
  278. package/dist/navigation/Navigation.js.map +1 -1
  279. package/dist/navigation/_navigation.scss +6 -5
  280. package/dist/navigation/types.d.ts +54 -6
  281. package/dist/navigation/types.js.map +1 -1
  282. package/dist/navigation/useActiveHeadingId.d.ts +1 -1
  283. package/dist/navigation/useActiveHeadingId.js.map +1 -1
  284. package/dist/navigation/useNavigationExpansion.d.ts +104 -0
  285. package/dist/navigation/useNavigationExpansion.js +77 -0
  286. package/dist/navigation/useNavigationExpansion.js.map +1 -0
  287. package/dist/navigation/utils.d.ts +13 -0
  288. package/dist/navigation/utils.js +36 -0
  289. package/dist/navigation/utils.js.map +1 -0
  290. package/dist/objectFit.d.ts +69 -0
  291. package/dist/objectFit.js +52 -0
  292. package/dist/objectFit.js.map +1 -0
  293. package/dist/overlay/_overlay.scss +2 -1
  294. package/dist/positioning/useFixedPositioning.d.ts +17 -4
  295. package/dist/positioning/useFixedPositioning.js +10 -5
  296. package/dist/positioning/useFixedPositioning.js.map +1 -1
  297. package/dist/positioning/utils.js.map +1 -1
  298. package/dist/progress/LinearProgress.js.map +1 -1
  299. package/dist/progress/_progress.scss +20 -14
  300. package/dist/responsive-item/ResponsiveItem.d.ts +64 -0
  301. package/dist/responsive-item/ResponsiveItem.js +68 -0
  302. package/dist/responsive-item/ResponsiveItem.js.map +1 -0
  303. package/dist/responsive-item/ResponsiveItemOverlay.d.ts +1 -19
  304. package/dist/responsive-item/ResponsiveItemOverlay.js +1 -12
  305. package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
  306. package/dist/responsive-item/_responsive-item.scss +110 -133
  307. package/dist/responsive-item/responsiveItemOverlayStyles.d.ts +19 -0
  308. package/dist/responsive-item/responsiveItemOverlayStyles.js +14 -0
  309. package/dist/responsive-item/responsiveItemOverlayStyles.js.map +1 -0
  310. package/dist/responsive-item/responsiveItemStyles.d.ts +52 -0
  311. package/dist/responsive-item/responsiveItemStyles.js +15 -0
  312. package/dist/responsive-item/responsiveItemStyles.js.map +1 -0
  313. package/dist/scroll/useScrollLock.d.ts +5 -0
  314. package/dist/scroll/useScrollLock.js.map +1 -1
  315. package/dist/searching/utils.d.ts +2 -2
  316. package/dist/searching/utils.js.map +1 -1
  317. package/dist/segmented-button/SegmentedButton.d.ts +2 -1
  318. package/dist/segmented-button/SegmentedButton.js +2 -1
  319. package/dist/segmented-button/SegmentedButton.js.map +1 -1
  320. package/dist/segmented-button/_segmented-button.scss +6 -6
  321. package/dist/sheet/_sheet.scss +18 -6
  322. package/dist/snackbar/ToastManager.js +15 -5
  323. package/dist/snackbar/ToastManager.js.map +1 -1
  324. package/dist/snackbar/_snackbar.scss +30 -17
  325. package/dist/snackbar/useCurrentToastActions.d.ts +5 -5
  326. package/dist/snackbar/useCurrentToastActions.js.map +1 -1
  327. package/dist/table/_table.scss +15 -3
  328. package/dist/table/tableCellStyles.d.ts +7 -3
  329. package/dist/table/tableCellStyles.js +2 -2
  330. package/dist/table/tableCellStyles.js.map +1 -1
  331. package/dist/tabs/Tab.d.ts +2 -1
  332. package/dist/tabs/Tab.js +2 -1
  333. package/dist/tabs/Tab.js.map +1 -1
  334. package/dist/tabs/TabList.d.ts +2 -2
  335. package/dist/tabs/TabList.js.map +1 -1
  336. package/dist/tabs/TabListScrollButton.d.ts +1 -1
  337. package/dist/tabs/TabListScrollButton.js +1 -1
  338. package/dist/tabs/TabListScrollButton.js.map +1 -1
  339. package/dist/tabs/_tabs.scss +30 -9
  340. package/dist/tabs/getTabListScrollToOptions.d.ts +18 -0
  341. package/dist/tabs/getTabListScrollToOptions.js +19 -0
  342. package/dist/tabs/getTabListScrollToOptions.js.map +1 -0
  343. package/dist/tabs/tabStyles.d.ts +3 -0
  344. package/dist/tabs/tabStyles.js.map +1 -1
  345. package/dist/tabs/useTabList.d.ts +1 -8
  346. package/dist/tabs/useTabList.js +1 -0
  347. package/dist/tabs/useTabList.js.map +1 -1
  348. package/dist/tabs/useTabs.d.ts +6 -6
  349. package/dist/tabs/useTabs.js.map +1 -1
  350. package/dist/tabs/utils.d.ts +0 -18
  351. package/dist/tabs/utils.js +0 -15
  352. package/dist/tabs/utils.js.map +1 -1
  353. package/dist/test-utils/ResizeObserver.d.ts +11 -12
  354. package/dist/test-utils/ResizeObserver.js +11 -12
  355. package/dist/test-utils/ResizeObserver.js.map +1 -1
  356. package/dist/test-utils/matchMedia.d.ts +3 -3
  357. package/dist/test-utils/matchMedia.js +6 -6
  358. package/dist/test-utils/matchMedia.js.map +1 -1
  359. package/dist/test-utils/polyfills/TextDecoder.js +0 -1
  360. package/dist/test-utils/polyfills/TextDecoder.js.map +1 -1
  361. package/dist/test-utils/timers.d.ts +9 -5
  362. package/dist/test-utils/timers.js +5 -5
  363. package/dist/test-utils/timers.js.map +1 -1
  364. package/dist/theme/LocalStorageColorSchemeProvider.d.ts +1 -1
  365. package/dist/theme/LocalStorageColorSchemeProvider.js +2 -1
  366. package/dist/theme/LocalStorageColorSchemeProvider.js.map +1 -1
  367. package/dist/theme/ThemeProvider.js +3 -1
  368. package/dist/theme/ThemeProvider.js.map +1 -1
  369. package/dist/theme/_a11y.scss +86 -13
  370. package/dist/theme/_colors.scss +279 -277
  371. package/dist/theme/_theme.scss +308 -37
  372. package/dist/theme/isColorScheme.d.ts +16 -0
  373. package/dist/theme/isColorScheme.js +19 -0
  374. package/dist/theme/isColorScheme.js.map +1 -0
  375. package/dist/theme/types.d.ts +53 -1
  376. package/dist/theme/types.js +1 -23
  377. package/dist/theme/types.js.map +1 -1
  378. package/dist/theme/useCSSVariables.d.ts +2 -19
  379. package/dist/theme/useCSSVariables.js.map +1 -1
  380. package/dist/theme/useColorScheme.d.ts +1 -35
  381. package/dist/theme/useColorScheme.js.map +1 -1
  382. package/dist/theme/useColorSchemeMetaTag.d.ts +1 -1
  383. package/dist/theme/useColorSchemeMetaTag.js.map +1 -1
  384. package/dist/theme/useColorSchemeProvider.d.ts +1 -1
  385. package/dist/theme/useColorSchemeProvider.js +1 -1
  386. package/dist/theme/useColorSchemeProvider.js.map +1 -1
  387. package/dist/theme/{usePrefersColorScheme.js → usePrefersDarkScheme.js} +1 -1
  388. package/dist/theme/usePrefersDarkScheme.js.map +1 -0
  389. package/dist/theme/utils.js.map +1 -1
  390. package/dist/tooltip/useTooltip.d.ts +14 -9
  391. package/dist/tooltip/useTooltip.js +2 -1
  392. package/dist/tooltip/useTooltip.js.map +1 -1
  393. package/dist/transition/_transition.scss +16 -9
  394. package/dist/transition/skeletonPlaceholderUtils.js.map +1 -1
  395. package/dist/transition/types.d.ts +1 -1
  396. package/dist/transition/types.js.map +1 -1
  397. package/dist/transition/useCarousel.d.ts +3 -3
  398. package/dist/transition/useCarousel.js.map +1 -1
  399. package/dist/transition/useCollapseTransition.js.map +1 -1
  400. package/dist/transition/useTransition.js +1 -0
  401. package/dist/transition/useTransition.js.map +1 -1
  402. package/dist/transition/utils.js.map +1 -1
  403. package/dist/tree/TreeItem.d.ts +2 -1
  404. package/dist/tree/TreeItem.js +4 -3
  405. package/dist/tree/TreeItem.js.map +1 -1
  406. package/dist/tree/TreeItemExpander.js.map +1 -1
  407. package/dist/tree/_tree.scss +8 -6
  408. package/dist/tree/useTreeExpansion.d.ts +1 -1
  409. package/dist/tree/useTreeExpansion.js +6 -18
  410. package/dist/tree/useTreeExpansion.js.map +1 -1
  411. package/dist/tree/useTreeSelection.d.ts +1 -1
  412. package/dist/tree/useTreeSelection.js +7 -25
  413. package/dist/tree/useTreeSelection.js.map +1 -1
  414. package/dist/tree/utils.d.ts +1 -1
  415. package/dist/tree/utils.js.map +1 -1
  416. package/dist/types.d.ts +12 -4
  417. package/dist/types.js.map +1 -1
  418. package/dist/typography/WritingDirectionProvider.d.ts +1 -1
  419. package/dist/typography/WritingDirectionProvider.js.map +1 -1
  420. package/dist/typography/_typography.scss +94 -37
  421. package/dist/typography/typographyStyles.js.map +1 -1
  422. package/dist/useDebouncedFunction.d.ts +1 -5
  423. package/dist/useDebouncedFunction.js +3 -1
  424. package/dist/useDebouncedFunction.js.map +1 -1
  425. package/dist/useDropzone.d.ts +4 -4
  426. package/dist/useDropzone.js.map +1 -1
  427. package/dist/useEnsuredId.js.map +1 -1
  428. package/dist/useIntersectionObserver.d.ts +5 -5
  429. package/dist/useIntersectionObserver.js.map +1 -1
  430. package/dist/useLocalStorage.d.ts +3 -3
  431. package/dist/useLocalStorage.js +1 -1
  432. package/dist/useLocalStorage.js.map +1 -1
  433. package/dist/useMutationObserver.d.ts +1 -1
  434. package/dist/useMutationObserver.js.map +1 -1
  435. package/dist/useOrientation.js +3 -1
  436. package/dist/useOrientation.js.map +1 -1
  437. package/dist/usePageInactive.d.ts +2 -2
  438. package/dist/usePageInactive.js.map +1 -1
  439. package/dist/useReadonlySet.d.ts +76 -0
  440. package/dist/useReadonlySet.js +72 -0
  441. package/dist/useReadonlySet.js.map +1 -0
  442. package/dist/useResizeListener.d.ts +1 -1
  443. package/dist/useResizeListener.js.map +1 -1
  444. package/dist/useResizeObserver.d.ts +19 -0
  445. package/dist/useResizeObserver.js +19 -0
  446. package/dist/useResizeObserver.js.map +1 -1
  447. package/dist/useThrottledFunction.d.ts +1 -5
  448. package/dist/useThrottledFunction.js +3 -1
  449. package/dist/useThrottledFunction.js.map +1 -1
  450. package/dist/useToggle.d.ts +3 -3
  451. package/dist/useToggle.js.map +1 -1
  452. package/dist/utils/RenderRecursively.d.ts +2 -2
  453. package/dist/utils/RenderRecursively.js.map +1 -1
  454. package/dist/utils/alphaNumericSort.d.ts +5 -5
  455. package/dist/utils/alphaNumericSort.js.map +1 -1
  456. package/dist/utils/bem.d.ts +1 -1
  457. package/dist/utils/bem.js +1 -1
  458. package/dist/utils/bem.js.map +1 -1
  459. package/dist/utils/debounce.d.ts +5 -0
  460. package/dist/utils/debounce.js +17 -0
  461. package/dist/utils/debounce.js.map +1 -0
  462. package/dist/utils/nearest.js.map +1 -1
  463. package/dist/utils/parseCssLengthUnit.js.map +1 -1
  464. package/dist/utils/throttle.d.ts +5 -0
  465. package/dist/utils/throttle.js +30 -0
  466. package/dist/utils/throttle.js.map +1 -0
  467. package/dist/utils/wait.js +3 -1
  468. package/dist/utils/wait.js.map +1 -1
  469. package/dist/window-splitter/WindowSplitter.d.ts +37 -15
  470. package/dist/window-splitter/WindowSplitter.js +38 -17
  471. package/dist/window-splitter/WindowSplitter.js.map +1 -1
  472. package/dist/window-splitter/_window-splitter.scss +32 -14
  473. package/dist/window-splitter/styles.d.ts +14 -0
  474. package/dist/window-splitter/styles.js +18 -0
  475. package/dist/window-splitter/styles.js.map +1 -0
  476. package/package.json +25 -24
  477. package/src/app-bar/AppBar.tsx +1 -170
  478. package/src/app-bar/AppBarTitle.tsx +1 -44
  479. package/src/app-bar/styles.ts +206 -0
  480. package/src/autocomplete/Autocomplete.tsx +194 -211
  481. package/src/autocomplete/AutocompleteChip.tsx +48 -0
  482. package/src/autocomplete/AutocompleteCircularProgress.tsx +6 -17
  483. package/src/autocomplete/AutocompleteClearButton.tsx +44 -0
  484. package/src/autocomplete/AutocompleteDropdownButton.tsx +16 -37
  485. package/src/autocomplete/AutocompleteListboxChildren.tsx +68 -0
  486. package/src/autocomplete/autocompleteStyles.ts +48 -9
  487. package/src/autocomplete/defaults.ts +26 -17
  488. package/src/autocomplete/types.ts +744 -61
  489. package/src/autocomplete/useAutocomplete.ts +428 -0
  490. package/src/autocomplete/utils.ts +211 -0
  491. package/src/badge/Badge.tsx +1 -39
  492. package/src/badge/styles.ts +45 -0
  493. package/src/box/Box.tsx +11 -9
  494. package/src/box/styles.ts +14 -5
  495. package/src/button/AsyncButton.tsx +1 -1
  496. package/src/button/Button.tsx +5 -1
  497. package/src/card/Card.tsx +35 -4
  498. package/src/card/ClickableCard.tsx +9 -2
  499. package/src/card/styles.ts +1 -10
  500. package/src/chip/Chip.tsx +6 -1
  501. package/src/chip/styles.ts +12 -10
  502. package/src/delegateEvent.ts +5 -5
  503. package/src/dialog/Dialog.tsx +48 -61
  504. package/src/dialog/FixedDialog.tsx +1 -11
  505. package/src/dialog/styles.ts +97 -0
  506. package/src/divider/Divider.tsx +0 -12
  507. package/src/divider/styles.ts +12 -0
  508. package/src/draggable/useDraggable.ts +17 -10
  509. package/src/draggable/utils.ts +3 -3
  510. package/src/expansion-panel/ExpansionPanel.tsx +1 -1
  511. package/src/expansion-panel/useExpansionPanels.ts +18 -27
  512. package/src/{form → files}/FileInput.tsx +7 -15
  513. package/src/files/styles.ts +10 -0
  514. package/src/{form → files}/useFileUpload.ts +30 -34
  515. package/src/files/utils.ts +234 -0
  516. package/src/{form/fileUtils.ts → files/validation.ts} +15 -244
  517. package/src/focus/useFocusContainer.ts +16 -8
  518. package/src/form/FormMessageContainer.tsx +2 -2
  519. package/src/form/InputToggle.tsx +5 -1
  520. package/src/form/Label.tsx +18 -18
  521. package/src/form/Listbox.tsx +87 -0
  522. package/src/form/ListboxProvider.ts +37 -0
  523. package/src/form/MenuItemTextField.tsx +1 -2
  524. package/src/form/NativeSelect.tsx +14 -10
  525. package/src/form/Option.tsx +74 -22
  526. package/src/form/Select.tsx +89 -85
  527. package/src/form/SelectedOption.tsx +2 -0
  528. package/src/form/Slider.tsx +14 -11
  529. package/src/form/SliderThumb.tsx +4 -4
  530. package/src/form/SliderValueMarks.tsx +4 -4
  531. package/src/form/TextArea.tsx +6 -8
  532. package/src/form/TextField.tsx +0 -2
  533. package/src/form/TextFieldContainer.tsx +9 -11
  534. package/src/form/formMessageContainerStyles.ts +22 -0
  535. package/src/form/optionStyles.ts +7 -2
  536. package/src/form/sliderUtils.ts +1 -1
  537. package/src/form/textFieldContainerStyles.ts +9 -14
  538. package/src/form/types.ts +3 -11
  539. package/src/form/useCheckboxGroup.ts +28 -36
  540. package/src/form/useCombobox.ts +86 -38
  541. package/src/form/useEditableCombobox.ts +43 -8
  542. package/src/form/useRadioGroup.ts +6 -6
  543. package/src/form/useSelectCombobox.ts +4 -4
  544. package/src/form/useTextField.ts +1 -1
  545. package/src/hoverMode/useHoverMode.ts +3 -3
  546. package/src/hoverMode/useHoverModeProvider.ts +4 -4
  547. package/src/icon/FontIcon.tsx +4 -2
  548. package/src/icon/TextIconSpacing.tsx +1 -1
  549. package/src/icon/iconConfig.tsx +12 -0
  550. package/src/interaction/UserInteractionModeProvider.tsx +12 -8
  551. package/src/interaction/types.ts +21 -2
  552. package/src/interaction/useElementInteraction.tsx +9 -2
  553. package/src/interaction/utils.ts +7 -7
  554. package/src/layout/useExpandableLayout.ts +3 -3
  555. package/src/layout/useLayoutAppBarHeight.ts +3 -4
  556. package/src/layout/useTemporaryLayout.ts +2 -2
  557. package/src/list/ListItem.tsx +5 -1
  558. package/src/list/ListItemLink.tsx +5 -1
  559. package/src/media-queries/useMediaQuery.ts +2 -1
  560. package/src/menu/Menu.tsx +11 -3
  561. package/src/menu/MenuItemButton.tsx +7 -1
  562. package/src/menu/useContextMenu.ts +3 -3
  563. package/src/movement/types.ts +5 -5
  564. package/src/navigation/CollapsibleNavGroup.tsx +16 -8
  565. package/src/navigation/DefaultNavigationRenderer.tsx +8 -6
  566. package/src/navigation/NavItemButton.tsx +2 -1
  567. package/src/navigation/NavItemLink.tsx +11 -3
  568. package/src/navigation/NavSubheader.tsx +1 -1
  569. package/src/navigation/Navigation.tsx +1 -1
  570. package/src/navigation/types.ts +60 -10
  571. package/src/navigation/useActiveHeadingId.ts +1 -1
  572. package/src/navigation/useNavigationExpansion.ts +170 -0
  573. package/src/navigation/utils.ts +47 -0
  574. package/src/objectFit.ts +88 -0
  575. package/src/positioning/useFixedPositioning.ts +34 -11
  576. package/src/responsive-item/ResponsiveItem.tsx +96 -0
  577. package/src/responsive-item/ResponsiveItemOverlay.tsx +6 -46
  578. package/src/responsive-item/responsiveItemOverlayStyles.ts +46 -0
  579. package/src/responsive-item/responsiveItemStyles.ts +81 -0
  580. package/src/scroll/useScrollLock.ts +6 -0
  581. package/src/searching/utils.ts +3 -3
  582. package/src/segmented-button/SegmentedButton.tsx +5 -1
  583. package/src/snackbar/ToastManager.tsx +16 -5
  584. package/src/snackbar/useCurrentToastActions.ts +5 -5
  585. package/src/table/tableCellStyles.ts +10 -6
  586. package/src/tabs/Tab.tsx +4 -1
  587. package/src/tabs/TabList.tsx +2 -2
  588. package/src/tabs/TabListScrollButton.tsx +4 -4
  589. package/src/tabs/getTabListScrollToOptions.ts +37 -0
  590. package/src/tabs/tabStyles.ts +4 -0
  591. package/src/tabs/useTabList.ts +2 -9
  592. package/src/tabs/useTabs.ts +6 -6
  593. package/src/tabs/utils.ts +0 -38
  594. package/src/test-utils/ResizeObserver.ts +11 -12
  595. package/src/test-utils/matchMedia.ts +7 -7
  596. package/src/test-utils/polyfills/TextDecoder.ts +0 -1
  597. package/src/test-utils/timers.ts +10 -7
  598. package/src/theme/LocalStorageColorSchemeProvider.tsx +4 -4
  599. package/src/theme/ThemeProvider.tsx +3 -3
  600. package/src/theme/isColorScheme.ts +22 -0
  601. package/src/theme/types.ts +67 -1
  602. package/src/theme/useCSSVariables.ts +7 -30
  603. package/src/theme/useColorScheme.ts +1 -40
  604. package/src/theme/useColorSchemeMetaTag.ts +1 -1
  605. package/src/theme/useColorSchemeProvider.ts +2 -2
  606. package/src/tooltip/useTooltip.ts +17 -9
  607. package/src/transition/types.ts +1 -1
  608. package/src/transition/useCarousel.ts +3 -3
  609. package/src/transition/useTransition.ts +1 -0
  610. package/src/tree/TreeItem.tsx +7 -1
  611. package/src/tree/TreeItemExpander.tsx +1 -1
  612. package/src/tree/useTreeExpansion.ts +7 -25
  613. package/src/tree/useTreeSelection.ts +8 -32
  614. package/src/tree/utils.ts +6 -2
  615. package/src/types.ts +20 -4
  616. package/src/typography/WritingDirectionProvider.tsx +1 -1
  617. package/src/useDebouncedFunction.ts +4 -9
  618. package/src/useDropzone.ts +4 -4
  619. package/src/useIntersectionObserver.ts +5 -5
  620. package/src/useLocalStorage.ts +6 -6
  621. package/src/useMutationObserver.ts +1 -1
  622. package/src/useOrientation.ts +3 -1
  623. package/src/usePageInactive.ts +2 -2
  624. package/src/useReadonlySet.ts +122 -0
  625. package/src/useResizeListener.ts +1 -1
  626. package/src/useResizeObserver.ts +19 -0
  627. package/src/useThrottledFunction.ts +6 -9
  628. package/src/useToggle.ts +3 -3
  629. package/src/utils/RenderRecursively.tsx +2 -2
  630. package/src/utils/alphaNumericSort.ts +5 -5
  631. package/src/utils/bem.ts +1 -1
  632. package/src/utils/debounce.ts +22 -0
  633. package/src/utils/throttle.ts +38 -0
  634. package/src/utils/wait.ts +5 -1
  635. package/src/window-splitter/WindowSplitter.tsx +38 -43
  636. package/src/window-splitter/styles.ts +42 -0
  637. package/dist/autocomplete/FilterAutocompleteOptions.d.ts +0 -8
  638. package/dist/autocomplete/FilterAutocompleteOptions.js +0 -57
  639. package/dist/autocomplete/FilterAutocompleteOptions.js.map +0 -1
  640. package/dist/dialog/DialogContainer.d.ts +0 -14
  641. package/dist/dialog/DialogContainer.js +0 -20
  642. package/dist/dialog/DialogContainer.js.map +0 -1
  643. package/dist/form/FileInput.js.map +0 -1
  644. package/dist/form/fileUtils.js.map +0 -1
  645. package/dist/form/useFileUpload.js.map +0 -1
  646. package/dist/form/useListboxProvider.d.ts +0 -31
  647. package/dist/form/useListboxProvider.js.map +0 -1
  648. package/dist/navigation/getHrefFromParents.d.ts +0 -5
  649. package/dist/navigation/getHrefFromParents.js +0 -13
  650. package/dist/navigation/getHrefFromParents.js.map +0 -1
  651. package/dist/responsive-item/ResponsiveItemContainer.d.ts +0 -115
  652. package/dist/responsive-item/ResponsiveItemContainer.js +0 -80
  653. package/dist/responsive-item/ResponsiveItemContainer.js.map +0 -1
  654. package/dist/responsive-item/styles.d.ts +0 -34
  655. package/dist/responsive-item/styles.js +0 -17
  656. package/dist/responsive-item/styles.js.map +0 -1
  657. package/dist/theme/usePrefersColorScheme.js.map +0 -1
  658. package/src/autocomplete/FilterAutocompleteOptions.tsx +0 -86
  659. package/src/dialog/DialogContainer.tsx +0 -28
  660. package/src/form/useListboxProvider.ts +0 -45
  661. package/src/navigation/getHrefFromParents.ts +0 -15
  662. package/src/responsive-item/ResponsiveItemContainer.tsx +0 -174
  663. package/src/responsive-item/styles.ts +0 -58
  664. /package/dist/theme/{usePrefersColorScheme.d.ts → usePrefersDarkScheme.d.ts} +0 -0
  665. /package/src/theme/{usePrefersColorScheme.ts → usePrefersDarkScheme.ts} +0 -0
@@ -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"],"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
+ {"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 { type ComponentWithRippleProps } from \"../interaction/types.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 ComponentWithRippleProps {\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 disableRipple,\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 mode: disableRipple ? \"none\" : undefined,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled,\n });\n\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","disableRipple","remaining","selectedIconNode","element","transitionIn","disableTransition","pressedClassName","handlers","ripples","mode","undefined","button","aria-pressed"],"mappings":"AAAA;;AACA,SAASA,UAAU,QAAmD,QAAQ;AAC9E,SAASC,OAAO,QAAQ,wBAAwB;AAEhD,SAASC,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AACxF,SAASC,qBAAqB,QAAQ,yCAAyC;AAC/E,SAASC,eAAe,QAAQ,6BAA6B;AAsD7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EACRC,aAAa,EACb,GAAGC,WACJ,GAAG3B;IAEJ,MAAMM,WAAWV,0BAA0BW;IAC3C,MAAMqB,mBAAmBlC,QAAQ,YAAYgB;IAC7C,MAAMD,eAAeZ,sBAAsB;QACzCgC,SAASD;QACTE,cAAc,CAAC,CAACtB;QAChBiB,UAAUb;QACVmB,mBAAmBlB;IACrB;IACA,MAAM,EAAEmB,gBAAgB,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAGvC,sBAAsB;QACpEwC,MAAMT,gBAAgB,SAASU;QAC/BtB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,qBACE,MAACY;QACE,GAAGV,SAAS;QACZ,GAAGM,QAAQ;QACZK,gBAAc9B;QACdP,KAAKA;QACLE,MAAMA;QACNsB,UAAUA;QACVvB,WAAWJ,gBAAgB;YACzBI;YACAM;YACAG;YACAqB;QACF;;YAEC,CAACpB,uBAAuBH;YACxBL;YACAE;YACAD;YACA6B;;;AAGP,GAAG"}
@@ -169,27 +169,27 @@ $variables: (
169
169
  padding: $vertical-padding $horizontal-padding;
170
170
 
171
171
  &:first-child {
172
+ border-bottom-left-radius: $border-radius;
173
+ border-top-left-radius: $border-radius;
174
+
172
175
  @include utils.rtl {
173
176
  border-bottom-left-radius: 0;
174
177
  border-bottom-right-radius: $border-radius;
175
178
  border-top-left-radius: 0;
176
179
  border-top-right-radius: $border-radius;
177
180
  }
178
-
179
- border-bottom-left-radius: $border-radius;
180
- border-top-left-radius: $border-radius;
181
181
  }
182
182
 
183
183
  &:last-child {
184
+ border-bottom-right-radius: $border-radius;
185
+ border-top-right-radius: $border-radius;
186
+
184
187
  @include utils.rtl {
185
188
  border-bottom-left-radius: $border-radius;
186
189
  border-bottom-right-radius: 0;
187
190
  border-top-left-radius: $border-radius;
188
191
  border-top-right-radius: 0;
189
192
  }
190
-
191
- border-bottom-right-radius: $border-radius;
192
- border-top-right-radius: $border-radius;
193
193
  }
194
194
 
195
195
  &--selected {
@@ -103,19 +103,31 @@ $variables: (
103
103
 
104
104
  @if not $disable-position-left {
105
105
  &--left {
106
- @include utils.auto-rtl(left, 0) {
106
+ @include set-var(transform-offscreen, translate3d(-100%, 0, 0));
107
+
108
+ left: 0;
109
+
110
+ @include utils.rtl {
107
111
  @include set-var(transform-offscreen, translate3d(100%, 0, 0));
112
+
113
+ left: auto;
114
+ right: 0;
108
115
  }
109
- @include set-var(transform-offscreen, translate3d(-100%, 0, 0));
110
116
  }
111
117
  }
112
118
 
113
119
  @if not $disable-position-right {
114
120
  &--right {
115
- @include utils.auto-rtl(right, 0) {
121
+ @include set-var(transform-offscreen, translate3d(100%, 0, 0));
122
+
123
+ right: 0;
124
+
125
+ @include utils.rtl {
116
126
  @include set-var(transform-offscreen, translate3d(-100%, 0, 0));
127
+
128
+ left: 0;
129
+ right: auto;
117
130
  }
118
- @include set-var(transform-offscreen, translate3d(100%, 0, 0));
119
131
  }
120
132
  }
121
133
 
@@ -144,11 +156,11 @@ $variables: (
144
156
  }
145
157
 
146
158
  &--media-width {
159
+ @include set-var(width, get-var(touch-width));
160
+
147
161
  @include media-queries.tablet-media {
148
162
  @include set-var(width, get-var(static-width));
149
163
  }
150
-
151
- @include set-var(width, get-var(touch-width));
152
164
  }
153
165
 
154
166
  &--viewport-height {
@@ -441,22 +441,32 @@ var _queue = /*#__PURE__*/ new WeakMap(), _timers = /*#__PURE__*/ new WeakMap(),
441
441
  /**
442
442
  * @see {@link ToastManager.addToast}
443
443
  * @since 6.0.0
444
- */ export const addToast = (toast)=>toastManager.addToast(toast);
444
+ */ export const addToast = (toast)=>{
445
+ toastManager.addToast(toast);
446
+ };
445
447
  /**
446
448
  * @see {@link ToastManager.startRemoveTimeout}
447
449
  * @since 6.0.0
448
- */ export const startRemoveToastTimeout = (toastId)=>toastManager.startRemoveTimeout(toastId);
450
+ */ export const startRemoveToastTimeout = (toastId)=>{
451
+ toastManager.startRemoveTimeout(toastId);
452
+ };
449
453
  /**
450
454
  * @see {@link ToastManager.popToast}
451
455
  * @since 6.0.0
452
- */ export const popToast = ()=>toastManager.popToast();
456
+ */ export const popToast = ()=>{
457
+ toastManager.popToast();
458
+ };
453
459
  /**
454
460
  * @see {@link ToastManager.removeToast}
455
461
  * @since 6.0.0
456
- */ export const removeToast = (toastId, transition)=>toastManager.removeToast(toastId, transition);
462
+ */ export const removeToast = (toastId, transition)=>{
463
+ toastManager.removeToast(toastId, transition);
464
+ };
457
465
  /**
458
466
  * @see {@link ToastManager.clearToasts}
459
467
  * @since 6.0.0
460
- */ export const clearToasts = ()=>toastManager.clearToasts();
468
+ */ export const clearToasts = ()=>{
469
+ toastManager.clearToasts();
470
+ };
461
471
 
462
472
  //# sourceMappingURL=ToastManager.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/snackbar/ToastManager.tsx"],"sourcesContent":["import { nanoid } from \"nanoid\";\nimport { type ConfigurableToastProps } from \"./Toast.js\";\n\n/**\n * @since 6.0.0\n */\nexport const DEFAULT_TOAST_VISIBLE_TIME = 5000;\n\n/**\n * - `\"normal\"` - the toast will be added to the end of the queue\n * - `\"next\"` - the toast will be inserted next-in-line in the queue, waiting\n * for the current visible toast to exit before being shown. If the toast does\n * not support duplicates, the existing toast will be moved instead and merged\n * with the toast.\n * - `\"replace\"` - if there is a currently visible toast, it will start the\n * leave transition and display the newly added toast instead.\n * - `\"immediate\"` - the same behavior as `\"replace\"` except that if there was a\n * currently visible toast, the toast will be shown again once the `\"immediate\"`\n * toast is hidden.\n *\n * @since 6.0.0 Renamed from `MessagePriority` to `ToastPriority`\n */\nexport type ToastPriority = \"normal\" | \"next\" | \"replace\" | \"immediate\";\n\n/**\n * - `\"allow\"` - toasts with the same `toastId` can be added into the queue, but\n * the leave timeout behavior might not work if multiple toasts can be shown\n * at the same time.\n * - `\"restart\"` - (default) toasts that have the same `toastId` as a toast\n * being shown will restart the exit timeout and update the toast with any\n * differences in the toast. If the toast is not currently being shown, a new\n * toast will not be added.\n * - `\"update\"` - toasts that have the same `toastId` will just update the toast\n * with the latest content while maintaining any existing timeouts\n *\n * @since 6.0.0 Renamed from `DuplicateBehavior`\n */\nexport type ToastDuplicateBehavior = \"allow\" | \"restart\" | \"update\";\n\n/**\n * @since 6.0.0\n */\nexport interface ToastMeta {\n /**\n * This will be `true` if the exit timeout has been paused either by hovering\n * the toast or the page has become inactive through blur or minimizing.\n */\n paused: boolean;\n\n /**\n * This will be `true` when the toast should be visible and `false` during the\n * exit animation.\n */\n visible: boolean;\n\n /**\n * The current toast's id which can be used with the:\n * - {@link ToastManager.removeToast}\n * - {@link ToastManager.startRemoveTimeout}\n * - {@link ToastManager.pauseRemoveTimeout}\n * - {@link ToastManager.resumeRemoveTimeout}\n */\n toastId: string;\n priority: ToastPriority;\n duplicates: ToastDuplicateBehavior;\n visibleTime: number | null;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface CreateToastOptions extends ConfigurableToastProps {\n /**\n * @defaultValue `nanoid()`\n */\n toastId?: string;\n\n /**\n * @see {@link ToastDuplicateBehavior}\n * @defaultValue `\"restart\"`\n */\n duplicates?: ToastDuplicateBehavior;\n\n /**\n * @see {@link ToastPriority}\n * @defaultValue `\"normal\"`\n */\n priority?: ToastPriority;\n\n /**\n * Set this to `null` to prevent the toast from automatically hiding,\n * otherwise set this to the number of milliseconds to remain visible.\n *\n * @see {@link DEFAULT_TOAST_VISIBLE_TIME}\n * @defaultValue `DEFAULT_TOAST_VISIBLE_TIME`\n */\n visibleTime?: number | null;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface QueuedToast extends ConfigurableToastProps, ToastMeta {}\n\n/**\n * @since 6.0.0\n */\nexport type ToastQueue = readonly Readonly<QueuedToast>[];\n\n/**\n * @since 6.0.0\n */\nexport type ToastCallback = (queue: ToastQueue) => void;\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport interface ToastVisibilityTimers {\n inactive: boolean;\n startTime: number;\n elapsedTime: number;\n exitTimeout?: number;\n}\n\n/**\n * @see {@link ToastManagerProvider}\n *\n * @since 6.0.0\n */\nexport class ToastManager {\n #queue: QueuedToast[];\n #timers: Map<string, ToastVisibilityTimers>;\n #listeners: ToastCallback[];\n\n constructor() {\n this.#queue = [];\n this.#timers = new Map();\n this.#listeners = [];\n\n // All of the class methods must be arrow functions to preserve the correct\n // `this` value. If they aren't arrow functions, I'd have to wrap each call\n // in an arrow function to work.\n //\n // i.e.\n // useSyncExternalStore(\n // (cb) => manager.subscribe(cb),\n // () => manager.getQueue(),\n // () => manager.getQueue(),\n // );\n }\n\n #emit = (): void => {\n // shallow clone to ensure react updates\n this.#queue = [...this.#queue];\n this.#listeners.forEach((callback) => {\n callback(this.#queue);\n });\n };\n\n #getToastIndex = (toastId: string | undefined): number => {\n if (!toastId) {\n return -1;\n }\n\n return this.#queue.findIndex((toast) => toast.toastId === toastId);\n };\n\n #getToast = (toastId: string | undefined): QueuedToast | undefined => {\n return this.#queue[this.#getToastIndex(toastId)];\n };\n\n /**\n * Starts the exit transition for the currently shown toast and adds the next\n * toast into the queue. This requires a manual call to `this.#emit()`\n * afterwards.\n */\n #addToastImmediately = (nextToast: QueuedToast): void => {\n const [current] = this.#queue;\n this.clearTimer(current.toastId);\n this.#queue[0] = {\n ...current,\n visible: false,\n };\n if (nextToast.priority === \"immediate\") {\n this.#queue.splice(1, 0, nextToast, current);\n } else {\n this.#queue.splice(1, 0, nextToast);\n }\n };\n\n /**\n * This calls `this.#emit()` if the toast was updated\n */\n #updateToast = (\n toastIdOrIndex: string | number,\n patch: Partial<QueuedToast>\n ): void => {\n const index =\n typeof toastIdOrIndex === \"number\"\n ? toastIdOrIndex\n : this.#getToastIndex(toastIdOrIndex);\n\n if (index === -1) {\n return;\n }\n\n this.#queue[index] = {\n ...this.#queue[index],\n ...patch,\n };\n this.#emit();\n };\n\n /**\n * This is just used to subscribe to changes in the {@link useToastQueue}.\n *\n * ```tsx\n * useSyncExternalStore(\n * toastManager.subscribe,\n * toastManager.getQueue,\n * toastManager.getQueue,\n * );\n * ```\n *\n * @internal\n */\n subscribe = (callback: ToastCallback): (() => void) => {\n this.#listeners.push(callback);\n\n return () => {\n this.#listeners = this.#listeners.filter((cb) => cb !== callback);\n };\n };\n\n /**\n * @see {@link subscribe}\n * @internal\n */\n getQueue = (): ToastQueue => {\n return this.#queue;\n };\n\n /**\n * Either adds the toast to the queue or updates an existing toast when using\n * an existing `toastId`.\n *\n * @example Adding toasts\n * ```tsx\n * // create a toast when the user is offline that will not disappear\n * addToast({ toastId: \"offline\", visibleTime: null });\n *\n * // add a new toast that displays `\"Toast\"` to the queue\n * addToast({ children: \"Toast!\" });\n *\n * // add an online toast notification. since these three use the same toast\n * // id, the hide timer will be reset each time\n * addToast({ toastId: \"online\" });\n * addToast({ toastId: \"online\" });\n * addToast({ toastId: \"online\" });\n *\n * // add a server error toast to the queue where the second one will be\n * // ignored\n * addToast({\n * toastId: \"ServerError\",\n * theme: \"error\",\n * duplicates: \"prevent\",\n * });\n * addToast({\n * toastId: \"ServerError\",\n * theme: \"error\",\n * duplicates: \"prevent\",\n * });\n *\n * // add a toast to the queue that has an action button that says \"Goodbye\"\n * addToast({\n * children: \"Hello, world!\",\n * action: \"Goodbye\",\n * });\n *\n * // add a toast to the queue that has an action button that says \"Goodbye\"\n * // and a custom click handler\n * addToast({\n * children: \"Hello, world!\",\n * action: {\n * onClick: () => {\n * logout();\n * },\n * children: \"Goodbye\",\n * },\n * });\n *\n * // add a toast to the queue that renders a react component in the content,\n * // a custom action button implementation (using `ToastActionButton`), and a\n * // close button\n * addToast({\n * children: <SomeCustomComponent />,\n * actionButton: <SomeCustomActionButton />,\n * closeButton: true,\n * });\n * ```\n */\n addToast = (toast: CreateToastOptions): void => {\n const {\n toastId = nanoid(),\n visibleTime = DEFAULT_TOAST_VISIBLE_TIME,\n role = visibleTime === null ? \"alert\" : \"status\",\n priority = \"normal\",\n duplicates = \"restart\",\n } = toast;\n\n const existingIndex = this.#getToastIndex(toast.toastId);\n if (existingIndex !== -1 && duplicates !== \"allow\") {\n const existingToast = this.#queue[existingIndex];\n const nextToast: QueuedToast = {\n ...existingToast,\n ...toast,\n };\n\n // reorder/move the existing toast to be the next item in the queue by:\n // - removing the toast from the queue\n // - inserting it into the next position with the updates\n if (priority === \"next\" && existingIndex > 1) {\n this.#queue.splice(existingIndex, 1);\n this.#queue.splice(1, 0, nextToast);\n this.#emit();\n return;\n }\n\n // only need to reorder the queue if it is not being shown\n if (\n (priority === \"replace\" || priority === \"immediate\") &&\n existingIndex !== 0\n ) {\n this.#queue.splice(existingIndex, 1);\n this.#addToastImmediately(nextToast);\n this.#emit();\n return;\n }\n\n const timers = this.#timers.get(toastId);\n if (existingToast.visible && duplicates === \"restart\" && timers) {\n this.#timers.set(toastId, { ...timers, elapsedTime: 0 });\n\n // wait for the next resume event instead. this _should_ only happen\n // when hovering a toast and another toast replaces it\n if (!nextToast.paused) {\n this.startRemoveTimeout(toastId);\n }\n }\n\n this.#updateToast(existingIndex, toast);\n return;\n }\n\n const nextToast: QueuedToast = {\n ...toast,\n role,\n paused: false,\n visible: true,\n toastId,\n priority,\n duplicates,\n visibleTime,\n };\n\n const queueSize = this.#queue.length;\n if (priority === \"next\" && queueSize > 1) {\n this.#queue.splice(1, 0, nextToast);\n } else if (\n (priority === \"replace\" || priority === \"immediate\") &&\n queueSize > 0\n ) {\n this.#addToastImmediately(nextToast);\n } else {\n this.#queue.push(nextToast);\n }\n\n this.#emit();\n };\n\n /**\n * Attempts to start the timeout for removing the toast when the `visibleTime`\n * is not null for a toast.\n *\n * @param toastId - The specific toastId to update\n */\n startRemoveTimeout = (toastId: string): void => {\n const toast = this.#getToast(toastId);\n if (!toast) {\n return;\n }\n\n const { visibleTime } = toast;\n if (visibleTime === null) {\n // Must manually be closed\n return;\n }\n\n const cached = this.#timers.get(toastId);\n const timers = (cached && { ...cached }) || {\n inactive: false,\n startTime: Date.now(),\n elapsedTime: 0,\n };\n window.clearTimeout(timers.exitTimeout);\n\n let duration = visibleTime;\n if (timers.elapsedTime) {\n duration -= timers.elapsedTime;\n }\n\n timers.inactive = false;\n timers.exitTimeout = window.setTimeout(() => {\n this.removeToast(toastId, true);\n }, duration);\n this.#timers.set(toastId, timers);\n };\n\n /**\n * Pauses the remove timeout for a specific toast normally with hover events\n * or the browser becoming inactive.\n *\n * @param toastId - The specific toastId to pause\n */\n pauseRemoveTimeout = (toastId: string): void => {\n const toast = this.#getToast(toastId);\n const cached = this.#timers.get(toastId);\n if (!toast || !cached || cached.inactive) {\n return;\n }\n\n window.clearTimeout(cached.exitTimeout);\n const timers = { ...cached };\n timers.inactive = true;\n timers.elapsedTime = Date.now() - timers.startTime + timers.elapsedTime;\n this.#timers.set(toastId, timers);\n this.#updateToast(toastId, { paused: true });\n };\n\n /**\n * Resumes the current remove timeout if it was paused by\n * {@link pauseRemoveTimeout}.\n *\n * @param toastId - The specific toastId to resume\n */\n resumeRemoveTimeout = (toastId: string): void => {\n const toastIndex = this.#getToastIndex(toastId);\n const timers = this.#timers.get(toastId);\n if (toastIndex === -1 || !timers?.startTime) {\n return;\n }\n\n timers.startTime = Date.now();\n this.#updateToast(toastIndex, { paused: false });\n this.startRemoveTimeout(toastId);\n };\n\n /**\n * Removes a toast by id from the queue without any exit animation.\n *\n * @param toastId - The specific {@link QueuedToast.toastId}\n * @param transition - Set this to `true` to remove the toast by the exit\n * transition instead of immediately.\n */\n removeToast = (toastId: string, transition: boolean): void => {\n const toastIndex = this.#getToastIndex(toastId);\n if (toastIndex === -1) {\n return;\n }\n\n if (transition) {\n this.clearTimer(toastId);\n this.#updateToast(toastIndex, { visible: false });\n return;\n }\n\n this.#queue.splice(toastIndex, 1);\n this.#emit();\n };\n\n /**\n * Clears any pending timers for the provided toast id. This should generally\n * be used in the `useEffect` cleanup effect for any custom toast renderer\n * implementations.\n *\n * @example\n * ```tsx\n * const { toastId } = toast;\n * const toastManager = useToastManager();\n *\n * useEffect(() => {\n * return () => {\n * toastManager.clearTimer(toastId):\n * }\n * }, [toastManager, toastId]);\n * ```\n */\n clearTimer = (toastId: string): void => {\n const timer = this.#timers.get(toastId);\n window.clearTimeout(timer?.exitTimeout);\n this.#timers.delete(toastId);\n };\n\n /**\n * Removes first toast from the queue without any exit animation. You most\n * likely want to use {@link removeToast} instead.\n */\n popToast = (): void => {\n this.#queue.pop();\n this.#emit();\n };\n\n /**\n * Removes all toasts from the queue. There will be no exit animation.\n *\n * @param disableEmit - Set this to `true` to disable emitting the empty queue.\n * Mostly used for tests.\n */\n clearToasts = (disableEmit = false): void => {\n this.#queue = [];\n this.#timers.forEach((meta) => {\n window.clearTimeout(meta.exitTimeout);\n });\n this.#timers.clear();\n if (!disableEmit) {\n this.#emit();\n }\n };\n}\n\n/**\n * The default toast manager for react-md apps that will allow toasts to be\n * added without setting up the {@link ToastManagerProvider}.\n *\n * @internal\n * @since 6.0.0\n */\nexport const toastManager = new ToastManager();\n\n/**\n * @see {@link ToastManager.addToast}\n * @since 6.0.0\n */\nexport const addToast: ToastManager[\"addToast\"] = (toast) =>\n toastManager.addToast(toast);\n\n/**\n * @see {@link ToastManager.startRemoveTimeout}\n * @since 6.0.0\n */\nexport const startRemoveToastTimeout: ToastManager[\"startRemoveTimeout\"] = (\n toastId\n) => toastManager.startRemoveTimeout(toastId);\n\n/**\n * @see {@link ToastManager.popToast}\n * @since 6.0.0\n */\nexport const popToast: ToastManager[\"popToast\"] = () => toastManager.popToast();\n\n/**\n * @see {@link ToastManager.removeToast}\n * @since 6.0.0\n */\nexport const removeToast: ToastManager[\"removeToast\"] = (toastId, transition) =>\n toastManager.removeToast(toastId, transition);\n\n/**\n * @see {@link ToastManager.clearToasts}\n * @since 6.0.0\n */\nexport const clearToasts = (): void => toastManager.clearToasts();\n"],"names":["nanoid","DEFAULT_TOAST_VISIBLE_TIME","ToastManager","constructor","forEach","callback","toastId","findIndex","toast","nextToast","current","clearTimer","visible","priority","splice","toastIdOrIndex","patch","index","subscribe","push","filter","cb","getQueue","addToast","visibleTime","role","duplicates","existingIndex","existingToast","timers","get","set","elapsedTime","paused","startRemoveTimeout","queueSize","length","cached","inactive","startTime","Date","now","window","clearTimeout","exitTimeout","duration","setTimeout","removeToast","pauseRemoveTimeout","resumeRemoveTimeout","toastIndex","transition","timer","delete","popToast","pop","clearToasts","disableEmit","meta","clear","Map","toastManager","startRemoveToastTimeout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,MAAM,QAAQ,SAAS;AAGhC;;CAEC,GACD,OAAO,MAAMC,6BAA6B,KAAK;IA6H7C,sCACA,uCACA,0CAmBA,qCAQA,8CAQA,yCAIA;;;;GAIC,GACD,oDAcA;;GAEC,GACD;AArEF;;;;CAIC,GACD,OAAO,MAAMC;IAKXC,aAAc;QAJd,gCAAA;;mBAAA,KAAA;;QACA,gCAAA;;mBAAA,KAAA;;QACA,gCAAA;;mBAAA,KAAA;;QAmBA,gCAAA;;mBAAQ;gBACN,wCAAwC;+CACnC,QAAS;gDAAI,IAAI,EAAC;iBAAO;gBAC9B,yBAAA,IAAI,EAAC,YAAWC,OAAO,CAAC,CAACC;oBACvBA,kCAAS,IAAI,EAAC;gBAChB;YACF;;QAEA,gCAAA;;mBAAiB,CAACC;gBAChB,IAAI,CAACA,SAAS;oB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,eAAe;AAE/C;;;CAGC,GACD,OAAO,MAAMqB,WAAqC,CAACf,QACjDqD,aAAatC,QAAQ,CAACf,OAAO;AAE/B;;;CAGC,GACD,OAAO,MAAMsD,0BAA8D,CACzExD,UACGuD,aAAa3B,kBAAkB,CAAC5B,SAAS;AAE9C;;;CAGC,GACD,OAAO,MAAMgD,WAAqC,IAAMO,aAAaP,QAAQ,GAAG;AAEhF;;;CAGC,GACD,OAAO,MAAMP,cAA2C,CAACzC,SAAS6C,aAChEU,aAAad,WAAW,CAACzC,SAAS6C,YAAY;AAEhD;;;CAGC,GACD,OAAO,MAAMK,cAAc,IAAYK,aAAaL,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../src/snackbar/ToastManager.tsx"],"sourcesContent":["import { nanoid } from \"nanoid\";\nimport { type ConfigurableToastProps } from \"./Toast.js\";\n\n/**\n * @since 6.0.0\n */\nexport const DEFAULT_TOAST_VISIBLE_TIME = 5000;\n\n/**\n * - `\"normal\"` - the toast will be added to the end of the queue\n * - `\"next\"` - the toast will be inserted next-in-line in the queue, waiting\n * for the current visible toast to exit before being shown. If the toast does\n * not support duplicates, the existing toast will be moved instead and merged\n * with the toast.\n * - `\"replace\"` - if there is a currently visible toast, it will start the\n * leave transition and display the newly added toast instead.\n * - `\"immediate\"` - the same behavior as `\"replace\"` except that if there was a\n * currently visible toast, the toast will be shown again once the `\"immediate\"`\n * toast is hidden.\n *\n * @since 6.0.0 Renamed from `MessagePriority` to `ToastPriority`\n */\nexport type ToastPriority = \"normal\" | \"next\" | \"replace\" | \"immediate\";\n\n/**\n * - `\"allow\"` - toasts with the same `toastId` can be added into the queue, but\n * the leave timeout behavior might not work if multiple toasts can be shown\n * at the same time.\n * - `\"restart\"` - (default) toasts that have the same `toastId` as a toast\n * being shown will restart the exit timeout and update the toast with any\n * differences in the toast. If the toast is not currently being shown, a new\n * toast will not be added.\n * - `\"update\"` - toasts that have the same `toastId` will just update the toast\n * with the latest content while maintaining any existing timeouts\n *\n * @since 6.0.0 Renamed from `DuplicateBehavior`\n */\nexport type ToastDuplicateBehavior = \"allow\" | \"restart\" | \"update\";\n\n/**\n * @since 6.0.0\n */\nexport interface ToastMeta {\n /**\n * This will be `true` if the exit timeout has been paused either by hovering\n * the toast or the page has become inactive through blur or minimizing.\n */\n paused: boolean;\n\n /**\n * This will be `true` when the toast should be visible and `false` during the\n * exit animation.\n */\n visible: boolean;\n\n /**\n * The current toast's id which can be used with the:\n * - {@link ToastManager.removeToast}\n * - {@link ToastManager.startRemoveTimeout}\n * - {@link ToastManager.pauseRemoveTimeout}\n * - {@link ToastManager.resumeRemoveTimeout}\n */\n toastId: string;\n priority: ToastPriority;\n duplicates: ToastDuplicateBehavior;\n visibleTime: number | null;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface CreateToastOptions extends ConfigurableToastProps {\n /**\n * @defaultValue `nanoid()`\n */\n toastId?: string;\n\n /**\n * @see {@link ToastDuplicateBehavior}\n * @defaultValue `\"restart\"`\n */\n duplicates?: ToastDuplicateBehavior;\n\n /**\n * @see {@link ToastPriority}\n * @defaultValue `\"normal\"`\n */\n priority?: ToastPriority;\n\n /**\n * Set this to `null` to prevent the toast from automatically hiding,\n * otherwise set this to the number of milliseconds to remain visible.\n *\n * @see {@link DEFAULT_TOAST_VISIBLE_TIME}\n * @defaultValue `DEFAULT_TOAST_VISIBLE_TIME`\n */\n visibleTime?: number | null;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface QueuedToast extends ConfigurableToastProps, ToastMeta {}\n\n/**\n * @since 6.0.0\n */\nexport type ToastQueue = readonly Readonly<QueuedToast>[];\n\n/**\n * @since 6.0.0\n */\nexport type ToastCallback = (queue: ToastQueue) => void;\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport interface ToastVisibilityTimers {\n inactive: boolean;\n startTime: number;\n elapsedTime: number;\n exitTimeout?: number;\n}\n\n/**\n * @see {@link ToastManagerProvider}\n *\n * @since 6.0.0\n */\nexport class ToastManager {\n #queue: QueuedToast[];\n #timers: Map<string, ToastVisibilityTimers>;\n #listeners: ToastCallback[];\n\n constructor() {\n this.#queue = [];\n this.#timers = new Map();\n this.#listeners = [];\n\n // All of the class methods must be arrow functions to preserve the correct\n // `this` value. If they aren't arrow functions, I'd have to wrap each call\n // in an arrow function to work.\n //\n // i.e.\n // useSyncExternalStore(\n // (cb) => manager.subscribe(cb),\n // () => manager.getQueue(),\n // () => manager.getQueue(),\n // );\n }\n\n #emit = (): void => {\n // shallow clone to ensure react updates\n this.#queue = [...this.#queue];\n this.#listeners.forEach((callback) => {\n callback(this.#queue);\n });\n };\n\n #getToastIndex = (toastId: string | undefined): number => {\n if (!toastId) {\n return -1;\n }\n\n return this.#queue.findIndex((toast) => toast.toastId === toastId);\n };\n\n #getToast = (toastId: string | undefined): QueuedToast | undefined => {\n return this.#queue[this.#getToastIndex(toastId)];\n };\n\n /**\n * Starts the exit transition for the currently shown toast and adds the next\n * toast into the queue. This requires a manual call to `this.#emit()`\n * afterwards.\n */\n #addToastImmediately = (nextToast: QueuedToast): void => {\n const [current] = this.#queue;\n this.clearTimer(current.toastId);\n this.#queue[0] = {\n ...current,\n visible: false,\n };\n if (nextToast.priority === \"immediate\") {\n this.#queue.splice(1, 0, nextToast, current);\n } else {\n this.#queue.splice(1, 0, nextToast);\n }\n };\n\n /**\n * This calls `this.#emit()` if the toast was updated\n */\n #updateToast = (\n toastIdOrIndex: string | number,\n patch: Partial<QueuedToast>\n ): void => {\n const index =\n typeof toastIdOrIndex === \"number\"\n ? toastIdOrIndex\n : this.#getToastIndex(toastIdOrIndex);\n\n if (index === -1) {\n return;\n }\n\n this.#queue[index] = {\n ...this.#queue[index],\n ...patch,\n };\n this.#emit();\n };\n\n /**\n * This is just used to subscribe to changes in the {@link useToastQueue}.\n *\n * ```tsx\n * useSyncExternalStore(\n * toastManager.subscribe,\n * toastManager.getQueue,\n * toastManager.getQueue,\n * );\n * ```\n *\n * @internal\n */\n subscribe = (callback: ToastCallback): (() => void) => {\n this.#listeners.push(callback);\n\n return () => {\n this.#listeners = this.#listeners.filter((cb) => cb !== callback);\n };\n };\n\n /**\n * @see {@link subscribe}\n * @internal\n */\n getQueue = (): ToastQueue => {\n return this.#queue;\n };\n\n /**\n * Either adds the toast to the queue or updates an existing toast when using\n * an existing `toastId`.\n *\n * @example Adding toasts\n * ```tsx\n * // create a toast when the user is offline that will not disappear\n * addToast({ toastId: \"offline\", visibleTime: null });\n *\n * // add a new toast that displays `\"Toast\"` to the queue\n * addToast({ children: \"Toast!\" });\n *\n * // add an online toast notification. since these three use the same toast\n * // id, the hide timer will be reset each time\n * addToast({ toastId: \"online\" });\n * addToast({ toastId: \"online\" });\n * addToast({ toastId: \"online\" });\n *\n * // add a server error toast to the queue where the second one will be\n * // ignored\n * addToast({\n * toastId: \"ServerError\",\n * theme: \"error\",\n * duplicates: \"prevent\",\n * });\n * addToast({\n * toastId: \"ServerError\",\n * theme: \"error\",\n * duplicates: \"prevent\",\n * });\n *\n * // add a toast to the queue that has an action button that says \"Goodbye\"\n * addToast({\n * children: \"Hello, world!\",\n * action: \"Goodbye\",\n * });\n *\n * // add a toast to the queue that has an action button that says \"Goodbye\"\n * // and a custom click handler\n * addToast({\n * children: \"Hello, world!\",\n * action: {\n * onClick: () => {\n * logout();\n * },\n * children: \"Goodbye\",\n * },\n * });\n *\n * // add a toast to the queue that renders a react component in the content,\n * // a custom action button implementation (using `ToastActionButton`), and a\n * // close button\n * addToast({\n * children: <SomeCustomComponent />,\n * actionButton: <SomeCustomActionButton />,\n * closeButton: true,\n * });\n * ```\n */\n addToast = (toast: CreateToastOptions): void => {\n const {\n toastId = nanoid(),\n visibleTime = DEFAULT_TOAST_VISIBLE_TIME,\n role = visibleTime === null ? \"alert\" : \"status\",\n priority = \"normal\",\n duplicates = \"restart\",\n } = toast;\n\n const existingIndex = this.#getToastIndex(toast.toastId);\n if (existingIndex !== -1 && duplicates !== \"allow\") {\n const existingToast = this.#queue[existingIndex];\n const nextToast: QueuedToast = {\n ...existingToast,\n ...toast,\n };\n\n // reorder/move the existing toast to be the next item in the queue by:\n // - removing the toast from the queue\n // - inserting it into the next position with the updates\n if (priority === \"next\" && existingIndex > 1) {\n this.#queue.splice(existingIndex, 1);\n this.#queue.splice(1, 0, nextToast);\n this.#emit();\n return;\n }\n\n // only need to reorder the queue if it is not being shown\n if (\n (priority === \"replace\" || priority === \"immediate\") &&\n existingIndex !== 0\n ) {\n this.#queue.splice(existingIndex, 1);\n this.#addToastImmediately(nextToast);\n this.#emit();\n return;\n }\n\n const timers = this.#timers.get(toastId);\n if (existingToast.visible && duplicates === \"restart\" && timers) {\n this.#timers.set(toastId, { ...timers, elapsedTime: 0 });\n\n // wait for the next resume event instead. this _should_ only happen\n // when hovering a toast and another toast replaces it\n if (!nextToast.paused) {\n this.startRemoveTimeout(toastId);\n }\n }\n\n this.#updateToast(existingIndex, toast);\n return;\n }\n\n const nextToast: QueuedToast = {\n ...toast,\n role,\n paused: false,\n visible: true,\n toastId,\n priority,\n duplicates,\n visibleTime,\n };\n\n const queueSize = this.#queue.length;\n if (priority === \"next\" && queueSize > 1) {\n this.#queue.splice(1, 0, nextToast);\n } else if (\n (priority === \"replace\" || priority === \"immediate\") &&\n queueSize > 0\n ) {\n this.#addToastImmediately(nextToast);\n } else {\n this.#queue.push(nextToast);\n }\n\n this.#emit();\n };\n\n /**\n * Attempts to start the timeout for removing the toast when the `visibleTime`\n * is not null for a toast.\n *\n * @param toastId - The specific toastId to update\n */\n startRemoveTimeout = (toastId: string): void => {\n const toast = this.#getToast(toastId);\n if (!toast) {\n return;\n }\n\n const { visibleTime } = toast;\n if (visibleTime === null) {\n // Must manually be closed\n return;\n }\n\n const cached = this.#timers.get(toastId);\n const timers = (cached && { ...cached }) || {\n inactive: false,\n startTime: Date.now(),\n elapsedTime: 0,\n };\n window.clearTimeout(timers.exitTimeout);\n\n let duration = visibleTime;\n if (timers.elapsedTime) {\n duration -= timers.elapsedTime;\n }\n\n timers.inactive = false;\n timers.exitTimeout = window.setTimeout(() => {\n this.removeToast(toastId, true);\n }, duration);\n this.#timers.set(toastId, timers);\n };\n\n /**\n * Pauses the remove timeout for a specific toast normally with hover events\n * or the browser becoming inactive.\n *\n * @param toastId - The specific toastId to pause\n */\n pauseRemoveTimeout = (toastId: string): void => {\n const toast = this.#getToast(toastId);\n const cached = this.#timers.get(toastId);\n if (!toast || !cached || cached.inactive) {\n return;\n }\n\n window.clearTimeout(cached.exitTimeout);\n const timers = { ...cached };\n timers.inactive = true;\n timers.elapsedTime = Date.now() - timers.startTime + timers.elapsedTime;\n this.#timers.set(toastId, timers);\n this.#updateToast(toastId, { paused: true });\n };\n\n /**\n * Resumes the current remove timeout if it was paused by\n * {@link pauseRemoveTimeout}.\n *\n * @param toastId - The specific toastId to resume\n */\n resumeRemoveTimeout = (toastId: string): void => {\n const toastIndex = this.#getToastIndex(toastId);\n const timers = this.#timers.get(toastId);\n if (toastIndex === -1 || !timers?.startTime) {\n return;\n }\n\n timers.startTime = Date.now();\n this.#updateToast(toastIndex, { paused: false });\n this.startRemoveTimeout(toastId);\n };\n\n /**\n * Removes a toast by id from the queue without any exit animation.\n *\n * @param toastId - The specific {@link QueuedToast.toastId}\n * @param transition - Set this to `true` to remove the toast by the exit\n * transition instead of immediately.\n */\n removeToast = (toastId: string, transition: boolean): void => {\n const toastIndex = this.#getToastIndex(toastId);\n if (toastIndex === -1) {\n return;\n }\n\n if (transition) {\n this.clearTimer(toastId);\n this.#updateToast(toastIndex, { visible: false });\n return;\n }\n\n this.#queue.splice(toastIndex, 1);\n this.#emit();\n };\n\n /**\n * Clears any pending timers for the provided toast id. This should generally\n * be used in the `useEffect` cleanup effect for any custom toast renderer\n * implementations.\n *\n * @example\n * ```tsx\n * const { toastId } = toast;\n * const toastManager = useToastManager();\n *\n * useEffect(() => {\n * return () => {\n * toastManager.clearTimer(toastId):\n * }\n * }, [toastManager, toastId]);\n * ```\n */\n clearTimer = (toastId: string): void => {\n const timer = this.#timers.get(toastId);\n window.clearTimeout(timer?.exitTimeout);\n this.#timers.delete(toastId);\n };\n\n /**\n * Removes first toast from the queue without any exit animation. You most\n * likely want to use {@link removeToast} instead.\n */\n popToast = (): void => {\n this.#queue.pop();\n this.#emit();\n };\n\n /**\n * Removes all toasts from the queue. There will be no exit animation.\n *\n * @param disableEmit - Set this to `true` to disable emitting the empty queue.\n * Mostly used for tests.\n */\n clearToasts = (disableEmit = false): void => {\n this.#queue = [];\n this.#timers.forEach((meta) => {\n window.clearTimeout(meta.exitTimeout);\n });\n this.#timers.clear();\n if (!disableEmit) {\n this.#emit();\n }\n };\n}\n\n/**\n * The default toast manager for react-md apps that will allow toasts to be\n * added without setting up the {@link ToastManagerProvider}.\n *\n * @internal\n * @since 6.0.0\n */\nexport const toastManager = new ToastManager();\n\n/**\n * @see {@link ToastManager.addToast}\n * @since 6.0.0\n */\nexport const addToast: ToastManager[\"addToast\"] = (toast) => {\n toastManager.addToast(toast);\n};\n\n/**\n * @see {@link ToastManager.startRemoveTimeout}\n * @since 6.0.0\n */\nexport const startRemoveToastTimeout: ToastManager[\"startRemoveTimeout\"] = (\n toastId\n) => {\n toastManager.startRemoveTimeout(toastId);\n};\n\n/**\n * @see {@link ToastManager.popToast}\n * @since 6.0.0\n */\nexport const popToast: ToastManager[\"popToast\"] = () => {\n toastManager.popToast();\n};\n\n/**\n * @see {@link ToastManager.removeToast}\n * @since 6.0.0\n */\nexport const removeToast: ToastManager[\"removeToast\"] = (\n toastId,\n transition\n) => {\n toastManager.removeToast(toastId, transition);\n};\n\n/**\n * @see {@link ToastManager.clearToasts}\n * @since 6.0.0\n */\nexport const clearToasts = (): void => {\n toastManager.clearToasts();\n};\n"],"names":["nanoid","DEFAULT_TOAST_VISIBLE_TIME","ToastManager","constructor","forEach","callback","toastId","findIndex","toast","nextToast","current","clearTimer","visible","priority","splice","toastIdOrIndex","patch","index","subscribe","push","filter","cb","getQueue","addToast","visibleTime","role","duplicates","existingIndex","existingToast","timers","get","set","elapsedTime","paused","startRemoveTimeout","queueSize","length","cached","inactive","startTime","Date","now","window","clearTimeout","exitTimeout","duration","setTimeout","removeToast","pauseRemoveTimeout","resumeRemoveTimeout","toastIndex","transition","timer","delete","popToast","pop","clearToasts","disableEmit","meta","clear","Map","toastManager","startRemoveToastTimeout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,MAAM,QAAQ,SAAS;AAGhC;;CAEC,GACD,OAAO,MAAMC,6BAA6B,KAAK;IA6H7C,sCACA,uCACA,0CAmBA,qCAQA,8CAQA,yCAIA;;;;GAIC,GACD,oDAcA;;GAEC,GACD;AArEF;;;;CAIC,GACD,OAAO,MAAMC;IAKXC,aAAc;QAJd,gCAAA;;mBAAA,KAAA;;QACA,gCAAA;;mBAAA,KAAA;;QACA,gCAAA;;mBAAA,KAAA;;QAmBA,gCAAA;;mBAAQ;gBACN,wCAAwC;+CACnC,QAAS;gDAAI,IAAI,EAAC;iBAAO;gBAC9B,yBAAA,IAAI,EAAC,YAAWC,OAAO,CAAC,CAACC;oBACvBA,kCAAS,IAAI,EAAC;gBAChB;YACF;;QAEA,gCAAA;;mBAAiB,CAACC;gBAChB,IAAI,CAACA,SAAS;oBACZ,OAAO,CAAC;gBACV;gBAEA,OAAO,yBAAA,IAAI,EAAC,QAAOC,SAAS,CAAC,CAACC,QAAUA,MAAMF,OAAO,KAAKA;YAC5D;;QAEA,gCAAA;;mBAAY,CAACA;gBACX,OAAO,yBAAA,IAAI,EAAC,OAAM,CAAC,yBAAA,IAAI,EAAC,qBAAL,IAAI,EAAgBA,SAAS;YAClD;;QAOA,gCAAA;;mBAAuB,CAACG;gBACtB,MAAM,CAACC,QAAQ,4BAAG,IAAI,EAAC;gBACvB,IAAI,CAACC,UAAU,CAACD,QAAQJ,OAAO;gBAC/B,yBAAA,IAAI,EAAC,OAAM,CAAC,EAAE,GAAG;oBACf,GAAGI,OAAO;oBACVE,SAAS;gBACX;gBACA,IAAIH,UAAUI,QAAQ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
169
169
 
170
170
  @if not $disable-action-button {
171
171
  &--action {
172
- @include utils.auto-rtl(
173
- padding-right,
174
- $action-horizontal-padding,
175
- $horizontal-padding
176
- );
172
+ padding-right: $action-horizontal-padding;
173
+
174
+ @include utils.rtl {
175
+ padding-left: $action-horizontal-padding;
176
+ padding-right: $horizontal-padding;
177
+ }
177
178
  }
178
179
  }
179
180
 
180
181
  @if not $disable-close-button {
181
182
  &--x {
182
- @include utils.auto-rtl(
183
- padding-right,
184
- $close-button-horizontal-padding,
185
- $horizontal-padding
186
- );
183
+ padding-right: $close-button-horizontal-padding;
184
+
185
+ @include utils.rtl {
186
+ padding-left: $close-button-horizontal-padding;
187
+ padding-right: $horizontal-padding;
188
+ }
187
189
  }
188
190
 
189
191
  @if not $disable-action-button {
@@ -226,16 +228,23 @@ $variables: (background-color, color, offset);
226
228
 
227
229
  @if not $disable-action-button {
228
230
  &--action {
229
- @include utils.auto-rtl(
230
- padding-right,
231
- button.$text-horizontal-padding
232
- );
231
+ padding-right: button.$text-horizontal-padding;
232
+
233
+ @include utils.rtl {
234
+ padding-left: button.$text-horizontal-padding;
235
+ padding-right: 0;
236
+ }
233
237
  }
234
238
  }
235
239
 
236
240
  @if not $disable-close-button and not $disable-action-button {
237
241
  &--gap {
238
- @include utils.auto-rtl(margin-right, $toast-gap);
242
+ margin-right: $toast-gap;
243
+
244
+ @include utils.rtl {
245
+ margin-left: $toast-gap;
246
+ margin-right: 0;
247
+ }
239
248
  }
240
249
  }
241
250
  }
@@ -254,10 +263,14 @@ $variables: (background-color, color, offset);
254
263
  justify-self: flex-end;
255
264
 
256
265
  &--reordered {
257
- @include utils.auto-rtl(margin-right, $action-horizontal-padding);
258
-
259
266
  grid-column-end: span 2;
267
+ margin-right: $action-horizontal-padding;
260
268
  order: 3;
269
+
270
+ @include utils.rtl {
271
+ margin-left: $action-horizontal-padding;
272
+ margin-right: 0;
273
+ }
261
274
  }
262
275
  }
263
276
  }
@@ -6,15 +6,15 @@
6
6
  */
7
7
  export interface CurrentToastActions {
8
8
  /** @see {@link ToastManager.clearTimer} */
9
- clearTimer(): void;
9
+ clearTimer: () => void;
10
10
  /** @see {@link ToastManager.removeToast} */
11
- removeToast(transition: boolean): void;
11
+ removeToast: (transition: boolean) => void;
12
12
  /** @see {@link ToastManager.startRemoveTimeout} */
13
- startRemoveTimeout(): void;
13
+ startRemoveTimeout: () => void;
14
14
  /** @see {@link ToastManager.pauseRemoveTimeout} */
15
- pauseRemoveTimeout(): void;
15
+ pauseRemoveTimeout: () => void;
16
16
  /** @see {@link ToastManager.resumeRemoveTimeout} */
17
- resumeRemoveTimeout(): void;
17
+ resumeRemoveTimeout: () => void;
18
18
  }
19
19
  /**
20
20
  * @since 6.0.0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/snackbar/useCurrentToastActions.ts"],"sourcesContent":["\"use client\";\nimport { createContext, useContext } from \"react\";\n\n/**\n * A simplified version of the {@link ToastManager} that has the actions bound\n * to the current {@link QueuedToast.toastId}.\n *\n * @since 6.0.0\n */\nexport interface CurrentToastActions {\n /** @see {@link ToastManager.clearTimer} */\n clearTimer(): void;\n /** @see {@link ToastManager.removeToast} */\n removeToast(transition: boolean): void;\n /** @see {@link ToastManager.startRemoveTimeout} */\n startRemoveTimeout(): void;\n /** @see {@link ToastManager.pauseRemoveTimeout} */\n pauseRemoveTimeout(): void;\n /** @see {@link ToastManager.resumeRemoveTimeout} */\n resumeRemoveTimeout(): void;\n}\n\nconst context = createContext<CurrentToastActions | null>(null);\ncontext.displayName = \"CurrentToastActions\";\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport const { Provider: CurrentToastActionsProvider } = context;\n\n/**\n * This is only required if you have multiple `Snackbar` implementations in your\n * app.\n *\n * @since 6.0.0\n */\nexport function useCurrentToastActions(): CurrentToastActions {\n const actions = useContext(context);\n if (!actions) {\n throw new Error(\n \"The `CurrentToastActionsProvider` has not been initialized\"\n );\n }\n\n return actions;\n}\n"],"names":["createContext","useContext","context","displayName","Provider","CurrentToastActionsProvider","useCurrentToastActions","actions","Error"],"mappings":"AAAA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAqBlD,MAAMC,UAAUF,cAA0C;AAC1DE,QAAQC,WAAW,GAAG;AAEtB;;;CAGC,GACD,OAAO,MAAM,EAAEC,UAAUC,2BAA2B,EAAE,GAAGH,QAAQ;AAEjE;;;;;CAKC,GACD,OAAO,SAASI;IACd,MAAMC,UAAUN,WAAWC;IAC3B,IAAI,CAACK,SAAS;QACZ,MAAM,IAAIC,MACR;IAEJ;IAEA,OAAOD;AACT"}
1
+ {"version":3,"sources":["../../src/snackbar/useCurrentToastActions.ts"],"sourcesContent":["\"use client\";\nimport { createContext, useContext } from \"react\";\n\n/**\n * A simplified version of the {@link ToastManager} that has the actions bound\n * to the current {@link QueuedToast.toastId}.\n *\n * @since 6.0.0\n */\nexport interface CurrentToastActions {\n /** @see {@link ToastManager.clearTimer} */\n clearTimer: () => void;\n /** @see {@link ToastManager.removeToast} */\n removeToast: (transition: boolean) => void;\n /** @see {@link ToastManager.startRemoveTimeout} */\n startRemoveTimeout: () => void;\n /** @see {@link ToastManager.pauseRemoveTimeout} */\n pauseRemoveTimeout: () => void;\n /** @see {@link ToastManager.resumeRemoveTimeout} */\n resumeRemoveTimeout: () => void;\n}\n\nconst context = createContext<CurrentToastActions | null>(null);\ncontext.displayName = \"CurrentToastActions\";\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport const { Provider: CurrentToastActionsProvider } = context;\n\n/**\n * This is only required if you have multiple `Snackbar` implementations in your\n * app.\n *\n * @since 6.0.0\n */\nexport function useCurrentToastActions(): CurrentToastActions {\n const actions = useContext(context);\n if (!actions) {\n throw new Error(\n \"The `CurrentToastActionsProvider` has not been initialized\"\n );\n }\n\n return actions;\n}\n"],"names":["createContext","useContext","context","displayName","Provider","CurrentToastActionsProvider","useCurrentToastActions","actions","Error"],"mappings":"AAAA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAqBlD,MAAMC,UAAUF,cAA0C;AAC1DE,QAAQC,WAAW,GAAG;AAEtB;;;CAGC,GACD,OAAO,MAAM,EAAEC,UAAUC,2BAA2B,EAAE,GAAGH,QAAQ;AAEjE;;;;;CAKC,GACD,OAAO,SAASI;IACd,MAAMC,UAAUN,WAAWC;IAC3B,IAAI,CAACK,SAAS;QACZ,MAAM,IAAIC,MACR;IAEJ;IAEA,OAAOD;AACT"}
@@ -255,10 +255,11 @@ $row-selected-styles: (
255
255
  &--sticky {
256
256
  @include use-var(background-color, sticky-background-color);
257
257
  @include use-var(top, sticky-header);
258
- @include utils.map-to-styles($sticky-header-inactive-styles);
259
258
 
260
259
  position: sticky;
261
260
  z-index: $sticky-header-z-index;
261
+
262
+ @include utils.map-to-styles($sticky-header-inactive-styles);
262
263
  }
263
264
 
264
265
  &--sticky-active {
@@ -272,10 +273,11 @@ $row-selected-styles: (
272
273
  &--sticky {
273
274
  @include use-var(background-color, sticky-background-color);
274
275
  @include use-var(bottom, sticky-footer);
275
- @include utils.map-to-styles($sticky-footer-inactive-styles);
276
276
 
277
277
  position: sticky;
278
278
  z-index: $sticky-footer-z-index;
279
+
280
+ @include utils.map-to-styles($sticky-footer-inactive-styles);
279
281
  }
280
282
 
281
283
  &--sticky-active {
@@ -357,9 +359,9 @@ $row-selected-styles: (
357
359
  }
358
360
 
359
361
  &--sticky-cell {
360
- @include utils.auto-rtl(left, get-var(sticky-cell));
361
362
  @include theme.theme-use-var(background-color);
362
363
 
364
+ @include use-var(left, sticky-cell);
363
365
  transition: background-color transition.$linear-duration;
364
366
  z-index: $sticky-cell-z-index;
365
367
 
@@ -441,6 +443,16 @@ $row-selected-styles: (
441
443
  width: 100%;
442
444
  }
443
445
  }
446
+
447
+ @if not $disable-sticky-cell {
448
+ @include utils.rtl {
449
+ &--sticky-cell {
450
+ @include use-var(right, sticky-cell);
451
+
452
+ left: auto;
453
+ }
454
+ }
455
+ }
444
456
  }
445
457
  }
446
458
  }
@@ -5,13 +5,17 @@ export interface TableCellClassNameOptions {
5
5
  /**
6
6
  * Set this to `true` if the cell is rendered as a `<th>` so that the correct
7
7
  * sticky styles can be applied.
8
+ *
9
+ * @defaultValue `false`
8
10
  */
9
- header: boolean;
11
+ header?: boolean;
10
12
  /**
11
13
  * Set this to true if the cell is rendered in a `<thead>` so that the correct
12
14
  * sticky styles can be applied.
15
+ *
16
+ * @defaultValue `header`
13
17
  */
14
- isInTableHeader: boolean;
18
+ isInTableHeader?: boolean;
15
19
  /** @defaultValue `false` */
16
20
  grow?: boolean;
17
21
  /** @defaultValue `false` */
@@ -30,4 +34,4 @@ export interface TableCellClassNameOptions {
30
34
  /**
31
35
  * @since 6.0.0
32
36
  */
33
- export declare function tableCell(options: TableCellClassNameOptions): string;
37
+ export declare function tableCell(options?: TableCellClassNameOptions): string;
@@ -2,8 +2,8 @@ import { cnb } from "cnbuilder";
2
2
  import { cssUtils } from "../cssUtils.js";
3
3
  /**
4
4
  * @since 6.0.0
5
- */ export function tableCell(options) {
6
- const { grow, sticky, header, inputToggle, hAlign, vAlign, lineWrap = true, padding = "horizontal", isInTableHeader, className } = options;
5
+ */ export function tableCell(options = {}) {
6
+ const { grow, sticky, header, inputToggle, hAlign = "left", vAlign = "middle", lineWrap = true, padding = "horizontal", isInTableHeader = header, className } = options;
7
7
  // using `&&` instead of `bem` since the latest version of typescript does not
8
8
  // support setting the same object key (empty string)
9
9
  const p = "rmd-table-cell--";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/table/tableCellStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport {\n type TableCellHorizontalAlignment,\n type TableCellVerticalAlignment,\n} from \"./types.js\";\n\n/** @since 6.0.0 */\nexport interface TableCellClassNameOptions {\n className?: string;\n\n /**\n * Set this to `true` if the cell is rendered as a `<th>` so that the correct\n * sticky styles can be applied.\n */\n header: boolean;\n\n /**\n * Set this to true if the cell is rendered in a `<thead>` so that the correct\n * sticky styles can be applied.\n */\n isInTableHeader: boolean;\n\n /** @defaultValue `false` */\n grow?: boolean;\n\n /** @defaultValue `false` */\n sticky?: boolean;\n\n /** @defaultValue `false` */\n inputToggle?: boolean;\n\n hAlign?: TableCellHorizontalAlignment;\n vAlign?: TableCellVerticalAlignment;\n\n /** @defaultValue `true` */\n lineWrap?: boolean;\n\n /**\n * @defaultValue `\"horizontal\"`\n */\n padding?: \"horizontal\" | \"vertical\" | \"none\";\n}\n\n/**\n * @since 6.0.0\n */\nexport function tableCell(options: TableCellClassNameOptions): string {\n const {\n grow,\n sticky,\n header,\n inputToggle,\n hAlign,\n vAlign,\n lineWrap = true,\n padding = \"horizontal\",\n isInTableHeader,\n className,\n } = options;\n\n // using `&&` instead of `bem` since the latest version of typescript does not\n // support setting the same object key (empty string)\n const p = \"rmd-table-cell--\";\n return cnb(\n \"rmd-table-cell\",\n grow && `${p}grow`,\n header && `${p}header`,\n sticky && `${p}sticky`,\n inputToggle && `${p}input-toggle`,\n sticky && (!isInTableHeader || inputToggle) && `${p}sticky-cell`,\n sticky && isInTableHeader && `${p}sticky-header`,\n sticky && isInTableHeader && inputToggle && `${p}header-cell`,\n vAlign && vAlign !== \"middle\" && `${p}${vAlign}`,\n !lineWrap && `${p}no-wrap`,\n padding === \"vertical\" && `${p}v-padding`,\n padding === \"none\" && `${p}no-padding`,\n cssUtils({\n textAlign: hAlign,\n }),\n className\n );\n}\n"],"names":["cnb","cssUtils","tableCell","options","grow","sticky","header","inputToggle","hAlign","vAlign","lineWrap","padding","isInTableHeader","className","p","textAlign"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,QAAQ,QAAQ,iBAAiB;AA2C1C;;CAEC,GACD,OAAO,SAASC,UAAUC,OAAkC;IAC1D,MAAM,EACJC,IAAI,EACJC,MAAM,EACNC,MAAM,EACNC,WAAW,EACXC,MAAM,EACNC,MAAM,EACNC,WAAW,IAAI,EACfC,UAAU,YAAY,EACtBC,eAAe,EACfC,SAAS,EACV,GAAGV;IAEJ,8EAA8E;IAC9E,qDAAqD;IACrD,MAAMW,IAAI;IACV,OAAOd,IACL,kBACAI,QAAQ,CAAC,EAAEU,EAAE,IAAI,CAAC,EAClBR,UAAU,CAAC,EAAEQ,EAAE,MAAM,CAAC,EACtBT,UAAU,CAAC,EAAES,EAAE,MAAM,CAAC,EACtBP,eAAe,CAAC,EAAEO,EAAE,YAAY,CAAC,EACjCT,UAAW,CAAA,CAACO,mBAAmBL,WAAU,KAAM,CAAC,EAAEO,EAAE,WAAW,CAAC,EAChET,UAAUO,mBAAmB,CAAC,EAAEE,EAAE,aAAa,CAAC,EAChDT,UAAUO,mBAAmBL,eAAe,CAAC,EAAEO,EAAE,WAAW,CAAC,EAC7DL,UAAUA,WAAW,YAAY,CAAC,EAAEK,EAAE,EAAEL,OAAO,CAAC,EAChD,CAACC,YAAY,CAAC,EAAEI,EAAE,OAAO,CAAC,EAC1BH,YAAY,cAAc,CAAC,EAAEG,EAAE,SAAS,CAAC,EACzCH,YAAY,UAAU,CAAC,EAAEG,EAAE,UAAU,CAAC,EACtCb,SAAS;QACPc,WAAWP;IACb,IACAK;AAEJ"}
1
+ {"version":3,"sources":["../../src/table/tableCellStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport {\n type TableCellHorizontalAlignment,\n type TableCellVerticalAlignment,\n} from \"./types.js\";\n\n/** @since 6.0.0 */\nexport interface TableCellClassNameOptions {\n className?: string;\n\n /**\n * Set this to `true` if the cell is rendered as a `<th>` so that the correct\n * sticky styles can be applied.\n *\n * @defaultValue `false`\n */\n header?: boolean;\n\n /**\n * Set this to true if the cell is rendered in a `<thead>` so that the correct\n * sticky styles can be applied.\n *\n * @defaultValue `header`\n */\n isInTableHeader?: boolean;\n\n /** @defaultValue `false` */\n grow?: boolean;\n\n /** @defaultValue `false` */\n sticky?: boolean;\n\n /** @defaultValue `false` */\n inputToggle?: boolean;\n\n hAlign?: TableCellHorizontalAlignment;\n vAlign?: TableCellVerticalAlignment;\n\n /** @defaultValue `true` */\n lineWrap?: boolean;\n\n /**\n * @defaultValue `\"horizontal\"`\n */\n padding?: \"horizontal\" | \"vertical\" | \"none\";\n}\n\n/**\n * @since 6.0.0\n */\nexport function tableCell(options: TableCellClassNameOptions = {}): string {\n const {\n grow,\n sticky,\n header,\n inputToggle,\n hAlign = \"left\",\n vAlign = \"middle\",\n lineWrap = true,\n padding = \"horizontal\",\n isInTableHeader = header,\n className,\n } = options;\n\n // using `&&` instead of `bem` since the latest version of typescript does not\n // support setting the same object key (empty string)\n const p = \"rmd-table-cell--\";\n return cnb(\n \"rmd-table-cell\",\n grow && `${p}grow`,\n header && `${p}header`,\n sticky && `${p}sticky`,\n inputToggle && `${p}input-toggle`,\n sticky && (!isInTableHeader || inputToggle) && `${p}sticky-cell`,\n sticky && isInTableHeader && `${p}sticky-header`,\n sticky && isInTableHeader && inputToggle && `${p}header-cell`,\n vAlign && vAlign !== \"middle\" && `${p}${vAlign}`,\n !lineWrap && `${p}no-wrap`,\n padding === \"vertical\" && `${p}v-padding`,\n padding === \"none\" && `${p}no-padding`,\n cssUtils({\n textAlign: hAlign,\n }),\n className\n );\n}\n"],"names":["cnb","cssUtils","tableCell","options","grow","sticky","header","inputToggle","hAlign","vAlign","lineWrap","padding","isInTableHeader","className","p","textAlign"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,QAAQ,QAAQ,iBAAiB;AA+C1C;;CAEC,GACD,OAAO,SAASC,UAAUC,UAAqC,CAAC,CAAC;IAC/D,MAAM,EACJC,IAAI,EACJC,MAAM,EACNC,MAAM,EACNC,WAAW,EACXC,SAAS,MAAM,EACfC,SAAS,QAAQ,EACjBC,WAAW,IAAI,EACfC,UAAU,YAAY,EACtBC,kBAAkBN,MAAM,EACxBO,SAAS,EACV,GAAGV;IAEJ,8EAA8E;IAC9E,qDAAqD;IACrD,MAAMW,IAAI;IACV,OAAOd,IACL,kBACAI,QAAQ,GAAGU,EAAE,IAAI,CAAC,EAClBR,UAAU,GAAGQ,EAAE,MAAM,CAAC,EACtBT,UAAU,GAAGS,EAAE,MAAM,CAAC,EACtBP,eAAe,GAAGO,EAAE,YAAY,CAAC,EACjCT,UAAW,CAAA,CAACO,mBAAmBL,WAAU,KAAM,GAAGO,EAAE,WAAW,CAAC,EAChET,UAAUO,mBAAmB,GAAGE,EAAE,aAAa,CAAC,EAChDT,UAAUO,mBAAmBL,eAAe,GAAGO,EAAE,WAAW,CAAC,EAC7DL,UAAUA,WAAW,YAAY,GAAGK,IAAIL,QAAQ,EAChD,CAACC,YAAY,GAAGI,EAAE,OAAO,CAAC,EAC1BH,YAAY,cAAc,GAAGG,EAAE,SAAS,CAAC,EACzCH,YAAY,UAAU,GAAGG,EAAE,UAAU,CAAC,EACtCb,SAAS;QACPc,WAAWP;IACb,IACAK;AAEJ"}
@@ -1,9 +1,10 @@
1
1
  import { type AnchorHTMLAttributes, type ButtonHTMLAttributes, type ReactElement, type ReactNode } from "react";
2
+ import { type ComponentWithRippleProps } from "../interaction/types.js";
2
3
  import { type CustomLinkComponent } from "../link/Link.js";
3
4
  /**
4
5
  * @since 6.0.0
5
6
  */
6
- export interface BaseTabProps {
7
+ export interface BaseTabProps extends ComponentWithRippleProps {
7
8
  /**
8
9
  * Set this to `true` if the tab is currently active.
9
10
  *
package/dist/tabs/Tab.js CHANGED
@@ -15,11 +15,12 @@ import { tab } from "./tabStyles.js";
15
15
  *
16
16
  * @since 6.0.0
17
17
  */ export function Tab(props) {
18
- const { id: propId, as: Component = "button", active, activeIndicator, verticalActiveIndicator, icon, iconAfter, stacked, className, children: propChildren, onBlur, onClick, onKeyDown, onKeyUp, onMouseDown, onMouseUp, onMouseLeave, onDragStart, onTouchStart, onTouchEnd, onTouchMove, ...remaining } = props;
18
+ const { id: propId, as: Component = "button", active, activeIndicator, verticalActiveIndicator, icon, iconAfter, stacked, className, children: propChildren, onBlur, onClick, onKeyDown, onKeyUp, onMouseDown, onMouseUp, onMouseLeave, onDragStart, onTouchStart, onTouchEnd, onTouchMove, disableRipple, ...remaining } = props;
19
19
  const { disabled } = props;
20
20
  const id = useEnsuredId(propId, "tab");
21
21
  const { activeDescendantId } = useKeyboardMovementContext();
22
22
  const { ripples, handlers } = useElementInteraction({
23
+ mode: disableRipple ? "none" : undefined,
23
24
  onBlur,
24
25
  onClick,
25
26
  onKeyDown,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/tabs/Tab.tsx"],"sourcesContent":["\"use client\";\nimport {\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { type CustomLinkComponent } from \"../link/Link.js\";\nimport { useKeyboardMovementContext } from \"../movement/useKeyboardMovementProvider.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { tab } from \"./tabStyles.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type useTabs } from \"./useTabs.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type TabListProps } from \"./TabList.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface BaseTabProps {\n /**\n * Set this to `true` if the tab is currently active.\n *\n * This is normally provided by the {@link useTabs} hook.\n */\n active: boolean;\n\n /**\n * Set this to `true` if the {@link TabListProps.disableTransition} prop has\n * also been set to `true` to disable an active indicator below the tab when\n * {@link active} is `true`.\n *\n * @defaultValue `false`\n */\n activeIndicator?: boolean;\n\n /**\n * Set this to `true` when rendering the tabs vertically and\n * {@link activeIndicator} has been enabled.\n *\n * @defaultValue !false\n */\n verticalActiveIndicator?: boolean;\n\n /**\n * An optional icon to render with the with the {@link children}. The default\n * behavior will render this icon before the children.\n *\n * @see {@link iconAfter}\n * @see {@link stacked}\n */\n icon?: ReactNode;\n\n /**\n * Set this to `true` to render the {@link icon} after the {@link children}.\n *\n * @defaultValue `false`\n */\n iconAfter?: boolean;\n\n /**\n * Set this to `true` to render the {@link icon} and {@link children} stacked\n * instead of horizontally.\n *\n * @defaultValue `false`\n */\n stacked?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface TabButtonProps\n extends BaseTabProps,\n ButtonHTMLAttributes<HTMLButtonElement> {\n as?: \"button\";\n}\n\n/**\n * @since 6.0.0\n */\nexport interface TabLinkProps\n extends BaseTabProps,\n AnchorHTMLAttributes<HTMLAnchorElement> {\n as: CustomLinkComponent;\n}\n\n/**\n * @since 6.0.0\n */\nexport type TabProps = TabButtonProps | TabLinkProps;\n\n/**\n * **Client Component**\n *\n * This component should usually be used with the `TabsList` component and\n * `useTabs` hook.\n *\n * @see {@link useTabs}\n *\n * @since 6.0.0\n */\nexport function Tab(props: TabProps): ReactElement {\n const {\n id: propId,\n as: Component = \"button\",\n active,\n activeIndicator,\n verticalActiveIndicator,\n icon,\n iconAfter,\n stacked,\n className,\n children: propChildren,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n ...remaining\n } = props as TabButtonProps;\n const { disabled } = props as TabButtonProps;\n\n const id = useEnsuredId(propId, \"tab\");\n const { activeDescendantId } = useKeyboardMovementContext();\n const { ripples, handlers } = 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 const isLink = Component !== \"button\";\n const children = useHigherContrastChildren(propChildren);\n let buttonOnlyProps: Record<string, unknown> | undefined;\n if (!isLink) {\n buttonOnlyProps = { type: \"button\" };\n }\n\n return (\n <Component\n {...remaining}\n {...buttonOnlyProps}\n {...handlers}\n aria-selected={active}\n id={id}\n role=\"tab\"\n tabIndex={id === activeDescendantId ? 0 : -1}\n className={tab({\n className,\n active,\n isLink,\n stacked: !!icon && stacked,\n disabled,\n reversed: !!icon && iconAfter,\n activeIndicator,\n verticalActiveIndicator,\n })}\n >\n {icon}\n {children}\n {ripples}\n </Component>\n );\n}\n"],"names":["useElementInteraction","useHigherContrastChildren","useKeyboardMovementContext","useEnsuredId","tab","Tab","props","id","propId","as","Component","active","activeIndicator","verticalActiveIndicator","icon","iconAfter","stacked","className","children","propChildren","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","remaining","disabled","activeDescendantId","ripples","handlers","isLink","buttonOnlyProps","type","aria-selected","role","tabIndex","reversed"],"mappings":"AAAA;;AAOA,SAASA,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AAExF,SAASC,0BAA0B,QAAQ,6CAA6C;AACxF,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,GAAG,QAAQ,iBAAiB;AAmFrC;;;;;;;;;CASC,GACD,OAAO,SAASC,IAAIC,KAAe;IACjC,MAAM,EACJC,IAAIC,MAAM,EACVC,IAAIC,YAAY,QAAQ,EACxBC,MAAM,EACNC,eAAe,EACfC,uBAAuB,EACvBC,IAAI,EACJC,SAAS,EACTC,OAAO,EACPC,SAAS,EACTC,UAAUC,YAAY,EACtBC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,WAAW,EACXC,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,WAAW,EACX,GAAGC,WACJ,GAAGzB;IACJ,MAAM,EAAE0B,QAAQ,EAAE,GAAG1B;IAErB,MAAMC,KAAKJ,aAAaK,QAAQ;IAChC,MAAM,EAAEyB,kBAAkB,EAAE,GAAG/B;IAC/B,MAAM,EAAEgC,OAAO,EAAEC,QAAQ,EAAE,GAAGnC,sBAAsB;QAClDoB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAE;IACF;IAEA,MAAMI,SAAS1B,cAAc;IAC7B,MAAMQ,WAAWjB,0BAA0BkB;IAC3C,IAAIkB;IACJ,IAAI,CAACD,QAAQ;QACXC,kBAAkB;YAAEC,MAAM;QAAS;IACrC;IAEA,qBACE,MAAC5B;QACE,GAAGqB,SAAS;QACZ,GAAGM,eAAe;QAClB,GAAGF,QAAQ;QACZI,iBAAe5B;QACfJ,IAAIA;QACJiC,MAAK;QACLC,UAAUlC,OAAO0B,qBAAqB,IAAI,CAAC;QAC3ChB,WAAWb,IAAI;YACba;YACAN;YACAyB;YACApB,SAAS,CAAC,CAACF,QAAQE;YACnBgB;YACAU,UAAU,CAAC,CAAC5B,QAAQC;YACpBH;YACAC;QACF;;YAECC;YACAI;YACAgB;;;AAGP"}
1
+ {"version":3,"sources":["../../src/tabs/Tab.tsx"],"sourcesContent":["\"use client\";\nimport {\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { type CustomLinkComponent } from \"../link/Link.js\";\nimport { useKeyboardMovementContext } from \"../movement/useKeyboardMovementProvider.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { tab } from \"./tabStyles.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type useTabs } from \"./useTabs.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type TabListProps } from \"./TabList.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface BaseTabProps extends ComponentWithRippleProps {\n /**\n * Set this to `true` if the tab is currently active.\n *\n * This is normally provided by the {@link useTabs} hook.\n */\n active: boolean;\n\n /**\n * Set this to `true` if the {@link TabListProps.disableTransition} prop has\n * also been set to `true` to disable an active indicator below the tab when\n * {@link active} is `true`.\n *\n * @defaultValue `false`\n */\n activeIndicator?: boolean;\n\n /**\n * Set this to `true` when rendering the tabs vertically and\n * {@link activeIndicator} has been enabled.\n *\n * @defaultValue !false\n */\n verticalActiveIndicator?: boolean;\n\n /**\n * An optional icon to render with the with the {@link children}. The default\n * behavior will render this icon before the children.\n *\n * @see {@link iconAfter}\n * @see {@link stacked}\n */\n icon?: ReactNode;\n\n /**\n * Set this to `true` to render the {@link icon} after the {@link children}.\n *\n * @defaultValue `false`\n */\n iconAfter?: boolean;\n\n /**\n * Set this to `true` to render the {@link icon} and {@link children} stacked\n * instead of horizontally.\n *\n * @defaultValue `false`\n */\n stacked?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface TabButtonProps\n extends BaseTabProps,\n ButtonHTMLAttributes<HTMLButtonElement> {\n as?: \"button\";\n}\n\n/**\n * @since 6.0.0\n */\nexport interface TabLinkProps\n extends BaseTabProps,\n AnchorHTMLAttributes<HTMLAnchorElement> {\n as: CustomLinkComponent;\n}\n\n/**\n * @since 6.0.0\n */\nexport type TabProps = TabButtonProps | TabLinkProps;\n\n/**\n * **Client Component**\n *\n * This component should usually be used with the `TabsList` component and\n * `useTabs` hook.\n *\n * @see {@link useTabs}\n *\n * @since 6.0.0\n */\nexport function Tab(props: TabProps): ReactElement {\n const {\n id: propId,\n as: Component = \"button\",\n active,\n activeIndicator,\n verticalActiveIndicator,\n icon,\n iconAfter,\n stacked,\n className,\n children: propChildren,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disableRipple,\n ...remaining\n } = props as TabButtonProps;\n const { disabled } = props as TabButtonProps;\n\n const id = useEnsuredId(propId, \"tab\");\n const { activeDescendantId } = useKeyboardMovementContext();\n const { ripples, handlers } = useElementInteraction({\n mode: disableRipple ? \"none\" : undefined,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled,\n });\n\n const isLink = Component !== \"button\";\n const children = useHigherContrastChildren(propChildren);\n let buttonOnlyProps: Record<string, unknown> | undefined;\n if (!isLink) {\n buttonOnlyProps = { type: \"button\" };\n }\n\n return (\n <Component\n {...remaining}\n {...buttonOnlyProps}\n {...handlers}\n aria-selected={active}\n id={id}\n role=\"tab\"\n tabIndex={id === activeDescendantId ? 0 : -1}\n className={tab({\n className,\n active,\n isLink,\n stacked: !!icon && stacked,\n disabled,\n reversed: !!icon && iconAfter,\n activeIndicator,\n verticalActiveIndicator,\n })}\n >\n {icon}\n {children}\n {ripples}\n </Component>\n );\n}\n"],"names":["useElementInteraction","useHigherContrastChildren","useKeyboardMovementContext","useEnsuredId","tab","Tab","props","id","propId","as","Component","active","activeIndicator","verticalActiveIndicator","icon","iconAfter","stacked","className","children","propChildren","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","disableRipple","remaining","disabled","activeDescendantId","ripples","handlers","mode","undefined","isLink","buttonOnlyProps","type","aria-selected","role","tabIndex","reversed"],"mappings":"AAAA;;AAQA,SAASA,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AAExF,SAASC,0BAA0B,QAAQ,6CAA6C;AACxF,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,GAAG,QAAQ,iBAAiB;AAmFrC;;;;;;;;;CASC,GACD,OAAO,SAASC,IAAIC,KAAe;IACjC,MAAM,EACJC,IAAIC,MAAM,EACVC,IAAIC,YAAY,QAAQ,EACxBC,MAAM,EACNC,eAAe,EACfC,uBAAuB,EACvBC,IAAI,EACJC,SAAS,EACTC,OAAO,EACPC,SAAS,EACTC,UAAUC,YAAY,EACtBC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,WAAW,EACXC,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,aAAa,EACb,GAAGC,WACJ,GAAG1B;IACJ,MAAM,EAAE2B,QAAQ,EAAE,GAAG3B;IAErB,MAAMC,KAAKJ,aAAaK,QAAQ;IAChC,MAAM,EAAE0B,kBAAkB,EAAE,GAAGhC;IAC/B,MAAM,EAAEiC,OAAO,EAAEC,QAAQ,EAAE,GAAGpC,sBAAsB;QAClDqC,MAAMN,gBAAgB,SAASO;QAC/BlB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAG;IACF;IAEA,MAAMM,SAAS7B,cAAc;IAC7B,MAAMQ,WAAWjB,0BAA0BkB;IAC3C,IAAIqB;IACJ,IAAI,CAACD,QAAQ;QACXC,kBAAkB;YAAEC,MAAM;QAAS;IACrC;IAEA,qBACE,MAAC/B;QACE,GAAGsB,SAAS;QACZ,GAAGQ,eAAe;QAClB,GAAGJ,QAAQ;QACZM,iBAAe/B;QACfJ,IAAIA;QACJoC,MAAK;QACLC,UAAUrC,OAAO2B,qBAAqB,IAAI,CAAC;QAC3CjB,WAAWb,IAAI;YACba;YACAN;YACA4B;YACAvB,SAAS,CAAC,CAACF,QAAQE;YACnBiB;YACAY,UAAU,CAAC,CAAC/B,QAAQC;YACpBH;YACAC;QACF;;YAECC;YACAI;YACAiB;;;AAGP"}
@@ -1,13 +1,13 @@
1
1
  import { type HTMLAttributes } from "react";
2
+ import { type GetTabListScrollToOptions } from "./getTabListScrollToOptions.js";
2
3
  import { type BaseTabListScrollButtonProps } from "./TabListScrollButton.js";
3
4
  import { type TabsAlignment } from "./tabListStyles.js";
4
- import { type GetTabListScrollToOptions } from "./utils.js";
5
5
  /**
6
6
  * @since 6.0.0
7
7
  */
8
8
  export interface TabListProps extends HTMLAttributes<HTMLDivElement> {
9
9
  activeIndex: number;
10
- setActiveIndex(nextActiveIndex: number): void;
10
+ setActiveIndex: (nextActiveIndex: number) => void;
11
11
  /**
12
12
  * @defaultValue `"left"`
13
13
  */