@basic-ui/material 1.0.0-alpha.0 → 1.0.0-alpha.3

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 (534) hide show
  1. package/build/cjs/index.js +24 -18
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/esm/Alert/Alert.d.ts +2 -2
  4. package/build/esm/Alert/Alert.js +8 -8
  5. package/build/esm/Alert/Alert.js.map +1 -1
  6. package/build/esm/Alert/index.d.ts +0 -0
  7. package/build/esm/Alert/index.js.map +0 -0
  8. package/build/esm/AppBar/AppBar.d.ts +3 -3
  9. package/build/esm/AppBar/AppBar.js +24 -16
  10. package/build/esm/AppBar/AppBar.js.map +1 -1
  11. package/build/esm/AppBar/AppBarButton.d.ts +2 -2
  12. package/build/esm/AppBar/AppBarButton.js +8 -9
  13. package/build/esm/AppBar/AppBarButton.js.map +1 -1
  14. package/build/esm/AppBar/context.d.ts +1 -1
  15. package/build/esm/AppBar/context.js +6 -5
  16. package/build/esm/AppBar/context.js.map +1 -1
  17. package/build/esm/AppBar/index.d.ts +0 -0
  18. package/build/esm/AppBar/index.js.map +0 -0
  19. package/build/esm/Badge/Badge.d.ts +2 -2
  20. package/build/esm/Badge/Badge.js +2 -2
  21. package/build/esm/Badge/Badge.js.map +1 -1
  22. package/build/esm/Badge/index.d.ts +0 -0
  23. package/build/esm/Badge/index.js.map +0 -0
  24. package/build/esm/BaseLine/BaseLine.d.ts +0 -0
  25. package/build/esm/BaseLine/BaseLine.js +4 -4
  26. package/build/esm/BaseLine/BaseLine.js.map +1 -1
  27. package/build/esm/BaseLine/index.d.ts +0 -0
  28. package/build/esm/BaseLine/index.js.map +0 -0
  29. package/build/esm/BottomSheet/BottomSheet.d.ts +2 -2
  30. package/build/esm/BottomSheet/BottomSheet.js +11 -13
  31. package/build/esm/BottomSheet/BottomSheet.js.map +1 -1
  32. package/build/esm/BottomSheet/BottomSheetSurface.d.ts +4 -4
  33. package/build/esm/BottomSheet/BottomSheetSurface.js +9 -9
  34. package/build/esm/BottomSheet/BottomSheetSurface.js.map +1 -1
  35. package/build/esm/BottomSheet/index.d.ts +0 -0
  36. package/build/esm/BottomSheet/index.js.map +0 -0
  37. package/build/esm/Box/Box.d.ts +5 -5
  38. package/build/esm/Box/Box.js +27 -19
  39. package/build/esm/Box/Box.js.map +1 -1
  40. package/build/esm/Box/index.d.ts +0 -0
  41. package/build/esm/Box/index.js.map +0 -0
  42. package/build/esm/Button/BaseButton.d.ts +3 -3
  43. package/build/esm/Button/BaseButton.js +11 -12
  44. package/build/esm/Button/BaseButton.js.map +1 -1
  45. package/build/esm/Button/Button.d.ts +3 -3
  46. package/build/esm/Button/Button.js +27 -22
  47. package/build/esm/Button/Button.js.map +1 -1
  48. package/build/esm/Button/ButtonGroup.d.ts +3 -3
  49. package/build/esm/Button/ButtonGroup.js +15 -12
  50. package/build/esm/Button/ButtonGroup.js.map +1 -1
  51. package/build/esm/Button/FilledButton.d.ts +2 -2
  52. package/build/esm/Button/FilledButton.js +57 -49
  53. package/build/esm/Button/FilledButton.js.map +1 -1
  54. package/build/esm/Button/FloatingActionButton.d.ts +1 -1
  55. package/build/esm/Button/FloatingActionButton.js.map +1 -1
  56. package/build/esm/Button/IconButton.d.ts +1 -1
  57. package/build/esm/Button/IconButton.js.map +1 -1
  58. package/build/esm/Button/OutlinedButton.d.ts +1 -1
  59. package/build/esm/Button/OutlinedButton.js +27 -25
  60. package/build/esm/Button/OutlinedButton.js.map +1 -1
  61. package/build/esm/Button/TransparentButton.d.ts +2 -2
  62. package/build/esm/Button/TransparentButton.js +45 -41
  63. package/build/esm/Button/TransparentButton.js.map +1 -1
  64. package/build/esm/Button/context.js +4 -2
  65. package/build/esm/Button/context.js.map +1 -1
  66. package/build/esm/Button/index.d.ts +0 -0
  67. package/build/esm/Button/index.js.map +0 -0
  68. package/build/esm/CheckBox/CheckBox.d.ts +3 -3
  69. package/build/esm/CheckBox/CheckBox.js +42 -35
  70. package/build/esm/CheckBox/CheckBox.js.map +1 -1
  71. package/build/esm/CheckBox/CheckBoxIcon.d.ts +3 -3
  72. package/build/esm/CheckBox/CheckBoxIcon.js +15 -13
  73. package/build/esm/CheckBox/CheckBoxIcon.js.map +1 -1
  74. package/build/esm/CheckBox/CheckPath.d.ts +0 -0
  75. package/build/esm/CheckBox/CheckPath.js +15 -14
  76. package/build/esm/CheckBox/CheckPath.js.map +1 -1
  77. package/build/esm/CheckBox/IndeterminatePath.d.ts +0 -0
  78. package/build/esm/CheckBox/IndeterminatePath.js +14 -13
  79. package/build/esm/CheckBox/IndeterminatePath.js.map +1 -1
  80. package/build/esm/CheckBox/index.d.ts +0 -0
  81. package/build/esm/CheckBox/index.js.map +0 -0
  82. package/build/esm/Chip/ButtonChip.d.ts +3 -3
  83. package/build/esm/Chip/ButtonChip.js +15 -15
  84. package/build/esm/Chip/ButtonChip.js.map +1 -1
  85. package/build/esm/Chip/Chip.d.ts +0 -0
  86. package/build/esm/Chip/Chip.js.map +0 -0
  87. package/build/esm/Chip/ChipBase.d.ts +3 -3
  88. package/build/esm/Chip/ChipBase.js +24 -19
  89. package/build/esm/Chip/ChipBase.js.map +1 -1
  90. package/build/esm/Chip/ChoiceChip.d.ts +3 -3
  91. package/build/esm/Chip/ChoiceChip.js +25 -26
  92. package/build/esm/Chip/ChoiceChip.js.map +1 -1
  93. package/build/esm/Chip/index.d.ts +0 -0
  94. package/build/esm/Chip/index.js.map +0 -0
  95. package/build/esm/ColorMode/ColorModeProvider.d.ts +1 -1
  96. package/build/esm/ColorMode/ColorModeProvider.js +32 -19
  97. package/build/esm/ColorMode/ColorModeProvider.js.map +1 -1
  98. package/build/esm/ColorMode/color-mode.d.ts +0 -0
  99. package/build/esm/ColorMode/color-mode.js +3 -3
  100. package/build/esm/ColorMode/color-mode.js.map +1 -1
  101. package/build/esm/ColorMode/color-vars.d.ts +0 -0
  102. package/build/esm/ColorMode/color-vars.js +20 -12
  103. package/build/esm/ColorMode/color-vars.js.map +1 -1
  104. package/build/esm/ColorMode/constants.d.ts +0 -0
  105. package/build/esm/ColorMode/constants.js +3 -3
  106. package/build/esm/ColorMode/constants.js.map +1 -1
  107. package/build/esm/ColorMode/index.d.ts +0 -0
  108. package/build/esm/ColorMode/index.js.map +0 -0
  109. package/build/esm/Combobox/Combobox.d.ts +15 -15
  110. package/build/esm/Combobox/Combobox.js +50 -56
  111. package/build/esm/Combobox/Combobox.js.map +1 -1
  112. package/build/esm/Combobox/index.d.ts +0 -0
  113. package/build/esm/Combobox/index.js.map +0 -0
  114. package/build/esm/Dialog/Dialog.d.ts +5 -5
  115. package/build/esm/Dialog/Dialog.js +22 -23
  116. package/build/esm/Dialog/Dialog.js.map +1 -1
  117. package/build/esm/Dialog/DialogBackdrop.d.ts +4 -4
  118. package/build/esm/Dialog/DialogBackdrop.js +10 -11
  119. package/build/esm/Dialog/DialogBackdrop.js.map +1 -1
  120. package/build/esm/Dialog/DialogContainer.d.ts +2 -2
  121. package/build/esm/Dialog/DialogContainer.js +4 -6
  122. package/build/esm/Dialog/DialogContainer.js.map +1 -1
  123. package/build/esm/Dialog/DialogSurface.d.ts +4 -4
  124. package/build/esm/Dialog/DialogSurface.js +14 -14
  125. package/build/esm/Dialog/DialogSurface.js.map +1 -1
  126. package/build/esm/Dialog/Scrim.d.ts +2 -2
  127. package/build/esm/Dialog/Scrim.js +4 -6
  128. package/build/esm/Dialog/Scrim.js.map +1 -1
  129. package/build/esm/Dialog/index.d.ts +0 -0
  130. package/build/esm/Dialog/index.js.map +0 -0
  131. package/build/esm/Dialog/useDialogAnimation.d.ts +0 -0
  132. package/build/esm/Dialog/useDialogAnimation.js +19 -20
  133. package/build/esm/Dialog/useDialogAnimation.js.map +1 -1
  134. package/build/esm/Divider/Divider.d.ts +3 -3
  135. package/build/esm/Divider/Divider.js +9 -8
  136. package/build/esm/Divider/Divider.js.map +1 -1
  137. package/build/esm/Divider/index.d.ts +0 -0
  138. package/build/esm/Divider/index.js.map +0 -0
  139. package/build/esm/FloatingLabel/FloatingLabel.d.ts +1 -1
  140. package/build/esm/FloatingLabel/FloatingLabel.js +26 -22
  141. package/build/esm/FloatingLabel/FloatingLabel.js.map +1 -1
  142. package/build/esm/FloatingLabel/index.d.ts +0 -0
  143. package/build/esm/FloatingLabel/index.js.map +0 -0
  144. package/build/esm/LineRipple/LineRipple.d.ts +3 -3
  145. package/build/esm/LineRipple/LineRipple.js +27 -18
  146. package/build/esm/LineRipple/LineRipple.js.map +1 -1
  147. package/build/esm/LineRipple/index.d.ts +0 -0
  148. package/build/esm/LineRipple/index.js.map +0 -0
  149. package/build/esm/Link/Link.d.ts +3 -3
  150. package/build/esm/Link/Link.js +10 -9
  151. package/build/esm/Link/Link.js.map +1 -1
  152. package/build/esm/Link/index.d.ts +0 -0
  153. package/build/esm/Link/index.js.map +0 -0
  154. package/build/esm/List/List.d.ts +3 -3
  155. package/build/esm/List/List.js +20 -13
  156. package/build/esm/List/List.js.map +1 -1
  157. package/build/esm/List/index.d.ts +0 -0
  158. package/build/esm/List/index.js.map +0 -0
  159. package/build/esm/ListItem/ListItem.d.ts +3 -3
  160. package/build/esm/ListItem/ListItem.js +25 -21
  161. package/build/esm/ListItem/ListItem.js.map +1 -1
  162. package/build/esm/ListItem/ListItemText.d.ts +1 -1
  163. package/build/esm/ListItem/ListItemText.js +8 -8
  164. package/build/esm/ListItem/ListItemText.js.map +1 -1
  165. package/build/esm/ListItem/context.d.ts +0 -0
  166. package/build/esm/ListItem/context.js.map +0 -0
  167. package/build/esm/ListItem/index.d.ts +0 -0
  168. package/build/esm/ListItem/index.js.map +0 -0
  169. package/build/esm/Menu/Menu.d.ts +10 -10
  170. package/build/esm/Menu/Menu.js +22 -25
  171. package/build/esm/Menu/Menu.js.map +1 -1
  172. package/build/esm/Menu/animation.d.ts +1 -1
  173. package/build/esm/Menu/animation.js +1 -1
  174. package/build/esm/Menu/animation.js.map +1 -1
  175. package/build/esm/Menu/index.d.ts +0 -0
  176. package/build/esm/Menu/index.js.map +0 -0
  177. package/build/esm/NotchedOutline/NotchedOutline.d.ts +1 -1
  178. package/build/esm/NotchedOutline/NotchedOutline.js +25 -21
  179. package/build/esm/NotchedOutline/NotchedOutline.js.map +1 -1
  180. package/build/esm/NotchedOutline/context.d.ts +0 -0
  181. package/build/esm/NotchedOutline/context.js +6 -5
  182. package/build/esm/NotchedOutline/context.js.map +1 -1
  183. package/build/esm/NotchedOutline/index.d.ts +0 -0
  184. package/build/esm/NotchedOutline/index.js.map +0 -0
  185. package/build/esm/NotchedOutline/styledComponents.d.ts +0 -0
  186. package/build/esm/NotchedOutline/styledComponents.js +53 -58
  187. package/build/esm/NotchedOutline/styledComponents.js.map +1 -1
  188. package/build/esm/Paper/Paper.d.ts +4 -3
  189. package/build/esm/Paper/Paper.js +15 -13
  190. package/build/esm/Paper/Paper.js.map +1 -1
  191. package/build/esm/Paper/index.d.ts +0 -0
  192. package/build/esm/Paper/index.js.map +0 -0
  193. package/build/esm/ProgressSpinner/ProgressSpinner.d.ts +2 -2
  194. package/build/esm/ProgressSpinner/ProgressSpinner.js +16 -16
  195. package/build/esm/ProgressSpinner/ProgressSpinner.js.map +1 -1
  196. package/build/esm/ProgressSpinner/index.d.ts +0 -0
  197. package/build/esm/ProgressSpinner/index.js.map +0 -0
  198. package/build/esm/RadioButton/RadioButton.d.ts +1 -1
  199. package/build/esm/RadioButton/RadioButton.js +16 -19
  200. package/build/esm/RadioButton/RadioButton.js.map +1 -1
  201. package/build/esm/RadioButton/RadioButtonIcon.d.ts +1 -1
  202. package/build/esm/RadioButton/RadioButtonIcon.js +5 -6
  203. package/build/esm/RadioButton/RadioButtonIcon.js.map +1 -1
  204. package/build/esm/RadioButton/RadioGroup.d.ts +3 -3
  205. package/build/esm/RadioButton/RadioGroup.js +5 -4
  206. package/build/esm/RadioButton/RadioGroup.js.map +1 -1
  207. package/build/esm/RadioButton/index.d.ts +0 -0
  208. package/build/esm/RadioButton/index.js.map +0 -0
  209. package/build/esm/Ripple/Ripple.d.ts +1 -1
  210. package/build/esm/Ripple/Ripple.js +21 -20
  211. package/build/esm/Ripple/Ripple.js.map +1 -1
  212. package/build/esm/Ripple/RippleBox.d.ts +4 -4
  213. package/build/esm/Ripple/RippleBox.js +22 -15
  214. package/build/esm/Ripple/RippleBox.js.map +1 -1
  215. package/build/esm/Ripple/constants.d.ts +0 -0
  216. package/build/esm/Ripple/constants.js +7 -7
  217. package/build/esm/Ripple/constants.js.map +1 -1
  218. package/build/esm/Ripple/index.d.ts +0 -0
  219. package/build/esm/Ripple/index.js.map +0 -0
  220. package/build/esm/Ripple/keyframes.d.ts +1 -1
  221. package/build/esm/Ripple/keyframes.js +3 -3
  222. package/build/esm/Ripple/keyframes.js.map +1 -1
  223. package/build/esm/Ripple/useRipple.d.ts +0 -0
  224. package/build/esm/Ripple/useRipple.js +55 -48
  225. package/build/esm/Ripple/useRipple.js.map +1 -1
  226. package/build/esm/Ripple/useRippleHandlers.d.ts +1 -1
  227. package/build/esm/Ripple/useRippleHandlers.js +13 -15
  228. package/build/esm/Ripple/useRippleHandlers.js.map +1 -1
  229. package/build/esm/Ripple/useRippleSurface.d.ts +1 -1
  230. package/build/esm/Ripple/useRippleSurface.js +39 -38
  231. package/build/esm/Ripple/useRippleSurface.js.map +1 -1
  232. package/build/esm/Select/Select.d.ts +4 -4
  233. package/build/esm/Select/Select.js +69 -47
  234. package/build/esm/Select/Select.js.map +1 -1
  235. package/build/esm/Select/SelectIcon.d.ts +3 -3
  236. package/build/esm/Select/SelectIcon.js +6 -7
  237. package/build/esm/Select/SelectIcon.js.map +1 -1
  238. package/build/esm/Select/context.d.ts +0 -0
  239. package/build/esm/Select/context.js +7 -6
  240. package/build/esm/Select/context.js.map +1 -1
  241. package/build/esm/Select/defaultRender.d.ts +0 -0
  242. package/build/esm/Select/defaultRender.js +12 -10
  243. package/build/esm/Select/defaultRender.js.map +1 -1
  244. package/build/esm/Select/index.d.ts +0 -0
  245. package/build/esm/Select/index.js.map +0 -0
  246. package/build/esm/Select/styledComponents.d.ts +2 -2
  247. package/build/esm/Select/styledComponents.js +16 -19
  248. package/build/esm/Select/styledComponents.js.map +1 -1
  249. package/build/esm/SelectItem/SelectItem.d.ts +2 -2
  250. package/build/esm/SelectItem/SelectItem.js +18 -19
  251. package/build/esm/SelectItem/SelectItem.js.map +1 -1
  252. package/build/esm/SelectItem/index.d.ts +0 -0
  253. package/build/esm/SelectItem/index.js.map +0 -0
  254. package/build/esm/SelectionControl/SelectionControlLabel.d.ts +3 -3
  255. package/build/esm/SelectionControl/SelectionControlLabel.js +7 -7
  256. package/build/esm/SelectionControl/SelectionControlLabel.js.map +1 -1
  257. package/build/esm/SelectionControl/SelectionControlText.d.ts +3 -3
  258. package/build/esm/SelectionControl/SelectionControlText.js +8 -8
  259. package/build/esm/SelectionControl/SelectionControlText.js.map +1 -1
  260. package/build/esm/SelectionControl/index.d.ts +0 -0
  261. package/build/esm/SelectionControl/index.js.map +0 -0
  262. package/build/esm/Skeleton/DelayAppearance.d.ts +4 -4
  263. package/build/esm/Skeleton/DelayAppearance.js +9 -9
  264. package/build/esm/Skeleton/DelayAppearance.js.map +1 -1
  265. package/build/esm/Skeleton/Skeleton.d.ts +3 -3
  266. package/build/esm/Skeleton/Skeleton.js +11 -10
  267. package/build/esm/Skeleton/Skeleton.js.map +1 -1
  268. package/build/esm/Skeleton/animation.d.ts +2 -2
  269. package/build/esm/Skeleton/animation.js +25 -22
  270. package/build/esm/Skeleton/animation.js.map +1 -1
  271. package/build/esm/Skeleton/index.d.ts +0 -0
  272. package/build/esm/Skeleton/index.js.map +0 -0
  273. package/build/esm/Snackbar/Snackbar.d.ts +3 -3
  274. package/build/esm/Snackbar/Snackbar.js +21 -21
  275. package/build/esm/Snackbar/Snackbar.js.map +1 -1
  276. package/build/esm/Snackbar/Stack.d.ts +2 -3
  277. package/build/esm/Snackbar/Stack.js +78 -65
  278. package/build/esm/Snackbar/Stack.js.map +1 -1
  279. package/build/esm/Snackbar/index.d.ts +0 -0
  280. package/build/esm/Snackbar/index.js.map +0 -0
  281. package/build/esm/Snackbar/useSnackbarAnimation.d.ts +1 -1
  282. package/build/esm/Snackbar/useSnackbarAnimation.js +113 -78
  283. package/build/esm/Snackbar/useSnackbarAnimation.js.map +1 -1
  284. package/build/esm/Switch/Switch.d.ts +3 -3
  285. package/build/esm/Switch/Switch.js +21 -22
  286. package/build/esm/Switch/Switch.js.map +1 -1
  287. package/build/esm/Switch/index.d.ts +0 -0
  288. package/build/esm/Switch/index.js.map +0 -0
  289. package/build/esm/Switch/styledComponents.d.ts +0 -0
  290. package/build/esm/Switch/styledComponents.js +23 -25
  291. package/build/esm/Switch/styledComponents.js.map +1 -1
  292. package/build/esm/Tab/Tab.d.ts +4 -4
  293. package/build/esm/Tab/Tab.js +17 -19
  294. package/build/esm/Tab/Tab.js.map +1 -1
  295. package/build/esm/Tab/TabList.d.ts +3 -3
  296. package/build/esm/Tab/TabList.js +18 -19
  297. package/build/esm/Tab/TabList.js.map +1 -1
  298. package/build/esm/Tab/TabPanel.d.ts +3 -3
  299. package/build/esm/Tab/TabPanel.js +8 -11
  300. package/build/esm/Tab/TabPanel.js.map +1 -1
  301. package/build/esm/Tab/TabPanels.d.ts +0 -0
  302. package/build/esm/Tab/TabPanels.js.map +0 -0
  303. package/build/esm/Tab/Tabs.d.ts +0 -0
  304. package/build/esm/Tab/Tabs.js.map +0 -0
  305. package/build/esm/Tab/context.d.ts +0 -0
  306. package/build/esm/Tab/context.js +6 -5
  307. package/build/esm/Tab/context.js.map +1 -1
  308. package/build/esm/Tab/index.d.ts +0 -0
  309. package/build/esm/Tab/index.js.map +0 -0
  310. package/build/esm/TabIndicator/TabIndicator.d.ts +2 -2
  311. package/build/esm/TabIndicator/TabIndicator.js +22 -21
  312. package/build/esm/TabIndicator/TabIndicator.js.map +1 -1
  313. package/build/esm/TabIndicator/context.d.ts +0 -0
  314. package/build/esm/TabIndicator/context.js +6 -5
  315. package/build/esm/TabIndicator/context.js.map +1 -1
  316. package/build/esm/TabIndicator/index.d.ts +0 -0
  317. package/build/esm/TabIndicator/index.js.map +0 -0
  318. package/build/esm/Table/Table.d.ts +2 -2
  319. package/build/esm/Table/Table.js +8 -8
  320. package/build/esm/Table/Table.js.map +1 -1
  321. package/build/esm/Table/TableBody.d.ts +2 -2
  322. package/build/esm/Table/TableBody.js +4 -6
  323. package/build/esm/Table/TableBody.js.map +1 -1
  324. package/build/esm/Table/TableCell.d.ts +2 -2
  325. package/build/esm/Table/TableCell.js +6 -8
  326. package/build/esm/Table/TableCell.js.map +1 -1
  327. package/build/esm/Table/TableHead.d.ts +2 -2
  328. package/build/esm/Table/TableHead.js +5 -7
  329. package/build/esm/Table/TableHead.js.map +1 -1
  330. package/build/esm/Table/TableRow.d.ts +2 -2
  331. package/build/esm/Table/TableRow.js +5 -7
  332. package/build/esm/Table/TableRow.js.map +1 -1
  333. package/build/esm/Table/context.d.ts +0 -0
  334. package/build/esm/Table/context.js +6 -5
  335. package/build/esm/Table/context.js.map +1 -1
  336. package/build/esm/Table/index.d.ts +0 -0
  337. package/build/esm/Table/index.js.map +0 -0
  338. package/build/esm/Text/LoremIpsum.d.ts +1 -1
  339. package/build/esm/Text/LoremIpsum.js +6 -6
  340. package/build/esm/Text/LoremIpsum.js.map +1 -1
  341. package/build/esm/Text/Text.d.ts +3 -3
  342. package/build/esm/Text/Text.js +9 -9
  343. package/build/esm/Text/Text.js.map +1 -1
  344. package/build/esm/Text/index.d.ts +0 -0
  345. package/build/esm/Text/index.js.map +0 -0
  346. package/build/esm/TextField/FilledContainer.d.ts +3 -3
  347. package/build/esm/TextField/FilledContainer.js +56 -53
  348. package/build/esm/TextField/FilledContainer.js.map +1 -1
  349. package/build/esm/TextField/HelperText.d.ts +3 -3
  350. package/build/esm/TextField/HelperText.js +14 -13
  351. package/build/esm/TextField/HelperText.js.map +1 -1
  352. package/build/esm/TextField/IconContainer.d.ts +2 -2
  353. package/build/esm/TextField/IconContainer.js +15 -23
  354. package/build/esm/TextField/IconContainer.js.map +1 -1
  355. package/build/esm/TextField/Input.d.ts +3 -3
  356. package/build/esm/TextField/Input.js +13 -13
  357. package/build/esm/TextField/Input.js.map +1 -1
  358. package/build/esm/TextField/OutlinedContainer.d.ts +4 -4
  359. package/build/esm/TextField/OutlinedContainer.js +28 -22
  360. package/build/esm/TextField/OutlinedContainer.js.map +1 -1
  361. package/build/esm/TextField/TextField.d.ts +4 -4
  362. package/build/esm/TextField/TextField.js +59 -41
  363. package/build/esm/TextField/TextField.js.map +1 -1
  364. package/build/esm/TextField/consts.js +5 -5
  365. package/build/esm/TextField/consts.js.map +1 -1
  366. package/build/esm/TextField/index.d.ts +0 -0
  367. package/build/esm/TextField/index.js.map +0 -0
  368. package/build/esm/ThemeExplorer/ColorPicker.d.ts +4 -4
  369. package/build/esm/ThemeExplorer/ColorPicker.js +14 -14
  370. package/build/esm/ThemeExplorer/ColorPicker.js.map +1 -1
  371. package/build/esm/ThemeExplorer/TextFieldColorPicker.d.ts +2 -2
  372. package/build/esm/ThemeExplorer/TextFieldColorPicker.js +44 -24
  373. package/build/esm/ThemeExplorer/TextFieldColorPicker.js.map +1 -1
  374. package/build/esm/ThemeExplorer/ThemeColors.d.ts +1 -1
  375. package/build/esm/ThemeExplorer/ThemeColors.js +3 -3
  376. package/build/esm/ThemeExplorer/ThemeColors.js.map +1 -1
  377. package/build/esm/ThemeExplorer/components.d.ts +2 -1
  378. package/build/esm/ThemeExplorer/components.js +64 -56
  379. package/build/esm/ThemeExplorer/components.js.map +1 -1
  380. package/build/esm/ThemeExplorer/makeColorScheme.d.ts +1 -1
  381. package/build/esm/ThemeExplorer/makeColorScheme.js.map +1 -1
  382. package/build/esm/ThemeExplorer/useDeferredColor.d.ts +1 -1
  383. package/build/esm/ThemeExplorer/useDeferredColor.js +10 -3
  384. package/build/esm/ThemeExplorer/useDeferredColor.js.map +1 -1
  385. package/build/esm/ThemeExplorer/useLocalStorageCachedState.js +9 -2
  386. package/build/esm/ThemeExplorer/useLocalStorageCachedState.js.map +1 -1
  387. package/build/esm/Tooltip/Tooltip.d.ts +3 -3
  388. package/build/esm/Tooltip/Tooltip.js +7 -8
  389. package/build/esm/Tooltip/Tooltip.js.map +1 -1
  390. package/build/esm/Tooltip/index.d.ts +0 -0
  391. package/build/esm/Tooltip/index.js.map +0 -0
  392. package/build/esm/color.d.ts +3 -3
  393. package/build/esm/color.js +19 -13
  394. package/build/esm/color.js.map +1 -1
  395. package/build/esm/css.d.ts +0 -0
  396. package/build/esm/css.js.map +0 -0
  397. package/build/esm/hooks/useAnimation.d.ts +1 -1
  398. package/build/esm/hooks/useAnimation.js +54 -41
  399. package/build/esm/hooks/useAnimation.js.map +1 -1
  400. package/build/esm/index.d.ts +0 -0
  401. package/build/esm/index.js.map +0 -0
  402. package/build/esm/theme/index.d.ts +0 -0
  403. package/build/esm/theme/index.js.map +0 -0
  404. package/build/esm/theme/theme.d.ts +0 -0
  405. package/build/esm/theme/theme.js +1 -1
  406. package/build/esm/theme/theme.js.map +1 -1
  407. package/build/esm/theme/typography-raleway.d.ts +0 -0
  408. package/build/esm/theme/typography-raleway.js +1 -1
  409. package/build/esm/theme/typography-raleway.js.map +1 -1
  410. package/build/esm/theme/typography-roboto.d.ts +0 -0
  411. package/build/esm/theme/typography-roboto.js +1 -1
  412. package/build/esm/theme/typography-roboto.js.map +1 -1
  413. package/build/esm/theme/useTheme.d.ts +2 -472
  414. package/build/esm/theme/useTheme.js +1 -1
  415. package/build/esm/theme/useTheme.js.map +1 -1
  416. package/build/tsconfig.tsbuildinfo +1 -1
  417. package/package.json +6 -5
  418. package/src/Alert/Alert.tsx +3 -1
  419. package/src/AppBar/AppBar.story.tsx +7 -6
  420. package/src/AppBar/AppBar.tsx +5 -3
  421. package/src/AppBar/AppBarButton.tsx +3 -1
  422. package/src/AppBar/context.ts +2 -1
  423. package/src/Badge/Badge.tsx +3 -1
  424. package/src/BaseLine/BaseLine.tsx +15 -11
  425. package/src/BottomSheet/BottomSheet.story.tsx +1 -0
  426. package/src/BottomSheet/BottomSheet.tsx +2 -1
  427. package/src/BottomSheet/BottomSheetSurface.tsx +9 -5
  428. package/src/Box/Box.tsx +21 -18
  429. package/src/Button/BaseButton.tsx +4 -2
  430. package/src/Button/Button.story.tsx +16 -3
  431. package/src/Button/Button.tsx +3 -2
  432. package/src/Button/ButtonGroup.tsx +4 -2
  433. package/src/Button/FilledButton.tsx +3 -2
  434. package/src/Button/FloatingActionButton.tsx +1 -1
  435. package/src/Button/IconButton.tsx +1 -1
  436. package/src/Button/OutlinedButton.tsx +3 -2
  437. package/src/Button/SpinnerButton.story.tsx +9 -10
  438. package/src/Button/TransparentButton.tsx +4 -4
  439. package/src/Button/context.tsx +1 -0
  440. package/src/CheckBox/CheckBox.story.tsx +3 -2
  441. package/src/CheckBox/CheckBox.tsx +9 -5
  442. package/src/CheckBox/CheckBoxIcon.tsx +4 -2
  443. package/src/Chip/ButtonChip.tsx +6 -4
  444. package/src/Chip/Chip.story.tsx +0 -1
  445. package/src/Chip/ChipBase.tsx +7 -5
  446. package/src/Chip/ChoiceChip.tsx +10 -7
  447. package/src/ColorMode/ColorModeProvider.tsx +4 -2
  448. package/src/Combobox/Combobox.story.tsx +2 -1
  449. package/src/Combobox/Combobox.tsx +29 -17
  450. package/src/Dialog/Dialog.story.tsx +3 -1
  451. package/src/Dialog/Dialog.tsx +9 -4
  452. package/src/Dialog/DialogBackdrop.tsx +6 -6
  453. package/src/Dialog/DialogContainer.tsx +3 -1
  454. package/src/Dialog/DialogSurface.tsx +8 -6
  455. package/src/Dialog/Scrim.tsx +3 -1
  456. package/src/Divider/Divider.tsx +4 -2
  457. package/src/FloatingLabel/FloatingLabel.story.tsx +1 -0
  458. package/src/FloatingLabel/FloatingLabel.tsx +3 -2
  459. package/src/LineRipple/LineRipple.story.tsx +1 -0
  460. package/src/LineRipple/LineRipple.tsx +6 -3
  461. package/src/Link/Link.tsx +4 -2
  462. package/src/List/List.tsx +5 -2
  463. package/src/ListItem/ListItem.story.tsx +1 -0
  464. package/src/ListItem/ListItem.tsx +6 -3
  465. package/src/ListItem/ListItemText.tsx +2 -1
  466. package/src/Menu/Menu.tsx +20 -12
  467. package/src/Menu/animation.ts +1 -1
  468. package/src/NotchedOutline/NotchedOutline.story.tsx +2 -1
  469. package/src/NotchedOutline/NotchedOutline.tsx +2 -1
  470. package/src/NotchedOutline/styledComponents.ts +3 -2
  471. package/src/Paper/Paper.story.tsx +2 -1
  472. package/src/Paper/Paper.tsx +22 -9
  473. package/src/ProgressSpinner/ProgressSpinner.story.tsx +1 -0
  474. package/src/ProgressSpinner/ProgressSpinner.tsx +5 -2
  475. package/src/RadioButton/RadioButton.story.tsx +2 -1
  476. package/src/RadioButton/RadioButton.tsx +9 -7
  477. package/src/RadioButton/RadioButtonIcon.tsx +2 -1
  478. package/src/RadioButton/RadioGroup.tsx +5 -5
  479. package/src/Ripple/Ripple.story.tsx +8 -2
  480. package/src/Ripple/Ripple.tsx +2 -1
  481. package/src/Ripple/RippleBox.tsx +8 -4
  482. package/src/Ripple/keyframes.ts +2 -1
  483. package/src/Ripple/useRipple.ts +1 -0
  484. package/src/Ripple/useRippleHandlers.ts +3 -1
  485. package/src/Ripple/useRippleSurface.ts +9 -7
  486. package/src/Select/PaymentMethodSelect.story.tsx +3 -1
  487. package/src/Select/Select.story.tsx +1 -0
  488. package/src/Select/Select.tsx +6 -4
  489. package/src/Select/SelectIcon.tsx +6 -3
  490. package/src/Select/defaultRender.ts +13 -13
  491. package/src/Select/styledComponents.tsx +5 -3
  492. package/src/SelectItem/SelectItem.tsx +4 -2
  493. package/src/SelectionControl/SelectionControlLabel.tsx +6 -3
  494. package/src/SelectionControl/SelectionControlText.tsx +4 -2
  495. package/src/Skeleton/DelayAppearance.tsx +5 -3
  496. package/src/Skeleton/Skeleton.tsx +4 -2
  497. package/src/Skeleton/animation.ts +3 -2
  498. package/src/Snackbar/Snackbar.story.tsx +1 -0
  499. package/src/Snackbar/Snackbar.tsx +5 -3
  500. package/src/Snackbar/Stack.tsx +3 -3
  501. package/src/Snackbar/useSnackbarAnimation.ts +3 -1
  502. package/src/Switch/Switch.tsx +9 -5
  503. package/src/Switch/styledComponents.tsx +14 -11
  504. package/src/Tab/Tab.tsx +8 -4
  505. package/src/Tab/TabList.tsx +5 -5
  506. package/src/Tab/TabPanel.tsx +5 -5
  507. package/src/TabIndicator/TabIndicator.tsx +6 -3
  508. package/src/Table/Table.tsx +4 -1
  509. package/src/Table/TableBody.tsx +3 -1
  510. package/src/Table/TableCell.tsx +3 -1
  511. package/src/Table/TableHead.tsx +4 -2
  512. package/src/Table/TableRow.tsx +4 -2
  513. package/src/Text/LoremIpsum.tsx +2 -1
  514. package/src/Text/Text.tsx +4 -2
  515. package/src/TextField/FilledContainer.tsx +5 -3
  516. package/src/TextField/HelperText.tsx +3 -2
  517. package/src/TextField/IconContainer.tsx +3 -2
  518. package/src/TextField/Input.tsx +5 -3
  519. package/src/TextField/OutlinedContainer.tsx +5 -3
  520. package/src/TextField/TextField.story.tsx +1 -0
  521. package/src/TextField/TextField.tsx +6 -3
  522. package/src/ThemeExplorer/ColorPicker.tsx +19 -16
  523. package/src/ThemeExplorer/TextFieldColorPicker.tsx +5 -2
  524. package/src/ThemeExplorer/ThemeBuilder.story.tsx +8 -12
  525. package/src/ThemeExplorer/ThemeColors.tsx +2 -1
  526. package/src/ThemeExplorer/ThemeExplorer.story.tsx +1 -0
  527. package/src/ThemeExplorer/components.tsx +5 -18
  528. package/src/ThemeExplorer/makeColorScheme.tsx +2 -1
  529. package/src/ThemeExplorer/useDeferredColor.tsx +2 -1
  530. package/src/Tooltip/Tooltip.story.tsx +1 -0
  531. package/src/Tooltip/Tooltip.tsx +8 -4
  532. package/src/color.ts +18 -16
  533. package/src/hooks/useAnimation.ts +2 -1
  534. package/src/theme/useTheme.ts +3 -1
