@fluentui/react-toast 9.7.1 → 9.7.2

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 (150) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/lib/components/AriaLive/AriaLive.js +1 -0
  3. package/lib/components/AriaLive/AriaLive.js.map +1 -1
  4. package/lib/components/AriaLive/useAriaLive.js +1 -0
  5. package/lib/components/AriaLive/useAriaLive.js.map +1 -1
  6. package/lib/components/AriaLive/useAriaLiveStyles.styles.js +2 -0
  7. package/lib/components/AriaLive/useAriaLiveStyles.styles.js.map +1 -1
  8. package/lib/components/AriaLive/useAriaLiveStyles.styles.raw.js +1 -0
  9. package/lib/components/AriaLive/useAriaLiveStyles.styles.raw.js.map +1 -1
  10. package/lib/components/Timer/Timer.js +1 -0
  11. package/lib/components/Timer/Timer.js.map +1 -1
  12. package/lib/components/Toast/Toast.js +1 -0
  13. package/lib/components/Toast/Toast.js.map +1 -1
  14. package/lib/components/Toast/useToast.js +1 -0
  15. package/lib/components/Toast/useToast.js.map +1 -1
  16. package/lib/components/Toast/useToastStyles.styles.js +2 -0
  17. package/lib/components/Toast/useToastStyles.styles.js.map +1 -1
  18. package/lib/components/Toast/useToastStyles.styles.raw.js +1 -0
  19. package/lib/components/Toast/useToastStyles.styles.raw.js.map +1 -1
  20. package/lib/components/ToastBody/ToastBody.js +1 -0
  21. package/lib/components/ToastBody/ToastBody.js.map +1 -1
  22. package/lib/components/ToastBody/useToastBody.js +1 -0
  23. package/lib/components/ToastBody/useToastBody.js.map +1 -1
  24. package/lib/components/ToastBody/useToastBodyStyles.styles.js +3 -1
  25. package/lib/components/ToastBody/useToastBodyStyles.styles.js.map +1 -1
  26. package/lib/components/ToastBody/useToastBodyStyles.styles.raw.js +2 -1
  27. package/lib/components/ToastBody/useToastBodyStyles.styles.raw.js.map +1 -1
  28. package/lib/components/ToastContainer/ToastContainer.js +1 -0
  29. package/lib/components/ToastContainer/ToastContainer.js.map +1 -1
  30. package/lib/components/ToastContainer/renderToastContainer.js +2 -1
  31. package/lib/components/ToastContainer/renderToastContainer.js.map +1 -1
  32. package/lib/components/ToastContainer/useToastContainer.js +1 -0
  33. package/lib/components/ToastContainer/useToastContainer.js.map +1 -1
  34. package/lib/components/ToastContainer/useToastContainerContextValues.js +1 -0
  35. package/lib/components/ToastContainer/useToastContainerContextValues.js.map +1 -1
  36. package/lib/components/ToastContainer/useToastContainerStyles.styles.js +2 -0
  37. package/lib/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -1
  38. package/lib/components/ToastContainer/useToastContainerStyles.styles.raw.js +1 -0
  39. package/lib/components/ToastContainer/useToastContainerStyles.styles.raw.js.map +1 -1
  40. package/lib/components/ToastFooter/ToastFooter.js +1 -0
  41. package/lib/components/ToastFooter/ToastFooter.js.map +1 -1
  42. package/lib/components/ToastFooter/useToastFooterStyles.styles.js +2 -0
  43. package/lib/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -1
  44. package/lib/components/ToastFooter/useToastFooterStyles.styles.raw.js +1 -0
  45. package/lib/components/ToastFooter/useToastFooterStyles.styles.raw.js.map +1 -1
  46. package/lib/components/ToastTitle/ToastTitle.js +1 -0
  47. package/lib/components/ToastTitle/ToastTitle.js.map +1 -1
  48. package/lib/components/ToastTitle/useToastTitle.js +1 -0
  49. package/lib/components/ToastTitle/useToastTitle.js.map +1 -1
  50. package/lib/components/ToastTitle/useToastTitleStyles.styles.js +2 -0
  51. package/lib/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
  52. package/lib/components/ToastTitle/useToastTitleStyles.styles.raw.js +1 -0
  53. package/lib/components/ToastTitle/useToastTitleStyles.styles.raw.js.map +1 -1
  54. package/lib/components/ToastTrigger/ToastTrigger.js +1 -0
  55. package/lib/components/ToastTrigger/ToastTrigger.js.map +1 -1
  56. package/lib/components/ToastTrigger/useToastTrigger.js +1 -0
  57. package/lib/components/ToastTrigger/useToastTrigger.js.map +1 -1
  58. package/lib/components/Toaster/Toaster.js +1 -0
  59. package/lib/components/Toaster/Toaster.js.map +1 -1
  60. package/lib/components/Toaster/useToastAnnounce.js +1 -0
  61. package/lib/components/Toaster/useToastAnnounce.js.map +1 -1
  62. package/lib/components/Toaster/useToaster.js +1 -0
  63. package/lib/components/Toaster/useToaster.js.map +1 -1
  64. package/lib/components/Toaster/useToasterFocusManagement.js +1 -0
  65. package/lib/components/Toaster/useToasterFocusManagement.js.map +1 -1
  66. package/lib/components/Toaster/useToasterStyles.styles.js +2 -0
  67. package/lib/components/Toaster/useToasterStyles.styles.js.map +1 -1
  68. package/lib/components/Toaster/useToasterStyles.styles.raw.js +1 -0
  69. package/lib/components/Toaster/useToasterStyles.styles.raw.js.map +1 -1
  70. package/lib/contexts/toastContainerContext.js +1 -0
  71. package/lib/contexts/toastContainerContext.js.map +1 -1
  72. package/lib/state/useToastController.js +1 -0
  73. package/lib/state/useToastController.js.map +1 -1
  74. package/lib/state/useToaster.js +1 -0
  75. package/lib/state/useToaster.js.map +1 -1
  76. package/lib-commonjs/components/AriaLive/AriaLive.js +1 -0
  77. package/lib-commonjs/components/AriaLive/AriaLive.js.map +1 -1
  78. package/lib-commonjs/components/AriaLive/useAriaLive.js +1 -0
  79. package/lib-commonjs/components/AriaLive/useAriaLive.js.map +1 -1
  80. package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js +1 -0
  81. package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js.map +1 -1
  82. package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.raw.js +1 -0
  83. package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.raw.js.map +1 -1
  84. package/lib-commonjs/components/Timer/Timer.js +1 -0
  85. package/lib-commonjs/components/Timer/Timer.js.map +1 -1
  86. package/lib-commonjs/components/Toast/Toast.js +1 -0
  87. package/lib-commonjs/components/Toast/Toast.js.map +1 -1
  88. package/lib-commonjs/components/Toast/useToast.js +1 -0
  89. package/lib-commonjs/components/Toast/useToast.js.map +1 -1
  90. package/lib-commonjs/components/Toast/useToastStyles.styles.js +1 -0
  91. package/lib-commonjs/components/Toast/useToastStyles.styles.js.map +1 -1
  92. package/lib-commonjs/components/Toast/useToastStyles.styles.raw.js +1 -0
  93. package/lib-commonjs/components/Toast/useToastStyles.styles.raw.js.map +1 -1
  94. package/lib-commonjs/components/ToastBody/ToastBody.js +1 -0
  95. package/lib-commonjs/components/ToastBody/ToastBody.js.map +1 -1
  96. package/lib-commonjs/components/ToastBody/useToastBody.js +1 -0
  97. package/lib-commonjs/components/ToastBody/useToastBody.js.map +1 -1
  98. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js +3 -2
  99. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js.map +1 -1
  100. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.raw.js +2 -1
  101. package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.raw.js.map +1 -1
  102. package/lib-commonjs/components/ToastContainer/ToastContainer.js +1 -0
  103. package/lib-commonjs/components/ToastContainer/ToastContainer.js.map +1 -1
  104. package/lib-commonjs/components/ToastContainer/renderToastContainer.js +1 -0
  105. package/lib-commonjs/components/ToastContainer/renderToastContainer.js.map +1 -1
  106. package/lib-commonjs/components/ToastContainer/useToastContainer.js +1 -0
  107. package/lib-commonjs/components/ToastContainer/useToastContainer.js.map +1 -1
  108. package/lib-commonjs/components/ToastContainer/useToastContainerContextValues.js +1 -0
  109. package/lib-commonjs/components/ToastContainer/useToastContainerContextValues.js.map +1 -1
  110. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js +1 -0
  111. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -1
  112. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.raw.js +1 -0
  113. package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.raw.js.map +1 -1
  114. package/lib-commonjs/components/ToastFooter/ToastFooter.js +1 -0
  115. package/lib-commonjs/components/ToastFooter/ToastFooter.js.map +1 -1
  116. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js +1 -0
  117. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -1
  118. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.raw.js +1 -0
  119. package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.raw.js.map +1 -1
  120. package/lib-commonjs/components/ToastTitle/ToastTitle.js +1 -0
  121. package/lib-commonjs/components/ToastTitle/ToastTitle.js.map +1 -1
  122. package/lib-commonjs/components/ToastTitle/useToastTitle.js +1 -0
  123. package/lib-commonjs/components/ToastTitle/useToastTitle.js.map +1 -1
  124. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js +1 -0
  125. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
  126. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.raw.js +1 -0
  127. package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.raw.js.map +1 -1
  128. package/lib-commonjs/components/ToastTrigger/ToastTrigger.js +1 -0
  129. package/lib-commonjs/components/ToastTrigger/ToastTrigger.js.map +1 -1
  130. package/lib-commonjs/components/ToastTrigger/useToastTrigger.js +1 -0
  131. package/lib-commonjs/components/ToastTrigger/useToastTrigger.js.map +1 -1
  132. package/lib-commonjs/components/Toaster/Toaster.js +1 -0
  133. package/lib-commonjs/components/Toaster/Toaster.js.map +1 -1
  134. package/lib-commonjs/components/Toaster/useToastAnnounce.js +1 -0
  135. package/lib-commonjs/components/Toaster/useToastAnnounce.js.map +1 -1
  136. package/lib-commonjs/components/Toaster/useToaster.js +1 -0
  137. package/lib-commonjs/components/Toaster/useToaster.js.map +1 -1
  138. package/lib-commonjs/components/Toaster/useToasterFocusManagement.js +1 -0
  139. package/lib-commonjs/components/Toaster/useToasterFocusManagement.js.map +1 -1
  140. package/lib-commonjs/components/Toaster/useToasterStyles.styles.js +1 -0
  141. package/lib-commonjs/components/Toaster/useToasterStyles.styles.js.map +1 -1
  142. package/lib-commonjs/components/Toaster/useToasterStyles.styles.raw.js +1 -0
  143. package/lib-commonjs/components/Toaster/useToasterStyles.styles.raw.js.map +1 -1
  144. package/lib-commonjs/contexts/toastContainerContext.js +1 -0
  145. package/lib-commonjs/contexts/toastContainerContext.js.map +1 -1
  146. package/lib-commonjs/state/useToastController.js +1 -0
  147. package/lib-commonjs/state/useToastController.js.map +1 -1
  148. package/lib-commonjs/state/useToaster.js +1 -0
  149. package/lib-commonjs/state/useToaster.js.map +1 -1
  150. package/package.json +9 -9
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ToastTitle/useToastTitleStyles.styles.ts"],"sourcesContent":["import { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ToastTitleSlots, ToastTitleState } from './ToastTitle.types';\n\nexport const toastTitleClassNames: SlotClassNames<ToastTitleSlots> = {\n root: 'fui-ToastTitle',\n media: 'fui-ToastTitle__media',\n action: 'fui-ToastTitle__action',\n};\n\nconst useRootBaseClassName = makeResetStyles({\n display: 'flex',\n gridColumnEnd: 3,\n color: tokens.colorNeutralForeground1,\n wordBreak: 'break-word',\n});\n\nconst useMediaBaseClassName = makeResetStyles({\n display: 'flex',\n paddingTop: '2px',\n gridColumnEnd: 2,\n paddingRight: '8px',\n fontSize: '16px',\n color: tokens.colorNeutralForeground1,\n});\n\nconst useActionBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'start',\n paddingLeft: '12px',\n gridColumnEnd: -1,\n color: tokens.colorBrandForeground1,\n});\n\nconst useInvertedStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForegroundInverted2,\n },\n\n action: {\n color: tokens.colorBrandForegroundInverted,\n },\n\n media: {\n color: tokens.colorNeutralForegroundInverted,\n },\n});\n\nconst useIntentIconStyles = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForeground1,\n },\n error: {\n color: tokens.colorStatusDangerForeground1,\n },\n warning: {\n color: tokens.colorStatusWarningForeground1,\n },\n info: {\n color: tokens.colorNeutralForeground2,\n },\n});\n\nconst useIntentIconStylesInverted = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForegroundInverted,\n },\n error: {\n color: tokens.colorStatusDangerForegroundInverted,\n },\n warning: {\n color: tokens.colorStatusWarningForegroundInverted,\n },\n info: {\n color: tokens.colorNeutralForegroundInverted2,\n },\n});\n\n/**\n * Apply styling to the ToastTitle slots based on the state\n */\nexport const useToastTitleStyles_unstable = (state: ToastTitleState): ToastTitleState => {\n 'use no memo';\n\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(\n toastTitleClassNames.root,\n rootBaseClassName,\n state.backgroundAppearance === 'inverted' && invertedStyles.root,\n state.root.className,\n );\n\n if (state.media) {\n state.media.className = mergeClasses(\n toastTitleClassNames.media,\n mediaBaseClassName,\n state.backgroundAppearance === 'inverted' && invertedStyles.media,\n intent && intentIconStyles[intent],\n intent && state.backgroundAppearance === 'inverted' && intentIconStylesInverted[intent],\n state.media.className,\n );\n }\n\n if (state.action) {\n state.action.className = mergeClasses(\n toastTitleClassNames.action,\n actionBaseClassName,\n state.backgroundAppearance === 'inverted' && invertedStyles.action,\n state.action.className,\n );\n }\n\n return state;\n};\n"],"names":["makeStyles","makeResetStyles","mergeClasses","tokens","toastTitleClassNames","root","media","action","useRootBaseClassName","display","gridColumnEnd","color","colorNeutralForeground1","wordBreak","useMediaBaseClassName","paddingTop","paddingRight","fontSize","useActionBaseClassName","alignItems","paddingLeft","colorBrandForeground1","useInvertedStyles","colorNeutralForegroundInverted2","colorBrandForegroundInverted","colorNeutralForegroundInverted","useIntentIconStyles","success","colorStatusSuccessForeground1","error","colorStatusDangerForeground1","warning","colorStatusWarningForeground1","info","colorNeutralForeground2","useIntentIconStylesInverted","colorStatusSuccessForegroundInverted","colorStatusDangerForegroundInverted","colorStatusWarningForegroundInverted","useToastTitleStyles_unstable","state","rootBaseClassName","actionBaseClassName","mediaBaseClassName","intentIconStyles","intentIconStylesInverted","intent","invertedStyles","className","backgroundAppearance"],"mappings":";;;;;;;;;;;IAKaI,oBAAAA;;;gCA6EAmC;eAAAA;;;uBAlF6C,iBAAiB;4BACpD,wBAAwB;AAIxC,6BAA8D;IACnElC,MAAM;IACNC,OAAO;IACPC,QAAQ;AACV,EAAE;AAEF,MAAMC,2BAAuBP,sBAAAA,EAAgB;IAC3CQ,SAAS;IACTC,eAAe;IACfC,OAAOR,kBAAAA,CAAOS,uBAAuB;IACrCC,WAAW;AACb;AAEA,MAAMC,4BAAwBb,sBAAAA,EAAgB;IAC5CQ,SAAS;IACTM,YAAY;IACZL,eAAe;IACfM,cAAc;IACdC,UAAU;IACVN,OAAOR,kBAAAA,CAAOS,uBAAuB;AACvC;AAEA,MAAMM,6BAAyBjB,sBAAAA,EAAgB;IAC7CQ,SAAS;IACTU,YAAY;IACZC,aAAa;IACbV,eAAe,CAAC;IAChBC,OAAOR,kBAAAA,CAAOkB,qBAAqB;AACrC;AAEA,MAAMC,wBAAoBtB,iBAAAA,EAAW;IACnCK,MAAM;QACJM,OAAOR,kBAAAA,CAAOoB,+BAA+B;IAC/C;IAEAhB,QAAQ;QACNI,OAAOR,kBAAAA,CAAOqB,4BAA4B;IAC5C;IAEAlB,OAAO;QACLK,OAAOR,kBAAAA,CAAOsB,8BAA8B;IAC9C;AACF;AAEA,MAAMC,0BAAsB1B,iBAAAA,EAAW;IACrC2B,SAAS;QACPhB,OAAOR,kBAAAA,CAAOyB,6BAA6B;IAC7C;IACAC,OAAO;QACLlB,OAAOR,kBAAAA,CAAO2B,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EAC3BmC,qBACAF,MAAMS,oBAAoB,KAAK,cAAcF,eAAexC,MAAM,EAClEiC,MAAMjC,MAAM,CAACyC,SAAS;IAE1B;IAEA,OAAOR;AACT,EAAE"}
1
+ {"version":3,"sources":["../src/components/ToastTitle/useToastTitleStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ToastTitleSlots, ToastTitleState } from './ToastTitle.types';\n\nexport const toastTitleClassNames: SlotClassNames<ToastTitleSlots> = {\n root: 'fui-ToastTitle',\n media: 'fui-ToastTitle__media',\n action: 'fui-ToastTitle__action',\n};\n\nconst useRootBaseClassName = makeResetStyles({\n display: 'flex',\n gridColumnEnd: 3,\n color: tokens.colorNeutralForeground1,\n wordBreak: 'break-word',\n});\n\nconst useMediaBaseClassName = makeResetStyles({\n display: 'flex',\n paddingTop: '2px',\n gridColumnEnd: 2,\n paddingRight: '8px',\n fontSize: '16px',\n color: tokens.colorNeutralForeground1,\n});\n\nconst useActionBaseClassName = makeResetStyles({\n display: 'flex',\n alignItems: 'start',\n paddingLeft: '12px',\n gridColumnEnd: -1,\n color: tokens.colorBrandForeground1,\n});\n\nconst useInvertedStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForegroundInverted2,\n },\n\n action: {\n color: tokens.colorBrandForegroundInverted,\n },\n\n media: {\n color: tokens.colorNeutralForegroundInverted,\n },\n});\n\nconst useIntentIconStyles = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForeground1,\n },\n error: {\n color: tokens.colorStatusDangerForeground1,\n },\n warning: {\n color: tokens.colorStatusWarningForeground1,\n },\n info: {\n color: tokens.colorNeutralForeground2,\n },\n});\n\nconst useIntentIconStylesInverted = makeStyles({\n success: {\n color: tokens.colorStatusSuccessForegroundInverted,\n },\n error: {\n color: tokens.colorStatusDangerForegroundInverted,\n },\n warning: {\n color: tokens.colorStatusWarningForegroundInverted,\n },\n info: {\n color: tokens.colorNeutralForegroundInverted2,\n },\n});\n\n/**\n * Apply styling to the ToastTitle slots based on the state\n */\nexport const useToastTitleStyles_unstable = (state: ToastTitleState): ToastTitleState => {\n 'use no memo';\n\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(\n toastTitleClassNames.root,\n rootBaseClassName,\n state.backgroundAppearance === 'inverted' && invertedStyles.root,\n state.root.className,\n );\n\n if (state.media) {\n state.media.className = mergeClasses(\n toastTitleClassNames.media,\n mediaBaseClassName,\n state.backgroundAppearance === 'inverted' && invertedStyles.media,\n intent && intentIconStyles[intent],\n intent && state.backgroundAppearance === 'inverted' && intentIconStylesInverted[intent],\n state.media.className,\n );\n }\n\n if (state.action) {\n state.action.className = mergeClasses(\n toastTitleClassNames.action,\n actionBaseClassName,\n state.backgroundAppearance === 'inverted' && invertedStyles.action,\n state.action.className,\n );\n }\n\n return state;\n};\n"],"names":["makeStyles","makeResetStyles","mergeClasses","tokens","toastTitleClassNames","root","media","action","useRootBaseClassName","display","gridColumnEnd","color","colorNeutralForeground1","wordBreak","useMediaBaseClassName","paddingTop","paddingRight","fontSize","useActionBaseClassName","alignItems","paddingLeft","colorBrandForeground1","useInvertedStyles","colorNeutralForegroundInverted2","colorBrandForegroundInverted","colorNeutralForegroundInverted","useIntentIconStyles","success","colorStatusSuccessForeground1","error","colorStatusDangerForeground1","warning","colorStatusWarningForeground1","info","colorNeutralForeground2","useIntentIconStylesInverted","colorStatusSuccessForegroundInverted","colorStatusDangerForegroundInverted","colorStatusWarningForegroundInverted","useToastTitleStyles_unstable","state","rootBaseClassName","actionBaseClassName","mediaBaseClassName","intentIconStyles","intentIconStylesInverted","intent","invertedStyles","className","backgroundAppearance"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ACnD;IACAN,SAAS;QACPpB,OAAOR,kBAAAA,CAAOmC,oCAAoC;IACpD;IACAL,MAAM;QACJtB,OAAOR,kBAAAA,CAAOoB,+BAA+B;IAC/C;AACF;AAKO,qCAAqC,CAACiB;IAC3C;IAEA,MAAMC,oBAAoBjC;IAC1B,MAAMkC,sBAAsBxB;IAC5B,MAAMyB,qBAAqB7B;IAC3B,MAAM8B,mBAAmBlB;IACzB,MAAMmB,2BAA2BV;IACjC,MAAM,EAAEW,MAAM,EAAE,GAAGN;IACnB,MAAMO,iBAAiBzB;IACvBkB,MAAMnC,IAAI,CAAC2C,SAAS,OAAG9C,mBAAAA,EACrBE,qBAAqBC,IAAI,EACzBoC,mBACAD,MAAMS,oBAAoB,KAAK,cAAcF,eAAe1C,IAAI,EAChEmC,MAAMnC,IAAI,CAAC2C,SAAS;IAGtB,IAAIR,MAAMlC,KAAK,EAAE;QACfkC,MAAMlC,KAAK,CAAC0C,SAAS,GAAG9C,uBAAAA,EACtBE,qBAAqBE,KAAK,EAC1BqC,oBACAH,MAAMS,oBAAoB,KAAK,cAAcF,eAAezC,KAAK,EACjEwC,UAAUF,gBAAgB,CAACE,OAAO,EAClCA,UAAUN,MAAMS,oBAAoB,KAAK,cAAcJ,wBAAwB,CAACC,OAAO,EACvFN,MAAMlC,KAAK,CAAC0C,SAAS;IAEzB;IAEA,IAAIR,MAAMjC,MAAM,EAAE;QAChBiC,MAAMjC,MAAM,CAACyC,SAAS,OAAG9C,mBAAAA,EACvBE,qBAAqBG,MAAM,EAC3BmC,qBACAF,MAAMS,oBAAoB,KAAK,cAAcF,eAAexC,MAAM,EAClEiC,MAAMjC,MAAM,CAACyC,SAAS;IAE1B;IAEA,OAAOR;AACT,EAAE"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ToastTrigger/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":";;;;;;;;;;;iEAAuB,QAAQ;iCACU,oBAAoB;oCACjB,uBAAuB;AAM5D,MAAMG,eAA4CC,CAAAA;IACvD,MAAMC,YAAQJ,yCAAAA,EAAyBG;IAEvC,WAAOF,+CAAAA,EAA4BG;AACrC,EAAE;AAEFF,aAAaG,WAAW,GAAG"}
1
+ {"version":3,"sources":["../src/components/ToastTrigger/ToastTrigger.tsx"],"sourcesContent":["'use client';\n\nimport * 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;;;;;;;;;;;;iEAEuB,QAAQ;iCACU,oBAAoB;oCACjB,uBAAuB;AAM5D,MAAMG,eAA4CC,CAAAA;IACvD,MAAMC,YAAQJ,yCAAAA,EAAyBG;IAEvC,WAAOF,+CAAAA,EAA4BG;AACrC,EAAE;AAEFF,aAAaG,WAAW,GAAG"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ToastTrigger/useToastTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n applyTriggerPropsToChildren,\n getTriggerChild,\n getReactElementRef,\n useEventCallback,\n} 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: getReactElementRef<HTMLButtonElement>(child),\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","getReactElementRef","useEventCallback","useARIAButtonProps","useToastContainerContext","useToastTrigger_unstable","props","children","disableButtonEnhancement","close","child","handleClick","e","onClick","isDefaultPrevented","triggerChildProps","ref","ariaButtonTriggerChildProps","type"],"mappings":";;;;+BAoBaO;;;;;;;iEApBU,QAAQ;gCAMxB,4BAA4B;2BACA,uBAAuB;uCAEjB,uCAAuC;AAWzE,iCAAiC,CAACC;IACvC,MAAM,EAAEC,QAAQ,EAAEC,2BAA2B,KAAK,EAAE,GAAGF;IACvD,MAAM,EAAEG,KAAK,EAAE,OAAGL,+CAAAA;IAElB,MAAMM,YAAQV,+BAAAA,EAAgBO;IAE9B,MAAMI,kBAAcT,gCAAAA,EAClB,CAACU;YACCF,sBAAAA;QAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAAA,CAAAA,eAAAA,MAAOJ,KAAAA,AAAK,EAACO,OAAAA,AAAO,MAAA,QAApBH,yBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qBAAAA,IAAAA,CAAAA,cAAuBE;QACvB,IAAI,CAACA,EAAEE,kBAAkB,IAAI;YAC3BL;QACF;IACF;IAGF,MAAMM,oBAAoB;WACrBL,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOJ,KAAV;QACAU,SAAKf,kCAAAA,EAAsCS;QAC3CG,SAASF;IACX;IAEA,MAAMM,kCAA8Bd,6BAAAA,EAClCO,WAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOQ,IAAAA,AAAI,MAAK,YAAYR,CAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOQ,IAAAA,AAAI,MAAK,MAAMR,MAAMQ,IAAI,GAAG,OAC/D;QACE,GAAGH,iBAAiB;QACpBG,MAAM;IACR;IAGF,OAAO;QACLX,cAAUR,2CAAAA,EACRQ,UACAC,2BAA2BO,oBAAoBE;IAEnD;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/ToastTrigger/useToastTrigger.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n applyTriggerPropsToChildren,\n getTriggerChild,\n getReactElementRef,\n useEventCallback,\n} 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: getReactElementRef<HTMLButtonElement>(child),\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","getReactElementRef","useEventCallback","useARIAButtonProps","useToastContainerContext","useToastTrigger_unstable","props","children","disableButtonEnhancement","close","child","handleClick","e","onClick","isDefaultPrevented","triggerChildProps","ref","ariaButtonTriggerChildProps","type"],"mappings":"AAAA;;;;;+BAsBaO;;;;;;;iEApBU,QAAQ;gCAMxB,4BAA4B;2BACA,uBAAuB;uCAEjB,uCAAuC;AAWzE,iCAAiC,CAACC;IACvC,MAAM,EAAEC,QAAQ,EAAEC,2BAA2B,KAAK,EAAE,GAAGF;IACvD,MAAM,EAAEG,KAAK,EAAE,GAAGL,mDAAAA;IAElB,MAAMM,YAAQV,+BAAAA,EAAgBO;IAE9B,MAAMI,kBAAcT,gCAAAA,EAClB,CAACU;YACCF,sBAAAA;QAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,uBAAAA,CAAAA,eAAAA,MAAOJ,KAAAA,AAAK,EAACO,OAAAA,AAAO,MAAA,QAApBH,yBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qBAAAA,IAAAA,CAAAA,cAAuBE;QACvB,IAAI,CAACA,EAAEE,kBAAkB,IAAI;YAC3BL;QACF;IACF;IAGF,MAAMM,oBAAoB;WACrBL,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOJ,KAAV;QACAU,SAAKf,kCAAAA,EAAsCS;QAC3CG,SAASF;IACX;IAEA,MAAMM,kCAA8Bd,6BAAAA,EAClCO,CAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOQ,IAAAA,AAAI,MAAK,YAAYR,CAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOQ,IAAAA,AAAI,MAAK,MAAMR,MAAMQ,IAAI,GAAG,OAC/D;QACE,GAAGH,iBAAiB;QACpBG,MAAM;IACR;IAGF,OAAO;QACLX,cAAUR,2CAAAA,EACRQ,UACAC,2BAA2BO,oBAAoBE;IAEnD;AACF,EAAE"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Toaster/Toaster.tsx"],"sourcesContent":["import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport * as React from 'react';\n\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 useCustomStyleHook_unstable('useToasterStyles_unstable')(state);\n return renderToaster_unstable(state);\n};\n\nToaster.displayName = 'Toaster';\n"],"names":["useCustomStyleHook_unstable","React","useToaster_unstable","renderToaster_unstable","useToasterStyles_unstable","Toaster","props","state","displayName"],"mappings":";;;;+BAWaK;;;;;;;qCAX+B,kCAAkC;iEACvD,QAAQ;4BAEK,eAAe;+BACZ,kBAAkB;wCACf,4BAA4B;AAM/D,gBAAwCC,CAAAA;IAC7C,MAAMC,YAAQL,+BAAAA,EAAoBI;QAElCF,iDAAAA,EAA0BG;QAC1BP,gDAAAA,EAA4B,6BAA6BO;IACzD,WAAOJ,qCAAAA,EAAuBI;AAChC,EAAE;AAEFF,QAAQG,WAAW,GAAG"}
1
+ {"version":3,"sources":["../src/components/Toaster/Toaster.tsx"],"sourcesContent":["'use client';\n\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport * as React from 'react';\n\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 useCustomStyleHook_unstable('useToasterStyles_unstable')(state);\n return renderToaster_unstable(state);\n};\n\nToaster.displayName = 'Toaster';\n"],"names":["useCustomStyleHook_unstable","React","useToaster_unstable","renderToaster_unstable","useToasterStyles_unstable","Toaster","props","state","displayName"],"mappings":"AAAA;;;;;;;;;;;;qCAE4C,kCAAkC;iEACvD,QAAQ;4BAEK,eAAe;+BACZ,kBAAkB;wCACf,4BAA4B;AAM/D,MAAMK,UAAkCC,CAAAA;IAC7C,MAAMC,YAAQL,+BAAAA,EAAoBI;QAElCF,iDAAAA,EAA0BG;QAC1BP,gDAAAA,EAA4B,6BAA6BO;IACzD,WAAOJ,qCAAAA,EAAuBI;AAChC,EAAE;AAEFF,QAAQG,WAAW,GAAG"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Toaster/useToastAnnounce.ts"],"sourcesContent":["import * as React from 'react';\nimport { Announce } from '../AriaLive';\nimport { isHTMLElement } from '@fluentui/react-utilities';\n\n/**\n * Wraps an aria live announcement function.\n * Aria live announcements can be detrimental once the user is already navigating\n * multiple toasts. Once the user is focused inside the toaster, the announecments should be disabled.\n * @param announce\n * @returns A function to announce a toast and a ref to attach to the toaster element\n */\nexport function useToastAnnounce(announce: Announce): {\n announceToast: Announce;\n toasterRef: React.RefCallback<HTMLDivElement>;\n} {\n const activeRef = React.useRef(true);\n const cleanupRef = React.useRef<() => void>(() => undefined);\n const announceToast = React.useCallback<Announce>(\n (message, options) => {\n if (activeRef.current) {\n announce(message, options);\n }\n },\n [announce],\n );\n\n const toasterRef = React.useCallback((el: HTMLDivElement | null) => {\n if (!el) {\n cleanupRef.current();\n return;\n }\n\n const onFocusIn = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n return;\n }\n\n activeRef.current = false;\n };\n\n const onFocusOut = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n return;\n }\n\n activeRef.current = true;\n };\n\n el.addEventListener('focusin', onFocusIn);\n el.addEventListener('focusout', onFocusOut);\n\n cleanupRef.current = () => {\n el.removeEventListener('focusin', onFocusIn);\n el.removeEventListener('focusout', onFocusOut);\n };\n }, []);\n\n return {\n announceToast,\n toasterRef,\n };\n}\n"],"names":["React","isHTMLElement","useToastAnnounce","announce","activeRef","useRef","cleanupRef","undefined","announceToast","useCallback","message","options","current","toasterRef","el","onFocusIn","e","currentTarget","contains","relatedTarget","onFocusOut","addEventListener","removeEventListener"],"mappings":";;;;+BAWgBE;;;;;;;iEAXO,QAAQ;gCAED,4BAA4B;AASnD,0BAA0BC,QAAkB;IAIjD,MAAMC,YAAYJ,OAAMK,MAAM,CAAC;IAC/B,MAAMC,aAAaN,OAAMK,MAAM,CAAa,IAAME;IAClD,MAAMC,gBAAgBR,OAAMS,WAAW,CACrC,CAACC,SAASC;QACR,IAAIP,UAAUQ,OAAO,EAAE;YACrBT,SAASO,SAASC;QACpB;IACF,GACA;QAACR;KAAS;IAGZ,MAAMU,aAAab,OAAMS,WAAW,CAAC,CAACK;QACpC,IAAI,CAACA,IAAI;YACPR,WAAWM,OAAO;YAClB;QACF;QAEA,MAAMG,YAAY,CAACC;YACjB,QACEf,6BAAAA,EAAce,EAAEC,aAAa,KAC7BD,EAAEC,aAAa,CAACC,QAAQ,KAACjB,6BAAAA,EAAce,EAAEG,aAAa,IAAIH,EAAEG,aAAa,GAAG,OAC5E;gBACA;YACF;YAEAf,UAAUQ,OAAO,GAAG;QACtB;QAEA,MAAMQ,aAAa,CAACJ;YAClB,QACEf,6BAAAA,EAAce,EAAEC,aAAa,KAC7BD,EAAEC,aAAa,CAACC,QAAQ,KAACjB,6BAAAA,EAAce,EAAEG,aAAa,IAAIH,EAAEG,aAAa,GAAG,OAC5E;gBACA;YACF;YAEAf,UAAUQ,OAAO,GAAG;QACtB;QAEAE,GAAGO,gBAAgB,CAAC,WAAWN;QAC/BD,GAAGO,gBAAgB,CAAC,YAAYD;QAEhCd,WAAWM,OAAO,GAAG;YACnBE,GAAGQ,mBAAmB,CAAC,WAAWP;YAClCD,GAAGQ,mBAAmB,CAAC,YAAYF;QACrC;IACF,GAAG,EAAE;IAEL,OAAO;QACLZ;QACAK;IACF;AACF"}
1
+ {"version":3,"sources":["../src/components/Toaster/useToastAnnounce.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Announce } from '../AriaLive';\nimport { isHTMLElement } from '@fluentui/react-utilities';\n\n/**\n * Wraps an aria live announcement function.\n * Aria live announcements can be detrimental once the user is already navigating\n * multiple toasts. Once the user is focused inside the toaster, the announecments should be disabled.\n * @param announce\n * @returns A function to announce a toast and a ref to attach to the toaster element\n */\nexport function useToastAnnounce(announce: Announce): {\n announceToast: Announce;\n toasterRef: React.RefCallback<HTMLDivElement>;\n} {\n const activeRef = React.useRef(true);\n const cleanupRef = React.useRef<() => void>(() => undefined);\n const announceToast = React.useCallback<Announce>(\n (message, options) => {\n if (activeRef.current) {\n announce(message, options);\n }\n },\n [announce],\n );\n\n const toasterRef = React.useCallback((el: HTMLDivElement | null) => {\n if (!el) {\n cleanupRef.current();\n return;\n }\n\n const onFocusIn = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n return;\n }\n\n activeRef.current = false;\n };\n\n const onFocusOut = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n return;\n }\n\n activeRef.current = true;\n };\n\n el.addEventListener('focusin', onFocusIn);\n el.addEventListener('focusout', onFocusOut);\n\n cleanupRef.current = () => {\n el.removeEventListener('focusin', onFocusIn);\n el.removeEventListener('focusout', onFocusOut);\n };\n }, []);\n\n return {\n announceToast,\n toasterRef,\n };\n}\n"],"names":["React","isHTMLElement","useToastAnnounce","announce","activeRef","useRef","cleanupRef","undefined","announceToast","useCallback","message","options","current","toasterRef","el","onFocusIn","e","currentTarget","contains","relatedTarget","onFocusOut","addEventListener","removeEventListener"],"mappings":"AAAA;;;;;+BAagBE;;;;;;;iEAXO,QAAQ;gCAED,4BAA4B;AASnD,0BAA0BC,QAAkB;IAIjD,MAAMC,YAAYJ,OAAMK,MAAM,CAAC;IAC/B,MAAMC,aAAaN,OAAMK,MAAM,CAAa,IAAME;IAClD,MAAMC,gBAAgBR,OAAMS,WAAW,CACrC,CAACC,SAASC;QACR,IAAIP,UAAUQ,OAAO,EAAE;YACrBT,SAASO,SAASC;QACpB;IACF,GACA;QAACR;KAAS;IAGZ,MAAMU,aAAab,OAAMS,WAAW,CAAC,CAACK;QACpC,IAAI,CAACA,IAAI;YACPR,WAAWM,OAAO;YAClB;QACF;QAEA,MAAMG,YAAY,CAACC;YACjB,QACEf,6BAAAA,EAAce,EAAEC,aAAa,KAC7BD,EAAEC,aAAa,CAACC,QAAQ,KAACjB,6BAAAA,EAAce,EAAEG,aAAa,IAAIH,EAAEG,aAAa,GAAG,OAC5E;gBACA;YACF;YAEAf,UAAUQ,OAAO,GAAG;QACtB;QAEA,MAAMQ,aAAa,CAACJ;YAClB,QACEf,6BAAAA,EAAce,EAAEC,aAAa,KAC7BD,EAAEC,aAAa,CAACC,QAAQ,CAACjB,iCAAAA,EAAce,EAAEG,aAAa,IAAIH,EAAEG,aAAa,GAAG,OAC5E;gBACA;YACF;YAEAf,UAAUQ,OAAO,GAAG;QACtB;QAEAE,GAAGO,gBAAgB,CAAC,WAAWN;QAC/BD,GAAGO,gBAAgB,CAAC,YAAYD;QAEhCd,WAAWM,OAAO,GAAG;YACnBE,GAAGQ,mBAAmB,CAAC,WAAWP;YAClCD,GAAGQ,mBAAmB,CAAC,YAAYF;QACrC;IACF,GAAG,EAAE;IAEL,OAAO;QACLZ;QACAK;IACF;AACF"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Toaster/useToaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n ExtractSlotProps,\n Slot,\n getIntrinsicElementProps,\n useEventCallback,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport type { ToasterProps, ToasterState } from './Toaster.types';\nimport { TOAST_POSITIONS, ToastPosition, useToaster } from '../../state';\nimport { Announce } from '../AriaLive';\nimport { ToastContainer } from '../ToastContainer';\nimport { useToasterFocusManagement_unstable } from './useToasterFocusManagement';\nimport { useToastAnnounce } from './useToastAnnounce';\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 'use no memo';\n\n const { offset, announce: announceProp, mountNode, inline = false, ...rest } = props;\n const announceRef = React.useRef<Announce>(() => null);\n const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } =\n useToaster<HTMLDivElement>(rest);\n const announce = React.useCallback<Announce>((message, options) => announceRef.current(message, options), []);\n const { dir } = useFluent();\n\n const { onKeyDown: onKeyDownProp, ...rootProps } = slot.always(\n getIntrinsicElementProps<ExtractSlotProps<Slot<'div'>>>('div', rest),\n {\n elementType: 'div',\n },\n );\n const focusableGroupAttr = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n ignoreDefaultKeydown: { Escape: true },\n });\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === Escape) {\n e.preventDefault();\n closeAllToasts();\n }\n onKeyDownProp?.(e);\n });\n const usePositionSlot = (toastPosition: ToastPosition) => {\n const focusManagementRef = useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts);\n const { announceToast, toasterRef } = useToastAnnounce(announceProp ?? announce);\n return slot.optional<ExtractSlotProps<Slot<'div'>>>(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n ref: useMergedRefs(focusManagementRef, toasterRef),\n children: toastsToRender.get(toastPosition)?.map(toast => (\n <ToastContainer\n {...toast}\n tryRestoreFocus={tryRestoreFocus}\n intent={toast.intent}\n announce={announceToast}\n key={toast.toastId}\n visible={isToastVisible(toast.toastId)}\n >\n {toast.content as React.ReactNode}\n </ToastContainer>\n )),\n onKeyDown,\n ...focusableGroupAttr,\n 'data-toaster-position': toastPosition,\n role: 'list',\n // Explicitly casting because our slot types can't handle data attributes\n } as ExtractSlotProps<Slot<'div'>>,\n elementType: 'div',\n });\n };\n\n return {\n dir,\n mountNode,\n components: {\n root: 'div',\n bottomStart: 'div',\n bottomEnd: 'div',\n topStart: 'div',\n topEnd: 'div',\n top: 'div',\n bottom: 'div',\n },\n root: slot.always(rootProps, { elementType: 'div' }),\n bottomStart: usePositionSlot(TOAST_POSITIONS.bottomStart),\n bottomEnd: usePositionSlot(TOAST_POSITIONS.bottomEnd),\n topStart: usePositionSlot(TOAST_POSITIONS.topStart),\n topEnd: usePositionSlot(TOAST_POSITIONS.topEnd),\n top: usePositionSlot(TOAST_POSITIONS.top),\n bottom: usePositionSlot(TOAST_POSITIONS.bottom),\n announceRef,\n offset,\n announce: announceProp ?? announce,\n renderAriaLive: !announceProp,\n inline,\n };\n};\n"],"names":["React","getIntrinsicElementProps","useEventCallback","useMergedRefs","slot","useFluent_unstable","useFluent","useFocusableGroup","Escape","TOAST_POSITIONS","useToaster","ToastContainer","useToasterFocusManagement_unstable","useToastAnnounce","useToaster_unstable","props","offset","announce","announceProp","mountNode","inline","rest","announceRef","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","closeAllToasts","useCallback","message","options","current","dir","onKeyDown","onKeyDownProp","rootProps","always","elementType","focusableGroupAttr","tabBehavior","ignoreDefaultKeydown","e","key","preventDefault","usePositionSlot","toastPosition","focusManagementRef","announceToast","toasterRef","optional","has","defaultProps","ref","children","get","map","toast","intent","toastId","visible","content","role","components","root","bottomStart","bottomEnd","topStart","topEnd","top","bottom","renderAriaLive"],"mappings":";;;;+BAwBac;;;;;;;iEAxBU,QAAQ;gCAQxB,4BAA4B;qCACa,kCAAkC;8BAChD,0BAA0B;8BACrC,0BAA0B;uBAEU,cAAc;gCAE1C,oBAAoB;2CACA,8BAA8B;kCAChD,qBAAqB;AAO/C,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BAAoBE;gBACvCK,QAAQ,EAAA,CAAE/B,sBAAAA,eAAegC,GAAG,CAACT,cAAAA,MAAAA,QAAnBvB,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAmCiC,GAAG,CAACC,CAAAA,QAAAA,WAAAA,GAC/C,OAAA,aAAA,CAAC/C,8BAAAA,EAAAA;wBACE,GAAG+C,KAAK;wBACT9B,iBAAiBA;wBACjB+B,QAAQD,MAAMC,MAAM;wBACpB1C,UAAUgC;wBACVL,KAAKc,MAAME,OAAO;wBAClBC,SAASpC,eAAeiC,MAAME,OAAO;uBAEpCF,MAAMI,OAAO;gBAGlB3B;gBACA,GAAGK,kBAAkB;gBACrB,yBAAyBO;gBACzBgB,MAAM;YAER;YACAxB,aAAa;QACf;IACF;IAEA,OAAO;QACLL;QACAf;QACA6C,YAAY;YACVC,MAAM;YACNC,aAAa;YACbC,WAAW;YACXC,UAAU;YACVC,QAAQ;YACRC,KAAK;YACLC,QAAQ;QACV;QACAN,MAAM7D,oBAAAA,CAAKkC,MAAM,CAACD,WAAW;YAAEE,aAAa;QAAM;QAClD2B,aAAapB,gBAAgBrC,sBAAAA,CAAgByD,WAAW;QACxDC,WAAWrB,gBAAgBrC,sBAAAA,CAAgB0D,SAAS;QACpDC,UAAUtB,gBAAgBrC,sBAAAA,CAAgB2D,QAAQ;QAClDC,QAAQvB,gBAAgBrC,sBAAAA,CAAgB4D,MAAM;QAC9CC,KAAKxB,gBAAgBrC,sBAAAA,CAAgB6D,GAAG;QACxCC,QAAQzB,gBAAgBrC,sBAAAA,CAAgB8D,MAAM;QAC9CjD;QACAN;QACAC,UAAUC,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,eAAgBD;QAC1BuD,gBAAgB,CAACtD;QACjBE;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/Toaster/useToaster.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n ExtractSlotProps,\n Slot,\n getIntrinsicElementProps,\n useEventCallback,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { Escape } from '@fluentui/keyboard-keys';\nimport type { ToasterProps, ToasterState } from './Toaster.types';\nimport { TOAST_POSITIONS, ToastPosition, useToaster } from '../../state';\nimport { Announce } from '../AriaLive';\nimport { ToastContainer } from '../ToastContainer';\nimport { useToasterFocusManagement_unstable } from './useToasterFocusManagement';\nimport { useToastAnnounce } from './useToastAnnounce';\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 'use no memo';\n\n const { offset, announce: announceProp, mountNode, inline = false, ...rest } = props;\n const announceRef = React.useRef<Announce>(() => null);\n const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } =\n useToaster<HTMLDivElement>(rest);\n const announce = React.useCallback<Announce>((message, options) => announceRef.current(message, options), []);\n const { dir } = useFluent();\n\n const { onKeyDown: onKeyDownProp, ...rootProps } = slot.always(\n getIntrinsicElementProps<ExtractSlotProps<Slot<'div'>>>('div', rest),\n {\n elementType: 'div',\n },\n );\n const focusableGroupAttr = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n ignoreDefaultKeydown: { Escape: true },\n });\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === Escape) {\n e.preventDefault();\n closeAllToasts();\n }\n onKeyDownProp?.(e);\n });\n const usePositionSlot = (toastPosition: ToastPosition) => {\n const focusManagementRef = useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts);\n const { announceToast, toasterRef } = useToastAnnounce(announceProp ?? announce);\n return slot.optional<ExtractSlotProps<Slot<'div'>>>(toastsToRender.has(toastPosition) ? rootProps : null, {\n defaultProps: {\n ref: useMergedRefs(focusManagementRef, toasterRef),\n children: toastsToRender.get(toastPosition)?.map(toast => (\n <ToastContainer\n {...toast}\n tryRestoreFocus={tryRestoreFocus}\n intent={toast.intent}\n announce={announceToast}\n key={toast.toastId}\n visible={isToastVisible(toast.toastId)}\n >\n {toast.content as React.ReactNode}\n </ToastContainer>\n )),\n onKeyDown,\n ...focusableGroupAttr,\n 'data-toaster-position': toastPosition,\n role: 'list',\n // Explicitly casting because our slot types can't handle data attributes\n } as ExtractSlotProps<Slot<'div'>>,\n elementType: 'div',\n });\n };\n\n return {\n dir,\n mountNode,\n components: {\n root: 'div',\n bottomStart: 'div',\n bottomEnd: 'div',\n topStart: 'div',\n topEnd: 'div',\n top: 'div',\n bottom: 'div',\n },\n root: slot.always(rootProps, { elementType: 'div' }),\n bottomStart: usePositionSlot(TOAST_POSITIONS.bottomStart),\n bottomEnd: usePositionSlot(TOAST_POSITIONS.bottomEnd),\n topStart: usePositionSlot(TOAST_POSITIONS.topStart),\n topEnd: usePositionSlot(TOAST_POSITIONS.topEnd),\n top: usePositionSlot(TOAST_POSITIONS.top),\n bottom: usePositionSlot(TOAST_POSITIONS.bottom),\n announceRef,\n offset,\n announce: announceProp ?? announce,\n renderAriaLive: !announceProp,\n inline,\n };\n};\n"],"names":["React","getIntrinsicElementProps","useEventCallback","useMergedRefs","slot","useFluent_unstable","useFluent","useFocusableGroup","Escape","TOAST_POSITIONS","useToaster","ToastContainer","useToasterFocusManagement_unstable","useToastAnnounce","useToaster_unstable","props","offset","announce","announceProp","mountNode","inline","rest","announceRef","useRef","toastsToRender","isToastVisible","pauseAllToasts","playAllToasts","tryRestoreFocus","closeAllToasts","useCallback","message","options","current","dir","onKeyDown","onKeyDownProp","rootProps","always","elementType","focusableGroupAttr","tabBehavior","ignoreDefaultKeydown","e","key","preventDefault","usePositionSlot","toastPosition","focusManagementRef","announceToast","toasterRef","optional","has","defaultProps","ref","children","get","map","toast","intent","toastId","visible","content","role","components","root","bottomStart","bottomEnd","topStart","topEnd","top","bottom","renderAriaLive"],"mappings":"AAAA;;;;;+BA0B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AACtD;QACjBE;IACF;AACF,EAAE"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Toaster/useToasterFocusManagement.ts"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowDown, ArrowUp } from '@fluentui/keyboard-keys';\nimport { toastContainerClassNames } from '../ToastContainer';\n\nconst noop = () => undefined;\n\n/**\n * @internal\n */\nexport function useToasterFocusManagement_unstable(\n pauseAllToasts: () => void,\n playAllToasts: () => void,\n): (el: HTMLDivElement) => void {\n const { targetDocument } = useFluent();\n const cleanupListenersRef = React.useRef<() => void>(noop);\n\n return React.useCallback(\n (el: HTMLDivElement) => {\n if (!el || !targetDocument) {\n cleanupListenersRef.current();\n cleanupListenersRef.current = noop;\n return;\n }\n\n const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {\n acceptNode(node: Node) {\n if (isHTMLElement(node) && node.classList.contains(toastContainerClassNames.root)) {\n return NodeFilter.FILTER_ACCEPT;\n }\n\n return NodeFilter.FILTER_SKIP;\n },\n });\n\n /**\n * FIXME: https://github.com/microsoft/tabster/issues/299\n * Toasts should be arrow navigable and focus should be trapped in a stack of tasts\n * This is a temporary measure, Tabster does not have an API yet to enable mover arrow keys from within grouppers\n * Once tabster fully supports this use case, remove this hook\n */\n const keydownListener = (e: KeyboardEvent) => {\n const { target, key } = e;\n if (!isHTMLElement(target)) {\n return;\n }\n\n if (key === ArrowDown) {\n toastContainerWalker.currentNode = target;\n let nextToastContainer = toastContainerWalker.nextNode();\n if (!nextToastContainer) {\n toastContainerWalker.currentNode = el;\n nextToastContainer = toastContainerWalker.nextNode();\n }\n\n if (isHTMLElement(nextToastContainer)) {\n nextToastContainer.focus();\n }\n }\n\n if (key === ArrowUp) {\n toastContainerWalker.currentNode = target;\n let prevToastContainer = toastContainerWalker.previousNode();\n if (prevToastContainer && prevToastContainer.contains(target)) {\n prevToastContainer = toastContainerWalker.previousNode();\n }\n\n if (!prevToastContainer) {\n toastContainerWalker.currentNode = el;\n prevToastContainer = toastContainerWalker.lastChild();\n }\n\n if (isHTMLElement(prevToastContainer)) {\n prevToastContainer.focus();\n }\n }\n };\n\n const focusInListener = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n pauseAllToasts();\n }\n };\n\n const focusOutListener = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n playAllToasts();\n }\n };\n\n el.addEventListener('keydown', keydownListener);\n el.addEventListener('focusin', focusInListener);\n el.addEventListener('focusout', focusOutListener);\n\n cleanupListenersRef.current = () => {\n el.removeEventListener('keydown', keydownListener);\n el.removeEventListener('focusin', focusInListener);\n el.removeEventListener('focusout', focusOutListener);\n };\n },\n [targetDocument, pauseAllToasts, playAllToasts],\n );\n}\n"],"names":["isHTMLElement","React","useFluent_unstable","useFluent","ArrowDown","ArrowUp","toastContainerClassNames","noop","undefined","useToasterFocusManagement_unstable","pauseAllToasts","playAllToasts","targetDocument","cleanupListenersRef","useRef","useCallback","el","current","toastContainerWalker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","classList","contains","root","FILTER_ACCEPT","FILTER_SKIP","keydownListener","e","target","key","currentNode","nextToastContainer","nextNode","focus","prevToastContainer","previousNode","lastChild","focusInListener","currentTarget","relatedTarget","focusOutListener","addEventListener","removeEventListener"],"mappings":";;;;+BAWgBS;;;;;;;gCAXc,4BAA4B;iEACnC,QAAQ;qCACiB,kCAAkC;8BAC/C,0BAA0B;gCACpB,oBAAoB;AAE7D,MAAMF,OAAO,IAAMC;AAKZ,4CACLE,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WAAW,GAAGjB;oBACnCqB,qBAAqBnB,qBAAqBqB,SAAS;gBACrD;gBAEA,QAAIvC,6BAAAA,EAAcqC,qBAAqB;oBACrCA,mBAAmBD,KAAK;gBAC1B;YACF;QACF;QAEA,MAAMI,kBAAkB,CAACV;YACvB,QACE9B,6BAAAA,EAAc8B,EAAEW,aAAa,KAC7B,CAACX,EAAEW,aAAa,CAAChB,QAAQ,KAACzB,6BAAAA,EAAc8B,EAAEY,aAAa,IAAIZ,EAAEY,aAAa,GAAG,OAC7E;gBACAhC;YACF;QACF;QAEA,MAAMiC,mBAAmB,CAACb;YACxB,QACE9B,6BAAAA,EAAc8B,EAAEW,aAAa,KAC7B,CAACX,EAAEW,aAAa,CAAChB,QAAQ,KAACzB,6BAAAA,EAAc8B,EAAEY,aAAa,IAAIZ,EAAEY,aAAa,GAAG,OAC7E;gBACA/B;YACF;QACF;QAEAK,GAAG4B,gBAAgB,CAAC,WAAWf;QAC/Bb,GAAG4B,gBAAgB,CAAC,WAAWJ;QAC/BxB,GAAG4B,gBAAgB,CAAC,YAAYD;QAEhC9B,oBAAoBI,OAAO,GAAG;YAC5BD,GAAG6B,mBAAmB,CAAC,WAAWhB;YAClCb,GAAG6B,mBAAmB,CAAC,WAAWL;YAClCxB,GAAG6B,mBAAmB,CAAC,YAAYF;QACrC;IACF,GACA;QAAC/B;QAAgBF;QAAgBC;KAAc;AAEnD"}
1
+ {"version":3,"sources":["../src/components/Toaster/useToasterFocusManagement.ts"],"sourcesContent":["'use client';\n\nimport { isHTMLElement } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowDown, ArrowUp } from '@fluentui/keyboard-keys';\nimport { toastContainerClassNames } from '../ToastContainer';\n\nconst noop = () => undefined;\n\n/**\n * @internal\n */\nexport function useToasterFocusManagement_unstable(\n pauseAllToasts: () => void,\n playAllToasts: () => void,\n): (el: HTMLDivElement) => void {\n const { targetDocument } = useFluent();\n const cleanupListenersRef = React.useRef<() => void>(noop);\n\n return React.useCallback(\n (el: HTMLDivElement) => {\n if (!el || !targetDocument) {\n cleanupListenersRef.current();\n cleanupListenersRef.current = noop;\n return;\n }\n\n const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {\n acceptNode(node: Node) {\n if (isHTMLElement(node) && node.classList.contains(toastContainerClassNames.root)) {\n return NodeFilter.FILTER_ACCEPT;\n }\n\n return NodeFilter.FILTER_SKIP;\n },\n });\n\n /**\n * FIXME: https://github.com/microsoft/tabster/issues/299\n * Toasts should be arrow navigable and focus should be trapped in a stack of tasts\n * This is a temporary measure, Tabster does not have an API yet to enable mover arrow keys from within grouppers\n * Once tabster fully supports this use case, remove this hook\n */\n const keydownListener = (e: KeyboardEvent) => {\n const { target, key } = e;\n if (!isHTMLElement(target)) {\n return;\n }\n\n if (key === ArrowDown) {\n toastContainerWalker.currentNode = target;\n let nextToastContainer = toastContainerWalker.nextNode();\n if (!nextToastContainer) {\n toastContainerWalker.currentNode = el;\n nextToastContainer = toastContainerWalker.nextNode();\n }\n\n if (isHTMLElement(nextToastContainer)) {\n nextToastContainer.focus();\n }\n }\n\n if (key === ArrowUp) {\n toastContainerWalker.currentNode = target;\n let prevToastContainer = toastContainerWalker.previousNode();\n if (prevToastContainer && prevToastContainer.contains(target)) {\n prevToastContainer = toastContainerWalker.previousNode();\n }\n\n if (!prevToastContainer) {\n toastContainerWalker.currentNode = el;\n prevToastContainer = toastContainerWalker.lastChild();\n }\n\n if (isHTMLElement(prevToastContainer)) {\n prevToastContainer.focus();\n }\n }\n };\n\n const focusInListener = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n pauseAllToasts();\n }\n };\n\n const focusOutListener = (e: FocusEvent) => {\n if (\n isHTMLElement(e.currentTarget) &&\n !e.currentTarget.contains(isHTMLElement(e.relatedTarget) ? e.relatedTarget : null)\n ) {\n playAllToasts();\n }\n };\n\n el.addEventListener('keydown', keydownListener);\n el.addEventListener('focusin', focusInListener);\n el.addEventListener('focusout', focusOutListener);\n\n cleanupListenersRef.current = () => {\n el.removeEventListener('keydown', keydownListener);\n el.removeEventListener('focusin', focusInListener);\n el.removeEventListener('focusout', focusOutListener);\n };\n },\n [targetDocument, pauseAllToasts, playAllToasts],\n );\n}\n"],"names":["isHTMLElement","React","useFluent_unstable","useFluent","ArrowDown","ArrowUp","toastContainerClassNames","noop","undefined","useToasterFocusManagement_unstable","pauseAllToasts","playAllToasts","targetDocument","cleanupListenersRef","useRef","useCallback","el","current","toastContainerWalker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","classList","contains","root","FILTER_ACCEPT","FILTER_SKIP","keydownListener","e","target","key","currentNode","nextToastContainer","nextNode","focus","prevToastContainer","previousNode","lastChild","focusInListener","currentTarget","relatedTarget","focusOutListener","addEventListener","removeEventListener"],"mappings":"AAAA;;;;;+BAagBS;;;;;;;gCAXc,4BAA4B;iEACnC,QAAQ;qCACiB,kCAAkC;8BAC/C,0BAA0B;gCACpB,oBAAoB;AAE7D,MAAMF,OAAO,IAAMC;AAKZ,4CACLE,cAA0B,EAC1BC,aAAyB;IAEzB,MAAM,EAAEC,cAAc,EAAE,OAAGT,uCAAAA;IAC3B,MAAMU,sBAAsBZ,OAAMa,MAAM,CAAaP;IAErD,OAAON,OAAMc,WAAW,CACtB,CAACC;QACC,IAAI,CAACA,MAAM,CAACJ,gBAAgB;YAC1BC,oBAAoBI,OAAO;YAC3BJ,oBAAoBI,OAAO,GAAGV;YAC9B;QACF;QAEA,MAAMW,uBAAuBN,eAAeO,gBAAgB,CAACH,IAAII,WAAWC,YAAY,EAAE;YACxFC,YAAWC,IAAU;gBACnB,QAAIvB,6BAAAA,EAAcuB,SAASA,KAAKC,SAAS,CAACC,QAAQ,CAACnB,wCAAAA,CAAyBoB,IAAI,GAAG;oBACjF,OAAON,WAAWO,aA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c8B,EAAEY,aAAa,IAAIZ,EAAEY,aAAa,GAAG,OAC7E;gBACA/B;YACF;QACF;QAEAK,GAAG4B,gBAAgB,CAAC,WAAWf;QAC/Bb,GAAG4B,gBAAgB,CAAC,WAAWJ;QAC/BxB,GAAG4B,gBAAgB,CAAC,YAAYD;QAEhC9B,oBAAoBI,OAAO,GAAG;YAC5BD,GAAG6B,mBAAmB,CAAC,WAAWhB;YAClCb,GAAG6B,mBAAmB,CAAC,WAAWL;YAClCxB,GAAG6B,mBAAmB,CAAC,YAAYF;QACrC;IACF,GACA;QAAC/B;QAAgBF;QAAgBC;KAAc;AAEnD"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["useToasterStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, 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});\nconst useToasterStyles = makeStyles({\n inline: {\n position: 'absolute'\n }\n});\n/**\n * Apply styling to the Toaster slots based on the state\n */ export const useToasterStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n const styles = useToasterStyles();\n const className = mergeClasses(toasterClassNames.root, rootBaseClassName, state.inline && styles.inline, state.root.className);\n if (state.bottomStart) {\n var _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 var _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 var _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 var _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 if (state.top) {\n var _state_top;\n state.top.className = className;\n var _style4;\n (_style4 = (_state_top = state.top).style) !== null && _style4 !== void 0 ? _style4 : _state_top.style = {};\n Object.assign(state.top.style, getPositionStyles(TOAST_POSITIONS.top, state.dir, state.offset));\n }\n if (state.bottom) {\n var _state_bottom;\n state.bottom.className = className;\n var _style5;\n (_style5 = (_state_bottom = state.bottom).style) !== null && _style5 !== void 0 ? _style5 : _state_bottom.style = {};\n Object.assign(state.bottom.style, getPositionStyles(TOAST_POSITIONS.bottom, state.dir, state.offset));\n }\n return state;\n};\n"],"names":["__resetStyles","__styles","mergeClasses","TOAST_POSITIONS","getPositionStyles","toasterClassNames","root","useRootBaseClassName","useToasterStyles","inline","qhf8xq","d","useToasterStyles_unstable","state","rootBaseClassName","styles","className","bottomStart","_state_bottomStart","_style","style","Object","assign","dir","offset","bottomEnd","_state_bottomEnd","_style1","topStart","_state_topStart","_style2","topEnd","_state_topEnd","_style3","top","_state_top","_style4","bottom","_state_bottom","_style5"],"mappings":";;;;;;;;;;;qBAE8B;eAAjBK;;IAiBIO,yBAAyB;;;;uBAnBgB,gBAAgB;uBACvB,mBAAmB;AAC/D,0BAA0B;IAC7BN,IAAI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e,CAAC4B,MAAM,EAAElB,KAAK,CAACU,GAAG,EAAEV,KAAK,CAACW,MAAM,CAAC,CAAC;IACzG;IACA,IAAIX,KAAK,CAACqB,GAAG,EAAE;QACX,IAAIC,UAAU;QACdtB,KAAK,CAACqB,GAAG,CAAClB,SAAS,GAAGA,SAAS;QAC/B,IAAIoB,OAAO;SACVA,OAAO,GAAG,CAACD,UAAU,GAAGtB,KAAK,CAACqB,GAAAA,AAAG,EAAEd,KAAAA,AAAK,MAAM,IAAI,IAAIgB,OAAO,KAAK,KAAK,CAAC,GAAGA,OAAO,GAAGD,UAAU,CAACf,KAAK,GAAG,CAAC,CAAC;QAC3GC,MAAM,CAACC,MAAM,CAACT,KAAK,CAACqB,GAAG,CAACd,KAAK,MAAEhB,wBAAiB,EAACD,sBAAe,CAAC+B,GAAG,EAAErB,KAAK,CAACU,GAAG,EAAEV,KAAK,CAACW,MAAM,CAAC,CAAC;IACnG;IACA,IAAIX,KAAK,CAACwB,MAAM,EAAE;QACd,IAAIC,aAAa;QACjBzB,KAAK,CAACwB,MAAM,CAACrB,SAAS,GAAGA,SAAS;QAClC,IAAIuB,OAAO;SACVA,OAAO,GAAG,CAACD,aAAa,GAAGzB,KAAK,CAACwB,MAAM,AAANA,EAAQjB,KAAAA,AAAK,MAAM,IAAI,IAAImB,OAAO,KAAK,KAAK,CAAC,GAAGA,OAAO,GAAGD,aAAa,CAAClB,KAAK,GAAG,CAAC,CAAC;QACpHC,MAAM,CAACC,MAAM,CAACT,KAAK,CAACwB,MAAM,CAACjB,KAAK,MAAEhB,wBAAiB,EAACD,sBAAe,CAACkC,MAAM,EAAExB,KAAK,CAACU,GAAG,EAAEV,KAAK,CAACW,MAAM,CAAC,CAAC;IACzG;IACA,OAAOX,KAAK;AAChB,CAAC"}
1
+ {"version":3,"sources":["useToasterStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeResetStyles, makeStyles, 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});\nconst useToasterStyles = makeStyles({\n inline: {\n position: 'absolute'\n }\n});\n/**\n * Apply styling to the Toaster slots based on the state\n */ export const useToasterStyles_unstable = (state)=>{\n 'use no memo';\n const rootBaseClassName = useRootBaseClassName();\n const styles = useToasterStyles();\n const className = mergeClasses(toasterClassNames.root, rootBaseClassName, state.inline && styles.inline, state.root.className);\n if (state.bottomStart) {\n var _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 var _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 var _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 var _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 if (state.top) {\n var _state_top;\n state.top.className = className;\n var _style4;\n (_style4 = (_state_top = state.top).style) !== null && _style4 !== void 0 ? _style4 : _state_top.style = {};\n Object.assign(state.top.style, getPositionStyles(TOAST_POSITIONS.top, state.dir, state.offset));\n }\n if (state.bottom) {\n var _state_bottom;\n state.bottom.className = className;\n var _style5;\n (_style5 = (_state_bottom = state.bottom).style) !== null && _style5 !== void 0 ? _style5 : _state_bottom.style = {};\n Object.assign(state.bottom.style, getPositionStyles(TOAST_POSITIONS.bottom, state.dir, state.offset));\n }\n return state;\n};\n"],"names":["__resetStyles","__styles","mergeClasses","TOAST_POSITIONS","getPositionStyles","toasterClassNames","root","useRootBaseClassName","useToasterStyles","inline","qhf8xq","d","useToasterStyles_unstable","state","rootBaseClassName","styles","className","bottomStart","_state_bottomStart","_style","style","Object","assign","dir","offset","bottomEnd","_state_bottomEnd","_style1","topStart","_state_topStart","_style2","topEnd","_state_topEnd","_style3","top","_state_top","_style4","bottom","_state_bottom","_style5"],"mappings":"AAAA,YAAY;;;;;;;;;;;;IAGCK,iBAAiB;;;6BAiBY;eAAzBO;;;uBAnByC,gBAAgB;uBACvB,mBAAmB;AAC/D,0BAA0B;IAC7BN,IAAI,EAAE;AACV,CAAC;AACD;;CAEA,GAAI,MAAMC,oBAAoB,GAAA,WAAA,OAAGP,oBAAA,EAAA,WAAA,MAAA;IAAA;CAIhC,CAAC;AACF,MAAMQ,gBAAgB,GAAA,WAAA,OAAGP,eAAA,EAAA;IAAAQ,MAAA,EAAA;QAAAC,MAAA,EAAA;IAAA;AAAA,GAAA;IAAAC,CAAA,EAAA;QAAA;KAAA;AAAA,CAIxB,CAAC;AAGS,mCAAmCE,KAAK,IAAG;IAClD,aAAa;IACb,MAAMC,iBAAiB,GAAGP,oBAAoB,CAAC,CAAC;IAChD,MAAMQ,MAAM,GAAGP,gBAAgB,CAAC,CAAC;IACjC,MAAMQ,SAAS,OAAGd,mBAAY,EAACG,iBAAiB,CAACC,IAAI,EAAEQ,iBAAiB,EAAED,KAAK,CAACJ,MAAM,IAAIM,MAAM,CAACN,MAAM,EAAEI,KAAK,CAACP,IAAI,CAACU,SAAS,CAAC;IAC9H,IAAIH,K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wB,MAAM,EAAE;QACd,IAAIC,aAAa;QACjBzB,KAAK,CAACwB,MAAM,CAACrB,SAAS,GAAGA,SAAS;QAClC,IAAIuB,OAAO;SACVA,OAAO,GAAG,AAACD,aAAa,IAAGzB,KAAK,CAACwB,MAAM,AAANA,EAAQjB,KAAAA,AAAK,MAAM,IAAI,IAAImB,OAAO,KAAK,KAAK,CAAC,GAAGA,OAAO,GAAGD,aAAa,CAAClB,KAAK,GAAG,CAAC,CAAC;QACpHC,MAAM,CAACC,MAAM,CAACT,KAAK,CAACwB,MAAM,CAACjB,KAAK,MAAEhB,wBAAiB,EAACD,sBAAe,CAACkC,MAAM,EAAExB,KAAK,CAACU,GAAG,EAAEV,KAAK,CAACW,MAAM,CAAC,CAAC;IACzG;IACA,OAAOX,KAAK;AAChB,CAAC"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Toaster/useToasterStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { ToasterSlots, ToasterState } from './Toaster.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { TOAST_POSITIONS, getPositionStyles } from '../../state/index';\n\nexport const toasterClassNames: SlotClassNames<ToasterSlots> = {\n root: 'fui-Toaster',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = makeResetStyles({\n position: 'fixed',\n width: '292px',\n pointerEvents: 'none',\n});\n\nconst useToasterStyles = makeStyles({\n inline: {\n position: 'absolute',\n },\n});\n\n/**\n * Apply styling to the Toaster slots based on the state\n */\nexport const useToasterStyles_unstable = (state: ToasterState): ToasterState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n const styles = useToasterStyles();\n const className = mergeClasses(\n toasterClassNames.root,\n rootBaseClassName,\n state.inline && styles.inline,\n state.root.className,\n );\n if (state.bottomStart) {\n state.bottomStart.className = className;\n state.bottomStart.style ??= {};\n Object.assign(state.bottomStart.style, getPositionStyles(TOAST_POSITIONS.bottomStart, state.dir, state.offset));\n }\n\n if (state.bottomEnd) {\n state.bottomEnd.className = className;\n state.bottomEnd.style ??= {};\n Object.assign(state.bottomEnd.style, getPositionStyles(TOAST_POSITIONS.bottomEnd, state.dir, state.offset));\n }\n\n if (state.topStart) {\n state.topStart.className = className;\n state.topStart.style ??= {};\n Object.assign(state.topStart.style, getPositionStyles(TOAST_POSITIONS.topStart, state.dir, state.offset));\n }\n\n if (state.topEnd) {\n state.topEnd.className = className;\n state.topEnd.style ??= {};\n Object.assign(state.topEnd.style, getPositionStyles(TOAST_POSITIONS.topEnd, state.dir, state.offset));\n }\n\n if (state.top) {\n state.top.className = className;\n state.top.style ??= {};\n Object.assign(state.top.style, getPositionStyles(TOAST_POSITIONS.top, state.dir, state.offset));\n }\n\n if (state.bottom) {\n state.bottom.className = className;\n state.bottom.style ??= {};\n Object.assign(state.bottom.style, getPositionStyles(TOAST_POSITIONS.bottom, state.dir, state.offset));\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","TOAST_POSITIONS","getPositionStyles","toasterClassNames","root","useRootBaseClassName","position","width","pointerEvents","useToasterStyles","inline","useToasterStyles_unstable","state","rootBaseClassName","styles","className","bottomStart","style","Object","assign","dir","offset","bottomEnd","topStart","topEnd","top","bottom"],"mappings":";;;;;;;;;;;qBAKaK;eAAAA;;IAsBAQ,yBAAAA;;;;uBA3B6C,iBAAiB;uBAGxB,oBAAoB;AAEhE,0BAAwD;IAC7DP,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,2BAAuBP,sBAAAA,EAAgB;IAC3CQ,UAAU;IACVC,OAAO;IACPC,eAAe;AACjB;AAEA,MAAMC,uBAAmBV,iBAAAA,EAAW;IAClCW,QAAQ;QACNJ,UAAU;IACZ;AACF;AAKO,kCAAkC,CAACM;IACxC;IAEA,MAAMC,oBAAoBR;IAC1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';\n\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { ToasterSlots, ToasterState } from './Toaster.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { TOAST_POSITIONS, getPositionStyles } from '../../state/index';\n\nexport const toasterClassNames: SlotClassNames<ToasterSlots> = {\n root: 'fui-Toaster',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = makeResetStyles({\n position: 'fixed',\n width: '292px',\n pointerEvents: 'none',\n});\n\nconst useToasterStyles = makeStyles({\n inline: {\n position: 'absolute',\n },\n});\n\n/**\n * Apply styling to the Toaster slots based on the state\n */\nexport const useToasterStyles_unstable = (state: ToasterState): ToasterState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n const styles = useToasterStyles();\n const className = mergeClasses(\n toasterClassNames.root,\n rootBaseClassName,\n state.inline && styles.inline,\n state.root.className,\n );\n if (state.bottomStart) {\n state.bottomStart.className = className;\n state.bottomStart.style ??= {};\n Object.assign(state.bottomStart.style, getPositionStyles(TOAST_POSITIONS.bottomStart, state.dir, state.offset));\n }\n\n if (state.bottomEnd) {\n state.bottomEnd.className = className;\n state.bottomEnd.style ??= {};\n Object.assign(state.bottomEnd.style, getPositionStyles(TOAST_POSITIONS.bottomEnd, state.dir, state.offset));\n }\n\n if (state.topStart) {\n state.topStart.className = className;\n state.topStart.style ??= {};\n Object.assign(state.topStart.style, getPositionStyles(TOAST_POSITIONS.topStart, state.dir, state.offset));\n }\n\n if (state.topEnd) {\n state.topEnd.className = className;\n state.topEnd.style ??= {};\n Object.assign(state.topEnd.style, getPositionStyles(TOAST_POSITIONS.topEnd, state.dir, state.offset));\n }\n\n if (state.top) {\n state.top.className = className;\n state.top.style ??= {};\n Object.assign(state.top.style, getPositionStyles(TOAST_POSITIONS.top, state.dir, state.offset));\n }\n\n if (state.bottom) {\n state.bottom.className = className;\n state.bottom.style ??= {};\n Object.assign(state.bottom.style, getPositionStyles(TOAST_POSITIONS.bottom, state.dir, state.offset));\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","TOAST_POSITIONS","getPositionStyles","toasterClassNames","root","useRootBaseClassName","position","width","pointerEvents","useToasterStyles","inline","useToasterStyles_unstable","state","rootBaseClassName","styles","className","bottomStart","style","Object","assign","dir","offset","bottomEnd","topStart","topEnd","top","bottom"],"mappings":"AAAA;;;;;;;;;;;;IAOaK,iBAAAA;;;6BAsBAQ;eAAAA;;;uBA3B6C,iBAAiB;uBAGxB,oBAAoB;AAEhE,0BAAwD;IAC7DP,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,2BAAuBP,sBAAAA,EAAgB;IAC3CQ,UAAU;IACVC,OAAO;IACPC,eAAe;AACjB;AAEA,MAAMC,uBAAmBV,iBAAAA,EAAW;IAClCW,QAAQ;QACNJ,UAAU;IACZ;AACF;AAKO,kCAAkC,CAACM;IACxC;IAEA,MAAMC,oBAAoBR;IAC1B,MAAMS,SAASL;IACf,MAAMM,gBAAYf,mBAAAA,EAChBG,kBAAkBC,IAAI,EACtBS,mBACAD,MAAMF,MAAM,IAAII,OAAOJ,MAAM,EAC7BE,MAAMR,IAAI,CAACW,SAAS;IAEtB,IAAIH,MAAMI,WAAW,EAAE;YAErBJ;QADAA,MAAMI,WAAW,CAACD,SAAS,GAAGA;;QAC9BH,CAAAA,SAAAA,CAAAA,qBAAAA,MAAMI,WAAAA,AAAW,EAACC,KAAAA,MAAAA,QAAAA,WAAAA,KAAAA,IAAAA,SAAlBL,mBAAkBK,KAAAA,GAAU,CAAC;QAC7BC,OAAOC,MAAM,CAACP,MAAMI,WAAW,CAACC,KAAK,MAAEf,wBAAAA,EAAkBD,sBAAAA,CAAgBe,WAAW,EAAEJ,MAAMQ,GAAG,EAAER,MAAMS,MAAM;IAC/G;IAEA,IAAIT,MAAMU,SAAS,EAAE;YAEnBV;QADAA,MAAMU,SAAS,CAACP,SAAS,GAAGA;;QAC5BH,CAAAA,UAAAA,CAAAA,mBAAAA,M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OC,MAAM,CAACP,MAAMa,GAAG,CAACR,KAAK,MAAEf,wBAAAA,EAAkBD,sBAAAA,CAAgBwB,GAAG,EAAEb,MAAMQ,GAAG,EAAER,MAAMS,MAAM;IAC/F;IAEA,IAAIT,MAAMc,MAAM,EAAE;YAEhBd;QADAA,MAAMc,MAAM,CAACX,SAAS,GAAGA;;QACzBH,CAAAA,UAAAA,CAAAA,gBAAAA,MAAMc,MAAM,AAANA,EAAOT,KAAAA,MAAAA,QAAAA,YAAAA,KAAAA,IAAAA,UAAbL,cAAaK,KAAAA,GAAU,CAAC;QACxBC,OAAOC,MAAM,CAACP,MAAMc,MAAM,CAACT,KAAK,MAAEf,wBAAAA,EAAkBD,sBAAAA,CAAgByB,MAAM,EAAEd,MAAMQ,GAAG,EAAER,MAAMS,MAAM;IACrG;IAEA,OAAOT;AACT,EAAE"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/contexts/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 = (): ToastContainerContextValue =>\n React.useContext(ToastContainerContext) ?? toastContainerContextDefaultValue;\n"],"names":["React","toastContainerContextDefaultValue","close","intent","undefined","bodyId","titleId","ToastContainerContext","createContext","ToastContainerContextProvider","Provider","useToastContainerContext","useContext"],"mappings":";;;;;;;;;;;iCAmBaS;;;4BACAE;;;;;iEApBU,QAAQ;AAU/B,MAAMV,oCAAgE;IACpEC,OAAO,IAAM;IACbC,QAAQC;IACRC,QAAQ;IACRC,SAAS;AACX;AAEA,MAAMC,wBAAAA,WAAAA,GAAwBP,OAAMQ,aAAa,CAAyCJ;AAEnF,MAAMK,gCAAgCF,sBAAsBG,QAAQ,CAAC;AACrE,MAAMC,2BAA2B;QACtCX;WAAAA,CAAAA,oBAAAA,OAAMY,UAAU,CAACL,sBAAAA,MAAAA,QAAjBP,sBAAAA,KAAAA,IAAAA,oBAA2CC;EAAkC"}
1
+ {"version":3,"sources":["../src/contexts/toastContainerContext.tsx"],"sourcesContent":["'use client';\n\nimport * 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 = (): ToastContainerContextValue =>\n React.useContext(ToastContainerContext) ?? toastContainerContextDefaultValue;\n"],"names":["React","toastContainerContextDefaultValue","close","intent","undefined","bodyId","titleId","ToastContainerContext","createContext","ToastContainerContextProvider","Provider","useToastContainerContext","useContext"],"mappings":"AAAA;;;;;;;;;;;;iCAqBaS;;;4BACAE;eAAAA;;;;iEApBU,QAAQ;AAU/B,MAAMV,oCAAgE;IACpEC,OAAO,IAAM;IACbC,QAAQC;IACRC,QAAQ;IACRC,SAAS;AACX;AAEA,MAAMC,wBAAAA,WAAAA,GAAwBP,OAAMQ,aAAa,CAAyCJ;AAEnF,MAAMK,gCAAgCF,sBAAsBG,QAAQ,CAAC;AACrE,iCAAiC;QACtCV;WAAAA,CAAAA,oBAAAA,OAAMY,UAAU,CAACL,sBAAAA,MAAAA,QAAjBP,sBAAAA,KAAAA,IAAAA,oBAA2CC;EAAkC"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/state/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 dispatchToast: (content: React.ReactNode, options?: DispatchToastOptions) => void;\n dismissToast: (toastId: ToastId) => void;\n dismissAllToasts: () => void;\n updateToast: (options: UpdateToastOptions) => void;\n pauseToast: (toastId: ToastId) => void;\n playToast: (toastId: ToastId) => void;\n} {\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":";;;;+BAkBgBiB;;;;;;;iEAlBO,QAAQ;qCACiB,kCAAkC;yBAQ3E,YAAY;AAGnB,MAAMF,OAAO,IAAMC;AAMZ,4BAA4BE,SAAqB;IAQtD,MAAM,EAAEC,cAAc,EAAE,OAAGjB,uCAAAA;IAE3B,OAAOF,OAAMoB,OAAO,CAAC;QACnB,IAAI,CAACD,gBAAgB;YACnB,OAAO;gBACLhB,eAAeY;gBACfV,cAAcU;gBACdR,kBAAkBQ;gBAClBN,aAAaM;gBACbF,YAAYE;gBACZJ,WAAWI;YACb;QACF;QAEA,OAAO;YACLZ,eAAe,CAACkB,SAA0BC;oBACxClB,sBAAAA,EAAqBiB,SAAS;oBAAE,GAAGC,OAAO;oBAAEJ;oBAAWK,MAAM;wBAAEC,IAAI,EAAEF,YAAAA,QAAAA,YAAAA,KAAAA,IAAAA,KAAAA,IAAAA,QAASE,IAAI;oBAAC;gBAAE,GAAGL;YAC1F;YACAd,cAAc,CAACoB;gBACbnB,yBAAAA,EAAoBmB,SAASP,WAAWC;YAC1C;YACAZ,kBAAkB;oBAChBC,yBAAAA,EAAwBU,WAAWC;YACrC;YACAV,aAAa,CAACa;oBACZZ,oBAAAA,EAAmB;oBAAE,GAAGY,OAAO;oBAAEC,MAAM;wBAAEC,MAAMF,QAAQE,IAAI;oBAAC;oBAAGN;gBAAU,GAAGC;YAC9E;YACAN,YAAY,CAACY;oBACXX,mBAAAA,EAAkBW,SAASP,WAAWC;YACxC;YACAR,WAAW,CAACc;oBACVb,kBAAAA,EAAiBa,SAASP,WAAWC;YACvC;QACF;IACF,GAAG;QAACA;QAAgBD;KAAU;AAChC"}
1
+ {"version":3,"sources":["../src/state/useToastController.ts"],"sourcesContent":["'use client';\n\nimport * 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 dispatchToast: (content: React.ReactNode, options?: DispatchToastOptions) => void;\n dismissToast: (toastId: ToastId) => void;\n dismissAllToasts: () => void;\n updateToast: (options: UpdateToastOptions) => void;\n pauseToast: (toastId: ToastId) => void;\n playToast: (toastId: ToastId) => void;\n} {\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;;;;;+BAoBgBiB;;;;;;;iEAlBO,QAAQ;qCACiB,kCAAkC;yBAQ3E,YAAY;AAGnB,MAAMF,OAAO,IAAMC;AAMZ,4BAA4BE,SAAqB;IAQtD,MAAM,EAAEC,cAAc,EAAE,OAAGjB,uCAAAA;IAE3B,OAAOF,OAAMoB,OAAO,CAAC;QACnB,IAAI,CAACD,gBAAgB;YACnB,OAAO;gBACLhB,eAAeY;gBACfV,cAAcU;gBACdR,kBAAkBQ;gBAClBN,aAAaM;gBACbF,YAAYE;gBACZJ,WAAWI;YACb;QACF;QAEA,OAAO;YACLZ,eAAe,CAACkB,SAA0BC;oBACxClB,sBAAAA,EAAqBiB,SAAS;oBAAE,GAAGC,OAAO;oBAAEJ;oBAAWK,MAAM;wBAAEC,IAAI,EAAEF,YAAAA,QAAAA,YAAAA,KAAAA,IAAAA,KAAAA,IAAAA,QAASE,IAAI;oBAAC;gBAAE,GAAGL;YAC1F;YACAd,cAAc,CAACoB;gBACbnB,yBAAAA,EAAoBmB,SAASP,WAAWC;YAC1C;YACAZ,kBAAkB;oBAChBC,yBAAAA,EAAwBU,WAAWC;YACrC;YACAV,aAAa,CAACa;oBACZZ,oBAAAA,EAAmB;oBAAE,GAAGY,OAAO;oBAAEC,MAAM;wBAAEC,MAAMF,QAAQE,IAAI;oBAAC;oBAAGN;gBAAU,GAAGC;YAC9E;YACAN,YAAY,CAACY;oBACXX,mBAAAA,EAAkBW,SAASP,WAAWC;YACxC;YACAR,WAAW,CAACc;oBACVb,kBAAAA,EAAiBa,SAASP,WAAWC;YACvC;QACF;IACF,GAAG;QAACA;QAAgBD;KAAU;AAChC"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/state/useToaster.ts"],"sourcesContent":["import * as React from 'react';\nimport { isHTMLElement, useEventCallback, useForceUpdate } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { createToaster } from './vanilla';\nimport type {\n CommonToastDetail,\n ShowToastEventDetail,\n Toast,\n ToastId,\n ToastListenerMap,\n ToastPosition,\n ToasterId,\n ToasterOptions,\n} from './types';\nimport { EVENTS } from './constants';\n\nexport function useToaster<TElement extends HTMLElement = HTMLDivElement>(\n options: Partial<ToasterOptions> = {},\n): {\n isToastVisible: (toastId: ToastId) => boolean;\n toastsToRender: Map<ToastPosition, Toast[]>;\n pauseAllToasts: () => void;\n playAllToasts: () => void;\n tryRestoreFocus: () => void;\n closeAllToasts: () => void;\n} {\n const forceUpdate = useForceUpdate();\n const { toasterId: userToasterId, shortcuts } = options;\n // Currently the toaster options can never be changed at runtime\n const [toaster] = React.useState(() => createToaster(options));\n const { targetDocument } = useFluent();\n\n const lastActiveElementRef = React.useRef<HTMLElement | null>(null);\n\n const isCorrectToaster = useEventCallback((toasterId: ToasterId | undefined) => {\n return toasterId === userToasterId;\n });\n\n const isFocusShortcut = useEventCallback((e: KeyboardEvent) => {\n if (shortcuts?.focus) {\n return shortcuts.focus(e);\n }\n });\n\n const pauseAllToasts = React.useCallback(() => {\n toaster.visibleToasts.forEach(toastId => {\n const toast = toaster.toasts.get(toastId);\n toast?.imperativeRef.current?.pause();\n });\n }, [toaster]);\n\n const playAllToasts = React.useCallback(() => {\n toaster.visibleToasts.forEach(toastId => {\n const toast = toaster.toasts.get(toastId);\n toast?.imperativeRef.current?.play();\n });\n }, [toaster]);\n\n const getMostRecentVisibleToast = React.useCallback(() => {\n return Array.from(toaster.visibleToasts).reduce((cur, next) => {\n const toast = toaster.toasts.get(next);\n if (!toast) {\n return cur;\n }\n\n if (!cur) {\n return toast;\n }\n\n if (cur.order < toast?.order) {\n return toast;\n }\n\n return cur;\n }, undefined as Toast | undefined);\n }, [toaster]);\n\n const tryRestoreFocus = React.useCallback(() => {\n const mostRecentToast = getMostRecentVisibleToast();\n if (mostRecentToast?.imperativeRef.current) {\n mostRecentToast.imperativeRef.current.focus();\n } else {\n lastActiveElementRef.current?.focus();\n lastActiveElementRef.current = null;\n }\n }, [getMostRecentVisibleToast]);\n\n const closeAllToasts = React.useCallback(() => {\n toaster.visibleToasts.forEach(toastId => {\n const toast = toaster.toasts.get(toastId);\n toast?.close();\n });\n\n tryRestoreFocus();\n }, [toaster, tryRestoreFocus]);\n\n React.useEffect(() => {\n if (!targetDocument) {\n return;\n }\n\n const addToastListener = <TType extends keyof ToastListenerMap>(\n eventType: TType,\n callback: ToastListenerMap[TType],\n ) => {\n const listener: ToastListenerMap[TType] = (e: CustomEvent<CommonToastDetail>) => {\n if (!isCorrectToaster(e.detail.toasterId)) {\n return;\n }\n\n callback(e as CustomEvent<ShowToastEventDetail>);\n forceUpdate();\n };\n\n targetDocument.addEventListener(eventType, listener as () => void);\n return () => targetDocument.removeEventListener(eventType, listener as () => void);\n };\n\n const buildToast: ToastListenerMap[typeof EVENTS.show] = e => {\n toaster.buildToast(e.detail, forceUpdate);\n };\n\n const dismissToast: ToastListenerMap[typeof EVENTS.dismiss] = e => {\n toaster.dismissToast(e.detail.toastId);\n };\n\n const updateToast: ToastListenerMap[typeof EVENTS.update] = e => {\n toaster.updateToast(e.detail);\n };\n\n const dismissAllToasts: ToastListenerMap[typeof EVENTS.dismissAll] = e => {\n toaster.dismissAllToasts();\n };\n\n const pauseToast: ToastListenerMap[typeof EVENTS.pause] = e => {\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n toast.imperativeRef.current?.pause();\n }\n };\n\n const playToast: ToastListenerMap[typeof EVENTS.play] = e => {\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n toast.imperativeRef.current?.play();\n }\n };\n\n const cleanupBuildListener = addToastListener(EVENTS.show, buildToast);\n const cleanupUpdateListener = addToastListener(EVENTS.update, updateToast);\n const cleanupDismissListener = addToastListener(EVENTS.dismiss, dismissToast);\n const cleanupDismissAllListener = addToastListener(EVENTS.dismissAll, dismissAllToasts);\n const cleanupPauseListener = addToastListener(EVENTS.pause, pauseToast);\n const cleanupPlayListener = addToastListener(EVENTS.play, playToast);\n\n const focusShortcutListener = (e: KeyboardEvent) => {\n if (isFocusShortcut(e)) {\n pauseAllToasts();\n const mostRecentToast = getMostRecentVisibleToast();\n\n if (mostRecentToast) {\n lastActiveElementRef.current = isHTMLElement(targetDocument.activeElement)\n ? targetDocument.activeElement\n : null;\n mostRecentToast.imperativeRef.current?.focus();\n }\n }\n };\n\n targetDocument.addEventListener('keydown', focusShortcutListener);\n\n return () => {\n cleanupBuildListener();\n cleanupDismissAllListener();\n cleanupUpdateListener();\n cleanupDismissListener();\n cleanupPauseListener();\n cleanupPlayListener();\n\n targetDocument.removeEventListener('keydown', focusShortcutListener);\n };\n }, [\n toaster,\n forceUpdate,\n targetDocument,\n isCorrectToaster,\n pauseAllToasts,\n getMostRecentVisibleToast,\n isFocusShortcut,\n ]);\n\n const toastsToRender = (() => {\n if (!toaster) {\n return new Map<ToastPosition, Toast[]>();\n }\n\n const toRender = new Map<ToastPosition, Toast[]>();\n const toasts = Array.from(toaster.toasts.values());\n\n toasts.forEach(toast => {\n const { position } = toast;\n toRender.has(position) || toRender.set(position, []);\n if (position.startsWith('bottom')) {\n toRender.get(position)!.push(toast);\n } else {\n toRender.get(position)!.unshift(toast);\n }\n });\n\n return toRender;\n })();\n\n return {\n isToastVisible: toaster.isToastVisible,\n toastsToRender,\n pauseAllToasts,\n playAllToasts,\n tryRestoreFocus,\n closeAllToasts,\n };\n}\n"],"names":["React","isHTMLElement","useEventCallback","useForceUpdate","useFluent_unstable","useFluent","createToaster","EVENTS","useToaster","options","forceUpdate","toasterId","userToasterId","shortcuts","toaster","useState","targetDocument","lastActiveElementRef","useRef","isCorrectToaster","isFocusShortcut","e","focus","pauseAllToasts","useCallback","visibleToasts","forEach","toastId","toast","toasts","get","imperativeRef","current","pause","playAllToasts","play","getMostRecentVisibleToast","Array","from","reduce","cur","next","order","undefined","tryRestoreFocus","mostRecentToast","closeAllToasts","close","useEffect","addToastListener","eventType","callback","listener","detail","addEventListener","removeEventListener","buildToast","dismissToast","updateToast","dismissAllToasts","pauseToast","playToast","cleanupBuildListener","show","cleanupUpdateListener","update","cleanupDismissListener","dismiss","cleanupDismissAllListener","dismissAll","cleanupPauseListener","cleanupPlayListener","focusShortcutListener","activeElement","toastsToRender","Map","toRender","values","position","has","set","startsWith","push","unshift","isToastVisible"],"mappings":";;;;+BAgBgBQ;;;;;;;iEAhBO,QAAQ;gCACiC,4BAA4B;qCAC5C,kCAAkC;yBACpD,YAAY;2BAWnB,cAAc;AAE9B,oBACLC,UAAmC,CAAC,CAAC;IASrC,MAAMC,kBAAcP,8BAAAA;IACpB,MAAM,EAAEQ,WAAWC,aAAa,EAAEC,SAAS,EAAE,GAAGJ;IAChD,gEAAgE;IAChE,MAAM,CAACK,QAAQ,GAAGd,OAAMe,QAAQ,CAAC,QAAMT,sBAAAA,EAAcG;IACrD,MAAM,EAAEO,cAAc,EAAE,OAAGX,uCAAAA;IAE3B,MAAMY,uBAAuBjB,OAAMkB,MAAM,CAAqB;IAE9D,MAAMC,uBAAmBjB,gCAAAA,EAAiB,CAACS;QACzC,OAAOA,cAAcC;IACvB;IAEA,MAAMQ,sBAAkBlB,gCAAAA,EAAiB,CAACmB;QACxC,IAAIR,cAAAA,QAAAA,cAAAA,KAAAA,IAAAA,KAAAA,IAAAA,UAAWS,KAAK,EAAE;YACpB,OAAOT,UAAUS,KAAK,CAACD;QACzB;IACF;IAEA,MAAME,iBAAiBvB,OAAMwB,WAAW,CAAC;QACvCV,QAAQW,aAAa,CAACC,OAAO,CAACC,CAAAA;gBAE5BC;YADA,MAAMA,QAAQd,QAAQe,MAAM,CAACC,GAAG,CAACH;YACjCC,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAA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AmB,CAAC,WAAWiB;QAChD;IACF,GAAG;QACD1D;QACAJ;QACAM;QACAG;QACAI;QACAa;QACAhB;KACD;IAED,MAAMsD,iBAAkB,CAAA;QACtB,IAAI,CAAC5D,SAAS;YACZ,OAAO,IAAI6D;QACb;QAEA,MAAMC,WAAW,IAAID;QACrB,MAAM9C,SAASQ,MAAMC,IAAI,CAACxB,QAAQe,MAAM,CAACgD,MAAM;QAE/ChD,OAAOH,OAAO,CAACE,CAAAA;YACb,MAAM,EAAEkD,QAAQ,EAAE,GAAGlD;YACrBgD,SAASG,GAAG,CAACD,aAAaF,SAASI,GAAG,CAACF,UAAU,EAAE;YACnD,IAAIA,SAASG,UAAU,CAAC,WAAW;gBACjCL,SAAS9C,GAAG,CAACgD,UAAWI,IAAI,CAACtD;YAC/B,OAAO;gBACLgD,SAAS9C,GAAG,CAACgD,UAAWK,OAAO,CAACvD;YAClC;QACF;QAEA,OAAOgD;KACT,CAAA;IAEA,OAAO;QACLQ,gBAAgBtE,QAAQsE,cAAc;QACtCV;QACAnD;QACAW;QACAU;QACAE;IACF;AACF"}
1
+ {"version":3,"sources":["../src/state/useToaster.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { isHTMLElement, useEventCallback, useForceUpdate } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { createToaster } from './vanilla';\nimport type {\n CommonToastDetail,\n ShowToastEventDetail,\n Toast,\n ToastId,\n ToastListenerMap,\n ToastPosition,\n ToasterId,\n ToasterOptions,\n} from './types';\nimport { EVENTS } from './constants';\n\nexport function useToaster<TElement extends HTMLElement = HTMLDivElement>(\n options: Partial<ToasterOptions> = {},\n): {\n isToastVisible: (toastId: ToastId) => boolean;\n toastsToRender: Map<ToastPosition, Toast[]>;\n pauseAllToasts: () => void;\n playAllToasts: () => void;\n tryRestoreFocus: () => void;\n closeAllToasts: () => void;\n} {\n const forceUpdate = useForceUpdate();\n const { toasterId: userToasterId, shortcuts } = options;\n // Currently the toaster options can never be changed at runtime\n const [toaster] = React.useState(() => createToaster(options));\n const { targetDocument } = useFluent();\n\n const lastActiveElementRef = React.useRef<HTMLElement | null>(null);\n\n const isCorrectToaster = useEventCallback((toasterId: ToasterId | undefined) => {\n return toasterId === userToasterId;\n });\n\n const isFocusShortcut = useEventCallback((e: KeyboardEvent) => {\n if (shortcuts?.focus) {\n return shortcuts.focus(e);\n }\n });\n\n const pauseAllToasts = React.useCallback(() => {\n toaster.visibleToasts.forEach(toastId => {\n const toast = toaster.toasts.get(toastId);\n toast?.imperativeRef.current?.pause();\n });\n }, [toaster]);\n\n const playAllToasts = React.useCallback(() => {\n toaster.visibleToasts.forEach(toastId => {\n const toast = toaster.toasts.get(toastId);\n toast?.imperativeRef.current?.play();\n });\n }, [toaster]);\n\n const getMostRecentVisibleToast = React.useCallback(() => {\n return Array.from(toaster.visibleToasts).reduce((cur, next) => {\n const toast = toaster.toasts.get(next);\n if (!toast) {\n return cur;\n }\n\n if (!cur) {\n return toast;\n }\n\n if (cur.order < toast?.order) {\n return toast;\n }\n\n return cur;\n }, undefined as Toast | undefined);\n }, [toaster]);\n\n const tryRestoreFocus = React.useCallback(() => {\n const mostRecentToast = getMostRecentVisibleToast();\n if (mostRecentToast?.imperativeRef.current) {\n mostRecentToast.imperativeRef.current.focus();\n } else {\n lastActiveElementRef.current?.focus();\n lastActiveElementRef.current = null;\n }\n }, [getMostRecentVisibleToast]);\n\n const closeAllToasts = React.useCallback(() => {\n toaster.visibleToasts.forEach(toastId => {\n const toast = toaster.toasts.get(toastId);\n toast?.close();\n });\n\n tryRestoreFocus();\n }, [toaster, tryRestoreFocus]);\n\n React.useEffect(() => {\n if (!targetDocument) {\n return;\n }\n\n const addToastListener = <TType extends keyof ToastListenerMap>(\n eventType: TType,\n callback: ToastListenerMap[TType],\n ) => {\n const listener: ToastListenerMap[TType] = (e: CustomEvent<CommonToastDetail>) => {\n if (!isCorrectToaster(e.detail.toasterId)) {\n return;\n }\n\n callback(e as CustomEvent<ShowToastEventDetail>);\n forceUpdate();\n };\n\n targetDocument.addEventListener(eventType, listener as () => void);\n return () => targetDocument.removeEventListener(eventType, listener as () => void);\n };\n\n const buildToast: ToastListenerMap[typeof EVENTS.show] = e => {\n toaster.buildToast(e.detail, forceUpdate);\n };\n\n const dismissToast: ToastListenerMap[typeof EVENTS.dismiss] = e => {\n toaster.dismissToast(e.detail.toastId);\n };\n\n const updateToast: ToastListenerMap[typeof EVENTS.update] = e => {\n toaster.updateToast(e.detail);\n };\n\n const dismissAllToasts: ToastListenerMap[typeof EVENTS.dismissAll] = e => {\n toaster.dismissAllToasts();\n };\n\n const pauseToast: ToastListenerMap[typeof EVENTS.pause] = e => {\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n toast.imperativeRef.current?.pause();\n }\n };\n\n const playToast: ToastListenerMap[typeof EVENTS.play] = e => {\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n toast.imperativeRef.current?.play();\n }\n };\n\n const cleanupBuildListener = addToastListener(EVENTS.show, buildToast);\n const cleanupUpdateListener = addToastListener(EVENTS.update, updateToast);\n const cleanupDismissListener = addToastListener(EVENTS.dismiss, dismissToast);\n const cleanupDismissAllListener = addToastListener(EVENTS.dismissAll, dismissAllToasts);\n const cleanupPauseListener = addToastListener(EVENTS.pause, pauseToast);\n const cleanupPlayListener = addToastListener(EVENTS.play, playToast);\n\n const focusShortcutListener = (e: KeyboardEvent) => {\n if (isFocusShortcut(e)) {\n pauseAllToasts();\n const mostRecentToast = getMostRecentVisibleToast();\n\n if (mostRecentToast) {\n lastActiveElementRef.current = isHTMLElement(targetDocument.activeElement)\n ? targetDocument.activeElement\n : null;\n mostRecentToast.imperativeRef.current?.focus();\n }\n }\n };\n\n targetDocument.addEventListener('keydown', focusShortcutListener);\n\n return () => {\n cleanupBuildListener();\n cleanupDismissAllListener();\n cleanupUpdateListener();\n cleanupDismissListener();\n cleanupPauseListener();\n cleanupPlayListener();\n\n targetDocument.removeEventListener('keydown', focusShortcutListener);\n };\n }, [\n toaster,\n forceUpdate,\n targetDocument,\n isCorrectToaster,\n pauseAllToasts,\n getMostRecentVisibleToast,\n isFocusShortcut,\n ]);\n\n const toastsToRender = (() => {\n if (!toaster) {\n return new Map<ToastPosition, Toast[]>();\n }\n\n const toRender = new Map<ToastPosition, Toast[]>();\n const toasts = Array.from(toaster.toasts.values());\n\n toasts.forEach(toast => {\n const { position } = toast;\n toRender.has(position) || toRender.set(position, []);\n if (position.startsWith('bottom')) {\n toRender.get(position)!.push(toast);\n } else {\n toRender.get(position)!.unshift(toast);\n }\n });\n\n return toRender;\n })();\n\n return {\n isToastVisible: toaster.isToastVisible,\n toastsToRender,\n pauseAllToasts,\n playAllToasts,\n tryRestoreFocus,\n closeAllToasts,\n };\n}\n"],"names":["React","isHTMLElement","useEventCallback","useForceUpdate","useFluent_unstable","useFluent","createToaster","EVENTS","useToaster","options","forceUpdate","toasterId","userToasterId","shortcuts","toaster","useState","targetDocument","lastActiveElementRef","useRef","isCorrectToaster","isFocusShortcut","e","focus","pauseAllToasts","useCallback","visibleToasts","forEach","toastId","toast","toasts","get","imperativeRef","current","pause","playAllToasts","play","getMostRecentVisibleToast","Array","from","reduce","cur","next","order","undefined","tryRestoreFocus","mostRecentToast","closeAllToasts","close","useEffect","addToastListener","eventType","callback","listener","detail","addEventListener","removeEventListener","buildToast","dismissToast","updateToast","dismissAllToasts","pauseToast","playToast","cleanupBuildListener","show","cleanupUpdateListener","update","cleanupDismissListener","dismiss","cleanupDismissAllListener","dismissAll","cleanupPauseListener","cleanupPlayListener","focusShortcutListener","activeElement","toastsToRender","Map","toRender","values","position","has","set","startsWith","push","unshift","isToastVisible"],"mappings":"AAAA;;;;;+BAkBgBQ;;;;;;;iEAhBO,QAAQ;gCACiC,4BAA4B;qCAC5C,kCAAkC;yBACpD,YAAY;2BAWnB,cAAc;AAE9B,oBACLC,UAAmC,CAAC,CAAC;IASrC,MAAMC,kBAAcP,8BAAAA;IAC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,CAACvD;YAClC;QACF;QAEA,OAAOgD;KACT,CAAA;IAEA,OAAO;QACLQ,gBAAgBtE,QAAQsE,cAAc;QACtCV;QACAnD;QACAW;QACAU;QACAE;IACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-toast",
3
- "version": "9.7.1",
3
+ "version": "9.7.2",
4
4
  "description": "Toast component for Fluent UI",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -21,16 +21,16 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@fluentui/keyboard-keys": "^9.0.8",
24
- "@fluentui/react-aria": "^9.17.0",
24
+ "@fluentui/react-aria": "^9.17.1",
25
25
  "@fluentui/react-icons": "^2.0.245",
26
- "@fluentui/react-jsx-runtime": "^9.2.0",
27
- "@fluentui/react-motion": "^9.10.4",
28
- "@fluentui/react-motion-components-preview": "^0.10.0",
29
- "@fluentui/react-portal": "^9.8.2",
30
- "@fluentui/react-shared-contexts": "^9.25.1",
31
- "@fluentui/react-tabster": "^9.26.5",
26
+ "@fluentui/react-jsx-runtime": "^9.2.1",
27
+ "@fluentui/react-motion": "^9.11.0",
28
+ "@fluentui/react-motion-components-preview": "^0.10.1",
29
+ "@fluentui/react-portal": "^9.8.3",
30
+ "@fluentui/react-shared-contexts": "^9.25.2",
31
+ "@fluentui/react-tabster": "^9.26.6",
32
32
  "@fluentui/react-theme": "^9.2.0",
33
- "@fluentui/react-utilities": "^9.24.1",
33
+ "@fluentui/react-utilities": "^9.25.0",
34
34
  "@griffel/react": "^1.5.22",
35
35
  "@swc/helpers": "^0.5.1"
36
36
  },