@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 @@
1
+ {"version":3,"names":["__styles","__resetStyles","mergeClasses","tokens","toastTitleClassNames","root","media","action","useRootBaseClassName","useMediaBaseClassName","useActionBaseClassName","useInvertedStyles","sj55zd","d","useIntentIconStyles","success","error","warning","info","useIntentIconStylesInverted","useToastTitleStyles_unstable","state","rootBaseClassName","actionBaseClassName","mediaBaseClassName","intentIconStyles","intentIconStylesInverted","intent","invertedStyles","className","backgroundAppearance"],"sources":["useToastTitleStyles.styles.js"],"sourcesContent":["import { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const toastTitleClassNames = {\n root: 'fui-ToastTitle',\n media: 'fui-ToastTitle__media',\n action: 'fui-ToastTitle__action'\n};\nconst useRootBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n gridColumnEnd: 3,\n color: tokens.colorNeutralForeground1\n});\nconst useMediaBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n gridColumnEnd: 2,\n paddingRight: '8px',\n fontSize: '16px',\n color: tokens.colorNeutralForeground1\n});\nconst useActionBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n paddingLeft: '12px',\n gridColumnEnd: -1,\n color: tokens.colorBrandForeground1\n});\nconst useInvertedStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForegroundInverted2\n },\n action: {\n color: tokens.colorBrandForegroundInverted\n },\n media: {\n color: tokens.colorNeutralForegroundInverted\n }\n});\nconst useIntentIconStyles = makeStyles({\n success: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteGreenForeground3\n },\n error: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteCranberryForeground2\n },\n warning: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteDarkOrangeForeground1\n },\n info: {\n color: tokens.colorNeutralForeground2\n }\n});\nconst useIntentIconStylesInverted = makeStyles({\n success: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteGreenForegroundInverted\n },\n error: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteRedForegroundInverted\n },\n warning: {\n // FIXME https://github.com/microsoft/fluentui/issues/28219\n color: tokens.colorPaletteYellowForegroundInverted\n },\n info: {\n color: tokens.colorNeutralForegroundInverted2\n }\n});\n/**\n * Apply styling to the ToastTitle slots based on the state\n */ export const useToastTitleStyles_unstable = (state)=>{\n const rootBaseClassName = useRootBaseClassName();\n const actionBaseClassName = useActionBaseClassName();\n const mediaBaseClassName = useMediaBaseClassName();\n const intentIconStyles = useIntentIconStyles();\n const intentIconStylesInverted = useIntentIconStylesInverted();\n const { intent } = state;\n const invertedStyles = useInvertedStyles();\n state.root.className = mergeClasses(toastTitleClassNames.root, rootBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.root, state.root.className);\n if (state.media) {\n state.media.className = mergeClasses(toastTitleClassNames.media, mediaBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.media, state.media.className, intent && intentIconStyles[intent], intent && state.backgroundAppearance === 'inverted' && intentIconStylesInverted[intent]);\n }\n if (state.action) {\n state.action.className = mergeClasses(toastTitleClassNames.action, actionBaseClassName, state.backgroundAppearance === 'inverted' && invertedStyles.action, state.action.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAAC,aAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,oBAAoB,GAAG;EAChCC,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EAAE,uBAAuB;EAC9BC,MAAM,EAAE;AACZ,CAAC;AACD,MAAMC,oBAAoB,gBAAGP,aAAA,uRAK5B,CAAC;AACF,MAAMQ,qBAAqB,gBAAGR,aAAA,8lBAO7B,CAAC;AACF,MAAMS,sBAAsB,gBAAGT,aAAA,kkBAM9B,CAAC;AACF,MAAMU,iBAAiB,gBAAGX,QAAA;EAAAK,IAAA;IAAAO,MAAA;EAAA;EAAAL,MAAA;IAAAK,MAAA;EAAA;EAAAN,KAAA;IAAAM,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAUzB,CAAC;AACF,MAAMC,mBAAmB,gBAAGd,QAAA;EAAAe,OAAA;IAAAH,MAAA;EAAA;EAAAI,KAAA;IAAAJ,MAAA;EAAA;EAAAK,OAAA;IAAAL,MAAA;EAAA;EAAAM,IAAA;IAAAN,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAgB3B,CAAC;AACF,MAAMM,2BAA2B,gBAAGnB,QAAA;EAAAe,OAAA;IAAAH,MAAA;EAAA;EAAAI,KAAA;IAAAJ,MAAA;EAAA;EAAAK,OAAA;IAAAL,MAAA;EAAA;EAAAM,IAAA;IAAAN,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAgBnC,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMO,4BAA4B,GAAIC,KAAK,IAAG;EACrD,MAAMC,iBAAiB,GAAGd,oBAAoB,CAAC,CAAC;EAChD,MAAMe,mBAAmB,GAAGb,sBAAsB,CAAC,CAAC;EACpD,MAAMc,kBAAkB,GAAGf,qBAAqB,CAAC,CAAC;EAClD,MAAMgB,gBAAgB,GAAGX,mBAAmB,CAAC,CAAC;EAC9C,MAAMY,wBAAwB,GAAGP,2BAA2B,CAAC,CAAC;EAC9D,MAAM;IAAEQ;EAAQ,CAAC,GAAGN,KAAK;EACzB,MAAMO,cAAc,GAAGjB,iBAAiB,CAAC,CAAC;EAC1CU,KAAK,CAAChB,IAAI,CAACwB,SAAS,GAAG3B,YAAY,CAACE,oBAAoB,CAACC,IAAI,EAAEiB,iBAAiB,EAAED,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACvB,IAAI,EAAEgB,KAAK,CAAChB,IAAI,CAACwB,SAAS,CAAC;EACzK,IAAIR,KAAK,CAACf,KAAK,EAAE;IACbe,KAAK,CAACf,KAAK,CAACuB,SAAS,GAAG3B,YAAY,CAACE,oBAAoB,CAACE,KAAK,EAAEkB,kBAAkB,EAAEH,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACtB,KAAK,EAAEe,KAAK,CAACf,KAAK,CAACuB,SAAS,EAAEF,MAAM,IAAIF,gBAAgB,CAACE,MAAM,CAAC,EAAEA,MAAM,IAAIN,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIJ,wBAAwB,CAACC,MAAM,CAAC,CAAC;EAC/S;EACA,IAAIN,KAAK,CAACd,MAAM,EAAE;IACdc,KAAK,CAACd,MAAM,CAACsB,SAAS,GAAG3B,YAAY,CAACE,oBAAoB,CAACG,MAAM,EAAEgB,mBAAmB,EAAEF,KAAK,CAACS,oBAAoB,KAAK,UAAU,IAAIF,cAAc,CAACrB,MAAM,EAAEc,KAAK,CAACd,MAAM,CAACsB,SAAS,CAAC;EACvL;EACA,OAAOR,KAAK;AAChB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { useToastTrigger_unstable } from './useToastTrigger';
3
+ import { renderToastTrigger_unstable } from './renderToastTrigger';
4
+ /**
5
+ * ToastTrigger component
6
+ */ export const ToastTrigger = (props)=>{
7
+ const state = useToastTrigger_unstable(props);
8
+ return renderToastTrigger_unstable(state);
9
+ };
10
+ ToastTrigger.displayName = 'ToastTrigger';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["ToastTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToastTrigger_unstable } from './useToastTrigger';\nimport { renderToastTrigger_unstable } from './renderToastTrigger';\nimport type { ToastTriggerProps } from './ToastTrigger.types';\n\n/**\n * ToastTrigger component\n */\nexport const ToastTrigger: React.FC<ToastTriggerProps> = props => {\n const state = useToastTrigger_unstable(props);\n\n return renderToastTrigger_unstable(state);\n};\n\nToastTrigger.displayName = 'ToastTrigger';\n"],"names":["React","useToastTrigger_unstable","renderToastTrigger_unstable","ToastTrigger","props","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,2BAA2B,QAAQ,uBAAuB;AAGnE;;CAEC,GACD,OAAO,MAAMC,eAA4CC,CAAAA,QAAS;IAChE,MAAMC,QAAQJ,yBAAyBG;IAEvC,OAAOF,4BAA4BG;AACrC,EAAE;AAEFF,aAAaG,WAAW,GAAG"}
@@ -0,0 +1 @@
1
+ import * as React from 'react';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["ToastTrigger.types.ts"],"sourcesContent":["import { ARIAButtonResultProps, ARIAButtonType } from '@fluentui/react-aria';\nimport type { TriggerProps } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nexport type ToastTriggerProps = TriggerProps<ToastTriggerChildProps> & {\n /**\n * Disables internal trigger mechanism that ensures a child provided will be a compliant ARIA button.\n * @default false\n */\n disableButtonEnhancement?: boolean;\n};\n\n/**\n * Props that are passed to the child of the ToastTrigger when cloned to ensure correct behaviour for the Toast\n */\nexport type ToastTriggerChildProps<Type extends ARIAButtonType = ARIAButtonType, Props = {}> = ARIAButtonResultProps<\n Type,\n Props\n>;\n\nexport type ToastTriggerState = {\n children: React.ReactElement | null;\n};\n"],"names":["React"],"mappings":"AAEA,YAAYA,WAAW,QAAQ"}
@@ -0,0 +1,4 @@
1
+ export * from './ToastTrigger';
2
+ export * from './ToastTrigger.types';
3
+ export * from './renderToastTrigger';
4
+ export * from './useToastTrigger';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ToastTrigger';\nexport * from './ToastTrigger.types';\nexport * from './renderToastTrigger';\nexport * from './useToastTrigger';\n"],"names":[],"mappings":"AAAA,cAAc,iBAAiB;AAC/B,cAAc,uBAAuB;AACrC,cAAc,uBAAuB;AACrC,cAAc,oBAAoB"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Render the final JSX of MenuTrigger
3
+ *
4
+ * Only renders children
5
+ */ export const renderToastTrigger_unstable = (state)=>state.children;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["renderToastTrigger.tsx"],"sourcesContent":["import type { ToastTriggerState } from './ToastTrigger.types';\n\n/**\n * Render the final JSX of MenuTrigger\n *\n * Only renders children\n */\nexport const renderToastTrigger_unstable = (state: ToastTriggerState) => state.children;\n"],"names":["renderToastTrigger_unstable","state","children"],"mappings":"AAEA;;;;CAIC,GACD,OAAO,MAAMA,8BAA8B,CAACC,QAA6BA,MAAMC,QAAQ,CAAC"}
@@ -0,0 +1,36 @@
1
+ import * as React from 'react';
2
+ import { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';
3
+ import { useARIAButtonProps } from '@fluentui/react-aria';
4
+ import { useToastContainerContext } from '../../contexts/toastContainerContext';
5
+ /**
6
+ * A non-visual component that wraps its child
7
+ * and configures them to be the trigger that will close a `Toast`.
8
+ * This component should only accept one child.
9
+ *
10
+ * This component sole purpose is to avoid opting out of the internal controlled open state of a `Toast`
11
+ * Besides being a trigger that closes a toast through context this component doesn't do much,
12
+ * making it basically unnecessary in cases where the trigger is outside of a toast.
13
+ */ export const useToastTrigger_unstable = (props)=>{
14
+ const { children , disableButtonEnhancement =false } = props;
15
+ const { close } = useToastContainerContext();
16
+ const child = getTriggerChild(children);
17
+ const handleClick = useEventCallback((e)=>{
18
+ var _child_props, _child_props_onClick;
19
+ (_child_props_onClick = (_child_props = child === null || child === void 0 ? void 0 : child.props).onClick) === null || _child_props_onClick === void 0 ? void 0 : _child_props_onClick.call(_child_props, e);
20
+ if (!e.isDefaultPrevented()) {
21
+ close();
22
+ }
23
+ });
24
+ const triggerChildProps = {
25
+ ...child === null || child === void 0 ? void 0 : child.props,
26
+ ref: child === null || child === void 0 ? void 0 : child.ref,
27
+ onClick: handleClick
28
+ };
29
+ const ariaButtonTriggerChildProps = useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', {
30
+ ...triggerChildProps,
31
+ type: 'button'
32
+ });
33
+ return {
34
+ children: applyTriggerPropsToChildren(children, disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps)
35
+ };
36
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useToastTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport type { ToastTriggerProps, ToastTriggerState } from './ToastTrigger.types';\nimport { useToastContainerContext } from '../../contexts/toastContainerContext';\n\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will close a `Toast`.\n * This component should only accept one child.\n *\n * This component sole purpose is to avoid opting out of the internal controlled open state of a `Toast`\n * Besides being a trigger that closes a toast through context this component doesn't do much,\n * making it basically unnecessary in cases where the trigger is outside of a toast.\n */\nexport const useToastTrigger_unstable = (props: ToastTriggerProps): ToastTriggerState => {\n const { children, disableButtonEnhancement = false } = props;\n const { close } = useToastContainerContext();\n\n const child = getTriggerChild(children);\n\n const handleClick = useEventCallback(\n (e: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(e);\n if (!e.isDefaultPrevented()) {\n close();\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n ref: child?.ref,\n onClick: handleClick,\n };\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n {\n ...triggerChildProps,\n type: 'button',\n },\n );\n\n return {\n children: applyTriggerPropsToChildren(\n children,\n disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n };\n};\n"],"names":["React","applyTriggerPropsToChildren","getTriggerChild","useEventCallback","useARIAButtonProps","useToastContainerContext","useToastTrigger_unstable","props","children","disableButtonEnhancement","close","child","handleClick","e","onClick","isDefaultPrevented","triggerChildProps","ref","ariaButtonTriggerChildProps","type"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ,4BAA4B;AAC3G,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,SAASC,wBAAwB,QAAQ,uCAAuC;AAEhF;;;;;;;;CAQC,GACD,OAAO,MAAMC,2BAA2B,CAACC,QAAgD;IACvF,MAAM,EAAEC,SAAQ,EAAEC,0BAA2B,KAAK,CAAA,EAAE,GAAGF;IACvD,MAAM,EAAEG,MAAK,EAAE,GAAGL;IAElB,MAAMM,QAAQT,gBAAgBM;IAE9B,MAAMI,cAAcT,iBAClB,CAACU,IAAgF;YAC/EF,cAAAA;QAAAA,CAAAA,uBAAAA,CAAAA,eAAAA,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOJ,KAAK,EAACO,OAAO,cAApBH,kCAAAA,KAAAA,IAAAA,qBAAAA,KAAAA,cAAuBE;QACvB,IAAI,CAACA,EAAEE,kBAAkB,IAAI;YAC3BL;QACF,CAAC;IACH;IAGF,MAAMM,oBAAoB;QACxB,GAAGL,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOJ,KAAK;QACfU,KAAKN,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOM,GAAG;QACfH,SAASF;IACX;IAEA,MAAMM,8BAA8Bd,mBAClCO,CAAAA,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOQ,IAAI,AAAD,MAAM,YAAYR,CAAAA,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOQ,IAAI,AAAD,MAAM,MAAMR,MAAMQ,IAAI,GAAG,KAAK,EACpE;QACE,GAAGH,iBAAiB;QACpBG,MAAM;IACR;IAGF,OAAO;QACLX,UAAUP,4BACRO,UACAC,2BAA2BO,oBAAoBE,2BAA2B;IAE9E;AACF,EAAE"}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { useToaster_unstable } from './useToaster';
3
+ import { renderToaster_unstable } from './renderToaster';
4
+ import { useToasterStyles_unstable } from './useToasterStyles.styles';
5
+ /**
6
+ * Toaster component - renders a collection of toasts dispatched imperatively
7
+ */ export const Toaster = (props)=>{
8
+ const state = useToaster_unstable(props);
9
+ useToasterStyles_unstable(state);
10
+ return renderToaster_unstable(state);
11
+ };
12
+ Toaster.displayName = 'Toaster';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Toaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useToaster_unstable } from './useToaster';\nimport { renderToaster_unstable } from './renderToaster';\nimport { useToasterStyles_unstable } from './useToasterStyles.styles';\nimport type { ToasterProps } from './Toaster.types';\n\n/**\n * Toaster component - renders a collection of toasts dispatched imperatively\n */\nexport const Toaster: React.FC<ToasterProps> = props => {\n const state = useToaster_unstable(props);\n\n useToasterStyles_unstable(state);\n return renderToaster_unstable(state);\n};\n\nToaster.displayName = 'Toaster';\n"],"names":["React","useToaster_unstable","renderToaster_unstable","useToasterStyles_unstable","Toaster","props","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,yBAAyB,QAAQ,4BAA4B;AAGtE;;CAEC,GACD,OAAO,MAAMC,UAAkCC,CAAAA,QAAS;IACtD,MAAMC,QAAQL,oBAAoBI;IAElCF,0BAA0BG;IAC1B,OAAOJ,uBAAuBI;AAChC,EAAE;AAEFF,QAAQG,WAAW,GAAG"}
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Toaster.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { ToasterOptions } from '../../state/types';\nimport { Announce, AriaLiveProps } from '../AriaLive';\n\nexport type ToasterSlots = {\n /**\n * NOTE: This root slot maps in exactly the same way to the containers rendered for each toast position\n * There is no intention (currently) to let users customize the div for each toast position.\n */\n root: Slot<'div'>;\n};\n\nexport type ToasterSlotsInternal = ToasterSlots & {\n bottomEnd?: Slot<'div'>;\n bottomStart?: Slot<'div'>;\n topEnd?: Slot<'div'>;\n topStart?: Slot<'div'>;\n};\n\n/**\n * Toaster Props\n */\nexport type ToasterProps = Omit<ComponentProps<ToasterSlots>, 'children'> &\n Partial<ToasterOptions> & {\n /**\n * User override API for aria-live narration for toasts\n */\n announce?: Announce;\n };\n\n/**\n * State used in rendering Toaster\n */\nexport type ToasterState = ComponentState<ToasterSlotsInternal> &\n Pick<AriaLiveProps, 'announceRef'> &\n Pick<Required<ToasterProps>, 'announce'> & {\n offset: ToasterOptions['offset'] | undefined;\n renderAriaLive: boolean;\n dir: 'rtl' | 'ltr';\n };\n"],"names":[],"mappings":"AAAA,WAuCI"}
@@ -0,0 +1,5 @@
1
+ export * from './Toaster';
2
+ export * from './Toaster.types';
3
+ export * from './renderToaster';
4
+ export * from './useToaster';
5
+ export * from './useToasterStyles.styles';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Toaster';\nexport * from './Toaster.types';\nexport * from './renderToaster';\nexport * from './useToaster';\nexport * from './useToasterStyles.styles';\n"],"names":[],"mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,kBAAkB;AAChC,cAAc,kBAAkB;AAChC,cAAc,eAAe;AAC7B,cAAc,4BAA4B"}
@@ -0,0 +1,14 @@
1
+ /** @jsxRuntime classic */ /** @jsxFrag Fragment */ /** @jsx createElement */ import { createElement, Fragment } from '@fluentui/react-jsx-runtime';
2
+ import { getSlotsNext } from '@fluentui/react-utilities';
3
+ import { Portal } from '@fluentui/react-portal';
4
+ import { AriaLive } from '../AriaLive';
5
+ /**
6
+ * Render the final JSX of Toaster
7
+ */ export const renderToaster_unstable = (state)=>{
8
+ const { announceRef , renderAriaLive } = state;
9
+ const { slots , slotProps } = getSlotsNext(state);
10
+ const hasToasts = !!slots.bottomStart || !!slots.bottomEnd || !!slots.topStart || !!slots.topEnd;
11
+ return /*#__PURE__*/ createElement(Fragment, null, renderAriaLive ? /*#__PURE__*/ createElement(AriaLive, {
12
+ announceRef: announceRef
13
+ }) : null, hasToasts ? /*#__PURE__*/ createElement(Portal, null, slots.bottomStart ? /*#__PURE__*/ createElement(slots.bottomStart, slotProps.bottomStart) : null, slots.bottomEnd ? /*#__PURE__*/ createElement(slots.bottomEnd, slotProps.bottomEnd) : null, slots.topStart ? /*#__PURE__*/ createElement(slots.topStart, slotProps.topStart) : null, slots.topEnd ? /*#__PURE__*/ createElement(slots.topEnd, slotProps.topEnd) : null) : null);
14
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["renderToaster.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 { Portal } from '@fluentui/react-portal';\nimport type { ToasterState, ToasterSlotsInternal } from './Toaster.types';\nimport { AriaLive } from '../AriaLive';\n\n/**\n * Render the final JSX of Toaster\n */\nexport const renderToaster_unstable = (state: ToasterState) => {\n const { announceRef, renderAriaLive } = state;\n const { slots, slotProps } = getSlotsNext<ToasterSlotsInternal>(state);\n\n const hasToasts = !!slots.bottomStart || !!slots.bottomEnd || !!slots.topStart || !!slots.topEnd;\n\n return (\n <>\n {renderAriaLive ? <AriaLive announceRef={announceRef} /> : null}\n {hasToasts ? (\n <Portal>\n {slots.bottomStart ? <slots.bottomStart {...slotProps.bottomStart} /> : null}\n {slots.bottomEnd ? <slots.bottomEnd {...slotProps.bottomEnd} /> : null}\n {slots.topStart ? <slots.topStart {...slotProps.topStart} /> : null}\n {slots.topEnd ? <slots.topEnd {...slotProps.topEnd} /> : null}\n </Portal>\n ) : null}\n </>\n );\n};\n"],"names":["createElement","Fragment","getSlotsNext","Portal","AriaLive","renderToaster_unstable","state","announceRef","renderAriaLive","slots","slotProps","hasToasts","bottomStart","bottomEnd","topStart","topEnd"],"mappings":"AAAA,wBAAwB,GACxB,sBAAsB,GACtB,uBAAuB,GAEvB,SAASA,aAAa,EAAEC,QAAQ,QAAQ,8BAA8B;AACtE,SAASC,YAAY,QAAQ,4BAA4B;AACzD,SAASC,MAAM,QAAQ,yBAAyB;AAEhD,SAASC,QAAQ,QAAQ,cAAc;AAEvC;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CAACC,QAAwB;IAC7D,MAAM,EAAEC,YAAW,EAAEC,eAAc,EAAE,GAAGF;IACxC,MAAM,EAAEG,MAAK,EAAEC,UAAS,EAAE,GAAGR,aAAmCI;IAEhE,MAAMK,YAAY,CAAC,CAACF,MAAMG,WAAW,IAAI,CAAC,CAACH,MAAMI,SAAS,IAAI,CAAC,CAACJ,MAAMK,QAAQ,IAAI,CAAC,CAACL,MAAMM,MAAM;IAEhG,qBACE,AAlBJ,cADA,gBAoBOP,+BAAiB,AAnBxB,cAmByBJ;QAASG,aAAaA;SAAkB,IAAI,EAC9DI,0BACC,AArBR,cAqBSR,cACEM,MAAMG,WAAW,iBAAG,AAtB/B,cAsBgCH,MAAMG,WAAW,EAAKF,UAAUE,WAAW,IAAO,IAAI,EAC3EH,MAAMI,SAAS,iBAAG,AAvB7B,cAuB8BJ,MAAMI,SAAS,EAAKH,UAAUG,SAAS,IAAO,IAAI,EACrEJ,MAAMK,QAAQ,iBAAG,AAxB5B,cAwB6BL,MAAMK,QAAQ,EAAKJ,UAAUI,QAAQ,IAAO,IAAI,EAClEL,MAAMM,MAAM,iBAAG,AAzB1B,cAyB2BN,MAAMM,MAAM,EAAKL,UAAUK,MAAM,IAAO,IAAI,IAE7D,IAAI;AAGd,EAAE"}
@@ -0,0 +1,71 @@
1
+ import * as React from 'react';
2
+ import { getNativeElementProps, resolveShorthand, useEventCallback } from '@fluentui/react-utilities';
3
+ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
4
+ import { TOAST_POSITIONS, useToaster } from '../../state';
5
+ import { ToastContainer } from '../ToastContainer';
6
+ /**
7
+ * Create the state required to render Toaster.
8
+ *
9
+ * @param props - props from this instance of Toaster
10
+ */ export const useToaster_unstable = (props)=>{
11
+ const { offset , announce: announceProp , ...rest } = props;
12
+ const announceRef = React.useRef(()=>null);
13
+ const { toastsToRender , isToastVisible , pauseAllToasts , playAllToasts , tryRestoreFocus } = useToaster(rest);
14
+ const announce = React.useCallback((message, options)=>announceRef.current(message, options), []);
15
+ const { dir } = useFluent();
16
+ const rootProps = getNativeElementProps('div', rest);
17
+ const onFocusPositionSlot = useEventCallback((e)=>{
18
+ var _rootProps_onFocus;
19
+ if (!e.currentTarget.contains(e.relatedTarget)) {
20
+ pauseAllToasts();
21
+ }
22
+ (_rootProps_onFocus = rootProps.onFocus) === null || _rootProps_onFocus === void 0 ? void 0 : _rootProps_onFocus.call(rootProps, e);
23
+ });
24
+ const onBlurPositionSlot = useEventCallback((e)=>{
25
+ var _rootProps_onBlur;
26
+ if (!e.currentTarget.contains(e.relatedTarget)) {
27
+ playAllToasts();
28
+ tryRestoreFocus();
29
+ }
30
+ (_rootProps_onBlur = rootProps.onBlur) === null || _rootProps_onBlur === void 0 ? void 0 : _rootProps_onBlur.call(rootProps, e);
31
+ });
32
+ const createPositionSlot = (toastPosition)=>{
33
+ var _toastsToRender_get;
34
+ return resolveShorthand(toastsToRender.has(toastPosition) ? rootProps : null, {
35
+ defaultProps: {
36
+ children: (_toastsToRender_get = toastsToRender.get(toastPosition)) === null || _toastsToRender_get === void 0 ? void 0 : _toastsToRender_get.map((toast)=>/*#__PURE__*/ React.createElement(ToastContainer, {
37
+ ...toast,
38
+ tryRestoreFocus: tryRestoreFocus,
39
+ intent: toast.intent,
40
+ announce: announce,
41
+ key: toast.toastId,
42
+ visible: isToastVisible(toast.toastId)
43
+ }, toast.content)),
44
+ 'data-toaster-position': toastPosition,
45
+ onFocus: onFocusPositionSlot,
46
+ onBlur: onBlurPositionSlot
47
+ }
48
+ });
49
+ };
50
+ return {
51
+ dir,
52
+ components: {
53
+ root: 'div',
54
+ bottomStart: 'div',
55
+ bottomEnd: 'div',
56
+ topStart: 'div',
57
+ topEnd: 'div'
58
+ },
59
+ root: resolveShorthand(rootProps, {
60
+ required: true
61
+ }),
62
+ bottomStart: createPositionSlot(TOAST_POSITIONS.bottomStart),
63
+ bottomEnd: createPositionSlot(TOAST_POSITIONS.bottomEnd),
64
+ topStart: createPositionSlot(TOAST_POSITIONS.topStart),
65
+ topEnd: createPositionSlot(TOAST_POSITIONS.topEnd),
66
+ announceRef,
67
+ offset,
68
+ announce: announceProp !== null && announceProp !== void 0 ? announceProp : announce,
69
+ renderAriaLive: !announceProp
70
+ };
71
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useToaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n ExtractSlotProps,\n Slot,\n getNativeElementProps,\n resolveShorthand,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport type { ToasterProps, ToasterState } from './Toaster.types';\nimport { TOAST_POSITIONS, ToastPosition, useToaster } from '../../state';\nimport { Announce } from '../AriaLive';\nimport { ToastContainer } from '../ToastContainer';\n\n/**\n * Create the state required to render Toaster.\n *\n * @param props - props from this instance of Toaster\n */\nexport const useToaster_unstable = (props: ToasterProps): ToasterState => {\n const { offset, announce: announceProp, ...rest } = props;\n const announceRef = React.useRef<Announce>(() => null);\n const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus } =\n useToaster<HTMLDivElement>(rest);\n const announce = React.useCallback<Announce>((message, options) => announceRef.current(message, options), []);\n const { dir } = useFluent();\n\n const rootProps = getNativeElementProps('div', rest);\n\n const onFocusPositionSlot = useEventCallback((e: React.FocusEvent) => {\n if (!e.currentTarget.contains(e.relatedTarget)) {\n pauseAllToasts();\n }\n\n rootProps.onFocus?.(e);\n });\n\n const onBlurPositionSlot = useEventCallback((e: React.FocusEvent) => {\n if (!e.currentTarget.contains(e.relatedTarget)) {\n playAllToasts();\n tryRestoreFocus();\n }\n\n rootProps.onBlur?.(e);\n });\n\n const createPositionSlot = (toastPosition: ToastPosition) =>\n resolveShorthand(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n children: toastsToRender.get(toastPosition)?.map(toast => (\n <ToastContainer\n {...toast}\n tryRestoreFocus={tryRestoreFocus}\n intent={toast.intent}\n announce={announce}\n key={toast.toastId}\n visible={isToastVisible(toast.toastId)}\n >\n {toast.content as React.ReactNode}\n </ToastContainer>\n )),\n 'data-toaster-position': toastPosition,\n onFocus: onFocusPositionSlot,\n onBlur: onBlurPositionSlot,\n // Explicitly casting because our slot types can't handle data attributes\n } as ExtractSlotProps<Slot<'div'>>,\n });\n\n return {\n dir,\n components: {\n root: 'div',\n bottomStart: 'div',\n bottomEnd: 'div',\n topStart: 'div',\n topEnd: 'div',\n },\n root: resolveShorthand(rootProps, { required: true }),\n bottomStart: createPositionSlot(TOAST_POSITIONS.bottomStart),\n bottomEnd: createPositionSlot(TOAST_POSITIONS.bottomEnd),\n topStart: createPositionSlot(TOAST_POSITIONS.topStart),\n topEnd: createPositionSlot(TOAST_POSITIONS.topEnd),\n announceRef,\n offset,\n announce: announceProp ?? announce,\n renderAriaLive: !announceProp,\n };\n};\n"],"names":["React","getNativeElementProps","resolveShorthand","useEventCallback","useFluent_unstable","useFluent","TOAST_POSITIONS","useToaster","ToastContainer","useToaster_unstable","props","offset","announce","announceProp","rest","announceRef","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","useCallback","message","options","current","dir","rootProps","onFocusPositionSlot","e","currentTarget","contains","relatedTarget","onFocus","onBlurPositionSlot","onBlur","createPositionSlot","toastPosition","has","defaultProps","children","get","map","toast","intent","key","toastId","visible","content","components","root","bottomStart","bottomEnd","topStart","topEnd","required","renderAriaLive"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAGEC,qBAAqB,EACrBC,gBAAgB,EAChBC,gBAAgB,QACX,4BAA4B;AACnC,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAElF,SAASC,eAAe,EAAiBC,UAAU,QAAQ,cAAc;AAEzE,SAASC,cAAc,QAAQ,oBAAoB;AAEnD;;;;CAIC,GACD,OAAO,MAAMC,sBAAsB,CAACC,QAAsC;IACxE,MAAM,EAAEC,OAAM,EAAEC,UAAUC,aAAY,EAAE,GAAGC,MAAM,GAAGJ;IACpD,MAAMK,cAAcf,MAAMgB,MAAM,CAAW,IAAM,IAAI;IACrD,MAAM,EAAEC,eAAc,EAAEC,eAAc,EAAEC,eAAc,EAAEC,cAAa,EAAEC,gBAAe,EAAE,GACtFd,WAA2BO;IAC7B,MAAMF,WAAWZ,MAAMsB,WAAW,CAAW,CAACC,SAASC,UAAYT,YAAYU,OAAO,CAACF,SAASC,UAAU,EAAE;IAC5G,MAAM,EAAEE,IAAG,EAAE,GAAGrB;IAEhB,MAAMsB,YAAY1B,sBAAsB,OAAOa;IAE/C,MAAMc,sBAAsBzB,iBAAiB,CAAC0B,IAAwB;YAKpEF;QAJA,IAAI,CAACE,EAAEC,aAAa,CAACC,QAAQ,CAACF,EAAEG,aAAa,GAAG;YAC9Cb;QACF,CAAC;QAEDQ,CAAAA,qBAAAA,UAAUM,OAAO,cAAjBN,gCAAAA,KAAAA,IAAAA,mBAAAA,KAAAA,WAAoBE;IACtB;IAEA,MAAMK,qBAAqB/B,iBAAiB,CAAC0B,IAAwB;YAMnEF;QALA,IAAI,CAACE,EAAEC,aAAa,CAACC,QAAQ,CAACF,EAAEG,aAAa,GAAG;YAC9CZ;YACAC;QACF,CAAC;QAEDM,CAAAA,oBAAAA,UAAUQ,MAAM,cAAhBR,+BAAAA,KAAAA,IAAAA,kBAAAA,KAAAA,WAAmBE;IACrB;IAEA,MAAMO,qBAAqB,CAACC;YAGZpB;QAFdf,OAAAA,iBAAiBe,eAAeqB,GAAG,CAACD,iBAAiBV,YAAY,IAAI,EAAE;YACrEY,cAAc;gBACZC,QAAQ,EAAEvB,CAAAA,sBAAAA,eAAewB,GAAG,CAACJ,4BAAnBpB,iCAAAA,KAAAA,IAAAA,oBAAmCyB,IAAIC,CAAAA,sBAC/C,oBAACnC;wBACE,GAAGmC,KAAK;wBACTtB,iBAAiBA;wBACjBuB,QAAQD,MAAMC,MAAM;wBACpBhC,UAAUA;wBACViC,KAAKF,MAAMG,OAAO;wBAClBC,SAAS7B,eAAeyB,MAAMG,OAAO;uBAEpCH,MAAMK,OAAO;gBAGlB,yBAAyBX;gBACzBJ,SAASL;gBACTO,QAAQD;YAEV;QACF;;IAEF,OAAO;QACLR;QACAuB,YAAY;YACVC,MAAM;YACNC,aAAa;YACbC,WAAW;YACXC,UAAU;YACVC,QAAQ;QACV;QACAJ,MAAMhD,iBAAiByB,WAAW;YAAE4B,UAAU,IAAI;QAAC;QACnDJ,aAAaf,mBAAmB9B,gBAAgB6C,WAAW;QAC3DC,WAAWhB,mBAAmB9B,gBAAgB8C,SAAS;QACvDC,UAAUjB,mBAAmB9B,gBAAgB+C,QAAQ;QACrDC,QAAQlB,mBAAmB9B,gBAAgBgD,MAAM;QACjDvC;QACAJ;QACAC,UAAUC,yBAAAA,0BAAAA,eAAgBD,QAAQ;QAClC4C,gBAAgB,CAAC3C;IACnB;AACF,EAAE"}
@@ -0,0 +1,43 @@
1
+ var _state_bottomStart, _state_bottomEnd, _state_topStart, _state_topEnd;
2
+ import { __resetStyles, mergeClasses } from '@griffel/react';
3
+ import { TOAST_POSITIONS, getPositionStyles } from '../../state/index';
4
+ export const toasterClassNames = {
5
+ root: 'fui-Toaster'
6
+ };
7
+ /**
8
+ * Styles for the root slot
9
+ */
10
+ const useRootBaseClassName = /*#__PURE__*/__resetStyles("r3hfdjz", null, [".r3hfdjz{position:fixed;width:292px;pointer-events:none;}"]);
11
+ /**
12
+ * Apply styling to the Toaster slots based on the state
13
+ */
14
+ export const useToasterStyles_unstable = state => {
15
+ const rootBaseClassName = useRootBaseClassName();
16
+ const className = mergeClasses(toasterClassNames.root, rootBaseClassName, state.root.className);
17
+ if (state.bottomStart) {
18
+ state.bottomStart.className = className;
19
+ var _style;
20
+ (_style = (_state_bottomStart = state.bottomStart).style) !== null && _style !== void 0 ? _style : _state_bottomStart.style = {};
21
+ Object.assign(state.bottomStart.style, getPositionStyles(TOAST_POSITIONS.bottomStart, state.dir, state.offset));
22
+ }
23
+ if (state.bottomEnd) {
24
+ state.bottomEnd.className = className;
25
+ var _style1;
26
+ (_style1 = (_state_bottomEnd = state.bottomEnd).style) !== null && _style1 !== void 0 ? _style1 : _state_bottomEnd.style = {};
27
+ Object.assign(state.bottomEnd.style, getPositionStyles(TOAST_POSITIONS.bottomEnd, state.dir, state.offset));
28
+ }
29
+ if (state.topStart) {
30
+ state.topStart.className = className;
31
+ var _style2;
32
+ (_style2 = (_state_topStart = state.topStart).style) !== null && _style2 !== void 0 ? _style2 : _state_topStart.style = {};
33
+ Object.assign(state.topStart.style, getPositionStyles(TOAST_POSITIONS.topStart, state.dir, state.offset));
34
+ }
35
+ if (state.topEnd) {
36
+ state.topEnd.className = className;
37
+ var _style3;
38
+ (_style3 = (_state_topEnd = state.topEnd).style) !== null && _style3 !== void 0 ? _style3 : _state_topEnd.style = {};
39
+ Object.assign(state.topEnd.style, getPositionStyles(TOAST_POSITIONS.topEnd, state.dir, state.offset));
40
+ }
41
+ return state;
42
+ };
43
+ //# sourceMappingURL=useToasterStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_state_bottomStart","_state_bottomEnd","_state_topStart","_state_topEnd","__resetStyles","mergeClasses","TOAST_POSITIONS","getPositionStyles","toasterClassNames","root","useRootBaseClassName","useToasterStyles_unstable","state","rootBaseClassName","className","bottomStart","_style","style","Object","assign","dir","offset","bottomEnd","_style1","topStart","_style2","topEnd","_style3"],"sources":["useToasterStyles.styles.js"],"sourcesContent":["var _state_bottomStart, _state_bottomEnd, _state_topStart, _state_topEnd;\nimport { makeResetStyles, mergeClasses } from '@griffel/react';\nimport { TOAST_POSITIONS, getPositionStyles } from '../../state/index';\nexport const toasterClassNames = {\n root: 'fui-Toaster'\n};\n/**\n * Styles for the root slot\n */ const useRootBaseClassName = makeResetStyles({\n position: 'fixed',\n width: '292px',\n pointerEvents: 'none'\n});\n/**\n * Apply styling to the Toaster slots based on the state\n */ export const useToasterStyles_unstable = (state)=>{\n const rootBaseClassName = useRootBaseClassName();\n const className = mergeClasses(toasterClassNames.root, rootBaseClassName, state.root.className);\n if (state.bottomStart) {\n state.bottomStart.className = className;\n var _style;\n (_style = (_state_bottomStart = state.bottomStart).style) !== null && _style !== void 0 ? _style : _state_bottomStart.style = {};\n Object.assign(state.bottomStart.style, getPositionStyles(TOAST_POSITIONS.bottomStart, state.dir, state.offset));\n }\n if (state.bottomEnd) {\n state.bottomEnd.className = className;\n var _style1;\n (_style1 = (_state_bottomEnd = state.bottomEnd).style) !== null && _style1 !== void 0 ? _style1 : _state_bottomEnd.style = {};\n Object.assign(state.bottomEnd.style, getPositionStyles(TOAST_POSITIONS.bottomEnd, state.dir, state.offset));\n }\n if (state.topStart) {\n state.topStart.className = className;\n var _style2;\n (_style2 = (_state_topStart = state.topStart).style) !== null && _style2 !== void 0 ? _style2 : _state_topStart.style = {};\n Object.assign(state.topStart.style, getPositionStyles(TOAST_POSITIONS.topStart, state.dir, state.offset));\n }\n if (state.topEnd) {\n state.topEnd.className = className;\n var _style3;\n (_style3 = (_state_topEnd = state.topEnd).style) !== null && _style3 !== void 0 ? _style3 : _state_topEnd.style = {};\n Object.assign(state.topEnd.style, getPositionStyles(TOAST_POSITIONS.topEnd, state.dir, state.offset));\n }\n return state;\n};\n"],"mappings":"AAAA,IAAIA,kBAAkB,EAAEC,gBAAgB,EAAEC,eAAe,EAAEC,aAAa;AACxE,SAAAC,aAAA,EAA0BC,YAAY,QAAQ,gBAAgB;AAC9D,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,mBAAmB;AACtE,OAAO,MAAMC,iBAAiB,GAAG;EAC7BC,IAAI,EAAE;AACV,CAAC;AACD;AACA;AACA;AAAI,MAAMC,oBAAoB,gBAAGN,aAAA,+EAIhC,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMO,yBAAyB,GAAIC,KAAK,IAAG;EAClD,MAAMC,iBAAiB,GAAGH,oBAAoB,CAAC,CAAC;EAChD,MAAMI,SAAS,GAAGT,YAAY,CAACG,iBAAiB,CAACC,IAAI,EAAEI,iBAAiB,EAAED,KAAK,CAACH,IAAI,CAACK,SAAS,CAAC;EAC/F,IAAIF,KAAK,CAACG,WAAW,EAAE;IACnBH,KAAK,CAACG,WAAW,CAACD,SAAS,GAAGA,SAAS;IACvC,IAAIE,MAAM;IACV,CAACA,MAAM,GAAG,CAAChB,kBAAkB,GAAGY,KAAK,CAACG,WAAW,EAAEE,KAAK,MAAM,IAAI,IAAID,MAAM,KAAK,KAAK,CAAC,GAAGA,MAAM,GAAGhB,kBAAkB,CAACiB,KAAK,GAAG,CAAC,CAAC;IAChIC,MAAM,CAACC,MAAM,CAACP,KAAK,CAACG,WAAW,CAACE,KAAK,EAAEV,iBAAiB,CAACD,eAAe,CAACS,WAAW,EAAEH,KAAK,CAACQ,GAAG,EAAER,KAAK,CAACS,MAAM,CAAC,CAAC;EACnH;EACA,IAAIT,KAAK,CAACU,SAAS,EAAE;IACjBV,KAAK,CAACU,SAAS,CAACR,SAAS,GAAGA,SAAS;IACrC,IAAIS,OAAO;IACX,CAACA,OAAO,GAAG,CAACtB,gBAAgB,GAAGW,KAAK,CAACU,SAAS,EAAEL,KAAK,MAAM,IAAI,IAAIM,OAAO,KAAK,KAAK,CAAC,GAAGA,OAAO,GAAGtB,gBAAgB,CAACgB,KAAK,GAAG,CAAC,CAAC;IAC7HC,MAAM,CAACC,MAAM,CAACP,KAAK,CAACU,SAAS,CAACL,KAAK,EAAEV,iBAAiB,CAACD,eAAe,CAACgB,SAAS,EAAEV,KAAK,CAACQ,GAAG,EAAER,KAAK,CAACS,MAAM,CAAC,CAAC;EAC/G;EACA,IAAIT,KAAK,CAACY,QAAQ,EAAE;IAChBZ,KAAK,CAACY,QAAQ,CAACV,SAAS,GAAGA,SAAS;IACpC,IAAIW,OAAO;IACX,CAACA,OAAO,GAAG,CAACvB,eAAe,GAAGU,KAAK,CAACY,QAAQ,EAAEP,KAAK,MAAM,IAAI,IAAIQ,OAAO,KAAK,KAAK,CAAC,GAAGA,OAAO,GAAGvB,eAAe,CAACe,KAAK,GAAG,CAAC,CAAC;IAC1HC,MAAM,CAACC,MAAM,CAACP,KAAK,CAACY,QAAQ,CAACP,KAAK,EAAEV,iBAAiB,CAACD,eAAe,CAACkB,QAAQ,EAAEZ,KAAK,CAACQ,GAAG,EAAER,KAAK,CAACS,MAAM,CAAC,CAAC;EAC7G;EACA,IAAIT,KAAK,CAACc,MAAM,EAAE;IACdd,KAAK,CAACc,MAAM,CAACZ,SAAS,GAAGA,SAAS;IAClC,IAAIa,OAAO;IACX,CAACA,OAAO,GAAG,CAACxB,aAAa,GAAGS,KAAK,CAACc,MAAM,EAAET,KAAK,MAAM,IAAI,IAAIU,OAAO,KAAK,KAAK,CAAC,GAAGA,OAAO,GAAGxB,aAAa,CAACc,KAAK,GAAG,CAAC,CAAC;IACpHC,MAAM,CAACC,MAAM,CAACP,KAAK,CAACc,MAAM,CAACT,KAAK,EAAEV,iBAAiB,CAACD,eAAe,CAACoB,MAAM,EAAEd,KAAK,CAACQ,GAAG,EAAER,KAAK,CAACS,MAAM,CAAC,CAAC;EACzG;EACA,OAAOT,KAAK;AAChB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ const toastContainerContextDefaultValue = {
3
+ close: ()=>null,
4
+ intent: undefined,
5
+ bodyId: '',
6
+ titleId: ''
7
+ };
8
+ const ToastContainerContext = /*#__PURE__*/ React.createContext(undefined);
9
+ export const ToastContainerContextProvider = ToastContainerContext.Provider;
10
+ var _React_useContext;
11
+ export const useToastContainerContext = ()=>(_React_useContext = React.useContext(ToastContainerContext)) !== null && _React_useContext !== void 0 ? _React_useContext : toastContainerContextDefaultValue;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["toastContainerContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ToastIntent } from '../state/types';\n\nexport type ToastContainerContextValue = {\n close: () => void;\n intent: ToastIntent | undefined;\n bodyId: string;\n titleId: string;\n};\n\nconst toastContainerContextDefaultValue: ToastContainerContextValue = {\n close: () => null,\n intent: undefined,\n bodyId: '',\n titleId: '',\n};\n\nconst ToastContainerContext = React.createContext<ToastContainerContextValue | undefined>(undefined);\n\nexport const ToastContainerContextProvider = ToastContainerContext.Provider;\nexport const useToastContainerContext = () =>\n React.useContext(ToastContainerContext) ?? toastContainerContextDefaultValue;\n"],"names":["React","toastContainerContextDefaultValue","close","intent","undefined","bodyId","titleId","ToastContainerContext","createContext","ToastContainerContextProvider","Provider","useToastContainerContext","useContext"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAU/B,MAAMC,oCAAgE;IACpEC,OAAO,IAAM,IAAI;IACjBC,QAAQC;IACRC,QAAQ;IACRC,SAAS;AACX;AAEA,MAAMC,sCAAwBP,MAAMQ,aAAa,CAAyCJ;AAE1F,OAAO,MAAMK,gCAAgCF,sBAAsBG,QAAQ,CAAC;IAE1EV;AADF,OAAO,MAAMW,2BAA2B,IACtCX,CAAAA,oBAAAA,MAAMY,UAAU,CAACL,oCAAjBP,+BAAAA,oBAA2CC,iCAAiC,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { useToastController } from './state';
2
+ export { ToastTrigger, useToastTrigger_unstable, renderToastTrigger_unstable } from './ToastTrigger';
3
+ export { Toaster, useToaster_unstable, useToasterStyles_unstable, renderToaster_unstable, toasterClassNames } from './Toaster';
4
+ export { Toast, useToastStyles_unstable, useToast_unstable, renderToast_unstable, toastClassNames } from './Toast';
5
+ export { ToastTitle, useToastTitleStyles_unstable, useToastTitle_unstable, renderToastTitle_unstable, toastTitleClassNames } from './ToastTitle';
6
+ export { ToastBody, useToastBodyStyles_unstable, useToastBody_unstable, renderToastBody_unstable, toastBodyClassNames } from './ToastBody';
7
+ export { ToastFooter, useToastFooterStyles_unstable, useToastFooter_unstable, renderToastFooter_unstable, toastFooterClassNames } from './ToastFooter';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export { useToastController } from './state';\nexport type { ToastPosition, ToastId, ToastOffset, ToastPoliteness, ToastStatus, ToastIntent } from './state';\n\nexport { ToastTrigger, useToastTrigger_unstable, renderToastTrigger_unstable } from './ToastTrigger';\nexport type { ToastTriggerChildProps, ToastTriggerProps, ToastTriggerState } from './ToastTrigger';\nexport {\n Toaster,\n useToaster_unstable,\n useToasterStyles_unstable,\n renderToaster_unstable,\n toasterClassNames,\n} from './Toaster';\nexport type { ToasterProps, ToasterState, ToasterSlots } from './Toaster';\nexport { Toast, useToastStyles_unstable, useToast_unstable, renderToast_unstable, toastClassNames } from './Toast';\nexport type { ToastProps, ToastState, ToastSlots } from './Toast';\n\nexport {\n ToastTitle,\n useToastTitleStyles_unstable,\n useToastTitle_unstable,\n renderToastTitle_unstable,\n toastTitleClassNames,\n} from './ToastTitle';\nexport type { ToastTitleProps, ToastTitleState, ToastTitleSlots } from './ToastTitle';\n\nexport {\n ToastBody,\n useToastBodyStyles_unstable,\n useToastBody_unstable,\n renderToastBody_unstable,\n toastBodyClassNames,\n} from './ToastBody';\nexport type { ToastBodyProps, ToastBodyState, ToastBodySlots } from './ToastBody';\n\nexport {\n ToastFooter,\n useToastFooterStyles_unstable,\n useToastFooter_unstable,\n renderToastFooter_unstable,\n toastFooterClassNames,\n} from './ToastFooter';\nexport type { ToastFooterProps, ToastFooterState, ToastFooterSlots } from './ToastFooter';\n"],"names":["useToastController","ToastTrigger","useToastTrigger_unstable","renderToastTrigger_unstable","Toaster","useToaster_unstable","useToasterStyles_unstable","renderToaster_unstable","toasterClassNames","Toast","useToastStyles_unstable","useToast_unstable","renderToast_unstable","toastClassNames","ToastTitle","useToastTitleStyles_unstable","useToastTitle_unstable","renderToastTitle_unstable","toastTitleClassNames","ToastBody","useToastBodyStyles_unstable","useToastBody_unstable","renderToastBody_unstable","toastBodyClassNames","ToastFooter","useToastFooterStyles_unstable","useToastFooter_unstable","renderToastFooter_unstable","toastFooterClassNames"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,UAAU;AAG7C,SAASC,YAAY,EAAEC,wBAAwB,EAAEC,2BAA2B,QAAQ,iBAAiB;AAErG,SACEC,OAAO,EACPC,mBAAmB,EACnBC,yBAAyB,EACzBC,sBAAsB,EACtBC,iBAAiB,QACZ,YAAY;AAEnB,SAASC,KAAK,EAAEC,uBAAuB,EAAEC,iBAAiB,EAAEC,oBAAoB,EAAEC,eAAe,QAAQ,UAAU;AAGnH,SACEC,UAAU,EACVC,4BAA4B,EAC5BC,sBAAsB,EACtBC,yBAAyB,EACzBC,oBAAoB,QACf,eAAe;AAGtB,SACEC,SAAS,EACTC,2BAA2B,EAC3BC,qBAAqB,EACrBC,wBAAwB,EACxBC,mBAAmB,QACd,cAAc;AAGrB,SACEC,WAAW,EACXC,6BAA6B,EAC7BC,uBAAuB,EACvBC,0BAA0B,EAC1BC,qBAAqB,QAChB,gBAAgB"}
@@ -0,0 +1,14 @@
1
+ export const EVENTS = {
2
+ show: 'fui-toast-show',
3
+ dismiss: 'fui-toast-dismiss',
4
+ dismissAll: 'fui-toast-dismiss-all',
5
+ update: 'fui-toast-update',
6
+ pause: 'fui-toast-pause',
7
+ play: 'fui-toast-play'
8
+ };
9
+ export const TOAST_POSITIONS = {
10
+ bottomEnd: 'bottom-end',
11
+ bottomStart: 'bottom-start',
12
+ topEnd: 'top-end',
13
+ topStart: 'top-start'
14
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["constants.ts"],"sourcesContent":["export const EVENTS = {\n show: 'fui-toast-show',\n dismiss: 'fui-toast-dismiss',\n dismissAll: 'fui-toast-dismiss-all',\n update: 'fui-toast-update',\n pause: 'fui-toast-pause',\n play: 'fui-toast-play',\n} as const;\n\nexport const TOAST_POSITIONS = {\n bottomEnd: 'bottom-end',\n bottomStart: 'bottom-start',\n topEnd: 'top-end',\n topStart: 'top-start',\n} as const;\n"],"names":["EVENTS","show","dismiss","dismissAll","update","pause","play","TOAST_POSITIONS","bottomEnd","bottomStart","topEnd","topStart"],"mappings":"AAAA,OAAO,MAAMA,SAAS;IACpBC,MAAM;IACNC,SAAS;IACTC,YAAY;IACZC,QAAQ;IACRC,OAAO;IACPC,MAAM;AACR,EAAW;AAEX,OAAO,MAAMC,kBAAkB;IAC7BC,WAAW;IACXC,aAAa;IACbC,QAAQ;IACRC,UAAU;AACZ,EAAW"}
@@ -0,0 +1,5 @@
1
+ export * from './types';
2
+ export * from './useToaster';
3
+ export * from './useToastController';
4
+ export { getPositionStyles } from './vanilla';
5
+ export { TOAST_POSITIONS } from './constants';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './types';\nexport * from './useToaster';\nexport * from './useToastController';\nexport { getPositionStyles } from './vanilla';\nexport { TOAST_POSITIONS } from './constants';\n"],"names":["getPositionStyles","TOAST_POSITIONS"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,uBAAuB;AACrC,SAASA,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,eAAe,QAAQ,cAAc"}
@@ -0,0 +1 @@
1
+ import * as React from 'react';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["types.ts"],"sourcesContent":["import type { Slot } from '@fluentui/react-utilities';\nimport { EVENTS } from './constants';\nimport * as React from 'react';\n\nexport type ToastId = string;\nexport type ToasterId = string;\n\nexport type ToastPosition = 'top-end' | 'top-start' | 'bottom-end' | 'bottom-start';\nexport type ToastPoliteness = 'assertive' | 'polite';\nexport type ToastStatus = 'queued' | 'visible' | 'dismissed' | 'unmounted';\nexport type ToastIntent = 'info' | 'success' | 'error' | 'warning';\nexport type ToastChangeHandler = (event: null, data: ToastChangeData) => void;\n\nexport interface ToastChangeData extends ToastOptions, Pick<Toast, 'updateId'> {\n status: ToastStatus;\n}\n\nexport interface ToastOptions<TData = object> {\n /**\n * Uniquely identifies a toast, used for update and dismiss operations\n */\n toastId: ToastId;\n /**\n * The position the toast should render to\n */\n position: ToastPosition;\n /**\n * Toast content\n */\n content: unknown;\n /**\n * Auto dismiss timeout in milliseconds\n * @default 3000\n */\n timeout: number;\n /**\n * Toast timeout pauses while focus is on another window\n * @default false\n */\n pauseOnWindowBlur: boolean;\n /**\n * Toast timeout pauses while user cursor is on the toast\n * @default false\n */\n pauseOnHover: boolean;\n /**\n * Toast belongs to a specific toaster\n */\n toasterId: ToasterId | undefined;\n /**\n * Higher priority toasts will be rendered before lower priority toasts\n */\n priority: number;\n /**\n * Used to determine [aria-live](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) narration\n * This will override the intent prop\n */\n politeness?: ToastPoliteness;\n\n /**\n * Default toast types that determine the urgency or [aria-live](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) narration\n * The UI layer may use these intents to apply specific styling.\n * @default info\n */\n intent?: ToastIntent;\n /**\n * Additional data that needs to be passed to the toast\n */\n data: TData;\n\n /**\n * Reports changes to the Toast lifecycle\n */\n onStatusChange: ToastChangeHandler | undefined;\n}\n\nexport interface ToastOffsetObject {\n horizontal?: number;\n vertical?: number;\n}\n\nexport type ToastOffset = Partial<Record<ToastPosition, ToastOffsetObject>> | ToastOffsetObject;\n\nexport interface ToasterShortcuts {\n focus: (e: KeyboardEvent) => boolean;\n}\n\nexport interface ToasterOptions\n extends Pick<ToastOptions, 'position' | 'timeout' | 'pauseOnWindowBlur' | 'pauseOnHover' | 'priority'> {\n offset?: ToastOffset;\n toasterId?: ToasterId;\n limit?: number;\n shortcuts?: ToasterShortcuts;\n}\n\nexport interface Toast<TData = object> extends ToastOptions<TData> {\n /**\n * Determines the visiblity of a toast\n */\n close: () => void;\n /**\n * Removes a toast completely\n */\n remove: () => void;\n /**\n * A number used to track updates immutably\n */\n updateId: number;\n /**\n * Used to determine default priority when the user does not set one\n * Simple counter of toasts dispatched.\n */\n order: number;\n\n imperativeRef: React.RefObject<ToastImperativeRef>;\n}\n\nexport interface CommonToastDetail {\n toasterId?: ToasterId;\n}\n\nexport interface ShowToastEventDetail extends Partial<ToastOptions>, CommonToastDetail {\n toastId: ToastId;\n}\n\nexport interface UpdateToastEventDetail extends Partial<ToastOptions>, CommonToastDetail {\n toastId: ToastId;\n}\n\nexport interface DismissToastEventDetail extends CommonToastDetail {\n toastId: ToastId;\n}\n\nexport interface PauseToastEventDetail extends CommonToastDetail {\n toastId: ToastId;\n}\n\nexport interface PlayToastEventDetail extends CommonToastDetail {\n toastId: ToastId;\n}\n\nexport interface DismissAllToastsEventDetail extends CommonToastDetail {}\n\ntype EventListener<TDetail> = (e: CustomEvent<TDetail>) => void;\n\nexport type ToastListenerMap = {\n [EVENTS.show]: EventListener<ShowToastEventDetail>;\n [EVENTS.dismiss]: EventListener<DismissToastEventDetail>;\n [EVENTS.dismissAll]: EventListener<DismissAllToastsEventDetail>;\n [EVENTS.update]: EventListener<UpdateToastEventDetail>;\n [EVENTS.play]: EventListener<PlayToastEventDetail>;\n [EVENTS.pause]: EventListener<PauseToastEventDetail>;\n};\n\ntype RootSlot = Slot<'div'>;\n\nexport interface DispatchToastOptions extends Partial<Omit<ToastOptions, 'toasterId'>> {\n root?: RootSlot;\n}\n\nexport interface UpdateToastOptions extends UpdateToastEventDetail {\n root?: RootSlot;\n}\n\nexport type ToastImperativeRef = {\n /**\n * Focuses the Toast.\n * If there are no focusable elements in the Toast, the Toast itself is focused.\n */\n focus: () => void;\n\n /**\n * Resumes the timeout of a paused toast\n */\n play: () => void;\n\n /**\n * Pauses the timeout of a toast\n */\n pause: () => void;\n};\n"],"names":["React"],"mappings":"AAEA,YAAYA,WAAW,QAAQ"}
@@ -0,0 +1,57 @@
1
+ import * as React from 'react';
2
+ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
3
+ import { dispatchToast as dispatchToastVanilla, dismissToast as dismissToastVanilla, dismissAllToasts as dismissAllToastsVanilla, updateToast as updateToastVanilla, playToast as playToastVanilla, pauseToast as pauseToastVanilla } from './vanilla';
4
+ const noop = ()=>undefined;
5
+ /**
6
+ * @param toasterId - If an id is provided all imperative methods control that specific toaster
7
+ * @returns Imperative methods to control toasts
8
+ */ export function useToastController(toasterId) {
9
+ const { targetDocument } = useFluent();
10
+ return React.useMemo(()=>{
11
+ if (!targetDocument) {
12
+ return {
13
+ dispatchToast: noop,
14
+ dismissToast: noop,
15
+ dismissAllToasts: noop,
16
+ updateToast: noop,
17
+ pauseToast: noop,
18
+ playToast: noop
19
+ };
20
+ }
21
+ return {
22
+ dispatchToast: (content, options)=>{
23
+ dispatchToastVanilla(content, {
24
+ ...options,
25
+ toasterId,
26
+ data: {
27
+ root: options === null || options === void 0 ? void 0 : options.root
28
+ }
29
+ }, targetDocument);
30
+ },
31
+ dismissToast: (toastId)=>{
32
+ dismissToastVanilla(toastId, toasterId, targetDocument);
33
+ },
34
+ dismissAllToasts: ()=>{
35
+ dismissAllToastsVanilla(toasterId, targetDocument);
36
+ },
37
+ updateToast: (options)=>{
38
+ updateToastVanilla({
39
+ ...options,
40
+ data: {
41
+ root: options.root
42
+ },
43
+ toasterId
44
+ }, targetDocument);
45
+ },
46
+ pauseToast: (toastId)=>{
47
+ pauseToastVanilla(toastId, toasterId, targetDocument);
48
+ },
49
+ playToast: (toastId)=>{
50
+ playToastVanilla(toastId, toasterId, targetDocument);
51
+ }
52
+ };
53
+ }, [
54
+ targetDocument,
55
+ toasterId
56
+ ]);
57
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useToastController.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport {\n dispatchToast as dispatchToastVanilla,\n dismissToast as dismissToastVanilla,\n dismissAllToasts as dismissAllToastsVanilla,\n updateToast as updateToastVanilla,\n playToast as playToastVanilla,\n pauseToast as pauseToastVanilla,\n} from './vanilla';\nimport { DispatchToastOptions, ToastId, ToasterId, UpdateToastOptions } from './types';\n\nconst noop = () => undefined;\n\n/**\n * @param toasterId - If an id is provided all imperative methods control that specific toaster\n * @returns Imperative methods to control toasts\n */\nexport function useToastController(toasterId?: ToasterId) {\n const { targetDocument } = useFluent();\n\n return React.useMemo(() => {\n if (!targetDocument) {\n return {\n dispatchToast: noop,\n dismissToast: noop,\n dismissAllToasts: noop,\n updateToast: noop,\n pauseToast: noop,\n playToast: noop,\n };\n }\n\n return {\n dispatchToast: (content: React.ReactNode, options?: DispatchToastOptions) => {\n dispatchToastVanilla(content, { ...options, toasterId, data: { root: options?.root } }, targetDocument);\n },\n dismissToast: (toastId: ToastId) => {\n dismissToastVanilla(toastId, toasterId, targetDocument);\n },\n dismissAllToasts: () => {\n dismissAllToastsVanilla(toasterId, targetDocument);\n },\n updateToast: (options: UpdateToastOptions) => {\n updateToastVanilla({ ...options, data: { root: options.root }, toasterId }, targetDocument);\n },\n pauseToast: (toastId: ToastId) => {\n pauseToastVanilla(toastId, toasterId, targetDocument);\n },\n playToast: (toastId: ToastId) => {\n playToastVanilla(toastId, toasterId, targetDocument);\n },\n };\n }, [targetDocument, toasterId]);\n}\n"],"names":["React","useFluent_unstable","useFluent","dispatchToast","dispatchToastVanilla","dismissToast","dismissToastVanilla","dismissAllToasts","dismissAllToastsVanilla","updateToast","updateToastVanilla","playToast","playToastVanilla","pauseToast","pauseToastVanilla","noop","undefined","useToastController","toasterId","targetDocument","useMemo","content","options","data","root","toastId"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SACEC,iBAAiBC,oBAAoB,EACrCC,gBAAgBC,mBAAmB,EACnCC,oBAAoBC,uBAAuB,EAC3CC,eAAeC,kBAAkB,EACjCC,aAAaC,gBAAgB,EAC7BC,cAAcC,iBAAiB,QAC1B,YAAY;AAGnB,MAAMC,OAAO,IAAMC;AAEnB;;;CAGC,GACD,OAAO,SAASC,mBAAmBC,SAAqB,EAAE;IACxD,MAAM,EAAEC,eAAc,EAAE,GAAGjB;IAE3B,OAAOF,MAAMoB,OAAO,CAAC,IAAM;QACzB,IAAI,CAACD,gBAAgB;YACnB,OAAO;gBACLhB,eAAeY;gBACfV,cAAcU;gBACdR,kBAAkBQ;gBAClBN,aAAaM;gBACbF,YAAYE;gBACZJ,WAAWI;YACb;QACF,CAAC;QAED,OAAO;YACLZ,eAAe,CAACkB,SAA0BC,UAAmC;gBAC3ElB,qBAAqBiB,SAAS;oBAAE,GAAGC,OAAO;oBAAEJ;oBAAWK,MAAM;wBAAEC,MAAMF,oBAAAA,qBAAAA,KAAAA,IAAAA,QAASE,IAAI;oBAAC;gBAAE,GAAGL;YAC1F;YACAd,cAAc,CAACoB,UAAqB;gBAClCnB,oBAAoBmB,SAASP,WAAWC;YAC1C;YACAZ,kBAAkB,IAAM;gBACtBC,wBAAwBU,WAAWC;YACrC;YACAV,aAAa,CAACa,UAAgC;gBAC5CZ,mBAAmB;oBAAE,GAAGY,OAAO;oBAAEC,MAAM;wBAAEC,MAAMF,QAAQE,IAAI;oBAAC;oBAAGN;gBAAU,GAAGC;YAC9E;YACAN,YAAY,CAACY,UAAqB;gBAChCX,kBAAkBW,SAASP,WAAWC;YACxC;YACAR,WAAW,CAACc,UAAqB;gBAC/Bb,iBAAiBa,SAASP,WAAWC;YACvC;QACF;IACF,GAAG;QAACA;QAAgBD;KAAU;AAChC,CAAC"}