@react-md/core 1.0.0-next.20 → 1.0.0-next.21

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 (1138) hide show
  1. package/dist/CoreProviders.d.ts +1 -0
  2. package/dist/CoreProviders.js +1 -0
  3. package/dist/CoreProviders.js.map +1 -1
  4. package/dist/NoSsr.d.ts +3 -1
  5. package/dist/NoSsr.js +3 -1
  6. package/dist/NoSsr.js.map +1 -1
  7. package/dist/RootHtml.d.ts +1 -1
  8. package/dist/RootHtml.js +1 -1
  9. package/dist/RootHtml.js.map +1 -1
  10. package/dist/SsrProvider.d.ts +1 -0
  11. package/dist/SsrProvider.js +1 -0
  12. package/dist/SsrProvider.js.map +1 -1
  13. package/dist/_a11y.scss +187 -0
  14. package/dist/_base.scss +479 -0
  15. package/dist/_box-shadows.scss +80 -71
  16. package/dist/_colors.scss +283 -279
  17. package/dist/_core.scss +5 -483
  18. package/dist/_object-fit.scss +27 -23
  19. package/dist/_utils.scss +225 -225
  20. package/dist/app-bar/AppBar.d.ts +3 -1
  21. package/dist/app-bar/AppBar.js +3 -1
  22. package/dist/app-bar/AppBar.js.map +1 -1
  23. package/dist/app-bar/AppBarTitle.d.ts +2 -1
  24. package/dist/app-bar/AppBarTitle.js +2 -1
  25. package/dist/app-bar/AppBarTitle.js.map +1 -1
  26. package/dist/app-bar/_app-bar.scss +112 -105
  27. package/dist/autocomplete/Autocomplete.d.ts +81 -2
  28. package/dist/autocomplete/Autocomplete.js +4 -2
  29. package/dist/autocomplete/Autocomplete.js.map +1 -1
  30. package/dist/autocomplete/AutocompleteChip.d.ts +1 -0
  31. package/dist/autocomplete/AutocompleteChip.js +1 -0
  32. package/dist/autocomplete/AutocompleteChip.js.map +1 -1
  33. package/dist/autocomplete/AutocompleteCircularProgress.d.ts +1 -0
  34. package/dist/autocomplete/AutocompleteCircularProgress.js +1 -0
  35. package/dist/autocomplete/AutocompleteCircularProgress.js.map +1 -1
  36. package/dist/autocomplete/AutocompleteClearButton.d.ts +1 -0
  37. package/dist/autocomplete/AutocompleteClearButton.js +4 -2
  38. package/dist/autocomplete/AutocompleteClearButton.js.map +1 -1
  39. package/dist/autocomplete/AutocompleteDropdownButton.d.ts +1 -0
  40. package/dist/autocomplete/AutocompleteDropdownButton.js +1 -0
  41. package/dist/autocomplete/AutocompleteDropdownButton.js.map +1 -1
  42. package/dist/autocomplete/AutocompleteListboxChildren.d.ts +1 -3
  43. package/dist/autocomplete/AutocompleteListboxChildren.js.map +1 -1
  44. package/dist/autocomplete/_autocomplete.scss +125 -71
  45. package/dist/autocomplete/autocompleteStyles.d.ts +3 -0
  46. package/dist/autocomplete/autocompleteStyles.js +5 -2
  47. package/dist/autocomplete/autocompleteStyles.js.map +1 -1
  48. package/dist/autocomplete/types.d.ts +128 -82
  49. package/dist/autocomplete/types.js.map +1 -1
  50. package/dist/autocomplete/useAutocomplete.d.ts +3 -0
  51. package/dist/autocomplete/useAutocomplete.js +17 -17
  52. package/dist/autocomplete/useAutocomplete.js.map +1 -1
  53. package/dist/autocomplete/utils.d.ts +3 -6
  54. package/dist/autocomplete/utils.js.map +1 -1
  55. package/dist/avatar/Avatar.d.ts +2 -1
  56. package/dist/avatar/Avatar.js +2 -1
  57. package/dist/avatar/Avatar.js.map +1 -1
  58. package/dist/avatar/_avatar.scss +81 -77
  59. package/dist/badge/Badge.d.ts +8 -4
  60. package/dist/badge/Badge.js +8 -4
  61. package/dist/badge/Badge.js.map +1 -1
  62. package/dist/badge/_badge.scss +72 -68
  63. package/dist/box/Box.d.ts +4 -3
  64. package/dist/box/Box.js +4 -3
  65. package/dist/box/Box.js.map +1 -1
  66. package/dist/box/_box.scss +115 -119
  67. package/dist/button/AsyncButton.d.ts +3 -2
  68. package/dist/button/AsyncButton.js +4 -3
  69. package/dist/button/AsyncButton.js.map +1 -1
  70. package/dist/button/Button.d.ts +11 -9
  71. package/dist/button/Button.js +11 -9
  72. package/dist/button/Button.js.map +1 -1
  73. package/dist/button/ButtonUnstyled.d.ts +1 -0
  74. package/dist/button/ButtonUnstyled.js +2 -1
  75. package/dist/button/ButtonUnstyled.js.map +1 -1
  76. package/dist/button/TooltippedButton.d.ts +3 -2
  77. package/dist/button/TooltippedButton.js +2 -1
  78. package/dist/button/TooltippedButton.js.map +1 -1
  79. package/dist/button/_button.scss +128 -98
  80. package/dist/button/{buttonStyles.d.ts → styles.d.ts} +10 -0
  81. package/dist/button/{buttonStyles.js → styles.js} +9 -1
  82. package/dist/button/styles.js.map +1 -0
  83. package/dist/card/Card.d.ts +9 -10
  84. package/dist/card/Card.js +9 -10
  85. package/dist/card/Card.js.map +1 -1
  86. package/dist/card/CardContent.d.ts +1 -0
  87. package/dist/card/CardContent.js +1 -0
  88. package/dist/card/CardContent.js.map +1 -1
  89. package/dist/card/CardFooter.d.ts +1 -0
  90. package/dist/card/CardFooter.js +1 -0
  91. package/dist/card/CardFooter.js.map +1 -1
  92. package/dist/card/CardHeader.d.ts +1 -0
  93. package/dist/card/CardHeader.js +1 -0
  94. package/dist/card/CardHeader.js.map +1 -1
  95. package/dist/card/CardSubtitle.d.ts +1 -0
  96. package/dist/card/CardSubtitle.js +1 -0
  97. package/dist/card/CardSubtitle.js.map +1 -1
  98. package/dist/card/CardTitle.d.ts +2 -1
  99. package/dist/card/CardTitle.js +1 -0
  100. package/dist/card/CardTitle.js.map +1 -1
  101. package/dist/card/ClickableCard.d.ts +3 -1
  102. package/dist/card/ClickableCard.js +3 -1
  103. package/dist/card/ClickableCard.js.map +1 -1
  104. package/dist/card/_card.scss +76 -71
  105. package/dist/chip/Chip.d.ts +5 -3
  106. package/dist/chip/Chip.js +5 -3
  107. package/dist/chip/Chip.js.map +1 -1
  108. package/dist/chip/_chip.scss +247 -33
  109. package/dist/cssUtils.d.ts +1 -1
  110. package/dist/cssUtils.js.map +1 -1
  111. package/dist/dialog/Dialog.d.ts +9 -10
  112. package/dist/dialog/Dialog.js +9 -10
  113. package/dist/dialog/Dialog.js.map +1 -1
  114. package/dist/dialog/DialogContent.d.ts +2 -0
  115. package/dist/dialog/DialogContent.js +5 -2
  116. package/dist/dialog/DialogContent.js.map +1 -1
  117. package/dist/dialog/DialogFooter.d.ts +2 -0
  118. package/dist/dialog/DialogFooter.js +5 -2
  119. package/dist/dialog/DialogFooter.js.map +1 -1
  120. package/dist/dialog/DialogHeader.d.ts +14 -2
  121. package/dist/dialog/DialogHeader.js +8 -2
  122. package/dist/dialog/DialogHeader.js.map +1 -1
  123. package/dist/dialog/DialogTitle.d.ts +2 -0
  124. package/dist/dialog/DialogTitle.js +5 -2
  125. package/dist/dialog/DialogTitle.js.map +1 -1
  126. package/dist/dialog/FixedDialog.d.ts +11 -10
  127. package/dist/dialog/FixedDialog.js +13 -12
  128. package/dist/dialog/FixedDialog.js.map +1 -1
  129. package/dist/dialog/_dialog.scss +167 -22
  130. package/dist/dialog/styles.d.ts +12 -6
  131. package/dist/dialog/styles.js +11 -5
  132. package/dist/dialog/styles.js.map +1 -1
  133. package/dist/divider/Divider.d.ts +3 -1
  134. package/dist/divider/Divider.js +3 -1
  135. package/dist/divider/Divider.js.map +1 -1
  136. package/dist/divider/_divider.scss +68 -0
  137. package/dist/divider/styles.js.map +1 -1
  138. package/dist/draggable/_draggable.scss +16 -0
  139. package/dist/draggable/useDraggable.d.ts +1 -0
  140. package/dist/draggable/useDraggable.js +1 -0
  141. package/dist/draggable/useDraggable.js.map +1 -1
  142. package/dist/error-boundary/ErrorBoundary.d.ts +58 -0
  143. package/dist/error-boundary/ErrorBoundary.js +99 -0
  144. package/dist/error-boundary/ErrorBoundary.js.map +1 -0
  145. package/dist/error-boundary/context.d.ts +11 -0
  146. package/dist/error-boundary/context.js +12 -0
  147. package/dist/error-boundary/context.js.map +1 -0
  148. package/dist/error-boundary/types.d.ts +16 -0
  149. package/dist/error-boundary/types.js +7 -0
  150. package/dist/error-boundary/types.js.map +1 -0
  151. package/dist/error-boundary/useErrorBoundary.d.ts +25 -0
  152. package/dist/error-boundary/useErrorBoundary.js +33 -0
  153. package/dist/error-boundary/useErrorBoundary.js.map +1 -0
  154. package/dist/expansion-panel/ExpansionList.d.ts +1 -0
  155. package/dist/expansion-panel/ExpansionList.js +1 -0
  156. package/dist/expansion-panel/ExpansionList.js.map +1 -1
  157. package/dist/expansion-panel/ExpansionPanel.d.ts +32 -0
  158. package/dist/expansion-panel/ExpansionPanel.js +32 -0
  159. package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
  160. package/dist/expansion-panel/ExpansionPanelHeader.d.ts +4 -7
  161. package/dist/expansion-panel/ExpansionPanelHeader.js +9 -10
  162. package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
  163. package/dist/expansion-panel/_expansion-panel.scss +45 -0
  164. package/dist/expansion-panel/expansionPanelStyles.d.ts +20 -0
  165. package/dist/expansion-panel/expansionPanelStyles.js +12 -0
  166. package/dist/expansion-panel/expansionPanelStyles.js.map +1 -1
  167. package/dist/expansion-panel/useExpansionList.d.ts +7 -8
  168. package/dist/expansion-panel/useExpansionList.js +7 -8
  169. package/dist/expansion-panel/useExpansionList.js.map +1 -1
  170. package/dist/expansion-panel/useExpansionPanels.d.ts +7 -10
  171. package/dist/expansion-panel/useExpansionPanels.js +7 -10
  172. package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
  173. package/dist/files/FileInput.d.ts +4 -2
  174. package/dist/files/FileInput.js +3 -1
  175. package/dist/files/FileInput.js.map +1 -1
  176. package/dist/files/_files.scss +9 -0
  177. package/dist/files/styles.d.ts +1 -1
  178. package/dist/files/styles.js +1 -1
  179. package/dist/files/styles.js.map +1 -1
  180. package/dist/files/useFileUpload.d.ts +2 -0
  181. package/dist/files/useFileUpload.js +2 -0
  182. package/dist/files/useFileUpload.js.map +1 -1
  183. package/dist/focus/useFocusContainer.js +24 -23
  184. package/dist/focus/useFocusContainer.js.map +1 -1
  185. package/dist/form/Checkbox.d.ts +3 -1
  186. package/dist/form/Checkbox.js +3 -1
  187. package/dist/form/Checkbox.js.map +1 -1
  188. package/dist/form/Fieldset.d.ts +6 -20
  189. package/dist/form/Fieldset.js +6 -13
  190. package/dist/form/Fieldset.js.map +1 -1
  191. package/dist/form/Form.d.ts +2 -0
  192. package/dist/form/Form.js +2 -0
  193. package/dist/form/Form.js.map +1 -1
  194. package/dist/form/FormMessage.d.ts +2 -0
  195. package/dist/form/FormMessage.js +2 -0
  196. package/dist/form/FormMessage.js.map +1 -1
  197. package/dist/form/FormMessageContainer.d.ts +1 -0
  198. package/dist/form/FormMessageContainer.js +1 -0
  199. package/dist/form/FormMessageContainer.js.map +1 -1
  200. package/dist/form/FormMessageCounter.d.ts +2 -0
  201. package/dist/form/FormMessageCounter.js +2 -0
  202. package/dist/form/FormMessageCounter.js.map +1 -1
  203. package/dist/form/InputToggle.d.ts +4 -2
  204. package/dist/form/InputToggle.js +2 -0
  205. package/dist/form/InputToggle.js.map +1 -1
  206. package/dist/form/Label.d.ts +4 -5
  207. package/dist/form/Label.js +4 -32
  208. package/dist/form/Label.js.map +1 -1
  209. package/dist/form/Legend.d.ts +1 -0
  210. package/dist/form/Legend.js +1 -0
  211. package/dist/form/Legend.js.map +1 -1
  212. package/dist/form/Listbox.d.ts +1 -1
  213. package/dist/form/Listbox.js.map +1 -1
  214. package/dist/form/MenuItemCheckbox.d.ts +3 -1
  215. package/dist/form/MenuItemCheckbox.js +3 -1
  216. package/dist/form/MenuItemCheckbox.js.map +1 -1
  217. package/dist/form/MenuItemFileInput.d.ts +1 -0
  218. package/dist/form/MenuItemFileInput.js +1 -0
  219. package/dist/form/MenuItemFileInput.js.map +1 -1
  220. package/dist/form/MenuItemInputToggle.d.ts +3 -2
  221. package/dist/form/MenuItemInputToggle.js +1 -0
  222. package/dist/form/MenuItemInputToggle.js.map +1 -1
  223. package/dist/form/MenuItemRadio.d.ts +8 -8
  224. package/dist/form/MenuItemRadio.js +8 -8
  225. package/dist/form/MenuItemRadio.js.map +1 -1
  226. package/dist/form/MenuItemSwitch.d.ts +3 -1
  227. package/dist/form/MenuItemSwitch.js +3 -1
  228. package/dist/form/MenuItemSwitch.js.map +1 -1
  229. package/dist/form/MenuItemTextField.d.ts +1 -0
  230. package/dist/form/MenuItemTextField.js +1 -0
  231. package/dist/form/MenuItemTextField.js.map +1 -1
  232. package/dist/form/NativeSelect.d.ts +2 -0
  233. package/dist/form/NativeSelect.js +2 -0
  234. package/dist/form/NativeSelect.js.map +1 -1
  235. package/dist/form/OptGroup.d.ts +4 -1
  236. package/dist/form/OptGroup.js +4 -1
  237. package/dist/form/OptGroup.js.map +1 -1
  238. package/dist/form/Option.d.ts +2 -1
  239. package/dist/form/Option.js +1 -0
  240. package/dist/form/Option.js.map +1 -1
  241. package/dist/form/Password.d.ts +3 -1
  242. package/dist/form/Password.js +3 -1
  243. package/dist/form/Password.js.map +1 -1
  244. package/dist/form/Radio.d.ts +2 -0
  245. package/dist/form/Radio.js +2 -0
  246. package/dist/form/Radio.js.map +1 -1
  247. package/dist/form/Select.d.ts +5 -28
  248. package/dist/form/Select.js +4 -27
  249. package/dist/form/Select.js.map +1 -1
  250. package/dist/form/Slider.d.ts +9 -2
  251. package/dist/form/Slider.js.map +1 -1
  252. package/dist/form/SliderContainer.js +7 -11
  253. package/dist/form/SliderContainer.js.map +1 -1
  254. package/dist/form/SliderMark.js +5 -8
  255. package/dist/form/SliderMark.js.map +1 -1
  256. package/dist/form/SliderMarkLabel.js +5 -7
  257. package/dist/form/SliderMarkLabel.js.map +1 -1
  258. package/dist/form/SliderThumb.js +2 -27
  259. package/dist/form/SliderThumb.js.map +1 -1
  260. package/dist/form/SliderTrack.js +6 -12
  261. package/dist/form/SliderTrack.js.map +1 -1
  262. package/dist/form/SliderValueTooltip.js +7 -7
  263. package/dist/form/SliderValueTooltip.js.map +1 -1
  264. package/dist/form/Switch.d.ts +9 -1
  265. package/dist/form/Switch.js +3 -1
  266. package/dist/form/Switch.js.map +1 -1
  267. package/dist/form/SwitchTrack.js +8 -8
  268. package/dist/form/SwitchTrack.js.map +1 -1
  269. package/dist/form/TextArea.d.ts +9 -1
  270. package/dist/form/TextArea.js +3 -1
  271. package/dist/form/TextArea.js.map +1 -1
  272. package/dist/form/TextField.d.ts +3 -1
  273. package/dist/form/TextField.js +3 -1
  274. package/dist/form/TextField.js.map +1 -1
  275. package/dist/form/TextFieldAddon.d.ts +1 -34
  276. package/dist/form/TextFieldAddon.js +1 -16
  277. package/dist/form/TextFieldAddon.js.map +1 -1
  278. package/dist/form/TextFieldContainer.d.ts +13 -0
  279. package/dist/form/TextFieldContainer.js.map +1 -1
  280. package/dist/form/_form.scss +737 -10
  281. package/dist/form/fieldsetStyles.d.ts +19 -0
  282. package/dist/form/fieldsetStyles.js +14 -0
  283. package/dist/form/fieldsetStyles.js.map +1 -0
  284. package/dist/form/formConfig.js +22 -3
  285. package/dist/form/formConfig.js.map +1 -1
  286. package/dist/form/labelStyles.d.ts +5 -0
  287. package/dist/form/labelStyles.js +34 -0
  288. package/dist/form/labelStyles.js.map +1 -0
  289. package/dist/form/sliderStyles.d.ts +89 -0
  290. package/dist/form/sliderStyles.js +96 -0
  291. package/dist/form/sliderStyles.js.map +1 -0
  292. package/dist/form/switchStyles.d.ts +24 -6
  293. package/dist/form/switchStyles.js +18 -0
  294. package/dist/form/switchStyles.js.map +1 -1
  295. package/dist/form/textAreaStyles.d.ts +0 -6
  296. package/dist/form/textAreaStyles.js.map +1 -1
  297. package/dist/form/textFieldAddonStyles.d.ts +17 -0
  298. package/dist/form/textFieldAddonStyles.js +18 -0
  299. package/dist/form/textFieldAddonStyles.js.map +1 -0
  300. package/dist/form/textFieldContainerStyles.d.ts +0 -13
  301. package/dist/form/textFieldContainerStyles.js.map +1 -1
  302. package/dist/form/types.d.ts +23 -2
  303. package/dist/form/types.js.map +1 -1
  304. package/dist/form/useCheckboxGroup.d.ts +8 -0
  305. package/dist/form/useCheckboxGroup.js +6 -1
  306. package/dist/form/useCheckboxGroup.js.map +1 -1
  307. package/dist/form/useCombobox.d.ts +0 -1
  308. package/dist/form/useCombobox.js +66 -63
  309. package/dist/form/useCombobox.js.map +1 -1
  310. package/dist/form/useNumberField.d.ts +17 -7
  311. package/dist/form/useNumberField.js +2 -0
  312. package/dist/form/useNumberField.js.map +1 -1
  313. package/dist/form/useRadioGroup.d.ts +6 -0
  314. package/dist/form/useRadioGroup.js +3 -0
  315. package/dist/form/useRadioGroup.js.map +1 -1
  316. package/dist/form/useRangeSlider.d.ts +6 -1
  317. package/dist/form/useRangeSlider.js +6 -1
  318. package/dist/form/useRangeSlider.js.map +1 -1
  319. package/dist/form/useSlider.d.ts +4 -1
  320. package/dist/form/useSlider.js +4 -1
  321. package/dist/form/useSlider.js.map +1 -1
  322. package/dist/form/useTextField.d.ts +7 -1
  323. package/dist/form/useTextField.js +5 -1
  324. package/dist/form/useTextField.js.map +1 -1
  325. package/dist/form/validation.d.ts +1 -0
  326. package/dist/form/validation.js.map +1 -1
  327. package/dist/icon/FontIcon.d.ts +1 -0
  328. package/dist/icon/FontIcon.js +1 -0
  329. package/dist/icon/FontIcon.js.map +1 -1
  330. package/dist/icon/IconRotator.d.ts +2 -0
  331. package/dist/icon/IconRotator.js +2 -0
  332. package/dist/icon/IconRotator.js.map +1 -1
  333. package/dist/icon/MaterialIcon.d.ts +2 -0
  334. package/dist/icon/MaterialIcon.js +2 -0
  335. package/dist/icon/MaterialIcon.js.map +1 -1
  336. package/dist/icon/MaterialSymbol.d.ts +3 -1
  337. package/dist/icon/MaterialSymbol.js +3 -1
  338. package/dist/icon/MaterialSymbol.js.map +1 -1
  339. package/dist/icon/SVGIcon.d.ts +2 -0
  340. package/dist/icon/SVGIcon.js +2 -0
  341. package/dist/icon/SVGIcon.js.map +1 -1
  342. package/dist/icon/TextIconSpacing.d.ts +6 -2
  343. package/dist/icon/TextIconSpacing.js +6 -2
  344. package/dist/icon/TextIconSpacing.js.map +1 -1
  345. package/dist/icon/_icon.scss +137 -129
  346. package/dist/icon/config.d.ts +2 -2
  347. package/dist/icon/config.js +2 -2
  348. package/dist/icon/config.js.map +1 -1
  349. package/dist/icon/material.d.ts +1 -1
  350. package/dist/icon/material.js.map +1 -1
  351. package/dist/icon/styles.d.ts +2 -1
  352. package/dist/icon/styles.js.map +1 -1
  353. package/dist/interaction/Ripple.d.ts +11 -2
  354. package/dist/interaction/Ripple.js.map +1 -1
  355. package/dist/interaction/UserInteractionModeProvider.d.ts +1 -1
  356. package/dist/interaction/UserInteractionModeProvider.js +1 -1
  357. package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
  358. package/dist/interaction/_interaction.scss +279 -13
  359. package/dist/layout/LayoutAppBar.d.ts +1 -0
  360. package/dist/layout/LayoutAppBar.js +1 -0
  361. package/dist/layout/LayoutAppBar.js.map +1 -1
  362. package/dist/layout/LayoutNav.d.ts +9 -12
  363. package/dist/layout/LayoutNav.js +9 -12
  364. package/dist/layout/LayoutNav.js.map +1 -1
  365. package/dist/layout/LayoutWindowSplitter.d.ts +7 -8
  366. package/dist/layout/LayoutWindowSplitter.js +7 -8
  367. package/dist/layout/LayoutWindowSplitter.js.map +1 -1
  368. package/dist/layout/Main.d.ts +2 -1
  369. package/dist/layout/Main.js +2 -1
  370. package/dist/layout/Main.js.map +1 -1
  371. package/dist/layout/_layout.scss +106 -23
  372. package/dist/layout/useExpandableLayout.d.ts +1 -0
  373. package/dist/layout/useExpandableLayout.js +1 -0
  374. package/dist/layout/useExpandableLayout.js.map +1 -1
  375. package/dist/layout/useHorizontalLayoutTransition.d.ts +9 -6
  376. package/dist/layout/useHorizontalLayoutTransition.js +4 -1
  377. package/dist/layout/useHorizontalLayoutTransition.js.map +1 -1
  378. package/dist/layout/useLayoutAppBarHeight.d.ts +7 -10
  379. package/dist/layout/useLayoutAppBarHeight.js +7 -10
  380. package/dist/layout/useLayoutAppBarHeight.js.map +1 -1
  381. package/dist/layout/useLayoutTree.d.ts +3 -0
  382. package/dist/layout/useLayoutTree.js +3 -0
  383. package/dist/layout/useLayoutTree.js.map +1 -1
  384. package/dist/layout/useLayoutWindowSplitter.d.ts +4 -2
  385. package/dist/layout/useLayoutWindowSplitter.js +4 -2
  386. package/dist/layout/useLayoutWindowSplitter.js.map +1 -1
  387. package/dist/layout/useResizableLayout.d.ts +1 -0
  388. package/dist/layout/useResizableLayout.js +3 -1
  389. package/dist/layout/useResizableLayout.js.map +1 -1
  390. package/dist/layout/useTemporaryLayout.d.ts +1 -0
  391. package/dist/layout/useTemporaryLayout.js +1 -0
  392. package/dist/layout/useTemporaryLayout.js.map +1 -1
  393. package/dist/link/Link.d.ts +3 -1
  394. package/dist/link/Link.js +3 -1
  395. package/dist/link/Link.js.map +1 -1
  396. package/dist/link/SkipToMainContent.d.ts +22 -0
  397. package/dist/link/SkipToMainContent.js +22 -0
  398. package/dist/link/SkipToMainContent.js.map +1 -1
  399. package/dist/link/_link.scss +55 -6
  400. package/dist/list/List.d.ts +11 -1
  401. package/dist/list/List.js +5 -1
  402. package/dist/list/List.js.map +1 -1
  403. package/dist/list/ListItem.d.ts +22 -2
  404. package/dist/list/ListItem.js +6 -2
  405. package/dist/list/ListItem.js.map +1 -1
  406. package/dist/list/ListItemChildren.d.ts +3 -1
  407. package/dist/list/ListItemChildren.js +3 -1
  408. package/dist/list/ListItemChildren.js.map +1 -1
  409. package/dist/list/ListItemLink.d.ts +32 -1
  410. package/dist/list/ListItemLink.js +32 -1
  411. package/dist/list/ListItemLink.js.map +1 -1
  412. package/dist/list/ListSubheader.d.ts +2 -0
  413. package/dist/list/ListSubheader.js +2 -0
  414. package/dist/list/ListSubheader.js.map +1 -1
  415. package/dist/list/_list.scss +224 -1
  416. package/dist/list/listItemStyles.d.ts +0 -16
  417. package/dist/list/listItemStyles.js.map +1 -1
  418. package/dist/list/listStyles.d.ts +0 -6
  419. package/dist/list/listStyles.js.map +1 -1
  420. package/dist/media-queries/AppSizeProvider.d.ts +2 -0
  421. package/dist/media-queries/AppSizeProvider.js +2 -0
  422. package/dist/media-queries/AppSizeProvider.js.map +1 -1
  423. package/dist/media-queries/_media-queries.scss +111 -4
  424. package/dist/media-queries/useMediaQuery.d.ts +2 -0
  425. package/dist/media-queries/useMediaQuery.js +2 -0
  426. package/dist/media-queries/useMediaQuery.js.map +1 -1
  427. package/dist/menu/DropdownMenu.d.ts +5 -2
  428. package/dist/menu/DropdownMenu.js +5 -2
  429. package/dist/menu/DropdownMenu.js.map +1 -1
  430. package/dist/menu/Menu.d.ts +1 -0
  431. package/dist/menu/Menu.js +1 -0
  432. package/dist/menu/Menu.js.map +1 -1
  433. package/dist/menu/MenuBar.d.ts +4 -1
  434. package/dist/menu/MenuBar.js +4 -1
  435. package/dist/menu/MenuBar.js.map +1 -1
  436. package/dist/menu/MenuButton.d.ts +1 -0
  437. package/dist/menu/MenuButton.js +1 -0
  438. package/dist/menu/MenuButton.js.map +1 -1
  439. package/dist/menu/MenuItem.d.ts +1 -0
  440. package/dist/menu/MenuItem.js +1 -0
  441. package/dist/menu/MenuItem.js.map +1 -1
  442. package/dist/menu/MenuItemCircularProgress.d.ts +4 -6
  443. package/dist/menu/MenuItemCircularProgress.js +4 -6
  444. package/dist/menu/MenuItemCircularProgress.js.map +1 -1
  445. package/dist/menu/MenuItemGroup.d.ts +6 -7
  446. package/dist/menu/MenuItemGroup.js +6 -7
  447. package/dist/menu/MenuItemGroup.js.map +1 -1
  448. package/dist/menu/MenuItemSeparator.d.ts +1 -0
  449. package/dist/menu/MenuItemSeparator.js +1 -0
  450. package/dist/menu/MenuItemSeparator.js.map +1 -1
  451. package/dist/menu/MenuWidget.d.ts +0 -12
  452. package/dist/menu/MenuWidget.js +1 -12
  453. package/dist/menu/MenuWidget.js.map +1 -1
  454. package/dist/menu/_menu.scss +61 -0
  455. package/dist/menu/styles.d.ts +12 -0
  456. package/dist/menu/styles.js +14 -0
  457. package/dist/menu/styles.js.map +1 -0
  458. package/dist/menu/useContextMenu.d.ts +4 -1
  459. package/dist/menu/useContextMenu.js +4 -1
  460. package/dist/menu/useContextMenu.js.map +1 -1
  461. package/dist/movement/useKeyboardMovementProvider.d.ts +3 -3
  462. package/dist/movement/useKeyboardMovementProvider.js +3 -3
  463. package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
  464. package/dist/navigation/CollapsibleNavGroup.d.ts +1 -0
  465. package/dist/navigation/CollapsibleNavGroup.js +1 -0
  466. package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
  467. package/dist/navigation/DefaultNavigationRenderer.d.ts +1 -0
  468. package/dist/navigation/DefaultNavigationRenderer.js +1 -0
  469. package/dist/navigation/DefaultNavigationRenderer.js.map +1 -1
  470. package/dist/navigation/NavGroup.d.ts +1 -0
  471. package/dist/navigation/NavGroup.js +1 -0
  472. package/dist/navigation/NavGroup.js.map +1 -1
  473. package/dist/navigation/NavItem.d.ts +1 -0
  474. package/dist/navigation/NavItem.js +1 -0
  475. package/dist/navigation/NavItem.js.map +1 -1
  476. package/dist/navigation/NavItemButton.d.ts +1 -0
  477. package/dist/navigation/NavItemButton.js +1 -0
  478. package/dist/navigation/NavItemButton.js.map +1 -1
  479. package/dist/navigation/NavItemLink.d.ts +1 -0
  480. package/dist/navigation/NavItemLink.js +1 -0
  481. package/dist/navigation/NavItemLink.js.map +1 -1
  482. package/dist/navigation/NavSubheader.d.ts +1 -0
  483. package/dist/navigation/NavSubheader.js +1 -0
  484. package/dist/navigation/NavSubheader.js.map +1 -1
  485. package/dist/navigation/Navigation.d.ts +44 -0
  486. package/dist/navigation/Navigation.js +44 -0
  487. package/dist/navigation/Navigation.js.map +1 -1
  488. package/dist/navigation/_navigation.scss +47 -5
  489. package/dist/navigation/getTableOfContentsHeadings.d.ts +20 -0
  490. package/dist/navigation/getTableOfContentsHeadings.js +53 -0
  491. package/dist/navigation/getTableOfContentsHeadings.js.map +1 -0
  492. package/dist/navigation/navItemStyles.js +1 -1
  493. package/dist/navigation/navItemStyles.js.map +1 -1
  494. package/dist/navigation/types.d.ts +47 -0
  495. package/dist/navigation/types.js +1 -3
  496. package/dist/navigation/types.js.map +1 -1
  497. package/dist/navigation/useActiveHeadingId.d.ts +2 -12
  498. package/dist/navigation/useActiveHeadingId.js +1 -0
  499. package/dist/navigation/useActiveHeadingId.js.map +1 -1
  500. package/dist/navigation/useNavigationExpansion.d.ts +2 -0
  501. package/dist/navigation/useNavigationExpansion.js +2 -0
  502. package/dist/navigation/useNavigationExpansion.js.map +1 -1
  503. package/dist/navigation/useTableOfContentsHeadings.d.ts +3 -37
  504. package/dist/navigation/useTableOfContentsHeadings.js +18 -41
  505. package/dist/navigation/useTableOfContentsHeadings.js.map +1 -1
  506. package/dist/overlay/Overlay.d.ts +10 -1
  507. package/dist/overlay/Overlay.js +5 -2
  508. package/dist/overlay/Overlay.js.map +1 -1
  509. package/dist/overlay/_overlay.scss +35 -0
  510. package/dist/overlay/{overlayStyles.d.ts → styles.d.ts} +0 -6
  511. package/dist/overlay/{overlayStyles.js → styles.js} +1 -1
  512. package/dist/overlay/styles.js.map +1 -0
  513. package/dist/portal/Portal.d.ts +1 -0
  514. package/dist/portal/Portal.js +1 -0
  515. package/dist/portal/Portal.js.map +1 -1
  516. package/dist/portal/PortalContainerProvider.d.ts +1 -0
  517. package/dist/portal/PortalContainerProvider.js +1 -0
  518. package/dist/portal/PortalContainerProvider.js.map +1 -1
  519. package/dist/positioning/createHorizontalPosition.d.ts +6 -6
  520. package/dist/positioning/createHorizontalPosition.js +12 -12
  521. package/dist/positioning/createHorizontalPosition.js.map +1 -1
  522. package/dist/positioning/createVerticalPosition.d.ts +6 -6
  523. package/dist/positioning/createVerticalPosition.js +2 -2
  524. package/dist/positioning/createVerticalPosition.js.map +1 -1
  525. package/dist/positioning/useFixedPositioning.d.ts +1 -0
  526. package/dist/positioning/useFixedPositioning.js +1 -0
  527. package/dist/positioning/useFixedPositioning.js.map +1 -1
  528. package/dist/progress/CircularProgress.d.ts +3 -2
  529. package/dist/progress/CircularProgress.js +3 -2
  530. package/dist/progress/CircularProgress.js.map +1 -1
  531. package/dist/progress/LinearProgress.d.ts +3 -2
  532. package/dist/progress/LinearProgress.js +3 -2
  533. package/dist/progress/LinearProgress.js.map +1 -1
  534. package/dist/progress/_progress.scss +164 -38
  535. package/dist/responsive-item/ResponsiveItem.d.ts +4 -3
  536. package/dist/responsive-item/ResponsiveItem.js +4 -3
  537. package/dist/responsive-item/ResponsiveItem.js.map +1 -1
  538. package/dist/responsive-item/ResponsiveItemOverlay.d.ts +6 -4
  539. package/dist/responsive-item/ResponsiveItemOverlay.js +6 -4
  540. package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
  541. package/dist/responsive-item/_responsive-item.scss +89 -0
  542. package/dist/scroll/useScrollLock.d.ts +1 -0
  543. package/dist/scroll/useScrollLock.js +1 -0
  544. package/dist/scroll/useScrollLock.js.map +1 -1
  545. package/dist/searching/fuzzy.d.ts +2 -1
  546. package/dist/searching/fuzzy.js +2 -1
  547. package/dist/searching/fuzzy.js.map +1 -1
  548. package/dist/segmented-button/SegmentedButton.d.ts +3 -4
  549. package/dist/segmented-button/SegmentedButton.js +3 -4
  550. package/dist/segmented-button/SegmentedButton.js.map +1 -1
  551. package/dist/segmented-button/SegmentedButtonContainer.d.ts +5 -6
  552. package/dist/segmented-button/SegmentedButtonContainer.js +7 -8
  553. package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -1
  554. package/dist/segmented-button/_segmented-button.scss +79 -33
  555. package/dist/segmented-button/segmentedButtonContainerStyles.d.ts +1 -1
  556. package/dist/segmented-button/segmentedButtonContainerStyles.js +1 -1
  557. package/dist/segmented-button/segmentedButtonContainerStyles.js.map +1 -1
  558. package/dist/sheet/Sheet.d.ts +14 -0
  559. package/dist/sheet/Sheet.js +2 -0
  560. package/dist/sheet/Sheet.js.map +1 -1
  561. package/dist/sheet/_sheet.scss +84 -0
  562. package/dist/sheet/styles.d.ts +19 -15
  563. package/dist/sheet/styles.js +6 -2
  564. package/dist/sheet/styles.js.map +1 -1
  565. package/dist/snackbar/DefaultToastRenderer.d.ts +1 -0
  566. package/dist/snackbar/DefaultToastRenderer.js +1 -0
  567. package/dist/snackbar/DefaultToastRenderer.js.map +1 -1
  568. package/dist/snackbar/Snackbar.d.ts +10 -9
  569. package/dist/snackbar/Snackbar.js +4 -1
  570. package/dist/snackbar/Snackbar.js.map +1 -1
  571. package/dist/snackbar/Toast.d.ts +8 -0
  572. package/dist/snackbar/Toast.js +1 -0
  573. package/dist/snackbar/Toast.js.map +1 -1
  574. package/dist/snackbar/ToastActionButton.d.ts +2 -1
  575. package/dist/snackbar/ToastActionButton.js +1 -0
  576. package/dist/snackbar/ToastActionButton.js.map +1 -1
  577. package/dist/snackbar/ToastCloseButton.d.ts +2 -1
  578. package/dist/snackbar/ToastCloseButton.js +1 -0
  579. package/dist/snackbar/ToastCloseButton.js.map +1 -1
  580. package/dist/snackbar/ToastContent.d.ts +1 -0
  581. package/dist/snackbar/ToastContent.js +1 -0
  582. package/dist/snackbar/ToastContent.js.map +1 -1
  583. package/dist/snackbar/ToastManager.d.ts +1 -1
  584. package/dist/snackbar/ToastManager.js +1 -1
  585. package/dist/snackbar/ToastManager.js.map +1 -1
  586. package/dist/snackbar/ToastManagerProvider.d.ts +1 -0
  587. package/dist/snackbar/ToastManagerProvider.js +1 -0
  588. package/dist/snackbar/ToastManagerProvider.js.map +1 -1
  589. package/dist/snackbar/_snackbar.scss +131 -3
  590. package/dist/snackbar/toastStyles.d.ts +0 -7
  591. package/dist/snackbar/toastStyles.js.map +1 -1
  592. package/dist/snackbar/useCurrentToastActions.d.ts +1 -0
  593. package/dist/snackbar/useCurrentToastActions.js +1 -0
  594. package/dist/snackbar/useCurrentToastActions.js.map +1 -1
  595. package/dist/storage/useStorage.d.ts +1 -0
  596. package/dist/storage/useStorage.js +1 -0
  597. package/dist/storage/useStorage.js.map +1 -1
  598. package/dist/suspense/CircularProgressSuspense.d.ts +2 -1
  599. package/dist/suspense/CircularProgressSuspense.js +2 -1
  600. package/dist/suspense/CircularProgressSuspense.js.map +1 -1
  601. package/dist/suspense/NullSuspense.d.ts +2 -1
  602. package/dist/suspense/NullSuspense.js +2 -1
  603. package/dist/suspense/NullSuspense.js.map +1 -1
  604. package/dist/table/StickyTableSection.d.ts +2 -0
  605. package/dist/table/StickyTableSection.js +2 -0
  606. package/dist/table/StickyTableSection.js.map +1 -1
  607. package/dist/table/Table.d.ts +8 -8
  608. package/dist/table/Table.js +8 -8
  609. package/dist/table/Table.js.map +1 -1
  610. package/dist/table/TableBody.d.ts +2 -0
  611. package/dist/table/TableBody.js +2 -0
  612. package/dist/table/TableBody.js.map +1 -1
  613. package/dist/table/TableCell.d.ts +6 -2
  614. package/dist/table/TableCell.js +2 -0
  615. package/dist/table/TableCell.js.map +1 -1
  616. package/dist/table/TableCheckbox.d.ts +11 -12
  617. package/dist/table/TableCheckbox.js +10 -11
  618. package/dist/table/TableCheckbox.js.map +1 -1
  619. package/dist/table/TableConfigurationProvider.js +1 -1
  620. package/dist/table/TableConfigurationProvider.js.map +1 -1
  621. package/dist/table/TableContainer.d.ts +2 -0
  622. package/dist/table/TableContainer.js +2 -0
  623. package/dist/table/TableContainer.js.map +1 -1
  624. package/dist/table/TableContainerProvider.js +1 -1
  625. package/dist/table/TableContainerProvider.js.map +1 -1
  626. package/dist/table/TableFooter.d.ts +2 -0
  627. package/dist/table/TableFooter.js +2 -0
  628. package/dist/table/TableFooter.js.map +1 -1
  629. package/dist/table/TableHeader.d.ts +2 -0
  630. package/dist/table/TableHeader.js +2 -0
  631. package/dist/table/TableHeader.js.map +1 -1
  632. package/dist/table/TableRadio.d.ts +13 -13
  633. package/dist/table/TableRadio.js +10 -10
  634. package/dist/table/TableRadio.js.map +1 -1
  635. package/dist/table/TableRow.d.ts +2 -0
  636. package/dist/table/TableRow.js +2 -0
  637. package/dist/table/TableRow.js.map +1 -1
  638. package/dist/table/_table.scss +209 -11
  639. package/dist/table/tableCellStyles.js +3 -2
  640. package/dist/table/tableCellStyles.js.map +1 -1
  641. package/dist/tabs/SimpleTabPanel.d.ts +2 -0
  642. package/dist/tabs/SimpleTabPanel.js +2 -0
  643. package/dist/tabs/SimpleTabPanel.js.map +1 -1
  644. package/dist/tabs/SimpleTabPanels.d.ts +2 -0
  645. package/dist/tabs/SimpleTabPanels.js +2 -0
  646. package/dist/tabs/SimpleTabPanels.js.map +1 -1
  647. package/dist/tabs/Tab.d.ts +19 -1
  648. package/dist/tabs/Tab.js +1 -1
  649. package/dist/tabs/Tab.js.map +1 -1
  650. package/dist/tabs/TabList.d.ts +1 -1
  651. package/dist/tabs/TabList.js +1 -1
  652. package/dist/tabs/TabList.js.map +1 -1
  653. package/dist/tabs/TabListScrollButton.d.ts +1 -1
  654. package/dist/tabs/TabListScrollButton.js.map +1 -1
  655. package/dist/tabs/_tabs.scss +142 -5
  656. package/dist/tabs/tabStyles.d.ts +0 -18
  657. package/dist/tabs/tabStyles.js.map +1 -1
  658. package/dist/tabs/useTabs.d.ts +4 -0
  659. package/dist/tabs/useTabs.js +3 -2
  660. package/dist/tabs/useTabs.js.map +1 -1
  661. package/dist/test-utils/jest-globals/match-media.d.ts +1 -2
  662. package/dist/test-utils/jest-globals/match-media.js +1 -1
  663. package/dist/test-utils/jest-globals/match-media.js.map +1 -1
  664. package/dist/test-utils/jest-globals/resize-observer.js +2 -2
  665. package/dist/test-utils/jest-globals/resize-observer.js.map +1 -1
  666. package/dist/test-utils/mocks/ResizeObserver.d.ts +7 -7
  667. package/dist/test-utils/mocks/ResizeObserver.js +7 -7
  668. package/dist/test-utils/mocks/ResizeObserver.js.map +1 -1
  669. package/dist/test-utils/mocks/match-media.d.ts +31 -0
  670. package/dist/test-utils/mocks/match-media.js.map +1 -1
  671. package/dist/test-utils/utils/createMatchMediaSpy.d.ts +40 -0
  672. package/dist/test-utils/{mocks/match-media-implementation.js → utils/createMatchMediaSpy.js} +33 -4
  673. package/dist/test-utils/utils/createMatchMediaSpy.js.map +1 -0
  674. package/dist/test-utils/vitest/match-media.d.ts +1 -2
  675. package/dist/test-utils/vitest/match-media.js +1 -1
  676. package/dist/test-utils/vitest/match-media.js.map +1 -1
  677. package/dist/test-utils/vitest/resize-observer.js +2 -2
  678. package/dist/test-utils/vitest/resize-observer.js.map +1 -1
  679. package/dist/theme/LocalStorageColorSchemeProvider.d.ts +6 -6
  680. package/dist/theme/LocalStorageColorSchemeProvider.js +6 -6
  681. package/dist/theme/LocalStorageColorSchemeProvider.js.map +1 -1
  682. package/dist/theme/ThemeProvider.d.ts +10 -11
  683. package/dist/theme/ThemeProvider.js +7 -9
  684. package/dist/theme/ThemeProvider.js.map +1 -1
  685. package/dist/theme/_a11y.scss +62 -62
  686. package/dist/theme/_colors.scss +283 -279
  687. package/dist/theme/_theme.scss +298 -249
  688. package/dist/theme/colors.d.ts +2 -2
  689. package/dist/theme/colors.js +2 -2
  690. package/dist/theme/colors.js.map +1 -1
  691. package/dist/theme/useColorScheme.d.ts +1 -1
  692. package/dist/theme/useColorScheme.js +1 -1
  693. package/dist/theme/useColorScheme.js.map +1 -1
  694. package/dist/tooltip/Tooltip.d.ts +12 -1
  695. package/dist/tooltip/Tooltip.js +6 -2
  696. package/dist/tooltip/Tooltip.js.map +1 -1
  697. package/dist/tooltip/TooltipHoverModeProvider.d.ts +1 -0
  698. package/dist/tooltip/TooltipHoverModeProvider.js +1 -0
  699. package/dist/tooltip/TooltipHoverModeProvider.js.map +1 -1
  700. package/dist/tooltip/_tooltip.scss +109 -5
  701. package/dist/tooltip/constants.d.ts +13 -3
  702. package/dist/tooltip/constants.js +4 -4
  703. package/dist/tooltip/constants.js.map +1 -1
  704. package/dist/tooltip/{tooltipStyles.d.ts → styles.d.ts} +1 -1
  705. package/dist/tooltip/{tooltipStyles.js → styles.js} +1 -1
  706. package/dist/tooltip/styles.js.map +1 -0
  707. package/dist/tooltip/useTooltip.d.ts +8 -15
  708. package/dist/tooltip/useTooltip.js +8 -8
  709. package/dist/tooltip/useTooltip.js.map +1 -1
  710. package/dist/transition/CSSTransition.d.ts +3 -1
  711. package/dist/transition/CSSTransition.js +3 -1
  712. package/dist/transition/CSSTransition.js.map +1 -1
  713. package/dist/transition/Collapse.d.ts +1 -0
  714. package/dist/transition/Collapse.js +1 -0
  715. package/dist/transition/Collapse.js.map +1 -1
  716. package/dist/transition/CrossFade.d.ts +1 -0
  717. package/dist/transition/CrossFade.js +1 -0
  718. package/dist/transition/CrossFade.js.map +1 -1
  719. package/dist/transition/ScaleTransition.d.ts +4 -1
  720. package/dist/transition/ScaleTransition.js +4 -1
  721. package/dist/transition/ScaleTransition.js.map +1 -1
  722. package/dist/transition/SkeletonPlaceholder.d.ts +3 -2
  723. package/dist/transition/SkeletonPlaceholder.js +3 -2
  724. package/dist/transition/SkeletonPlaceholder.js.map +1 -1
  725. package/dist/transition/Slide.d.ts +1 -0
  726. package/dist/transition/Slide.js +1 -0
  727. package/dist/transition/Slide.js.map +1 -1
  728. package/dist/transition/SlideContainer.d.ts +10 -7
  729. package/dist/transition/SlideContainer.js +12 -8
  730. package/dist/transition/SlideContainer.js.map +1 -1
  731. package/dist/transition/_transition.scss +178 -6
  732. package/dist/transition/getTransitionCallbacks.d.ts +76 -0
  733. package/dist/transition/getTransitionCallbacks.js +57 -0
  734. package/dist/transition/getTransitionCallbacks.js.map +1 -0
  735. package/dist/transition/skeletonPlaceholderUtils.d.ts +4 -1
  736. package/dist/transition/skeletonPlaceholderUtils.js +4 -1
  737. package/dist/transition/skeletonPlaceholderUtils.js.map +1 -1
  738. package/dist/transition/types.d.ts +26 -1
  739. package/dist/transition/types.js.map +1 -1
  740. package/dist/transition/useCSSTransition.d.ts +2 -0
  741. package/dist/transition/useCSSTransition.js +2 -0
  742. package/dist/transition/useCSSTransition.js.map +1 -1
  743. package/dist/transition/useCarousel.d.ts +6 -2
  744. package/dist/transition/useCarousel.js +11 -7
  745. package/dist/transition/useCarousel.js.map +1 -1
  746. package/dist/transition/useCollapseTransition.d.ts +7 -2
  747. package/dist/transition/useCollapseTransition.js +2 -0
  748. package/dist/transition/useCollapseTransition.js.map +1 -1
  749. package/dist/transition/useCrossFadeTransition.d.ts +22 -45
  750. package/dist/transition/useCrossFadeTransition.js +17 -49
  751. package/dist/transition/useCrossFadeTransition.js.map +1 -1
  752. package/dist/transition/useScaleTransition.d.ts +22 -16
  753. package/dist/transition/useScaleTransition.js +20 -14
  754. package/dist/transition/useScaleTransition.js.map +1 -1
  755. package/dist/transition/useSkeletonPlaceholder.d.ts +6 -3
  756. package/dist/transition/useSkeletonPlaceholder.js +3 -0
  757. package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
  758. package/dist/transition/useSlideTransition.d.ts +9 -3
  759. package/dist/transition/useSlideTransition.js +1 -0
  760. package/dist/transition/useSlideTransition.js.map +1 -1
  761. package/dist/transition/useTransition.d.ts +1 -0
  762. package/dist/transition/useTransition.js +3 -2
  763. package/dist/transition/useTransition.js.map +1 -1
  764. package/dist/tree/DefaultTreeItemRenderer.d.ts +1 -0
  765. package/dist/tree/DefaultTreeItemRenderer.js +1 -0
  766. package/dist/tree/DefaultTreeItemRenderer.js.map +1 -1
  767. package/dist/tree/Tree.d.ts +8 -9
  768. package/dist/tree/Tree.js +4 -3
  769. package/dist/tree/Tree.js.map +1 -1
  770. package/dist/tree/TreeItem.d.ts +1 -0
  771. package/dist/tree/TreeItem.js +1 -0
  772. package/dist/tree/TreeItem.js.map +1 -1
  773. package/dist/tree/_tree.scss +71 -1
  774. package/dist/tree/types.d.ts +1 -1
  775. package/dist/tree/types.js.map +1 -1
  776. package/dist/tree/useTree.d.ts +4 -2
  777. package/dist/tree/useTree.js +4 -2
  778. package/dist/tree/useTree.js.map +1 -1
  779. package/dist/tree/useTreeExpansion.d.ts +1 -0
  780. package/dist/tree/useTreeExpansion.js +1 -0
  781. package/dist/tree/useTreeExpansion.js.map +1 -1
  782. package/dist/tree/useTreeItems.d.ts +1 -0
  783. package/dist/tree/useTreeItems.js +1 -0
  784. package/dist/tree/useTreeItems.js.map +1 -1
  785. package/dist/tree/useTreeSelection.d.ts +1 -0
  786. package/dist/tree/useTreeSelection.js +1 -0
  787. package/dist/tree/useTreeSelection.js.map +1 -1
  788. package/dist/types.d.ts +1 -1
  789. package/dist/types.js.map +1 -1
  790. package/dist/typography/HighlightText.d.ts +76 -0
  791. package/dist/typography/HighlightText.js +60 -0
  792. package/dist/typography/HighlightText.js.map +1 -0
  793. package/dist/typography/HighlightTextMark.d.ts +16 -0
  794. package/dist/typography/HighlightTextMark.js +16 -0
  795. package/dist/typography/HighlightTextMark.js.map +1 -0
  796. package/dist/typography/Mark.d.ts +27 -0
  797. package/dist/typography/Mark.js +34 -0
  798. package/dist/typography/Mark.js.map +1 -0
  799. package/dist/typography/SrOnly.d.ts +3 -1
  800. package/dist/typography/SrOnly.js +3 -1
  801. package/dist/typography/SrOnly.js.map +1 -1
  802. package/dist/typography/TextContainer.d.ts +9 -1
  803. package/dist/typography/TextContainer.js +3 -1
  804. package/dist/typography/TextContainer.js.map +1 -1
  805. package/dist/typography/Typography.d.ts +2 -1
  806. package/dist/typography/Typography.js +2 -1
  807. package/dist/typography/Typography.js.map +1 -1
  808. package/dist/typography/WritingDirectionProvider.d.ts +8 -8
  809. package/dist/typography/WritingDirectionProvider.js +8 -8
  810. package/dist/typography/WritingDirectionProvider.js.map +1 -1
  811. package/dist/typography/_typography.scss +392 -51
  812. package/dist/typography/markStyles.d.ts +10 -0
  813. package/dist/typography/markStyles.js +11 -0
  814. package/dist/typography/markStyles.js.map +1 -0
  815. package/dist/typography/textContainerStyles.d.ts +2 -7
  816. package/dist/typography/textContainerStyles.js +2 -1
  817. package/dist/typography/textContainerStyles.js.map +1 -1
  818. package/dist/typography/typographyStyles.d.ts +2 -2
  819. package/dist/typography/typographyStyles.js +2 -2
  820. package/dist/typography/typographyStyles.js.map +1 -1
  821. package/dist/useAsyncFunction.d.ts +10 -68
  822. package/dist/useAsyncFunction.js +9 -67
  823. package/dist/useAsyncFunction.js.map +1 -1
  824. package/dist/useDebouncedFunction.d.ts +3 -1
  825. package/dist/useDebouncedFunction.js +3 -1
  826. package/dist/useDebouncedFunction.js.map +1 -1
  827. package/dist/useDropzone.d.ts +3 -2
  828. package/dist/useDropzone.js +3 -2
  829. package/dist/useDropzone.js.map +1 -1
  830. package/dist/useThrottledFunction.d.ts +3 -1
  831. package/dist/useThrottledFunction.js +3 -1
  832. package/dist/useThrottledFunction.js.map +1 -1
  833. package/dist/useUnmounted.d.ts +1 -1
  834. package/dist/useUnmounted.js +1 -1
  835. package/dist/useUnmounted.js.map +1 -1
  836. package/dist/utils/RenderRecursively.d.ts +1 -0
  837. package/dist/utils/RenderRecursively.js +1 -0
  838. package/dist/utils/RenderRecursively.js.map +1 -1
  839. package/dist/utils/applyRef.d.ts +1 -1
  840. package/dist/utils/applyRef.js +1 -1
  841. package/dist/utils/applyRef.js.map +1 -1
  842. package/dist/window-splitter/WindowSplitter.d.ts +11 -0
  843. package/dist/window-splitter/WindowSplitter.js +1 -0
  844. package/dist/window-splitter/WindowSplitter.js.map +1 -1
  845. package/dist/window-splitter/_window-splitter.scss +46 -0
  846. package/dist/window-splitter/useWindowSplitter.d.ts +0 -10
  847. package/dist/window-splitter/useWindowSplitter.js.map +1 -1
  848. package/package.json +43 -17
  849. package/src/CoreProviders.tsx +1 -0
  850. package/src/NoSsr.tsx +3 -1
  851. package/src/RootHtml.tsx +1 -1
  852. package/src/SsrProvider.tsx +1 -0
  853. package/src/app-bar/AppBar.tsx +3 -1
  854. package/src/app-bar/AppBarTitle.tsx +2 -1
  855. package/src/autocomplete/Autocomplete.tsx +85 -3
  856. package/src/autocomplete/AutocompleteChip.tsx +1 -0
  857. package/src/autocomplete/AutocompleteCircularProgress.tsx +1 -0
  858. package/src/autocomplete/AutocompleteClearButton.tsx +3 -1
  859. package/src/autocomplete/AutocompleteDropdownButton.tsx +1 -0
  860. package/src/autocomplete/AutocompleteListboxChildren.tsx +2 -3
  861. package/src/autocomplete/autocompleteStyles.ts +11 -2
  862. package/src/autocomplete/types.ts +140 -86
  863. package/src/autocomplete/useAutocomplete.ts +21 -26
  864. package/src/autocomplete/utils.ts +6 -8
  865. package/src/avatar/Avatar.tsx +2 -1
  866. package/src/badge/Badge.tsx +8 -4
  867. package/src/box/Box.tsx +4 -3
  868. package/src/button/AsyncButton.tsx +4 -3
  869. package/src/button/Button.tsx +11 -9
  870. package/src/button/ButtonUnstyled.tsx +2 -1
  871. package/src/button/TooltippedButton.tsx +3 -2
  872. package/src/button/{buttonStyles.ts → styles.ts} +18 -0
  873. package/src/card/Card.tsx +9 -10
  874. package/src/card/CardContent.tsx +1 -0
  875. package/src/card/CardFooter.tsx +1 -0
  876. package/src/card/CardHeader.tsx +1 -0
  877. package/src/card/CardSubtitle.tsx +1 -0
  878. package/src/card/CardTitle.tsx +2 -1
  879. package/src/card/ClickableCard.tsx +3 -1
  880. package/src/chip/Chip.tsx +5 -3
  881. package/src/cssUtils.ts +1 -1
  882. package/src/dialog/Dialog.tsx +9 -10
  883. package/src/dialog/DialogContent.tsx +5 -5
  884. package/src/dialog/DialogFooter.tsx +5 -2
  885. package/src/dialog/DialogHeader.tsx +31 -5
  886. package/src/dialog/DialogTitle.tsx +8 -7
  887. package/src/dialog/FixedDialog.tsx +13 -12
  888. package/src/dialog/styles.ts +16 -10
  889. package/src/divider/Divider.tsx +3 -1
  890. package/src/divider/styles.ts +2 -2
  891. package/src/draggable/useDraggable.ts +1 -0
  892. package/src/error-boundary/ErrorBoundary.tsx +103 -0
  893. package/src/error-boundary/context.ts +16 -0
  894. package/src/error-boundary/types.ts +19 -0
  895. package/src/error-boundary/useErrorBoundary.ts +36 -0
  896. package/src/expansion-panel/ExpansionList.tsx +1 -0
  897. package/src/expansion-panel/ExpansionPanel.tsx +32 -0
  898. package/src/expansion-panel/ExpansionPanelHeader.tsx +10 -10
  899. package/src/expansion-panel/expansionPanelStyles.ts +33 -0
  900. package/src/expansion-panel/useExpansionList.ts +7 -8
  901. package/src/expansion-panel/useExpansionPanels.ts +7 -10
  902. package/src/files/FileInput.tsx +4 -2
  903. package/src/files/styles.ts +1 -1
  904. package/src/files/useFileUpload.ts +2 -0
  905. package/src/focus/useFocusContainer.ts +29 -43
  906. package/src/form/Checkbox.tsx +3 -1
  907. package/src/form/Fieldset.tsx +6 -35
  908. package/src/form/Form.tsx +2 -0
  909. package/src/form/FormMessage.tsx +2 -0
  910. package/src/form/FormMessageContainer.tsx +1 -0
  911. package/src/form/FormMessageCounter.tsx +2 -0
  912. package/src/form/InputToggle.tsx +4 -2
  913. package/src/form/Label.tsx +5 -54
  914. package/src/form/Legend.tsx +1 -0
  915. package/src/form/Listbox.tsx +1 -1
  916. package/src/form/MenuItemCheckbox.tsx +3 -1
  917. package/src/form/MenuItemFileInput.tsx +1 -0
  918. package/src/form/MenuItemInputToggle.tsx +3 -2
  919. package/src/form/MenuItemRadio.tsx +8 -8
  920. package/src/form/MenuItemSwitch.tsx +3 -1
  921. package/src/form/MenuItemTextField.tsx +1 -0
  922. package/src/form/NativeSelect.tsx +2 -0
  923. package/src/form/OptGroup.tsx +4 -1
  924. package/src/form/Option.tsx +2 -1
  925. package/src/form/Password.tsx +3 -1
  926. package/src/form/Radio.tsx +2 -0
  927. package/src/form/Select.tsx +6 -29
  928. package/src/form/Slider.tsx +9 -2
  929. package/src/form/SliderContainer.tsx +7 -15
  930. package/src/form/SliderMark.tsx +2 -13
  931. package/src/form/SliderMarkLabel.tsx +2 -5
  932. package/src/form/SliderThumb.tsx +2 -50
  933. package/src/form/SliderTrack.tsx +8 -18
  934. package/src/form/SliderValueTooltip.tsx +2 -10
  935. package/src/form/Switch.tsx +10 -1
  936. package/src/form/SwitchTrack.tsx +3 -6
  937. package/src/form/TextArea.tsx +10 -1
  938. package/src/form/TextField.tsx +3 -1
  939. package/src/form/TextFieldAddon.tsx +2 -59
  940. package/src/form/TextFieldContainer.tsx +14 -0
  941. package/src/form/fieldsetStyles.ts +35 -0
  942. package/src/form/formConfig.ts +29 -4
  943. package/src/form/labelStyles.ts +55 -0
  944. package/src/form/sliderStyles.ts +204 -0
  945. package/src/form/switchStyles.ts +36 -7
  946. package/src/form/textAreaStyles.ts +0 -7
  947. package/src/form/textFieldAddonStyles.ts +41 -0
  948. package/src/form/textFieldContainerStyles.ts +0 -14
  949. package/src/form/types.ts +25 -2
  950. package/src/form/useCheckboxGroup.ts +14 -0
  951. package/src/form/useCombobox.ts +78 -84
  952. package/src/form/useNumberField.ts +19 -7
  953. package/src/form/useRadioGroup.ts +9 -0
  954. package/src/form/useRangeSlider.ts +6 -1
  955. package/src/form/useSlider.ts +4 -1
  956. package/src/form/useTextField.ts +12 -1
  957. package/src/form/validation.ts +1 -0
  958. package/src/icon/FontIcon.tsx +1 -0
  959. package/src/icon/IconRotator.tsx +2 -0
  960. package/src/icon/MaterialIcon.tsx +2 -0
  961. package/src/icon/MaterialSymbol.tsx +3 -1
  962. package/src/icon/SVGIcon.tsx +2 -0
  963. package/src/icon/TextIconSpacing.tsx +6 -2
  964. package/src/icon/config.tsx +2 -2
  965. package/src/icon/material.ts +260 -17
  966. package/src/icon/styles.ts +5 -1
  967. package/src/interaction/Ripple.tsx +4 -4
  968. package/src/interaction/UserInteractionModeProvider.tsx +1 -1
  969. package/src/layout/LayoutAppBar.tsx +1 -0
  970. package/src/layout/LayoutNav.tsx +9 -12
  971. package/src/layout/LayoutWindowSplitter.tsx +7 -8
  972. package/src/layout/Main.tsx +2 -1
  973. package/src/layout/useExpandableLayout.ts +1 -0
  974. package/src/layout/useHorizontalLayoutTransition.ts +5 -2
  975. package/src/layout/useLayoutAppBarHeight.ts +7 -10
  976. package/src/layout/useLayoutTree.ts +3 -0
  977. package/src/layout/useLayoutWindowSplitter.ts +4 -2
  978. package/src/layout/useResizableLayout.ts +3 -0
  979. package/src/layout/useTemporaryLayout.ts +1 -0
  980. package/src/link/Link.tsx +3 -1
  981. package/src/link/SkipToMainContent.tsx +22 -0
  982. package/src/list/List.tsx +12 -1
  983. package/src/list/ListItem.tsx +23 -2
  984. package/src/list/ListItemChildren.tsx +3 -1
  985. package/src/list/ListItemLink.tsx +32 -1
  986. package/src/list/ListSubheader.tsx +2 -0
  987. package/src/list/listItemStyles.ts +0 -17
  988. package/src/list/listStyles.ts +0 -7
  989. package/src/media-queries/AppSizeProvider.tsx +2 -0
  990. package/src/media-queries/useMediaQuery.ts +2 -0
  991. package/src/menu/DropdownMenu.tsx +5 -2
  992. package/src/menu/Menu.tsx +1 -0
  993. package/src/menu/MenuBar.tsx +4 -1
  994. package/src/menu/MenuButton.tsx +1 -0
  995. package/src/menu/MenuItem.tsx +1 -0
  996. package/src/menu/MenuItemCircularProgress.tsx +4 -6
  997. package/src/menu/MenuItemGroup.tsx +6 -7
  998. package/src/menu/MenuItemSeparator.tsx +1 -0
  999. package/src/menu/MenuWidget.tsx +1 -21
  1000. package/src/menu/styles.ts +23 -0
  1001. package/src/menu/useContextMenu.ts +4 -1
  1002. package/src/movement/useKeyboardMovementProvider.ts +3 -3
  1003. package/src/navigation/CollapsibleNavGroup.tsx +1 -0
  1004. package/src/navigation/DefaultNavigationRenderer.tsx +1 -0
  1005. package/src/navigation/NavGroup.tsx +1 -0
  1006. package/src/navigation/NavItem.tsx +1 -0
  1007. package/src/navigation/NavItemButton.tsx +1 -0
  1008. package/src/navigation/NavItemLink.tsx +1 -0
  1009. package/src/navigation/NavSubheader.tsx +1 -0
  1010. package/src/navigation/Navigation.tsx +44 -0
  1011. package/src/navigation/getTableOfContentsHeadings.ts +70 -0
  1012. package/src/navigation/navItemStyles.ts +1 -1
  1013. package/src/navigation/types.ts +57 -0
  1014. package/src/navigation/useActiveHeadingId.ts +3 -15
  1015. package/src/navigation/useNavigationExpansion.ts +2 -0
  1016. package/src/navigation/useTableOfContentsHeadings.ts +22 -89
  1017. package/src/overlay/Overlay.tsx +12 -2
  1018. package/src/overlay/{overlayStyles.ts → styles.ts} +1 -7
  1019. package/src/portal/Portal.tsx +1 -0
  1020. package/src/portal/PortalContainerProvider.tsx +1 -0
  1021. package/src/positioning/createHorizontalPosition.ts +25 -19
  1022. package/src/positioning/createVerticalPosition.ts +10 -8
  1023. package/src/positioning/useFixedPositioning.ts +1 -0
  1024. package/src/progress/CircularProgress.tsx +3 -2
  1025. package/src/progress/LinearProgress.tsx +3 -2
  1026. package/src/responsive-item/ResponsiveItem.tsx +4 -3
  1027. package/src/responsive-item/ResponsiveItemOverlay.tsx +6 -4
  1028. package/src/scroll/useScrollLock.ts +1 -0
  1029. package/src/searching/fuzzy.ts +2 -1
  1030. package/src/segmented-button/SegmentedButton.tsx +3 -4
  1031. package/src/segmented-button/SegmentedButtonContainer.tsx +7 -8
  1032. package/src/segmented-button/segmentedButtonContainerStyles.ts +1 -1
  1033. package/src/sheet/Sheet.tsx +15 -0
  1034. package/src/sheet/styles.ts +10 -17
  1035. package/src/snackbar/DefaultToastRenderer.tsx +1 -0
  1036. package/src/snackbar/Snackbar.tsx +10 -9
  1037. package/src/snackbar/Toast.tsx +9 -0
  1038. package/src/snackbar/ToastActionButton.tsx +2 -1
  1039. package/src/snackbar/ToastCloseButton.tsx +2 -1
  1040. package/src/snackbar/ToastContent.tsx +1 -0
  1041. package/src/snackbar/{ToastManager.tsx → ToastManager.ts} +1 -1
  1042. package/src/snackbar/ToastManagerProvider.tsx +1 -0
  1043. package/src/snackbar/toastStyles.ts +0 -8
  1044. package/src/snackbar/useCurrentToastActions.ts +1 -0
  1045. package/src/storage/useStorage.ts +1 -0
  1046. package/src/suspense/CircularProgressSuspense.tsx +2 -1
  1047. package/src/suspense/NullSuspense.tsx +2 -1
  1048. package/src/table/StickyTableSection.tsx +2 -0
  1049. package/src/table/Table.tsx +8 -8
  1050. package/src/table/TableBody.tsx +2 -0
  1051. package/src/table/TableCell.tsx +6 -2
  1052. package/src/table/TableCheckbox.tsx +11 -12
  1053. package/src/table/TableContainer.tsx +2 -0
  1054. package/src/table/TableFooter.tsx +2 -0
  1055. package/src/table/TableHeader.tsx +2 -0
  1056. package/src/table/TableRadio.tsx +13 -13
  1057. package/src/table/TableRow.tsx +2 -0
  1058. package/src/table/tableCellStyles.ts +1 -1
  1059. package/src/tabs/SimpleTabPanel.tsx +2 -0
  1060. package/src/tabs/SimpleTabPanels.tsx +2 -0
  1061. package/src/tabs/Tab.tsx +21 -1
  1062. package/src/tabs/TabList.tsx +1 -1
  1063. package/src/tabs/TabListScrollButton.tsx +1 -1
  1064. package/src/tabs/tabStyles.ts +0 -20
  1065. package/src/tabs/useTabs.ts +7 -2
  1066. package/src/test-utils/jest-globals/match-media.ts +4 -3
  1067. package/src/test-utils/jest-globals/resize-observer.ts +2 -2
  1068. package/src/test-utils/mocks/ResizeObserver.ts +7 -7
  1069. package/src/test-utils/mocks/match-media.ts +32 -0
  1070. package/src/test-utils/{mocks/match-media-implementation.ts → utils/createMatchMediaSpy.ts} +34 -36
  1071. package/src/test-utils/vitest/match-media.ts +4 -3
  1072. package/src/test-utils/vitest/resize-observer.ts +2 -2
  1073. package/src/theme/LocalStorageColorSchemeProvider.tsx +6 -6
  1074. package/src/theme/ThemeProvider.tsx +10 -11
  1075. package/src/theme/colors.ts +2 -2
  1076. package/src/theme/useColorScheme.ts +1 -1
  1077. package/src/tooltip/Tooltip.tsx +14 -2
  1078. package/src/tooltip/TooltipHoverModeProvider.tsx +1 -0
  1079. package/src/tooltip/constants.ts +11 -11
  1080. package/src/tooltip/{tooltipStyles.ts → styles.ts} +1 -1
  1081. package/src/tooltip/useTooltip.ts +8 -16
  1082. package/src/transition/CSSTransition.tsx +3 -1
  1083. package/src/transition/Collapse.tsx +1 -0
  1084. package/src/transition/CrossFade.tsx +1 -0
  1085. package/src/transition/ScaleTransition.tsx +4 -1
  1086. package/src/transition/SkeletonPlaceholder.tsx +3 -2
  1087. package/src/transition/Slide.tsx +1 -0
  1088. package/src/transition/SlideContainer.tsx +15 -11
  1089. package/src/transition/getTransitionCallbacks.ts +140 -0
  1090. package/src/transition/skeletonPlaceholderUtils.ts +4 -1
  1091. package/src/transition/types.ts +28 -7
  1092. package/src/transition/useCSSTransition.ts +2 -0
  1093. package/src/transition/useCarousel.ts +11 -7
  1094. package/src/transition/useCollapseTransition.ts +4 -3
  1095. package/src/transition/useCrossFadeTransition.ts +23 -57
  1096. package/src/transition/useScaleTransition.ts +27 -19
  1097. package/src/transition/useSkeletonPlaceholder.ts +6 -3
  1098. package/src/transition/useSlideTransition.ts +14 -13
  1099. package/src/transition/useTransition.ts +3 -2
  1100. package/src/tree/DefaultTreeItemRenderer.tsx +1 -0
  1101. package/src/tree/Tree.tsx +8 -9
  1102. package/src/tree/TreeItem.tsx +1 -0
  1103. package/src/tree/types.ts +1 -1
  1104. package/src/tree/useTree.ts +4 -2
  1105. package/src/tree/useTreeExpansion.ts +1 -0
  1106. package/src/tree/useTreeItems.ts +1 -0
  1107. package/src/tree/useTreeSelection.ts +1 -0
  1108. package/src/types.ts +1 -1
  1109. package/src/typography/HighlightText.tsx +201 -0
  1110. package/src/typography/HighlightTextMark.tsx +25 -0
  1111. package/src/typography/Mark.tsx +41 -0
  1112. package/src/typography/SrOnly.tsx +3 -1
  1113. package/src/typography/TextContainer.tsx +10 -1
  1114. package/src/typography/Typography.tsx +2 -1
  1115. package/src/typography/WritingDirectionProvider.tsx +8 -8
  1116. package/src/typography/markStyles.ts +20 -0
  1117. package/src/typography/textContainerStyles.ts +2 -8
  1118. package/src/typography/typographyStyles.ts +2 -2
  1119. package/src/useAsyncFunction.ts +12 -68
  1120. package/src/useDebouncedFunction.ts +3 -1
  1121. package/src/useDropzone.ts +3 -2
  1122. package/src/useThrottledFunction.ts +3 -1
  1123. package/src/useUnmounted.ts +1 -1
  1124. package/src/utils/RenderRecursively.tsx +1 -0
  1125. package/src/utils/applyRef.ts +1 -1
  1126. package/src/window-splitter/WindowSplitter.tsx +12 -0
  1127. package/src/window-splitter/useWindowSplitter.ts +0 -11
  1128. package/dist/button/buttonStyles.js.map +0 -1
  1129. package/dist/button/buttonUnstyledStyles.d.ts +0 -10
  1130. package/dist/button/buttonUnstyledStyles.js +0 -11
  1131. package/dist/button/buttonUnstyledStyles.js.map +0 -1
  1132. package/dist/overlay/overlayStyles.js.map +0 -1
  1133. package/dist/test-utils/mocks/match-media-implementation.d.ts +0 -42
  1134. package/dist/test-utils/mocks/match-media-implementation.js.map +0 -1
  1135. package/dist/tooltip/tooltipStyles.js.map +0 -1
  1136. package/src/button/buttonUnstyledStyles.ts +0 -19
  1137. /package/src/table/{TableConfigurationProvider.tsx → TableConfigurationProvider.ts} +0 -0
  1138. /package/src/table/{TableContainerProvider.tsx → TableContainerProvider.ts} +0 -0
