@fluentui/react-toast 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +56 -0
- package/CHANGELOG.md +19 -0
- package/LICENSE +15 -0
- package/README.md +5 -0
- package/dist/index.d.ts +485 -0
- package/lib/AriaLive.js +1 -0
- package/lib/AriaLive.js.map +1 -0
- package/lib/Toast.js +1 -0
- package/lib/Toast.js.map +1 -0
- package/lib/ToastBody.js +1 -0
- package/lib/ToastBody.js.map +1 -0
- package/lib/ToastContainer.js +1 -0
- package/lib/ToastContainer.js.map +1 -0
- package/lib/ToastFooter.js +1 -0
- package/lib/ToastFooter.js.map +1 -0
- package/lib/ToastTitle.js +1 -0
- package/lib/ToastTitle.js.map +1 -0
- package/lib/ToastTrigger.js +1 -0
- package/lib/ToastTrigger.js.map +1 -0
- package/lib/Toaster.js +1 -0
- package/lib/Toaster.js.map +1 -0
- package/lib/components/AriaLive/AriaLive.js +12 -0
- package/lib/components/AriaLive/AriaLive.js.map +1 -0
- package/lib/components/AriaLive/AriaLive.types.js +1 -0
- package/lib/components/AriaLive/AriaLive.types.js.map +1 -0
- package/lib/components/AriaLive/index.js +5 -0
- package/lib/components/AriaLive/index.js.map +1 -0
- package/lib/components/AriaLive/renderAriaLive.js +8 -0
- package/lib/components/AriaLive/renderAriaLive.js.map +1 -0
- package/lib/components/AriaLive/useAriaLive.js +73 -0
- package/lib/components/AriaLive/useAriaLive.js.map +1 -0
- package/lib/components/AriaLive/useAriaLiveStyles.styles.js +19 -0
- package/lib/components/AriaLive/useAriaLiveStyles.styles.js.map +1 -0
- package/lib/components/Timer/Timer.js +21 -0
- package/lib/components/Timer/Timer.js.map +1 -0
- package/lib/components/Timer/index.js +1 -0
- package/lib/components/Timer/index.js.map +1 -0
- package/lib/components/Timer/useTimerStyles.styles.js +3 -0
- package/lib/components/Timer/useTimerStyles.styles.js.map +1 -0
- package/lib/components/Toast/Toast.js +13 -0
- package/lib/components/Toast/Toast.js.map +1 -0
- package/lib/components/Toast/Toast.types.js +1 -0
- package/lib/components/Toast/Toast.types.js.map +1 -0
- package/lib/components/Toast/index.js +5 -0
- package/lib/components/Toast/index.js.map +1 -0
- package/lib/components/Toast/renderToast.js +11 -0
- package/lib/components/Toast/renderToast.js.map +1 -0
- package/lib/components/Toast/useToast.js +22 -0
- package/lib/components/Toast/useToast.js.map +1 -0
- package/lib/components/Toast/useToastContextValues.js +6 -0
- package/lib/components/Toast/useToastContextValues.js.map +1 -0
- package/lib/components/Toast/useToastStyles.styles.js +24 -0
- package/lib/components/Toast/useToastStyles.styles.js.map +1 -0
- package/lib/components/ToastBody/ToastBody.js +12 -0
- package/lib/components/ToastBody/ToastBody.js.map +1 -0
- package/lib/components/ToastBody/ToastBody.types.js +1 -0
- package/lib/components/ToastBody/ToastBody.types.js.map +1 -0
- package/lib/components/ToastBody/index.js +5 -0
- package/lib/components/ToastBody/index.js.map +1 -0
- package/lib/components/ToastBody/renderToastBody.js +8 -0
- package/lib/components/ToastBody/renderToastBody.js.map +1 -0
- package/lib/components/ToastBody/useToastBody.js +29 -0
- package/lib/components/ToastBody/useToastBody.js.map +1 -0
- package/lib/components/ToastBody/useToastBodyStyles.styles.js +32 -0
- package/lib/components/ToastBody/useToastBodyStyles.styles.js.map +1 -0
- package/lib/components/ToastContainer/ToastContainer.js +13 -0
- package/lib/components/ToastContainer/ToastContainer.js.map +1 -0
- package/lib/components/ToastContainer/ToastContainer.types.js +1 -0
- package/lib/components/ToastContainer/ToastContainer.types.js.map +1 -0
- package/lib/components/ToastContainer/index.js +6 -0
- package/lib/components/ToastContainer/index.js.map +1 -0
- package/lib/components/ToastContainer/renderToastContainer.js +21 -0
- package/lib/components/ToastContainer/renderToastContainer.js.map +1 -0
- package/lib/components/ToastContainer/useToastContainer.js +219 -0
- package/lib/components/ToastContainer/useToastContainer.js.map +1 -0
- package/lib/components/ToastContainer/useToastContainerContextValues.js +18 -0
- package/lib/components/ToastContainer/useToastContainerContextValues.js.map +1 -0
- package/lib/components/ToastContainer/useToastContainerStyles.styles.js +36 -0
- package/lib/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -0
- package/lib/components/ToastFooter/ToastFooter.js +12 -0
- package/lib/components/ToastFooter/ToastFooter.js.map +1 -0
- package/lib/components/ToastFooter/ToastFooter.types.js +1 -0
- package/lib/components/ToastFooter/ToastFooter.types.js.map +1 -0
- package/lib/components/ToastFooter/index.js +5 -0
- package/lib/components/ToastFooter/index.js.map +1 -0
- package/lib/components/ToastFooter/renderToastFooter.js +8 -0
- package/lib/components/ToastFooter/renderToastFooter.js.map +1 -0
- package/lib/components/ToastFooter/useToastFooter.js +21 -0
- package/lib/components/ToastFooter/useToastFooter.js.map +1 -0
- package/lib/components/ToastFooter/useToastFooterStyles.styles.js +17 -0
- package/lib/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -0
- package/lib/components/ToastTitle/ToastTitle.js +12 -0
- package/lib/components/ToastTitle/ToastTitle.js.map +1 -0
- package/lib/components/ToastTitle/ToastTitle.types.js +1 -0
- package/lib/components/ToastTitle/ToastTitle.types.js.map +1 -0
- package/lib/components/ToastTitle/index.js +5 -0
- package/lib/components/ToastTitle/index.js.map +1 -0
- package/lib/components/ToastTitle/renderToastTitle.js +8 -0
- package/lib/components/ToastTitle/renderToastTitle.js.map +1 -0
- package/lib/components/ToastTitle/useToastTitle.js +54 -0
- package/lib/components/ToastTitle/useToastTitle.js.map +1 -0
- package/lib/components/ToastTitle/useToastTitleStyles.styles.js +78 -0
- package/lib/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -0
- package/lib/components/ToastTrigger/ToastTrigger.js +10 -0
- package/lib/components/ToastTrigger/ToastTrigger.js.map +1 -0
- package/lib/components/ToastTrigger/ToastTrigger.types.js +1 -0
- package/lib/components/ToastTrigger/ToastTrigger.types.js.map +1 -0
- package/lib/components/ToastTrigger/index.js +4 -0
- package/lib/components/ToastTrigger/index.js.map +1 -0
- package/lib/components/ToastTrigger/renderToastTrigger.js +5 -0
- package/lib/components/ToastTrigger/renderToastTrigger.js.map +1 -0
- package/lib/components/ToastTrigger/useToastTrigger.js +36 -0
- package/lib/components/ToastTrigger/useToastTrigger.js.map +1 -0
- package/lib/components/Toaster/Toaster.js +12 -0
- package/lib/components/Toaster/Toaster.js.map +1 -0
- package/lib/components/Toaster/Toaster.types.js +1 -0
- package/lib/components/Toaster/Toaster.types.js.map +1 -0
- package/lib/components/Toaster/index.js +5 -0
- package/lib/components/Toaster/index.js.map +1 -0
- package/lib/components/Toaster/renderToaster.js +14 -0
- package/lib/components/Toaster/renderToaster.js.map +1 -0
- package/lib/components/Toaster/useToaster.js +71 -0
- package/lib/components/Toaster/useToaster.js.map +1 -0
- package/lib/components/Toaster/useToasterStyles.styles.js +43 -0
- package/lib/components/Toaster/useToasterStyles.styles.js.map +1 -0
- package/lib/contexts/toastContainerContext.js +11 -0
- package/lib/contexts/toastContainerContext.js.map +1 -0
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -0
- package/lib/state/constants.js +14 -0
- package/lib/state/constants.js.map +1 -0
- package/lib/state/index.js +5 -0
- package/lib/state/index.js.map +1 -0
- package/lib/state/types.js +1 -0
- package/lib/state/types.js.map +1 -0
- package/lib/state/useToastController.js +57 -0
- package/lib/state/useToastController.js.map +1 -0
- package/lib/state/useToaster.js +162 -0
- package/lib/state/useToaster.js.map +1 -0
- package/lib/state/vanilla/createToaster.js +137 -0
- package/lib/state/vanilla/createToaster.js.map +1 -0
- package/lib/state/vanilla/dismissAllToasts.js +11 -0
- package/lib/state/vanilla/dismissAllToasts.js.map +1 -0
- package/lib/state/vanilla/dismissToast.js +12 -0
- package/lib/state/vanilla/dismissToast.js.map +1 -0
- package/lib/state/vanilla/dispatchToast.js +16 -0
- package/lib/state/vanilla/dispatchToast.js.map +1 -0
- package/lib/state/vanilla/getPositionStyles.js +40 -0
- package/lib/state/vanilla/getPositionStyles.js.map +1 -0
- package/lib/state/vanilla/index.js +8 -0
- package/lib/state/vanilla/index.js.map +1 -0
- package/lib/state/vanilla/pauseToast.js +12 -0
- package/lib/state/vanilla/pauseToast.js.map +1 -0
- package/lib/state/vanilla/playToast.js +12 -0
- package/lib/state/vanilla/playToast.js.map +1 -0
- package/lib/state/vanilla/updateToast.js +9 -0
- package/lib/state/vanilla/updateToast.js.map +1 -0
- package/lib-commonjs/AriaLive.js +6 -0
- package/lib-commonjs/AriaLive.js.map +1 -0
- package/lib-commonjs/Toast.js +6 -0
- package/lib-commonjs/Toast.js.map +1 -0
- package/lib-commonjs/ToastBody.js +6 -0
- package/lib-commonjs/ToastBody.js.map +1 -0
- package/lib-commonjs/ToastContainer.js +6 -0
- package/lib-commonjs/ToastContainer.js.map +1 -0
- package/lib-commonjs/ToastFooter.js +6 -0
- package/lib-commonjs/ToastFooter.js.map +1 -0
- package/lib-commonjs/ToastTitle.js +6 -0
- package/lib-commonjs/ToastTitle.js.map +1 -0
- package/lib-commonjs/ToastTrigger.js +6 -0
- package/lib-commonjs/ToastTrigger.js.map +1 -0
- package/lib-commonjs/Toaster.js +6 -0
- package/lib-commonjs/Toaster.js.map +1 -0
- package/lib-commonjs/components/AriaLive/AriaLive.js +19 -0
- package/lib-commonjs/components/AriaLive/AriaLive.js.map +1 -0
- package/lib-commonjs/components/AriaLive/AriaLive.types.js +6 -0
- package/lib-commonjs/components/AriaLive/AriaLive.types.js.map +1 -0
- package/lib-commonjs/components/AriaLive/index.js +10 -0
- package/lib-commonjs/components/AriaLive/index.js.map +1 -0
- package/lib-commonjs/components/AriaLive/renderAriaLive.js +14 -0
- package/lib-commonjs/components/AriaLive/renderAriaLive.js.map +1 -0
- package/lib-commonjs/components/AriaLive/useAriaLive.js +75 -0
- package/lib-commonjs/components/AriaLive/useAriaLive.js.map +1 -0
- package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js +31 -0
- package/lib-commonjs/components/AriaLive/useAriaLiveStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Timer/Timer.js +30 -0
- package/lib-commonjs/components/Timer/Timer.js.map +1 -0
- package/lib-commonjs/components/Timer/index.js +6 -0
- package/lib-commonjs/components/Timer/index.js.map +1 -0
- package/lib-commonjs/components/Timer/useTimerStyles.styles.js +16 -0
- package/lib-commonjs/components/Timer/useTimerStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Toast/Toast.js +20 -0
- package/lib-commonjs/components/Toast/Toast.js.map +1 -0
- package/lib-commonjs/components/Toast/Toast.types.js +4 -0
- package/lib-commonjs/components/Toast/Toast.types.js.map +1 -0
- package/lib-commonjs/components/Toast/index.js +10 -0
- package/lib-commonjs/components/Toast/index.js.map +1 -0
- package/lib-commonjs/components/Toast/renderToast.js +17 -0
- package/lib-commonjs/components/Toast/renderToast.js.map +1 -0
- package/lib-commonjs/components/Toast/useToast.js +23 -0
- package/lib-commonjs/components/Toast/useToast.js.map +1 -0
- package/lib-commonjs/components/Toast/useToastContextValues.js +14 -0
- package/lib-commonjs/components/Toast/useToastContextValues.js.map +1 -0
- package/lib-commonjs/components/Toast/useToastStyles.styles.js +39 -0
- package/lib-commonjs/components/Toast/useToastStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ToastBody/ToastBody.js +19 -0
- package/lib-commonjs/components/ToastBody/ToastBody.js.map +1 -0
- package/lib-commonjs/components/ToastBody/ToastBody.types.js +4 -0
- package/lib-commonjs/components/ToastBody/ToastBody.types.js.map +1 -0
- package/lib-commonjs/components/ToastBody/index.js +10 -0
- package/lib-commonjs/components/ToastBody/index.js.map +1 -0
- package/lib-commonjs/components/ToastBody/renderToastBody.js +14 -0
- package/lib-commonjs/components/ToastBody/renderToastBody.js.map +1 -0
- package/lib-commonjs/components/ToastBody/useToastBody.js +30 -0
- package/lib-commonjs/components/ToastBody/useToastBody.js.map +1 -0
- package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js +47 -0
- package/lib-commonjs/components/ToastBody/useToastBodyStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ToastContainer/ToastContainer.js +20 -0
- package/lib-commonjs/components/ToastContainer/ToastContainer.js.map +1 -0
- package/lib-commonjs/components/ToastContainer/ToastContainer.types.js +6 -0
- package/lib-commonjs/components/ToastContainer/ToastContainer.types.js.map +1 -0
- package/lib-commonjs/components/ToastContainer/index.js +11 -0
- package/lib-commonjs/components/ToastContainer/index.js.map +1 -0
- package/lib-commonjs/components/ToastContainer/renderToastContainer.js +27 -0
- package/lib-commonjs/components/ToastContainer/renderToastContainer.js.map +1 -0
- package/lib-commonjs/components/ToastContainer/useToastContainer.js +220 -0
- package/lib-commonjs/components/ToastContainer/useToastContainer.js.map +1 -0
- package/lib-commonjs/components/ToastContainer/useToastContainerContextValues.js +27 -0
- package/lib-commonjs/components/ToastContainer/useToastContainerContextValues.js.map +1 -0
- package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js +64 -0
- package/lib-commonjs/components/ToastContainer/useToastContainerStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ToastFooter/ToastFooter.js +19 -0
- package/lib-commonjs/components/ToastFooter/ToastFooter.js.map +1 -0
- package/lib-commonjs/components/ToastFooter/ToastFooter.types.js +4 -0
- package/lib-commonjs/components/ToastFooter/ToastFooter.types.js.map +1 -0
- package/lib-commonjs/components/ToastFooter/index.js +10 -0
- package/lib-commonjs/components/ToastFooter/index.js.map +1 -0
- package/lib-commonjs/components/ToastFooter/renderToastFooter.js +14 -0
- package/lib-commonjs/components/ToastFooter/renderToastFooter.js.map +1 -0
- package/lib-commonjs/components/ToastFooter/useToastFooter.js +22 -0
- package/lib-commonjs/components/ToastFooter/useToastFooter.js.map +1 -0
- package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js +28 -0
- package/lib-commonjs/components/ToastFooter/useToastFooterStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ToastTitle/ToastTitle.js +19 -0
- package/lib-commonjs/components/ToastTitle/ToastTitle.js.map +1 -0
- package/lib-commonjs/components/ToastTitle/ToastTitle.types.js +4 -0
- package/lib-commonjs/components/ToastTitle/ToastTitle.types.js.map +1 -0
- package/lib-commonjs/components/ToastTitle/index.js +10 -0
- package/lib-commonjs/components/ToastTitle/index.js.map +1 -0
- package/lib-commonjs/components/ToastTitle/renderToastTitle.js +14 -0
- package/lib-commonjs/components/ToastTitle/renderToastTitle.js.map +1 -0
- package/lib-commonjs/components/ToastTitle/useToastTitle.js +55 -0
- package/lib-commonjs/components/ToastTitle/useToastTitle.js.map +1 -0
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js +107 -0
- package/lib-commonjs/components/ToastTitle/useToastTitleStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.js +17 -0
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.js.map +1 -0
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.types.js +6 -0
- package/lib-commonjs/components/ToastTrigger/ToastTrigger.types.js.map +1 -0
- package/lib-commonjs/components/ToastTrigger/index.js +9 -0
- package/lib-commonjs/components/ToastTrigger/index.js.map +1 -0
- package/lib-commonjs/components/ToastTrigger/renderToastTrigger.js +13 -0
- package/lib-commonjs/components/ToastTrigger/renderToastTrigger.js.map +1 -0
- package/lib-commonjs/components/ToastTrigger/useToastTrigger.js +37 -0
- package/lib-commonjs/components/ToastTrigger/useToastTrigger.js.map +1 -0
- package/lib-commonjs/components/Toaster/Toaster.js +19 -0
- package/lib-commonjs/components/Toaster/Toaster.js.map +1 -0
- package/lib-commonjs/components/Toaster/Toaster.types.js +4 -0
- package/lib-commonjs/components/Toaster/Toaster.types.js.map +1 -0
- package/lib-commonjs/components/Toaster/index.js +10 -0
- package/lib-commonjs/components/Toaster/index.js.map +1 -0
- package/lib-commonjs/components/Toaster/renderToaster.js +20 -0
- package/lib-commonjs/components/Toaster/renderToaster.js.map +1 -0
- package/lib-commonjs/components/Toaster/useToaster.js +76 -0
- package/lib-commonjs/components/Toaster/useToaster.js.map +1 -0
- package/lib-commonjs/components/Toaster/useToasterStyles.styles.js +54 -0
- package/lib-commonjs/components/Toaster/useToasterStyles.styles.js.map +1 -0
- package/lib-commonjs/contexts/toastContainerContext.js +26 -0
- package/lib-commonjs/contexts/toastContainerContext.js.map +1 -0
- package/lib-commonjs/index.js +48 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/state/constants.js +28 -0
- package/lib-commonjs/state/constants.js.map +1 -0
- package/lib-commonjs/state/index.js +20 -0
- package/lib-commonjs/state/index.js.map +1 -0
- package/lib-commonjs/state/types.js +6 -0
- package/lib-commonjs/state/types.js.map +1 -0
- package/lib-commonjs/state/useToastController.js +63 -0
- package/lib-commonjs/state/useToastController.js.map +1 -0
- package/lib-commonjs/state/useToaster.js +171 -0
- package/lib-commonjs/state/useToaster.js.map +1 -0
- package/lib-commonjs/state/vanilla/createToaster.js +142 -0
- package/lib-commonjs/state/vanilla/createToaster.js.map +1 -0
- package/lib-commonjs/state/vanilla/dismissAllToasts.js +19 -0
- package/lib-commonjs/state/vanilla/dismissAllToasts.js.map +1 -0
- package/lib-commonjs/state/vanilla/dismissToast.js +20 -0
- package/lib-commonjs/state/vanilla/dismissToast.js.map +1 -0
- package/lib-commonjs/state/vanilla/dispatchToast.js +24 -0
- package/lib-commonjs/state/vanilla/dispatchToast.js.map +1 -0
- package/lib-commonjs/state/vanilla/getPositionStyles.js +48 -0
- package/lib-commonjs/state/vanilla/getPositionStyles.js.map +1 -0
- package/lib-commonjs/state/vanilla/index.js +13 -0
- package/lib-commonjs/state/vanilla/index.js.map +1 -0
- package/lib-commonjs/state/vanilla/pauseToast.js +20 -0
- package/lib-commonjs/state/vanilla/pauseToast.js.map +1 -0
- package/lib-commonjs/state/vanilla/playToast.js +20 -0
- package/lib-commonjs/state/vanilla/playToast.js.map +1 -0
- package/lib-commonjs/state/vanilla/updateToast.js +17 -0
- package/lib-commonjs/state/vanilla/updateToast.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "getPositionStyles", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>getPositionStyles
|
|
8
|
+
});
|
|
9
|
+
const getPositionStyles = (position, dir, offset)=>{
|
|
10
|
+
const positionStyles = {
|
|
11
|
+
position: 'fixed'
|
|
12
|
+
};
|
|
13
|
+
var _offset_position;
|
|
14
|
+
const offsetStyles = offset ? isShorthandOffset(offset) ? offset : (_offset_position = offset[position]) !== null && _offset_position !== void 0 ? _offset_position : {} : {};
|
|
15
|
+
const { horizontal =20 , vertical =16 } = offsetStyles;
|
|
16
|
+
const start = dir === 'ltr' ? 'left' : 'right';
|
|
17
|
+
const end = dir === 'ltr' ? 'right' : 'left';
|
|
18
|
+
switch(position){
|
|
19
|
+
case 'top-start':
|
|
20
|
+
Object.assign(positionStyles, {
|
|
21
|
+
top: vertical,
|
|
22
|
+
[start]: horizontal
|
|
23
|
+
});
|
|
24
|
+
break;
|
|
25
|
+
case 'top-end':
|
|
26
|
+
Object.assign(positionStyles, {
|
|
27
|
+
top: vertical,
|
|
28
|
+
[end]: horizontal
|
|
29
|
+
});
|
|
30
|
+
break;
|
|
31
|
+
case 'bottom-start':
|
|
32
|
+
Object.assign(positionStyles, {
|
|
33
|
+
bottom: vertical,
|
|
34
|
+
[start]: horizontal
|
|
35
|
+
});
|
|
36
|
+
break;
|
|
37
|
+
case 'bottom-end':
|
|
38
|
+
Object.assign(positionStyles, {
|
|
39
|
+
bottom: vertical,
|
|
40
|
+
[end]: horizontal
|
|
41
|
+
});
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
return positionStyles;
|
|
45
|
+
};
|
|
46
|
+
function isShorthandOffset(offset) {
|
|
47
|
+
return 'horizontal' in offset || 'vertical' in offset;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["getPositionStyles.js"],"sourcesContent":["export const getPositionStyles = (position, dir, offset)=>{\n const positionStyles = {\n position: 'fixed'\n };\n var _offset_position;\n const offsetStyles = offset ? isShorthandOffset(offset) ? offset : (_offset_position = offset[position]) !== null && _offset_position !== void 0 ? _offset_position : {} : {};\n const { horizontal =20 , vertical =16 } = offsetStyles;\n const start = dir === 'ltr' ? 'left' : 'right';\n const end = dir === 'ltr' ? 'right' : 'left';\n switch(position){\n case 'top-start':\n Object.assign(positionStyles, {\n top: vertical,\n [start]: horizontal\n });\n break;\n case 'top-end':\n Object.assign(positionStyles, {\n top: vertical,\n [end]: horizontal\n });\n break;\n case 'bottom-start':\n Object.assign(positionStyles, {\n bottom: vertical,\n [start]: horizontal\n });\n break;\n case 'bottom-end':\n Object.assign(positionStyles, {\n bottom: vertical,\n [end]: horizontal\n });\n break;\n }\n return positionStyles;\n};\nfunction isShorthandOffset(offset) {\n return 'horizontal' in offset || 'vertical' in offset;\n}\n"],"names":["getPositionStyles","position","dir","offset","positionStyles","_offset_position","offsetStyles","isShorthandOffset","horizontal","vertical","start","end","Object","assign","top","bottom"],"mappings":";;;;+BAAaA;;aAAAA;;AAAN,MAAMA,oBAAoB,CAACC,UAAUC,KAAKC,SAAS;IACtD,MAAMC,iBAAiB;QACnBH,UAAU;IACd;IACA,IAAII;IACJ,MAAMC,eAAeH,SAASI,kBAAkBJ,UAAUA,SAAS,AAACE,CAAAA,mBAAmBF,MAAM,CAACF,SAAS,AAAD,MAAO,IAAI,IAAII,qBAAqB,KAAK,IAAIA,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7K,MAAM,EAAEG,YAAY,GAAE,EAAGC,UAAU,GAAE,EAAG,GAAGH;IAC3C,MAAMI,QAAQR,QAAQ,QAAQ,SAAS,OAAO;IAC9C,MAAMS,MAAMT,QAAQ,QAAQ,UAAU,MAAM;IAC5C,OAAOD;QACH,KAAK;YACDW,OAAOC,MAAM,CAACT,gBAAgB;gBAC1BU,KAAKL;gBACL,CAACC,MAAM,EAAEF;YACb;YACA,KAAM;QACV,KAAK;YACDI,OAAOC,MAAM,CAACT,gBAAgB;gBAC1BU,KAAKL;gBACL,CAACE,IAAI,EAAEH;YACX;YACA,KAAM;QACV,KAAK;YACDI,OAAOC,MAAM,CAACT,gBAAgB;gBAC1BW,QAAQN;gBACR,CAACC,MAAM,EAAEF;YACb;YACA,KAAM;QACV,KAAK;YACDI,OAAOC,MAAM,CAACT,gBAAgB;gBAC1BW,QAAQN;gBACR,CAACE,IAAI,EAAEH;YACX;YACA,KAAM;IACd;IACA,OAAOJ;AACX;AACA,SAASG,kBAAkBJ,MAAM,EAAE;IAC/B,OAAO,gBAAgBA,UAAU,cAAcA;AACnD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
|
6
|
+
_exportStar(require("./dispatchToast"), exports);
|
|
7
|
+
_exportStar(require("./dismissToast"), exports);
|
|
8
|
+
_exportStar(require("./dismissAllToasts"), exports);
|
|
9
|
+
_exportStar(require("./updateToast"), exports);
|
|
10
|
+
_exportStar(require("./pauseToast"), exports);
|
|
11
|
+
_exportStar(require("./playToast"), exports);
|
|
12
|
+
_exportStar(require("./createToaster"), exports);
|
|
13
|
+
_exportStar(require("./getPositionStyles"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './dispatchToast';\nexport * from './dismissToast';\nexport * from './dismissAllToasts';\nexport * from './updateToast';\nexport * from './pauseToast';\nexport * from './playToast';\nexport * from './createToaster';\nexport * from './getPositionStyles';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "pauseToast", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>pauseToast
|
|
8
|
+
});
|
|
9
|
+
const _constants = require("../constants");
|
|
10
|
+
function pauseToast(toastId, toasterId = undefined, targetDocument) {
|
|
11
|
+
const event = new CustomEvent(_constants.EVENTS.pause, {
|
|
12
|
+
bubbles: false,
|
|
13
|
+
cancelable: false,
|
|
14
|
+
detail: {
|
|
15
|
+
toastId,
|
|
16
|
+
toasterId
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
targetDocument.dispatchEvent(event);
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["pauseToast.js"],"sourcesContent":["import { EVENTS } from '../constants';\nexport function pauseToast(toastId, toasterId = undefined, targetDocument) {\n const event = new CustomEvent(EVENTS.pause, {\n bubbles: false,\n cancelable: false,\n detail: {\n toastId,\n toasterId\n }\n });\n targetDocument.dispatchEvent(event);\n}\n"],"names":["pauseToast","toastId","toasterId","undefined","targetDocument","event","CustomEvent","EVENTS","pause","bubbles","cancelable","detail","dispatchEvent"],"mappings":";;;;+BACgBA;;aAAAA;;2BADO;AAChB,SAASA,WAAWC,OAAO,EAAEC,YAAYC,SAAS,EAAEC,cAAc,EAAE;IACvE,MAAMC,QAAQ,IAAIC,YAAYC,iBAAM,CAACC,KAAK,EAAE;QACxCC,SAAS,KAAK;QACdC,YAAY,KAAK;QACjBC,QAAQ;YACJV;YACAC;QACJ;IACJ;IACAE,eAAeQ,aAAa,CAACP;AACjC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "playToast", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>playToast
|
|
8
|
+
});
|
|
9
|
+
const _constants = require("../constants");
|
|
10
|
+
function playToast(toastId, toasterId = undefined, targetDocument) {
|
|
11
|
+
const event = new CustomEvent(_constants.EVENTS.play, {
|
|
12
|
+
bubbles: false,
|
|
13
|
+
cancelable: false,
|
|
14
|
+
detail: {
|
|
15
|
+
toastId,
|
|
16
|
+
toasterId
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
targetDocument.dispatchEvent(event);
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["playToast.js"],"sourcesContent":["import { EVENTS } from '../constants';\nexport function playToast(toastId, toasterId = undefined, targetDocument) {\n const event = new CustomEvent(EVENTS.play, {\n bubbles: false,\n cancelable: false,\n detail: {\n toastId,\n toasterId\n }\n });\n targetDocument.dispatchEvent(event);\n}\n"],"names":["playToast","toastId","toasterId","undefined","targetDocument","event","CustomEvent","EVENTS","play","bubbles","cancelable","detail","dispatchEvent"],"mappings":";;;;+BACgBA;;aAAAA;;2BADO;AAChB,SAASA,UAAUC,OAAO,EAAEC,YAAYC,SAAS,EAAEC,cAAc,EAAE;IACtE,MAAMC,QAAQ,IAAIC,YAAYC,iBAAM,CAACC,IAAI,EAAE;QACvCC,SAAS,KAAK;QACdC,YAAY,KAAK;QACjBC,QAAQ;YACJV;YACAC;QACJ;IACJ;IACAE,eAAeQ,aAAa,CAACP;AACjC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "updateToast", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>updateToast
|
|
8
|
+
});
|
|
9
|
+
const _constants = require("../constants");
|
|
10
|
+
function updateToast(options, targetDocument) {
|
|
11
|
+
const event = new CustomEvent(_constants.EVENTS.update, {
|
|
12
|
+
bubbles: false,
|
|
13
|
+
cancelable: false,
|
|
14
|
+
detail: options
|
|
15
|
+
});
|
|
16
|
+
targetDocument.dispatchEvent(event);
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["updateToast.js"],"sourcesContent":["import { EVENTS } from '../constants';\nexport function updateToast(options, targetDocument) {\n const event = new CustomEvent(EVENTS.update, {\n bubbles: false,\n cancelable: false,\n detail: options\n });\n targetDocument.dispatchEvent(event);\n}\n"],"names":["updateToast","options","targetDocument","event","CustomEvent","EVENTS","update","bubbles","cancelable","detail","dispatchEvent"],"mappings":";;;;+BACgBA;;aAAAA;;2BADO;AAChB,SAASA,YAAYC,OAAO,EAAEC,cAAc,EAAE;IACjD,MAAMC,QAAQ,IAAIC,YAAYC,iBAAM,CAACC,MAAM,EAAE;QACzCC,SAAS,KAAK;QACdC,YAAY,KAAK;QACjBC,QAAQR;IACZ;IACAC,eAAeQ,aAAa,CAACP;AACjC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fluentui/react-toast",
|
|
3
|
+
"version": "9.0.0",
|
|
4
|
+
"description": "Toast component for Fluent UI",
|
|
5
|
+
"main": "lib-commonjs/index.js",
|
|
6
|
+
"module": "lib/index.js",
|
|
7
|
+
"typings": "./dist/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/microsoft/fluentui"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "just-scripts build",
|
|
16
|
+
"bundle-size": "bundle-size measure",
|
|
17
|
+
"clean": "just-scripts clean",
|
|
18
|
+
"code-style": "just-scripts code-style",
|
|
19
|
+
"just": "just-scripts",
|
|
20
|
+
"lint": "just-scripts lint",
|
|
21
|
+
"test": "jest --passWithNoTests",
|
|
22
|
+
"test-ssr": "test-ssr \"./stories/**/*.stories.tsx\"",
|
|
23
|
+
"type-check": "tsc -b tsconfig.json",
|
|
24
|
+
"generate-api": "just-scripts generate-api",
|
|
25
|
+
"storybook": "start-storybook",
|
|
26
|
+
"start": "yarn storybook",
|
|
27
|
+
"e2e": "cypress run --component",
|
|
28
|
+
"e2e:local": "cypress open --component"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@fluentui/eslint-plugin": "*",
|
|
32
|
+
"@fluentui/react-conformance": "*",
|
|
33
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.23",
|
|
34
|
+
"@fluentui/scripts-api-extractor": "*",
|
|
35
|
+
"@fluentui/scripts-tasks": "*"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"react-transition-group": "^4.4.1",
|
|
39
|
+
"@fluentui/react-aria": "^9.3.26",
|
|
40
|
+
"@fluentui/react-icons": "^2.0.203",
|
|
41
|
+
"@fluentui/react-jsx-runtime": "9.0.0-alpha.10",
|
|
42
|
+
"@fluentui/react-portal": "^9.3.0",
|
|
43
|
+
"@fluentui/react-shared-contexts": "^9.6.0",
|
|
44
|
+
"@fluentui/react-tabster": "^9.9.2",
|
|
45
|
+
"@fluentui/react-theme": "^9.1.9",
|
|
46
|
+
"@fluentui/react-utilities": "^9.10.1",
|
|
47
|
+
"@griffel/react": "^1.5.7",
|
|
48
|
+
"@swc/helpers": "^0.4.14"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@types/react": ">=16.8.0 <19.0.0",
|
|
52
|
+
"@types/react-dom": ">=16.8.0 <19.0.0",
|
|
53
|
+
"react": ">=16.8.0 <19.0.0",
|
|
54
|
+
"react-dom": ">=16.8.0 <19.0.0"
|
|
55
|
+
},
|
|
56
|
+
"beachball": {
|
|
57
|
+
"disallowedChangeTypes": [
|
|
58
|
+
"major",
|
|
59
|
+
"prerelease"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"exports": {
|
|
63
|
+
".": {
|
|
64
|
+
"types": "./dist/index.d.ts",
|
|
65
|
+
"node": "./lib-commonjs/index.js",
|
|
66
|
+
"import": "./lib/index.js",
|
|
67
|
+
"require": "./lib-commonjs/index.js"
|
|
68
|
+
},
|
|
69
|
+
"./package.json": "./package.json"
|
|
70
|
+
}
|
|
71
|
+
}
|