@fluentui/react-toast 9.1.6 → 9.2.1
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.json +115 -1
- package/CHANGELOG.md +34 -2
- package/dist/index.d.ts +3 -2
- package/lib/components/AriaLive/AriaLive.js.map +1 -1
- package/lib/components/AriaLive/renderAriaLive.js +7 -2
- package/lib/components/AriaLive/renderAriaLive.js.map +1 -1
- package/lib/components/AriaLive/useAriaLive.js +6 -4
- package/lib/components/AriaLive/useAriaLive.js.map +1 -1
- package/lib/components/Timer/Timer.js +1 -1
- package/lib/components/Timer/Timer.js.map +1 -1
- package/lib/components/Toast/Toast.js.map +1 -1
- package/lib/components/Toast/renderToast.js +5 -4
- package/lib/components/Toast/renderToast.js.map +1 -1
- package/lib/components/Toast/useToast.js.map +1 -1
- package/lib/components/Toast/useToastContextValues.js +1 -1
- package/lib/components/Toast/useToastContextValues.js.map +1 -1
- package/lib/components/ToastBody/ToastBody.js.map +1 -1
- package/lib/components/ToastBody/renderToastBody.js +7 -2
- package/lib/components/ToastBody/renderToastBody.js.map +1 -1
- package/lib/components/ToastBody/useToastBody.js +1 -1
- package/lib/components/ToastBody/useToastBody.js.map +1 -1
- package/lib/components/ToastContainer/ToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/renderToastContainer.js +12 -7
- package/lib/components/ToastContainer/renderToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/useToastContainer.js +15 -15
- package/lib/components/ToastContainer/useToastContainer.js.map +1 -1
- package/lib/components/ToastContainer/useToastContainerContextValues.js +1 -1
- package/lib/components/ToastContainer/useToastContainerContextValues.js.map +1 -1
- package/lib/components/ToastFooter/ToastFooter.js.map +1 -1
- package/lib/components/ToastFooter/renderToastFooter.js +2 -2
- package/lib/components/ToastFooter/renderToastFooter.js.map +1 -1
- package/lib/components/ToastFooter/useToastFooter.js.map +1 -1
- package/lib/components/ToastTitle/ToastTitle.js.map +1 -1
- package/lib/components/ToastTitle/renderToastTitle.js +8 -2
- package/lib/components/ToastTitle/renderToastTitle.js.map +1 -1
- package/lib/components/ToastTitle/useToastTitle.js +1 -1
- package/lib/components/ToastTitle/useToastTitle.js.map +1 -1
- package/lib/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
- package/lib/components/ToastTrigger/ToastTrigger.js.map +1 -1
- package/lib/components/ToastTrigger/useToastTrigger.js +8 -7
- package/lib/components/ToastTrigger/useToastTrigger.js.map +1 -1
- package/lib/components/Toaster/Toaster.js.map +1 -1
- package/lib/components/Toaster/Toaster.types.js.map +1 -1
- package/lib/components/Toaster/renderToaster.js +18 -5
- package/lib/components/Toaster/renderToaster.js.map +1 -1
- package/lib/components/Toaster/useToastAnnounce.js.map +1 -1
- package/lib/components/Toaster/useToaster.js +7 -6
- package/lib/components/Toaster/useToaster.js.map +1 -1
- package/lib/components/Toaster/useToasterFocusManagement.js +2 -2
- package/lib/components/Toaster/useToasterFocusManagement.js.map +1 -1
- package/lib/contexts/toastContainerContext.js.map +1 -1
- package/lib/state/useToastController.js +3 -2
- package/lib/state/useToastController.js.map +1 -1
- package/lib/state/useToaster.js +15 -11
- package/lib/state/useToaster.js.map +1 -1
- package/lib/state/vanilla/createToaster.js +7 -7
- package/lib/state/vanilla/createToaster.js.map +1 -1
- package/lib/state/vanilla/dismissAllToasts.js.map +1 -1
- package/lib/state/vanilla/dismissToast.js.map +1 -1
- package/lib/state/vanilla/dispatchToast.js.map +1 -1
- package/lib/state/vanilla/getPositionStyles.js +1 -1
- package/lib/state/vanilla/getPositionStyles.js.map +1 -1
- package/lib/state/vanilla/pauseToast.js.map +1 -1
- package/lib/state/vanilla/playToast.js.map +1 -1
- package/lib/state/vanilla/updateToast.js.map +1 -1
- package/lib-commonjs/AriaLive.js +2 -2
- package/lib-commonjs/AriaLive.js.map +1 -1
- package/lib-commonjs/Toast.js +2 -2
- package/lib-commonjs/Toast.js.map +1 -1
- package/lib-commonjs/ToastBody.js +2 -2
- package/lib-commonjs/ToastBody.js.map +1 -1
- package/lib-commonjs/ToastContainer.js +2 -2
- package/lib-commonjs/ToastContainer.js.map +1 -1
- package/lib-commonjs/ToastFooter.js +2 -2
- package/lib-commonjs/ToastFooter.js.map +1 -1
- package/lib-commonjs/ToastTitle.js +2 -2
- package/lib-commonjs/ToastTitle.js.map +1 -1
- package/lib-commonjs/ToastTrigger.js +2 -2
- package/lib-commonjs/ToastTrigger.js.map +1 -1
- package/lib-commonjs/Toaster.js +2 -2
- package/lib-commonjs/Toaster.js.map +1 -1
- package/lib-commonjs/components/AriaLive/AriaLive.js +7 -5
- package/lib-commonjs/components/AriaLive/AriaLive.js.map +1 -1
- package/lib-commonjs/components/AriaLive/AriaLive.types.js +2 -2
- package/lib-commonjs/components/AriaLive/AriaLive.types.js.map +1 -1
- package/lib-commonjs/components/AriaLive/index.js +6 -6
- package/lib-commonjs/components/AriaLive/index.js.map +1 -1
- package/lib-commonjs/components/AriaLive/renderAriaLive.js +13 -6
- package/lib-commonjs/components/AriaLive/renderAriaLive.js.map +1 -1
- package/lib-commonjs/components/AriaLive/useAriaLive.js +16 -12
- package/lib-commonjs/components/AriaLive/useAriaLive.js.map +1 -1
- package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js +7 -3
- package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Timer/Timer.js +8 -6
- package/lib-commonjs/components/Timer/Timer.js.map +1 -1
- package/lib-commonjs/components/Timer/index.js +2 -2
- package/lib-commonjs/components/Timer/index.js.map +1 -1
- package/lib-commonjs/components/Timer/useTimerStyles.styles.js +4 -2
- package/lib-commonjs/components/Timer/useTimerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Toast/Toast.js +7 -5
- package/lib-commonjs/components/Toast/Toast.js.map +1 -1
- package/lib-commonjs/components/Toast/index.js +6 -6
- package/lib-commonjs/components/Toast/index.js.map +1 -1
- package/lib-commonjs/components/Toast/renderToast.js +12 -9
- package/lib-commonjs/components/Toast/renderToast.js.map +1 -1
- package/lib-commonjs/components/Toast/useToast.js +7 -5
- package/lib-commonjs/components/Toast/useToast.js.map +1 -1
- package/lib-commonjs/components/Toast/useToastContextValues.js +4 -2
- package/lib-commonjs/components/Toast/useToastContextValues.js.map +1 -1
- package/lib-commonjs/components/Toast/useToastStyles.styles.js +8 -4
- package/lib-commonjs/components/Toast/useToastStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastBody/ToastBody.js +7 -5
- package/lib-commonjs/components/ToastBody/ToastBody.js.map +1 -1
- package/lib-commonjs/components/ToastBody/index.js +6 -6
- package/lib-commonjs/components/ToastBody/index.js.map +1 -1
- package/lib-commonjs/components/ToastBody/renderToastBody.js +13 -6
- package/lib-commonjs/components/ToastBody/renderToastBody.js.map +1 -1
- package/lib-commonjs/components/ToastBody/useToastBody.js +11 -9
- package/lib-commonjs/components/ToastBody/useToastBody.js.map +1 -1
- package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js +9 -5
- package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/ToastContainer.js +7 -5
- package/lib-commonjs/components/ToastContainer/ToastContainer.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/ToastContainer.types.js +2 -2
- package/lib-commonjs/components/ToastContainer/ToastContainer.types.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/index.js +7 -7
- package/lib-commonjs/components/ToastContainer/index.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/renderToastContainer.js +19 -12
- package/lib-commonjs/components/ToastContainer/renderToastContainer.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/useToastContainer.js +42 -40
- package/lib-commonjs/components/ToastContainer/useToastContainer.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/useToastContainerContextValues.js +6 -4
- package/lib-commonjs/components/ToastContainer/useToastContainerContextValues.js.map +1 -1
- package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js +8 -4
- package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/ToastFooter.js +7 -5
- package/lib-commonjs/components/ToastFooter/ToastFooter.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/index.js +6 -6
- package/lib-commonjs/components/ToastFooter/index.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/renderToastFooter.js +8 -6
- package/lib-commonjs/components/ToastFooter/renderToastFooter.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/useToastFooter.js +7 -5
- package/lib-commonjs/components/ToastFooter/useToastFooter.js.map +1 -1
- package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js +7 -3
- package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/ToastTitle.js +7 -5
- package/lib-commonjs/components/ToastTitle/ToastTitle.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/index.js +6 -6
- package/lib-commonjs/components/ToastTitle/index.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/renderToastTitle.js +14 -6
- package/lib-commonjs/components/ToastTitle/renderToastTitle.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/useToastTitle.js +17 -15
- package/lib-commonjs/components/ToastTitle/useToastTitle.js.map +1 -1
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js +13 -9
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.js +5 -3
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.types.js +2 -2
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.types.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/index.js +5 -5
- package/lib-commonjs/components/ToastTrigger/index.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/renderToastTrigger.js +3 -1
- package/lib-commonjs/components/ToastTrigger/renderToastTrigger.js.map +1 -1
- package/lib-commonjs/components/ToastTrigger/useToastTrigger.js +18 -15
- package/lib-commonjs/components/ToastTrigger/useToastTrigger.js.map +1 -1
- package/lib-commonjs/components/Toaster/Toaster.js +7 -5
- package/lib-commonjs/components/Toaster/Toaster.js.map +1 -1
- package/lib-commonjs/components/Toaster/index.js +6 -6
- package/lib-commonjs/components/Toaster/index.js.map +1 -1
- package/lib-commonjs/components/Toaster/renderToaster.js +26 -11
- package/lib-commonjs/components/Toaster/renderToaster.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToastAnnounce.js +8 -6
- package/lib-commonjs/components/Toaster/useToastAnnounce.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToaster.js +25 -22
- package/lib-commonjs/components/Toaster/useToaster.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToasterFocusManagement.js +19 -17
- package/lib-commonjs/components/Toaster/useToasterFocusManagement.js.map +1 -1
- package/lib-commonjs/components/Toaster/useToasterStyles.styles.js +7 -3
- package/lib-commonjs/components/Toaster/useToasterStyles.styles.js.map +1 -1
- package/lib-commonjs/contexts/toastContainerContext.js +8 -4
- package/lib-commonjs/contexts/toastContainerContext.js.map +1 -1
- package/lib-commonjs/index.js +93 -35
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/state/constants.js +6 -2
- package/lib-commonjs/state/constants.js.map +1 -1
- package/lib-commonjs/state/index.js +10 -6
- package/lib-commonjs/state/index.js.map +1 -1
- package/lib-commonjs/state/types.js +2 -2
- package/lib-commonjs/state/types.js.map +1 -1
- package/lib-commonjs/state/useToastController.js +9 -6
- package/lib-commonjs/state/useToastController.js.map +1 -1
- package/lib-commonjs/state/useToaster.js +26 -20
- package/lib-commonjs/state/useToaster.js.map +1 -1
- package/lib-commonjs/state/vanilla/createToaster.js +14 -12
- package/lib-commonjs/state/vanilla/createToaster.js.map +1 -1
- package/lib-commonjs/state/vanilla/dismissAllToasts.js +3 -1
- package/lib-commonjs/state/vanilla/dismissAllToasts.js.map +1 -1
- package/lib-commonjs/state/vanilla/dismissToast.js +3 -1
- package/lib-commonjs/state/vanilla/dismissToast.js.map +1 -1
- package/lib-commonjs/state/vanilla/dispatchToast.js +3 -1
- package/lib-commonjs/state/vanilla/dispatchToast.js.map +1 -1
- package/lib-commonjs/state/vanilla/getPositionStyles.js +4 -2
- package/lib-commonjs/state/vanilla/getPositionStyles.js.map +1 -1
- package/lib-commonjs/state/vanilla/index.js +9 -9
- package/lib-commonjs/state/vanilla/index.js.map +1 -1
- package/lib-commonjs/state/vanilla/pauseToast.js +3 -1
- package/lib-commonjs/state/vanilla/pauseToast.js.map +1 -1
- package/lib-commonjs/state/vanilla/playToast.js +3 -1
- package/lib-commonjs/state/vanilla/playToast.js.map +1 -1
- package/lib-commonjs/state/vanilla/updateToast.js +3 -1
- package/lib-commonjs/state/vanilla/updateToast.js.map +1 -1
- package/package.json +14 -14
package/lib-commonjs/index.js
CHANGED
|
@@ -9,40 +9,98 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
useToastController: ()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
12
|
+
useToastController: function() {
|
|
13
|
+
return _state.useToastController;
|
|
14
|
+
},
|
|
15
|
+
ToastTrigger: function() {
|
|
16
|
+
return _ToastTrigger.ToastTrigger;
|
|
17
|
+
},
|
|
18
|
+
useToastTrigger_unstable: function() {
|
|
19
|
+
return _ToastTrigger.useToastTrigger_unstable;
|
|
20
|
+
},
|
|
21
|
+
renderToastTrigger_unstable: function() {
|
|
22
|
+
return _ToastTrigger.renderToastTrigger_unstable;
|
|
23
|
+
},
|
|
24
|
+
Toaster: function() {
|
|
25
|
+
return _Toaster.Toaster;
|
|
26
|
+
},
|
|
27
|
+
useToaster_unstable: function() {
|
|
28
|
+
return _Toaster.useToaster_unstable;
|
|
29
|
+
},
|
|
30
|
+
useToasterStyles_unstable: function() {
|
|
31
|
+
return _Toaster.useToasterStyles_unstable;
|
|
32
|
+
},
|
|
33
|
+
renderToaster_unstable: function() {
|
|
34
|
+
return _Toaster.renderToaster_unstable;
|
|
35
|
+
},
|
|
36
|
+
toasterClassNames: function() {
|
|
37
|
+
return _Toaster.toasterClassNames;
|
|
38
|
+
},
|
|
39
|
+
Toast: function() {
|
|
40
|
+
return _Toast.Toast;
|
|
41
|
+
},
|
|
42
|
+
useToastStyles_unstable: function() {
|
|
43
|
+
return _Toast.useToastStyles_unstable;
|
|
44
|
+
},
|
|
45
|
+
useToast_unstable: function() {
|
|
46
|
+
return _Toast.useToast_unstable;
|
|
47
|
+
},
|
|
48
|
+
renderToast_unstable: function() {
|
|
49
|
+
return _Toast.renderToast_unstable;
|
|
50
|
+
},
|
|
51
|
+
toastClassNames: function() {
|
|
52
|
+
return _Toast.toastClassNames;
|
|
53
|
+
},
|
|
54
|
+
ToastTitle: function() {
|
|
55
|
+
return _ToastTitle.ToastTitle;
|
|
56
|
+
},
|
|
57
|
+
useToastTitleStyles_unstable: function() {
|
|
58
|
+
return _ToastTitle.useToastTitleStyles_unstable;
|
|
59
|
+
},
|
|
60
|
+
useToastTitle_unstable: function() {
|
|
61
|
+
return _ToastTitle.useToastTitle_unstable;
|
|
62
|
+
},
|
|
63
|
+
renderToastTitle_unstable: function() {
|
|
64
|
+
return _ToastTitle.renderToastTitle_unstable;
|
|
65
|
+
},
|
|
66
|
+
toastTitleClassNames: function() {
|
|
67
|
+
return _ToastTitle.toastTitleClassNames;
|
|
68
|
+
},
|
|
69
|
+
ToastBody: function() {
|
|
70
|
+
return _ToastBody.ToastBody;
|
|
71
|
+
},
|
|
72
|
+
useToastBodyStyles_unstable: function() {
|
|
73
|
+
return _ToastBody.useToastBodyStyles_unstable;
|
|
74
|
+
},
|
|
75
|
+
useToastBody_unstable: function() {
|
|
76
|
+
return _ToastBody.useToastBody_unstable;
|
|
77
|
+
},
|
|
78
|
+
renderToastBody_unstable: function() {
|
|
79
|
+
return _ToastBody.renderToastBody_unstable;
|
|
80
|
+
},
|
|
81
|
+
toastBodyClassNames: function() {
|
|
82
|
+
return _ToastBody.toastBodyClassNames;
|
|
83
|
+
},
|
|
84
|
+
ToastFooter: function() {
|
|
85
|
+
return _ToastFooter.ToastFooter;
|
|
86
|
+
},
|
|
87
|
+
useToastFooterStyles_unstable: function() {
|
|
88
|
+
return _ToastFooter.useToastFooterStyles_unstable;
|
|
89
|
+
},
|
|
90
|
+
useToastFooter_unstable: function() {
|
|
91
|
+
return _ToastFooter.useToastFooter_unstable;
|
|
92
|
+
},
|
|
93
|
+
renderToastFooter_unstable: function() {
|
|
94
|
+
return _ToastFooter.renderToastFooter_unstable;
|
|
95
|
+
},
|
|
96
|
+
toastFooterClassNames: function() {
|
|
97
|
+
return _ToastFooter.toastFooterClassNames;
|
|
98
|
+
}
|
|
41
99
|
});
|
|
42
100
|
const _state = require("./state");
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
101
|
+
const _ToastTrigger = require("./ToastTrigger");
|
|
102
|
+
const _Toaster = require("./Toaster");
|
|
103
|
+
const _Toast = require("./Toast");
|
|
104
|
+
const _ToastTitle = require("./ToastTitle");
|
|
105
|
+
const _ToastBody = require("./ToastBody");
|
|
106
|
+
const _ToastFooter = require("./ToastFooter");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export { useToastController } from './state';\nexport { ToastTrigger, useToastTrigger_unstable, renderToastTrigger_unstable } from './ToastTrigger';\nexport { Toaster, useToaster_unstable, useToasterStyles_unstable, renderToaster_unstable, toasterClassNames } from './Toaster';\nexport { Toast, useToastStyles_unstable, useToast_unstable, renderToast_unstable, toastClassNames } from './Toast';\nexport { ToastTitle, useToastTitleStyles_unstable, useToastTitle_unstable, renderToastTitle_unstable, toastTitleClassNames } from './ToastTitle';\nexport { ToastBody, useToastBodyStyles_unstable, useToastBody_unstable, renderToastBody_unstable, toastBodyClassNames } from './ToastBody';\nexport { ToastFooter, useToastFooterStyles_unstable, useToastFooter_unstable, renderToastFooter_unstable, toastFooterClassNames } from './ToastFooter';\n"],"names":["useToastController","ToastTrigger","useToastTrigger_unstable","renderToastTrigger_unstable","Toaster","useToaster_unstable","useToasterStyles_unstable","renderToaster_unstable","toasterClassNames","Toast","useToastStyles_unstable","useToast_unstable","renderToast_unstable","toastClassNames","ToastTitle","useToastTitleStyles_unstable","useToastTitle_unstable","renderToastTitle_unstable","toastTitleClassNames","ToastBody","useToastBodyStyles_unstable","useToastBody_unstable","renderToastBody_unstable","toastBodyClassNames","ToastFooter","useToastFooterStyles_unstable","useToastFooter_unstable","renderToastFooter_unstable","toastFooterClassNames"],"mappings":";;;;;;;;;;;IAASA,kBAAkB,
|
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export { useToastController } from './state';\nexport { ToastTrigger, useToastTrigger_unstable, renderToastTrigger_unstable } from './ToastTrigger';\nexport { Toaster, useToaster_unstable, useToasterStyles_unstable, renderToaster_unstable, toasterClassNames } from './Toaster';\nexport { Toast, useToastStyles_unstable, useToast_unstable, renderToast_unstable, toastClassNames } from './Toast';\nexport { ToastTitle, useToastTitleStyles_unstable, useToastTitle_unstable, renderToastTitle_unstable, toastTitleClassNames } from './ToastTitle';\nexport { ToastBody, useToastBodyStyles_unstable, useToastBody_unstable, renderToastBody_unstable, toastBodyClassNames } from './ToastBody';\nexport { ToastFooter, useToastFooterStyles_unstable, useToastFooter_unstable, renderToastFooter_unstable, toastFooterClassNames } from './ToastFooter';\n"],"names":["useToastController","ToastTrigger","useToastTrigger_unstable","renderToastTrigger_unstable","Toaster","useToaster_unstable","useToasterStyles_unstable","renderToaster_unstable","toasterClassNames","Toast","useToastStyles_unstable","useToast_unstable","renderToast_unstable","toastClassNames","ToastTitle","useToastTitleStyles_unstable","useToastTitle_unstable","renderToastTitle_unstable","toastTitleClassNames","ToastBody","useToastBodyStyles_unstable","useToastBody_unstable","renderToastBody_unstable","toastBodyClassNames","ToastFooter","useToastFooterStyles_unstable","useToastFooter_unstable","renderToastFooter_unstable","toastFooterClassNames"],"mappings":";;;;;;;;;;;IAASA,kBAAkB;eAAlBA,yBAAkB;;IAClBC,YAAY;eAAZA,0BAAY;;IAAEC,wBAAwB;eAAxBA,sCAAwB;;IAAEC,2BAA2B;eAA3BA,yCAA2B;;IACnEC,OAAO;eAAPA,gBAAO;;IAAEC,mBAAmB;eAAnBA,4BAAmB;;IAAEC,yBAAyB;eAAzBA,kCAAyB;;IAAEC,sBAAsB;eAAtBA,+BAAsB;;IAAEC,iBAAiB;eAAjBA,0BAAiB;;IAClGC,KAAK;eAALA,YAAK;;IAAEC,uBAAuB;eAAvBA,8BAAuB;;IAAEC,iBAAiB;eAAjBA,wBAAiB;;IAAEC,oBAAoB;eAApBA,2BAAoB;;IAAEC,eAAe;eAAfA,sBAAe;;IACxFC,UAAU;eAAVA,sBAAU;;IAAEC,4BAA4B;eAA5BA,wCAA4B;;IAAEC,sBAAsB;eAAtBA,kCAAsB;;IAAEC,yBAAyB;eAAzBA,qCAAyB;;IAAEC,oBAAoB;eAApBA,gCAAoB;;IACjHC,SAAS;eAATA,oBAAS;;IAAEC,2BAA2B;eAA3BA,sCAA2B;;IAAEC,qBAAqB;eAArBA,gCAAqB;;IAAEC,wBAAwB;eAAxBA,mCAAwB;;IAAEC,mBAAmB;eAAnBA,8BAAmB;;IAC5GC,WAAW;eAAXA,wBAAW;;IAAEC,6BAA6B;eAA7BA,0CAA6B;;IAAEC,uBAAuB;eAAvBA,oCAAuB;;IAAEC,0BAA0B;eAA1BA,uCAA0B;;IAAEC,qBAAqB;eAArBA,kCAAqB;;;uBAN5F;8BACiD;yBAC+B;uBACV;4BACyB;2BACL;6BACU"}
|
|
@@ -9,8 +9,12 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
EVENTS: ()
|
|
13
|
-
|
|
12
|
+
EVENTS: function() {
|
|
13
|
+
return EVENTS;
|
|
14
|
+
},
|
|
15
|
+
TOAST_POSITIONS: function() {
|
|
16
|
+
return TOAST_POSITIONS;
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
19
|
const EVENTS = {
|
|
16
20
|
show: 'fui-toast-show',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["constants.js"],"sourcesContent":["export const EVENTS = {\n show: 'fui-toast-show',\n dismiss: 'fui-toast-dismiss',\n dismissAll: 'fui-toast-dismiss-all',\n update: 'fui-toast-update',\n pause: 'fui-toast-pause',\n play: 'fui-toast-play'\n};\nexport const TOAST_POSITIONS = {\n bottomEnd: 'bottom-end',\n bottomStart: 'bottom-start',\n topEnd: 'top-end',\n topStart: 'top-start'\n};\n"],"names":["EVENTS","TOAST_POSITIONS","show","dismiss","dismissAll","update","pause","play","bottomEnd","bottomStart","topEnd","topStart"],"mappings":";;;;;;;;;;;IAAaA,MAAM
|
|
1
|
+
{"version":3,"sources":["constants.js"],"sourcesContent":["export const EVENTS = {\n show: 'fui-toast-show',\n dismiss: 'fui-toast-dismiss',\n dismissAll: 'fui-toast-dismiss-all',\n update: 'fui-toast-update',\n pause: 'fui-toast-pause',\n play: 'fui-toast-play'\n};\nexport const TOAST_POSITIONS = {\n bottomEnd: 'bottom-end',\n bottomStart: 'bottom-start',\n topEnd: 'top-end',\n topStart: 'top-start'\n};\n"],"names":["EVENTS","TOAST_POSITIONS","show","dismiss","dismissAll","update","pause","play","bottomEnd","bottomStart","topEnd","topStart"],"mappings":";;;;;;;;;;;IAAaA,MAAM;eAANA;;IAQAC,eAAe;eAAfA;;;AARN,MAAMD,SAAS;IAClBE,MAAM;IACNC,SAAS;IACTC,YAAY;IACZC,QAAQ;IACRC,OAAO;IACPC,MAAM;AACV;AACO,MAAMN,kBAAkB;IAC3BO,WAAW;IACXC,aAAa;IACbC,QAAQ;IACRC,UAAU;AACd"}
|
|
@@ -9,12 +9,16 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
getPositionStyles: ()
|
|
13
|
-
|
|
12
|
+
getPositionStyles: function() {
|
|
13
|
+
return _vanilla.getPositionStyles;
|
|
14
|
+
},
|
|
15
|
+
TOAST_POSITIONS: function() {
|
|
16
|
+
return _constants.TOAST_POSITIONS;
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
20
|
+
_export_star._(require("./types"), exports);
|
|
21
|
+
_export_star._(require("./useToaster"), exports);
|
|
22
|
+
_export_star._(require("./useToastController"), exports);
|
|
19
23
|
const _vanilla = require("./vanilla");
|
|
20
24
|
const _constants = require("./constants");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './types';\nexport * from './useToaster';\nexport * from './useToastController';\nexport { getPositionStyles } from './vanilla';\nexport { TOAST_POSITIONS } from './constants';\n"],"names":["getPositionStyles","TOAST_POSITIONS"],"mappings":";;;;;;;;;;;IAGSA,iBAAiB,
|
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './types';\nexport * from './useToaster';\nexport * from './useToastController';\nexport { getPositionStyles } from './vanilla';\nexport { TOAST_POSITIONS } from './constants';\n"],"names":["getPositionStyles","TOAST_POSITIONS"],"mappings":";;;;;;;;;;;IAGSA,iBAAiB;eAAjBA,0BAAiB;;IACjBC,eAAe;eAAfA,0BAAe;;;;uBAJV;uBACA;uBACA;yBACoB;2BACF"}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
const _react = /*#__PURE__*/
|
|
5
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
6
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;iEAAuB"}
|
|
@@ -4,15 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "useToastController", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return useToastController;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
10
|
-
const _react = /*#__PURE__*/
|
|
11
|
-
const
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
12
14
|
const _vanilla = require("./vanilla");
|
|
13
15
|
const noop = ()=>undefined;
|
|
14
16
|
function useToastController(toasterId) {
|
|
15
|
-
const { targetDocument
|
|
17
|
+
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
16
18
|
return _react.useMemo(()=>{
|
|
17
19
|
if (!targetDocument) {
|
|
18
20
|
return {
|
|
@@ -26,11 +28,12 @@ function useToastController(toasterId) {
|
|
|
26
28
|
}
|
|
27
29
|
return {
|
|
28
30
|
dispatchToast: (content, options)=>{
|
|
31
|
+
var _options;
|
|
29
32
|
(0, _vanilla.dispatchToast)(content, {
|
|
30
33
|
...options,
|
|
31
34
|
toasterId,
|
|
32
35
|
data: {
|
|
33
|
-
root: options === null ||
|
|
36
|
+
root: (_options = options) === null || _options === void 0 ? void 0 : _options.root
|
|
34
37
|
}
|
|
35
38
|
}, targetDocument);
|
|
36
39
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToastController.js"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { dispatchToast as dispatchToastVanilla, dismissToast as dismissToastVanilla, dismissAllToasts as dismissAllToastsVanilla, updateToast as updateToastVanilla, playToast as playToastVanilla, pauseToast as pauseToastVanilla } from './vanilla';\nconst noop = ()=>undefined;\n/**\n * @param toasterId - If an id is provided all imperative methods control that specific toaster\n * @returns Imperative methods to control toasts\n */ export function useToastController(toasterId) {\n const { targetDocument
|
|
1
|
+
{"version":3,"sources":["useToastController.js"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { dispatchToast as dispatchToastVanilla, dismissToast as dismissToastVanilla, dismissAllToasts as dismissAllToastsVanilla, updateToast as updateToastVanilla, playToast as playToastVanilla, pauseToast as pauseToastVanilla } from './vanilla';\nconst noop = ()=>undefined;\n/**\n * @param toasterId - If an id is provided all imperative methods control that specific toaster\n * @returns Imperative methods to control toasts\n */ export function useToastController(toasterId) {\n const { targetDocument } = useFluent();\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 return {\n dispatchToast: (content, options)=>{\n var _options;\n dispatchToastVanilla(content, {\n ...options,\n toasterId,\n data: {\n root: (_options = options) === null || _options === void 0 ? void 0 : _options.root\n }\n }, targetDocument);\n },\n dismissToast: (toastId)=>{\n dismissToastVanilla(toastId, toasterId, targetDocument);\n },\n dismissAllToasts: ()=>{\n dismissAllToastsVanilla(toasterId, targetDocument);\n },\n updateToast: (options)=>{\n updateToastVanilla({\n ...options,\n data: {\n root: options.root\n },\n toasterId\n }, targetDocument);\n },\n pauseToast: (toastId)=>{\n pauseToastVanilla(toastId, toasterId, targetDocument);\n },\n playToast: (toastId)=>{\n playToastVanilla(toastId, toasterId, targetDocument);\n }\n };\n }, [\n targetDocument,\n toasterId\n ]);\n}\n"],"names":["useToastController","noop","undefined","toasterId","targetDocument","useFluent","React","useMemo","dispatchToast","dismissToast","dismissAllToasts","updateToast","pauseToast","playToast","content","options","_options","dispatchToastVanilla","data","root","toastId","dismissToastVanilla","dismissAllToastsVanilla","updateToastVanilla","pauseToastVanilla","playToastVanilla"],"mappings":";;;;+BAOoBA;;;eAAAA;;;;iEAPG;qCACyB;yBAC2L;AAC3O,MAAMC,OAAO,IAAIC;AAIN,SAASF,mBAAmBG,SAAS;IAC5C,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAS;IACpC,OAAOC,OAAMC,OAAO,CAAC;QACjB,IAAI,CAACH,gBAAgB;YACjB,OAAO;gBACHI,eAAeP;gBACfQ,cAAcR;gBACdS,kBAAkBT;gBAClBU,aAAaV;gBACbW,YAAYX;gBACZY,WAAWZ;YACf;QACJ;QACA,OAAO;YACHO,eAAe,CAACM,SAASC;gBACrB,IAAIC;gBACJC,IAAAA,sBAAoB,EAACH,SAAS;oBAC1B,GAAGC,OAAO;oBACVZ;oBACAe,MAAM;wBACFC,MAAM,AAACH,CAAAA,WAAWD,OAAM,MAAO,QAAQC,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASG,IAAI;oBACvF;gBACJ,GAAGf;YACP;YACAK,cAAc,CAACW;gBACXC,IAAAA,qBAAmB,EAACD,SAASjB,WAAWC;YAC5C;YACAM,kBAAkB;gBACdY,IAAAA,yBAAuB,EAACnB,WAAWC;YACvC;YACAO,aAAa,CAACI;gBACVQ,IAAAA,oBAAkB,EAAC;oBACf,GAAGR,OAAO;oBACVG,MAAM;wBACFC,MAAMJ,QAAQI,IAAI;oBACtB;oBACAhB;gBACJ,GAAGC;YACP;YACAQ,YAAY,CAACQ;gBACTI,IAAAA,mBAAiB,EAACJ,SAASjB,WAAWC;YAC1C;YACAS,WAAW,CAACO;gBACRK,IAAAA,kBAAgB,EAACL,SAASjB,WAAWC;YACzC;QACJ;IACJ,GAAG;QACCA;QACAD;KACH;AACL"}
|
|
@@ -4,49 +4,53 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "useToaster", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return useToaster;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
10
|
-
const _react = /*#__PURE__*/
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
14
|
+
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
13
15
|
const _vanilla = require("./vanilla");
|
|
14
16
|
const _constants = require("./constants");
|
|
15
17
|
function useToaster(options = {}) {
|
|
16
|
-
const forceUpdate = (0,
|
|
17
|
-
const { toasterId: userToasterId
|
|
18
|
+
const forceUpdate = (0, _reactutilities.useForceUpdate)();
|
|
19
|
+
const { toasterId: userToasterId, shortcuts } = options;
|
|
18
20
|
// Currently the toaster options can never be changed at runtime
|
|
19
21
|
const [toaster] = _react.useState(()=>(0, _vanilla.createToaster)(options));
|
|
20
|
-
const { targetDocument
|
|
22
|
+
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
21
23
|
const lastActiveElementRef = _react.useRef(null);
|
|
22
|
-
const isCorrectToaster = (0,
|
|
24
|
+
const isCorrectToaster = (0, _reactutilities.useEventCallback)((toasterId)=>{
|
|
23
25
|
return toasterId === userToasterId;
|
|
24
26
|
});
|
|
25
|
-
const isFocusShortcut = (0,
|
|
26
|
-
|
|
27
|
+
const isFocusShortcut = (0, _reactutilities.useEventCallback)((e)=>{
|
|
28
|
+
var _shortcuts;
|
|
29
|
+
if ((_shortcuts = shortcuts) === null || _shortcuts === void 0 ? void 0 : _shortcuts.focus) {
|
|
27
30
|
return shortcuts.focus(e);
|
|
28
31
|
}
|
|
29
32
|
});
|
|
30
33
|
const pauseAllToasts = _react.useCallback(()=>{
|
|
31
34
|
toaster.visibleToasts.forEach((toastId)=>{
|
|
32
|
-
var _toast_imperativeRef_current;
|
|
35
|
+
var _toast_imperativeRef_current, _toast;
|
|
33
36
|
const toast = toaster.toasts.get(toastId);
|
|
34
|
-
(
|
|
37
|
+
(_toast = toast) === null || _toast === void 0 ? void 0 : (_toast_imperativeRef_current = _toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.pause();
|
|
35
38
|
});
|
|
36
39
|
}, [
|
|
37
40
|
toaster
|
|
38
41
|
]);
|
|
39
42
|
const playAllToasts = _react.useCallback(()=>{
|
|
40
43
|
toaster.visibleToasts.forEach((toastId)=>{
|
|
41
|
-
var _toast_imperativeRef_current;
|
|
44
|
+
var _toast_imperativeRef_current, _toast;
|
|
42
45
|
const toast = toaster.toasts.get(toastId);
|
|
43
|
-
(
|
|
46
|
+
(_toast = toast) === null || _toast === void 0 ? void 0 : (_toast_imperativeRef_current = _toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.play();
|
|
44
47
|
});
|
|
45
48
|
}, [
|
|
46
49
|
toaster
|
|
47
50
|
]);
|
|
48
51
|
const getMostRecentVisibleToast = _react.useCallback(()=>{
|
|
49
52
|
return Array.from(toaster.visibleToasts).reduce((cur, next)=>{
|
|
53
|
+
var _toast;
|
|
50
54
|
const toast = toaster.toasts.get(next);
|
|
51
55
|
if (!toast) {
|
|
52
56
|
return cur;
|
|
@@ -54,7 +58,7 @@ function useToaster(options = {}) {
|
|
|
54
58
|
if (!cur) {
|
|
55
59
|
return toast;
|
|
56
60
|
}
|
|
57
|
-
if (cur.order < (toast === null ||
|
|
61
|
+
if (cur.order < ((_toast = toast) === null || _toast === void 0 ? void 0 : _toast.order)) {
|
|
58
62
|
return toast;
|
|
59
63
|
}
|
|
60
64
|
return cur;
|
|
@@ -63,8 +67,9 @@ function useToaster(options = {}) {
|
|
|
63
67
|
toaster
|
|
64
68
|
]);
|
|
65
69
|
const tryRestoreFocus = _react.useCallback(()=>{
|
|
70
|
+
var _mostRecentToast;
|
|
66
71
|
const mostRecentToast = getMostRecentVisibleToast();
|
|
67
|
-
if (mostRecentToast === null ||
|
|
72
|
+
if ((_mostRecentToast = mostRecentToast) === null || _mostRecentToast === void 0 ? void 0 : _mostRecentToast.imperativeRef.current) {
|
|
68
73
|
mostRecentToast.imperativeRef.current.focus();
|
|
69
74
|
} else {
|
|
70
75
|
var _lastActiveElementRef_current;
|
|
@@ -76,8 +81,9 @@ function useToaster(options = {}) {
|
|
|
76
81
|
]);
|
|
77
82
|
const closeAllToasts = _react.useCallback(()=>{
|
|
78
83
|
toaster.visibleToasts.forEach((toastId)=>{
|
|
84
|
+
var _toast;
|
|
79
85
|
const toast = toaster.toasts.get(toastId);
|
|
80
|
-
toast === null ||
|
|
86
|
+
(_toast = toast) === null || _toast === void 0 ? void 0 : _toast.close();
|
|
81
87
|
});
|
|
82
88
|
tryRestoreFocus();
|
|
83
89
|
}, [
|
|
@@ -137,7 +143,7 @@ function useToaster(options = {}) {
|
|
|
137
143
|
const mostRecentToast = getMostRecentVisibleToast();
|
|
138
144
|
if (mostRecentToast) {
|
|
139
145
|
var _mostRecentToast_imperativeRef_current;
|
|
140
|
-
lastActiveElementRef.current = (0,
|
|
146
|
+
lastActiveElementRef.current = (0, _reactutilities.isHTMLElement)(targetDocument.activeElement) ? targetDocument.activeElement : null;
|
|
141
147
|
(_mostRecentToast_imperativeRef_current = mostRecentToast.imperativeRef.current) === null || _mostRecentToast_imperativeRef_current === void 0 ? void 0 : _mostRecentToast_imperativeRef_current.focus();
|
|
142
148
|
}
|
|
143
149
|
}
|
|
@@ -168,7 +174,7 @@ function useToaster(options = {}) {
|
|
|
168
174
|
const toRender = new Map();
|
|
169
175
|
const toasts = Array.from(toaster.toasts.values());
|
|
170
176
|
toasts.forEach((toast)=>{
|
|
171
|
-
const { position
|
|
177
|
+
const { position } = toast;
|
|
172
178
|
toRender.has(position) || toRender.set(position, []);
|
|
173
179
|
if (position.startsWith('bottom')) {
|
|
174
180
|
toRender.get(position).push(toast);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useToaster.js"],"sourcesContent":["import * as React from 'react';\nimport { isHTMLElement, useEventCallback, useForceUpdate } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { createToaster } from './vanilla';\nimport { EVENTS } from './constants';\nexport function useToaster(options = {}) {\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 const lastActiveElementRef = React.useRef(null);\n const isCorrectToaster = useEventCallback((toasterId)=>{\n return toasterId === userToasterId;\n });\n const isFocusShortcut = useEventCallback((e)=>{\n if (shortcuts === null || shortcuts === void 0 ? void 0 : shortcuts.focus) {\n return shortcuts.focus(e);\n }\n });\n const pauseAllToasts = React.useCallback(()=>{\n toaster.visibleToasts.forEach((toastId)=>{\n var _toast_imperativeRef_current;\n const toast = toaster.toasts.get(toastId);\n (_toast_imperativeRef_current = toast === null || toast === void 0 ? void 0 : toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.pause();\n });\n }, [\n toaster\n ]);\n const playAllToasts = React.useCallback(()=>{\n toaster.visibleToasts.forEach((toastId)=>{\n var _toast_imperativeRef_current;\n const toast = toaster.toasts.get(toastId);\n (_toast_imperativeRef_current = toast === null || toast === void 0 ? void 0 : toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.play();\n });\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 if (!cur) {\n return toast;\n }\n if (cur.order < (toast === null || toast === void 0 ? void 0 : toast.order)) {\n return toast;\n }\n return cur;\n }, undefined);\n }, [\n toaster\n ]);\n const tryRestoreFocus = React.useCallback(()=>{\n const mostRecentToast = getMostRecentVisibleToast();\n if (mostRecentToast === null || mostRecentToast === void 0 ? void 0 : mostRecentToast.imperativeRef.current) {\n mostRecentToast.imperativeRef.current.focus();\n } else {\n var _lastActiveElementRef_current;\n (_lastActiveElementRef_current = lastActiveElementRef.current) === null || _lastActiveElementRef_current === void 0 ? void 0 : _lastActiveElementRef_current.focus();\n lastActiveElementRef.current = null;\n }\n }, [\n getMostRecentVisibleToast\n ]);\n const closeAllToasts = React.useCallback(()=>{\n toaster.visibleToasts.forEach((toastId)=>{\n const toast = toaster.toasts.get(toastId);\n toast === null || toast === void 0 ? void 0 : toast.close();\n });\n tryRestoreFocus();\n }, [\n toaster,\n tryRestoreFocus\n ]);\n React.useEffect(()=>{\n if (!targetDocument) {\n return;\n }\n const addToastListener = (eventType, callback)=>{\n const listener = (e)=>{\n if (!isCorrectToaster(e.detail.toasterId)) {\n return;\n }\n callback(e);\n forceUpdate();\n };\n targetDocument.addEventListener(eventType, listener);\n return ()=>targetDocument.removeEventListener(eventType, listener);\n };\n const buildToast = (e)=>{\n toaster.buildToast(e.detail, forceUpdate);\n };\n const dismissToast = (e)=>{\n toaster.dismissToast(e.detail.toastId);\n };\n const updateToast = (e)=>{\n toaster.updateToast(e.detail);\n };\n const dismissAllToasts = (e)=>{\n toaster.dismissAllToasts();\n };\n const pauseToast = (e)=>{\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n var _toast_imperativeRef_current;\n (_toast_imperativeRef_current = toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.pause();\n }\n };\n const playToast = (e)=>{\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n var _toast_imperativeRef_current;\n (_toast_imperativeRef_current = toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.play();\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 const focusShortcutListener = (e)=>{\n if (isFocusShortcut(e)) {\n pauseAllToasts();\n const mostRecentToast = getMostRecentVisibleToast();\n if (mostRecentToast) {\n var _mostRecentToast_imperativeRef_current;\n lastActiveElementRef.current = isHTMLElement(targetDocument.activeElement) ? targetDocument.activeElement : null;\n (_mostRecentToast_imperativeRef_current = mostRecentToast.imperativeRef.current) === null || _mostRecentToast_imperativeRef_current === void 0 ? void 0 : _mostRecentToast_imperativeRef_current.focus();\n }\n }\n };\n targetDocument.addEventListener('keydown', focusShortcutListener);\n return ()=>{\n cleanupBuildListener();\n cleanupDismissAllListener();\n cleanupUpdateListener();\n cleanupDismissListener();\n cleanupPauseListener();\n cleanupPlayListener();\n targetDocument.removeEventListener('keydown', focusShortcutListener);\n };\n }, [\n toaster,\n forceUpdate,\n targetDocument,\n isCorrectToaster,\n pauseAllToasts,\n getMostRecentVisibleToast,\n isFocusShortcut\n ]);\n const toastsToRender = (()=>{\n if (!toaster) {\n return new Map();\n }\n const toRender = new Map();\n const toasts = Array.from(toaster.toasts.values());\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 return toRender;\n })();\n return {\n isToastVisible: toaster.isToastVisible,\n toastsToRender,\n pauseAllToasts,\n playAllToasts,\n tryRestoreFocus,\n closeAllToasts\n };\n}\n"],"names":["useToaster","options","forceUpdate","useForceUpdate","toasterId","userToasterId","shortcuts","toaster","React","useState","createToaster","targetDocument","useFluent","lastActiveElementRef","useRef","isCorrectToaster","useEventCallback","isFocusShortcut","e","focus","pauseAllToasts","useCallback","visibleToasts","forEach","toastId","_toast_imperativeRef_current","toast","toasts","get","imperativeRef","current","pause","playAllToasts","play","getMostRecentVisibleToast","Array","from","reduce","cur","next","order","undefined","tryRestoreFocus","mostRecentToast","_lastActiveElementRef_current","closeAllToasts","close","useEffect","addToastListener","eventType","callback","listener","detail","addEventListener","removeEventListener","buildToast","dismissToast","updateToast","dismissAllToasts","pauseToast","playToast","cleanupBuildListener","EVENTS","show","cleanupUpdateListener","update","cleanupDismissListener","dismiss","cleanupDismissAllListener","dismissAll","cleanupPauseListener","cleanupPlayListener","focusShortcutListener","_mostRecentToast_imperativeRef_current","isHTMLElement","activeElement","toastsToRender","Map","toRender","values","position","has","set","startsWith","push","unshift","isToastVisible"],"mappings":";;;;+BAKgBA;;aAAAA;;;6DALO;gCACyC;qCAChB;yBAClB;2BACP;AAChB,SAASA,WAAWC,UAAU,CAAC,CAAC,EAAE;IACrC,MAAMC,cAAcC,IAAAA,8BAAc;IAClC,MAAM,EAAEC,WAAWC,cAAa,EAAGC,UAAS,EAAG,GAAGL;IAClD,gEAAgE;IAChE,MAAM,CAACM,QAAQ,GAAGC,OAAMC,QAAQ,CAAC,IAAIC,IAAAA,sBAAa,EAACT;IACnD,MAAM,EAAEU,eAAc,EAAG,GAA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;gBAC/BL,SAASlD,GAAG,CAACoD,UAAUI,IAAI,CAAC1D;YAChC,OAAO;gBACHoD,SAASlD,GAAG,CAACoD,UAAUK,OAAO,CAAC3D;YACnC,CAAC;QACL;QACA,OAAOoD;IACX,CAAA;IACA,OAAO;QACHQ,gBAAgB/E,QAAQ+E,cAAc;QACtCV;QACAxD;QACAY;QACAU;QACAG;IACJ;AACJ"}
|
|
1
|
+
{"version":3,"sources":["useToaster.js"],"sourcesContent":["import * as React from 'react';\nimport { isHTMLElement, useEventCallback, useForceUpdate } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { createToaster } from './vanilla';\nimport { EVENTS } from './constants';\nexport function useToaster(options = {}) {\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 const lastActiveElementRef = React.useRef(null);\n const isCorrectToaster = useEventCallback((toasterId)=>{\n return toasterId === userToasterId;\n });\n const isFocusShortcut = useEventCallback((e)=>{\n var _shortcuts;\n if ((_shortcuts = shortcuts) === null || _shortcuts === void 0 ? void 0 : _shortcuts.focus) {\n return shortcuts.focus(e);\n }\n });\n const pauseAllToasts = React.useCallback(()=>{\n toaster.visibleToasts.forEach((toastId)=>{\n var _toast_imperativeRef_current, _toast;\n const toast = toaster.toasts.get(toastId);\n (_toast = toast) === null || _toast === void 0 ? void 0 : (_toast_imperativeRef_current = _toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.pause();\n });\n }, [\n toaster\n ]);\n const playAllToasts = React.useCallback(()=>{\n toaster.visibleToasts.forEach((toastId)=>{\n var _toast_imperativeRef_current, _toast;\n const toast = toaster.toasts.get(toastId);\n (_toast = toast) === null || _toast === void 0 ? void 0 : (_toast_imperativeRef_current = _toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.play();\n });\n }, [\n toaster\n ]);\n const getMostRecentVisibleToast = React.useCallback(()=>{\n return Array.from(toaster.visibleToasts).reduce((cur, next)=>{\n var _toast;\n const toast = toaster.toasts.get(next);\n if (!toast) {\n return cur;\n }\n if (!cur) {\n return toast;\n }\n if (cur.order < ((_toast = toast) === null || _toast === void 0 ? void 0 : _toast.order)) {\n return toast;\n }\n return cur;\n }, undefined);\n }, [\n toaster\n ]);\n const tryRestoreFocus = React.useCallback(()=>{\n var _mostRecentToast;\n const mostRecentToast = getMostRecentVisibleToast();\n if ((_mostRecentToast = mostRecentToast) === null || _mostRecentToast === void 0 ? void 0 : _mostRecentToast.imperativeRef.current) {\n mostRecentToast.imperativeRef.current.focus();\n } else {\n var _lastActiveElementRef_current;\n (_lastActiveElementRef_current = lastActiveElementRef.current) === null || _lastActiveElementRef_current === void 0 ? void 0 : _lastActiveElementRef_current.focus();\n lastActiveElementRef.current = null;\n }\n }, [\n getMostRecentVisibleToast\n ]);\n const closeAllToasts = React.useCallback(()=>{\n toaster.visibleToasts.forEach((toastId)=>{\n var _toast;\n const toast = toaster.toasts.get(toastId);\n (_toast = toast) === null || _toast === void 0 ? void 0 : _toast.close();\n });\n tryRestoreFocus();\n }, [\n toaster,\n tryRestoreFocus\n ]);\n React.useEffect(()=>{\n if (!targetDocument) {\n return;\n }\n const addToastListener = (eventType, callback)=>{\n const listener = (e)=>{\n if (!isCorrectToaster(e.detail.toasterId)) {\n return;\n }\n callback(e);\n forceUpdate();\n };\n targetDocument.addEventListener(eventType, listener);\n return ()=>targetDocument.removeEventListener(eventType, listener);\n };\n const buildToast = (e)=>{\n toaster.buildToast(e.detail, forceUpdate);\n };\n const dismissToast = (e)=>{\n toaster.dismissToast(e.detail.toastId);\n };\n const updateToast = (e)=>{\n toaster.updateToast(e.detail);\n };\n const dismissAllToasts = (e)=>{\n toaster.dismissAllToasts();\n };\n const pauseToast = (e)=>{\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n var _toast_imperativeRef_current;\n (_toast_imperativeRef_current = toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.pause();\n }\n };\n const playToast = (e)=>{\n const toast = toaster.toasts.get(e.detail.toastId);\n if (toast) {\n var _toast_imperativeRef_current;\n (_toast_imperativeRef_current = toast.imperativeRef.current) === null || _toast_imperativeRef_current === void 0 ? void 0 : _toast_imperativeRef_current.play();\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 const focusShortcutListener = (e)=>{\n if (isFocusShortcut(e)) {\n pauseAllToasts();\n const mostRecentToast = getMostRecentVisibleToast();\n if (mostRecentToast) {\n var _mostRecentToast_imperativeRef_current;\n lastActiveElementRef.current = isHTMLElement(targetDocument.activeElement) ? targetDocument.activeElement : null;\n (_mostRecentToast_imperativeRef_current = mostRecentToast.imperativeRef.current) === null || _mostRecentToast_imperativeRef_current === void 0 ? void 0 : _mostRecentToast_imperativeRef_current.focus();\n }\n }\n };\n targetDocument.addEventListener('keydown', focusShortcutListener);\n return ()=>{\n cleanupBuildListener();\n cleanupDismissAllListener();\n cleanupUpdateListener();\n cleanupDismissListener();\n cleanupPauseListener();\n cleanupPlayListener();\n targetDocument.removeEventListener('keydown', focusShortcutListener);\n };\n }, [\n toaster,\n forceUpdate,\n targetDocument,\n isCorrectToaster,\n pauseAllToasts,\n getMostRecentVisibleToast,\n isFocusShortcut\n ]);\n const toastsToRender = (()=>{\n if (!toaster) {\n return new Map();\n }\n const toRender = new Map();\n const toasts = Array.from(toaster.toasts.values());\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 return toRender;\n })();\n return {\n isToastVisible: toaster.isToastVisible,\n toastsToRender,\n pauseAllToasts,\n playAllToasts,\n tryRestoreFocus,\n closeAllToasts\n };\n}\n"],"names":["useToaster","options","forceUpdate","useForceUpdate","toasterId","userToasterId","shortcuts","toaster","React","useState","createToaster","targetDocument","useFluent","lastActiveElementRef","useRef","isCorrectToaster","useEventCallback","isFocusShortcut","e","_shortcuts","focus","pauseAllToasts","useCallback","visibleToasts","forEach","toastId","_toast_imperativeRef_current","_toast","toast","toasts","get","imperativeRef","current","pause","playAllToasts","play","getMostRecentVisibleToast","Array","from","reduce","cur","next","order","undefined","tryRestoreFocus","_mostRecentToast","mostRecentToast","_lastActiveElementRef_current","closeAllToasts","close","useEffect","addToastListener","eventType","callback","listener","detail","addEventListener","removeEventListener","buildToast","dismissToast","updateToast","dismissAllToasts","pauseToast","playToast","cleanupBuildListener","EVENTS","show","cleanupUpdateListener","update","cleanupDismissListener","dismiss","cleanupDismissAllListener","dismissAll","cleanupPauseListener","cleanupPlayListener","focusShortcutListener","_mostRecentToast_imperativeRef_current","isHTMLElement","activeElement","toastsToRender","Map","toRender","values","position","has","set","startsWith","push","unshift","isToastVisible"],"mappings":";;;;+BAKgBA;;;eAAAA;;;;iEALO;gCACyC;qCAChB;yBAClB;2BACP;AAChB,SAASA,WAAWC,UAAU,CAAC,CAAC;IACnC,MAAMC,cAAcC,IAAAA,8BAAc;IAClC,MAAM,EAAEC,WAAWC,aAAa,EAAEC,SAAS,EAAE,GAAGL;IAChD,gEAAgE;IAChE,MAAM,CAACM,QAAQ,GAAGC,OAAMC,QAAQ,CAAC,IAAIC,IAAAA,sBAAa,EAACT;IACnD,MAAM,EAAEU,cAAc,EAAE,GAAGC,IAAAA,uCAAS;IACpC,MAAMC,uBAAuBL,OAAMM,MAAM,CAAC;IAC1C,MAAMC,mBAAmBC,IAAAA,gC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QACAI;IACJ;AACJ"}
|
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "createToaster", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return createToaster;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
10
|
-
const _react = /*#__PURE__*/
|
|
11
|
-
const
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
12
14
|
function assignDefined(a, b) {
|
|
13
15
|
// This cast is required, as Object.entries will return string as key which is not indexable
|
|
14
16
|
for (const [key, prop] of Object.entries(b)){
|
|
@@ -29,10 +31,10 @@ const defaulToastOptions = {
|
|
|
29
31
|
// Multiple toasts can be dispatched in a single tick, use counter to prevent collisions
|
|
30
32
|
let counter = 0;
|
|
31
33
|
function createToaster(options) {
|
|
32
|
-
const { limit =Number.POSITIVE_INFINITY
|
|
34
|
+
const { limit = Number.POSITIVE_INFINITY } = options;
|
|
33
35
|
const visibleToasts = new Set();
|
|
34
36
|
const toasts = new Map();
|
|
35
|
-
const queue = (0,
|
|
37
|
+
const queue = (0, _reactutilities.createPriorityQueue)((ta, tb)=>{
|
|
36
38
|
const a = toasts.get(ta);
|
|
37
39
|
const b = toasts.get(tb);
|
|
38
40
|
if (!a || !b) {
|
|
@@ -49,7 +51,7 @@ function createToaster(options) {
|
|
|
49
51
|
/**
|
|
50
52
|
* Updates an existing toast with any available option
|
|
51
53
|
*/ const updateToast = (toastOptions)=>{
|
|
52
|
-
const { toastId
|
|
54
|
+
const { toastId } = toastOptions;
|
|
53
55
|
const toastToUpdate = toasts.get(toastId);
|
|
54
56
|
if (!toastToUpdate) {
|
|
55
57
|
return;
|
|
@@ -72,20 +74,20 @@ function createToaster(options) {
|
|
|
72
74
|
* @param toastOptions user configured options
|
|
73
75
|
* @param onUpdate Some toast methods can result in UI changes (i.e. close) use this to dispatch callbacks
|
|
74
76
|
*/ const buildToast = (toastOptions, onUpdate)=>{
|
|
75
|
-
var _toast_onStatusChange;
|
|
76
|
-
const { toastId
|
|
77
|
+
var _toast_onStatusChange, _toast;
|
|
78
|
+
const { toastId, content, toasterId } = toastOptions;
|
|
77
79
|
if (toasts.has(toastId)) {
|
|
78
80
|
return;
|
|
79
81
|
}
|
|
80
82
|
const close = ()=>{
|
|
81
|
-
var _toast_onStatusChange;
|
|
83
|
+
var _toast_onStatusChange, _toast;
|
|
82
84
|
const toast = toasts.get(toastId);
|
|
83
85
|
if (!toast) {
|
|
84
86
|
return;
|
|
85
87
|
}
|
|
86
88
|
visibleToasts.delete(toastId);
|
|
87
89
|
onUpdate();
|
|
88
|
-
(_toast_onStatusChange = toast.onStatusChange) === null || _toast_onStatusChange === void 0 ? void 0 : _toast_onStatusChange.call(
|
|
90
|
+
(_toast_onStatusChange = (_toast = toast).onStatusChange) === null || _toast_onStatusChange === void 0 ? void 0 : _toast_onStatusChange.call(_toast, null, {
|
|
89
91
|
status: 'dismissed',
|
|
90
92
|
...toast
|
|
91
93
|
});
|
|
@@ -120,7 +122,7 @@ function createToaster(options) {
|
|
|
120
122
|
assignDefined(toast, options);
|
|
121
123
|
assignDefined(toast, toastOptions);
|
|
122
124
|
toasts.set(toastId, toast);
|
|
123
|
-
(_toast_onStatusChange = toast.onStatusChange) === null || _toast_onStatusChange === void 0 ? void 0 : _toast_onStatusChange.call(
|
|
125
|
+
(_toast_onStatusChange = (_toast = toast).onStatusChange) === null || _toast_onStatusChange === void 0 ? void 0 : _toast_onStatusChange.call(_toast, null, {
|
|
124
126
|
status: 'queued',
|
|
125
127
|
...toast
|
|
126
128
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["createToaster.js"],"sourcesContent":["import * as React from 'react';\nimport { createPriorityQueue } from '@fluentui/react-utilities';\nfunction assignDefined(a, b) {\n // This cast is required, as Object.entries will return string as key which is not indexable\n for (const [key, prop] of Object.entries(b)){\n // eslint-disable-next-line eqeqeq\n if (prop != undefined) {\n a[key] = prop;\n }\n }\n}\nconst defaulToastOptions = {\n onStatusChange: undefined,\n priority: 0,\n pauseOnHover: false,\n pauseOnWindowBlur: false,\n position: 'bottom-end',\n timeout: 3000\n};\n// Multiple toasts can be dispatched in a single tick, use counter to prevent collisions\nlet counter = 0;\n/**\n * Toast are managed outside of the react lifecycle because they can be\n * dispatched imperatively. Therefore the state of toast visibility can't\n * really be managed properly by a declarative lifecycle.\n */ export function createToaster(options) {\n const { limit =Number.POSITIVE_INFINITY
|
|
1
|
+
{"version":3,"sources":["createToaster.js"],"sourcesContent":["import * as React from 'react';\nimport { createPriorityQueue } from '@fluentui/react-utilities';\nfunction assignDefined(a, b) {\n // This cast is required, as Object.entries will return string as key which is not indexable\n for (const [key, prop] of Object.entries(b)){\n // eslint-disable-next-line eqeqeq\n if (prop != undefined) {\n a[key] = prop;\n }\n }\n}\nconst defaulToastOptions = {\n onStatusChange: undefined,\n priority: 0,\n pauseOnHover: false,\n pauseOnWindowBlur: false,\n position: 'bottom-end',\n timeout: 3000\n};\n// Multiple toasts can be dispatched in a single tick, use counter to prevent collisions\nlet counter = 0;\n/**\n * Toast are managed outside of the react lifecycle because they can be\n * dispatched imperatively. Therefore the state of toast visibility can't\n * really be managed properly by a declarative lifecycle.\n */ export function createToaster(options) {\n const { limit = Number.POSITIVE_INFINITY } = options;\n const visibleToasts = new Set();\n const toasts = new Map();\n const queue = createPriorityQueue((ta, tb)=>{\n const a = toasts.get(ta);\n const b = toasts.get(tb);\n if (!a || !b) {\n return 0;\n }\n if (a.priority === b.priority) {\n return a.order - b.order;\n }\n return a.priority - b.priority;\n });\n const isToastVisible = (toastId)=>{\n return visibleToasts.has(toastId);\n };\n /**\n * Updates an existing toast with any available option\n */ const updateToast = (toastOptions)=>{\n const { toastId } = toastOptions;\n const toastToUpdate = toasts.get(toastId);\n if (!toastToUpdate) {\n return;\n }\n Object.assign(toastToUpdate, toastOptions);\n toastToUpdate.updateId++;\n };\n /**\n * Dismisses a toast with a specific id\n */ const dismissToast = (toastId)=>{\n visibleToasts.delete(toastId);\n };\n /**\n * Dismisses all toasts and clears the queue\n */ const dismissAllToasts = ()=>{\n visibleToasts.clear();\n queue.clear();\n };\n /**\n * @param toastOptions user configured options\n * @param onUpdate Some toast methods can result in UI changes (i.e. close) use this to dispatch callbacks\n */ const buildToast = (toastOptions, onUpdate)=>{\n var _toast_onStatusChange, _toast;\n const { toastId, content, toasterId } = toastOptions;\n if (toasts.has(toastId)) {\n return;\n }\n const close = ()=>{\n var _toast_onStatusChange, _toast;\n const toast = toasts.get(toastId);\n if (!toast) {\n return;\n }\n visibleToasts.delete(toastId);\n onUpdate();\n (_toast_onStatusChange = (_toast = toast).onStatusChange) === null || _toast_onStatusChange === void 0 ? void 0 : _toast_onStatusChange.call(_toast, null, {\n status: 'dismissed',\n ...toast\n });\n };\n const remove = ()=>{\n const toast = toasts.get(toastId);\n if (!toast) {\n return;\n }\n toasts.delete(toastId);\n if (visibleToasts.size < limit && queue.peek()) {\n const nextToast = toasts.get(queue.dequeue());\n if (!nextToast) {\n return;\n }\n visibleToasts.add(nextToast.toastId);\n }\n onUpdate();\n };\n const toast = {\n ...defaulToastOptions,\n close,\n remove,\n toastId,\n content,\n updateId: 0,\n toasterId,\n order: counter++,\n data: {},\n imperativeRef: React.createRef()\n };\n assignDefined(toast, options);\n assignDefined(toast, toastOptions);\n toasts.set(toastId, toast);\n (_toast_onStatusChange = (_toast = toast).onStatusChange) === null || _toast_onStatusChange === void 0 ? void 0 : _toast_onStatusChange.call(_toast, null, {\n status: 'queued',\n ...toast\n });\n if (visibleToasts.size >= limit) {\n queue.enqueue(toastId);\n } else {\n visibleToasts.add(toastId);\n }\n };\n return {\n buildToast,\n dismissAllToasts,\n dismissToast,\n isToastVisible,\n updateToast,\n visibleToasts,\n toasts\n };\n}\n"],"names":["createToaster","assignDefined","a","b","key","prop","Object","entries","undefined","defaulToastOptions","onStatusChange","priority","pauseOnHover","pauseOnWindowBlur","position","timeout","counter","options","limit","Number","POSITIVE_INFINITY","visibleToasts","Set","toasts","Map","queue","createPriorityQueue","ta","tb","get","order","isToastVisible","toastId","has","updateToast","toastOptions","toastToUpdate","assign","updateId","dismissToast","delete","dismissAllToasts","clear","buildToast","onUpdate","_toast_onStatusChange","_toast","content","toasterId","close","toast","call","status","remove","size","peek","nextToast","dequeue","add","data","imperativeRef","React","createRef","set","enqueue"],"mappings":";;;;+BAyBoBA;;;eAAAA;;;;iEAzBG;gCACa;AACpC,SAASC,cAAcC,CAAC,EAAEC,CAAC;IACvB,4FAA4F;IAC5F,KAAK,MAAM,CAACC,KAAKC,KAAK,IAAIC,OAAOC,OAAO,CAACJ,GAAG;QACxC,kCAAkC;QAClC,IAAIE,QAAQG,WAAW;YACnBN,CAAC,CAACE,IAAI,GAAGC;QACb;IACJ;AACJ;AACA,MAAMI,qBAAqB;IACvBC,gBAAgBF;IAChBG,UAAU;IACVC,cAAc;IACdC,mBAAmB;IACnBC,UAAU;IACVC,SAAS;AACb;AACA,wFAAwF;AACxF,IAAIC,UAAU;AAKH,SAAShB,cAAciB,OAAO;IACrC,MAAM,EAAEC,QAAQC,OAAOC,iBAAiB,EAAE,GAAGH;IAC7C,MAAMI,gBAAgB,IAAIC;IAC1B,MAAMC,SAAS,IAAIC;IACnB,MAAMC,QAAQC,IAAAA,mCAAmB,EAAC,CAACC,IAAIC;QACnC,MAAM1B,IAAIqB,OAAOM,GAAG,CAACF;QACrB,MAAMxB,IAAIoB,OAAOM,GAAG,CAACD;QACrB,IAAI,CAAC1B,KAAK,CAACC,GAAG;YACV,OAAO;QACX;QACA,IAAID,EAAES,QAAQ,KAAKR,EAAEQ,QAAQ,EAAE;YAC3B,OAAOT,EAAE4B,KAAK,GAAG3B,EAAE2B,KAAK;QAC5B;QACA,OA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jC,OAAOM,GAAG,CAACJ,MAAMgC,OAAO;gBAC1C,IAAI,CAACD,WAAW;oBACZ;gBACJ;gBACAnC,cAAcqC,GAAG,CAACF,UAAUxB,OAAO;YACvC;YACAY;QACJ;QACA,MAAMM,QAAQ;YACV,GAAGzC,kBAAkB;YACrBwC;YACAI;YACArB;YACAe;YACAT,UAAU;YACVU;YACAlB,OAAOd;YACP2C,MAAM,CAAC;YACPC,6BAAeC,OAAMC,SAAS;QAClC;QACA7D,cAAciD,OAAOjC;QACrBhB,cAAciD,OAAOf;QACrBZ,OAAOwC,GAAG,CAAC/B,SAASkB;QACnBL,CAAAA,wBAAwB,AAACC,CAAAA,SAASI,KAAI,EAAGxC,cAAc,AAAD,MAAO,QAAQmC,0BAA0B,KAAK,IAAI,KAAK,IAAIA,sBAAsBM,IAAI,CAACL,QAAQ,MAAM;YACvJM,QAAQ;YACR,GAAGF,KAAK;QACZ;QACA,IAAI7B,cAAciC,IAAI,IAAIpC,OAAO;YAC7BO,MAAMuC,OAAO,CAAChC;QAClB,OAAO;YACHX,cAAcqC,GAAG,CAAC1B;QACtB;IACJ;IACA,OAAO;QACHW;QACAF;QACAF;QACAR;QACAG;QACAb;QACAE;IACJ;AACJ"}
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "dismissAllToasts", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return dismissAllToasts;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _constants = require("../constants");
|
|
10
12
|
function dismissAllToasts(toasterId = undefined, targetDocument) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["dismissAllToasts.js"],"sourcesContent":["import { EVENTS } from '../constants';\nexport function dismissAllToasts(toasterId = undefined, targetDocument) {\n const event = new CustomEvent(EVENTS.dismissAll, {\n bubbles: false,\n cancelable: false,\n detail: {\n toasterId\n }\n });\n targetDocument.dispatchEvent(event);\n}\n"],"names":["dismissAllToasts","toasterId","undefined","targetDocument","event","CustomEvent","EVENTS","dismissAll","bubbles","cancelable","detail","dispatchEvent"],"mappings":";;;;+BACgBA
|
|
1
|
+
{"version":3,"sources":["dismissAllToasts.js"],"sourcesContent":["import { EVENTS } from '../constants';\nexport function dismissAllToasts(toasterId = undefined, targetDocument) {\n const event = new CustomEvent(EVENTS.dismissAll, {\n bubbles: false,\n cancelable: false,\n detail: {\n toasterId\n }\n });\n targetDocument.dispatchEvent(event);\n}\n"],"names":["dismissAllToasts","toasterId","undefined","targetDocument","event","CustomEvent","EVENTS","dismissAll","bubbles","cancelable","detail","dispatchEvent"],"mappings":";;;;+BACgBA;;;eAAAA;;;2BADO;AAChB,SAASA,iBAAiBC,YAAYC,SAAS,EAAEC,cAAc;IAClE,MAAMC,QAAQ,IAAIC,YAAYC,iBAAM,CAACC,UAAU,EAAE;QAC7CC,SAAS;QACTC,YAAY;QACZC,QAAQ;YACJT;QACJ;IACJ;IACAE,eAAeQ,aAAa,CAACP;AACjC"}
|