@@ -16,6 +16,7 @@ const noop = ()=>{
16
16
  * This button will automatically close the toast when clicked unless
17
17
  * `event.stopPropagation()` is called from the `onClick` prop.
18
18
  *
19
+ * @see {@link https://next.react-md.dev/components/snackbar | Snackbar Demos}
19
20
  * @since 6.0.0
20
21
  */ export const ToastCloseButton = /*#__PURE__*/ forwardRef(function ToastCloseButton(props, ref) {
21
22
  const { buttonType = "icon-square", "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel = buttonType !== "text" && !ariaLabelledBy ? "Close" : undefined, children: propChildren, className, onClick = noop, reordered, ...remaining } = props;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/snackbar/ToastCloseButton.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport { forwardRef } from \"react\";\n\nimport { Button, type ButtonProps } from \"../button/Button.js\";\nimport { type ButtonType } from \"../button/buttonStyles.js\";\nimport { getIcon } from \"../icon/config.js\";\nimport { bem } from \"../utils/bem.js\";\nimport { useCurrentToastActions } from \"./useCurrentToastActions.js\";\n\nconst styles = bem(\"rmd-toast-x\");\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @since 6.0.0\n */\nexport interface ToastCloseButtonProps extends ButtonProps {\n /**\n * Note: This default value will only be used if the {@link buttonType} is not\n * `\"text\"` and an `aria-labelledby` is not provided.\n *\n * @defaultValue `\"Close\"`\n */\n \"aria-label\"?: string;\n\n /** @defaultValue `\"icon-square\"` */\n buttonType?: ButtonType;\n\n /**\n * Set this to `true` when there is a close button visible and the content is\n * stacked. This will update the styles so the button renders next to the\n * content and above the action button.\n *\n * @defaultValue `false`\n */\n reordered?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * This button will automatically close the toast when clicked unless\n * `event.stopPropagation()` is called from the `onClick` prop.\n *\n * @since 6.0.0\n */\nexport const ToastCloseButton = forwardRef<\n HTMLButtonElement,\n ToastCloseButtonProps\n>(function ToastCloseButton(props, ref) {\n const {\n buttonType = \"icon-square\",\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-label\": ariaLabel = buttonType !== \"text\" && !ariaLabelledBy\n ? \"Close\"\n : undefined,\n children: propChildren,\n className,\n onClick = noop,\n reordered,\n ...remaining\n } = props;\n\n const children = getIcon(\"close\", propChildren);\n const { removeToast } = useCurrentToastActions();\n\n return (\n <Button\n {...remaining}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n ref={ref}\n onClick={(event) => {\n onClick(event);\n if (event.isPropagationStopped()) {\n return;\n }\n\n removeToast(true);\n }}\n className={cnb(styles({ reordered }), className)}\n buttonType={buttonType}\n >\n {children}\n </Button>\n );\n});\n"],"names":["cnb","forwardRef","Button","getIcon","bem","useCurrentToastActions","styles","noop","ToastCloseButton","props","ref","buttonType","ariaLabelledBy","ariaLabel","undefined","children","propChildren","className","onClick","reordered","remaining","removeToast","aria-label","aria-labelledby","event","isPropagationStopped"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAAQ,QAAQ;AAEnC,SAASC,MAAM,QAA0B,sBAAsB;AAE/D,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,GAAG,QAAQ,kBAAkB;AACtC,SAASC,sBAAsB,QAAQ,8BAA8B;AAErE,MAAMC,SAASF,IAAI;AACnB,MAAMG,OAAO;AACX,aAAa;AACf;AA2BA;;;;;;;CAOC,GACD,OAAO,MAAMC,iCAAmBP,WAG9B,SAASO,iBAAiBC,KAAK,EAAEC,GAAG;IACpC,MAAM,EACJC,aAAa,aAAa,EAC1B,mBAAmBC,cAAc,EACjC,cAAcC,YAAYF,eAAe,UAAU,CAACC,iBAChD,UACAE,SAAS,EACbC,UAAUC,YAAY,EACtBC,SAAS,EACTC,UAAUX,IAAI,EACdY,SAAS,EACT,GAAGC,WACJ,GAAGX;IAEJ,MAAMM,WAAWZ,QAAQ,SAASa;IAClC,MAAM,EAAEK,WAAW,EAAE,GAAGhB;IAExB,qBACE,KAACH;QACE,GAAGkB,SAAS;QACbE,cAAYT;QACZU,mBAAiBX;QACjBF,KAAKA;QACLQ,SAAS,CAACM;YACRN,QAAQM;YACR,IAAIA,MAAMC,oBAAoB,IAAI;gBAChC;YACF;YAEAJ,YAAY;QACd;QACAJ,WAAWjB,IAAIM,OAAO;YAAEa;QAAU,IAAIF;QACtCN,YAAYA;kBAEXI;;AAGP,GAAG"}
1
+ {"version":3,"sources":["../../src/snackbar/ToastCloseButton.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport { forwardRef } from \"react\";\n\nimport { Button, type ButtonProps } from \"../button/Button.js\";\nimport { type ButtonType } from \"../button/styles.js\";\nimport { getIcon } from \"../icon/config.js\";\nimport { bem } from \"../utils/bem.js\";\nimport { useCurrentToastActions } from \"./useCurrentToastActions.js\";\n\nconst styles = bem(\"rmd-toast-x\");\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @since 6.0.0\n */\nexport interface ToastCloseButtonProps extends ButtonProps {\n /**\n * Note: This default value will only be used if the {@link buttonType} is not\n * `\"text\"` and an `aria-labelledby` is not provided.\n *\n * @defaultValue `\"Close\"`\n */\n \"aria-label\"?: string;\n\n /** @defaultValue `\"icon-square\"` */\n buttonType?: ButtonType;\n\n /**\n * Set this to `true` when there is a close button visible and the content is\n * stacked. This will update the styles so the button renders next to the\n * content and above the action button.\n *\n * @defaultValue `false`\n */\n reordered?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * This button will automatically close the toast when clicked unless\n * `event.stopPropagation()` is called from the `onClick` prop.\n *\n * @see {@link https://next.react-md.dev/components/snackbar | Snackbar Demos}\n * @since 6.0.0\n */\nexport const ToastCloseButton = forwardRef<\n HTMLButtonElement,\n ToastCloseButtonProps\n>(function ToastCloseButton(props, ref) {\n const {\n buttonType = \"icon-square\",\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-label\": ariaLabel = buttonType !== \"text\" && !ariaLabelledBy\n ? \"Close\"\n : undefined,\n children: propChildren,\n className,\n onClick = noop,\n reordered,\n ...remaining\n } = props;\n\n const children = getIcon(\"close\", propChildren);\n const { removeToast } = useCurrentToastActions();\n\n return (\n <Button\n {...remaining}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n ref={ref}\n onClick={(event) => {\n onClick(event);\n if (event.isPropagationStopped()) {\n return;\n }\n\n removeToast(true);\n }}\n className={cnb(styles({ reordered }), className)}\n buttonType={buttonType}\n >\n {children}\n </Button>\n );\n});\n"],"names":["cnb","forwardRef","Button","getIcon","bem","useCurrentToastActions","styles","noop","ToastCloseButton","props","ref","buttonType","ariaLabelledBy","ariaLabel","undefined","children","propChildren","className","onClick","reordered","remaining","removeToast","aria-label","aria-labelledby","event","isPropagationStopped"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAAQ,QAAQ;AAEnC,SAASC,MAAM,QAA0B,sBAAsB;AAE/D,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,GAAG,QAAQ,kBAAkB;AACtC,SAASC,sBAAsB,QAAQ,8BAA8B;AAErE,MAAMC,SAASF,IAAI;AACnB,MAAMG,OAAO;AACX,aAAa;AACf;AA2BA;;;;;;;;CAQC,GACD,OAAO,MAAMC,iCAAmBP,WAG9B,SAASO,iBAAiBC,KAAK,EAAEC,GAAG;IACpC,MAAM,EACJC,aAAa,aAAa,EAC1B,mBAAmBC,cAAc,EACjC,cAAcC,YAAYF,eAAe,UAAU,CAACC,iBAChD,UACAE,SAAS,EACbC,UAAUC,YAAY,EACtBC,SAAS,EACTC,UAAUX,IAAI,EACdY,SAAS,EACT,GAAGC,WACJ,GAAGX;IAEJ,MAAMM,WAAWZ,QAAQ,SAASa;IAClC,MAAM,EAAEK,WAAW,EAAE,GAAGhB;IAExB,qBACE,KAACH;QACE,GAAGkB,SAAS;QACbE,cAAYT;QACZU,mBAAiBX;QACjBF,KAAKA;QACLQ,SAAS,CAACM;YACRN,QAAQM;YACR,IAAIA,MAAMC,oBAAoB,IAAI;gBAChC;YACF;YAEAJ,YAAY;QACd;QACAJ,WAAWjB,IAAIM,OAAO;YAAEa;QAAU,IAAIF;QACtCN,YAAYA;kBAEXI;;AAGP,GAAG"}
@@ -28,6 +28,7 @@ export interface ToastContentProps extends HTMLAttributes<HTMLDivElement> {
28
28
  /**
29
29
  * **Client Component**
30
30
  *
31
+ * @see {@link https://next.react-md.dev/components/snackbar | Snackbar Demos}
31
32
  * @since 6.0.0
32
33
  */
33
34
  export declare const ToastContent: import("react").ForwardRefExoticComponent<ToastContentProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -6,6 +6,7 @@ import { toastContent } from "./toastContentStyles.js";
6
6
  /**
7
7
  * **Client Component**
8
8
  *
9
+ * @see {@link https://next.react-md.dev/components/snackbar | Snackbar Demos}
9
10
  * @since 6.0.0
10
11
  */ export const ToastContent = /*#__PURE__*/ forwardRef(function ToastContent(props, ref) {
11
12
  const { className, children, action, stacked, multiline: propMultiline, closeButton, disableWrapper, ...remaining } = props;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/snackbar/ToastContent.tsx"],"sourcesContent":["\"use client\";\n\nimport { type HTMLAttributes, forwardRef, useCallback, useState } from \"react\";\n\nimport { useResizeObserver } from \"../useResizeObserver.js\";\nimport { toastContent } from \"./toastContentStyles.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface ToastContentProps extends HTMLAttributes<HTMLDivElement> {\n /** @defaultValue `false` */\n action?: boolean;\n\n /** @defaultValue `false` */\n stacked?: boolean;\n\n /**\n * Set this to `true` if you know that the {@link children} span multiple\n * lines. When this is omitted, a `ResizeObserver` will be used to\n * automatically detect multiline content.\n */\n multiline?: boolean;\n\n /** @defaultValue `false` */\n closeButton?: boolean;\n\n /**\n * Set this to `true` if you do not want to wrap the `children` in a `<div>`\n * that applies some toast layout styles. This should really only be used for\n * custom `Toast` implementations.\n *\n * @internal\n * @defaultValue `false`\n */\n disableWrapper?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * @since 6.0.0\n */\nexport const ToastContent = forwardRef<HTMLDivElement, ToastContentProps>(\n function ToastContent(props, ref) {\n const {\n className,\n children,\n action,\n stacked,\n multiline: propMultiline,\n closeButton,\n disableWrapper,\n ...remaining\n } = props;\n\n const [isMultiline, setMultiline] = useState(false);\n const nodeRef = useResizeObserver({\n ref,\n disabled: disableWrapper || typeof propMultiline === \"boolean\",\n disableWidth: true,\n onUpdate: useCallback((entry) => {\n const element = entry.target;\n const style = window.getComputedStyle(element);\n const lineHeight = parseFloat(style.lineHeight);\n if (Number.isNaN(lineHeight)) {\n return;\n }\n\n setMultiline(element.scrollHeight > lineHeight);\n }, []),\n });\n const multiline = propMultiline ?? isMultiline;\n\n if (disableWrapper) {\n return <>{children}</>;\n }\n\n return (\n <div\n {...remaining}\n ref={nodeRef}\n className={toastContent({\n action,\n stacked,\n multiline,\n closeButton,\n className,\n })}\n >\n {children}\n </div>\n );\n }\n);\n"],"names":["forwardRef","useCallback","useState","useResizeObserver","toastContent","ToastContent","props","ref","className","children","action","stacked","multiline","propMultiline","closeButton","disableWrapper","remaining","isMultiline","setMultiline","nodeRef","disabled","disableWidth","onUpdate","entry","element","target","style","window","getComputedStyle","lineHeight","parseFloat","Number","isNaN","scrollHeight","div"],"mappings":"AAAA;;AAEA,SAA8BA,UAAU,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AAE/E,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,YAAY,QAAQ,0BAA0B;AAiCvD;;;;CAIC,GACD,OAAO,MAAMC,6BAAeL,WAC1B,SAASK,aAAaC,KAAK,EAAEC,GAAG;IAC9B,MAAM,EACJC,SAAS,EACTC,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,WAAWC,aAAa,EACxBC,WAAW,EACXC,cAAc,EACd,GAAGC,WACJ,GAAGV;IAEJ,MAAM,CAACW,aAAaC,aAAa,GAAGhB,SAAS;IAC7C,MAAMiB,UAAUhB,kBAAkB;QAChCI;QACAa,UAAUL,kBAAkB,OAAOF,kBAAkB;QACrDQ,cAAc;QACdC,UAAUrB,YAAY,CAACsB;YACrB,MAAMC,UAAUD,MAAME,MAAM;YAC5B,MAAMC,QAAQC,OAAOC,gBAAgB,CAACJ;YACtC,MAAMK,aAAaC,WAAWJ,MAAMG,UAAU;YAC9C,IAAIE,OAAOC,KAAK,CAACH,aAAa;gBAC5B;YACF;YAEAX,aAAaM,QAAQS,YAAY,GAAGJ;QACtC,GAAG,EAAE;IACP;IACA,MAAMjB,YAAYC,iBAAiBI;IAEnC,IAAIF,gBAAgB;QAClB,qBAAO;sBAAGN;;IACZ;IAEA,qBACE,KAACyB;QACE,GAAGlB,SAAS;QACbT,KAAKY;QACLX,WAAWJ,aAAa;YACtBM;YACAC;YACAC;YACAE;YACAN;QACF;kBAECC;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/snackbar/ToastContent.tsx"],"sourcesContent":["\"use client\";\n\nimport { type HTMLAttributes, forwardRef, useCallback, useState } from \"react\";\n\nimport { useResizeObserver } from \"../useResizeObserver.js\";\nimport { toastContent } from \"./toastContentStyles.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface ToastContentProps extends HTMLAttributes<HTMLDivElement> {\n /** @defaultValue `false` */\n action?: boolean;\n\n /** @defaultValue `false` */\n stacked?: boolean;\n\n /**\n * Set this to `true` if you know that the {@link children} span multiple\n * lines. When this is omitted, a `ResizeObserver` will be used to\n * automatically detect multiline content.\n */\n multiline?: boolean;\n\n /** @defaultValue `false` */\n closeButton?: boolean;\n\n /**\n * Set this to `true` if you do not want to wrap the `children` in a `<div>`\n * that applies some toast layout styles. This should really only be used for\n * custom `Toast` implementations.\n *\n * @internal\n * @defaultValue `false`\n */\n disableWrapper?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * @see {@link https://next.react-md.dev/components/snackbar | Snackbar Demos}\n * @since 6.0.0\n */\nexport const ToastContent = forwardRef<HTMLDivElement, ToastContentProps>(\n function ToastContent(props, ref) {\n const {\n className,\n children,\n action,\n stacked,\n multiline: propMultiline,\n closeButton,\n disableWrapper,\n ...remaining\n } = props;\n\n const [isMultiline, setMultiline] = useState(false);\n const nodeRef = useResizeObserver({\n ref,\n disabled: disableWrapper || typeof propMultiline === \"boolean\",\n disableWidth: true,\n onUpdate: useCallback((entry) => {\n const element = entry.target;\n const style = window.getComputedStyle(element);\n const lineHeight = parseFloat(style.lineHeight);\n if (Number.isNaN(lineHeight)) {\n return;\n }\n\n setMultiline(element.scrollHeight > lineHeight);\n }, []),\n });\n const multiline = propMultiline ?? isMultiline;\n\n if (disableWrapper) {\n return <>{children}</>;\n }\n\n return (\n <div\n {...remaining}\n ref={nodeRef}\n className={toastContent({\n action,\n stacked,\n multiline,\n closeButton,\n className,\n })}\n >\n {children}\n </div>\n );\n }\n);\n"],"names":["forwardRef","useCallback","useState","useResizeObserver","toastContent","ToastContent","props","ref","className","children","action","stacked","multiline","propMultiline","closeButton","disableWrapper","remaining","isMultiline","setMultiline","nodeRef","disabled","disableWidth","onUpdate","entry","element","target","style","window","getComputedStyle","lineHeight","parseFloat","Number","isNaN","scrollHeight","div"],"mappings":"AAAA;;AAEA,SAA8BA,UAAU,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AAE/E,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,YAAY,QAAQ,0BAA0B;AAiCvD;;;;;CAKC,GACD,OAAO,MAAMC,6BAAeL,WAC1B,SAASK,aAAaC,KAAK,EAAEC,GAAG;IAC9B,MAAM,EACJC,SAAS,EACTC,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,WAAWC,aAAa,EACxBC,WAAW,EACXC,cAAc,EACd,GAAGC,WACJ,GAAGV;IAEJ,MAAM,CAACW,aAAaC,aAAa,GAAGhB,SAAS;IAC7C,MAAMiB,UAAUhB,kBAAkB;QAChCI;QACAa,UAAUL,kBAAkB,OAAOF,kBAAkB;QACrDQ,cAAc;QACdC,UAAUrB,YAAY,CAACsB;YACrB,MAAMC,UAAUD,MAAME,MAAM;YAC5B,MAAMC,QAAQC,OAAOC,gBAAgB,CAACJ;YACtC,MAAMK,aAAaC,WAAWJ,MAAMG,UAAU;YAC9C,IAAIE,OAAOC,KAAK,CAACH,aAAa;gBAC5B;YACF;YAEAX,aAAaM,QAAQS,YAAY,GAAGJ;QACtC,GAAG,EAAE;IACP;IACA,MAAMjB,YAAYC,iBAAiBI;IAEnC,IAAIF,gBAAgB;QAClB,qBAAO;sBAAGN;;IACZ;IAEA,qBACE,KAACyB;QACE,GAAGlB,SAAS;QACbT,KAAKY;QACLX,WAAWJ,aAAa;YACtBM;YACAC;YACAC;YACAE;YACAN;QACF;kBAECC;;AAGP,GACA"}
@@ -109,8 +109,8 @@ export interface ToastVisibilityTimers {
109
109
  exitTimeout?: number;
110
110
  }
111
111
  /**
112
+ * @see {@link https://next.react-md.dev/components/snackbar | Snackbar Demos}
112
113
  * @see {@link ToastManagerProvider}
113
- *
114
114
  * @since 6.0.0
115
115
  */
116
116
  export declare class ToastManager {
@@ -63,8 +63,8 @@ var _queue = /*#__PURE__*/ new WeakMap(), _timers = /*#__PURE__*/ new WeakMap(),
63
63
  * This calls `this.#emit()` if the toast was updated
64
64
  */ _updateToast = /*#__PURE__*/ new WeakMap();
65
65
  /**
66
+ * @see {@link https://next.react-md.dev/components/snackbar | Snackbar Demos}
66
67
  * @see {@link ToastManagerProvider}
67
- *
68
68
  * @since 6.0.0
69
69
  */ export class ToastManager {
70
70
  constructor(){
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/snackbar/ToastManager.tsx"],"sourcesContent":["import { nanoid } from \"nanoid\";\n\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;AAIhC;;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;;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AE;uCACX,SAAU,IAAIG;uCACd,YAAa,EAAE;IAEpB,2EAA2E;IAC3E,2EAA2E;IAC3E,gCAAgC;IAChC,EAAE;IACF,OAAO;IACP,wBAAwB;IACxB,mCAAmC;IACnC,8BAA8B;IAC9B,8BAA8B;IAC9B,KAAK;IACP;AA2XF;AAEA;;;;;;CAMC,GACD,OAAO,MAAMC,eAAe,IAAI3D,eAAe;AAE/C;;;CAGC,GACD,OAAO,MAAMqB,WAAqC,CAACf;IACjDqD,aAAatC,QAAQ,CAACf;AACxB,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAMsD,0BAA8D,CACzExD;IAEAuD,aAAa3B,kBAAkB,CAAC5B;AAClC,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAMgD,WAAqC;IAChDO,aAAaP,QAAQ;AACvB,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAMP,cAA2C,CACtDzC,SACA6C;IAEAU,aAAad,WAAW,CAACzC,SAAS6C;AACpC,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAMK,cAAc;IACzBK,aAAaL,WAAW;AAC1B,EAAE"}
1
+ {"version":3,"sources":["../../src/snackbar/ToastManager.ts"],"sourcesContent":["import { nanoid } from \"nanoid\";\n\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 https://next.react-md.dev/components/snackbar | Snackbar Demos}\n * @see {@link ToastManagerProvider}\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;AAIhC;;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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B,CAAC5B;AAClC,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAMgD,WAAqC;IAChDO,aAAaP,QAAQ;AACvB,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAMP,cAA2C,CACtDzC,SACA6C;IAEAU,aAAad,WAAW,CAACzC,SAAS6C;AACpC,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAMK,cAAc;IACzBK,aAAaL,WAAW;AAC1B,EAAE"}
@@ -47,6 +47,7 @@ export interface ToastManagerProviderProps {
47
47
  * the default {@link addToast}, {@link removeToast}, and {@link clearToasts}
48
48
  * implementation.
49
49
  *
50
+ * @see {@link https://next.react-md.dev/components/snackbar | Snackbar Demos}
50
51
  * @see {@link ToastManager} for example usage.
51
52
  * @since 6.0.0
52
53
  */
@@ -56,6 +56,7 @@ const { Provider } = context;
56
56
  * the default {@link addToast}, {@link removeToast}, and {@link clearToasts}
57
57
  * implementation.
58
58
  *
59
+ * @see {@link https://next.react-md.dev/components/snackbar | Snackbar Demos}
59
60
  * @see {@link ToastManager} for example usage.
60
61
  * @since 6.0.0
61
62
  */ export function ToastManagerProvider(props) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/snackbar/ToastManagerProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ReactElement,\n type ReactNode,\n createContext,\n useContext,\n useMemo,\n useSyncExternalStore,\n} from \"react\";\n\nimport {\n type ToastManager,\n type ToastQueue,\n toastManager,\n} from \"./ToastManager.js\";\n\nconst context = createContext(toastManager);\ncontext.displayName = \"ToastManager\";\nconst { Provider } = context;\n\n/**\n * This is mostly an internal hook to implement the toast functionality but can\n * be used externally as well for custom toast behavior if the other hooks do\n * not support your needs.\n *\n * @see {@link useAddToast}\n * @see {@link useToastQueue}\n * @see {@link useRemoveToast}\n *\n * @returns The current `ToastManager` set in the `ToastManagerProvider`.\n * Defaults to {@link toastManager} if there are no parent providers.\n * @since 6.0.0\n */\nexport function useToastManager(): ToastManager {\n return useContext(context);\n}\n\n/**\n * @see {@link ToastManager.addToast}\n * @since 6.0.0\n */\nexport function useAddToast(): ToastManager[\"addToast\"] {\n return useToastManager().addToast;\n}\n\n/**\n * @see {@link ToastManager.removeToast}\n * @since 6.0.0\n */\nexport function useRemoveToast(): ToastManager[\"removeToast\"] {\n return useToastManager().removeToast;\n}\n\n/**\n * @param limit - the total number of toasts that can be visible at once.\n * @since 6.0.0\n */\nexport function useToastQueue(limit?: number): ToastQueue {\n const toastManager = useToastManager();\n\n const queue = useSyncExternalStore(\n toastManager.subscribe,\n toastManager.getQueue,\n toastManager.getQueue\n );\n\n return useMemo(() => {\n if (!limit) {\n return queue;\n }\n\n return queue.slice(0, limit);\n }, [limit, queue]);\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ToastManagerProviderProps {\n children: ReactNode;\n\n /**\n * @defaultValue `toastManager`\n */\n manager?: ToastManager;\n}\n\n/**\n * **Client Component**\n *\n * This component can be used to implement separate instances of toasts if\n * required in your app. This probably shouldn't be required for most apps with\n * the default {@link addToast}, {@link removeToast}, and {@link clearToasts}\n * implementation.\n *\n * @see {@link ToastManager} for example usage.\n * @since 6.0.0\n */\nexport function ToastManagerProvider(\n props: ToastManagerProviderProps\n): ReactElement {\n const { children, manager = toastManager } = props;\n\n return <Provider value={manager}>{children}</Provider>;\n}\n"],"names":["createContext","useContext","useMemo","useSyncExternalStore","toastManager","context","displayName","Provider","useToastManager","useAddToast","addToast","useRemoveToast","removeToast","useToastQueue","limit","queue","subscribe","getQueue","slice","ToastManagerProvider","props","children","manager","value"],"mappings":"AAAA;;AAEA,SAGEA,aAAa,EACbC,UAAU,EACVC,OAAO,EACPC,oBAAoB,QACf,QAAQ;AAEf,SAGEC,YAAY,QACP,oBAAoB;AAE3B,MAAMC,wBAAUL,cAAcI;AAC9BC,QAAQC,WAAW,GAAG;AACtB,MAAM,EAAEC,QAAQ,EAAE,GAAGF;AAErB;;;;;;;;;;;;CAYC,GACD,OAAO,SAASG;IACd,OAAOP,WAAWI;AACpB;AAEA;;;CAGC,GACD,OAAO,SAASI;IACd,OAAOD,kBAAkBE,QAAQ;AACnC;AAEA;;;CAGC,GACD,OAAO,SAASC;IACd,OAAOH,kBAAkBI,WAAW;AACtC;AAEA;;;CAGC,GACD,OAAO,SAASC,cAAcC,KAAc;IAC1C,MAAMV,eAAeI;IAErB,MAAMO,QAAQZ,qBACZC,aAAaY,SAAS,EACtBZ,aAAaa,QAAQ,EACrBb,aAAaa,QAAQ;IAGvB,OAAOf,QAAQ;QACb,IAAI,CAACY,OAAO;YACV,OAAOC;QACT;QAEA,OAAOA,MAAMG,KAAK,CAAC,GAAGJ;IACxB,GAAG;QAACA;QAAOC;KAAM;AACnB;AAcA;;;;;;;;;;CAUC,GACD,OAAO,SAASI,qBACdC,KAAgC;IAEhC,MAAM,EAAEC,QAAQ,EAAEC,UAAUlB,YAAY,EAAE,GAAGgB;IAE7C,qBAAO,KAACb;QAASgB,OAAOD;kBAAUD;;AACpC"}
1
+ {"version":3,"sources":["../../src/snackbar/ToastManagerProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ReactElement,\n type ReactNode,\n createContext,\n useContext,\n useMemo,\n useSyncExternalStore,\n} from \"react\";\n\nimport {\n type ToastManager,\n type ToastQueue,\n toastManager,\n} from \"./ToastManager.js\";\n\nconst context = createContext(toastManager);\ncontext.displayName = \"ToastManager\";\nconst { Provider } = context;\n\n/**\n * This is mostly an internal hook to implement the toast functionality but can\n * be used externally as well for custom toast behavior if the other hooks do\n * not support your needs.\n *\n * @see {@link useAddToast}\n * @see {@link useToastQueue}\n * @see {@link useRemoveToast}\n *\n * @returns The current `ToastManager` set in the `ToastManagerProvider`.\n * Defaults to {@link toastManager} if there are no parent providers.\n * @since 6.0.0\n */\nexport function useToastManager(): ToastManager {\n return useContext(context);\n}\n\n/**\n * @see {@link ToastManager.addToast}\n * @since 6.0.0\n */\nexport function useAddToast(): ToastManager[\"addToast\"] {\n return useToastManager().addToast;\n}\n\n/**\n * @see {@link ToastManager.removeToast}\n * @since 6.0.0\n */\nexport function useRemoveToast(): ToastManager[\"removeToast\"] {\n return useToastManager().removeToast;\n}\n\n/**\n * @param limit - the total number of toasts that can be visible at once.\n * @since 6.0.0\n */\nexport function useToastQueue(limit?: number): ToastQueue {\n const toastManager = useToastManager();\n\n const queue = useSyncExternalStore(\n toastManager.subscribe,\n toastManager.getQueue,\n toastManager.getQueue\n );\n\n return useMemo(() => {\n if (!limit) {\n return queue;\n }\n\n return queue.slice(0, limit);\n }, [limit, queue]);\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ToastManagerProviderProps {\n children: ReactNode;\n\n /**\n * @defaultValue `toastManager`\n */\n manager?: ToastManager;\n}\n\n/**\n * **Client Component**\n *\n * This component can be used to implement separate instances of toasts if\n * required in your app. This probably shouldn't be required for most apps with\n * the default {@link addToast}, {@link removeToast}, and {@link clearToasts}\n * implementation.\n *\n * @see {@link https://next.react-md.dev/components/snackbar | Snackbar Demos}\n * @see {@link ToastManager} for example usage.\n * @since 6.0.0\n */\nexport function ToastManagerProvider(\n props: ToastManagerProviderProps\n): ReactElement {\n const { children, manager = toastManager } = props;\n\n return <Provider value={manager}>{children}</Provider>;\n}\n"],"names":["createContext","useContext","useMemo","useSyncExternalStore","toastManager","context","displayName","Provider","useToastManager","useAddToast","addToast","useRemoveToast","removeToast","useToastQueue","limit","queue","subscribe","getQueue","slice","ToastManagerProvider","props","children","manager","value"],"mappings":"AAAA;;AAEA,SAGEA,aAAa,EACbC,UAAU,EACVC,OAAO,EACPC,oBAAoB,QACf,QAAQ;AAEf,SAGEC,YAAY,QACP,oBAAoB;AAE3B,MAAMC,wBAAUL,cAAcI;AAC9BC,QAAQC,WAAW,GAAG;AACtB,MAAM,EAAEC,QAAQ,EAAE,GAAGF;AAErB;;;;;;;;;;;;CAYC,GACD,OAAO,SAASG;IACd,OAAOP,WAAWI;AACpB;AAEA;;;CAGC,GACD,OAAO,SAASI;IACd,OAAOD,kBAAkBE,QAAQ;AACnC;AAEA;;;CAGC,GACD,OAAO,SAASC;IACd,OAAOH,kBAAkBI,WAAW;AACtC;AAEA;;;CAGC,GACD,OAAO,SAASC,cAAcC,KAAc;IAC1C,MAAMV,eAAeI;IAErB,MAAMO,QAAQZ,qBACZC,aAAaY,SAAS,EACtBZ,aAAaa,QAAQ,EACrBb,aAAaa,QAAQ;IAGvB,OAAOf,QAAQ;QACb,IAAI,CAACY,OAAO;YACV,OAAOC;QACT;QAEA,OAAOA,MAAMG,KAAK,CAAC,GAAGJ;IACxB,GAAG;QAACA;QAAOC;KAAM;AACnB;AAcA;;;;;;;;;;;CAWC,GACD,OAAO,SAASI,qBACdC,KAAgC;IAEhC,MAAM,EAAEC,QAAQ,EAAEC,UAAUlB,YAAY,EAAE,GAAGgB;IAE7C,qBAAO,KAACb;QAASgB,OAAOD;kBAAUD;;AACpC"}
@@ -1,3 +1,7 @@
1
+ ////
2
+ /// @group snackbar
3
+ ////
4
+
1
5
  @use "sass:map";
2
6
  @use "../utils";
3
7
  @use "../box-shadows";
@@ -10,59 +14,171 @@
10
14
  @use "../typography/typography";
11
15
  @use "../transition/transition";
12
16
 
17
+ /// Set to `true` to disable all the styles.
18
+ /// @type Boolean
13
19
  $disable-everything: false !default;
20
+
21
+ /// Set to `true` if the `position: absolute` styles are not required where a
22
+ /// `Snackbar` is rendered within another `position: relative` container.
23
+ ///
24
+ /// @type Boolean
14
25
  $disable-absolute: false !default;
26
+
27
+ /// Set to `true` to disable the styles for a `Snackbar` positioned at the top
28
+ /// of the page/container.
29
+ /// @type Boolean
15
30
  $disable-top: false !default;
31
+
32
+ /// Set to `true` to disable the styles for a `Snackbar` positioned at the
33
+ /// bottom of the page/container.
34
+ /// @type Boolean
16
35
  $disable-bottom: false !default;
36
+
37
+ /// Set to `true` to disable the styles for a `Snackbar` positioned at the
38
+ /// top-right of the page/container.
39
+ /// @type Boolean
17
40
  $disable-top-right: $disable-top !default;
41
+
42
+ /// Set to `true` to disable the styles for a `Snackbar` positioned at the
43
+ /// top-left of the page/container.
44
+ /// @type Boolean
18
45
  $disable-top-left: $disable-top !default;
46
+
47
+ /// Set to `true` to disable the styles for a `Snackbar` positioned at the
48
+ /// bottom-left of the page/container.
49
+ /// @type Boolean
19
50
  $disable-bottom-left: $disable-bottom !default;
51
+
52
+ /// Set to `true` to disable the styles for a `Snackbar` positioned at the
53
+ /// bottom-right of the page/container.
54
+ /// @type Boolean
20
55
  $disable-bottom-right: $disable-bottom !default;
56
+
57
+ /// Set to `true` to disable the `ToastCloseButton` styles.
58
+ /// @type Boolean
21
59
  $disable-close-button: false !default;
60
+
61
+ /// Set to `true` to disable the `ToastActionButton` styles.
62
+ /// @type Boolean
22
63
  $disable-action-button: false !default;
64
+
65
+ /// Set to `true` to disable the stacked `Snackbar` styles.
66
+ /// @type Boolean
23
67
  $disable-stacked: false !default;
24
68
 
69
+ /// The default `align-items` for a `Snackbar`.
70
+ /// @type String
25
71
  $default-align-items: center !default;
72
+
73
+ /// The default `gap` for a `Snackbar`.
74
+ /// @type Number
26
75
  $gap: 1rem !default;
76
+
77
+ /// The default `gap` for a `Toast`.
78
+ /// @type Number
27
79
  $toast-gap: 1rem !default;
80
+
81
+ /// The default `gap` for a stacked `Toast`.
82
+ /// @type Number
28
83
  $toast-gap-stacked: 0.5rem !default;
84
+
85
+ /// The default `gap` for a toast that has both a `ToastActionButton` and
86
+ /// `ToastCloseButton`.
87
+ /// @type Number
29
88
  $toast-gap-both-buttons: 0.25rem !default;
89
+
90
+ /// The viewport margin to apply to all `Toast` rendered within the `Snackbar`.
91
+ /// @type Number
30
92
  $margin: 1rem !default;
31
- $box-shadow: 6 !default;
93
+
94
+ /// A number between 0-24 representing the box-shadow elevation for a `Toast`.
95
+ /// @type Number
96
+ $elevation: 6 !default;
97
+
98
+ /// The default border-radius for a `Toast`.
99
+ /// @type Number
32
100
  $border-radius: 0.25rem !default;
101
+
102
+ /// The default vertical padding for a `Toast`.
103
+ /// @type Number
33
104
  $vertical-padding: 0.75em !default;
105
+
106
+ /// The default horizontal padding for a `Toast`.
107
+ /// @type Number
34
108
  $horizontal-padding: 1rem !default;
109
+
110
+ /// The default horizontal padding for a `Toast` that has an
111
+ /// `ToastActionButton`.
112
+ /// @type Number
35
113
  $action-horizontal-padding: 0.5rem !default;
114
+
115
+ /// The default horizontal padding for a `Toast` that has an
116
+ /// `ToastCloseButton`.
117
+ /// @type Number
36
118
  $close-button-horizontal-padding: 0 !default;
37
119
 
120
+ /// The min-height for a `Toast`.
121
+ /// @type Number
38
122
  $min-height: 3rem !default;
123
+
124
+ /// The min-width for a `Toast` when the viewport is tablet or above.
125
+ /// @type Number
39
126
  $min-width: 21.5rem !default;
127
+
128
+ /// The max-width for a `Toast`.
129
+ /// @type Number
40
130
  $max-width: 35.5rem !default;
131
+
132
+ /// The default `z-index` for a `Toast`.
133
+ /// @type Number
41
134
  $z-index: utils.$temporary-element-z-index + 10 !default;
42
135
 
136
+ /// The default `Toast` typography styles.
137
+ /// @type Map
43
138
  $typography: map.merge(
44
139
  typography.$base-font-styles,
45
140
  typography.$subtitle-2-styles
46
141
  ) !default;
47
142
 
143
+ /// The background-color to use in the light theme.
144
+ /// @type Color
48
145
  $light-theme-background-color: #323232 !default;
146
+
147
+ /// The text color to use in the light theme.
148
+ /// @type Color
49
149
  $light-theme-color: a11y.contrast-color($light-theme-background-color) !default;
50
150
 
151
+ /// The background-color to use in the dark theme.
152
+ /// @type Color
51
153
  $dark-theme-background-color: if(
52
154
  theme.$disable-dark-elevation,
53
155
  $light-theme-background-color,
54
- map.get(theme.$dark-elevation-colors, $box-shadow)
156
+ map.get(theme.$dark-elevation-colors, $elevation)
55
157
  ) !default;
158
+
159
+ /// The text color to use in the dark theme.
160
+ /// @type Color
56
161
  $dark-theme-color: a11y.contrast-color($dark-theme-background-color) !default;
57
162
 
163
+ /// The default background-color for a `Toast`.
164
+ /// @type Color
58
165
  $background-color: theme.get-default-color(
59
166
  $light-theme-background-color,
60
167
  $dark-theme-background-color
61
168
  ) !default;
169
+
170
+ /// The default text color for a `Toast`.
171
+ /// @type Color
62
172
  $color: theme.get-default-color($light-theme-color, $dark-theme-color) !default;
63
173
 
174
+ /// The available configurable css variables and mostly used internally for the
175
+ /// `get-var`, `set-var`, and `use-var` utils.
176
+ /// @type List
64
177
  $variables: (background-color, color, offset);
65
178
 
179
+ /// @param {String} name - The supported variable name
180
+ /// @param {any} fallback [null] - An optional fallback value
181
+ /// @returns {String} a `var()` statement
66
182
  @function get-var($name, $fallback: null) {
67
183
  $var: utils.get-var-name($variables, $name, "snackbar");
68
184
  @if $fallback {
@@ -72,16 +188,24 @@ $variables: (background-color, color, offset);
72
188
  @return var(#{$var});
73
189
  }
74
190
 
191
+ /// @param {String} name - The supported variable name
192
+ /// @param {any} value - The value to set the variable to. Supports `null` which
193
+ /// will just be a no-op.
75
194
  @mixin set-var($name, $value) {
76
195
  @if $value {
77
196
  #{utils.get-var-name($variables, $name, "snackbar")}: #{$value};
78
197
  }
79
198
  }
80
199
 
200
+ /// @param {String} property - The css property to apply the variable to
201
+ /// @param {String} name [$property] - The supported variable name
202
+ /// @param {any} fallback [null] - An optional fallback value if the variable
203
+ /// has not been set
81
204
  @mixin use-var($property, $name: $property, $fallback: null) {
82
205
  #{$property}: get-var($name, $fallback);
83
206
  }
84
207
 
208
+ /// Conditionally applies the css variables based on feature flags
85
209
  @mixin variables {
86
210
  @if not $disable-everything {
87
211
  @include set-var(background-color, $background-color);
@@ -90,6 +214,10 @@ $variables: (background-color, color, offset);
90
214
  }
91
215
  }
92
216
 
217
+ /// Generates all the styles based on feature flags.
218
+ ///
219
+ /// @param {Boolean} disable-layer [false] - Set this to `true` to disable the
220
+ /// layer behavior
93
221
  @mixin styles($disable-layer: false) {
94
222
  @if not $disable-everything {
95
223
  @include utils.optional-layer(snackbar, $disable-layer) {
@@ -145,7 +273,7 @@ $variables: (background-color, color, offset);
145
273
  }
146
274
 
147
275
  .rmd-toast {
148
- @include box-shadows.box-shadow($box-shadow, $disable-colors: true);
276
+ @include box-shadows.box-shadow($elevation, $disable-colors: true);
149
277
  @include utils.map-to-styles($typography);
150
278
  @include use-var(background-color);
151
279
  @include use-var(color);
@@ -1,11 +1,4 @@
1
1
  import { type BackgroundColor } from "../cssUtils.js";
2
- declare module "react" {
3
- interface CSSProperties {
4
- "--rmd-toast-color"?: string;
5
- "--rmd-toast-background-color"?: string;
6
- "--rmd-toast-offset"?: string | number;
7
- }
8
- }
9
2
  /** @since 6.0.0 */
10
3
  export interface ToastClassNameOptions {
11
4
  className?: string;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/snackbar/toastStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\nimport { type BackgroundColor, cssUtils } from \"../cssUtils.js\";\nimport { bem } from \"../utils/bem.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-toast-color\"?: string;\n \"--rmd-toast-background-color\"?: string;\n \"--rmd-toast-offset\"?: string | number;\n }\n}\n\nconst styles = bem(\"rmd-toast\");\n\n/** @since 6.0.0 */\nexport interface ToastClassNameOptions {\n className?: string;\n /** @defaultValue `\"surface\"` */\n theme?: BackgroundColor;\n /** @defaultValue `false` */\n action?: boolean;\n /** @defaultValue `false` */\n paused?: boolean;\n /** @defaultValue `false` */\n stacked?: boolean;\n /** @defaultValue `false` */\n reordered?: boolean;\n /** @defaultValue `false` */\n closeButton?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function toast(options: ToastClassNameOptions = {}): string {\n const {\n className,\n theme = \"surface\",\n action,\n paused,\n stacked,\n reordered,\n closeButton,\n } = options;\n\n return cnb(\n styles({\n x: closeButton,\n action,\n paused,\n \"small-gap\": closeButton && action,\n stacked,\n reordered: stacked && reordered,\n }),\n cssUtils({\n backgroundColor:\n theme !== \"surface\" && theme !== \"current-color\" ? theme : undefined,\n }),\n className\n );\n}\n"],"names":["cnb","cssUtils","bem","styles","toast","options","className","theme","action","paused","stacked","reordered","closeButton","x","backgroundColor","undefined"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAA+BC,QAAQ,QAAQ,iBAAiB;AAChE,SAASC,GAAG,QAAQ,kBAAkB;AAUtC,MAAMC,SAASD,IAAI;AAmBnB;;CAEC,GACD,OAAO,SAASE,MAAMC,UAAiC,CAAC,CAAC;IACvD,MAAM,EACJC,SAAS,EACTC,QAAQ,SAAS,EACjBC,MAAM,EACNC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,WAAW,EACZ,GAAGP;IAEJ,OAAOL,IACLG,OAAO;QACLU,GAAGD;QACHJ;QACAC;QACA,aAAaG,eAAeJ;QAC5BE;QACAC,WAAWD,WAAWC;IACxB,IACAV,SAAS;QACPa,iBACEP,UAAU,aAAaA,UAAU,kBAAkBA,QAAQQ;IAC/D,IACAT;AAEJ"}
1
+ {"version":3,"sources":["../../src/snackbar/toastStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\nimport { type BackgroundColor, cssUtils } from \"../cssUtils.js\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-toast\");\n\n/** @since 6.0.0 */\nexport interface ToastClassNameOptions {\n className?: string;\n /** @defaultValue `\"surface\"` */\n theme?: BackgroundColor;\n /** @defaultValue `false` */\n action?: boolean;\n /** @defaultValue `false` */\n paused?: boolean;\n /** @defaultValue `false` */\n stacked?: boolean;\n /** @defaultValue `false` */\n reordered?: boolean;\n /** @defaultValue `false` */\n closeButton?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function toast(options: ToastClassNameOptions = {}): string {\n const {\n className,\n theme = \"surface\",\n action,\n paused,\n stacked,\n reordered,\n closeButton,\n } = options;\n\n return cnb(\n styles({\n x: closeButton,\n action,\n paused,\n \"small-gap\": closeButton && action,\n stacked,\n reordered: stacked && reordered,\n }),\n cssUtils({\n backgroundColor:\n theme !== \"surface\" && theme !== \"current-color\" ? theme : undefined,\n }),\n className\n );\n}\n"],"names":["cnb","cssUtils","bem","styles","toast","options","className","theme","action","paused","stacked","reordered","closeButton","x","backgroundColor","undefined"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAA+BC,QAAQ,QAAQ,iBAAiB;AAChE,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAmBnB;;CAEC,GACD,OAAO,SAASE,MAAMC,UAAiC,CAAC,CAAC;IACvD,MAAM,EACJC,SAAS,EACTC,QAAQ,SAAS,EACjBC,MAAM,EACNC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,WAAW,EACZ,GAAGP;IAEJ,OAAOL,IACLG,OAAO;QACLU,GAAGD;QACHJ;QACAC;QACA,aAAaG,eAAeJ;QAC5BE;QACAC,WAAWD,WAAWC;IACxB,IACAV,SAAS;QACPa,iBACEP,UAAU,aAAaA,UAAU,kBAAkBA,QAAQQ;IAC/D,IACAT;AAEJ"}
@@ -25,6 +25,7 @@ export declare const CurrentToastActionsProvider: import("react").Provider<Curre
25
25
  * This is only required if you have multiple `Snackbar` implementations in your
26
26
  * app.
27
27
  *
28
+ * @see {@link https://next.react-md.dev/components/snackbar | Snackbar Demos}
28
29
  * @since 6.0.0
29
30
  */
30
31
  export declare function useCurrentToastActions(): CurrentToastActions;
@@ -10,6 +10,7 @@ context.displayName = "CurrentToastActions";
10
10
  * This is only required if you have multiple `Snackbar` implementations in your
11
11
  * app.
12
12
  *
13
+ * @see {@link https://next.react-md.dev/components/snackbar | Snackbar Demos}
13
14
  * @since 6.0.0
14
15
  */ export function useCurrentToastActions() {
15
16
  const actions = useContext(context);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/snackbar/useCurrentToastActions.ts"],"sourcesContent":["\"use client\";\n\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;AAEA,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\";\n\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 * @see {@link https://next.react-md.dev/components/snackbar | Snackbar Demos}\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;AAEA,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;;;;;;CAMC,GACD,OAAO,SAASI;IACd,MAAMC,UAAUN,WAAWC;IAC3B,IAAI,CAACK,SAAS;QACZ,MAAM,IAAIC,MACR;IAEJ;IAEA,OAAOD;AACT"}
@@ -105,6 +105,7 @@ import { type StorageImplementation, type StorageOptions } from "./types.js";
105
105
  * }
106
106
  * ```
107
107
  *
108
+ * @see {@link https://next.react-md.dev/hooks/use-storage | useStorage Demos}
108
109
  * @see https://developer.mozilla.org/en-US/docs/Web/API/StorageEvent
109
110
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
110
111
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
@@ -110,6 +110,7 @@ import { getItemFromStorage, removeItemFromStorage, setItemInStorage } from "./u
110
110
  * }
111
111
  * ```
112
112
  *
113
+ * @see {@link https://next.react-md.dev/hooks/use-storage | useStorage Demos}
113
114
  * @see https://developer.mozilla.org/en-US/docs/Web/API/StorageEvent
114
115
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
115
116
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/storage/useStorage.ts"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { useSsr } from \"../SsrProvider.js\";\nimport { type UseStateSetter } from \"../types.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport { getStorageSerializers } from \"./internalUtils.js\";\nimport { type StorageImplementation, type StorageOptions } from \"./types.js\";\nimport {\n getItemFromStorage,\n removeItemFromStorage,\n setItemInStorage,\n} from \"./utils.js\";\n\n/**\n * The `useStorage` hook can be used to read and write from `localStorage`\n * (default) or `sessionStorage`. The default behavior will automatically sync\n * the value across tabs using the `StorageEvent`.\n *\n * @example Simple Example\n * ```tsx\n * import { TextField } from \"@react-md/core/form/TextField\";\n * import { useStorage } from \"@react-md/core/storage/useStorage\";\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { value, setValue } = useStorage({\n * key: \"savedSearch\",\n * defaultValue: \"\",\n * });\n *\n * return (\n * <TextField\n * label=\"Search\"\n * placeholder=\"Search...\"\n * type=\"search\"\n * value={value}\n * onChange={(event) => {\n * setValue(event.currentTarget.value)\n * }}\n * />\n * );\n * }\n * ```\n *\n * @example Type-safe Objects\n * ```tsx\n * import { useStorage } from \"@react-md/core/storage/useStorage\";\n * import { type ReactElement } from \"react\";\n *\n * interface ExpectedSchema {\n * label: string;\n * value: string;\n * // others\n * }\n *\n * function Example(): ReactElement {\n * const { value, setValue } = useStorage<ExpectedSchema | null>({\n * key: \"someKey\",\n * defaultValue: null,\n *\n * // this is optional: you can create a custom deserializer to validate\n * // the stored value to prevent people manually updating local storage in\n * // the dev tools\n * deserializer(item) {\n * const parsed = JSON.parse(item):\n * const { label, value } = parsed;\n * if (typeof label !== 'string' || typeof value !== 'string') {\n * return null;\n * }\n *\n * return { label, value };\n * }\n * });\n *\n * // do something\n * // value will be `ExpectedSchema | null`\n * }\n * ```\n *\n * @example Manual Persistence\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import { Checkbox } from \"@react-md/core/form/Checkbox\";\n * import { Form } from \"@react-md/core/form/Form\";\n * import { useStorage } from \"@react-md/core/storage/useStorage\";\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { value, setValue, remove, persist } = useStorage({\n * key: \"someKey\",\n * manual: true,\n * defaultValue: false,\n * });\n *\n * return (\n * <Form\n * onSubmit={() => {\n * // current value will be saved into local storage\n * persist();\n * }}\n * onReset={() => {\n * // \"someKey\" will be removed from local storage\n * remove();\n * }}\n * >\n * <Checkbox\n * label=\"Allow cookies\"\n * checked={value}\n * onChange={(event) =>\n * setValue(event.currentTarget.checked);\n * }\n * />\n * <Button type=\"reset\">Decline</Button>\n * <Button type=\"submit\">Save</Button>\n * </Form>\n * );\n * }\n * ```\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/StorageEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\n * @since 6.0.0\n */\nexport function useStorage<T>(\n options: StorageOptions<T>\n): StorageImplementation<T> {\n const {\n key,\n defaultValue,\n manual,\n storage = globalThis.localStorage,\n } = options;\n\n const [initialValue] = useState(defaultValue);\n const { serializer, deserializer } = useMemo(\n () =>\n getStorageSerializers({\n raw: options.raw,\n serializer: options.serializer,\n deserializer: options.deserializer,\n initialValue,\n }),\n [initialValue, options.deserializer, options.raw, options.serializer]\n );\n\n const ssr = useSsr();\n const [value, setStoredValue] = useState<T>(() => {\n if (ssr) {\n return initialValue;\n }\n\n return getItemFromStorage({\n key,\n storage,\n fallback: initialValue,\n deserializer,\n });\n });\n\n const config = useRef({\n key,\n value,\n manual,\n storage,\n serializer,\n deserializer,\n defaultValue: initialValue,\n } as const);\n useIsomorphicLayoutEffect(() => {\n config.current = {\n key,\n value,\n manual,\n storage,\n serializer,\n deserializer,\n defaultValue: initialValue,\n };\n });\n\n const setValue = useCallback<UseStateSetter<T>>((valueOrDispatcher) => {\n const { key, manual, storage, serializer } = config.current;\n\n setStoredValue((prevValue) => {\n const nextValue =\n valueOrDispatcher instanceof Function\n ? valueOrDispatcher(prevValue)\n : valueOrDispatcher;\n\n if (!manual && nextValue !== prevValue) {\n setItemInStorage({\n key,\n value: nextValue,\n storage,\n serializer,\n });\n }\n\n return nextValue;\n });\n }, []);\n\n const remove = useCallback(() => {\n removeItemFromStorage(config.current);\n }, []);\n\n const persist = useCallback(() => {\n setItemInStorage(config.current);\n }, []);\n\n // make sure to sync the value in local storage\n useEffect(() => {\n const { value, manual, storage, serializer } = config.current;\n if (ssr || !key || !value || manual || !storage) {\n return;\n }\n\n setItemInStorage({\n key,\n value,\n storage,\n serializer,\n });\n }, [key, ssr]);\n useEffect(() => {\n const { defaultValue, storage, deserializer, manual } = config.current;\n if (manual || !ssr) {\n return;\n }\n\n // do not want to trigger the emit behavior for rehydration\n setStoredValue(\n getItemFromStorage({\n key,\n storage,\n fallback: defaultValue,\n deserializer,\n })\n );\n }, [key, ssr]);\n\n // update the value if another tab changed the local storage value\n useEffect(() => {\n if (!key) {\n return;\n }\n\n const callback = (event: StorageEvent): void => {\n const { storage, defaultValue, deserializer } = config.current;\n if (event.key === key && event.storageArea === storage) {\n setStoredValue(\n getItemFromStorage({\n key,\n storage,\n fallback: defaultValue,\n deserializer,\n })\n );\n }\n };\n\n window.addEventListener(\"storage\", callback);\n return () => {\n window.removeEventListener(\"storage\", callback);\n };\n }, [key]);\n\n return {\n value,\n setValue,\n remove,\n persist,\n };\n}\n"],"names":["useCallback","useEffect","useMemo","useRef","useState","useSsr","useIsomorphicLayoutEffect","getStorageSerializers","getItemFromStorage","removeItemFromStorage","setItemInStorage","useStorage","options","key","defaultValue","manual","storage","globalThis","localStorage","initialValue","serializer","deserializer","raw","ssr","value","setStoredValue","fallback","config","current","setValue","valueOrDispatcher","prevValue","nextValue","Function","remove","persist","callback","event","storageArea","window","addEventListener","removeEventListener"],"mappings":"AAAA;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAE1E,SAASC,MAAM,QAAQ,oBAAoB;AAE3C,SAASC,yBAAyB,QAAQ,kCAAkC;AAC5E,SAASC,qBAAqB,QAAQ,qBAAqB;AAE3D,SACEC,kBAAkB,EAClBC,qBAAqB,EACrBC,gBAAgB,QACX,aAAa;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8GC,GACD,OAAO,SAASC,WACdC,OAA0B;IAE1B,MAAM,EACJC,GAAG,EACHC,YAAY,EACZC,MAAM,EACNC,UAAUC,WAAWC,YAAY,EAClC,GAAGN;IAEJ,MAAM,CAACO,aAAa,GAAGf,SAASU;IAChC,MAAM,EAAEM,UAAU,EAAEC,YAAY,EAAE,GAAGnB,QACnC,IACEK,sBAAsB;YACpBe,KAAKV,QAAQU,GAAG;YAChBF,YAAYR,QAAQQ,UAAU;YAC9BC,cAAcT,QAAQS,YAAY;YAClCF;QACF,IACF;QAACA;QAAcP,QAAQS,YAAY;QAAET,QAAQU,GAAG;QAAEV,QAAQQ,UAAU;KAAC;IAGvE,MAAMG,MAAMlB;IACZ,MAAM,CAACmB,OAAOC,eAAe,GAAGrB,SAAY;QAC1C,IAAImB,KAAK;YACP,OAAOJ;QACT;QAEA,OAAOX,mBAAmB;YACxBK;YACAG;YACAU,UAAUP;YACVE;QACF;IACF;IAEA,MAAMM,SAASxB,OAAO;QACpBU;QACAW;QACAT;QACAC;QACAI;QACAC;QACAP,cAAcK;IAChB;IACAb,0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AAEF,YAAY,EAAEO,YAAY,EAAE,GAAGM,OAAOC,OAAO;YAC9D,IAAIS,MAAMxB,GAAG,KAAKA,OAAOwB,MAAMC,WAAW,KAAKtB,SAAS;gBACtDS,eACEjB,mBAAmB;oBACjBK;oBACAG;oBACAU,UAAUZ;oBACVO;gBACF;YAEJ;QACF;QAEAkB,OAAOC,gBAAgB,CAAC,WAAWJ;QACnC,OAAO;YACLG,OAAOE,mBAAmB,CAAC,WAAWL;QACxC;IACF,GAAG;QAACvB;KAAI;IAER,OAAO;QACLW;QACAK;QACAK;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/storage/useStorage.ts"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { useSsr } from \"../SsrProvider.js\";\nimport { type UseStateSetter } from \"../types.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport { getStorageSerializers } from \"./internalUtils.js\";\nimport { type StorageImplementation, type StorageOptions } from \"./types.js\";\nimport {\n getItemFromStorage,\n removeItemFromStorage,\n setItemInStorage,\n} from \"./utils.js\";\n\n/**\n * The `useStorage` hook can be used to read and write from `localStorage`\n * (default) or `sessionStorage`. The default behavior will automatically sync\n * the value across tabs using the `StorageEvent`.\n *\n * @example Simple Example\n * ```tsx\n * import { TextField } from \"@react-md/core/form/TextField\";\n * import { useStorage } from \"@react-md/core/storage/useStorage\";\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { value, setValue } = useStorage({\n * key: \"savedSearch\",\n * defaultValue: \"\",\n * });\n *\n * return (\n * <TextField\n * label=\"Search\"\n * placeholder=\"Search...\"\n * type=\"search\"\n * value={value}\n * onChange={(event) => {\n * setValue(event.currentTarget.value)\n * }}\n * />\n * );\n * }\n * ```\n *\n * @example Type-safe Objects\n * ```tsx\n * import { useStorage } from \"@react-md/core/storage/useStorage\";\n * import { type ReactElement } from \"react\";\n *\n * interface ExpectedSchema {\n * label: string;\n * value: string;\n * // others\n * }\n *\n * function Example(): ReactElement {\n * const { value, setValue } = useStorage<ExpectedSchema | null>({\n * key: \"someKey\",\n * defaultValue: null,\n *\n * // this is optional: you can create a custom deserializer to validate\n * // the stored value to prevent people manually updating local storage in\n * // the dev tools\n * deserializer(item) {\n * const parsed = JSON.parse(item):\n * const { label, value } = parsed;\n * if (typeof label !== 'string' || typeof value !== 'string') {\n * return null;\n * }\n *\n * return { label, value };\n * }\n * });\n *\n * // do something\n * // value will be `ExpectedSchema | null`\n * }\n * ```\n *\n * @example Manual Persistence\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import { Checkbox } from \"@react-md/core/form/Checkbox\";\n * import { Form } from \"@react-md/core/form/Form\";\n * import { useStorage } from \"@react-md/core/storage/useStorage\";\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { value, setValue, remove, persist } = useStorage({\n * key: \"someKey\",\n * manual: true,\n * defaultValue: false,\n * });\n *\n * return (\n * <Form\n * onSubmit={() => {\n * // current value will be saved into local storage\n * persist();\n * }}\n * onReset={() => {\n * // \"someKey\" will be removed from local storage\n * remove();\n * }}\n * >\n * <Checkbox\n * label=\"Allow cookies\"\n * checked={value}\n * onChange={(event) =>\n * setValue(event.currentTarget.checked);\n * }\n * />\n * <Button type=\"reset\">Decline</Button>\n * <Button type=\"submit\">Save</Button>\n * </Form>\n * );\n * }\n * ```\n *\n * @see {@link https://next.react-md.dev/hooks/use-storage | useStorage Demos}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/StorageEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\n * @since 6.0.0\n */\nexport function useStorage<T>(\n options: StorageOptions<T>\n): StorageImplementation<T> {\n const {\n key,\n defaultValue,\n manual,\n storage = globalThis.localStorage,\n } = options;\n\n const [initialValue] = useState(defaultValue);\n const { serializer, deserializer } = useMemo(\n () =>\n getStorageSerializers({\n raw: options.raw,\n serializer: options.serializer,\n deserializer: options.deserializer,\n initialValue,\n }),\n [initialValue, options.deserializer, options.raw, options.serializer]\n );\n\n const ssr = useSsr();\n const [value, setStoredValue] = useState<T>(() => {\n if (ssr) {\n return initialValue;\n }\n\n return getItemFromStorage({\n key,\n storage,\n fallback: initialValue,\n deserializer,\n });\n });\n\n const config = useRef({\n key,\n value,\n manual,\n storage,\n serializer,\n deserializer,\n defaultValue: initialValue,\n } as const);\n useIsomorphicLayoutEffect(() => {\n config.current = {\n key,\n value,\n manual,\n storage,\n serializer,\n deserializer,\n defaultValue: initialValue,\n };\n });\n\n const setValue = useCallback<UseStateSetter<T>>((valueOrDispatcher) => {\n const { key, manual, storage, serializer } = config.current;\n\n setStoredValue((prevValue) => {\n const nextValue =\n valueOrDispatcher instanceof Function\n ? valueOrDispatcher(prevValue)\n : valueOrDispatcher;\n\n if (!manual && nextValue !== prevValue) {\n setItemInStorage({\n key,\n value: nextValue,\n storage,\n serializer,\n });\n }\n\n return nextValue;\n });\n }, []);\n\n const remove = useCallback(() => {\n removeItemFromStorage(config.current);\n }, []);\n\n const persist = useCallback(() => {\n setItemInStorage(config.current);\n }, []);\n\n // make sure to sync the value in local storage\n useEffect(() => {\n const { value, manual, storage, serializer } = config.current;\n if (ssr || !key || !value || manual || !storage) {\n return;\n }\n\n setItemInStorage({\n key,\n value,\n storage,\n serializer,\n });\n }, [key, ssr]);\n useEffect(() => {\n const { defaultValue, storage, deserializer, manual } = config.current;\n if (manual || !ssr) {\n return;\n }\n\n // do not want to trigger the emit behavior for rehydration\n setStoredValue(\n getItemFromStorage({\n key,\n storage,\n fallback: defaultValue,\n deserializer,\n })\n );\n }, [key, ssr]);\n\n // update the value if another tab changed the local storage value\n useEffect(() => {\n if (!key) {\n return;\n }\n\n const callback = (event: StorageEvent): void => {\n const { storage, defaultValue, deserializer } = config.current;\n if (event.key === key && event.storageArea === storage) {\n setStoredValue(\n getItemFromStorage({\n key,\n storage,\n fallback: defaultValue,\n deserializer,\n })\n );\n }\n };\n\n window.addEventListener(\"storage\", callback);\n return () => {\n window.removeEventListener(\"storage\", callback);\n };\n }, [key]);\n\n return {\n value,\n setValue,\n remove,\n persist,\n };\n}\n"],"names":["useCallback","useEffect","useMemo","useRef","useState","useSsr","useIsomorphicLayoutEffect","getStorageSerializers","getItemFromStorage","removeItemFromStorage","setItemInStorage","useStorage","options","key","defaultValue","manual","storage","globalThis","localStorage","initialValue","serializer","deserializer","raw","ssr","value","setStoredValue","fallback","config","current","setValue","valueOrDispatcher","prevValue","nextValue","Function","remove","persist","callback","event","storageArea","window","addEventListener","removeEventListener"],"mappings":"AAAA;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAE1E,SAASC,MAAM,QAAQ,oBAAoB;AAE3C,SAASC,yBAAyB,QAAQ,kCAAkC;AAC5E,SAASC,qBAAqB,QAAQ,qBAAqB;AAE3D,SACEC,kBAAkB,EAClBC,qBAAqB,EACrBC,gBAAgB,QACX,aAAa;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GC,GACD,OAAO,SAASC,WACdC,OAA0B;IAE1B,MAAM,EACJC,GAAG,EACHC,YAAY,EACZC,MAAM,EACNC,UAAUC,WAAWC,YAAY,EAClC,GAAGN;IAEJ,MAAM,CAACO,aAAa,GAAGf,SAASU;IAChC,MAAM,EAAEM,UAAU,EAAEC,YAAY,EAAE,GAAGnB,QACnC,IACEK,sBAAsB;YACpBe,KAAKV,QAAQU,GAAG;YAChBF,YAAYR,QAAQQ,UAAU;YAC9BC,cAAcT,QAAQS,YAAY;YAClCF;QACF,IACF;QAACA;QAAcP,QAAQS,YAAY;QAAET,QAAQU,GAAG;QAAEV,QAAQQ,UAAU;KAAC;IAGvE,MA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