@@ -1,6 +1,6 @@
1
1
  import { keyframes } from '@emotion/react';
2
2
  import { alpha } from '../color';
3
- export const pulseAnimation = keyframes({
3
+ export var pulseAnimation = keyframes({
4
4
  '0%': {
5
5
  opacity: 1
6
6
  },
@@ -11,10 +11,12 @@ export const pulseAnimation = keyframes({
11
11
  opacity: 1
12
12
  }
13
13
  });
14
- export const pulseAnimationStyle = () => ({
15
- animation: "".concat(pulseAnimation, " 1.5s ease-in-out 0.5s infinite")
16
- });
17
- export const waveAnimation = keyframes({
14
+ export var pulseAnimationStyle = function pulseAnimationStyle() {
15
+ return {
16
+ animation: "".concat(pulseAnimation, " 1.5s ease-in-out 0.5s infinite")
17
+ };
18
+ };
19
+ export var waveAnimation = keyframes({
18
20
  '0%': {
19
21
  transform: 'translateX(-100%)'
20
22
  },
@@ -25,21 +27,22 @@ export const waveAnimation = keyframes({
25
27
  transform: 'translateX(100%)'
26
28
  }
27
29
  });
28
- export const waveAnimationStyle = ({
29
- theme
30
- }) => ({
31
- overflow: 'hidden',
32
- position: 'relative',
33
- '&::after': {
34
- position: 'absolute',
35
- content: '""',
36
- top: 0,
37
- left: 0,
38
- right: 0,
39
- bottom: 0,
40
- animation: "".concat(waveAnimation, " 1.6s linear 0.5s infinite"),
41
- transform: 'translateX(-100%)',
42
- background: "linear-gradient(90deg, transparent, ".concat(alpha('on.surface', 0.04)(theme), ", transparent)")
43
- }
44
- });
30
+ export var waveAnimationStyle = function waveAnimationStyle(_ref) {
31
+ var theme = _ref.theme;
32
+ return {
33
+ overflow: 'hidden',
34
+ position: 'relative',
35
+ '&::after': {
36
+ position: 'absolute',
37
+ content: '""',
38
+ top: 0,
39
+ left: 0,
40
+ right: 0,
41
+ bottom: 0,
42
+ animation: "".concat(waveAnimation, " 1.6s linear 0.5s infinite"),
43
+ transform: 'translateX(-100%)',
44
+ background: "linear-gradient(90deg, transparent, ".concat(alpha('on.surface', 0.04)(theme), ", transparent)")
45
+ }
46
+ };
47
+ };
45
48
  //# sourceMappingURL=animation.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Skeleton/animation.ts"],"names":["keyframes","alpha","pulseAnimation","opacity","pulseAnimationStyle","animation","waveAnimation","transform","waveAnimationStyle","theme","overflow","position","content","top","left","right","bottom","background"],"mappings":"AAAA,SAASA,SAAT,QAA0B,gBAA1B;AAGA,SAASC,KAAT,QAAsB,UAAtB;AAEA,OAAO,MAAMC,cAAyB,GAAGF,SAAS,CAAC;AACjD,QAAM;AACJG,IAAAA,OAAO,EAAE;AADL,GAD2C;AAIjD,SAAO;AACLA,IAAAA,OAAO,EAAE;AADJ,GAJ0C;AAOjD,UAAQ;AACNA,IAAAA,OAAO,EAAE;AADH;AAPyC,CAAD,CAA3C;AAYP,OAAO,MAAMC,mBAA4C,GAAG,OAAO;AACjEC,EAAAA,SAAS,YAAKH,cAAL;AADwD,CAAP,CAArD;AAIP,OAAO,MAAMI,aAAwB,GAAGN,SAAS,CAAC;AAChD,QAAM;AACJO,IAAAA,SAAS,EAAE;AADP,GAD0C;AAIhD,SAAO;AACLA,IAAAA,SAAS,EAAE;AADN,GAJyC;AAOhD,UAAQ;AACNA,IAAAA,SAAS,EAAE;AADL;AAPwC,CAAD,CAA1C;AAYP,OAAO,MAAMC,kBAA8D,GAAG,CAAC;AAC7EC,EAAAA;AAD6E,CAAD,MAElE;AACVC,EAAAA,QAAQ,EAAE,QADA;AAEVC,EAAAA,QAAQ,EAAE,UAFA;AAGV,cAAY;AACVA,IAAAA,QAAQ,EAAE,UADA;AAEVC,IAAAA,OAAO,EAAE,IAFC;AAGVC,IAAAA,GAAG,EAAE,CAHK;AAIVC,IAAAA,IAAI,EAAE,CAJI;AAKVC,IAAAA,KAAK,EAAE,CALG;AAMVC,IAAAA,MAAM,EAAE,CANE;AAOVX,IAAAA,SAAS,YAAKC,aAAL,+BAPC;AAQVC,IAAAA,SAAS,EAAE,mBARD;AASVU,IAAAA,UAAU,gDAAyChB,KAAK,CACtD,YADsD,EAEtD,IAFsD,CAAL,CAGjDQ,KAHiD,CAAzC;AATA;AAHF,CAFkE,CAAvE","sourcesContent":["import { keyframes } from '@emotion/react';\nimport { Keyframes } from '@emotion/serialize';\nimport { SystemStyleObject } from '@styled-system/css';\nimport { alpha } from '../color';\n\nexport const pulseAnimation: Keyframes = keyframes({\n '0%': {\n opacity: 1,\n },\n '50%': {\n opacity: 0.4,\n },\n '100%': {\n opacity: 1,\n },\n});\n\nexport const pulseAnimationStyle: () => SystemStyleObject = () => ({\n animation: `${pulseAnimation} 1.5s ease-in-out 0.5s infinite`,\n});\n\nexport const waveAnimation: Keyframes = keyframes({\n '0%': {\n transform: 'translateX(-100%)',\n },\n '60%': {\n transform: 'translateX(100%)',\n },\n '100%': {\n transform: 'translateX(100%)',\n },\n});\n\nexport const waveAnimationStyle: (obj: { theme: any }) => SystemStyleObject = ({\n theme,\n}: any) => ({\n overflow: 'hidden',\n position: 'relative',\n '&::after': {\n position: 'absolute',\n content: '\"\"',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n animation: `${waveAnimation} 1.6s linear 0.5s infinite`,\n transform: 'translateX(-100%)',\n background: `linear-gradient(90deg, transparent, ${alpha(\n 'on.surface',\n 0.04\n )(theme)}, transparent)`,\n },\n});\n"],"file":"animation.js"}
1
+ {"version":3,"sources":["../../../src/Skeleton/animation.ts"],"names":["keyframes","alpha","pulseAnimation","opacity","pulseAnimationStyle","animation","waveAnimation","transform","waveAnimationStyle","theme","overflow","position","content","top","left","right","bottom","background"],"mappings":"AAAA,SAASA,SAAT,QAA0B,gBAA1B;AAIA,SAASC,KAAT,QAAsB,UAAtB;AAEA,OAAO,IAAMC,cAAyB,GAAGF,SAAS,CAAC;AACjD,QAAM;AACJG,IAAAA,OAAO,EAAE;AADL,GAD2C;AAIjD,SAAO;AACLA,IAAAA,OAAO,EAAE;AADJ,GAJ0C;AAOjD,UAAQ;AACNA,IAAAA,OAAO,EAAE;AADH;AAPyC,CAAD,CAA3C;AAYP,OAAO,IAAMC,mBAA4C,GAAG,SAA/CA,mBAA+C;AAAA,SAAO;AACjEC,IAAAA,SAAS,YAAKH,cAAL;AADwD,GAAP;AAAA,CAArD;AAIP,OAAO,IAAMI,aAAwB,GAAGN,SAAS,CAAC;AAChD,QAAM;AACJO,IAAAA,SAAS,EAAE;AADP,GAD0C;AAIhD,SAAO;AACLA,IAAAA,SAAS,EAAE;AADN,GAJyC;AAOhD,UAAQ;AACNA,IAAAA,SAAS,EAAE;AADL;AAPwC,CAAD,CAA1C;AAYP,OAAO,IAAMC,kBAA8D,GAAG,SAAjEA,kBAAiE;AAAA,MAC5EC,KAD4E,QAC5EA,KAD4E;AAAA,SAElE;AACVC,IAAAA,QAAQ,EAAE,QADA;AAEVC,IAAAA,QAAQ,EAAE,UAFA;AAGV,gBAAY;AACVA,MAAAA,QAAQ,EAAE,UADA;AAEVC,MAAAA,OAAO,EAAE,IAFC;AAGVC,MAAAA,GAAG,EAAE,CAHK;AAIVC,MAAAA,IAAI,EAAE,CAJI;AAKVC,MAAAA,KAAK,EAAE,CALG;AAMVC,MAAAA,MAAM,EAAE,CANE;AAOVX,MAAAA,SAAS,YAAKC,aAAL,+BAPC;AAQVC,MAAAA,SAAS,EAAE,mBARD;AASVU,MAAAA,UAAU,gDAAyChB,KAAK,CACtD,YADsD,EAEtD,IAFsD,CAAL,CAGjDQ,KAHiD,CAAzC;AATA;AAHF,GAFkE;AAAA,CAAvE","sourcesContent":["import { keyframes } from '@emotion/react';\nimport type { Keyframes } from '@emotion/serialize';\nimport type { SystemStyleObject } from '@styled-system/css';\n\nimport { alpha } from '../color';\n\nexport const pulseAnimation: Keyframes = keyframes({\n '0%': {\n opacity: 1,\n },\n '50%': {\n opacity: 0.4,\n },\n '100%': {\n opacity: 1,\n },\n});\n\nexport const pulseAnimationStyle: () => SystemStyleObject = () => ({\n animation: `${pulseAnimation} 1.5s ease-in-out 0.5s infinite`,\n});\n\nexport const waveAnimation: Keyframes = keyframes({\n '0%': {\n transform: 'translateX(-100%)',\n },\n '60%': {\n transform: 'translateX(100%)',\n },\n '100%': {\n transform: 'translateX(100%)',\n },\n});\n\nexport const waveAnimationStyle: (obj: { theme: any }) => SystemStyleObject = ({\n theme,\n}: any) => ({\n overflow: 'hidden',\n position: 'relative',\n '&::after': {\n position: 'absolute',\n content: '\"\"',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n animation: `${waveAnimation} 1.6s linear 0.5s infinite`,\n transform: 'translateX(-100%)',\n background: `linear-gradient(90deg, transparent, ${alpha(\n 'on.surface',\n 0.04\n )(theme)}, transparent)`,\n },\n});\n"],"file":"animation.js"}
File without changes
File without changes
@@ -1,8 +1,8 @@
1
- import type * as React from 'react';
2
- import { PaperProps } from '../Paper';
1
+ import * as React from 'react';
2
+ import type { PaperProps } from '../Paper';
3
3
  export interface SnackbarProps extends PaperProps {
4
4
  action?: React.ReactElement;
5
5
  timeout?: number;
6
6
  dismissible?: boolean;
7
7
  }
8
- export declare const Snackbar: React.ForwardRefExoticComponent<Pick<SnackbarProps, "alignContent" | "alignItems" | "alignSelf" | "backgroundColor" | "backgroundImage" | "backgroundPosition" | "backgroundRepeat" | "backgroundSize" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "bottom" | "boxShadow" | "color" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "opacity" | "order" | "overflowX" | "overflowY" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "textAlign" | "textShadow" | "top" | "translate" | "verticalAlign" | "width" | "zIndex" | "background" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderStyle" | "borderTop" | "borderWidth" | "flex" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "gridColumnGap" | "gridGap" | "gridRowGap" | "hidden" | "as" | "sx" | "__css" | "variant" | "tx" | "theme" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "size" | "bg" | "borderX" | "borderY" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "elevation" | "outlined" | "backgroundOverlay" | "action" | "timeout" | "dismissible"> & React.RefAttributes<HTMLDivElement>>;
8
+ export declare const Snackbar: React.ForwardRefExoticComponent<Pick<SnackbarProps, "children" | "p" | "slot" | "style" | "title" | "alignContent" | "alignItems" | "alignSelf" | "backgroundColor" | "backgroundImage" | "backgroundPosition" | "backgroundRepeat" | "backgroundSize" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "bottom" | "boxShadow" | "color" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "opacity" | "order" | "overflowX" | "overflowY" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "textAlign" | "textShadow" | "top" | "translate" | "verticalAlign" | "width" | "zIndex" | "background" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderStyle" | "borderTop" | "borderWidth" | "flex" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "gridColumnGap" | "gridGap" | "gridRowGap" | "hidden" | "as" | "sx" | "__css" | "variant" | "tx" | "theme" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "size" | "bg" | "borderX" | "borderY" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "elevation" | "outlined" | "backgroundOverlay" | "darkThemeBackgroundOverlay" | "action" | "timeout" | "dismissible"> & React.RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import { assignMultipleRefs } from '@basic-ui/core';
4
4
  import { cloneElement, forwardRef, useRef } from 'react';
5
+ import * as React from 'react';
5
6
  import { Box } from '../Box';
6
7
  import { DARK_THEME_CLASS, DEFAULT_THEME_CLASS, useColorMode } from '../ColorMode';
7
8
  import { Paper } from '../Paper';
@@ -9,30 +10,29 @@ import { Text } from '../Text';
9
10
  import { useSnackbarAnimation } from './useSnackbarAnimation';
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
- export const Snackbar = /*#__PURE__*/forwardRef(function Snackbar(props, forwardedRef) {
13
- const {
14
- colorMode
15
- } = useColorMode();
16
- const ref = useRef(null);
13
+ export var Snackbar = /*#__PURE__*/forwardRef(function Snackbar(props, forwardedRef) {
14
+ var _useColorMode = useColorMode(),
15
+ colorMode = _useColorMode.colorMode;
17
16
 
18
- const {
19
- __css,
20
- action,
21
- children,
22
- style: styleProp,
23
- timeout = 5000,
24
- dismissible
25
- } = props,
26
- otherProps = _objectWithoutPropertiesLoose(props, ["__css", "action", "children", "style", "timeout", "dismissible"]);
17
+ var ref = useRef(null);
18
+
19
+ var __css = props.__css,
20
+ action = props.action,
21
+ children = props.children,
22
+ styleProp = props.style,
23
+ _props$timeout = props.timeout,
24
+ timeout = _props$timeout === void 0 ? 5000 : _props$timeout,
25
+ dismissible = props.dismissible,
26
+ otherProps = _objectWithoutProperties(props, ["__css", "action", "children", "style", "timeout", "dismissible"]);
27
+
28
+ var _useSnackbarAnimation = useSnackbarAnimation(ref, timeout),
29
+ onClose = _useSnackbarAnimation.onClose,
30
+ placementStyle = _useSnackbarAnimation.placementStyle,
31
+ style = _useSnackbarAnimation.style;
27
32
 
28
- const {
29
- onClose,
30
- placementStyle,
31
- style
32
- } = useSnackbarAnimation(ref, timeout);
33
33
  return /*#__PURE__*/_jsxs(Paper, _extends({
34
34
  elevation: 4,
35
- backgroundOverlay: 4,
35
+ darkThemeBackgroundOverlay: 4,
36
36
  className: colorMode === 'default' ? DARK_THEME_CLASS : DEFAULT_THEME_CLASS,
37
37
  ref: assignMultipleRefs(forwardedRef, ref),
38
38
  __css: _extends({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Snackbar/Snackbar.tsx"],"names":["assignMultipleRefs","cloneElement","forwardRef","useRef","Box","DARK_THEME_CLASS","DEFAULT_THEME_CLASS","useColorMode","Paper","Text","useSnackbarAnimation","Snackbar","props","forwardedRef","colorMode","ref","__css","action","children","style","styleProp","timeout","dismissible","otherProps","onClose","placementStyle","boxShadow","py","pl","pr","display","minWidth","maxWidth","borderRadius","color","flexDirection","willChange","onClick"],"mappings":";;AAAA,SAASA,kBAAT,QAAmC,gBAAnC;AAEA,SAASC,YAAT,EAAuBC,UAAvB,EAAmCC,MAAnC,QAAiD,OAAjD;AAEA,SAASC,GAAT,QAAoB,QAApB;AACA,SACEC,gBADF,EAEEC,mBAFF,EAGEC,YAHF,QAIO,cAJP;AAKA,SAASC,KAAT,QAAkC,UAAlC;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,oBAAT,QAAqC,wBAArC;;;AAQA,OAAO,MAAMC,QAAQ,gBAAGT,UAAU,CAChC,SAASS,QAAT,CAAkBC,KAAlB,EAAyBC,YAAzB,EAAuC;AACrC,QAAM;AAAEC,IAAAA;AAAF,MAAgBP,YAAY,EAAlC;AACA,QAAMQ,GAAG,GAAGZ,MAAM,CAAwB,IAAxB,CAAlB;;AACA,QAAM;AACJa,IAAAA,KADI;AAEJC,IAAAA,MAFI;AAGJC,IAAAA,QAHI;AAIJC,IAAAA,KAAK,EAAEC,SAJH;AAKJC,IAAAA,OAAO,GAAG,IALN;AAMJC,IAAAA;AANI,MAQFV,KARJ;AAAA,QAOKW,UAPL,iCAQIX,KARJ;;AAUA,QAAM;A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,QAAAA,OAAO,EAAEb;AAAX,OAAT,CAAf,GAAgDP;AAD9D,MAhCJ;AAAA,KADF;AAuCD,CA1D+B,CAA3B","sourcesContent":["import { assignMultipleRefs } from '@basic-ui/core';\nimport { rem } from 'polished';\nimport { cloneElement, forwardRef, useRef } from 'react';\nimport type * as React from 'react';\nimport { Box } from '../Box';\nimport {\n DARK_THEME_CLASS,\n DEFAULT_THEME_CLASS,\n useColorMode,\n} from '../ColorMode';\nimport { Paper, PaperProps } from '../Paper';\nimport { Text } from '../Text';\nimport { useSnackbarAnimation } from './useSnackbarAnimation';\n\nexport interface SnackbarProps extends PaperProps {\n action?: React.ReactElement;\n timeout?: number;\n dismissible?: boolean;\n}\n\nexport const Snackbar = forwardRef<HTMLDivElement, SnackbarProps>(\n function Snackbar(props, forwardedRef) {\n const { colorMode } = useColorMode();\n const ref = useRef<HTMLDivElement | null>(null);\n const {\n __css,\n action,\n children,\n style: styleProp,\n timeout = 5000,\n dismissible,\n ...otherProps\n } = props;\n\n const { onClose, placementStyle, style } = useSnackbarAnimation(\n ref,\n timeout\n );\n\n return (\n <Paper\n elevation={4}\n backgroundOverlay={4}\n className={\n colorMode === 'default' ? DARK_THEME_CLASS : DEFAULT_THEME_CLASS\n }\n ref={assignMultipleRefs(forwardedRef, ref)}\n __css={{\n boxShadow: 4,\n py: rem(6),\n pl: 3,\n pr: 3,\n display: 'inline-flex',\n minWidth: `min(100%, ${rem(344)})`,\n maxWidth: ['100%', 'unset'],\n borderRadius: 'extra-small',\n color: 'on.surface',\n flexDirection: 'row',\n willChange: 'transform,opacity',\n ...placementStyle,\n ...__css,\n }}\n style={{\n ...style,\n ...styleProp,\n }}\n {...otherProps}\n >\n <Text variant=\"body2\" as=\"span\" py={2}>\n {children}\n </Text>\n {action && (\n <Box as=\"span\" pl={2} mr={-2} ml=\"auto\" minWidth=\"auto\">\n {dismissible ? cloneElement(action, { onClick: onClose }) : action}\n </Box>\n )}\n </Paper>\n );\n }\n);\n"],"file":"Snackbar.js"}
1
+ {"version":3,"sources":["../../../src/Snackbar/Snackbar.tsx"],"names":["assignMultipleRefs","cloneElement","forwardRef","useRef","React","Box","DARK_THEME_CLASS","DEFAULT_THEME_CLASS","useColorMode","Paper","Text","useSnackbarAnimation","Snackbar","props","forwardedRef","colorMode","ref","__css","action","children","styleProp","style","timeout","dismissible","otherProps","onClose","placementStyle","boxShadow","py","pl","pr","display","minWidth","maxWidth","borderRadius","color","flexDirection","willChange","onClick"],"mappings":";;AAAA,SAASA,kBAAT,QAAmC,gBAAnC;AAEA,SAASC,YAAT,EAAuBC,UAAvB,EAAmCC,MAAnC,QAAiD,OAAjD;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,SAASC,GAAT,QAAoB,QAApB;AACA,SACEC,gBADF,EAEEC,mBAFF,EAGEC,YAHF,QAIO,cAJP;AAMA,SAASC,KAAT,QAAsB,UAAtB;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,oBAAT,QAAqC,wBAArC;;;AAQA,OAAO,IAAMC,QAAQ,gBAAGV,UAAU,CAChC,SAASU,QAAT,CAAkBC,KAAlB,EAAyBC,YAAzB,EAAuC;AAAA,sBACfN,YAAY,EADG;AAAA,MAC7BO,SAD6B,iBAC7BA,SAD6B;;AAErC,MAAMC,GAAG,GAAGb,MAAM,CAAwB,IAAxB,CAAlB;;AAFqC,MAInCc,KAJmC,GAWjCJ,KAXiC,CAInCI,KAJmC;AAAA,MAKnCC,MALmC,GAWjCL,KAXiC,CAKnCK,MALmC;AAAA,MAMnCC,QANmC,GAWjCN,KAXiC,CAMnCM,QANmC;AAAA,MAO5BC,SAP4B,GAWjCP,KAXiC,CAOnCQ,KAPmC;AAAA,uBAWjCR,KAXiC,CAQnCS,OARmC;AAAA,MAQnCA,OARmC,+BAQzB,IARyB;AAAA,MASnCC,WATmC,GAWjCV,KAXiC,CASnCU,WATmC;AAAA,MAUhCC,UAVgC,4BAWjCX,KAXiC;;AAAA,8BAaMF,oBAAoB,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AY,CAACiB,MAAD,EAAS;AAAEoB,QAAAA,OAAO,EAAEb;AAAX,OAAT,CAAf,GAAgDP;AAD9D,MAhCJ;AAAA,KADF;AAuCD,CA1D+B,CAA3B","sourcesContent":["import { assignMultipleRefs } from '@basic-ui/core';\nimport { rem } from 'polished';\nimport { cloneElement, forwardRef, useRef } from 'react';\nimport * as React from 'react';\n\nimport { Box } from '../Box';\nimport {\n DARK_THEME_CLASS,\n DEFAULT_THEME_CLASS,\n useColorMode,\n} from '../ColorMode';\nimport type { PaperProps } from '../Paper';\nimport { Paper } from '../Paper';\nimport { Text } from '../Text';\nimport { useSnackbarAnimation } from './useSnackbarAnimation';\n\nexport interface SnackbarProps extends PaperProps {\n action?: React.ReactElement;\n timeout?: number;\n dismissible?: boolean;\n}\n\nexport const Snackbar = forwardRef<HTMLDivElement, SnackbarProps>(\n function Snackbar(props, forwardedRef) {\n const { colorMode } = useColorMode();\n const ref = useRef<HTMLDivElement | null>(null);\n const {\n __css,\n action,\n children,\n style: styleProp,\n timeout = 5000,\n dismissible,\n ...otherProps\n } = props;\n\n const { onClose, placementStyle, style } = useSnackbarAnimation(\n ref,\n timeout\n );\n\n return (\n <Paper\n elevation={4}\n darkThemeBackgroundOverlay={4}\n className={\n colorMode === 'default' ? DARK_THEME_CLASS : DEFAULT_THEME_CLASS\n }\n ref={assignMultipleRefs(forwardedRef, ref)}\n __css={{\n boxShadow: 4,\n py: rem(6),\n pl: 3,\n pr: 3,\n display: 'inline-flex',\n minWidth: `min(100%, ${rem(344)})`,\n maxWidth: ['100%', 'unset'],\n borderRadius: 'extra-small',\n color: 'on.surface',\n flexDirection: 'row',\n willChange: 'transform,opacity',\n ...placementStyle,\n ...__css,\n }}\n style={{\n ...style,\n ...styleProp,\n }}\n {...otherProps}\n >\n <Text variant=\"body2\" as=\"span\" py={2}>\n {children}\n </Text>\n {action && (\n <Box as=\"span\" pl={2} mr={-2} ml=\"auto\" minWidth=\"auto\">\n {dismissible ? cloneElement(action, { onClick: onClose }) : action}\n </Box>\n )}\n </Paper>\n );\n }\n);\n"],"file":"Snackbar.js"}
@@ -1,6 +1,5 @@
1
- import { MutableRefObject, ReactElement } from 'react';
2
- import type * as React from 'react';
3
- import { FC } from 'react';
1
+ import type { MutableRefObject, ReactElement, FC } from 'react';
2
+ import * as React from 'react';
4
3
  export declare type StackPlacement = 'top-right' | 'top-center' | 'top-left' | 'bottom-right' | 'bottom-center' | 'bottom-left';
5
4
  export interface StackItemContextProps {
6
5
  posY: number | undefined;
@@ -1,55 +1,57 @@
1
- import { useLayoutEffect } from 'react';
2
- import { createContext, useContext, useEffect, useRef, useState } from 'react';
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useLayoutEffect, createContext, useContext, useEffect, useRef, useState } from 'react';
3
+ import * as React from 'react';
3
4
  import { jsx as _jsx } from "react/jsx-runtime";
4
5
  import { jsxs as _jsxs } from "react/jsx-runtime";
5
- const StackItemContext = /*#__PURE__*/createContext(null);
6
+ var StackItemContext = /*#__PURE__*/createContext(null);
6
7
  StackItemContext.displayName = 'StackItemContext';
7
- export function useStackItem({
8
- ref,
9
- closeTimeoutInMilliseconds = 110
10
- }) {
11
- const context = useContext(StackItemContext);
8
+ export function useStackItem(_ref) {
9
+ var ref = _ref.ref,
10
+ _ref$closeTimeoutInMi = _ref.closeTimeoutInMilliseconds,
11
+ closeTimeoutInMilliseconds = _ref$closeTimeoutInMi === void 0 ? 110 : _ref$closeTimeoutInMi;
12
+ var context = useContext(StackItemContext);
12
13
 
13
14
  if (!context) {
14
15
  return null;
15
16
  }
16
17
 
17
- const {
18
- onSetHeight,
19
- onRemoveItem,
20
- posY,
21
- placement,
22
- isExiting
23
- } = context;
18
+ var onSetHeight = context.onSetHeight,
19
+ onRemoveItem = context.onRemoveItem,
20
+ posY = context.posY,
21
+ placement = context.placement,
22
+ isExiting = context.isExiting;
24
23
  /* eslint-disable react-hooks/rules-of-hooks */
25
24
 
26
- const [state, setState] = useState('entering');
25
+ var _useState = useState('entering'),
26
+ _useState2 = _slicedToArray(_useState, 2),
27
+ state = _useState2[0],
28
+ setState = _useState2[1];
27
29
 
28
30
  function onClose() {
29
31
  setState('exiting');
30
32
  }
31
33
 
32
- useLayoutEffect(() => {
34
+ useLayoutEffect(function () {
33
35
  var _ref$current$getBound, _ref$current;
34
36
 
35
- const height = (_ref$current$getBound = (_ref$current = ref.current) == null ? void 0 : _ref$current.getBoundingClientRect().height) != null ? _ref$current$getBound : 0;
37
+ var height = (_ref$current$getBound = (_ref$current = ref.current) == null ? void 0 : _ref$current.getBoundingClientRect().height) != null ? _ref$current$getBound : 0;
36
38
  onSetHeight(height);
37
39
 
38
40
  if (isExiting) {
39
41
  onClose();
40
42
  }
41
43
  });
42
- useEffect(() => {
44
+ useEffect(function () {
43
45
  if (posY !== undefined && state === 'entering') {
44
46
  setState('entered');
45
47
  }
46
48
  }, [state, posY]);
47
- useLayoutEffect(() => {
49
+ useLayoutEffect(function () {
48
50
  if (state === 'exiting') {
49
- const handle = setTimeout(() => {
51
+ var handle = setTimeout(function () {
50
52
  onRemoveItem();
51
53
  }, closeTimeoutInMilliseconds);
52
- return () => {
54
+ return function () {
53
55
  clearTimeout(handle);
54
56
  };
55
57
  }
@@ -57,39 +59,44 @@ export function useStackItem({
57
59
 
58
60
  return {
59
61
  translateY: posY,
60
- state,
61
- onClose,
62
- placement
62
+ state: state,
63
+ onClose: onClose,
64
+ placement: placement
63
65
  };
64
66
  /* eslint-enable react-hooks/rules-of-hooks */
65
67
  }
66
68
 
67
- function StackContent({
68
- gap = 0,
69
- placement,
70
- maxSize,
71
- onAddItemRef
72
- }) {
73
- const id = useRef(0);
74
- const items = useRef([]);
75
- const [, setCounter] = useState(false);
69
+ function StackContent(_ref2) {
70
+ var _ref2$gap = _ref2.gap,
71
+ gap = _ref2$gap === void 0 ? 0 : _ref2$gap,
72
+ placement = _ref2.placement,
73
+ maxSize = _ref2.maxSize,
74
+ onAddItemRef = _ref2.onAddItemRef;
75
+ var id = useRef(0);
76
+ var items = useRef([]);
77
+
78
+ var _useState3 = useState(false),
79
+ _useState4 = _slicedToArray(_useState3, 2),
80
+ setCounter = _useState4[1];
76
81
 
77
82
  function rerender() {
78
- setCounter(v => !v);
83
+ setCounter(function (v) {
84
+ return !v;
85
+ });
79
86
  }
80
87
 
81
- useEffect(() => {
82
- onAddItemRef.current = element => {
83
- const itemId = String(++id.current);
88
+ useEffect(function () {
89
+ onAddItemRef.current = function (element) {
90
+ var itemId = String(++id.current);
84
91
  items.current.push({
85
92
  id: itemId,
86
93
  height: undefined,
87
- element,
94
+ element: element,
88
95
  isExiting: false
89
96
  }); // Stack > maxSize? Close items
90
97
 
91
98
  if (items.current.length > maxSize) {
92
- for (let i = 0; i < items.current.length; i++) {
99
+ for (var i = 0; i < items.current.length; i++) {
93
100
  if (!items.current[i].isExiting) {
94
101
  items.current[i].isExiting = true;
95
102
  break;
@@ -100,15 +107,16 @@ function StackContent({
100
107
  rerender();
101
108
  };
102
109
 
103
- return () => {
110
+ return function () {
104
111
  onAddItemRef.current = null;
105
112
  };
106
113
  }, [maxSize]); // eslint-disable-line react-hooks/exhaustive-deps
107
114
 
108
115
  function setHeightById(id, height) {
109
- const item = items.current.find(({
110
- id: itemId
111
- }) => itemId === id);
116
+ var item = items.current.find(function (_ref3) {
117
+ var itemId = _ref3.id;
118
+ return itemId === id;
119
+ });
112
120
 
113
121
  if (item && item.height !== height) {
114
122
  item.height = height;
@@ -117,22 +125,23 @@ function StackContent({
117
125
  }
118
126
 
119
127
  function removeItemById(id) {
120
- const previousLength = items.current.length;
121
- items.current = items.current.filter(({
122
- id: itemId
123
- }) => itemId !== id);
128
+ var previousLength = items.current.length;
129
+ items.current = items.current.filter(function (_ref4) {
130
+ var itemId = _ref4.id;
131
+ return itemId !== id;
132
+ });
124
133
 
125
134
  if (items.current.length !== previousLength) {
126
135
  rerender();
127
136
  }
128
137
  }
129
138
 
130
- let y = 0;
139
+ var y = 0;
131
140
  return /*#__PURE__*/_jsx("div", {
132
141
  "data-stack-root": "",
133
- children: Array.from(items.current).map(item => {
134
- let posY = undefined;
135
- const height = item.height;
142
+ children: Array.from(items.current).map(function (item) {
143
+ var posY = undefined;
144
+ var height = item.height;
136
145
 
137
146
  if (height) {
138
147
  posY = y;
@@ -142,16 +151,18 @@ function StackContent({
142
151
  return /*#__PURE__*/_jsx(StackItemContext.Provider, {
143
152
  value: {
144
153
  isExiting: item.isExiting,
145
- posY,
146
- onSetHeight: height => {
154
+ posY: posY,
155
+ onSetHeight: function onSetHeight(height) {
147
156
  if (height === item.height) {
148
157
  return;
149
158
  }
150
159
 
151
160
  setHeightById(item.id, height);
152
161
  },
153
- onRemoveItem: () => removeItemById(item.id),
154
- placement
162
+ onRemoveItem: function onRemoveItem() {
163
+ return removeItemById(item.id);
164
+ },
165
+ placement: placement
155
166
  },
156
167
  children: item.element
157
168
  }, item.id);
@@ -159,14 +170,16 @@ function StackContent({
159
170
  });
160
171
  }
161
172
 
162
- const StackContext = /*#__PURE__*/createContext(null);
163
- export const StackProvider = ({
164
- children,
165
- gap = 8,
166
- placement = 'top-right',
167
- maxSize = 3
168
- }) => {
169
- const onAddItemRef = useRef(null);
173
+ var StackContext = /*#__PURE__*/createContext(null);
174
+ export var StackProvider = function StackProvider(_ref5) {
175
+ var children = _ref5.children,
176
+ _ref5$gap = _ref5.gap,
177
+ gap = _ref5$gap === void 0 ? 8 : _ref5$gap,
178
+ _ref5$placement = _ref5.placement,
179
+ placement = _ref5$placement === void 0 ? 'top-right' : _ref5$placement,
180
+ _ref5$maxSize = _ref5.maxSize,
181
+ maxSize = _ref5$maxSize === void 0 ? 3 : _ref5$maxSize;
182
+ var onAddItemRef = useRef(null);
170
183
 
171
184
  function onAddItem(element) {
172
185
  onAddItemRef.current == null ? void 0 : onAddItemRef.current(element);
@@ -185,7 +198,7 @@ export const StackProvider = ({
185
198
  });
186
199
  };
187
200
  export function useStack() {
188
- const ctx = useContext(StackContext);
201
+ var ctx = useContext(StackContext);
189
202
 
190
203
  if (!ctx) {
191
204
  throw new Error('useStack must be used within a StackContext.Provider');
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Snackbar/Stack.tsx"],"names":["useLayoutEffect","createContext","useContext","useEffect","useRef","useState","StackItemContext","displayName","useStackItem","ref","closeTimeoutInMilliseconds","context","onSetHeight","onRemoveItem","posY","placement","isExiting","state","setState","onClose","height","current","getBoundingClientRect","undefined","handle","setTimeout","clearTimeout","translateY","StackContent","gap","maxSize","onAddItemRef","id","items","setCounter","rerender","v","element","itemId","String","push","length","i","setHeightById","item","find","removeItemById","previousLength","filter","y","Array","from","map","StackContext","StackProvider","children","onAddItem","addItem","useStack","ctx","Error"],"mappings":"AAAA,SAAyCA,eAAzC,QAAgE,OAAhE;AAEA,SACEC,aADF,EAGEC,UAHF,EAIEC,SAJF,EAKEC,MALF,EAMEC,QANF,QAOO,OAPP;;;AA0BA,MAAMC,gBAAgB,gBAAGL,aAAa,CAA+B,IAA/B,CAAtC;AACAK,gBAAgB,CAACC,WAAjB,GAA+B,kBAA/B;AAQA,OAAO,SAASC,YAAT,CAAsB;AAC3BC,EAAAA,GAD2B;AAE3BC,EAAAA,0BAA0B,GAAG;AAFF,CAAtB,EAGY;AACjB,QAAMC,OAAO,GAAGT,UAAU,CAACI,gBAAD,CAA1B;;AACA,MAAI,CAACK,OAAL,EAAc;AACZ,WAAO,IAAP;AACD;;AACD,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,YAAf;AAA6BC,IAAAA,IAA7B;AAAmCC,IAAAA,SAAnC;AAA8CC,IAAAA;AAA9C,MAA4DL,OAAlE;AACA;;AACA,QAAM,CAACM,KAAD,EAAQC,QAAR,IAAoBb,QAAQ,CAChC,UADgC,CAAlC;;AAIA,WAASc,OAAT,GAAmB;AACjBD,IAAAA,QAAQ,CAAC,SAAD,CAAR;AACD;;AAEDlB,EAAAA,eAAe,CAAC,MAAM;AAAA;;AACpB,UAAMoB,MAAM,4CAAGX,GAAG,CAACY,OA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YAAY,gBAAGpD,aAAa,CAA2B,IAA3B,CAAlC;AASA,OAAO,MAAMqD,aAWX,GAAG,CAAC;AAAEC,EAAAA,QAAF;AAAY1B,EAAAA,GAAG,GAAG,CAAlB;AAAqBd,EAAAA,SAAS,GAAG,WAAjC;AAA8Ce,EAAAA,OAAO,GAAG;AAAxD,CAAD,KAAiE;AACpE,QAAMC,YAAY,GAAG3B,MAAM,CAAwC,IAAxC,CAA3B;;AACA,WAASoD,SAAT,CAAmBnB,OAAnB,EAAgD;AAC9CN,IAAAA,YAAY,CAACV,OAAb,oBAAAU,YAAY,CAACV,OAAb,CAAuBgB,OAAvB;AACD;;AAED,sBACE,MAAC,YAAD,CAAc,QAAd;AAAuB,IAAA,KAAK,EAAE;AAAEoB,MAAAA,OAAO,EAAED;AAAX,KAA9B;AAAA,eACGD,QADH,eAEE,KAAC,YAAD;AACE,MAAA,GAAG,EAAE1B,GADP;AAEE,MAAA,SAAS,EAAEd,SAFb;AAGE,MAAA,OAAO,EAAEe,OAHX;AAIE,MAAA,YAAY,EAAEC;AAJhB,MAFF;AAAA,IADF;AAWD,CA5BM;AA8BP,OAAO,SAAS2B,QAAT,GAAuC;AAC5C,QAAMC,GAAG,GAAGzD,UAAU,CAACmD,YAAD,CAAtB;;AACA,MAAI,CAACM,GAAL,EAAU;AACR,UAAM,IAAIC,KAAJ,CAAU,sDAAV,CAAN;AACD;;AACD,SAAOD,GAAP;AACD","sourcesContent":["import { MutableRefObject, ReactElement, useLayoutEffect } from 'react';\nimport type * as React from 'react';\nimport {\n createContext,\n FC,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nexport type StackPlacement =\n | 'top-right'\n | 'top-center'\n | 'top-left'\n | 'bottom-right'\n | 'bottom-center'\n | 'bottom-left';\n\n// StackItemContext Component\nexport interface StackItemContextProps {\n posY: number | undefined;\n isExiting: boolean;\n onSetHeight(height: number): void;\n onRemoveItem(): void;\n placement: StackPlacement;\n}\n\nconst StackItemContext = createContext<StackItemContextProps | null>(null);\nStackItemContext.displayName = 'StackItemContext';\n\ninterface StackItemProps {\n ref: MutableRefObject<HTMLElement | null>;\n openTimeoutInMilliseconds?: number;\n closeTimeoutInMilliseconds?: number;\n}\n\nexport function useStackItem({\n ref,\n closeTimeoutInMilliseconds = 110,\n}: StackItemProps) {\n const context = useContext(StackItemContext);\n if (!context) {\n return null;\n }\n const { onSetHeight, onRemoveItem, posY, placement, isExiting } = context;\n /* eslint-disable react-hooks/rules-of-hooks */\n const [state, setState] = useState<'entering' | 'entered' | 'exiting'>(\n 'entering'\n );\n\n function onClose() {\n setState('exiting');\n }\n\n useLayoutEffect(() => {\n const height = ref.current?.getBoundingClientRect().height ?? 0;\n onSetHeight(height);\n\n if (isExiting) {\n onClose();\n }\n });\n\n useEffect(() => {\n if (posY !== undefined && state === 'entering') {\n setState('entered');\n }\n }, [state, posY]);\n\n useLayoutEffect(() => {\n if (state === 'exiting') {\n const handle = setTimeout(() => {\n onRemoveItem();\n }, closeTimeoutInMilliseconds);\n\n return () => {\n clearTimeout(handle);\n };\n }\n }, [state]); // eslint-disable-line react-hooks/exhaustive-deps\n\n return {\n translateY: posY,\n state,\n onClose,\n placement,\n };\n /* eslint-enable react-hooks/rules-of-hooks */\n}\n\nfunction StackContent({\n gap = 0,\n placement,\n maxSize,\n onAddItemRef,\n}: {\n gap: number;\n placement: StackPlacement;\n maxSize: number;\n onAddItemRef: React.MutableRefObject<\n ((element: React.ReactElement) => void) | null\n >;\n}) {\n const id = useRef(0);\n const items = useRef<StackItem[]>([]);\n const [, setCounter] = useState(false);\n function rerender() {\n setCounter((v) => !v);\n }\n\n useEffect(() => {\n onAddItemRef.current = (element: React.ReactElement) => {\n const itemId = String(++id.current);\n\n items.current.push({\n id: itemId,\n height: undefined,\n element,\n isExiting: false,\n });\n // Stack > maxSize? Close items\n if (items.current.length > maxSize) {\n for (let i = 0; i < items.current.length; i++) {\n if (!items.current[i].isExiting) {\n items.current[i].isExiting = true;\n break;\n }\n }\n }\n rerender();\n };\n return () => {\n onAddItemRef.current = null;\n };\n }, [maxSize]); // eslint-disable-line react-hooks/exhaustive-deps\n\n function setHeightById(id: string, height: number) {\n const item = items.current.find(({ id: itemId }) => itemId === id);\n if (item && item.height !== height) {\n item.height = height;\n rerender();\n }\n }\n\n function removeItemById(id: string) {\n const previousLength = items.current.length;\n items.current = items.current.filter(({ id: itemId }) => itemId !== id);\n if (items.current.length !== previousLength) {\n rerender();\n }\n }\n\n let y = 0;\n return (\n <div data-stack-root=\"\">\n {Array.from(items.current).map((item) => {\n let posY: number | undefined = undefined;\n const height = item.height;\n if (height) {\n posY = y;\n y += height + gap;\n }\n\n return (\n <StackItemContext.Provider\n key={item.id}\n value={{\n isExiting: item.isExiting,\n posY,\n onSetHeight: (height: number) => {\n if (height === item.height) {\n return;\n }\n setHeightById(item.id, height);\n },\n onRemoveItem: () => removeItemById(item.id),\n placement,\n }}\n >\n {item.element}\n </StackItemContext.Provider>\n );\n })}\n </div>\n );\n}\n\nexport interface StackContextProps {\n addItem: (element: ReactElement) => void;\n}\n\nconst StackContext = createContext<StackContextProps | null>(null);\n\ninterface StackItem {\n id: string;\n element: ReactElement;\n height: number | undefined;\n isExiting: boolean;\n}\n\nexport const StackProvider: FC<{\n children?: React.ReactNode | React.ReactNode[];\n gap?: number;\n placement?:\n | 'top-right'\n | 'top-center'\n | 'top-left'\n | 'bottom-right'\n | 'bottom-center'\n | 'bottom-left';\n maxSize?: number;\n}> = ({ children, gap = 8, placement = 'top-right', maxSize = 3 }) => {\n const onAddItemRef = useRef<(element: React.ReactElement) => void>(null);\n function onAddItem(element: React.ReactElement) {\n onAddItemRef.current?.(element);\n }\n\n return (\n <StackContext.Provider value={{ addItem: onAddItem }}>\n {children}\n <StackContent\n gap={gap}\n placement={placement}\n maxSize={maxSize}\n onAddItemRef={onAddItemRef}\n />\n </StackContext.Provider>\n );\n};\n\nexport function useStack(): StackContextProps {\n const ctx = useContext(StackContext);\n if (!ctx) {\n throw new Error('useStack must be used within a StackContext.Provider');\n }\n return ctx;\n}\n"],"file":"Stack.js"}
1
+ {"version":3,"sources":["../../../src/Snackbar/Stack.tsx"],"names":["useLayoutEffect","createContext","useContext","useEffect","useRef","useState","React","StackItemContext","displayName","useStackItem","ref","closeTimeoutInMilliseconds","context","onSetHeight","onRemoveItem","posY","placement","isExiting","state","setState","onClose","height","current","getBoundingClientRect","undefined","handle","setTimeout","clearTimeout","translateY","StackContent","gap","maxSize","onAddItemRef","id","items","setCounter","rerender","v","element","itemId","String","push","length","i","setHeightById","item","find","removeItemById","previousLength","filter","y","Array","from","map","StackContext","StackProvider","children","onAddItem","addItem","useStack","ctx","Error"],"mappings":";AACA,SACEA,eADF,EAEEC,aAFF,EAGEC,UAHF,EAIEC,SAJF,EAKEC,MALF,EAMEC,QANF,QAOO,OAPP;AAQA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;;;AAmBA,IAAMC,gBAAgB,gBAAGN,aAAa,CAA+B,IAA/B,CAAtC;AACAM,gBAAgB,CAACC,WAAjB,GAA+B,kBAA/B;AAQA,OAAO,SAASC,YAAT,OAGY;AAAA,MAFjBC,GAEiB,QAFjBA,GAEiB;AAAA,mCADjBC,0BACiB;AAAA,MADjBA,0BACiB,sCADY,GACZ;AACjB,MAAMC,OAAO,GAAGV,UAAU,CAACK,gBAAD,CAA1B;;AACA,MAAI,CAACK,OAAL,EAAc;AACZ,WAAO,IAAP;AACD;;AAJgB,MAKTC,WALS,GAKiDD,OALjD,CAKTC,WALS;AAAA,MAKIC,YALJ,GAKiDF,OALjD,CAKIE,YALJ;AAAA,MAKkBC,IALlB,GAKiDH,OALjD,CAKkBG,IALlB;AAAA,MAKwBC,SALxB,GAKiDJ,OALjD,CAKwBI,SALxB;AAAA,MAKmCC,SALnC,GAKiDL,OALjD,CAKmCK,SALnC;AAMjB;;AANiB,kBAOSZ,QAAQ,CAChC,UADgC,CAPjB;AAAA;AAAA,MAOVa,KAPU;AAAA,MAOHC,QAPG;;AAWjB,WAASC,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AAM,IAAIC,KAAJ,CAAU,sDAAV,CAAN;AACD;;AACD,SAAOD,GAAP;AACD","sourcesContent":["import type { MutableRefObject, ReactElement, FC } from 'react';\nimport {\n useLayoutEffect,\n createContext,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport * as React from 'react';\n\nexport type StackPlacement =\n | 'top-right'\n | 'top-center'\n | 'top-left'\n | 'bottom-right'\n | 'bottom-center'\n | 'bottom-left';\n\n// StackItemContext Component\nexport interface StackItemContextProps {\n posY: number | undefined;\n isExiting: boolean;\n onSetHeight(height: number): void;\n onRemoveItem(): void;\n placement: StackPlacement;\n}\n\nconst StackItemContext = createContext<StackItemContextProps | null>(null);\nStackItemContext.displayName = 'StackItemContext';\n\ninterface StackItemProps {\n ref: MutableRefObject<HTMLElement | null>;\n openTimeoutInMilliseconds?: number;\n closeTimeoutInMilliseconds?: number;\n}\n\nexport function useStackItem({\n ref,\n closeTimeoutInMilliseconds = 110,\n}: StackItemProps) {\n const context = useContext(StackItemContext);\n if (!context) {\n return null;\n }\n const { onSetHeight, onRemoveItem, posY, placement, isExiting } = context;\n /* eslint-disable react-hooks/rules-of-hooks */\n const [state, setState] = useState<'entering' | 'entered' | 'exiting'>(\n 'entering'\n );\n\n function onClose() {\n setState('exiting');\n }\n\n useLayoutEffect(() => {\n const height = ref.current?.getBoundingClientRect().height ?? 0;\n onSetHeight(height);\n\n if (isExiting) {\n onClose();\n }\n });\n\n useEffect(() => {\n if (posY !== undefined && state === 'entering') {\n setState('entered');\n }\n }, [state, posY]);\n\n useLayoutEffect(() => {\n if (state === 'exiting') {\n const handle = setTimeout(() => {\n onRemoveItem();\n }, closeTimeoutInMilliseconds);\n\n return () => {\n clearTimeout(handle);\n };\n }\n }, [state]); // eslint-disable-line react-hooks/exhaustive-deps\n\n return {\n translateY: posY,\n state,\n onClose,\n placement,\n };\n /* eslint-enable react-hooks/rules-of-hooks */\n}\n\nfunction StackContent({\n gap = 0,\n placement,\n maxSize,\n onAddItemRef,\n}: {\n gap: number;\n placement: StackPlacement;\n maxSize: number;\n onAddItemRef: React.MutableRefObject<\n ((element: React.ReactElement) => void) | null\n >;\n}) {\n const id = useRef(0);\n const items = useRef<StackItem[]>([]);\n const [, setCounter] = useState(false);\n function rerender() {\n setCounter((v) => !v);\n }\n\n useEffect(() => {\n onAddItemRef.current = (element: React.ReactElement) => {\n const itemId = String(++id.current);\n\n items.current.push({\n id: itemId,\n height: undefined,\n element,\n isExiting: false,\n });\n // Stack > maxSize? Close items\n if (items.current.length > maxSize) {\n for (let i = 0; i < items.current.length; i++) {\n if (!items.current[i].isExiting) {\n items.current[i].isExiting = true;\n break;\n }\n }\n }\n rerender();\n };\n return () => {\n onAddItemRef.current = null;\n };\n }, [maxSize]); // eslint-disable-line react-hooks/exhaustive-deps\n\n function setHeightById(id: string, height: number) {\n const item = items.current.find(({ id: itemId }) => itemId === id);\n if (item && item.height !== height) {\n item.height = height;\n rerender();\n }\n }\n\n function removeItemById(id: string) {\n const previousLength = items.current.length;\n items.current = items.current.filter(({ id: itemId }) => itemId !== id);\n if (items.current.length !== previousLength) {\n rerender();\n }\n }\n\n let y = 0;\n return (\n <div data-stack-root=\"\">\n {Array.from(items.current).map((item) => {\n let posY: number | undefined = undefined;\n const height = item.height;\n if (height) {\n posY = y;\n y += height + gap;\n }\n\n return (\n <StackItemContext.Provider\n key={item.id}\n value={{\n isExiting: item.isExiting,\n posY,\n onSetHeight: (height: number) => {\n if (height === item.height) {\n return;\n }\n setHeightById(item.id, height);\n },\n onRemoveItem: () => removeItemById(item.id),\n placement,\n }}\n >\n {item.element}\n </StackItemContext.Provider>\n );\n })}\n </div>\n );\n}\n\nexport interface StackContextProps {\n addItem: (element: ReactElement) => void;\n}\n\nconst StackContext = createContext<StackContextProps | null>(null);\n\ninterface StackItem {\n id: string;\n element: ReactElement;\n height: number | undefined;\n isExiting: boolean;\n}\n\nexport const StackProvider: FC<{\n children?: React.ReactNode | React.ReactNode[];\n gap?: number;\n placement?:\n | 'top-right'\n | 'top-center'\n | 'top-left'\n | 'bottom-right'\n | 'bottom-center'\n | 'bottom-left';\n maxSize?: number;\n}> = ({ children, gap = 8, placement = 'top-right', maxSize = 3 }) => {\n const onAddItemRef = useRef<(element: React.ReactElement) => void>(null);\n function onAddItem(element: React.ReactElement) {\n onAddItemRef.current?.(element);\n }\n\n return (\n <StackContext.Provider value={{ addItem: onAddItem }}>\n {children}\n <StackContent\n gap={gap}\n placement={placement}\n maxSize={maxSize}\n onAddItemRef={onAddItemRef}\n />\n </StackContext.Provider>\n );\n};\n\nexport function useStack(): StackContextProps {\n const ctx = useContext(StackContext);\n if (!ctx) {\n throw new Error('useStack must be used within a StackContext.Provider');\n }\n return ctx;\n}\n"],"file":"Stack.js"}
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- import { CSSProperties } from 'react';
1
+ import type { CSSProperties } from 'react';
2
2
  declare type AnimationState = 'entering' | 'entered' | 'exiting';
3
3
  export declare const placements: {
4
4
  'top-right': {