@fluentui/react-toast 9.0.0

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 (310) hide show
  1. package/CHANGELOG.json +56 -0
  2. package/CHANGELOG.md +19 -0
  3. package/LICENSE +15 -0
  4. package/README.md +5 -0
  5. package/dist/index.d.ts +485 -0
  6. package/lib/AriaLive.js +1 -0
  7. package/lib/AriaLive.js.map +1 -0
  8. package/lib/Toast.js +1 -0
  9. package/lib/Toast.js.map +1 -0
  10. package/lib/ToastBody.js +1 -0
  11. package/lib/ToastBody.js.map +1 -0
  12. package/lib/ToastContainer.js +1 -0
  13. package/lib/ToastContainer.js.map +1 -0
  14. package/lib/ToastFooter.js +1 -0
  15. package/lib/ToastFooter.js.map +1 -0
  16. package/lib/ToastTitle.js +1 -0
  17. package/lib/ToastTitle.js.map +1 -0
  18. package/lib/ToastTrigger.js +1 -0
  19. package/lib/ToastTrigger.js.map +1 -0
  20. package/lib/Toaster.js +1 -0
  21. package/lib/Toaster.js.map +1 -0
  22. package/lib/components/AriaLive/AriaLive.js +12 -0
  23. package/lib/components/AriaLive/AriaLive.js.map +1 -0
  24. package/lib/components/AriaLive/AriaLive.types.js +1 -0
  25. package/lib/components/AriaLive/AriaLive.types.js.map +1 -0
  26. package/lib/components/AriaLive/index.js +5 -0
  27. package/lib/components/AriaLive/index.js.map +1 -0
  28. package/lib/components/AriaLive/renderAriaLive.js +8 -0
  29. package/lib/components/AriaLive/renderAriaLive.js.map +1 -0
  30. package/lib/components/AriaLive/useAriaLive.js +73 -0
  31. package/lib/components/AriaLive/useAriaLive.js.map +1 -0
  32. package/lib/components/AriaLive/useAriaLiveStyles.styles.js +19 -0
  33. package/lib/components/AriaLive/useAriaLiveStyles.styles.js.map +1 -0
  34. package/lib/components/Timer/Timer.js +21 -0
  35. package/lib/components/Timer/Timer.js.map +1 -0
  36. package/lib/components/Timer/index.js +1 -0
  37. package/lib/components/Timer/index.js.map +1 -0
  38. package/lib/components/Timer/useTimerStyles.styles.js +3 -0
  39. package/lib/components/Timer/useTimerStyles.styles.js.map +1 -0
  40. package/lib/components/Toast/Toast.js +13 -0
  41. package/lib/components/Toast/Toast.js.map +1 -0
  42. package/lib/components/Toast/Toast.types.js +1 -0
  43. package/lib/components/Toast/Toast.types.js.map +1 -0
  44. package/lib/components/Toast/index.js +5 -0
  45. package/lib/components/Toast/index.js.map +1 -0
  46. package/lib/components/Toast/renderToast.js +11 -0
  47. package/lib/components/Toast/renderToast.js.map +1 -0
  48. package/lib/components/Toast/useToast.js +22 -0
  49. package/lib/components/Toast/useToast.js.map +1 -0
  50. package/lib/components/Toast/useToastContextValues.js +6 -0
  51. package/lib/components/Toast/useToastContextValues.js.map +1 -0
  52. package/lib/components/Toast/useToastStyles.styles.js +24 -0
  53. package/lib/components/Toast/useToastStyles.styles.js.map +1 -0
  54. package/lib/components/ToastBody/ToastBody.js +12 -0
  55. package/lib/components/ToastBody/ToastBody.js.map +1 -0
  56. package/lib/components/ToastBody/ToastBody.types.js +1 -0
  57. package/lib/components/ToastBody/ToastBody.types.js.map +1 -0
  58. package/lib/components/ToastBody/index.js +5 -0
  59. package/lib/components/ToastBody/index.js.map +1 -0
  60. package/lib/components/ToastBody/renderToastBody.js +8 -0
  61. package/lib/components/ToastBody/renderToastBody.js.map +1 -0
  62. package/lib/components/ToastBody/useToastBody.js +29 -0
  63. package/lib/components/ToastBody/useToastBody.js.map +1 -0
  64. package/lib/components/ToastBody/useToastBodyStyles.styles.js +32 -0
  65. package/lib/components/ToastBody/useToastBodyStyles.styles.js.map +1 -0
  66. package/lib/components/ToastContainer/ToastContainer.js +13 -0
  67. package/lib/components/ToastContainer/ToastContainer.js.map +1 -0
  68. package/lib/components/ToastContainer/ToastContainer.types.js +1 -0
  69. package/lib/components/ToastContainer/ToastContainer.types.js.map +1 -0
  70. package/lib/components/ToastContainer/index.js +6 -0
  71. package/lib/components/ToastContainer/index.js.map +1 -0
  72. package/lib/components/ToastContainer/renderToastContainer.js +21 -0
  73. package/lib/components/ToastContainer/renderToastContainer.js.map +1 -0
  74. package/lib/components/ToastContainer/useToastContainer.js +219 -0
  75. package/lib/components/ToastContainer/useToastContainer.js.map +1 -0
  76. package/lib/components/ToastContainer/useToastContainerContextValues.js +18 -0
  77. package/lib/components/ToastContainer/useToastContainerContextValues.js.map +1 -0
  78. package/lib/components/ToastContainer/useToastContainerStyles.styles.js +36 -0
  79. package/lib/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -0
  80. package/lib/components/ToastFooter/ToastFooter.js +12 -0
  81. package/lib/components/ToastFooter/ToastFooter.js.map +1 -0
  82. package/lib/components/ToastFooter/ToastFooter.types.js +1 -0
  83. package/lib/components/ToastFooter/ToastFooter.types.js.map +1 -0
  84. package/lib/components/ToastFooter/index.js +5 -0
  85. package/lib/components/ToastFooter/index.js.map +1 -0
  86. package/lib/components/ToastFooter/renderToastFooter.js +8 -0
  87. package/lib/components/ToastFooter/renderToastFooter.js.map +1 -0
  88. package/lib/components/ToastFooter/useToastFooter.js +21 -0
  89. package/lib/components/ToastFooter/useToastFooter.js.map +1 -0
  90. package/lib/components/ToastFooter/useToastFooterStyles.styles.js +17 -0
  91. package/lib/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -0
  92. package/lib/components/ToastTitle/ToastTitle.js +12 -0
  93. package/lib/components/ToastTitle/ToastTitle.js.map +1 -0
  94. package/lib/components/ToastTitle/ToastTitle.types.js +1 -0
  95. package/lib/components/ToastTitle/ToastTitle.types.js.map +1 -0
  96. package/lib/components/ToastTitle/index.js +5 -0
  97. package/lib/components/ToastTitle/index.js.map +1 -0
  98. package/lib/components/ToastTitle/renderToastTitle.js +8 -0
  99. package/lib/components/ToastTitle/renderToastTitle.js.map +1 -0
  100. package/lib/components/ToastTitle/useToastTitle.js +54 -0
  101. package/lib/components/ToastTitle/useToastTitle.js.map +1 -0
  102. package/lib/components/ToastTitle/useToastTitleStyles.styles.js +78 -0
  103. package/lib/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -0
  104. package/lib/components/ToastTrigger/ToastTrigger.js +10 -0
  105. package/lib/components/ToastTrigger/ToastTrigger.js.map +1 -0
  106. package/lib/components/ToastTrigger/ToastTrigger.types.js +1 -0
  107. package/lib/components/ToastTrigger/ToastTrigger.types.js.map +1 -0
  108. package/lib/components/ToastTrigger/index.js +4 -0
  109. package/lib/components/ToastTrigger/index.js.map +1 -0
  110. package/lib/components/ToastTrigger/renderToastTrigger.js +5 -0
  111. package/lib/components/ToastTrigger/renderToastTrigger.js.map +1 -0
  112. package/lib/components/ToastTrigger/useToastTrigger.js +36 -0
  113. package/lib/components/ToastTrigger/useToastTrigger.js.map +1 -0
  114. package/lib/components/Toaster/Toaster.js +12 -0
  115. package/lib/components/Toaster/Toaster.js.map +1 -0
  116. package/lib/components/Toaster/Toaster.types.js +1 -0
  117. package/lib/components/Toaster/Toaster.types.js.map +1 -0
  118. package/lib/components/Toaster/index.js +5 -0
  119. package/lib/components/Toaster/index.js.map +1 -0
  120. package/lib/components/Toaster/renderToaster.js +14 -0
  121. package/lib/components/Toaster/renderToaster.js.map +1 -0
  122. package/lib/components/Toaster/useToaster.js +71 -0
  123. package/lib/components/Toaster/useToaster.js.map +1 -0
  124. package/lib/components/Toaster/useToasterStyles.styles.js +43 -0
  125. package/lib/components/Toaster/useToasterStyles.styles.js.map +1 -0
  126. package/lib/contexts/toastContainerContext.js +11 -0
  127. package/lib/contexts/toastContainerContext.js.map +1 -0
  128. package/lib/index.js +7 -0
  129. package/lib/index.js.map +1 -0
  130. package/lib/state/constants.js +14 -0
  131. package/lib/state/constants.js.map +1 -0
  132. package/lib/state/index.js +5 -0
  133. package/lib/state/index.js.map +1 -0
  134. package/lib/state/types.js +1 -0
  135. package/lib/state/types.js.map +1 -0
  136. package/lib/state/useToastController.js +57 -0
  137. package/lib/state/useToastController.js.map +1 -0
  138. package/lib/state/useToaster.js +162 -0
  139. package/lib/state/useToaster.js.map +1 -0
  140. package/lib/state/vanilla/createToaster.js +137 -0
  141. package/lib/state/vanilla/createToaster.js.map +1 -0
  142. package/lib/state/vanilla/dismissAllToasts.js +11 -0
  143. package/lib/state/vanilla/dismissAllToasts.js.map +1 -0
  144. package/lib/state/vanilla/dismissToast.js +12 -0
  145. package/lib/state/vanilla/dismissToast.js.map +1 -0
  146. package/lib/state/vanilla/dispatchToast.js +16 -0
  147. package/lib/state/vanilla/dispatchToast.js.map +1 -0
  148. package/lib/state/vanilla/getPositionStyles.js +40 -0
  149. package/lib/state/vanilla/getPositionStyles.js.map +1 -0
  150. package/lib/state/vanilla/index.js +8 -0
  151. package/lib/state/vanilla/index.js.map +1 -0
  152. package/lib/state/vanilla/pauseToast.js +12 -0
  153. package/lib/state/vanilla/pauseToast.js.map +1 -0
  154. package/lib/state/vanilla/playToast.js +12 -0
  155. package/lib/state/vanilla/playToast.js.map +1 -0
  156. package/lib/state/vanilla/updateToast.js +9 -0
  157. package/lib/state/vanilla/updateToast.js.map +1 -0
  158. package/lib-commonjs/AriaLive.js +6 -0
  159. package/lib-commonjs/AriaLive.js.map +1 -0
  160. package/lib-commonjs/Toast.js +6 -0
  161. package/lib-commonjs/Toast.js.map +1 -0
  162. package/lib-commonjs/ToastBody.js +6 -0
  163. package/lib-commonjs/ToastBody.js.map +1 -0
  164. package/lib-commonjs/ToastContainer.js +6 -0
  165. package/lib-commonjs/ToastContainer.js.map +1 -0
  166. package/lib-commonjs/ToastFooter.js +6 -0
  167. package/lib-commonjs/ToastFooter.js.map +1 -0
  168. package/lib-commonjs/ToastTitle.js +6 -0
  169. package/lib-commonjs/ToastTitle.js.map +1 -0
  170. package/lib-commonjs/ToastTrigger.js +6 -0
  171. package/lib-commonjs/ToastTrigger.js.map +1 -0
  172. package/lib-commonjs/Toaster.js +6 -0
  173. package/lib-commonjs/Toaster.js.map +1 -0
  174. package/lib-commonjs/components/AriaLive/AriaLive.js +19 -0
  175. package/lib-commonjs/components/AriaLive/AriaLive.js.map +1 -0
  176. package/lib-commonjs/components/AriaLive/AriaLive.types.js +6 -0
  177. package/lib-commonjs/components/AriaLive/AriaLive.types.js.map +1 -0
  178. package/lib-commonjs/components/AriaLive/index.js +10 -0
  179. package/lib-commonjs/components/AriaLive/index.js.map +1 -0
  180. package/lib-commonjs/components/AriaLive/renderAriaLive.js +14 -0
  181. package/lib-commonjs/components/AriaLive/renderAriaLive.js.map +1 -0
  182. package/lib-commonjs/components/AriaLive/useAriaLive.js +75 -0
  183. package/lib-commonjs/components/AriaLive/useAriaLive.js.map +1 -0
  184. package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js +31 -0
  185. package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js.map +1 -0
  186. package/lib-commonjs/components/Timer/Timer.js +30 -0
  187. package/lib-commonjs/components/Timer/Timer.js.map +1 -0
  188. package/lib-commonjs/components/Timer/index.js +6 -0
  189. package/lib-commonjs/components/Timer/index.js.map +1 -0
  190. package/lib-commonjs/components/Timer/useTimerStyles.styles.js +16 -0
  191. package/lib-commonjs/components/Timer/useTimerStyles.styles.js.map +1 -0
  192. package/lib-commonjs/components/Toast/Toast.js +20 -0
  193. package/lib-commonjs/components/Toast/Toast.js.map +1 -0
  194. package/lib-commonjs/components/Toast/Toast.types.js +4 -0
  195. package/lib-commonjs/components/Toast/Toast.types.js.map +1 -0
  196. package/lib-commonjs/components/Toast/index.js +10 -0
  197. package/lib-commonjs/components/Toast/index.js.map +1 -0
  198. package/lib-commonjs/components/Toast/renderToast.js +17 -0
  199. package/lib-commonjs/components/Toast/renderToast.js.map +1 -0
  200. package/lib-commonjs/components/Toast/useToast.js +23 -0
  201. package/lib-commonjs/components/Toast/useToast.js.map +1 -0
  202. package/lib-commonjs/components/Toast/useToastContextValues.js +14 -0
  203. package/lib-commonjs/components/Toast/useToastContextValues.js.map +1 -0
  204. package/lib-commonjs/components/Toast/useToastStyles.styles.js +39 -0
  205. package/lib-commonjs/components/Toast/useToastStyles.styles.js.map +1 -0
  206. package/lib-commonjs/components/ToastBody/ToastBody.js +19 -0
  207. package/lib-commonjs/components/ToastBody/ToastBody.js.map +1 -0
  208. package/lib-commonjs/components/ToastBody/ToastBody.types.js +4 -0
  209. package/lib-commonjs/components/ToastBody/ToastBody.types.js.map +1 -0
  210. package/lib-commonjs/components/ToastBody/index.js +10 -0
  211. package/lib-commonjs/components/ToastBody/index.js.map +1 -0
  212. package/lib-commonjs/components/ToastBody/renderToastBody.js +14 -0
  213. package/lib-commonjs/components/ToastBody/renderToastBody.js.map +1 -0
  214. package/lib-commonjs/components/ToastBody/useToastBody.js +30 -0
  215. package/lib-commonjs/components/ToastBody/useToastBody.js.map +1 -0
  216. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js +47 -0
  217. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js.map +1 -0
  218. package/lib-commonjs/components/ToastContainer/ToastContainer.js +20 -0
  219. package/lib-commonjs/components/ToastContainer/ToastContainer.js.map +1 -0
  220. package/lib-commonjs/components/ToastContainer/ToastContainer.types.js +6 -0
  221. package/lib-commonjs/components/ToastContainer/ToastContainer.types.js.map +1 -0
  222. package/lib-commonjs/components/ToastContainer/index.js +11 -0
  223. package/lib-commonjs/components/ToastContainer/index.js.map +1 -0
  224. package/lib-commonjs/components/ToastContainer/renderToastContainer.js +27 -0
  225. package/lib-commonjs/components/ToastContainer/renderToastContainer.js.map +1 -0
  226. package/lib-commonjs/components/ToastContainer/useToastContainer.js +220 -0
  227. package/lib-commonjs/components/ToastContainer/useToastContainer.js.map +1 -0
  228. package/lib-commonjs/components/ToastContainer/useToastContainerContextValues.js +27 -0
  229. package/lib-commonjs/components/ToastContainer/useToastContainerContextValues.js.map +1 -0
  230. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js +64 -0
  231. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -0
  232. package/lib-commonjs/components/ToastFooter/ToastFooter.js +19 -0
  233. package/lib-commonjs/components/ToastFooter/ToastFooter.js.map +1 -0
  234. package/lib-commonjs/components/ToastFooter/ToastFooter.types.js +4 -0
  235. package/lib-commonjs/components/ToastFooter/ToastFooter.types.js.map +1 -0
  236. package/lib-commonjs/components/ToastFooter/index.js +10 -0
  237. package/lib-commonjs/components/ToastFooter/index.js.map +1 -0
  238. package/lib-commonjs/components/ToastFooter/renderToastFooter.js +14 -0
  239. package/lib-commonjs/components/ToastFooter/renderToastFooter.js.map +1 -0
  240. package/lib-commonjs/components/ToastFooter/useToastFooter.js +22 -0
  241. package/lib-commonjs/components/ToastFooter/useToastFooter.js.map +1 -0
  242. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js +28 -0
  243. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -0
  244. package/lib-commonjs/components/ToastTitle/ToastTitle.js +19 -0
  245. package/lib-commonjs/components/ToastTitle/ToastTitle.js.map +1 -0
  246. package/lib-commonjs/components/ToastTitle/ToastTitle.types.js +4 -0
  247. package/lib-commonjs/components/ToastTitle/ToastTitle.types.js.map +1 -0
  248. package/lib-commonjs/components/ToastTitle/index.js +10 -0
  249. package/lib-commonjs/components/ToastTitle/index.js.map +1 -0
  250. package/lib-commonjs/components/ToastTitle/renderToastTitle.js +14 -0
  251. package/lib-commonjs/components/ToastTitle/renderToastTitle.js.map +1 -0
  252. package/lib-commonjs/components/ToastTitle/useToastTitle.js +55 -0
  253. package/lib-commonjs/components/ToastTitle/useToastTitle.js.map +1 -0
  254. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js +107 -0
  255. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -0
  256. package/lib-commonjs/components/ToastTrigger/ToastTrigger.js +17 -0
  257. package/lib-commonjs/components/ToastTrigger/ToastTrigger.js.map +1 -0
  258. package/lib-commonjs/components/ToastTrigger/ToastTrigger.types.js +6 -0
  259. package/lib-commonjs/components/ToastTrigger/ToastTrigger.types.js.map +1 -0
  260. package/lib-commonjs/components/ToastTrigger/index.js +9 -0
  261. package/lib-commonjs/components/ToastTrigger/index.js.map +1 -0
  262. package/lib-commonjs/components/ToastTrigger/renderToastTrigger.js +13 -0
  263. package/lib-commonjs/components/ToastTrigger/renderToastTrigger.js.map +1 -0
  264. package/lib-commonjs/components/ToastTrigger/useToastTrigger.js +37 -0
  265. package/lib-commonjs/components/ToastTrigger/useToastTrigger.js.map +1 -0
  266. package/lib-commonjs/components/Toaster/Toaster.js +19 -0
  267. package/lib-commonjs/components/Toaster/Toaster.js.map +1 -0
  268. package/lib-commonjs/components/Toaster/Toaster.types.js +4 -0
  269. package/lib-commonjs/components/Toaster/Toaster.types.js.map +1 -0
  270. package/lib-commonjs/components/Toaster/index.js +10 -0
  271. package/lib-commonjs/components/Toaster/index.js.map +1 -0
  272. package/lib-commonjs/components/Toaster/renderToaster.js +20 -0
  273. package/lib-commonjs/components/Toaster/renderToaster.js.map +1 -0
  274. package/lib-commonjs/components/Toaster/useToaster.js +76 -0
  275. package/lib-commonjs/components/Toaster/useToaster.js.map +1 -0
  276. package/lib-commonjs/components/Toaster/useToasterStyles.styles.js +54 -0
  277. package/lib-commonjs/components/Toaster/useToasterStyles.styles.js.map +1 -0
  278. package/lib-commonjs/contexts/toastContainerContext.js +26 -0
  279. package/lib-commonjs/contexts/toastContainerContext.js.map +1 -0
  280. package/lib-commonjs/index.js +48 -0
  281. package/lib-commonjs/index.js.map +1 -0
  282. package/lib-commonjs/state/constants.js +28 -0
  283. package/lib-commonjs/state/constants.js.map +1 -0
  284. package/lib-commonjs/state/index.js +20 -0
  285. package/lib-commonjs/state/index.js.map +1 -0
  286. package/lib-commonjs/state/types.js +6 -0
  287. package/lib-commonjs/state/types.js.map +1 -0
  288. package/lib-commonjs/state/useToastController.js +63 -0
  289. package/lib-commonjs/state/useToastController.js.map +1 -0
  290. package/lib-commonjs/state/useToaster.js +171 -0
  291. package/lib-commonjs/state/useToaster.js.map +1 -0
  292. package/lib-commonjs/state/vanilla/createToaster.js +142 -0
  293. package/lib-commonjs/state/vanilla/createToaster.js.map +1 -0
  294. package/lib-commonjs/state/vanilla/dismissAllToasts.js +19 -0
  295. package/lib-commonjs/state/vanilla/dismissAllToasts.js.map +1 -0
  296. package/lib-commonjs/state/vanilla/dismissToast.js +20 -0
  297. package/lib-commonjs/state/vanilla/dismissToast.js.map +1 -0
  298. package/lib-commonjs/state/vanilla/dispatchToast.js +24 -0
  299. package/lib-commonjs/state/vanilla/dispatchToast.js.map +1 -0
  300. package/lib-commonjs/state/vanilla/getPositionStyles.js +48 -0
  301. package/lib-commonjs/state/vanilla/getPositionStyles.js.map +1 -0
  302. package/lib-commonjs/state/vanilla/index.js +13 -0
  303. package/lib-commonjs/state/vanilla/index.js.map +1 -0
  304. package/lib-commonjs/state/vanilla/pauseToast.js +20 -0
  305. package/lib-commonjs/state/vanilla/pauseToast.js.map +1 -0
  306. package/lib-commonjs/state/vanilla/playToast.js +20 -0
  307. package/lib-commonjs/state/vanilla/playToast.js.map +1 -0
  308. package/lib-commonjs/state/vanilla/updateToast.js +17 -0
  309. package/lib-commonjs/state/vanilla/updateToast.js.map +1 -0
  310. package/package.json +71 -0
