@fluentui/react-toast 9.8.0 → 9.8.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.
- package/CHANGELOG.md +37 -2
- package/dist/index.d.cts +640 -0
- package/lib/AriaLive.js +1 -1
- package/lib/AriaLive.js.map +1 -1
- package/lib/Toast.js +1 -1
- package/lib/Toast.js.map +1 -1
- package/lib/ToastBody.js +1 -1
- package/lib/ToastBody.js.map +1 -1
- package/lib/ToastContainer.js +1 -1
- package/lib/ToastContainer.js.map +1 -1
- package/lib/ToastFooter.js +1 -1
- package/lib/ToastFooter.js.map +1 -1
- package/lib/ToastTitle.js +1 -1
- package/lib/ToastTitle.js.map +1 -1
- package/lib/ToastTrigger.js +1 -1
- package/lib/ToastTrigger.js.map +1 -1
- package/lib/Toaster.js +1 -1
- package/lib/Toaster.js.map +1 -1
- package/lib/components/AriaLive/AriaLive.js +3 -3
- package/lib/components/AriaLive/AriaLive.js.map +1 -1
- package/lib/components/AriaLive/index.js +4 -4
- package/lib/components/AriaLive/index.js.map +1 -1
- package/lib/components/AriaLive/renderAriaLive.js +1 -1
- package/lib/components/AriaLive/useAriaLive.js +2 -2
- package/lib/components/AriaLive/useAriaLiveStyles.styles.js +1 -3
- package/lib/components/AriaLive/useAriaLiveStyles.styles.js.map +1 -1
- package/lib/components/AriaLive/useAriaLiveStyles.styles.raw.js +1 -2
- package/lib/components/AriaLive/useAriaLiveStyles.styles.raw.js.map +1 -1
- package/lib/components/Timer/Timer.js +2 -2
- package/lib/components/Timer/Timer.js.map +1 -1
- package/lib/components/Timer/index.js +1 -1
- package/lib/components/Timer/index.js.map +1 -1
- package/lib/components/Timer/useTimerStyles.styles.js +1 -1
- package/lib/components/Timer/useTimerStyles.styles.js.map +1 -1
- package/lib/components/Timer/useTimerStyles.styles.raw.js +1 -1
- package/lib/components/Toast/Toast.js +6 -6
- package/lib/components/Toast/Toast.js.map +1 -1
- package/lib/components/Toast/index.js +4 -4
- package/lib/components/Toast/index.js.map +1 -1
- package/lib/components/Toast/renderToast.js +2 -2
- package/lib/components/Toast/useToast.js +2 -2
- package/lib/components/Toast/useToast.js.map +1 -1
- package/lib/components/Toast/useToastStyles.styles.js +2 -4
- package/lib/components/Toast/useToastStyles.styles.js.map +1 -1
- package/lib/components/Toast/useToastStyles.styles.raw.js +2 -3
- package/lib/components/Toast/useToastStyles.styles.raw.js.map +1 -1
- package/lib/components/ToastBody/ToastBody.js +5 -5
- package/lib/components/ToastBody/ToastBody.js.map +1 -1
- package/lib/components/ToastBody/index.js +4 -4
- package/lib/components/ToastBody/index.js.map +1 -1
- package/lib/components/ToastBody/renderToastBody.js +1 -1
- package/lib/components/ToastBody/useToastBody.js +3 -3
- package/lib/components/ToastBody/useToastBody.js.map +1 -1
- package/lib/components/ToastBody/useToastBodyStyles.styles.js +2 -4
- package/lib/components/ToastBody/useToastBodyStyles.styles.js.map +1 -1
- package/lib/components/ToastBody/useToastBodyStyles.styles.raw.js +2 -3
- package/lib/components/ToastBody/useToastBodyStyles.styles.raw.js.map +1 -1
- package/lib/components/ToastContainer/ToastContainer.js +6 -6
- package/lib/components/ToastContainer/ToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/index.js +5 -5
- package/lib/components/ToastContainer/index.js.map +1 -1
- package/lib/components/ToastContainer/renderToastContainer.js +3 -3
- package/lib/components/ToastContainer/renderToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/useToastContainer.js +6 -6
- package/lib/components/ToastContainer/useToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/useToastContainerContextValues.js +1 -1
- package/lib/components/ToastContainer/useToastContainerStyles.styles.js +3 -5
- package/lib/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -1
- package/lib/components/ToastContainer/useToastContainerStyles.styles.raw.js +3 -4
- package/lib/components/ToastContainer/useToastContainerStyles.styles.raw.js.map +1 -1
- package/lib/components/ToastFooter/ToastFooter.js +5 -5
- package/lib/components/ToastFooter/ToastFooter.js.map +1 -1
- package/lib/components/ToastFooter/index.js +4 -4
- package/lib/components/ToastFooter/index.js.map +1 -1
- package/lib/components/ToastFooter/renderToastFooter.js +1 -1
- package/lib/components/ToastFooter/useToastFooter.js +1 -1
- package/lib/components/ToastFooter/useToastFooterStyles.styles.js +1 -3
- package/lib/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -1
- package/lib/components/ToastFooter/useToastFooterStyles.styles.raw.js +1 -2
- package/lib/components/ToastFooter/useToastFooterStyles.styles.raw.js.map +1 -1
- package/lib/components/ToastTitle/ToastTitle.js +5 -5
- package/lib/components/ToastTitle/ToastTitle.js.map +1 -1
- package/lib/components/ToastTitle/index.js +4 -4
- package/lib/components/ToastTitle/index.js.map +1 -1
- package/lib/components/ToastTitle/renderToastTitle.js +1 -1
- package/lib/components/ToastTitle/useToastTitle.js +5 -5
- package/lib/components/ToastTitle/useToastTitle.js.map +1 -1
- package/lib/components/ToastTitle/useToastTitleStyles.styles.js +2 -4
- package/lib/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
- package/lib/components/ToastTitle/useToastTitleStyles.styles.raw.js +2 -3
- package/lib/components/ToastTitle/useToastTitleStyles.styles.raw.js.map +1 -1
- package/lib/components/ToastTrigger/ToastTrigger.js +2 -2
- package/lib/components/ToastTrigger/ToastTrigger.js.map +1 -1
- package/lib/components/ToastTrigger/index.js +3 -3
- package/lib/components/ToastTrigger/index.js.map +1 -1
- package/lib/components/ToastTrigger/useToastTrigger.js +3 -3
- package/lib/components/ToastTrigger/useToastTrigger.js.map +1 -1
- package/lib/components/Toaster/Toaster.js +4 -4
- package/lib/components/Toaster/Toaster.js.map +1 -1
- package/lib/components/Toaster/index.js +5 -5
- package/lib/components/Toaster/index.js.map +1 -1
- package/lib/components/Toaster/renderToaster.js +3 -3
- package/lib/components/Toaster/renderToaster.js.map +1 -1
- package/lib/components/Toaster/useToastAnnounce.js +2 -2
- package/lib/components/Toaster/useToaster.js +9 -10
- package/lib/components/Toaster/useToaster.js.map +1 -1
- package/lib/components/Toaster/useToasterFocusManagement.js +5 -5
- package/lib/components/Toaster/useToasterFocusManagement.js.map +1 -1
- package/lib/components/Toaster/useToasterStyles.styles.js +2 -4
- package/lib/components/Toaster/useToasterStyles.styles.js.map +1 -1
- package/lib/components/Toaster/useToasterStyles.styles.raw.js +2 -3
- package/lib/components/Toaster/useToasterStyles.styles.raw.js.map +1 -1
- package/lib/contexts/toastContainerContext.js +1 -1
- package/lib/index.js +10 -10
- package/lib/index.js.map +1 -1
- package/lib/state/index.js +4 -4
- package/lib/state/index.js.map +1 -1
- package/lib/state/useToastController.js +3 -3
- package/lib/state/useToastController.js.map +1 -1
- package/lib/state/useToaster.js +5 -5
- package/lib/state/useToaster.js.map +1 -1
- package/lib/state/vanilla/createToaster.js +2 -2
- package/lib/state/vanilla/dismissAllToasts.js +1 -1
- package/lib/state/vanilla/dismissAllToasts.js.map +1 -1
- package/lib/state/vanilla/dismissToast.js +1 -1
- package/lib/state/vanilla/dismissToast.js.map +1 -1
- package/lib/state/vanilla/dispatchToast.js +1 -1
- package/lib/state/vanilla/dispatchToast.js.map +1 -1
- package/lib/state/vanilla/index.js +8 -8
- package/lib/state/vanilla/index.js.map +1 -1
- package/lib/state/vanilla/pauseToast.js +1 -1
- package/lib/state/vanilla/pauseToast.js.map +1 -1
- package/lib/state/vanilla/playToast.js +1 -1
- package/lib/state/vanilla/playToast.js.map +1 -1
- package/lib/state/vanilla/updateToast.js +1 -1
- package/lib/state/vanilla/updateToast.js.map +1 -1
- package/lib-commonjs/{AriaLive.js → AriaLive.cjs} +1 -1
- package/lib-commonjs/{AriaLive.js.map → AriaLive.cjs.map} +1 -1
- package/lib-commonjs/{Toast.js → Toast.cjs} +1 -1
- package/lib-commonjs/{Toast.js.map → Toast.cjs.map} +1 -1
- package/lib-commonjs/{ToastBody.js → ToastBody.cjs} +1 -1
- package/lib-commonjs/{ToastBody.js.map → ToastBody.cjs.map} +1 -1
- package/lib-commonjs/{ToastContainer.js → ToastContainer.cjs} +1 -1
- package/lib-commonjs/{ToastContainer.js.map → ToastContainer.cjs.map} +1 -1
- package/lib-commonjs/{ToastFooter.js → ToastFooter.cjs} +1 -1
- package/lib-commonjs/{ToastFooter.js.map → ToastFooter.cjs.map} +1 -1
- package/lib-commonjs/{ToastTitle.js → ToastTitle.cjs} +1 -1
- package/lib-commonjs/{ToastTitle.js.map → ToastTitle.cjs.map} +1 -1
- package/lib-commonjs/{ToastTrigger.js → ToastTrigger.cjs} +1 -1
- package/lib-commonjs/{ToastTrigger.js.map → ToastTrigger.cjs.map} +1 -1
- package/lib-commonjs/{Toaster.js → Toaster.cjs} +1 -1
- package/lib-commonjs/{Toaster.js.map → Toaster.cjs.map} +1 -1
- package/lib-commonjs/components/AriaLive/{AriaLive.js → AriaLive.cjs} +3 -3
- package/lib-commonjs/components/AriaLive/{AriaLive.js.map → AriaLive.cjs.map} +1 -1
- package/lib-commonjs/components/AriaLive/{index.js → index.cjs} +4 -4
- package/lib-commonjs/components/AriaLive/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/AriaLive/{useAriaLiveStyles.styles.js → useAriaLiveStyles.styles.cjs} +0 -1
- package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/AriaLive/{useAriaLiveStyles.styles.raw.js → useAriaLiveStyles.styles.raw.cjs} +0 -1
- package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/components/Timer/{Timer.js → Timer.cjs} +1 -1
- package/lib-commonjs/components/Timer/{Timer.js.map → Timer.cjs.map} +1 -1
- package/lib-commonjs/components/Timer/{index.js → index.cjs} +1 -1
- package/lib-commonjs/components/Timer/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/Timer/useTimerStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/Toast/{Toast.js → Toast.cjs} +4 -4
- package/lib-commonjs/components/Toast/{Toast.js.map → Toast.cjs.map} +1 -1
- package/lib-commonjs/components/Toast/{index.js → index.cjs} +4 -4
- package/lib-commonjs/components/Toast/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/Toast/{useToast.js → useToast.cjs} +1 -1
- package/lib-commonjs/components/Toast/{useToast.js.map → useToast.cjs.map} +1 -1
- package/lib-commonjs/components/Toast/{useToastStyles.styles.js → useToastStyles.styles.cjs} +0 -1
- package/lib-commonjs/components/Toast/useToastStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/Toast/{useToastStyles.styles.raw.js → useToastStyles.styles.raw.cjs} +0 -1
- package/lib-commonjs/components/Toast/useToastStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/components/ToastBody/{ToastBody.js → ToastBody.cjs} +3 -3
- package/lib-commonjs/components/ToastBody/{ToastBody.js.map → ToastBody.cjs.map} +1 -1
- package/lib-commonjs/components/ToastBody/{index.js → index.cjs} +4 -4
- package/lib-commonjs/components/ToastBody/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/ToastBody/{useToastBody.js → useToastBody.cjs} +1 -1
- package/lib-commonjs/components/ToastBody/{useToastBody.js.map → useToastBody.cjs.map} +1 -1
- package/lib-commonjs/components/ToastBody/{useToastBodyStyles.styles.js → useToastBodyStyles.styles.cjs} +0 -1
- package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/ToastBody/{useToastBodyStyles.styles.raw.js → useToastBodyStyles.styles.raw.cjs} +0 -1
- package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/components/ToastContainer/{ToastContainer.js → ToastContainer.cjs} +4 -4
- package/lib-commonjs/components/ToastContainer/{ToastContainer.js.map → ToastContainer.cjs.map} +1 -1
- package/lib-commonjs/components/ToastContainer/{index.js → index.cjs} +5 -5
- package/lib-commonjs/components/ToastContainer/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/ToastContainer/{renderToastContainer.js → renderToastContainer.cjs} +1 -1
- package/lib-commonjs/components/ToastContainer/{renderToastContainer.js.map → renderToastContainer.cjs.map} +1 -1
- package/lib-commonjs/components/ToastContainer/{useToastContainer.js → useToastContainer.cjs} +1 -1
- package/lib-commonjs/components/ToastContainer/{useToastContainer.js.map → useToastContainer.cjs.map} +1 -1
- package/lib-commonjs/components/ToastContainer/{useToastContainerStyles.styles.js → useToastContainerStyles.styles.cjs} +0 -1
- package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/ToastContainer/{useToastContainerStyles.styles.raw.js → useToastContainerStyles.styles.raw.cjs} +0 -1
- package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/components/ToastFooter/{ToastFooter.js → ToastFooter.cjs} +3 -3
- package/lib-commonjs/components/ToastFooter/{ToastFooter.js.map → ToastFooter.cjs.map} +1 -1
- package/lib-commonjs/components/ToastFooter/{index.js → index.cjs} +4 -4
- package/lib-commonjs/components/ToastFooter/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/ToastFooter/{useToastFooterStyles.styles.js → useToastFooterStyles.styles.cjs} +0 -1
- package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/ToastFooter/{useToastFooterStyles.styles.raw.js → useToastFooterStyles.styles.raw.cjs} +0 -1
- package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/components/ToastTitle/{ToastTitle.js → ToastTitle.cjs} +3 -3
- package/lib-commonjs/components/ToastTitle/{ToastTitle.js.map → ToastTitle.cjs.map} +1 -1
- package/lib-commonjs/components/ToastTitle/{index.js → index.cjs} +4 -4
- package/lib-commonjs/components/ToastTitle/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/ToastTitle/{useToastTitle.js → useToastTitle.cjs} +1 -1
- package/lib-commonjs/components/ToastTitle/{useToastTitle.js.map → useToastTitle.cjs.map} +1 -1
- package/lib-commonjs/components/ToastTitle/{useToastTitleStyles.styles.js → useToastTitleStyles.styles.cjs} +0 -1
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/ToastTitle/{useToastTitleStyles.styles.raw.js → useToastTitleStyles.styles.raw.cjs} +0 -1
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/components/ToastTrigger/{ToastTrigger.js → ToastTrigger.cjs} +2 -2
- package/lib-commonjs/components/ToastTrigger/{ToastTrigger.js.map → ToastTrigger.cjs.map} +1 -1
- package/lib-commonjs/components/ToastTrigger/{index.js → index.cjs} +3 -3
- package/lib-commonjs/components/ToastTrigger/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/ToastTrigger/{useToastTrigger.js → useToastTrigger.cjs} +1 -1
- package/lib-commonjs/components/ToastTrigger/{useToastTrigger.js.map → useToastTrigger.cjs.map} +1 -1
- package/lib-commonjs/components/Toaster/{Toaster.js → Toaster.cjs} +3 -3
- package/lib-commonjs/components/Toaster/{Toaster.js.map → Toaster.cjs.map} +1 -1
- package/lib-commonjs/components/Toaster/{index.js → index.cjs} +5 -5
- package/lib-commonjs/components/Toaster/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/Toaster/{renderToaster.js → renderToaster.cjs} +2 -2
- package/lib-commonjs/components/Toaster/{renderToaster.js.map → renderToaster.cjs.map} +1 -1
- package/lib-commonjs/components/Toaster/{useToaster.js → useToaster.cjs} +12 -13
- package/lib-commonjs/components/Toaster/useToaster.cjs.map +1 -0
- package/lib-commonjs/components/Toaster/{useToasterFocusManagement.js → useToasterFocusManagement.cjs} +2 -2
- package/lib-commonjs/components/Toaster/{useToasterFocusManagement.js.map → useToasterFocusManagement.cjs.map} +1 -1
- package/lib-commonjs/components/Toaster/{useToasterStyles.styles.js → useToasterStyles.styles.cjs} +1 -2
- package/lib-commonjs/components/Toaster/useToasterStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/Toaster/{useToasterStyles.styles.raw.js → useToasterStyles.styles.raw.cjs} +1 -2
- package/lib-commonjs/components/Toaster/useToasterStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/{index.js → index.cjs} +11 -11
- package/lib-commonjs/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/state/{index.js → index.cjs} +5 -5
- package/lib-commonjs/state/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/state/{useToastController.js → useToastController.cjs} +7 -7
- package/lib-commonjs/state/{useToastController.js.map → useToastController.cjs.map} +1 -1
- package/lib-commonjs/state/{useToaster.js → useToaster.cjs} +3 -3
- package/lib-commonjs/state/{useToaster.js.map → useToaster.cjs.map} +1 -1
- package/lib-commonjs/state/vanilla/{dismissAllToasts.js → dismissAllToasts.cjs} +1 -1
- package/lib-commonjs/state/vanilla/{dismissAllToasts.js.map → dismissAllToasts.cjs.map} +1 -1
- package/lib-commonjs/state/vanilla/{dismissToast.js → dismissToast.cjs} +1 -1
- package/lib-commonjs/state/vanilla/{dismissToast.js.map → dismissToast.cjs.map} +1 -1
- package/lib-commonjs/state/vanilla/{dispatchToast.js → dispatchToast.cjs} +1 -1
- package/lib-commonjs/state/vanilla/{dispatchToast.js.map → dispatchToast.cjs.map} +1 -1
- package/lib-commonjs/state/vanilla/{index.js → index.cjs} +8 -8
- package/lib-commonjs/state/vanilla/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/state/vanilla/{pauseToast.js → pauseToast.cjs} +1 -1
- package/lib-commonjs/state/vanilla/{pauseToast.js.map → pauseToast.cjs.map} +1 -1
- package/lib-commonjs/state/vanilla/{playToast.js → playToast.cjs} +1 -1
- package/lib-commonjs/state/vanilla/{playToast.js.map → playToast.cjs.map} +1 -1
- package/lib-commonjs/state/vanilla/{updateToast.js → updateToast.cjs} +1 -1
- package/lib-commonjs/state/vanilla/{updateToast.js.map → updateToast.cjs.map} +1 -1
- package/package.json +23 -17
- package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js.map +0 -1
- package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/Timer/useTimerStyles.styles.js.map +0 -1
- package/lib-commonjs/components/Toast/useToastStyles.styles.js.map +0 -1
- package/lib-commonjs/components/Toast/useToastStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js.map +0 -1
- package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js.map +0 -1
- package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js.map +0 -1
- package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js.map +0 -1
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/Toaster/useToaster.js.map +0 -1
- package/lib-commonjs/components/Toaster/useToasterStyles.styles.js.map +0 -1
- package/lib-commonjs/components/Toaster/useToasterStyles.styles.raw.js.map +0 -1
- /package/lib-commonjs/components/AriaLive/{AriaLive.types.js → AriaLive.types.cjs} +0 -0
- /package/lib-commonjs/components/AriaLive/{AriaLive.types.js.map → AriaLive.types.cjs.map} +0 -0
- /package/lib-commonjs/components/AriaLive/{renderAriaLive.js → renderAriaLive.cjs} +0 -0
- /package/lib-commonjs/components/AriaLive/{renderAriaLive.js.map → renderAriaLive.cjs.map} +0 -0
- /package/lib-commonjs/components/AriaLive/{useAriaLive.js → useAriaLive.cjs} +0 -0
- /package/lib-commonjs/components/AriaLive/{useAriaLive.js.map → useAriaLive.cjs.map} +0 -0
- /package/lib-commonjs/components/Timer/{useTimerStyles.styles.js → useTimerStyles.styles.cjs} +0 -0
- /package/lib-commonjs/components/Timer/{useTimerStyles.styles.raw.js → useTimerStyles.styles.raw.cjs} +0 -0
- /package/lib-commonjs/components/Timer/{useTimerStyles.styles.raw.js.map → useTimerStyles.styles.raw.cjs.map} +0 -0
- /package/lib-commonjs/components/Toast/{Toast.types.js → Toast.types.cjs} +0 -0
- /package/lib-commonjs/components/Toast/{Toast.types.js.map → Toast.types.cjs.map} +0 -0
- /package/lib-commonjs/components/Toast/{renderToast.js → renderToast.cjs} +0 -0
- /package/lib-commonjs/components/Toast/{renderToast.js.map → renderToast.cjs.map} +0 -0
- /package/lib-commonjs/components/Toast/{useToastContextValues.js → useToastContextValues.cjs} +0 -0
- /package/lib-commonjs/components/Toast/{useToastContextValues.js.map → useToastContextValues.cjs.map} +0 -0
- /package/lib-commonjs/components/ToastBody/{ToastBody.types.js → ToastBody.types.cjs} +0 -0
- /package/lib-commonjs/components/ToastBody/{ToastBody.types.js.map → ToastBody.types.cjs.map} +0 -0
- /package/lib-commonjs/components/ToastBody/{renderToastBody.js → renderToastBody.cjs} +0 -0
- /package/lib-commonjs/components/ToastBody/{renderToastBody.js.map → renderToastBody.cjs.map} +0 -0
- /package/lib-commonjs/components/ToastContainer/{ToastContainer.types.js → ToastContainer.types.cjs} +0 -0
- /package/lib-commonjs/components/ToastContainer/{ToastContainer.types.js.map → ToastContainer.types.cjs.map} +0 -0
- /package/lib-commonjs/components/ToastContainer/{useToastContainerContextValues.js → useToastContainerContextValues.cjs} +0 -0
- /package/lib-commonjs/components/ToastContainer/{useToastContainerContextValues.js.map → useToastContainerContextValues.cjs.map} +0 -0
- /package/lib-commonjs/components/ToastFooter/{ToastFooter.types.js → ToastFooter.types.cjs} +0 -0
- /package/lib-commonjs/components/ToastFooter/{ToastFooter.types.js.map → ToastFooter.types.cjs.map} +0 -0
- /package/lib-commonjs/components/ToastFooter/{renderToastFooter.js → renderToastFooter.cjs} +0 -0
- /package/lib-commonjs/components/ToastFooter/{renderToastFooter.js.map → renderToastFooter.cjs.map} +0 -0
- /package/lib-commonjs/components/ToastFooter/{useToastFooter.js → useToastFooter.cjs} +0 -0
- /package/lib-commonjs/components/ToastFooter/{useToastFooter.js.map → useToastFooter.cjs.map} +0 -0
- /package/lib-commonjs/components/ToastTitle/{ToastTitle.types.js → ToastTitle.types.cjs} +0 -0
- /package/lib-commonjs/components/ToastTitle/{ToastTitle.types.js.map → ToastTitle.types.cjs.map} +0 -0
- /package/lib-commonjs/components/ToastTitle/{renderToastTitle.js → renderToastTitle.cjs} +0 -0
- /package/lib-commonjs/components/ToastTitle/{renderToastTitle.js.map → renderToastTitle.cjs.map} +0 -0
- /package/lib-commonjs/components/ToastTrigger/{ToastTrigger.types.js → ToastTrigger.types.cjs} +0 -0
- /package/lib-commonjs/components/ToastTrigger/{ToastTrigger.types.js.map → ToastTrigger.types.cjs.map} +0 -0
- /package/lib-commonjs/components/ToastTrigger/{renderToastTrigger.js → renderToastTrigger.cjs} +0 -0
- /package/lib-commonjs/components/ToastTrigger/{renderToastTrigger.js.map → renderToastTrigger.cjs.map} +0 -0
- /package/lib-commonjs/components/Toaster/{Toaster.types.js → Toaster.types.cjs} +0 -0
- /package/lib-commonjs/components/Toaster/{Toaster.types.js.map → Toaster.types.cjs.map} +0 -0
- /package/lib-commonjs/components/Toaster/{useToastAnnounce.js → useToastAnnounce.cjs} +0 -0
- /package/lib-commonjs/components/Toaster/{useToastAnnounce.js.map → useToastAnnounce.cjs.map} +0 -0
- /package/lib-commonjs/contexts/{toastContainerContext.js → toastContainerContext.cjs} +0 -0
- /package/lib-commonjs/contexts/{toastContainerContext.js.map → toastContainerContext.cjs.map} +0 -0
- /package/lib-commonjs/state/{constants.js → constants.cjs} +0 -0
- /package/lib-commonjs/state/{constants.js.map → constants.cjs.map} +0 -0
- /package/lib-commonjs/state/{types.js → types.cjs} +0 -0
- /package/lib-commonjs/state/{types.js.map → types.cjs.map} +0 -0
- /package/lib-commonjs/state/vanilla/{createToaster.js → createToaster.cjs} +0 -0
- /package/lib-commonjs/state/vanilla/{createToaster.js.map → createToaster.cjs.map} +0 -0
- /package/lib-commonjs/state/vanilla/{getPositionStyles.js → getPositionStyles.cjs} +0 -0
- /package/lib-commonjs/state/vanilla/{getPositionStyles.js.map → getPositionStyles.cjs.map} +0 -0
package/lib-commonjs/components/ToastTrigger/{useToastTrigger.js.map → useToastTrigger.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToastTrigger/useToastTrigger.ts"],"sourcesContent":["'use client';\n\nimport type * 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":["applyTriggerPropsToChildren","getTriggerChild","getReactElementRef","useEventCallback","useARIAButtonProps","useToastContainerContext","useToastTrigger_unstable","props","children","disableButtonEnhancement","close","child","handleClick","e","onClick","isDefaultPrevented","triggerChildProps","ref","ariaButtonTriggerChildProps","type"],"mappings":"AAAA;;;;;+BAsBaM;;;;;;gCAdN,4BAA4B;2BACA,uBAAuB;uCAEjB,
|
|
1
|
+
{"version":3,"sources":["../src/components/ToastTrigger/useToastTrigger.ts"],"sourcesContent":["'use client';\n\nimport type * 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":["applyTriggerPropsToChildren","getTriggerChild","getReactElementRef","useEventCallback","useARIAButtonProps","useToastContainerContext","useToastTrigger_unstable","props","children","disableButtonEnhancement","close","child","handleClick","e","onClick","isDefaultPrevented","triggerChildProps","ref","ariaButtonTriggerChildProps","type"],"mappings":"AAAA;;;;;+BAsBaM;;;;;;gCAdN,4BAA4B;2BACA,uBAAuB;uCAEjB,0CAAuC;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"}
|
|
@@ -10,9 +10,9 @@ Object.defineProperty(exports, "Toaster", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
13
|
-
const _useToaster = require("./useToaster");
|
|
14
|
-
const _renderToaster = require("./renderToaster");
|
|
15
|
-
const _useToasterStylesstyles = require("./useToasterStyles.styles");
|
|
13
|
+
const _useToaster = require("./useToaster.cjs");
|
|
14
|
+
const _renderToaster = require("./renderToaster.cjs");
|
|
15
|
+
const _useToasterStylesstyles = require("./useToasterStyles.styles.cjs");
|
|
16
16
|
const Toaster = (props)=>{
|
|
17
17
|
const state = (0, _useToaster.useToaster_unstable)(props);
|
|
18
18
|
(0, _useToasterStylesstyles.useToasterStyles_unstable)(state);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toaster/Toaster.tsx"],"sourcesContent":["'use client';\n\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport type * 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","useToaster_unstable","renderToaster_unstable","useToasterStyles_unstable","Toaster","props","state","displayName"],"mappings":"AAAA;;;;;;;;;;;qCAE4C,kCAAkC;4BAG1C,
|
|
1
|
+
{"version":3,"sources":["../src/components/Toaster/Toaster.tsx"],"sourcesContent":["'use client';\n\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport type * 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","useToaster_unstable","renderToaster_unstable","useToasterStyles_unstable","Toaster","props","state","displayName"],"mappings":"AAAA;;;;;;;;;;;qCAE4C,kCAAkC;4BAG1C,kBAAe;+BACZ,qBAAkB;wCACf,+BAA4B;AAM/D,MAAMI,UAAkCC,CAAAA;IAC7C,MAAMC,YAAQL,+BAAAA,EAAoBI;QAElCF,iDAAAA,EAA0BG;QAC1BN,gDAAAA,EAA4B,6BAA6BM;IACzD,WAAOJ,qCAAAA,EAAuBI;AAChC,EAAE;AAEFF,QAAQG,WAAW,GAAG"}
|
|
@@ -28,8 +28,8 @@ _export(exports, {
|
|
|
28
28
|
return _useToaster.useToaster_unstable;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
const _Toaster = require("./Toaster");
|
|
32
|
-
const _renderToaster = require("./renderToaster");
|
|
33
|
-
const _useToaster = require("./useToaster");
|
|
34
|
-
const _useToasterStylesstyles = require("./useToasterStyles.styles");
|
|
35
|
-
const _useToastAnnounce = require("./useToastAnnounce");
|
|
31
|
+
const _Toaster = require("./Toaster.cjs");
|
|
32
|
+
const _renderToaster = require("./renderToaster.cjs");
|
|
33
|
+
const _useToaster = require("./useToaster.cjs");
|
|
34
|
+
const _useToasterStylesstyles = require("./useToasterStyles.styles.cjs");
|
|
35
|
+
const _useToastAnnounce = require("./useToastAnnounce.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toaster/index.ts"],"sourcesContent":["export { Toaster } from './Toaster';\nexport type { ToasterProps, ToasterSlots, ToasterSlotsInternal, ToasterState } from './Toaster.types';\nexport { renderToaster_unstable } from './renderToaster';\nexport { useToaster_unstable } from './useToaster';\nexport { toasterClassNames, useToasterStyles_unstable } from './useToasterStyles.styles';\nexport { useToastAnnounce } from './useToastAnnounce';\n"],"names":["Toaster","renderToaster_unstable","useToaster_unstable","toasterClassNames","useToasterStyles_unstable","useToastAnnounce"],"mappings":";;;;;;;;;;;;eAASA,gBAAO;;;eAEPC,qCAAsB;;;eAEtBE,yCAAiB;;;eACjBE,kCAAgB;;;eADGD,iDAAyB;;;eAD5CF,+BAAmB;;;yBAHJ,
|
|
1
|
+
{"version":3,"sources":["../src/components/Toaster/index.ts"],"sourcesContent":["export { Toaster } from './Toaster';\nexport type { ToasterProps, ToasterSlots, ToasterSlotsInternal, ToasterState } from './Toaster.types';\nexport { renderToaster_unstable } from './renderToaster';\nexport { useToaster_unstable } from './useToaster';\nexport { toasterClassNames, useToasterStyles_unstable } from './useToasterStyles.styles';\nexport { useToastAnnounce } from './useToastAnnounce';\n"],"names":["Toaster","renderToaster_unstable","useToaster_unstable","toasterClassNames","useToasterStyles_unstable","useToastAnnounce"],"mappings":";;;;;;;;;;;;eAASA,gBAAO;;;eAEPC,qCAAsB;;;eAEtBE,yCAAiB;;;eACjBE,kCAAgB;;;eADGD,iDAAyB;;;eAD5CF,+BAAmB;;;yBAHJ,eAAY;+BAEG,qBAAkB;4BACrB,kBAAe;wCACU,+BAA4B;kCACxD,wBAAqB"}
|
|
@@ -11,12 +11,12 @@ Object.defineProperty(exports, "renderToaster_unstable", {
|
|
|
11
11
|
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
12
12
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
13
13
|
const _reactportal = require("@fluentui/react-portal");
|
|
14
|
-
const
|
|
14
|
+
const _index = require("../AriaLive/index.cjs");
|
|
15
15
|
const renderToaster_unstable = (state)=>{
|
|
16
16
|
const { announceRef, renderAriaLive, inline, mountNode } = state;
|
|
17
17
|
(0, _reactutilities.assertSlots)(state);
|
|
18
18
|
const hasToasts = !!state.bottomStart || !!state.bottomEnd || !!state.topStart || !!state.topEnd || !!state.top || !!state.bottom;
|
|
19
|
-
const ariaLive = renderAriaLive ? /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
19
|
+
const ariaLive = renderAriaLive ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.AriaLive, {
|
|
20
20
|
announceRef: announceRef
|
|
21
21
|
}) : null;
|
|
22
22
|
const positionSlots = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toaster/renderToaster.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { Portal } from '@fluentui/react-portal';\nimport type { ToasterState, ToasterSlotsInternal } from './Toaster.types';\nimport { AriaLive } from '../AriaLive';\n\n/**\n * Render the final JSX of Toaster\n */\nexport const renderToaster_unstable = (state: ToasterState): JSXElement => {\n const { announceRef, renderAriaLive, inline, mountNode } = state;\n assertSlots<ToasterSlotsInternal>(state);\n\n const hasToasts =\n !!state.bottomStart || !!state.bottomEnd || !!state.topStart || !!state.topEnd || !!state.top || !!state.bottom;\n\n const ariaLive = renderAriaLive ? <AriaLive announceRef={announceRef} /> : null;\n const positionSlots = (\n <>\n {state.bottom ? <state.bottom /> : null}\n {state.bottomStart ? <state.bottomStart /> : null}\n {state.bottomEnd ? <state.bottomEnd /> : null}\n {state.topStart ? <state.topStart /> : null}\n {state.topEnd ? <state.topEnd /> : null}\n {state.top ? <state.top /> : null}\n </>\n );\n\n if (inline) {\n return (\n <>\n {ariaLive}\n {hasToasts ? positionSlots : null}\n </>\n );\n }\n\n return (\n <>\n {ariaLive}\n {hasToasts ? <Portal mountNode={mountNode}>{positionSlots}</Portal> : null}\n </>\n );\n};\n"],"names":["assertSlots","Portal","AriaLive","renderToaster_unstable","state","announceRef","renderAriaLive","inline","mountNode","hasToasts","bottomStart","bottomEnd","topStart","topEnd","top","bottom","ariaLive","positionSlots"],"mappings":";;;;+BAYaG;;;;;;4BAXb,UAAiD;gCAErB,4BAA4B;6BAEjC,yBAAyB;
|
|
1
|
+
{"version":3,"sources":["../src/components/Toaster/renderToaster.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { Portal } from '@fluentui/react-portal';\nimport type { ToasterState, ToasterSlotsInternal } from './Toaster.types';\nimport { AriaLive } from '../AriaLive';\n\n/**\n * Render the final JSX of Toaster\n */\nexport const renderToaster_unstable = (state: ToasterState): JSXElement => {\n const { announceRef, renderAriaLive, inline, mountNode } = state;\n assertSlots<ToasterSlotsInternal>(state);\n\n const hasToasts =\n !!state.bottomStart || !!state.bottomEnd || !!state.topStart || !!state.topEnd || !!state.top || !!state.bottom;\n\n const ariaLive = renderAriaLive ? <AriaLive announceRef={announceRef} /> : null;\n const positionSlots = (\n <>\n {state.bottom ? <state.bottom /> : null}\n {state.bottomStart ? <state.bottomStart /> : null}\n {state.bottomEnd ? <state.bottomEnd /> : null}\n {state.topStart ? <state.topStart /> : null}\n {state.topEnd ? <state.topEnd /> : null}\n {state.top ? <state.top /> : null}\n </>\n );\n\n if (inline) {\n return (\n <>\n {ariaLive}\n {hasToasts ? positionSlots : null}\n </>\n );\n }\n\n return (\n <>\n {ariaLive}\n {hasToasts ? <Portal mountNode={mountNode}>{positionSlots}</Portal> : null}\n </>\n );\n};\n"],"names":["assertSlots","Portal","AriaLive","renderToaster_unstable","state","announceRef","renderAriaLive","inline","mountNode","hasToasts","bottomStart","bottomEnd","topStart","topEnd","top","b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AA,EAAA,oBAAA,EAAA;;YACGD;YACAP,YAAAA,WAAAA,OAAY,eAAA,EAACR,mBAAAA,EAAAA;gBAAOO,WAAWA;0BAAYS;iBAA0B;;;AAG5E,EAAE"}
|
|
@@ -15,15 +15,14 @@ const _reactutilities = require("@fluentui/react-utilities");
|
|
|
15
15
|
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
16
16
|
const _reacttabster = require("@fluentui/react-tabster");
|
|
17
17
|
const _keyboardkeys = require("@fluentui/keyboard-keys");
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const _useToasterFocusManagement = require("./useToasterFocusManagement");
|
|
21
|
-
const _useToastAnnounce = require("./useToastAnnounce");
|
|
18
|
+
const _index = require("../../state/index.cjs");
|
|
19
|
+
const _index1 = require("../ToastContainer/index.cjs");
|
|
20
|
+
const _useToasterFocusManagement = require("./useToasterFocusManagement.cjs");
|
|
21
|
+
const _useToastAnnounce = require("./useToastAnnounce.cjs");
|
|
22
22
|
const useToaster_unstable = (props)=>{
|
|
23
|
-
'use no memo';
|
|
24
23
|
const { offset, announce: announceProp, mountNode, inline = false, ...rest } = props;
|
|
25
24
|
const announceRef = _react.useRef(()=>null);
|
|
26
|
-
const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } = (0,
|
|
25
|
+
const { toastsToRender, isToastVisible, pauseAllToasts, playAllToasts, tryRestoreFocus, closeAllToasts } = (0, _index.useToaster)(rest);
|
|
27
26
|
const announce = _react.useCallback((message, options)=>announceRef.current(message, options), []);
|
|
28
27
|
const { dir } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
29
28
|
const { onKeyDown: onKeyDownProp, ...rootProps } = _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', rest), {
|
|
@@ -49,7 +48,7 @@ const useToaster_unstable = (props)=>{
|
|
|
49
48
|
return _reactutilities.slot.optional(toastsToRender.has(toastPosition) ? rootProps : null, {
|
|
50
49
|
defaultProps: {
|
|
51
50
|
ref: (0, _reactutilities.useMergedRefs)(focusManagementRef, toasterRef),
|
|
52
|
-
children: (_toastsToRender_get = toastsToRender.get(toastPosition)) === null || _toastsToRender_get === void 0 ? void 0 : _toastsToRender_get.map((toast)=>/*#__PURE__*/ _react.createElement(
|
|
51
|
+
children: (_toastsToRender_get = toastsToRender.get(toastPosition)) === null || _toastsToRender_get === void 0 ? void 0 : _toastsToRender_get.map((toast)=>/*#__PURE__*/ _react.createElement(_index1.ToastContainer, {
|
|
53
52
|
...toast,
|
|
54
53
|
tryRestoreFocus: tryRestoreFocus,
|
|
55
54
|
intent: toast.intent,
|
|
@@ -80,12 +79,12 @@ const useToaster_unstable = (props)=>{
|
|
|
80
79
|
root: _reactutilities.slot.always(rootProps, {
|
|
81
80
|
elementType: 'div'
|
|
82
81
|
}),
|
|
83
|
-
bottomStart: usePositionSlot(
|
|
84
|
-
bottomEnd: usePositionSlot(
|
|
85
|
-
topStart: usePositionSlot(
|
|
86
|
-
topEnd: usePositionSlot(
|
|
87
|
-
top: usePositionSlot(
|
|
88
|
-
bottom: usePositionSlot(
|
|
82
|
+
bottomStart: usePositionSlot(_index.TOAST_POSITIONS.bottomStart),
|
|
83
|
+
bottomEnd: usePositionSlot(_index.TOAST_POSITIONS.bottomEnd),
|
|
84
|
+
topStart: usePositionSlot(_index.TOAST_POSITIONS.topStart),
|
|
85
|
+
topEnd: usePositionSlot(_index.TOAST_POSITIONS.topEnd),
|
|
86
|
+
top: usePositionSlot(_index.TOAST_POSITIONS.top),
|
|
87
|
+
bottom: usePositionSlot(_index.TOAST_POSITIONS.bottom),
|
|
89
88
|
announceRef,
|
|
90
89
|
offset,
|
|
91
90
|
announce: announceProp !== null && announceProp !== void 0 ? announceProp : announce,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Toaster/useToaster.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ExtractSlotProps, Slot } from '@fluentui/react-utilities';\nimport { getIntrinsicElementProps, useEventCallback, useMergedRefs, slot } 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 type { ToastPosition } from '../../state';\nimport { TOAST_POSITIONS, useToaster } from '../../state';\nimport type { 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 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":"A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uD,gBAAgB,CAACtD;QACjBE;IACF;AACF,EAAE"}
|
|
@@ -14,7 +14,7 @@ const _reactutilities = require("@fluentui/react-utilities");
|
|
|
14
14
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
15
15
|
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
16
16
|
const _keyboardkeys = require("@fluentui/keyboard-keys");
|
|
17
|
-
const
|
|
17
|
+
const _index = require("../ToastContainer/index.cjs");
|
|
18
18
|
const noop = ()=>undefined;
|
|
19
19
|
function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {
|
|
20
20
|
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
@@ -27,7 +27,7 @@ function useToasterFocusManagement_unstable(pauseAllToasts, playAllToasts) {
|
|
|
27
27
|
}
|
|
28
28
|
const toastContainerWalker = targetDocument.createTreeWalker(el, NodeFilter.SHOW_ELEMENT, {
|
|
29
29
|
acceptNode (node) {
|
|
30
|
-
if ((0, _reactutilities.isHTMLElement)(node) && node.classList.contains(
|
|
30
|
+
if ((0, _reactutilities.isHTMLElement)(node) && node.classList.contains(_index.toastContainerClassNames.root)) {
|
|
31
31
|
return NodeFilter.FILTER_ACCEPT;
|
|
32
32
|
}
|
|
33
33
|
return NodeFilter.FILTER_SKIP;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;uBACpB,6BAAoB;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,+BAAAA,CAAyBoB,IAAI,GAAG;oBACjF,OAAON,WAAWO,aAAa;gBACjC;gBAEA,OAAOP,WAAWQ,WAAW;YAC/B;QACF;QAEA;;;;;OAKC,GACD,MAAMC,kBAAkB,CAACC;YACvB,MAAM,EAAEC,MAAM,EAAEC,GAAG,EAAE,GAAGF;YACxB,IAAI,KAAC9B,6BAAAA,EAAc+B,SAAS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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"}
|
package/lib-commonjs/components/Toaster/{useToasterStyles.styles.js → useToasterStyles.styles.cjs}
RENAMED
|
@@ -18,7 +18,7 @@ _export(exports, {
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
const _react = require("@griffel/react");
|
|
21
|
-
const _index = require("../../state/index");
|
|
21
|
+
const _index = require("../../state/index.cjs");
|
|
22
22
|
const toasterClassNames = {
|
|
23
23
|
root: 'fui-Toaster'
|
|
24
24
|
};
|
|
@@ -37,7 +37,6 @@ const useToasterStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
|
37
37
|
]
|
|
38
38
|
});
|
|
39
39
|
const useToasterStyles_unstable = (state)=>{
|
|
40
|
-
'use no memo';
|
|
41
40
|
const rootBaseClassName = useRootBaseClassName();
|
|
42
41
|
const styles = useToasterStyles();
|
|
43
42
|
const className = (0, _react.mergeClasses)(toasterClassNames.root, rootBaseClassName, state.inline && styles.inline, state.root.className);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useToasterStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeResetStyles, makeStyles, mergeClasses } from \"@griffel/react\";\nimport { TOAST_POSITIONS, getPositionStyles } from \"../../state/index.js\";\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 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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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,sBAAsB;AAClE,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,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,KAAK,CAACI,WAAW,EAAE;QACnB,IAAIC,kBAAkB;QACtB,oDAAA;QACAL,KAAK,CAACI,WAAW,CAACD,SAAS,GAAGA,SAAS;QACvC,IAAIG,MAAM;SACTA,MAAM,GAAG,CAAC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GA,SAAS;QAClC,IAAIuB,OAAO;SACVA,OAAO,GAAG,CAACD,aAAa,GAAGzB,KAAK,CAACwB,MAAAA,AAAM,EAAEjB,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"}
|
|
@@ -18,7 +18,7 @@ _export(exports, {
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
const _react = require("@griffel/react");
|
|
21
|
-
const _index = require("../../state/index");
|
|
21
|
+
const _index = require("../../state/index.cjs");
|
|
22
22
|
const toasterClassNames = {
|
|
23
23
|
root: 'fui-Toaster'
|
|
24
24
|
};
|
|
@@ -35,7 +35,6 @@ const useToasterStyles = (0, _react.makeStyles)({
|
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
const useToasterStyles_unstable = (state)=>{
|
|
38
|
-
'use no memo';
|
|
39
38
|
const rootBaseClassName = useRootBaseClassName();
|
|
40
39
|
const styles = useToasterStyles();
|
|
41
40
|
const className = (0, _react.mergeClasses)(toasterClassNames.root, rootBaseClassName, state.inline && styles.inline, state.root.className);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Toaster/useToasterStyles.styles.ts"],"sourcesContent":["'use client';\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 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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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,uBAAoB;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,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;YAGrBJ;QAFA,oDAAoD;QACpDA,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;YAGnBV;QAFA,oDAAoD;QACpDA,MAAMU,SAAS,CAACP,SAAS,GAAGA;;QAC5BH,CAAAA,UAAAA,CAAAA,mBAAAA,MAAMU,SAAAA,AAAS,EAACL,KAAAA,MAAA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QACrBC,OAAOC,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;YAGhBd;QAFA,oDAAoD;QACpDA,MAAMc,MAAM,CAACX,SAAS,GAAGA;;QACzBH,CAAAA,UAAAA,iBAAAA,MAAMc,MAAAA,AAAM,EAACT,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"}
|
|
@@ -94,7 +94,7 @@ _export(exports, {
|
|
|
94
94
|
return _ToastContainer.useToastContainer_unstable;
|
|
95
95
|
},
|
|
96
96
|
useToastController: function() {
|
|
97
|
-
return
|
|
97
|
+
return _index.useToastController;
|
|
98
98
|
},
|
|
99
99
|
useToastFooterStyles_unstable: function() {
|
|
100
100
|
return _ToastFooter.useToastFooterStyles_unstable;
|
|
@@ -121,7 +121,7 @@ _export(exports, {
|
|
|
121
121
|
return _Toast.useToast_unstable;
|
|
122
122
|
},
|
|
123
123
|
useToaster: function() {
|
|
124
|
-
return
|
|
124
|
+
return _index.useToaster;
|
|
125
125
|
},
|
|
126
126
|
useToasterStyles_unstable: function() {
|
|
127
127
|
return _Toaster.useToasterStyles_unstable;
|
|
@@ -130,12 +130,12 @@ _export(exports, {
|
|
|
130
130
|
return _Toaster.useToaster_unstable;
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
|
-
const
|
|
134
|
-
const _ToastTrigger = require("./ToastTrigger");
|
|
135
|
-
const _Toaster = require("./Toaster");
|
|
136
|
-
const _Toast = require("./Toast");
|
|
137
|
-
const _ToastTitle = require("./ToastTitle");
|
|
138
|
-
const _ToastBody = require("./ToastBody");
|
|
139
|
-
const _ToastFooter = require("./ToastFooter");
|
|
140
|
-
const _toastContainerContext = require("./contexts/toastContainerContext");
|
|
141
|
-
const _ToastContainer = require("./ToastContainer");
|
|
133
|
+
const _index = require("./state/index.cjs");
|
|
134
|
+
const _ToastTrigger = require("./ToastTrigger.cjs");
|
|
135
|
+
const _Toaster = require("./Toaster.cjs");
|
|
136
|
+
const _Toast = require("./Toast.cjs");
|
|
137
|
+
const _ToastTitle = require("./ToastTitle.cjs");
|
|
138
|
+
const _ToastBody = require("./ToastBody.cjs");
|
|
139
|
+
const _ToastFooter = require("./ToastFooter.cjs");
|
|
140
|
+
const _toastContainerContext = require("./contexts/toastContainerContext.cjs");
|
|
141
|
+
const _ToastContainer = require("./ToastContainer.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { useToastController, useToaster } from './state';\nexport type {\n Announce as ToastAnnounce,\n AnnounceOptions as ToastAnnounceOptions,\n LiveMessage as ToastLiveMessage,\n} from './AriaLive';\nexport type {\n ToastPosition,\n ToastId,\n ToastOffset,\n ToastPoliteness,\n ToastStatus,\n ToastIntent,\n ToasterId,\n ToasterOptions,\n ToasterShortcuts,\n ToastImperativeRef,\n Toast as ToastData,\n ToastChangeData,\n ToastChangeHandler,\n ToastOptions,\n DispatchToastOptions as ToastDispatchOptions,\n UpdateToastOptions as ToastUpdateOptions,\n UpdateToastEventDetail as ToastUpdateEventDetail,\n} from './state';\n\nexport { ToastTrigger, useToastTrigger_unstable, renderToastTrigger_unstable } from './ToastTrigger';\nexport type { ToastTriggerChildProps, ToastTriggerProps, ToastTriggerState } from './ToastTrigger';\nexport {\n Toaster,\n useToaster_unstable,\n useToasterStyles_unstable,\n renderToaster_unstable,\n toasterClassNames,\n useToastAnnounce,\n} from './Toaster';\nexport type { ToasterProps, ToasterState, ToasterSlots } from './Toaster';\nexport {\n Toast,\n useToastStyles_unstable,\n useToastBase_unstable,\n useToast_unstable,\n renderToast_unstable,\n toastClassNames,\n} from './Toast';\nexport type { ToastBaseProps, ToastBaseState, ToastProps, ToastState, ToastSlots } from './Toast';\n\nexport {\n ToastTitle,\n useToastTitleStyles_unstable,\n useToastTitleBase_unstable,\n useToastTitle_unstable,\n renderToastTitle_unstable,\n toastTitleClassNames,\n} from './ToastTitle';\nexport type {\n ToastTitleBaseProps,\n ToastTitleBaseState,\n ToastTitleProps,\n ToastTitleState,\n ToastTitleSlots,\n} from './ToastTitle';\n\nexport {\n ToastBody,\n useToastBodyStyles_unstable,\n useToastBodyBase_unstable,\n useToastBody_unstable,\n renderToastBody_unstable,\n toastBodyClassNames,\n} from './ToastBody';\nexport type {\n ToastBodyBaseProps,\n ToastBodyBaseState,\n ToastBodyProps,\n ToastBodyState,\n ToastBodySlots,\n} from './ToastBody';\n\nexport {\n ToastFooter,\n useToastFooterStyles_unstable,\n useToastFooter_unstable,\n renderToastFooter_unstable,\n toastFooterClassNames,\n} from './ToastFooter';\nexport type { ToastFooterProps, ToastFooterState, ToastFooterSlots } from './ToastFooter';\n\nexport type { ToastContainerContextValue } from './contexts/toastContainerContext';\nexport { ToastContainerContextProvider, useToastContainerContext } from './contexts/toastContainerContext';\nexport { toastContainerClassNames } from './ToastContainer';\nexport type { ToastContainerSlots, ToastContainerProps, ToastContainerState } from './ToastContainer';\nexport {\n useToastContainer_unstable,\n renderToastContainer_unstable,\n useToastContainerContextValues_unstable,\n} from './ToastContainer';\n"],"names":["useToastController","useToaster","ToastTrigger","useToastTrigger_unstable","renderToastTrigger_unstable","Toaster","useToaster_unstable","useToasterStyles_unstable","renderToaster_unstable","toasterClassNames","useToastAnnounce","Toast","useToastStyles_unstable","useToastBase_unstable","useToast_unstable","renderToast_unstable","toastClassNames","ToastTitle","useToastTitleStyles_unstable","useToastTitleBase_unstable","useToastTitle_unstable","renderToastTitle_unstable","toastTitleClassNames","ToastBody","useToastBodyStyles_unstable","useToastBodyBase_unstable","useToastBody_unstable","renderToastBody_unstable","toastBodyClassNames","ToastFooter","useToastFooterStyles_unstable","useToastFooter_unstable","renderToastFooter_unstable","toastFooterClassNames","ToastContainerContextProvider","useToastContainerContext","toastContainerClassNames","useToastContainer_unstable","renderToastContainer_unstable","useToastContainerContextValues_unstable"],"mappings":";;;;;;;;;;;;eAsCEW,YAAK;;aA0BI;eAATY;;iCAyBoC;eAA7BW;;IATPL,WAAW;;;;eAhCXZ,sBAAU;;;eAtBHf,0BAAY;;;eAGnBG,gBAAO;;;eAuCPsB,mCAAwB;;;eA0BxBW,6CAA6B;;;eAX7BN,uCAA0B;;;eA/B1BX,qCAAyB;;+BA1BiD;eAA3BjB;;;eAgB/CW,2BAAoB;;;eAVpBP,+BAAsB;;IAqCtBoB;6CAAmB;;;eA1BnBZ,sBAAe;;;eA+CRoB,wCAAwB;;yBANV;eAArBH;;;eA/BAX,gCAAoB;;qBApBH;eAAjBb;;IACAC,gBAAgB;;;;eAMhBG,4BAAqB;;;eA0BrBY,oCAAyB;;;eADzBD,sCAA2B;;;eAE3BE,gCAAqB;;IAsBiBS,wBAAwB;;;;eAM9DI,uDAAuC,QAClC,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { useToastController, useToaster } from './state';\nexport type {\n Announce as ToastAnnounce,\n AnnounceOptions as ToastAnnounceOptions,\n LiveMessage as ToastLiveMessage,\n} from './AriaLive';\nexport type {\n ToastPosition,\n ToastId,\n ToastOffset,\n ToastPoliteness,\n ToastStatus,\n ToastIntent,\n ToasterId,\n ToasterOptions,\n ToasterShortcuts,\n ToastImperativeRef,\n Toast as ToastData,\n ToastChangeData,\n ToastChangeHandler,\n ToastOptions,\n DispatchToastOptions as ToastDispatchOptions,\n UpdateToastOptions as ToastUpdateOptions,\n UpdateToastEventDetail as ToastUpdateEventDetail,\n} from './state';\n\nexport { ToastTrigger, useToastTrigger_unstable, renderToastTrigger_unstable } from './ToastTrigger';\nexport type { ToastTriggerChildProps, ToastTriggerProps, ToastTriggerState } from './ToastTrigger';\nexport {\n Toaster,\n useToaster_unstable,\n useToasterStyles_unstable,\n renderToaster_unstable,\n toasterClassNames,\n useToastAnnounce,\n} from './Toaster';\nexport type { ToasterProps, ToasterState, ToasterSlots } from './Toaster';\nexport {\n Toast,\n useToastStyles_unstable,\n useToastBase_unstable,\n useToast_unstable,\n renderToast_unstable,\n toastClassNames,\n} from './Toast';\nexport type { ToastBaseProps, ToastBaseState, ToastProps, ToastState, ToastSlots } from './Toast';\n\nexport {\n ToastTitle,\n useToastTitleStyles_unstable,\n useToastTitleBase_unstable,\n useToastTitle_unstable,\n renderToastTitle_unstable,\n toastTitleClassNames,\n} from './ToastTitle';\nexport type {\n ToastTitleBaseProps,\n ToastTitleBaseState,\n ToastTitleProps,\n ToastTitleState,\n ToastTitleSlots,\n} from './ToastTitle';\n\nexport {\n ToastBody,\n useToastBodyStyles_unstable,\n useToastBodyBase_unstable,\n useToastBody_unstable,\n renderToastBody_unstable,\n toastBodyClassNames,\n} from './ToastBody';\nexport type {\n ToastBodyBaseProps,\n ToastBodyBaseState,\n ToastBodyProps,\n ToastBodyState,\n ToastBodySlots,\n} from './ToastBody';\n\nexport {\n ToastFooter,\n useToastFooterStyles_unstable,\n useToastFooter_unstable,\n renderToastFooter_unstable,\n toastFooterClassNames,\n} from './ToastFooter';\nexport type { ToastFooterProps, ToastFooterState, ToastFooterSlots } from './ToastFooter';\n\nexport type { ToastContainerContextValue } from './contexts/toastContainerContext';\nexport { ToastContainerContextProvider, useToastContainerContext } from './contexts/toastContainerContext';\nexport { toastContainerClassNames } from './ToastContainer';\nexport type { ToastContainerSlots, ToastContainerProps, ToastContainerState } from './ToastContainer';\nexport {\n useToastContainer_unstable,\n renderToastContainer_unstable,\n useToastContainerContextValues_unstable,\n} from './ToastContainer';\n"],"names":["useToastController","useToaster","ToastTrigger","useToastTrigger_unstable","renderToastTrigger_unstable","Toaster","useToaster_unstable","useToasterStyles_unstable","renderToaster_unstable","toasterClassNames","useToastAnnounce","Toast","useToastStyles_unstable","useToastBase_unstable","useToast_unstable","renderToast_unstable","toastClassNames","ToastTitle","useToastTitleStyles_unstable","useToastTitleBase_unstable","useToastTitle_unstable","renderToastTitle_unstable","toastTitleClassNames","ToastBody","useToastBodyStyles_unstable","useToastBodyBase_unstable","useToastBody_unstable","renderToastBody_unstable","toastBodyClassNames","ToastFooter","useToastFooterStyles_unstable","useToastFooter_unstable","renderToastFooter_unstable","toastFooterClassNames","ToastContainerContextProvider","useToastContainerContext","toastContainerClassNames","useToastContainer_unstable","renderToastContainer_unstable","useToastContainerContextValues_unstable"],"mappings":";;;;;;;;;;;;eAsCEW,YAAK;;aA0BI;eAATY;;iCAyBoC;eAA7BW;;IATPL,WAAW;;;;eAhCXZ,sBAAU;;;eAtBHf,0BAAY;;;eAGnBG,gBAAO;;;eAuCPsB,mCAAwB;;;eA0BxBW,6CAA6B;;;eAX7BN,uCAA0B;;;eA/B1BX,qCAAyB;;+BA1BiD;eAA3BjB;;;eAgB/CW,2BAAoB;;;eAVpBP,+BAAsB;;IAqCtBoB;6CAAmB;;;eA1BnBZ,sBAAe;;;eA+CRoB,wCAAwB;;yBANV;eAArBH;;;eA/BAX,gCAAoB;;qBApBH;eAAjBb;;IACAC,gBAAgB;;;;eAMhBG,4BAAqB;;;eA0BrBY,oCAAyB;;;eADzBD,sCAA2B;;;eAE3BE,gCAAqB;;IAsBiBS,wBAAwB;;;;eAM9DI,uDAAuC,QAClC,sBAAmB;;IAHxBF;yDAA0B;;;eA7FnBrC,yBAAkB;;;eAiFzB8B,0CAA6B;;;eAC7BC,oCAAuB;;;eA3CvBnB,8BAAuB;;;eAWvBO,sCAA0B;;IAD1BD,4BAA4B;;;;eAE5BE,kCAAsB;;;eAzBDjB,sCAAwB;;;eAe7CW,wBAAiB;;;eAzCUb,iBAAU;;;eA+BrCM,kCAAyB;;;eADzBD,4BAAmB;;;uBA9B0B,mBAAU;8BA0B2B,oBAAiB;yBAS9F,eAAY;uBASZ,aAAU;4BAUV,kBAAe;2BAgBf,iBAAc;6BAed,mBAAgB;uCAIiD,sCAAmC;gCAClE,sBAAmB"}
|
|
@@ -13,7 +13,7 @@ _export(exports, {
|
|
|
13
13
|
return _constants.TOAST_POSITIONS;
|
|
14
14
|
},
|
|
15
15
|
getPositionStyles: function() {
|
|
16
|
-
return
|
|
16
|
+
return _index.getPositionStyles;
|
|
17
17
|
},
|
|
18
18
|
useToastController: function() {
|
|
19
19
|
return _useToastController.useToastController;
|
|
@@ -22,7 +22,7 @@ _export(exports, {
|
|
|
22
22
|
return _useToaster.useToaster;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
const _useToaster = require("./useToaster");
|
|
26
|
-
const _useToastController = require("./useToastController");
|
|
27
|
-
const
|
|
28
|
-
const _constants = require("./constants");
|
|
25
|
+
const _useToaster = require("./useToaster.cjs");
|
|
26
|
+
const _useToastController = require("./useToastController.cjs");
|
|
27
|
+
const _index = require("./vanilla/index.cjs");
|
|
28
|
+
const _constants = require("./constants.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/state/index.ts"],"sourcesContent":["export type {\n CommonToastDetail,\n DismissAllToastsEventDetail,\n DismissToastEventDetail,\n DispatchToastOptions,\n PauseToastEventDetail,\n PlayToastEventDetail,\n ShowToastEventDetail,\n Toast,\n ToastChangeData,\n ToastChangeHandler,\n ToastId,\n ToastImperativeRef,\n ToastIntent,\n ToastListenerMap,\n ToastOffset,\n ToastOffsetObject,\n ToastOptions,\n ToastPoliteness,\n ToastPosition,\n ToastStatus,\n ToasterId,\n ToasterOptions,\n ToasterShortcuts,\n UpdateToastEventDetail,\n UpdateToastOptions,\n} from './types';\nexport { useToaster } from './useToaster';\nexport { useToastController } from './useToastController';\nexport { getPositionStyles } from './vanilla';\nexport { TOAST_POSITIONS } from './constants';\n"],"names":["useToaster","useToastController","getPositionStyles","TOAST_POSITIONS"],"mappings":";;;;;;;;;;;;eA8BSG,0BAAe;;;eADfD,
|
|
1
|
+
{"version":3,"sources":["../src/state/index.ts"],"sourcesContent":["export type {\n CommonToastDetail,\n DismissAllToastsEventDetail,\n DismissToastEventDetail,\n DispatchToastOptions,\n PauseToastEventDetail,\n PlayToastEventDetail,\n ShowToastEventDetail,\n Toast,\n ToastChangeData,\n ToastChangeHandler,\n ToastId,\n ToastImperativeRef,\n ToastIntent,\n ToastListenerMap,\n ToastOffset,\n ToastOffsetObject,\n ToastOptions,\n ToastPoliteness,\n ToastPosition,\n ToastStatus,\n ToasterId,\n ToasterOptions,\n ToasterShortcuts,\n UpdateToastEventDetail,\n UpdateToastOptions,\n} from './types';\nexport { useToaster } from './useToaster';\nexport { useToastController } from './useToastController';\nexport { getPositionStyles } from './vanilla';\nexport { TOAST_POSITIONS } from './constants';\n"],"names":["useToaster","useToastController","getPositionStyles","TOAST_POSITIONS"],"mappings":";;;;;;;;;;;;eA8BSG,0BAAe;;;eADfD,wBAAiB;;;eADjBD,sCAAkB;;;eADlBD,sBAAU;;;4BAAQ,kBAAe;oCACP,0BAAuB;uBACxB,qBAAY;2BACd,iBAAc"}
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "useToastController", {
|
|
|
12
12
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
13
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
14
|
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
15
|
-
const
|
|
15
|
+
const _index = require("./vanilla/index.cjs");
|
|
16
16
|
const noop = ()=>undefined;
|
|
17
17
|
function useToastController(toasterId) {
|
|
18
18
|
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
@@ -29,7 +29,7 @@ function useToastController(toasterId) {
|
|
|
29
29
|
}
|
|
30
30
|
return {
|
|
31
31
|
dispatchToast: (content, options)=>{
|
|
32
|
-
(0,
|
|
32
|
+
(0, _index.dispatchToast)(content, {
|
|
33
33
|
...options,
|
|
34
34
|
toasterId,
|
|
35
35
|
data: {
|
|
@@ -38,13 +38,13 @@ function useToastController(toasterId) {
|
|
|
38
38
|
}, targetDocument);
|
|
39
39
|
},
|
|
40
40
|
dismissToast: (toastId)=>{
|
|
41
|
-
(0,
|
|
41
|
+
(0, _index.dismissToast)(toastId, toasterId, targetDocument);
|
|
42
42
|
},
|
|
43
43
|
dismissAllToasts: ()=>{
|
|
44
|
-
(0,
|
|
44
|
+
(0, _index.dismissAllToasts)(toasterId, targetDocument);
|
|
45
45
|
},
|
|
46
46
|
updateToast: (options)=>{
|
|
47
|
-
(0,
|
|
47
|
+
(0, _index.updateToast)({
|
|
48
48
|
...options,
|
|
49
49
|
data: {
|
|
50
50
|
root: options.root
|
|
@@ -53,10 +53,10 @@ function useToastController(toasterId) {
|
|
|
53
53
|
}, targetDocument);
|
|
54
54
|
},
|
|
55
55
|
pauseToast: (toastId)=>{
|
|
56
|
-
(0,
|
|
56
|
+
(0, _index.pauseToast)(toastId, toasterId, targetDocument);
|
|
57
57
|
},
|
|
58
58
|
playToast: (toastId)=>{
|
|
59
|
-
(0,
|
|
59
|
+
(0, _index.playToast)(toastId, toasterId, targetDocument);
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
}, [
|
|
@@ -1 +1 @@
|
|
|
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 type { 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;
|
|
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 type { 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;uBAQ3E,qBAAY;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,oBAAAA,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,uBAAAA,EAAoBmB,SAASP,WAAWC;YAC1C;YACAZ,kBAAkB;oBAChBC,uBAAAA,EAAwBU,WAAWC;YACrC;YACAV,aAAa,CAACa;oBACZZ,kBAAAA,EAAmB;oBAAE,GAAGY,OAAO;oBAAEC,MAAM;wBAAEC,MAAMF,QAAQE,IAAI;oBAAC;oBAAGN;gBAAU,GAAGC;YAC9E;YACAN,YAAY,CAACY;oBACXX,iBAAAA,EAAkBW,SAASP,WAAWC;YACxC;YACAR,WAAW,CAACc;oBACVb,gBAAAA,EAAiBa,SAASP,WAAWC;YACvC;QACF;IACF,GAAG;QAACA;QAAgBD;KAAU;AAChC"}
|
|
@@ -13,13 +13,13 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
|
|
|
13
13
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
14
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
15
15
|
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
16
|
-
const
|
|
17
|
-
const _constants = require("./constants");
|
|
16
|
+
const _index = require("./vanilla/index.cjs");
|
|
17
|
+
const _constants = require("./constants.cjs");
|
|
18
18
|
function useToaster(options = {}) {
|
|
19
19
|
const forceUpdate = (0, _reactutilities.useForceUpdate)();
|
|
20
20
|
const { toasterId: userToasterId, shortcuts } = options;
|
|
21
21
|
// Currently the toaster options can never be changed at runtime
|
|
22
|
-
const [toaster] = _react.useState(()=>(0,
|
|
22
|
+
const [toaster] = _react.useState(()=>(0, _index.createToaster)(options));
|
|
23
23
|
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
24
24
|
const lastActiveElementRef = _react.useRef(null);
|
|
25
25
|
const isCorrectToaster = (0, _reactutilities.useEventCallback)((toasterId)=>{
|
|
@@ -1 +1 @@
|
|
|
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;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,C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MW,wBAAwB,CAACnD;YAC7B,IAAID,gBAAgBC,IAAI;gBACtBE;gBACA,MAAMsB,kBAAkBT;gBAExB,IAAIS,iBAAiB;wBAInBA;oBAHA5B,qBAAqBe,OAAO,OAAG/B,6BAAAA,EAAce,eAAeyD,aAAa,IACrEzD,eAAeyD,aAAa,GAC5B;qBACJ5B,yCAAAA,gBAAgBd,aAAa,CAACC,OAAAA,AAAO,MAAA,QAArCa,2CAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uCAAuCvB,KAAK;gBAC9C;YACF;QACF;QAEAN,eAAesC,gBAAgB,CAAC,WAAWkB;QAE3C,OAAO;YACLV;YACAM;YACAJ;YACAE;YACAI;YACAC;YAEAvD,eAAeuC,mBAAmB,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;uBACpD,qBAAY;2BAWnB,iBAAc;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,oBAAAA,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,KAAAA,IAAAA,CAAAA,+BAAAA,MAAOG,aAAa,CAACC,OAAAA,AAAO,MAAA,QAA5BJ,iCAAAA,K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ACD;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"}
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "dismissAllToasts", {
|
|
|
8
8
|
return dismissAllToasts;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _constants = require("../constants");
|
|
11
|
+
const _constants = require("../constants.cjs");
|
|
12
12
|
function dismissAllToasts(toasterId = undefined, targetDocument) {
|
|
13
13
|
const event = new CustomEvent(_constants.EVENTS.dismissAll, {
|
|
14
14
|
bubbles: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/state/vanilla/dismissAllToasts.ts"],"sourcesContent":["import { EVENTS } from '../constants';\nimport type { DismissAllToastsEventDetail, ToasterId } from '../types';\n\nexport function dismissAllToasts(toasterId: ToasterId | undefined = undefined, targetDocument: Document): void {\n const event = new CustomEvent<DismissAllToastsEventDetail>(EVENTS.dismissAll, {\n bubbles: false,\n cancelable: false,\n detail: { toasterId },\n });\n targetDocument.dispatchEvent(event);\n}\n"],"names":["EVENTS","dismissAllToasts","toasterId","undefined","targetDocument","event","CustomEvent","dismissAll","bubbles","cancelable","detail","dispatchEvent"],"mappings":";;;;+BAGgBC;;;;;;2BAHO,
|
|
1
|
+
{"version":3,"sources":["../src/state/vanilla/dismissAllToasts.ts"],"sourcesContent":["import { EVENTS } from '../constants';\nimport type { DismissAllToastsEventDetail, ToasterId } from '../types';\n\nexport function dismissAllToasts(toasterId: ToasterId | undefined = undefined, targetDocument: Document): void {\n const event = new CustomEvent<DismissAllToastsEventDetail>(EVENTS.dismissAll, {\n bubbles: false,\n cancelable: false,\n detail: { toasterId },\n });\n targetDocument.dispatchEvent(event);\n}\n"],"names":["EVENTS","dismissAllToasts","toasterId","undefined","targetDocument","event","CustomEvent","dismissAll","bubbles","cancelable","detail","dispatchEvent"],"mappings":";;;;+BAGgBC;;;;;;2BAHO,kBAAe;AAG/B,0BAA0BC,YAAmCC,SAAS,EAAEC,cAAwB;IACrG,MAAMC,QAAQ,IAAIC,YAAyCN,iBAAAA,CAAOO,UAAU,EAAE;QAC5EC,SAAS;QACTC,YAAY;QACZC,QAAQ;YAAER;QAAU;IACtB;IACAE,eAAeO,aAAa,CAACN;AAC/B"}
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "dismissToast", {
|
|
|
8
8
|
return dismissToast;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _constants = require("../constants");
|
|
11
|
+
const _constants = require("../constants.cjs");
|
|
12
12
|
function dismissToast(toastId, toasterId = undefined, targetDocument) {
|
|
13
13
|
const event = new CustomEvent(_constants.EVENTS.dismiss, {
|
|
14
14
|
bubbles: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/state/vanilla/dismissToast.ts"],"sourcesContent":["import { EVENTS } from '../constants';\nimport type { DismissToastEventDetail, ToastId, ToasterId } from '../types';\n\nexport function dismissToast(\n toastId: ToastId,\n toasterId: ToasterId | undefined = undefined,\n targetDocument: Document,\n): void {\n const event = new CustomEvent<DismissToastEventDetail>(EVENTS.dismiss, {\n bubbles: false,\n cancelable: false,\n detail: { toastId, toasterId },\n });\n targetDocument.dispatchEvent(event);\n}\n"],"names":["EVENTS","dismissToast","toastId","toasterId","undefined","targetDocument","event","CustomEvent","dismiss","bubbles","cancelable","detail","dispatchEvent"],"mappings":";;;;+BAGgBC;;;;;;2BAHO,
|
|
1
|
+
{"version":3,"sources":["../src/state/vanilla/dismissToast.ts"],"sourcesContent":["import { EVENTS } from '../constants';\nimport type { DismissToastEventDetail, ToastId, ToasterId } from '../types';\n\nexport function dismissToast(\n toastId: ToastId,\n toasterId: ToasterId | undefined = undefined,\n targetDocument: Document,\n): void {\n const event = new CustomEvent<DismissToastEventDetail>(EVENTS.dismiss, {\n bubbles: false,\n cancelable: false,\n detail: { toastId, toasterId },\n });\n targetDocument.dispatchEvent(event);\n}\n"],"names":["EVENTS","dismissToast","toastId","toasterId","undefined","targetDocument","event","CustomEvent","dismiss","bubbles","cancelable","detail","dispatchEvent"],"mappings":";;;;+BAGgBC;;;;;;2BAHO,kBAAe;AAG/B,sBACLC,OAAgB,EAChBC,YAAmCC,SAAS,EAC5CC,cAAwB;IAExB,MAAMC,QAAQ,IAAIC,YAAqCP,iBAAAA,CAAOQ,OAAO,EAAE;QACrEC,SAAS;QACTC,YAAY;QACZC,QAAQ;YAAET;YAASC;QAAU;IAC/B;IACAE,eAAeO,aAAa,CAACN;AAC/B"}
|