@@ -0,0 +1,8 @@
1
+ /** @jsxRuntime classic */ /** @jsxFrag Fragment */ /** @jsx createElement */ import { createElement, Fragment } from '@fluentui/react-jsx-runtime';
2
+ import { getSlotsNext } from '@fluentui/react-utilities';
3
+ /**
4
+ * Render the final JSX of AriaLive
5
+ */ export const renderAriaLive_unstable = (state)=>{
6
+ const { slots , slotProps } = getSlotsNext(state);
7
+ return /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement(slots.assertive, slotProps.assertive), /*#__PURE__*/ createElement(slots.polite, slotProps.polite));
8
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["renderAriaLive.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsxFrag Fragment */\n/** @jsx createElement */\n\nimport { createElement, Fragment } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { AriaLiveState, AriaLiveSlots } from './AriaLive.types';\n\n/**\n * Render the final JSX of AriaLive\n */\nexport const renderAriaLive_unstable = (state: AriaLiveState) => {\n const { slots, slotProps } = getSlotsNext<AriaLiveSlots>(state);\n\n return (\n <>\n <slots.assertive {...slotProps.assertive} />\n <slots.polite {...slotProps.polite} />\n </>\n );\n};\n"],"names":["createElement","Fragment","getSlotsNext","renderAriaLive_unstable","state","slots","slotProps","assertive","polite"],"mappings":"AAAA,wBAAwB,GACxB,sBAAsB,GACtB,uBAAuB,GAEvB,SAASA,aAAa,EAAEC,QAAQ,QAAQ,8BAA8B;AACtE,SAASC,YAAY,QAAQ,4BAA4B;AAGzD;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC,QAAyB;IAC/D,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGJ,aAA4BE;IAEzD,qBACE,AAbJ,cADA,8BAeM,AAdN,cAcOC,MAAME,SAAS,EAAKD,UAAUC,SAAS,iBACxC,AAfN,cAeOF,MAAMG,MAAM,EAAKF,UAAUE,MAAM;AAGxC,EAAE"}
@@ -0,0 +1,73 @@
1
+ import * as React from 'react';
2
+ import { resolveShorthand, createPriorityQueue, useEventCallback } from '@fluentui/react-utilities';
3
+ /** The duration the message needs to be in present in DOM for screen readers to register a change and announce */ const MESSAGE_DURATION = 500;
4
+ /**
5
+ * Create the state required to render AriaLive.
6
+ *
7
+ * The returned state can be modified with hooks such as useAriaLiveStyles_unstable,
8
+ * before being passed to renderAriaLive_unstable.
9
+ *
10
+ * @param props - props from this instance of AriaLive
11
+ */ export const useAriaLive_unstable = (props)=>{
12
+ const [currentMessage, setCurrentMessage] = React.useState(undefined);
13
+ // Can't rely on Date.now() if user invokes announce more than once in a code block
14
+ const order = React.useRef(0);
15
+ const [messageQueue] = React.useState(()=>createPriorityQueue((a, b)=>{
16
+ if (a.politeness === b.politeness) {
17
+ return a.createdAt - b.createdAt;
18
+ }
19
+ return a.politeness === 'assertive' ? -1 : 1;
20
+ }));
21
+ const announce = useEventCallback((message, options)=>{
22
+ const { politeness } = options;
23
+ if (message === (currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.message)) {
24
+ return;
25
+ }
26
+ const liveMessage = {
27
+ message,
28
+ politeness,
29
+ createdAt: order.current++
30
+ };
31
+ if (!currentMessage) {
32
+ setCurrentMessage(liveMessage);
33
+ } else {
34
+ messageQueue.enqueue(liveMessage);
35
+ }
36
+ });
37
+ React.useEffect(()=>{
38
+ const timeout = setTimeout(()=>{
39
+ if (messageQueue.peek()) {
40
+ setCurrentMessage(messageQueue.dequeue());
41
+ } else {
42
+ setCurrentMessage(undefined);
43
+ }
44
+ }, MESSAGE_DURATION);
45
+ return ()=>clearTimeout(timeout);
46
+ }, [
47
+ currentMessage,
48
+ messageQueue
49
+ ]);
50
+ React.useImperativeHandle(props.announceRef, ()=>announce);
51
+ const politeMessage = (currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.politeness) === 'polite' ? currentMessage.message : undefined;
52
+ const assertiveMessage = (currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.politeness) === 'assertive' ? currentMessage.message : undefined;
53
+ return {
54
+ components: {
55
+ assertive: 'div',
56
+ polite: 'div'
57
+ },
58
+ assertive: resolveShorthand(props.assertive, {
59
+ required: true,
60
+ defaultProps: {
61
+ 'aria-live': 'assertive',
62
+ children: assertiveMessage
63
+ }
64
+ }),
65
+ polite: resolveShorthand(props.polite, {
66
+ required: true,
67
+ defaultProps: {
68
+ 'aria-live': 'polite',
69
+ children: politeMessage
70
+ }
71
+ })
72
+ };
73
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useAriaLive.ts"],"sourcesContent":["import * as React from 'react';\nimport { resolveShorthand, createPriorityQueue, useEventCallback } from '@fluentui/react-utilities';\nimport type { AnnounceOptions, AriaLiveProps, AriaLiveState, LiveMessage } from './AriaLive.types';\n\n/** The duration the message needs to be in present in DOM for screen readers to register a change and announce */\nconst MESSAGE_DURATION = 500;\n\n/**\n * Create the state required to render AriaLive.\n *\n * The returned state can be modified with hooks such as useAriaLiveStyles_unstable,\n * before being passed to renderAriaLive_unstable.\n *\n * @param props - props from this instance of AriaLive\n */\nexport const useAriaLive_unstable = (props: AriaLiveProps): AriaLiveState => {\n const [currentMessage, setCurrentMessage] = React.useState<LiveMessage | undefined>(undefined);\n // Can't rely on Date.now() if user invokes announce more than once in a code block\n const order = React.useRef(0);\n const [messageQueue] = React.useState(() =>\n createPriorityQueue<LiveMessage>((a, b) => {\n if (a.politeness === b.politeness) {\n return a.createdAt - b.createdAt;\n }\n\n return a.politeness === 'assertive' ? -1 : 1;\n }),\n );\n\n const announce = useEventCallback((message: string, options: AnnounceOptions) => {\n const { politeness } = options;\n if (message === currentMessage?.message) {\n return;\n }\n\n const liveMessage: LiveMessage = {\n message,\n politeness,\n createdAt: order.current++,\n };\n\n if (!currentMessage) {\n setCurrentMessage(liveMessage);\n } else {\n messageQueue.enqueue(liveMessage);\n }\n });\n\n React.useEffect(() => {\n const timeout = setTimeout(() => {\n if (messageQueue.peek()) {\n setCurrentMessage(messageQueue.dequeue());\n } else {\n setCurrentMessage(undefined);\n }\n }, MESSAGE_DURATION);\n\n return () => clearTimeout(timeout);\n }, [currentMessage, messageQueue]);\n\n React.useImperativeHandle(props.announceRef, () => announce);\n\n const politeMessage = currentMessage?.politeness === 'polite' ? currentMessage.message : undefined;\n const assertiveMessage = currentMessage?.politeness === 'assertive' ? currentMessage.message : undefined;\n\n return {\n components: {\n assertive: 'div',\n polite: 'div',\n },\n\n assertive: resolveShorthand(props.assertive, {\n required: true,\n defaultProps: { 'aria-live': 'assertive', children: assertiveMessage },\n }),\n polite: resolveShorthand(props.polite, {\n required: true,\n defaultProps: { 'aria-live': 'polite', children: politeMessage },\n }),\n };\n};\n"],"names":["React","resolveShorthand","createPriorityQueue","useEventCallback","MESSAGE_DURATION","useAriaLive_unstable","props","currentMessage","setCurrentMessage","useState","undefined","order","useRef","messageQueue","a","b","politeness","createdAt","announce","message","options","liveMessage","current","enqueue","useEffect","timeout","setTimeout","peek","dequeue","clearTimeout","useImperativeHandle","announceRef","politeMessage","assertiveMessage","components","assertive","polite","required","defaultProps","children"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,EAAEC,mBAAmB,EAAEC,gBAAgB,QAAQ,4BAA4B;AAGpG,gHAAgH,GAChH,MAAMC,mBAAmB;AAEzB;;;;;;;CAOC,GACD,OAAO,MAAMC,uBAAuB,CAACC,QAAwC;IAC3E,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGR,MAAMS,QAAQ,CAA0BC;IACpF,mFAAmF;IACnF,MAAMC,QAAQX,MAAMY,MAAM,CAAC;IAC3B,MAAM,CAACC,aAAa,GAAGb,MAAMS,QAAQ,CAAC,IACpCP,oBAAiC,CAACY,GAAGC,IAAM;YACzC,IAAID,EAAEE,UAAU,KAAKD,EAAEC,UAAU,EAAE;gBACjC,OAAOF,EAAEG,SAAS,GAAGF,EAAEE,SAAS;YAClC,CAAC;YAED,OAAOH,EAAEE,UAAU,KAAK,cAAc,CAAC,IAAI,CAAC;QAC9C;IAGF,MAAME,WAAWf,iBAAiB,CAACgB,SAAiBC,UAA6B;QAC/E,MAAM,EAAEJ,WAAU,EAAE,GAAGI;QACvB,IAAID,YAAYZ,CAAAA,2BAAAA,4BAAAA,KAAAA,IAAAA,eAAgBY,OAAO,AAAD,GAAG;YACvC;QACF,CAAC;QAED,MAAME,cAA2B;YAC/BF;YACAH;YACAC,WAAWN,MAAMW,OAAO;QAC1B;QAEA,IAAI,CAACf,gBAAgB;YACnBC,kBAAkBa;QACpB,OAAO;YACLR,aAAaU,OAAO,CAACF;QACvB,CAAC;IACH;IAEArB,MAAMwB,SAAS,CAAC,IAAM;QACpB,MAAMC,UAAUC,WAAW,IAAM;YAC/B,IAAIb,aAAac,IAAI,IAAI;gBACvBnB,kBAAkBK,aAAae,OAAO;YACxC,OAAO;gBACLpB,kBAAkBE;YACpB,CAAC;QACH,GAAGN;QAEH,OAAO,IAAMyB,aAAaJ;IAC5B,GAAG;QAAClB;QAAgBM;KAAa;IAEjCb,MAAM8B,mBAAmB,CAACxB,MAAMyB,WAAW,EAAE,IAAMb;IAEnD,MAAMc,gBAAgBzB,CAAAA,2BAAAA,4BAAAA,KAAAA,IAAAA,eAAgBS,UAAU,AAAD,MAAM,WAAWT,eAAeY,OAAO,GAAGT,SAAS;IAClG,MAAMuB,mBAAmB1B,CAAAA,2BAAAA,4BAAAA,KAAAA,IAAAA,eAAgBS,UAAU,AAAD,MAAM,cAAcT,eAAeY,OAAO,GAAGT,SAAS;IAExG,OAAO;QACLwB,YAAY;YACVC,WAAW;YACXC,QAAQ;QACV;QAEAD,WAAWlC,iBAAiBK,MAAM6B,SAAS,EAAE;YAC3CE,UAAU,IAAI;YACdC,cAAc;gBAAE,aAAa;gBAAaC,UAAUN;YAAiB;QACvE;QACAG,QAAQnC,iBAAiBK,MAAM8B,MAAM,EAAE;YACrCC,UAAU,IAAI;YACdC,cAAc;gBAAE,aAAa;gBAAUC,UAAUP;YAAc;QACjE;IACF;AACF,EAAE"}
@@ -0,0 +1,19 @@
1
+ import { mergeClasses, shorthands, __resetStyles } from '@griffel/react';
2
+ export const ariaLiveClassNames = {
3
+ assertive: 'fui-AriaLive__assertive',
4
+ polite: 'fui-AriaLive__polite'
5
+ };
6
+ /**
7
+ * Styles for the root slot
8
+ */
9
+ const useResetStyles = /*#__PURE__*/__resetStyles("rsuwu0d", "r1m1grr4", [".rsuwu0d{clip:rect(0px, 0px, 0px, 0px);height:1px;margin-top:-1px;margin-right:-1px;margin-bottom:-1px;margin-left:-1px;overflow-x:hidden;overflow-y:hidden;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;width:1px;position:absolute;}", ".r1m1grr4{clip:rect(0px, 0px, 0px, 0px);height:1px;margin-top:-1px;margin-left:-1px;margin-bottom:-1px;margin-right:-1px;overflow-x:hidden;overflow-y:hidden;padding-top:0px;padding-left:0px;padding-bottom:0px;padding-right:0px;width:1px;position:absolute;}"]);
10
+ /**
11
+ * Apply styling to the AriaLive slots based on the state
12
+ */
13
+ export const useAriaLiveStyles_unstable = state => {
14
+ const visuallyHidden = useResetStyles();
15
+ state.assertive.className = mergeClasses(visuallyHidden, ariaLiveClassNames.assertive, state.assertive.className);
16
+ state.polite.className = mergeClasses(visuallyHidden, ariaLiveClassNames.polite, state.polite.className);
17
+ return state;
18
+ };
19
+ //# sourceMappingURL=useAriaLiveStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["mergeClasses","shorthands","__resetStyles","ariaLiveClassNames","assertive","polite","useResetStyles","useAriaLiveStyles_unstable","state","visuallyHidden","className"],"sources":["useAriaLiveStyles.styles.js"],"sourcesContent":["import { mergeClasses, shorthands, makeResetStyles } from '@griffel/react';\nexport const ariaLiveClassNames = {\n assertive: 'fui-AriaLive__assertive',\n polite: 'fui-AriaLive__polite'\n};\n/**\n * Styles for the root slot\n */ const useResetStyles = makeResetStyles({\n clip: 'rect(0px, 0px, 0px, 0px)',\n height: '1px',\n ...shorthands.margin('-1px'),\n ...shorthands.overflow('hidden'),\n ...shorthands.padding('0px'),\n width: '1px',\n position: 'absolute'\n});\n/**\n * Apply styling to the AriaLive slots based on the state\n */ export const useAriaLiveStyles_unstable = (state)=>{\n const visuallyHidden = useResetStyles();\n state.assertive.className = mergeClasses(visuallyHidden, ariaLiveClassNames.assertive, state.assertive.className);\n state.polite.className = mergeClasses(visuallyHidden, ariaLiveClassNames.polite, state.polite.className);\n return state;\n};\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,UAAU,EAAAC,aAAA,QAAyB,gBAAgB;AAC1E,OAAO,MAAMC,kBAAkB,GAAG;EAC9BC,SAAS,EAAE,yBAAyB;EACpCC,MAAM,EAAE;AACZ,CAAC;AACD;AACA;AACA;AAAI,MAAMC,cAAc,gBAAGJ,aAAA,+hBAQ1B,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMK,0BAA0B,GAAIC,KAAK,IAAG;EACnD,MAAMC,cAAc,GAAGH,cAAc,CAAC,CAAC;EACvCE,KAAK,CAACJ,SAAS,CAACM,SAAS,GAAGV,YAAY,CAACS,cAAc,EAAEN,kBAAkB,CAACC,SAAS,EAAEI,KAAK,CAACJ,SAAS,CAACM,SAAS,CAAC;EACjHF,KAAK,CAACH,MAAM,CAACK,SAAS,GAAGV,YAAY,CAACS,cAAc,EAAEN,kBAAkB,CAACE,MAAM,EAAEG,KAAK,CAACH,MAAM,CAACK,SAAS,CAAC;EACxG,OAAOF,KAAK;AAChB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { useBaseAnimationStyles } from './useTimerStyles.styles';
3
+ export const Timer = /*#__PURE__*/ React.forwardRef((props, ref)=>{
4
+ const baseAnimationStyles = useBaseAnimationStyles();
5
+ const { running , timeout , onTimeout } = props;
6
+ const style = {
7
+ animationDuration: `${timeout}ms`,
8
+ animationPlayState: running ? 'running' : 'paused'
9
+ };
10
+ if (timeout < 0) {
11
+ return null;
12
+ }
13
+ return /*#__PURE__*/ React.createElement("span", {
14
+ onAnimationEnd: onTimeout,
15
+ "data-timer-status": style.animationPlayState,
16
+ ref: ref,
17
+ style: style,
18
+ className: baseAnimationStyles
19
+ });
20
+ });
21
+ Timer.displayName = 'Timer';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Timer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useBaseAnimationStyles } from './useTimerStyles.styles';\n\nexport type TimerProps = {\n running: boolean;\n timeout: number;\n onTimeout: () => void;\n as?: 'span';\n};\n\nexport const Timer = React.forwardRef<HTMLDivElement, TimerProps>((props, ref) => {\n const baseAnimationStyles = useBaseAnimationStyles();\n const { running, timeout, onTimeout } = props;\n\n const style: React.CSSProperties = {\n animationDuration: `${timeout}ms`,\n animationPlayState: running ? 'running' : 'paused',\n };\n\n if (timeout < 0) {\n return null;\n }\n\n return (\n <span\n onAnimationEnd={onTimeout}\n data-timer-status={style.animationPlayState}\n ref={ref}\n style={style}\n className={baseAnimationStyles}\n />\n );\n});\n\nTimer.displayName = 'Timer';\n"],"names":["React","useBaseAnimationStyles","Timer","forwardRef","props","ref","baseAnimationStyles","running","timeout","onTimeout","style","animationDuration","animationPlayState","span","onAnimationEnd","data-timer-status","className","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsB,QAAQ,0BAA0B;AASjE,OAAO,MAAMC,sBAAQF,MAAMG,UAAU,CAA6B,CAACC,OAAOC,MAAQ;IAChF,MAAMC,sBAAsBL;IAC5B,MAAM,EAAEM,QAAO,EAAEC,QAAO,EAAEC,UAAS,EAAE,GAAGL;IAExC,MAAMM,QAA6B;QACjCC,mBAAmB,CAAC,EAAEH,QAAQ,EAAE,CAAC;QACjCI,oBAAoBL,UAAU,YAAY,QAAQ;IACpD;IAEA,IAAIC,UAAU,GAAG;QACf,OAAO,IAAI;IACb,CAAC;IAED,qBACE,oBAACK;QACCC,gBAAgBL;QAChBM,qBAAmBL,MAAME,kBAAkB;QAC3CP,KAAKA;QACLK,OAAOA;QACPM,WAAWV;;AAGjB,GAAG;AAEHJ,MAAMe,WAAW,GAAG"}
@@ -0,0 +1 @@
1
+ export * from './Timer';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Timer';\n"],"names":[],"mappings":"AAAA,cAAc,UAAU"}
@@ -0,0 +1,3 @@
1
+ import { __resetStyles } from '@griffel/react';
2
+ export const useBaseAnimationStyles = /*#__PURE__*/__resetStyles("r17x0t3n", "r75casi", [".r17x0t3n{-webkit-animation-name:rsacmq1;animation-name:rsacmq1;}", "@-webkit-keyframes rsacmq1{from{opacity:0;}to{opacity:0;}}", "@-webkit-keyframes rsacmq1{from{opacity:0;}to{opacity:0;}}", "@keyframes rsacmq1{from{opacity:0;}to{opacity:0;}}", ".r75casi{-webkit-animation-name:rsacmq1;animation-name:rsacmq1;}"]);
3
+ //# sourceMappingURL=useTimerStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__resetStyles","useBaseAnimationStyles"],"sources":["useTimerStyles.styles.js"],"sourcesContent":["import { makeResetStyles } from '@griffel/react';\nexport const useBaseAnimationStyles = makeResetStyles({\n animationName: {\n from: {\n opacity: 0\n },\n to: {\n opacity: 0\n }\n }\n});\n"],"mappings":"AAAA,SAAAA,aAAA,QAAgC,gBAAgB;AAChD,OAAO,MAAMC,sBAAsB,gBAAGD,aAAA,mVASrC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ import { useToast_unstable } from './useToast';
3
+ import { renderToast_unstable } from './renderToast';
4
+ import { useToastStyles_unstable } from './useToastStyles.styles';
5
+ import { useToastContextValues_unstable } from './useToastContextValues';
6
+ /**
7
+ * Toast component
8
+ */ export const Toast = /*#__PURE__*/ React.forwardRef((props, ref)=>{
9
+ const state = useToast_unstable(props, ref);
10
+ useToastStyles_unstable(state);
11
+ return renderToast_unstable(state, useToastContextValues_unstable(state));
12
+ });
13
+ Toast.displayName = 'Toast';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Toast.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToast_unstable } from './useToast';\nimport { renderToast_unstable } from './renderToast';\nimport { useToastStyles_unstable } from './useToastStyles.styles';\nimport type { ToastProps } from './Toast.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useToastContextValues_unstable } from './useToastContextValues';\n\n/**\n * Toast component\n */\nexport const Toast: ForwardRefComponent<ToastProps> = React.forwardRef((props, ref) => {\n const state = useToast_unstable(props, ref);\n\n useToastStyles_unstable(state);\n return renderToast_unstable(state, useToastContextValues_unstable(state));\n});\n\nToast.displayName = 'Toast';\n"],"names":["React","useToast_unstable","renderToast_unstable","useToastStyles_unstable","useToastContextValues_unstable","Toast","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,uBAAuB,QAAQ,0BAA0B;AAGlE,SAASC,8BAA8B,QAAQ,0BAA0B;AAEzE;;CAEC,GACD,OAAO,MAAMC,sBAAyCL,MAAMM,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACrF,MAAMC,QAAQR,kBAAkBM,OAAOC;IAEvCL,wBAAwBM;IACxB,OAAOP,qBAAqBO,OAAOL,+BAA+BK;AACpE,GAAG;AAEHJ,MAAMK,WAAW,GAAG"}
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Toast.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { BackgroundAppearanceContextValue } from '@fluentui/react-shared-contexts';\n\nexport type ToastSlots = {\n root: Slot<'div'>;\n};\n\nexport type ToastContextValues = {\n backgroundAppearance: BackgroundAppearanceContextValue;\n};\n\n/**\n * Toast Props\n */\nexport type ToastProps = ComponentProps<ToastSlots> & {\n appearance?: BackgroundAppearanceContextValue;\n};\n\n/**\n * State used in rendering Toast\n */\nexport type ToastState = ComponentState<ToastSlots> & {\n backgroundAppearance: BackgroundAppearanceContextValue;\n};\n"],"names":[],"mappings":"AAAA,WAuBE"}
@@ -0,0 +1,5 @@
1
+ export * from './Toast';
2
+ export * from './Toast.types';
3
+ export * from './renderToast';
4
+ export * from './useToast';
5
+ export * from './useToastStyles.styles';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Toast';\nexport * from './Toast.types';\nexport * from './renderToast';\nexport * from './useToast';\nexport * from './useToastStyles.styles';\n"],"names":[],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB;AAC9B,cAAc,aAAa;AAC3B,cAAc,0BAA0B"}
@@ -0,0 +1,11 @@
1
+ /** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
2
+ import { getSlotsNext } from '@fluentui/react-utilities';
3
+ import { BackgroundAppearanceProvider } from '@fluentui/react-shared-contexts';
4
+ /**
5
+ * Render the final JSX of Toast
6
+ */ export const renderToast_unstable = (state, contextValues)=>{
7
+ const { slots , slotProps } = getSlotsNext(state);
8
+ return /*#__PURE__*/ createElement(BackgroundAppearanceProvider, {
9
+ value: contextValues.backgroundAppearance
10
+ }, /*#__PURE__*/ createElement(slots.root, slotProps.root));
11
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["renderToast.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport { BackgroundAppearanceProvider } from '@fluentui/react-shared-contexts';\nimport type { ToastState, ToastSlots, ToastContextValues } from './Toast.types';\n\n/**\n * Render the final JSX of Toast\n */\nexport const renderToast_unstable = (state: ToastState, contextValues: ToastContextValues) => {\n const { slots, slotProps } = getSlotsNext<ToastSlots>(state);\n\n return (\n <BackgroundAppearanceProvider value={contextValues.backgroundAppearance}>\n <slots.root {...slotProps.root} />\n </BackgroundAppearanceProvider>\n );\n};\n"],"names":["createElement","getSlotsNext","BackgroundAppearanceProvider","renderToast_unstable","state","contextValues","slots","slotProps","value","backgroundAppearance","root"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,YAAY,QAAQ,4BAA4B;AACzD,SAASC,4BAA4B,QAAQ,kCAAkC;AAG/E;;CAEC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAmBC,gBAAsC;IAC5F,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGN,aAAyBG;IAEtD,qBACE,AAdJ,cAcKF;QAA6BM,OAAOH,cAAcI,oBAAoB;qBACrE,AAfN,cAeOH,MAAMI,IAAI,EAAKH,UAAUG,IAAI;AAGpC,EAAE"}
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ import { getNativeElementProps } from '@fluentui/react-utilities';
3
+ /**
4
+ * Create the state required to render Toast.
5
+ *
6
+ * The returned state can be modified with hooks such as useToastStyles_unstable,
7
+ * before being passed to renderToast_unstable.
8
+ *
9
+ * @param props - props from this instance of Toast
10
+ * @param ref - reference to root HTMLElement of Toast
11
+ */ export const useToast_unstable = (props, ref)=>{
12
+ return {
13
+ components: {
14
+ root: 'div'
15
+ },
16
+ root: getNativeElementProps('div', {
17
+ ref,
18
+ ...props
19
+ }),
20
+ backgroundAppearance: props.appearance
21
+ };
22
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useToast.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { ToastProps, ToastState } from './Toast.types';\n\n/**\n * Create the state required to render Toast.\n *\n * The returned state can be modified with hooks such as useToastStyles_unstable,\n * before being passed to renderToast_unstable.\n *\n * @param props - props from this instance of Toast\n * @param ref - reference to root HTMLElement of Toast\n */\nexport const useToast_unstable = (props: ToastProps, ref: React.Ref<HTMLElement>): ToastState => {\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref,\n ...props,\n }),\n backgroundAppearance: props.appearance,\n };\n};\n"],"names":["React","getNativeElementProps","useToast_unstable","props","ref","components","root","backgroundAppearance","appearance"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,4BAA4B;AAGlE;;;;;;;;CAQC,GACD,OAAO,MAAMC,oBAAoB,CAACC,OAAmBC,MAA4C;IAC/F,OAAO;QACLC,YAAY;YACVC,MAAM;QACR;QACAA,MAAML,sBAAsB,OAAO;YACjCG;YACA,GAAGD,KAAK;QACV;QACAI,sBAAsBJ,MAAMK,UAAU;IACxC;AACF,EAAE"}
@@ -0,0 +1,6 @@
1
+ export function useToastContextValues_unstable(state) {
2
+ const { backgroundAppearance } = state;
3
+ return {
4
+ backgroundAppearance
5
+ };
6
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useToastContextValues.ts"],"sourcesContent":["import { ToastContextValues, ToastState } from './Toast.types';\n\nexport function useToastContextValues_unstable(state: ToastState): ToastContextValues {\n const { backgroundAppearance } = state;\n\n return {\n backgroundAppearance,\n };\n}\n"],"names":["useToastContextValues_unstable","state","backgroundAppearance"],"mappings":"AAEA,OAAO,SAASA,+BAA+BC,KAAiB,EAAsB;IACpF,MAAM,EAAEC,qBAAoB,EAAE,GAAGD;IAEjC,OAAO;QACLC;IACF;AACF,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';
2
+ import { tokens } from '@fluentui/react-theme';
3
+ export const toastClassNames = {
4
+ root: 'fui-Toast'
5
+ };
6
+ const useRootBaseClassName = /*#__PURE__*/__resetStyles("rzyoxeq", "r1lipnsg", [".rzyoxeq{display:-ms-grid;display:grid;-ms-grid-columns:auto 1fr auto;grid-template-columns:auto 1fr auto;padding-top:12px;padding-right:12px;padding-bottom:12px;padding-left:12px;border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-width:1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:var(--colorTransparentStroke);border-right-color:var(--colorTransparentStroke);border-bottom-color:var(--colorTransparentStroke);border-left-color:var(--colorTransparentStroke);box-shadow:var(--shadow8);font-size:var(--fontSizeBase300);line-height:20px;font-weight:var(--fontWeightSemibold);color:var(--colorNeutralForeground1);background-color:var(--colorNeutralBackground1);}", ".r1lipnsg{display:-ms-grid;display:grid;-ms-grid-columns:auto 1fr auto;grid-template-columns:auto 1fr auto;padding-top:12px;padding-left:12px;padding-bottom:12px;padding-right:12px;border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-width:1px;border-left-width:1px;border-bottom-width:1px;border-right-width:1px;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;border-top-color:var(--colorTransparentStroke);border-left-color:var(--colorTransparentStroke);border-bottom-color:var(--colorTransparentStroke);border-right-color:var(--colorTransparentStroke);box-shadow:var(--shadow8);font-size:var(--fontSizeBase300);line-height:20px;font-weight:var(--fontWeightSemibold);color:var(--colorNeutralForeground1);background-color:var(--colorNeutralBackground1);}"]);
7
+ const useStyles = /*#__PURE__*/__styles({
8
+ inverted: {
9
+ sj55zd: "f1w7i9ko",
10
+ De3pzq: "f5pduvr"
11
+ }
12
+ }, {
13
+ d: [".f1w7i9ko{color:var(--colorNeutralForegroundInverted2);}", ".f5pduvr{background-color:var(--colorNeutralBackgroundInverted);}"]
14
+ });
15
+ /**
16
+ * Apply styling to the Toast slots based on the state
17
+ */
18
+ export const useToastStyles_unstable = state => {
19
+ const rootBaseClassName = useRootBaseClassName();
20
+ const styles = useStyles();
21
+ state.root.className = mergeClasses(toastClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && styles.inverted, state.root.className);
22
+ return state;
23
+ };
24
+ //# sourceMappingURL=useToastStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__resetStyles","__styles","mergeClasses","shorthands","tokens","toastClassNames","root","useRootBaseClassName","useStyles","inverted","sj55zd","De3pzq","d","useToastStyles_unstable","state","rootBaseClassName","styles","className","backgroundAppearance"],"sources":["useToastStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastClassNames = {\n root: 'fui-Toast'\n};\nconst useRootBaseClassName = makeResetStyles({\n display: 'grid',\n gridTemplateColumns: 'auto 1fr auto',\n ...shorthands.padding('12px', '12px'),\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n boxShadow: tokens.shadow8,\n fontSize: tokens.fontSizeBase300,\n lineHeight: '20px',\n fontWeight: tokens.fontWeightSemibold,\n color: tokens.colorNeutralForeground1,\n backgroundColor: tokens.colorNeutralBackground1\n});\nconst useStyles = makeStyles({\n inverted: {\n color: tokens.colorNeutralForegroundInverted2,\n backgroundColor: tokens.colorNeutralBackgroundInverted\n }\n});\n/**\n * Apply styling to the Toast slots based on the state\n */ export const useToastStyles_unstable = (state)=>{\n const rootBaseClassName = useRootBaseClassName();\n const styles = useStyles();\n state.root.className = mergeClasses(toastClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && styles.inverted, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACtF,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,eAAe,GAAG;EAC3BC,IAAI,EAAE;AACV,CAAC;AACD,MAAMC,oBAAoB,gBAAGP,aAAA,66DAY5B,CAAC;AACF,MAAMQ,SAAS,gBAAGP,QAAA;EAAAQ,QAAA;IAAAC,MAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAKjB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,uBAAuB,GAAIC,KAAK,IAAG;EAChD,MAAMC,iBAAiB,GAAGR,oBAAoB,CAAC,CAAC;EAChD,MAAMS,MAAM,GAAGR,SAAS,CAAC,CAAC;EAC1BM,KAAK,CAACR,IAAI,CAACW,SAAS,GAAGf,YAAY,CAACG,eAAe,CAACC,IAAI,EAAES,iBAAiB,EAAED,KAAK,CAACI,oBAAoB,KAAK,UAAU,IAAIF,MAAM,CAACP,QAAQ,EAAEK,KAAK,CAACR,IAAI,CAACW,SAAS,CAAC;EAChK,OAAOH,KAAK;AAChB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { useToastBody_unstable } from './useToastBody';
3
+ import { renderToastBody_unstable } from './renderToastBody';
4
+ import { useToastBodyStyles_unstable } from './useToastBodyStyles.styles';
5
+ /**
6
+ * ToastBody component
7
+ */ export const ToastBody = /*#__PURE__*/ React.forwardRef((props, ref)=>{
8
+ const state = useToastBody_unstable(props, ref);
9
+ useToastBodyStyles_unstable(state);
10
+ return renderToastBody_unstable(state);
11
+ });
12
+ ToastBody.displayName = 'ToastBody';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["ToastBody.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastBody_unstable } from './useToastBody';\nimport { renderToastBody_unstable } from './renderToastBody';\nimport { useToastBodyStyles_unstable } from './useToastBodyStyles.styles';\nimport type { ToastBodyProps } from './ToastBody.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * ToastBody component\n */\nexport const ToastBody: ForwardRefComponent<ToastBodyProps> = React.forwardRef((props, ref) => {\n const state = useToastBody_unstable(props, ref);\n\n useToastBodyStyles_unstable(state);\n return renderToastBody_unstable(state);\n});\n\nToastBody.displayName = 'ToastBody';\n"],"names":["React","useToastBody_unstable","renderToastBody_unstable","useToastBodyStyles_unstable","ToastBody","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,2BAA2B,QAAQ,8BAA8B;AAI1E;;CAEC,GACD,OAAO,MAAMC,0BAAiDJ,MAAMK,UAAU,CAAC,CAACC,OAAOC,MAAQ;IAC7F,MAAMC,QAAQP,sBAAsBK,OAAOC;IAE3CJ,4BAA4BK;IAC5B,OAAON,yBAAyBM;AAClC,GAAG;AAEHJ,UAAUK,WAAW,GAAG"}
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["ToastBody.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { BackgroundAppearanceContextValue } from '@fluentui/react-shared-contexts';\n\nexport type ToastBodySlots = {\n root: Slot<'div'>;\n subtitle?: Slot<'div'>;\n};\n\n/**\n * ToastBody Props\n */\nexport type ToastBodyProps = ComponentProps<ToastBodySlots> & {};\n\n/**\n * State used in rendering ToastBody\n */\nexport type ToastBodyState = ComponentState<ToastBodySlots> & {\n backgroundAppearance: BackgroundAppearanceContextValue;\n};\n"],"names":[],"mappings":"AAAA,WAkBE"}
@@ -0,0 +1,5 @@
1
+ export * from './ToastBody';
2
+ export * from './ToastBody.types';
3
+ export * from './renderToastBody';
4
+ export * from './useToastBody';
5
+ export * from './useToastBodyStyles.styles';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ToastBody';\nexport * from './ToastBody.types';\nexport * from './renderToastBody';\nexport * from './useToastBody';\nexport * from './useToastBodyStyles.styles';\n"],"names":[],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,iBAAiB;AAC/B,cAAc,8BAA8B"}
@@ -0,0 +1,8 @@
1
+ /** @jsxRuntime classic */ /** @jsxFrag Fragment */ /** @jsx createElement */ import { createElement, Fragment } from '@fluentui/react-jsx-runtime';
2
+ import { getSlotsNext } from '@fluentui/react-utilities';
3
+ /**
4
+ * Render the final JSX of ToastBody
5
+ */ export const renderToastBody_unstable = (state)=>{
6
+ const { slots , slotProps } = getSlotsNext(state);
7
+ return /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement(slots.root, slotProps.root), slots.subtitle ? /*#__PURE__*/ createElement(slots.subtitle, slotProps.subtitle) : null);
8
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["renderToastBody.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsxFrag Fragment */\n/** @jsx createElement */\n\nimport { createElement, Fragment } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { ToastBodyState, ToastBodySlots } from './ToastBody.types';\n\n/**\n * Render the final JSX of ToastBody\n */\nexport const renderToastBody_unstable = (state: ToastBodyState) => {\n const { slots, slotProps } = getSlotsNext<ToastBodySlots>(state);\n\n return (\n <>\n <slots.root {...slotProps.root} />\n {slots.subtitle ? <slots.subtitle {...slotProps.subtitle} /> : null}\n </>\n );\n};\n"],"names":["createElement","Fragment","getSlotsNext","renderToastBody_unstable","state","slots","slotProps","root","subtitle"],"mappings":"AAAA,wBAAwB,GACxB,sBAAsB,GACtB,uBAAuB,GAEvB,SAASA,aAAa,EAAEC,QAAQ,QAAQ,8BAA8B;AACtE,SAASC,YAAY,QAAQ,4BAA4B;AAGzD;;CAEC,GACD,OAAO,MAAMC,2BAA2B,CAACC,QAA0B;IACjE,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGJ,aAA6BE;IAE1D,qBACE,AAbJ,cADA,8BAeM,AAdN,cAcOC,MAAME,IAAI,EAAKD,UAAUC,IAAI,GAC7BF,MAAMG,QAAQ,iBAAG,AAfxB,cAeyBH,MAAMG,QAAQ,EAAKF,UAAUE,QAAQ,IAAO,IAAI;AAGzE,EAAE"}
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ import { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';
3
+ import { useToastContainerContext } from '../../contexts/toastContainerContext';
4
+ import { useBackgroundAppearance } from '@fluentui/react-shared-contexts';
5
+ /**
6
+ * Create the state required to render ToastBody.
7
+ *
8
+ * The returned state can be modified with hooks such as useToastBodyStyles_unstable,
9
+ * before being passed to renderToastBody_unstable.
10
+ *
11
+ * @param props - props from this instance of ToastBody
12
+ * @param ref - reference to root HTMLElement of ToastBody
13
+ */ export const useToastBody_unstable = (props, ref)=>{
14
+ const backgroundAppearance = useBackgroundAppearance();
15
+ const { bodyId } = useToastContainerContext();
16
+ return {
17
+ components: {
18
+ root: 'div',
19
+ subtitle: 'div'
20
+ },
21
+ subtitle: resolveShorthand(props.subtitle),
22
+ root: getNativeElementProps('div', {
23
+ ref,
24
+ id: bodyId,
25
+ ...props
26
+ }),
27
+ backgroundAppearance
28
+ };
29
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useToastBody.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport type { ToastBodyProps, ToastBodyState } from './ToastBody.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\nimport { useBackgroundAppearance } from '@fluentui/react-shared-contexts';\n\n/**\n * Create the state required to render ToastBody.\n *\n * The returned state can be modified with hooks such as useToastBodyStyles_unstable,\n * before being passed to renderToastBody_unstable.\n *\n * @param props - props from this instance of ToastBody\n * @param ref - reference to root HTMLElement of ToastBody\n */\nexport const useToastBody_unstable = (props: ToastBodyProps, ref: React.Ref<HTMLElement>): ToastBodyState => {\n const backgroundAppearance = useBackgroundAppearance();\n const { bodyId } = useToastContainerContext();\n return {\n components: {\n root: 'div',\n subtitle: 'div',\n },\n subtitle: resolveShorthand(props.subtitle),\n root: getNativeElementProps('div', {\n ref,\n id: bodyId,\n ...props,\n }),\n backgroundAppearance,\n };\n};\n"],"names":["React","getNativeElementProps","resolveShorthand","useToastContainerContext","useBackgroundAppearance","useToastBody_unstable","props","ref","backgroundAppearance","bodyId","components","root","subtitle","id"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ,4BAA4B;AAEpF,SAASC,wBAAwB,QAAQ,uCAAuC;AAChF,SAASC,uBAAuB,QAAQ,kCAAkC;AAE1E;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAuBC,MAAgD;IAC3G,MAAMC,uBAAuBJ;IAC7B,MAAM,EAAEK,OAAM,EAAE,GAAGN;IACnB,OAAO;QACLO,YAAY;YACVC,MAAM;YACNC,UAAU;QACZ;QACAA,UAAUV,iBAAiBI,MAAMM,QAAQ;QACzCD,MAAMV,sBAAsB,OAAO;YACjCM;YACAM,IAAIJ;YACJ,GAAGH,KAAK;QACV;QACAE;IACF;AACF,EAAE"}
@@ -0,0 +1,32 @@
1
+ import { __resetStyles, __styles, mergeClasses } from '@griffel/react';
2
+ import { tokens } from '@fluentui/react-theme';
3
+ export const toastBodyClassNames = {
4
+ root: 'fui-ToastBody',
5
+ subtitle: 'fui-ToastBody__subtitle'
6
+ };
7
+ const useRootBaseClassName = /*#__PURE__*/__resetStyles("rnxxsue", null, [".rnxxsue{-ms-grid-column:2;grid-column-start:2;-ms-grid-row-span:1;grid-column-end:3;padding-top:6px;font-size:var(--fontSizeBase300);line-height:var(--fontSizeBase300);font-weight:var(--fontWeightRegular);color:var(--colorNeutralForeground1);}"]);
8
+ const useSubtitleBaseClassName = /*#__PURE__*/__resetStyles("rzjw1xk", null, [".rzjw1xk{padding-top:4px;-ms-grid-column:2;grid-column-start:2;-ms-grid-row-span:1;grid-column-end:3;font-size:var(--fontSizeBase200);line-height:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);color:var(--colorNeutralForeground2);}"]);
9
+ const useInvertedStyles = /*#__PURE__*/__styles({
10
+ root: {
11
+ sj55zd: "f1w7i9ko"
12
+ },
13
+ subtitle: {
14
+ sj55zd: "f1w7i9ko"
15
+ }
16
+ }, {
17
+ d: [".f1w7i9ko{color:var(--colorNeutralForegroundInverted2);}"]
18
+ });
19
+ /**
20
+ * Apply styling to the ToastBody slots based on the state
21
+ */
22
+ export const useToastBodyStyles_unstable = state => {
23
+ const rootBaseClassName = useRootBaseClassName();
24
+ const subtitleBaseClassName = useSubtitleBaseClassName();
25
+ const invertedStyles = useInvertedStyles();
26
+ state.root.className = mergeClasses(toastBodyClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);
27
+ if (state.subtitle) {
28
+ state.subtitle.className = mergeClasses(toastBodyClassNames.subtitle, subtitleBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.subtitle, state.subtitle.className);
29
+ }
30
+ return state;
31
+ };
32
+ //# sourceMappingURL=useToastBodyStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","toastBodyClassNames","root","subtitle","useRootBaseClassName","useSubtitleBaseClassName","useInvertedStyles","sj55zd","d","useToastBodyStyles_unstable","state","rootBaseClassName","subtitleBaseClassName","invertedStyles","className","backgroundAppearance"],"sources":["useToastBodyStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastBodyClassNames = {\n root: 'fui-ToastBody',\n subtitle: 'fui-ToastBody__subtitle'\n};\nconst useRootBaseClassName = makeResetStyles({\n gridColumnStart: 2,\n gridColumnEnd: 3,\n paddingTop: '6px',\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightRegular,\n color: tokens.colorNeutralForeground1\n});\nconst useSubtitleBaseClassName = makeResetStyles({\n paddingTop: '4px',\n gridColumnStart: 2,\n gridColumnEnd: 3,\n fontSize: tokens.fontSizeBase200,\n lineHeight: tokens.fontSizeBase200,\n fontWeight: tokens.fontWeightRegular,\n color: tokens.colorNeutralForeground2\n});\nconst useInvertedStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForegroundInverted2\n },\n subtitle: {\n color: tokens.colorNeutralForegroundInverted2\n }\n});\n/**\n * Apply styling to the ToastBody slots based on the state\n */ export const useToastBodyStyles_unstable = (state)=>{\n const rootBaseClassName = useRootBaseClassName();\n const subtitleBaseClassName = useSubtitleBaseClassName();\n const invertedStyles = useInvertedStyles();\n state.root.className = mergeClasses(toastBodyClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);\n if (state.subtitle) {\n state.subtitle.className = mergeClasses(toastBodyClassNames.subtitle, subtitleBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.subtitle, state.subtitle.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,mBAAmB,GAAG;EAC/BC,IAAI,EAAE,eAAe;EACrBC,QAAQ,EAAE;AACd,CAAC;AACD,MAAMC,oBAAoB,gBAAGP,aAAA,0QAQ5B,CAAC;AACF,MAAMQ,wBAAwB,gBAAGR,aAAA,0QAQhC,CAAC;AACF,MAAMS,iBAAiB,gBAAGR,QAAA;EAAAI,IAAA;IAAAK,MAAA;EAAA;EAAAJ,QAAA;IAAAI,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAOzB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,2BAA2B,GAAIC,KAAK,IAAG;EACpD,MAAMC,iBAAiB,GAAGP,oBAAoB,CAAC,CAAC;EAChD,MAAMQ,qBAAqB,GAAGP,wBAAwB,CAAC,CAAC;EACxD,MAAMQ,cAAc,GAAGP,iBAAiB,CAAC,CAAC;EAC1CI,KAAK,CAACR,IAAI,CAACY,SAAS,GAAGf,YAAY,CAACE,mBAAmB,CAACC,IAAI,EAAES,iBAAiB,EAAED,KAAK,CAACK,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACX,IAAI,EAAEQ,KAAK,CAACR,IAAI,CAACY,SAAS,CAAC;EACxK,IAAIJ,KAAK,CAACP,QAAQ,EAAE;IAChBO,KAAK,CAACP,QAAQ,CAACW,SAAS,GAAGf,YAAY,CAACE,mBAAmB,CAACE,QAAQ,EAAES,qBAAqB,EAAEF,KAAK,CAACK,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACV,QAAQ,EAAEO,KAAK,CAACP,QAAQ,CAACW,SAAS,CAAC;EAChM;EACA,OAAOJ,KAAK;AAChB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ import { useToastContainer_unstable } from './useToastContainer';
3
+ import { renderToastContainer_unstable } from './renderToastContainer';
4
+ import { useToastContainerStyles_unstable } from './useToastContainerStyles.styles';
5
+ import { useToastContainerContextValues_unstable } from './useToastContainerContextValues';
6
+ /**
7
+ * ToastContainer component
8
+ */ export const ToastContainer = /*#__PURE__*/ React.forwardRef((props, ref)=>{
9
+ const state = useToastContainer_unstable(props, ref);
10
+ useToastContainerStyles_unstable(state);
11
+ return renderToastContainer_unstable(state, useToastContainerContextValues_unstable(state));
12
+ });
13
+ ToastContainer.displayName = 'ToastContainer';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["ToastContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastContainer_unstable } from './useToastContainer';\nimport { renderToastContainer_unstable } from './renderToastContainer';\nimport { useToastContainerStyles_unstable } from './useToastContainerStyles.styles';\nimport type { ToastContainerProps } from './ToastContainer.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useToastContainerContextValues_unstable } from './useToastContainerContextValues';\n\n/**\n * ToastContainer component\n */\nexport const ToastContainer: ForwardRefComponent<ToastContainerProps> = React.forwardRef((props, ref) => {\n const state = useToastContainer_unstable(props, ref);\n\n useToastContainerStyles_unstable(state);\n return renderToastContainer_unstable(state, useToastContainerContextValues_unstable(state));\n});\n\nToastContainer.displayName = 'ToastContainer';\n"],"names":["React","useToastContainer_unstable","renderToastContainer_unstable","useToastContainerStyles_unstable","useToastContainerContextValues_unstable","ToastContainer","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,gCAAgC,QAAQ,mCAAmC;AAGpF,SAASC,uCAAuC,QAAQ,mCAAmC;AAE3F;;CAEC,GACD,OAAO,MAAMC,+BAA2DL,MAAMM,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACvG,MAAMC,QAAQR,2BAA2BM,OAAOC;IAEhDL,iCAAiCM;IACjC,OAAOP,8BAA8BO,OAAOL,wCAAwCK;AACtF,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}
@@ -0,0 +1 @@
1
+ import * as React from 'react';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["ToastContainer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { Announce } from '../AriaLive/AriaLive.types';\nimport { Toast, ToastIntent } from '../../state';\nimport { ToastContainerContextValue } from '../../contexts/toastContainerContext';\nimport { TimerProps } from '../Timer/Timer';\n\nexport type ToastContainerContextValues = {\n toast: ToastContainerContextValue;\n};\n\nexport type ToastContainerSlots = {\n root: NonNullable<Slot<'div'>>;\n timer: NonNullable<Slot<TimerProps>>;\n};\n\n/**\n * ToastContainer Props\n */\nexport type ToastContainerProps = ComponentProps<Partial<ToastContainerSlots>> &\n Toast & {\n visible: boolean;\n announce: Announce;\n intent: ToastIntent | undefined;\n tryRestoreFocus: () => void;\n };\n\n/**\n * State used in rendering ToastContainer\n */\nexport type ToastContainerState = ComponentState<ToastContainerSlots> &\n Pick<ToastContainerProps, 'remove' | 'close' | 'updateId' | 'visible' | 'intent'> &\n Pick<ToastContainerContextValue, 'titleId' | 'bodyId'> & {\n transitionTimeout: number;\n timerTimeout: number;\n running: boolean;\n onTransitionEntering: () => void;\n nodeRef: React.Ref<HTMLDivElement>;\n };\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
@@ -0,0 +1,6 @@
1
+ export * from './ToastContainer';
2
+ export * from './ToastContainer.types';
3
+ export * from './renderToastContainer';
4
+ export * from './useToastContainer';
5
+ export * from './useToastContainerStyles.styles';
6
+ export * from './useToastContainerContextValues';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ToastContainer';\nexport * from './ToastContainer.types';\nexport * from './renderToastContainer';\nexport * from './useToastContainer';\nexport * from './useToastContainerStyles.styles';\nexport * from './useToastContainerContextValues';\n"],"names":[],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,yBAAyB;AACvC,cAAc,yBAAyB;AACvC,cAAc,sBAAsB;AACpC,cAAc,mCAAmC;AACjD,cAAc,mCAAmC"}
@@ -0,0 +1,21 @@
1
+ /** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
2
+ import { getSlotsNext } from '@fluentui/react-utilities';
3
+ import { Transition } from 'react-transition-group';
4
+ import { ToastContainerContextProvider } from '../../contexts/toastContainerContext';
5
+ /**
6
+ * Render the final JSX of ToastContainer
7
+ */ export const renderToastContainer_unstable = (state, contextValues)=>{
8
+ const { onTransitionEntering , visible , transitionTimeout , remove , nodeRef } = state;
9
+ const { slots , slotProps } = getSlotsNext(state);
10
+ return /*#__PURE__*/ createElement(Transition, {
11
+ in: visible,
12
+ appear: true,
13
+ unmountOnExit: true,
14
+ timeout: transitionTimeout,
15
+ onExited: remove,
16
+ onEntering: onTransitionEntering,
17
+ nodeRef: nodeRef
18
+ }, /*#__PURE__*/ createElement(ToastContainerContextProvider, {
19
+ value: contextValues.toast
20
+ }, /*#__PURE__*/ createElement(slots.root, slotProps.root), /*#__PURE__*/ createElement(slots.timer, slotProps.timer)));
21
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["renderToastContainer.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport { Transition } from 'react-transition-group';\nimport type { ToastContainerState, ToastContainerSlots, ToastContainerContextValues } from './ToastContainer.types';\nimport { ToastContainerContextProvider } from '../../contexts/toastContainerContext';\n\n/**\n * Render the final JSX of ToastContainer\n */\nexport const renderToastContainer_unstable = (\n state: ToastContainerState,\n contextValues: ToastContainerContextValues,\n) => {\n const { onTransitionEntering, visible, transitionTimeout, remove, nodeRef } = state;\n const { slots, slotProps } = getSlotsNext<ToastContainerSlots>(state);\n\n return (\n <Transition\n in={visible}\n appear\n unmountOnExit\n timeout={transitionTimeout}\n onExited={remove}\n onEntering={onTransitionEntering}\n nodeRef={nodeRef}\n >\n <ToastContainerContextProvider value={contextValues.toast}>\n <slots.root {...slotProps.root} />\n <slots.timer {...slotProps.timer} />\n </ToastContainerContextProvider>\n </Transition>\n );\n};\n"],"names":["createElement","getSlotsNext","Transition","ToastContainerContextProvider","renderToastContainer_unstable","state","contextValues","onTransitionEntering","visible","transitionTimeout","remove","nodeRef","slots","slotProps","in","appear","unmountOnExit","timeout","onExited","onEntering","value","toast","root","timer"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,YAAY,QAAQ,4BAA4B;AACzD,SAASC,UAAU,QAAQ,yBAAyB;AAEpD,SAASC,6BAA6B,QAAQ,uCAAuC;AAErF;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAC3CC,OACAC,gBACG;IACH,MAAM,EAAEC,qBAAoB,EAAEC,QAAO,EAAEC,kBAAiB,EAAEC,OAAM,EAAEC,QAAO,EAAE,GAAGN;IAC9E,MAAM,EAAEO,MAAK,EAAEC,UAAS,EAAE,GAAGZ,aAAkCI;IAE/D,qBACE,AAnBJ,cAmBKH;QACCY,IAAIN;QACJO,QAAAA,IAAM;QACNC,eAAAA,IAAa;QACbC,SAASR;QACTS,UAAUR;QACVS,YAAYZ;QACZI,SAASA;qBAET,AA5BN,cA4BOR;QAA8BiB,OAAOd,cAAce,KAAK;qBACvD,AA7BR,cA6BST,MAAMU,IAAI,EAAKT,UAAUS,IAAI,iBAC9B,AA9BR,cA8BSV,MAAMW,KAAK,EAAKV,UAAUU,KAAK;AAIxC,EAAE"}