@react-spectrum/toast 3.0.0-nightly.3114 → 3.0.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.
Files changed (35) hide show
  1. package/dist/Toast.main.js +6 -15
  2. package/dist/Toast.main.js.map +1 -1
  3. package/dist/Toast.mjs +6 -15
  4. package/dist/Toast.module.js +6 -15
  5. package/dist/Toast.module.js.map +1 -1
  6. package/dist/ToastContainer.main.js +37 -12
  7. package/dist/ToastContainer.main.js.map +1 -1
  8. package/dist/ToastContainer.mjs +38 -13
  9. package/dist/ToastContainer.module.js +38 -13
  10. package/dist/ToastContainer.module.js.map +1 -1
  11. package/dist/Toaster.main.js +14 -4
  12. package/dist/Toaster.main.js.map +1 -1
  13. package/dist/Toaster.mjs +15 -5
  14. package/dist/Toaster.module.js +15 -5
  15. package/dist/Toaster.module.js.map +1 -1
  16. package/dist/{toastContainer.da404f80.css → toastContainer.6706a095.css} +69 -45
  17. package/dist/toastContainer.6706a095.css.map +1 -0
  18. package/dist/toastContainer_css.main.js +33 -11
  19. package/dist/toastContainer_css.main.js.map +1 -1
  20. package/dist/toastContainer_css.mjs +33 -11
  21. package/dist/toastContainer_css.module.js +33 -11
  22. package/dist/toastContainer_css.module.js.map +1 -1
  23. package/dist/toast_vars_css.main.js +10 -10
  24. package/dist/toast_vars_css.mjs +10 -10
  25. package/dist/toast_vars_css.module.js +10 -10
  26. package/dist/types.d.ts +4 -2
  27. package/dist/types.d.ts.map +1 -1
  28. package/dist/{vars.c6e65b7e.css → vars.84eec607.css} +16 -16
  29. package/dist/{vars.c6e65b7e.css.map → vars.84eec607.css.map} +1 -1
  30. package/package.json +17 -17
  31. package/src/Toast.tsx +3 -17
  32. package/src/ToastContainer.tsx +52 -24
  33. package/src/Toaster.tsx +12 -5
  34. package/src/toastContainer.css +46 -24
  35. package/dist/toastContainer.da404f80.css.map +0 -1
@@ -1,7 +1,7 @@
1
1
  var $1e709ec471c88b75$exports = require("./intlStrings.main.js");
2
- require("./vars.c6e65b7e.css");
2
+ require("./vars.84eec607.css");
3
3
  var $b6e6aa676f8f9e47$exports = require("./toast_vars_css.main.js");
4
- require("./toastContainer.da404f80.css");
4
+ require("./toastContainer.6706a095.css");
5
5
  var $e20782d0579ed886$exports = require("./toastContainer_css.main.js");
6
6
  var $8Jify$spectrumiconsuiAlertMedium = require("@spectrum-icons/ui/AlertMedium");
7
7
  var $8Jify$reactspectrumbutton = require("@react-spectrum/button");
@@ -54,8 +54,8 @@ const $6c5bd1047ecc310e$export$fde44257752a9f60 = {
54
54
  negative: (0, ($parcel$interopDefault($8Jify$spectrumiconsuiAlertMedium))),
55
55
  positive: (0, ($parcel$interopDefault($8Jify$spectrumiconsuiSuccessMedium)))
56
56
  };
57
- function $6c5bd1047ecc310e$var$Toast(props, ref) {
58
- let { toast: { key: key, animation: animation, content: { children: children, variant: variant, actionLabel: actionLabel, onAction: onAction, shouldCloseOnAction: shouldCloseOnAction } }, state: state, ...otherProps } = props;
57
+ const $6c5bd1047ecc310e$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, ($parcel$interopDefault($8Jify$react))).forwardRef(function Toast(props, ref) {
58
+ let { toast: { key: key, content: { children: children, variant: variant, actionLabel: actionLabel, onAction: onAction, shouldCloseOnAction: shouldCloseOnAction } }, state: state, ...otherProps } = props;
59
59
  let domRef = (0, $8Jify$reactspectrumutils.useDOMRef)(ref);
60
60
  let { closeButtonProps: closeButtonProps, titleProps: titleProps, toastProps: toastProps, contentProps: contentProps } = (0, $8Jify$reactariatoast.useToast)(props, state, domRef);
61
61
  let { styleProps: styleProps } = (0, $8Jify$reactspectrumutils.useStyleProps)(otherProps);
@@ -76,15 +76,7 @@ function $6c5bd1047ecc310e$var$Toast(props, ref) {
76
76
  ['spectrum-Toast--' + variant]: variant
77
77
  }, styleProps.className, (0, $8Jify$reactspectrumutils.classNames)((0, ($parcel$interopDefault($e20782d0579ed886$exports))), 'spectrum-Toast', {
78
78
  'focus-ring': isFocusVisible
79
- })),
80
- style: {
81
- ...styleProps.style,
82
- zIndex: props.toast.priority
83
- },
84
- "data-animation": animation,
85
- onAnimationEnd: ()=>{
86
- if (animation === 'exiting') state.remove(key);
87
- }
79
+ }))
88
80
  }, /*#__PURE__*/ (0, ($parcel$interopDefault($8Jify$react))).createElement("div", {
89
81
  ...contentProps,
90
82
  className: (0, $8Jify$reactspectrumutils.classNames)((0, ($parcel$interopDefault($e20782d0579ed886$exports))), 'spectrum-Toast-contentWrapper')
@@ -109,8 +101,7 @@ function $6c5bd1047ecc310e$var$Toast(props, ref) {
109
101
  ...closeButtonProps,
110
102
  variant: "overBackground"
111
103
  }, /*#__PURE__*/ (0, ($parcel$interopDefault($8Jify$react))).createElement((0, ($parcel$interopDefault($8Jify$spectrumiconsuiCrossMedium))), null))));
112
- }
113
- let $6c5bd1047ecc310e$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, ($parcel$interopDefault($8Jify$react))).forwardRef($6c5bd1047ecc310e$var$Toast);
104
+ });
114
105
 
115
106
 
116
107
  //# sourceMappingURL=Toast.main.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAkCM,MAAM,4CAAQ;IACnB,MAAM,CAAA,GAAA,0DAAS;IACf,UAAU,CAAA,GAAA,2DAAU;IACpB,UAAU,CAAA,GAAA,6DAAY;AACxB;AAEA,SAAS,4BAAM,KAAyB,EAAE,GAA2B;IACnE,IAAI,EACF,OAAO,OACL,GAAG,aACH,SAAS,EACT,SAAS,YACP,QAAQ,WACR,OAAO,eACP,WAAW,YACX,QAAQ,uBACR,mBAAmB,EACpB,EACF,SACD,KAAK,EACL,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,oBACF,gBAAgB,cAChB,UAAU,cACV,UAAU,gBACV,YAAY,EACb,GAAG,CAAA,GAAA,8BAAO,EAAE,OAA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AA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAA2B,MAAK;QAAgB,GAAG,UAAU;OAAG,WAClG,6BACC,0DAAC,CAAA,GAAA,iCAAK;QACJ,SAAS;QACT,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QACrC,SAAQ;QACR,aAAY;OACX,8BAKT,0DAAC;QAAI,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;qBACjC,0DAAC,CAAA,GAAA,sCAAU;QAAG,GAAG,gBAAgB;QAAE,SAAQ;qBACzC,0DAAC,CAAA,GAAA,2DAAU;AAKrB;AAEA,IAAI,0DAAS,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/toast/src/Toast.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport {Button, ClearButton} from '@react-spectrum/button';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport CrossMedium from '@spectrum-icons/ui/CrossMedium';\nimport {DOMProps, DOMRef} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport InfoMedium from '@spectrum-icons/ui/InfoMedium';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {QueuedToast, ToastState} from '@react-stately/toast';\nimport React from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/toast/vars.css';\nimport SuccessMedium from '@spectrum-icons/ui/SuccessMedium';\nimport toastContainerStyles from './toastContainer.css';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useToast} from '@react-aria/toast';\n\nexport interface SpectrumToastValue extends DOMProps {\n children: string,\n variant: 'positive' | 'negative' | 'info' | 'neutral',\n actionLabel?: string,\n onAction?: () => void,\n shouldCloseOnAction?: boolean\n}\n\nexport interface SpectrumToastProps {\n toast: QueuedToast<SpectrumToastValue>,\n state: ToastState<SpectrumToastValue>\n}\n\n// TODO: express should use filled icons...\nexport const ICONS = {\n info: InfoMedium,\n negative: AlertMedium,\n positive: SuccessMedium\n};\n\nfunction Toast(props: SpectrumToastProps, ref: DOMRef<HTMLDivElement>) {\n let {\n toast: {\n key,\n animation,\n content: {\n children,\n variant,\n actionLabel,\n onAction,\n shouldCloseOnAction\n }\n },\n state,\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let {\n closeButtonProps,\n titleProps,\n toastProps,\n contentProps\n } = useToast(props, state, domRef);\n let {styleProps} = useStyleProps(otherProps);\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/toast');\n let iconLabel = variant && variant !== 'neutral' ? stringFormatter.format(variant) : null;\n let Icon = ICONS[variant];\n let {isFocusVisible, focusProps} = useFocusRing();\n\n const handleAction = () => {\n if (onAction) {\n onAction();\n }\n\n if (shouldCloseOnAction) {\n state.close(key);\n }\n };\n\n return (\n <div\n {...styleProps}\n {...mergeProps(toastProps, focusProps)}\n {...filterDOMProps(props.toast.content)}\n ref={domRef}\n className={classNames(styles,\n 'spectrum-Toast',\n {['spectrum-Toast--' + variant]: variant},\n styleProps.className,\n classNames(\n toastContainerStyles,\n 'spectrum-Toast',\n {'focus-ring': isFocusVisible}\n )\n )}\n style={{\n ...styleProps.style,\n zIndex: props.toast.priority\n }}\n data-animation={animation}\n onAnimationEnd={() => {\n if (animation === 'exiting') {\n state.remove(key);\n }\n }}>\n <div\n {...contentProps}\n className={classNames(toastContainerStyles, 'spectrum-Toast-contentWrapper')}>\n {Icon &&\n <Icon\n aria-label={iconLabel}\n UNSAFE_className={classNames(styles, 'spectrum-Toast-typeIcon')} />\n }\n <div className={classNames(styles, 'spectrum-Toast-body')} role=\"presentation\">\n <div className={classNames(styles, 'spectrum-Toast-content')} role=\"presentation\" {...titleProps}>{children}</div>\n {actionLabel &&\n <Button\n onPress={handleAction}\n UNSAFE_className={classNames(styles, 'spectrum-Button')}\n variant=\"secondary\"\n staticColor=\"white\">\n {actionLabel}\n </Button>\n }\n </div>\n </div>\n <div className={classNames(styles, 'spectrum-Toast-buttons')}>\n <ClearButton {...closeButtonProps} variant=\"overBackground\">\n <CrossMedium />\n </ClearButton>\n </div>\n </div>\n );\n}\n\nlet _Toast = React.forwardRef(Toast);\nexport {_Toast as Toast};\n"],"names":[],"version":3,"file":"Toast.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAkCM,MAAM,4CAAQ;IACnB,MAAM,CAAA,GAAA,0DAAS;IACf,UAAU,CAAA,GAAA,2DAAU;IACpB,UAAU,CAAA,GAAA,6DAAY;AACxB;AAEO,MAAM,0DAAQ,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,MAAM,KAAyB,EAAE,GAA2B;IACzG,IAAI,EACF,OAAO,OACL,GAAG,EACH,SAAS,YACP,QAAQ,WACR,OAAO,eACP,WAAW,YACX,QAAQ,uBACR,mBAAmB,EACpB,EACF,SACD,KAAK,EACL,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,oBACF,gBAAgB,cAChB,UAAU,cACV,UAAU,gBACV,YAAY,EACb,GAAG,CAAA,GAAA,8BAAO,EAAE,OAAO,OAAO;IAC3B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IAEjC,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAA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AA,GAAA,mDAAK,GAAG;qBACjC,0DAAC,CAAA,GAAA,sCAAU;QAAG,GAAG,gBAAgB;QAAE,SAAQ;qBACzC,0DAAC,CAAA,GAAA,2DAAU;AAKrB","sources":["packages/@react-spectrum/toast/src/Toast.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport {Button, ClearButton} from '@react-spectrum/button';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport CrossMedium from '@spectrum-icons/ui/CrossMedium';\nimport {DOMProps, DOMRef} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport InfoMedium from '@spectrum-icons/ui/InfoMedium';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {QueuedToast, ToastState} from '@react-stately/toast';\nimport React from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/toast/vars.css';\nimport SuccessMedium from '@spectrum-icons/ui/SuccessMedium';\nimport toastContainerStyles from './toastContainer.css';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useToast} from '@react-aria/toast';\n\nexport interface SpectrumToastValue extends DOMProps {\n children: string,\n variant: 'positive' | 'negative' | 'info' | 'neutral',\n actionLabel?: string,\n onAction?: () => void,\n shouldCloseOnAction?: boolean\n}\n\nexport interface SpectrumToastProps {\n toast: QueuedToast<SpectrumToastValue>,\n state: ToastState<SpectrumToastValue>\n}\n\n// TODO: express should use filled icons...\nexport const ICONS = {\n info: InfoMedium,\n negative: AlertMedium,\n positive: SuccessMedium\n};\n\nexport const Toast = React.forwardRef(function Toast(props: SpectrumToastProps, ref: DOMRef<HTMLDivElement>) {\n let {\n toast: {\n key,\n content: {\n children,\n variant,\n actionLabel,\n onAction,\n shouldCloseOnAction\n }\n },\n state,\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let {\n closeButtonProps,\n titleProps,\n toastProps,\n contentProps\n } = useToast(props, state, domRef);\n let {styleProps} = useStyleProps(otherProps);\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/toast');\n let iconLabel = variant && variant !== 'neutral' ? stringFormatter.format(variant) : null;\n let Icon = ICONS[variant];\n let {isFocusVisible, focusProps} = useFocusRing();\n\n const handleAction = () => {\n if (onAction) {\n onAction();\n }\n\n if (shouldCloseOnAction) {\n state.close(key);\n }\n };\n\n return (\n <div\n {...styleProps}\n {...mergeProps(toastProps, focusProps)}\n {...filterDOMProps(props.toast.content)}\n ref={domRef}\n className={classNames(styles,\n 'spectrum-Toast',\n {['spectrum-Toast--' + variant]: variant},\n styleProps.className,\n classNames(\n toastContainerStyles,\n 'spectrum-Toast',\n {'focus-ring': isFocusVisible}\n )\n )}>\n <div\n {...contentProps}\n className={classNames(toastContainerStyles, 'spectrum-Toast-contentWrapper')}>\n {Icon &&\n <Icon\n aria-label={iconLabel}\n UNSAFE_className={classNames(styles, 'spectrum-Toast-typeIcon')} />\n }\n <div className={classNames(styles, 'spectrum-Toast-body')} role=\"presentation\">\n <div className={classNames(styles, 'spectrum-Toast-content')} role=\"presentation\" {...titleProps}>{children}</div>\n {actionLabel &&\n <Button\n onPress={handleAction}\n UNSAFE_className={classNames(styles, 'spectrum-Button')}\n variant=\"secondary\"\n staticColor=\"white\">\n {actionLabel}\n </Button>\n }\n </div>\n </div>\n <div className={classNames(styles, 'spectrum-Toast-buttons')}>\n <ClearButton {...closeButtonProps} variant=\"overBackground\">\n <CrossMedium />\n </ClearButton>\n </div>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"Toast.main.js.map"}
package/dist/Toast.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import $iu2Jc$intlStringsmodulejs from "./intlStrings.mjs";
2
- import "./vars.c6e65b7e.css";
2
+ import "./vars.84eec607.css";
3
3
  import $iu2Jc$toast_vars_cssmodulejs from "./toast_vars_css.mjs";
4
- import "./toastContainer.da404f80.css";
4
+ import "./toastContainer.6706a095.css";
5
5
  import $iu2Jc$toastContainer_cssmodulejs from "./toastContainer_css.mjs";
6
6
  import $iu2Jc$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
7
7
  import {Button as $iu2Jc$Button, ClearButton as $iu2Jc$ClearButton} from "@react-spectrum/button";
@@ -48,8 +48,8 @@ const $7e7a2952509f3a56$export$fde44257752a9f60 = {
48
48
  negative: (0, $iu2Jc$spectrumiconsuiAlertMedium),
49
49
  positive: (0, $iu2Jc$spectrumiconsuiSuccessMedium)
50
50
  };
51
- function $7e7a2952509f3a56$var$Toast(props, ref) {
52
- let { toast: { key: key, animation: animation, content: { children: children, variant: variant, actionLabel: actionLabel, onAction: onAction, shouldCloseOnAction: shouldCloseOnAction } }, state: state, ...otherProps } = props;
51
+ const $7e7a2952509f3a56$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $iu2Jc$react).forwardRef(function Toast(props, ref) {
52
+ let { toast: { key: key, content: { children: children, variant: variant, actionLabel: actionLabel, onAction: onAction, shouldCloseOnAction: shouldCloseOnAction } }, state: state, ...otherProps } = props;
53
53
  let domRef = (0, $iu2Jc$useDOMRef)(ref);
54
54
  let { closeButtonProps: closeButtonProps, titleProps: titleProps, toastProps: toastProps, contentProps: contentProps } = (0, $iu2Jc$useToast)(props, state, domRef);
55
55
  let { styleProps: styleProps } = (0, $iu2Jc$useStyleProps)(otherProps);
@@ -70,15 +70,7 @@ function $7e7a2952509f3a56$var$Toast(props, ref) {
70
70
  ['spectrum-Toast--' + variant]: variant
71
71
  }, styleProps.className, (0, $iu2Jc$classNames)((0, ($parcel$interopDefault($iu2Jc$toastContainer_cssmodulejs))), 'spectrum-Toast', {
72
72
  'focus-ring': isFocusVisible
73
- })),
74
- style: {
75
- ...styleProps.style,
76
- zIndex: props.toast.priority
77
- },
78
- "data-animation": animation,
79
- onAnimationEnd: ()=>{
80
- if (animation === 'exiting') state.remove(key);
81
- }
73
+ }))
82
74
  }, /*#__PURE__*/ (0, $iu2Jc$react).createElement("div", {
83
75
  ...contentProps,
84
76
  className: (0, $iu2Jc$classNames)((0, ($parcel$interopDefault($iu2Jc$toastContainer_cssmodulejs))), 'spectrum-Toast-contentWrapper')
@@ -103,8 +95,7 @@ function $7e7a2952509f3a56$var$Toast(props, ref) {
103
95
  ...closeButtonProps,
104
96
  variant: "overBackground"
105
97
  }, /*#__PURE__*/ (0, $iu2Jc$react).createElement((0, $iu2Jc$spectrumiconsuiCrossMedium), null))));
106
- }
107
- let $7e7a2952509f3a56$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $iu2Jc$react).forwardRef($7e7a2952509f3a56$var$Toast);
98
+ });
108
99
 
109
100
 
110
101
  export {$7e7a2952509f3a56$export$fde44257752a9f60 as ICONS, $7e7a2952509f3a56$export$8d8dc7d5f743331b as Toast};
@@ -1,7 +1,7 @@
1
1
  import $iu2Jc$intlStringsmodulejs from "./intlStrings.module.js";
2
- import "./vars.c6e65b7e.css";
2
+ import "./vars.84eec607.css";
3
3
  import $iu2Jc$toast_vars_cssmodulejs from "./toast_vars_css.module.js";
4
- import "./toastContainer.da404f80.css";
4
+ import "./toastContainer.6706a095.css";
5
5
  import $iu2Jc$toastContainer_cssmodulejs from "./toastContainer_css.module.js";
6
6
  import $iu2Jc$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
7
7
  import {Button as $iu2Jc$Button, ClearButton as $iu2Jc$ClearButton} from "@react-spectrum/button";
@@ -48,8 +48,8 @@ const $7e7a2952509f3a56$export$fde44257752a9f60 = {
48
48
  negative: (0, $iu2Jc$spectrumiconsuiAlertMedium),
49
49
  positive: (0, $iu2Jc$spectrumiconsuiSuccessMedium)
50
50
  };
51
- function $7e7a2952509f3a56$var$Toast(props, ref) {
52
- let { toast: { key: key, animation: animation, content: { children: children, variant: variant, actionLabel: actionLabel, onAction: onAction, shouldCloseOnAction: shouldCloseOnAction } }, state: state, ...otherProps } = props;
51
+ const $7e7a2952509f3a56$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $iu2Jc$react).forwardRef(function Toast(props, ref) {
52
+ let { toast: { key: key, content: { children: children, variant: variant, actionLabel: actionLabel, onAction: onAction, shouldCloseOnAction: shouldCloseOnAction } }, state: state, ...otherProps } = props;
53
53
  let domRef = (0, $iu2Jc$useDOMRef)(ref);
54
54
  let { closeButtonProps: closeButtonProps, titleProps: titleProps, toastProps: toastProps, contentProps: contentProps } = (0, $iu2Jc$useToast)(props, state, domRef);
55
55
  let { styleProps: styleProps } = (0, $iu2Jc$useStyleProps)(otherProps);
@@ -70,15 +70,7 @@ function $7e7a2952509f3a56$var$Toast(props, ref) {
70
70
  ['spectrum-Toast--' + variant]: variant
71
71
  }, styleProps.className, (0, $iu2Jc$classNames)((0, ($parcel$interopDefault($iu2Jc$toastContainer_cssmodulejs))), 'spectrum-Toast', {
72
72
  'focus-ring': isFocusVisible
73
- })),
74
- style: {
75
- ...styleProps.style,
76
- zIndex: props.toast.priority
77
- },
78
- "data-animation": animation,
79
- onAnimationEnd: ()=>{
80
- if (animation === 'exiting') state.remove(key);
81
- }
73
+ }))
82
74
  }, /*#__PURE__*/ (0, $iu2Jc$react).createElement("div", {
83
75
  ...contentProps,
84
76
  className: (0, $iu2Jc$classNames)((0, ($parcel$interopDefault($iu2Jc$toastContainer_cssmodulejs))), 'spectrum-Toast-contentWrapper')
@@ -103,8 +95,7 @@ function $7e7a2952509f3a56$var$Toast(props, ref) {
103
95
  ...closeButtonProps,
104
96
  variant: "overBackground"
105
97
  }, /*#__PURE__*/ (0, $iu2Jc$react).createElement((0, $iu2Jc$spectrumiconsuiCrossMedium), null))));
106
- }
107
- let $7e7a2952509f3a56$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $iu2Jc$react).forwardRef($7e7a2952509f3a56$var$Toast);
98
+ });
108
99
 
109
100
 
110
101
  export {$7e7a2952509f3a56$export$fde44257752a9f60 as ICONS, $7e7a2952509f3a56$export$8d8dc7d5f743331b as Toast};
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAkCM,MAAM,4CAAQ;IACnB,MAAM,CAAA,GAAA,gCAAS;IACf,UAAU,CAAA,GAAA,iCAAU;IACpB,UAAU,CAAA,GAAA,mCAAY;AACxB;AAEA,SAAS,4BAAM,KAAyB,EAAE,GAA2B;IACnE,IAAI,EACF,OAAO,OACL,GAAG,aACH,SAAS,EACT,SAAS,YACP,QAAQ,WACR,OAAO,eACP,WAAW,YACX,QAAQ,uBACR,mBAAmB,EACpB,EACF,SACD,KAAK,EACL,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,oBACF,gBAAgB,cAChB,UAAU,cACV,UAAU,gBACV,YAAY,EACb,GAAG,CAAA,GAAA,eAAO,EAAE,OAAO,OAAO;IAC3B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IAEjC,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,YAAY,WAAW,YAAY,YAAY,gBAAgB,MAAM,CAAC,WAAW;IACrF,IAAI,OAAO,yCAAK,CAAC,QAAQ;IACzB,IAAI,kBAAC,cAAc,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,mBAAW;IAE9C,MAAM,eAAe;QACnB,IAAI,UACF;QAGF,IAAI,qBACF,MAAM,KAAK,CAAC;IAEhB;IAEA,qBACE,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,CAAA,G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AI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/toast/src/Toast.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport {Button, ClearButton} from '@react-spectrum/button';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport CrossMedium from '@spectrum-icons/ui/CrossMedium';\nimport {DOMProps, DOMRef} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport InfoMedium from '@spectrum-icons/ui/InfoMedium';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {QueuedToast, ToastState} from '@react-stately/toast';\nimport React from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/toast/vars.css';\nimport SuccessMedium from '@spectrum-icons/ui/SuccessMedium';\nimport toastContainerStyles from './toastContainer.css';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useToast} from '@react-aria/toast';\n\nexport interface SpectrumToastValue extends DOMProps {\n children: string,\n variant: 'positive' | 'negative' | 'info' | 'neutral',\n actionLabel?: string,\n onAction?: () => void,\n shouldCloseOnAction?: boolean\n}\n\nexport interface SpectrumToastProps {\n toast: QueuedToast<SpectrumToastValue>,\n state: ToastState<SpectrumToastValue>\n}\n\n// TODO: express should use filled icons...\nexport const ICONS = {\n info: InfoMedium,\n negative: AlertMedium,\n positive: SuccessMedium\n};\n\nfunction Toast(props: SpectrumToastProps, ref: DOMRef<HTMLDivElement>) {\n let {\n toast: {\n key,\n animation,\n content: {\n children,\n variant,\n actionLabel,\n onAction,\n shouldCloseOnAction\n }\n },\n state,\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let {\n closeButtonProps,\n titleProps,\n toastProps,\n contentProps\n } = useToast(props, state, domRef);\n let {styleProps} = useStyleProps(otherProps);\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/toast');\n let iconLabel = variant && variant !== 'neutral' ? stringFormatter.format(variant) : null;\n let Icon = ICONS[variant];\n let {isFocusVisible, focusProps} = useFocusRing();\n\n const handleAction = () => {\n if (onAction) {\n onAction();\n }\n\n if (shouldCloseOnAction) {\n state.close(key);\n }\n };\n\n return (\n <div\n {...styleProps}\n {...mergeProps(toastProps, focusProps)}\n {...filterDOMProps(props.toast.content)}\n ref={domRef}\n className={classNames(styles,\n 'spectrum-Toast',\n {['spectrum-Toast--' + variant]: variant},\n styleProps.className,\n classNames(\n toastContainerStyles,\n 'spectrum-Toast',\n {'focus-ring': isFocusVisible}\n )\n )}\n style={{\n ...styleProps.style,\n zIndex: props.toast.priority\n }}\n data-animation={animation}\n onAnimationEnd={() => {\n if (animation === 'exiting') {\n state.remove(key);\n }\n }}>\n <div\n {...contentProps}\n className={classNames(toastContainerStyles, 'spectrum-Toast-contentWrapper')}>\n {Icon &&\n <Icon\n aria-label={iconLabel}\n UNSAFE_className={classNames(styles, 'spectrum-Toast-typeIcon')} />\n }\n <div className={classNames(styles, 'spectrum-Toast-body')} role=\"presentation\">\n <div className={classNames(styles, 'spectrum-Toast-content')} role=\"presentation\" {...titleProps}>{children}</div>\n {actionLabel &&\n <Button\n onPress={handleAction}\n UNSAFE_className={classNames(styles, 'spectrum-Button')}\n variant=\"secondary\"\n staticColor=\"white\">\n {actionLabel}\n </Button>\n }\n </div>\n </div>\n <div className={classNames(styles, 'spectrum-Toast-buttons')}>\n <ClearButton {...closeButtonProps} variant=\"overBackground\">\n <CrossMedium />\n </ClearButton>\n </div>\n </div>\n );\n}\n\nlet _Toast = React.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AAE,CAAA,GAAA,uDAAK,GACzB,kBACA;YAAC,CAAC,qBAAqB,QAAQ,EAAE;QAAO,GACxC,WAAW,SAAS,EACpB,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,2DAAmB,GACnB,kBACA;YAAC,cAAc;QAAc;qBAGjC,gCAAC;QACE,GAAG,YAAY;QAChB,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,2DAAmB,GAAG;OAC3C,sBACC,gCAAC;QACC,cAAY;QACZ,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,uDAAK,GAAG;sBAEzC,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,uDAAK,GAAG;QAAwB,MAAK;qBAC9D,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,uDAAK,GAAG;QAA2B,MAAK;QAAgB,GAAG,UAAU;OAAG,WAClG,6BACC,gCAAC,CAAA,GAAA,aAAK;QACJ,SAAS;QACT,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,uDAAK,GAAG;QACrC,SAAQ;QACR,aAAY;OACX,8BAKT,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,uDAAK,GAAG;qBACjC,gCAAC,CAAA,GAAA,kBAAU;QAAG,GAAG,gBAAgB;QAAE,SAAQ;qBACzC,gCAAC,CAAA,GAAA,iCAAU;AAKrB","sources":["packages/@react-spectrum/toast/src/Toast.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport {Button, ClearButton} from '@react-spectrum/button';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport CrossMedium from '@spectrum-icons/ui/CrossMedium';\nimport {DOMProps, DOMRef} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport InfoMedium from '@spectrum-icons/ui/InfoMedium';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {QueuedToast, ToastState} from '@react-stately/toast';\nimport React from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/toast/vars.css';\nimport SuccessMedium from '@spectrum-icons/ui/SuccessMedium';\nimport toastContainerStyles from './toastContainer.css';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useToast} from '@react-aria/toast';\n\nexport interface SpectrumToastValue extends DOMProps {\n children: string,\n variant: 'positive' | 'negative' | 'info' | 'neutral',\n actionLabel?: string,\n onAction?: () => void,\n shouldCloseOnAction?: boolean\n}\n\nexport interface SpectrumToastProps {\n toast: QueuedToast<SpectrumToastValue>,\n state: ToastState<SpectrumToastValue>\n}\n\n// TODO: express should use filled icons...\nexport const ICONS = {\n info: InfoMedium,\n negative: AlertMedium,\n positive: SuccessMedium\n};\n\nexport const Toast = React.forwardRef(function Toast(props: SpectrumToastProps, ref: DOMRef<HTMLDivElement>) {\n let {\n toast: {\n key,\n content: {\n children,\n variant,\n actionLabel,\n onAction,\n shouldCloseOnAction\n }\n },\n state,\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let {\n closeButtonProps,\n titleProps,\n toastProps,\n contentProps\n } = useToast(props, state, domRef);\n let {styleProps} = useStyleProps(otherProps);\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/toast');\n let iconLabel = variant && variant !== 'neutral' ? stringFormatter.format(variant) : null;\n let Icon = ICONS[variant];\n let {isFocusVisible, focusProps} = useFocusRing();\n\n const handleAction = () => {\n if (onAction) {\n onAction();\n }\n\n if (shouldCloseOnAction) {\n state.close(key);\n }\n };\n\n return (\n <div\n {...styleProps}\n {...mergeProps(toastProps, focusProps)}\n {...filterDOMProps(props.toast.content)}\n ref={domRef}\n className={classNames(styles,\n 'spectrum-Toast',\n {['spectrum-Toast--' + variant]: variant},\n styleProps.className,\n classNames(\n toastContainerStyles,\n 'spectrum-Toast',\n {'focus-ring': isFocusVisible}\n )\n )}>\n <div\n {...contentProps}\n className={classNames(toastContainerStyles, 'spectrum-Toast-contentWrapper')}>\n {Icon &&\n <Icon\n aria-label={iconLabel}\n UNSAFE_className={classNames(styles, 'spectrum-Toast-typeIcon')} />\n }\n <div className={classNames(styles, 'spectrum-Toast-body')} role=\"presentation\">\n <div className={classNames(styles, 'spectrum-Toast-content')} role=\"presentation\" {...titleProps}>{children}</div>\n {actionLabel &&\n <Button\n onPress={handleAction}\n UNSAFE_className={classNames(styles, 'spectrum-Button')}\n variant=\"secondary\"\n staticColor=\"white\">\n {actionLabel}\n </Button>\n }\n </div>\n </div>\n <div className={classNames(styles, 'spectrum-Toast-buttons')}>\n <ClearButton {...closeButtonProps} variant=\"overBackground\">\n <CrossMedium />\n </ClearButton>\n </div>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"Toast.module.js.map"}
@@ -1,9 +1,10 @@
1
1
  var $6c5bd1047ecc310e$exports = require("./Toast.main.js");
2
- require("./toastContainer.da404f80.css");
2
+ require("./toastContainer.6706a095.css");
3
3
  var $e20782d0579ed886$exports = require("./toastContainer_css.main.js");
4
4
  var $5b9f2c86c1b1395c$exports = require("./Toaster.main.js");
5
5
  var $5IVGU$reactspectrumutils = require("@react-spectrum/utils");
6
6
  var $5IVGU$reactariautils = require("@react-aria/utils");
7
+ var $5IVGU$reactdom = require("react-dom");
7
8
  var $5IVGU$react = require("react");
8
9
  var $5IVGU$reactstatelytoast = require("@react-stately/toast");
9
10
  var $5IVGU$usesyncexternalstoreshimindexjs = require("use-sync-external-store/shim/index.js");
@@ -37,12 +38,19 @@ $parcel$export(module.exports, "ToastQueue", () => $56cdf77f3be52eaf$export$f1f8
37
38
 
38
39
 
39
40
 
41
+
42
+ function $56cdf77f3be52eaf$var$wrapInViewTransition(fn) {
43
+ if ('startViewTransition' in document) document.startViewTransition(()=>{
44
+ (0, $5IVGU$reactdom.flushSync)(fn);
45
+ }).ready.catch(()=>{});
46
+ else fn();
47
+ }
40
48
  // There is a single global toast queue instance for the whole app, initialized lazily.
41
49
  let $56cdf77f3be52eaf$var$globalToastQueue = null;
42
50
  function $56cdf77f3be52eaf$var$getGlobalToastQueue() {
43
51
  if (!$56cdf77f3be52eaf$var$globalToastQueue) $56cdf77f3be52eaf$var$globalToastQueue = new (0, $5IVGU$reactstatelytoast.ToastQueue)({
44
52
  maxVisibleToasts: Infinity,
45
- hasExitAnimation: true
53
+ wrapUpdate: $56cdf77f3be52eaf$var$wrapInViewTransition
46
54
  });
47
55
  return $56cdf77f3be52eaf$var$globalToastQueue;
48
56
  }
@@ -69,15 +77,11 @@ function $56cdf77f3be52eaf$export$f2815235e76a62b9(props) {
69
77
  // Only the first one will actually render.
70
78
  // We use a ref to do this, since it will have a stable identity
71
79
  // over the lifetime of the component.
72
- let ref = (0, $5IVGU$react.useRef)(undefined);
73
- // eslint-disable-next-line arrow-body-style
80
+ let ref = (0, $5IVGU$react.useRef)(null);
74
81
  (0, $5IVGU$react.useEffect)(()=>{
75
82
  $56cdf77f3be52eaf$var$toastProviders.add(ref);
76
83
  $56cdf77f3be52eaf$var$triggerSubscriptions();
77
84
  return ()=>{
78
- // When this toast provider unmounts, reset all animations so that
79
- // when the new toast provider renders, it is seamless.
80
- for (let toast of $56cdf77f3be52eaf$var$getGlobalToastQueue().visibleToasts)toast.animation = null;
81
85
  // Remove this toast provider, and call subscriptions.
82
86
  // This will cause all other instances to re-render,
83
87
  // and the first one to become the new active toast provider.
@@ -88,18 +92,39 @@ function $56cdf77f3be52eaf$export$f2815235e76a62b9(props) {
88
92
  // Only render if this is the active toast provider instance, and there are visible toasts.
89
93
  let activeToastContainer = $56cdf77f3be52eaf$var$useActiveToastContainer();
90
94
  let state = (0, $5IVGU$reactstatelytoast.useToastQueue)($56cdf77f3be52eaf$var$getGlobalToastQueue());
95
+ let { placement: placement, isCentered: isCentered } = (0, $5IVGU$react.useMemo)(()=>{
96
+ var _props_placement;
97
+ let placements = ((_props_placement = props.placement) !== null && _props_placement !== void 0 ? _props_placement : 'bottom').split(' ');
98
+ let placement = placements[placements.length - 1];
99
+ let isCentered = placements.length === 1;
100
+ return {
101
+ placement: placement,
102
+ isCentered: isCentered
103
+ };
104
+ }, [
105
+ props.placement
106
+ ]);
91
107
  if (ref === activeToastContainer && state.visibleToasts.length > 0) return /*#__PURE__*/ (0, ($parcel$interopDefault($5IVGU$react))).createElement((0, $5b9f2c86c1b1395c$exports.Toaster), {
92
108
  state: state,
93
109
  ...props
94
110
  }, /*#__PURE__*/ (0, ($parcel$interopDefault($5IVGU$react))).createElement("ol", {
95
111
  className: (0, $5IVGU$reactspectrumutils.classNames)((0, ($parcel$interopDefault($e20782d0579ed886$exports))), 'spectrum-ToastContainer-list')
96
- }, state.visibleToasts.slice().reverse().map((toast)=>/*#__PURE__*/ (0, ($parcel$interopDefault($5IVGU$react))).createElement("li", {
112
+ }, state.visibleToasts.map((toast, index)=>{
113
+ let shouldFade = isCentered && index !== 0;
114
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($5IVGU$react))).createElement("li", {
97
115
  key: toast.key,
98
- className: (0, $5IVGU$reactspectrumutils.classNames)((0, ($parcel$interopDefault($e20782d0579ed886$exports))), 'spectrum-ToastContainer-listitem')
116
+ className: (0, $5IVGU$reactspectrumutils.classNames)((0, ($parcel$interopDefault($e20782d0579ed886$exports))), 'spectrum-ToastContainer-listitem'),
117
+ style: {
118
+ viewTransitionName: toast.key,
119
+ viewTransitionClass: (0, $5IVGU$reactspectrumutils.classNames)((0, ($parcel$interopDefault($e20782d0579ed886$exports))), 'toast', placement, {
120
+ 'fadeOnly': shouldFade
121
+ })
122
+ }
99
123
  }, /*#__PURE__*/ (0, ($parcel$interopDefault($5IVGU$react))).createElement((0, $6c5bd1047ecc310e$exports.Toast), {
100
124
  toast: toast,
101
125
  state: state
102
- })))));
126
+ }));
127
+ })));
103
128
  return null;
104
129
  }
105
130
  function $56cdf77f3be52eaf$var$addToast(children, variant, options = {}) {
@@ -115,7 +140,7 @@ function $56cdf77f3be52eaf$var$addToast(children, variant, options = {}) {
115
140
  }
116
141
  });
117
142
  let shouldContinue = window.dispatchEvent(event);
118
- if (!shouldContinue) return;
143
+ if (!shouldContinue) return ()=>{};
119
144
  }
120
145
  let value = {
121
146
  children: children,
@@ -128,7 +153,7 @@ function $56cdf77f3be52eaf$var$addToast(children, variant, options = {}) {
128
153
  // Minimum time of 5s from https://spectrum.adobe.com/page/toast/#Auto-dismissible
129
154
  // Actionable toasts cannot be auto dismissed. That would fail WCAG SC 2.2.1.
130
155
  // It is debatable whether non-actionable toasts would also fail.
131
- let timeout = options.timeout && !options.onAction ? Math.max(options.timeout, 5000) : null;
156
+ let timeout = options.timeout && !options.onAction ? Math.max(options.timeout, 5000) : undefined;
132
157
  let queue = $56cdf77f3be52eaf$var$getGlobalToastQueue();
133
158
  let key = queue.add(value, {
134
159
  timeout: timeout,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AA0BD,uFAAuF;AACvF,IAAI,yCAA0D;AAC9D,SAAS;IACP,IAAI,CAAC,wCACH,yCAAmB,IAAI,CAAA,GAAA,mCAAS,EAAE;QAChC,kBAAkB;QAClB,kBAAkB;IACpB;IAGF,OAAO;AACT;AAGO,SAAS;IACd,yCAAmB;AACrB;AAEA,IAAI,uCAAiB,IAAI;AACzB,IAAI,sCAAgB,IAAI;AACxB,SAAS,gCAAU,EAAc;IAC/B,oCAAc,GAAG,CAAC;IAClB,OAAO,IAAM,oCAAc,MAAM,CAAC;AACpC;AAEA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gB,eAAe,OAAO,WAAW,aAAa;QACvE,IAAI,QAAQ,IAAI,YAAY,wBAAwB;YAClD,YAAY;YACZ,SAAS;YACT,QAAQ;0BACN;yBACA;yBACA;YACF;QACF;QAEA,IAAI,iBAAiB,OAAO,aAAa,CAAC;QAC1C,IAAI,CAAC,gBACH;IAEJ;IAEA,IAAI,QAAQ;kBACV;iBACA;QACA,aAAa,QAAQ,WAAW;QAChC,UAAU,QAAQ,QAAQ;QAC1B,qBAAqB,QAAQ,mBAAmB;QAChD,GAAG,CAAA,GAAA,oCAAa,EAAE,QAAQ;IAC5B;IAEA,kFAAkF;IAClF,6EAA6E;IAC7E,iEAAiE;IACjE,IAAI,UAAU,QAAQ,OAAO,IAAI,CAAC,QAAQ,QAAQ,GAAG,KAAK,GAAG,CAAC,QAAQ,OAAO,EAAE,QAAQ;IACvF,IAAI,QAAQ;IACZ,IAAI,MAAM,MAAM,GAAG,CAAC,OAAO;iBAAC;QAAS,SAAS,QAAQ,OAAO;IAAA;IAC7D,OAAO,IAAM,MAAM,KAAK,CAAC;AAC3B;AAEA,MAAM,4CAAqB;IACzB,4BAA4B,GAC5B,SAAQ,QAAgB,EAAE,UAAgC,CAAC,CAAC;QAC1D,OAAO,+BAAS,UAAU,WAAW;IACvC;IACA,6BAA6B,GAC7B,UAAS,QAAgB,EAAE,UAAgC,CAAC,CAAC;QAC3D,OAAO,+BAAS,UAAU,YAAY;IACxC;IACA,6BAA6B,GAC7B,UAAS,QAAgB,EAAE,UAAgC,CAAC,CAAC;QAC3D,OAAO,+BAAS,UAAU,YAAY;IACxC;IACA,mCAAmC,GACnC,MAAK,QAAgB,EAAE,UAAgC,CAAC,CAAC;QACvD,OAAO,+BAAS,UAAU,QAAQ;IACpC;AACF","sources":["packages/@react-spectrum/toast/src/ToastContainer.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaToastRegionProps} from '@react-aria/toast';\nimport {classNames} from '@react-spectrum/utils';\nimport {DOMProps} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport React, {ReactElement, useEffect, useRef} from 'react';\nimport {SpectrumToastValue, Toast} from './Toast';\nimport toastContainerStyles from './toastContainer.css';\nimport {Toaster} from './Toaster';\nimport {ToastOptions, ToastQueue, useToastQueue} from '@react-stately/toast';\nimport {useSyncExternalStore} from 'use-sync-external-store/shim/index.js';\n\nexport interface SpectrumToastContainerProps extends AriaToastRegionProps {}\n\nexport interface SpectrumToastOptions extends Omit<ToastOptions, 'priority'>, DOMProps {\n /** A label for the action button within the toast. */\n actionLabel?: string,\n /** Handler that is called when the action button is pressed. */\n onAction?: () => void,\n /** Whether the toast should automatically close when an action is performed. */\n shouldCloseOnAction?: boolean\n}\n\ntype CloseFunction = () => void;\n\n// There is a single global toast queue instance for the whole app, initialized lazily.\nlet globalToastQueue: ToastQueue<SpectrumToastValue> | null = null;\nfunction getGlobalToastQueue() {\n if (!globalToastQueue) {\n globalToastQueue = new ToastQueue({\n maxVisibleToasts: Infinity,\n hasExitAnimation: true\n });\n }\n\n return globalToastQueue;\n}\n\n// For testing. Not exported from the package index.\nexport function clearToastQueue() {\n globalToastQueue = null;\n}\n\nlet toastProviders = new Set();\nlet subscriptions = new Set<() => void>();\nfunction subscribe(fn: () => void) {\n subscriptions.add(fn);\n return () => subscriptions.delete(fn);\n}\n\nfunction triggerSubscriptions() {\n for (let fn of subscriptions) {\n fn();\n }\n}\n\nfunction getActiveToastContainer() {\n return toastProviders.values().next().value;\n}\n\nfunction useActiveToastContainer() {\n return useSyncExternalStore(subscribe, getActiveToastContainer, getActiveToastContainer);\n}\n\n/**\n * A ToastContainer renders the queued toasts in an application. It should be placed\n * at the root of the app.\n */\nexport function ToastContainer(props: SpectrumToastContainerProps): ReactElement {\n // Track all toast provider instances in a set.\n // Only the first one will actually render.\n // We use a ref to do this, since it will have a stable identity\n // over the lifetime of the component.\n let ref = useRef(undefined);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n toastProviders.add(ref);\n triggerSubscriptions();\n\n return () => {\n // When this toast provider unmounts, reset all animations so that\n // when the new toast provider renders, it is seamless.\n for (let toast of getGlobalToastQueue().visibleToasts) {\n toast.animation = null;\n }\n\n // Remove this toast provider, and call subscriptions.\n // This will cause all other instances to re-render,\n // and the first one to become the new active toast provider.\n toastProviders.delete(ref);\n triggerSubscriptions();\n };\n }, []);\n\n // Only render if this is the active toast provider instance, and there are visible toasts.\n let activeToastContainer = useActiveToastContainer();\n let state = useToastQueue(getGlobalToastQueue());\n\n if (ref === activeToastContainer && state.visibleToasts.length > 0) {\n return (\n <Toaster state={state} {...props}>\n <ol className={classNames(toastContainerStyles, 'spectrum-ToastContainer-list')}>\n {state.visibleToasts.slice().reverse().map((toast) => (\n <li\n key={toast.key}\n className={classNames(toastContainerStyles, 'spectrum-ToastContainer-listitem')}>\n <Toast\n toast={toast}\n state={state} />\n </li>\n ))}\n </ol>\n </Toaster>\n );\n }\n\n return null;\n}\n\nfunction addToast(children: string, variant: SpectrumToastValue['variant'], options: SpectrumToastOptions = {}) {\n // Dispatch a custom event so that toasts can be intercepted and re-targeted, e.g. when inside an iframe.\n if (typeof CustomEvent !== 'undefined' && typeof window !== 'undefined') {\n let event = new CustomEvent('react-spectrum-toast', {\n cancelable: true,\n bubbles: true,\n detail: {\n children,\n variant,\n options\n }\n });\n\n let shouldContinue = window.dispatchEvent(event);\n if (!shouldContinue) {\n return;\n }\n }\n\n let value = {\n children,\n variant,\n actionLabel: options.actionLabel,\n onAction: options.onAction,\n shouldCloseOnAction: options.shouldCloseOnAction,\n ...filterDOMProps(options)\n };\n\n // Minimum time of 5s from https://spectrum.adobe.com/page/toast/#Auto-dismissible\n // Actionable toasts cannot be auto dismissed. That would fail WCAG SC 2.2.1.\n // It is debatable whether non-actionable toasts would also fail.\n let timeout = options.timeout && !options.onAction ? Math.max(options.timeout, 5000) : null;\n let queue = getGlobalToastQueue();\n let key = queue.add(value, {timeout, onClose: options.onClose});\n return () => queue.close(key);\n}\n\nconst SpectrumToastQueue = {\n /** Queues a neutral toast. */\n neutral(children: string, options: SpectrumToastOptions = {}): CloseFunction {\n return addToast(children, 'neutral', options);\n },\n /** Queues a positive toast. */\n positive(children: string, options: SpectrumToastOptions = {}): CloseFunction {\n return addToast(children, 'positive', options);\n },\n /** Queues a negative toast. */\n negative(children: string, options: SpectrumToastOptions = {}): CloseFunction {\n return addToast(children, 'negative', options);\n },\n /** Queues an informational toast. */\n info(children: string, options: SpectrumToastOptions = {}): CloseFunction {\n return addToast(children, 'info', options);\n }\n};\n\nexport {SpectrumToastQueue as ToastQueue};\n"],"names":[],"version":3,"file":"ToastContainer.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA+BD,SAAS,2CAAqB,EAAc;IAC1C,IAAI,yBAAyB,UAC3B,SAAS,mBAAmB,CAAC;QAC3B,CAAA,GAAA,yBAAQ,EAAE;IACZ,GAAG,KAAK,CAAC,KAAK,CAAC,KAAO;SAEtB;AAEJ;AAEA,uFAAuF;AACvF,IAAI,yCAA0D;AAC9D,SAAS;IACP,IAAI,CAAC,wCACH,yCAAmB,IAAI,CAAA,GAAA,mCAAS,EAAE;QAChC,kBAAkB;QAClB,YAAY;IACd;IAGF,OAAO;AACT;AAGO,SAAS;IACd,yCAAmB;AACrB;AAEA,IAAI,uCAAiB,IAAI;AACzB,IAAI,sCAAgB,IAAI;AACxB,SAAS,gCAAU,EAAc;IAC/B,oCAAc,GAAG,CAAC;IAClB,OAAO,IAAM,oCAAc,MAAM,CAAC;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,QAAgB,EAAE,UAAgC,CAAC,CAAC;QAC3D,OAAO,+BAAS,UAAU,YAAY;IACxC;IACA,6BAA6B,GAC7B,UAAS,QAAgB,EAAE,UAAgC,CAAC,CAAC;QAC3D,OAAO,+BAAS,UAAU,YAAY;IACxC;IACA,mCAAmC,GACnC,MAAK,QAAgB,EAAE,UAAgC,CAAC,CAAC;QACvD,OAAO,+BAAS,UAAU,QAAQ;IACpC;AACF","sources":["packages/@react-spectrum/toast/src/ToastContainer.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaToastRegionProps} from '@react-aria/toast';\nimport {classNames} from '@react-spectrum/utils';\nimport {DOMProps} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {flushSync} from 'react-dom';\nimport React, {ReactElement, useEffect, useMemo, useRef} from 'react';\nimport {SpectrumToastValue, Toast} from './Toast';\nimport toastContainerStyles from './toastContainer.css';\nimport {Toaster} from './Toaster';\nimport {ToastOptions, ToastQueue, useToastQueue} from '@react-stately/toast';\nimport {useSyncExternalStore} from 'use-sync-external-store/shim/index.js';\n\nexport type ToastPlacement = 'top' | 'top end' | 'bottom' | 'bottom end';\n\nexport interface SpectrumToastContainerProps extends AriaToastRegionProps {\n placement?: ToastPlacement\n}\n\nexport interface SpectrumToastOptions extends ToastOptions, DOMProps {\n /** A label for the action button within the toast. */\n actionLabel?: string,\n /** Handler that is called when the action button is pressed. */\n onAction?: () => void,\n /** Whether the toast should automatically close when an action is performed. */\n shouldCloseOnAction?: boolean\n}\n\ntype CloseFunction = () => void;\n\nfunction wrapInViewTransition(fn: () => void): void {\n if ('startViewTransition' in document) {\n document.startViewTransition(() => {\n flushSync(fn);\n }).ready.catch(() => {});\n } else {\n fn();\n }\n}\n\n// There is a single global toast queue instance for the whole app, initialized lazily.\nlet globalToastQueue: ToastQueue<SpectrumToastValue> | null = null;\nfunction getGlobalToastQueue() {\n if (!globalToastQueue) {\n globalToastQueue = new ToastQueue({\n maxVisibleToasts: Infinity,\n wrapUpdate: wrapInViewTransition\n });\n }\n\n return globalToastQueue;\n}\n\n// For testing. Not exported from the package index.\nexport function clearToastQueue() {\n globalToastQueue = null;\n}\n\nlet toastProviders = new Set();\nlet subscriptions = new Set<() => void>();\nfunction subscribe(fn: () => void) {\n subscriptions.add(fn);\n return () => subscriptions.delete(fn);\n}\n\nfunction triggerSubscriptions() {\n for (let fn of subscriptions) {\n fn();\n }\n}\n\nfunction getActiveToastContainer() {\n return toastProviders.values().next().value;\n}\n\nfunction useActiveToastContainer() {\n return useSyncExternalStore(subscribe, getActiveToastContainer, getActiveToastContainer);\n}\n\n/**\n * A ToastContainer renders the queued toasts in an application. It should be placed\n * at the root of the app.\n */\nexport function ToastContainer(props: SpectrumToastContainerProps): ReactElement | null {\n // Track all toast provider instances in a set.\n // Only the first one will actually render.\n // We use a ref to do this, since it will have a stable identity\n // over the lifetime of the component.\n let ref = useRef(null);\n\n\n useEffect(() => {\n toastProviders.add(ref);\n triggerSubscriptions();\n\n return () => {\n // Remove this toast provider, and call subscriptions.\n // This will cause all other instances to re-render,\n // and the first one to become the new active toast provider.\n toastProviders.delete(ref);\n triggerSubscriptions();\n };\n }, []);\n\n // Only render if this is the active toast provider instance, and there are visible toasts.\n let activeToastContainer = useActiveToastContainer();\n let state = useToastQueue(getGlobalToastQueue());\n\n let {placement, isCentered} = useMemo(() => {\n let placements = (props.placement ?? 'bottom').split(' ');\n let placement = placements[placements.length - 1];\n let isCentered = placements.length === 1;\n return {placement, isCentered};\n }, [props.placement]);\n\n if (ref === activeToastContainer && state.visibleToasts.length > 0) {\n return (\n <Toaster state={state} {...props}>\n <ol className={classNames(toastContainerStyles, 'spectrum-ToastContainer-list')}>\n {state.visibleToasts.map((toast, index) => {\n let shouldFade = isCentered && index !== 0;\n return (\n <li\n key={toast.key}\n className={classNames(toastContainerStyles, 'spectrum-ToastContainer-listitem')}\n style={{\n viewTransitionName: toast.key,\n viewTransitionClass: classNames(\n toastContainerStyles,\n 'toast',\n placement,\n {'fadeOnly': shouldFade}\n )\n }}>\n <Toast\n toast={toast}\n state={state} />\n </li>\n );\n })}\n </ol>\n </Toaster>\n );\n }\n\n return null;\n}\n\nfunction addToast(children: string, variant: SpectrumToastValue['variant'], options: SpectrumToastOptions = {}) {\n // Dispatch a custom event so that toasts can be intercepted and re-targeted, e.g. when inside an iframe.\n if (typeof CustomEvent !== 'undefined' && typeof window !== 'undefined') {\n let event = new CustomEvent('react-spectrum-toast', {\n cancelable: true,\n bubbles: true,\n detail: {\n children,\n variant,\n options\n }\n });\n\n let shouldContinue = window.dispatchEvent(event);\n if (!shouldContinue) {\n return () => {};\n }\n }\n\n let value = {\n children,\n variant,\n actionLabel: options.actionLabel,\n onAction: options.onAction,\n shouldCloseOnAction: options.shouldCloseOnAction,\n ...filterDOMProps(options)\n };\n\n // Minimum time of 5s from https://spectrum.adobe.com/page/toast/#Auto-dismissible\n // Actionable toasts cannot be auto dismissed. That would fail WCAG SC 2.2.1.\n // It is debatable whether non-actionable toasts would also fail.\n let timeout = options.timeout && !options.onAction ? Math.max(options.timeout, 5000) : undefined;\n let queue = getGlobalToastQueue();\n let key = queue.add(value, {timeout, onClose: options.onClose});\n return () => queue.close(key);\n}\n\nconst SpectrumToastQueue = {\n /** Queues a neutral toast. */\n neutral(children: string, options: SpectrumToastOptions = {}): CloseFunction {\n return addToast(children, 'neutral', options);\n },\n /** Queues a positive toast. */\n positive(children: string, options: SpectrumToastOptions = {}): CloseFunction {\n return addToast(children, 'positive', options);\n },\n /** Queues a negative toast. */\n negative(children: string, options: SpectrumToastOptions = {}): CloseFunction {\n return addToast(children, 'negative', options);\n },\n /** Queues an informational toast. */\n info(children: string, options: SpectrumToastOptions = {}): CloseFunction {\n return addToast(children, 'info', options);\n }\n};\n\nexport {SpectrumToastQueue as ToastQueue};\n"],"names":[],"version":3,"file":"ToastContainer.main.js.map"}
@@ -1,10 +1,11 @@
1
1
  import {Toast as $7e7a2952509f3a56$export$8d8dc7d5f743331b} from "./Toast.mjs";
2
- import "./toastContainer.da404f80.css";
2
+ import "./toastContainer.6706a095.css";
3
3
  import $5lmgI$toastContainer_cssmodulejs from "./toastContainer_css.mjs";
4
4
  import {Toaster as $e46feef4e4c28a4b$export$fb98e3a2a4cd92d7} from "./Toaster.mjs";
5
5
  import {classNames as $5lmgI$classNames} from "@react-spectrum/utils";
6
6
  import {filterDOMProps as $5lmgI$filterDOMProps} from "@react-aria/utils";
7
- import $5lmgI$react, {useRef as $5lmgI$useRef, useEffect as $5lmgI$useEffect} from "react";
7
+ import {flushSync as $5lmgI$flushSync} from "react-dom";
8
+ import $5lmgI$react, {useRef as $5lmgI$useRef, useEffect as $5lmgI$useEffect, useMemo as $5lmgI$useMemo} from "react";
8
9
  import {ToastQueue as $5lmgI$ToastQueue, useToastQueue as $5lmgI$useToastQueue} from "@react-stately/toast";
9
10
  import {useSyncExternalStore as $5lmgI$useSyncExternalStore} from "use-sync-external-store/shim/index.js";
10
11
 
@@ -30,12 +31,19 @@ function $parcel$interopDefault(a) {
30
31
 
31
32
 
32
33
 
34
+
35
+ function $02c59b34bd70955a$var$wrapInViewTransition(fn) {
36
+ if ('startViewTransition' in document) document.startViewTransition(()=>{
37
+ (0, $5lmgI$flushSync)(fn);
38
+ }).ready.catch(()=>{});
39
+ else fn();
40
+ }
33
41
  // There is a single global toast queue instance for the whole app, initialized lazily.
34
42
  let $02c59b34bd70955a$var$globalToastQueue = null;
35
43
  function $02c59b34bd70955a$var$getGlobalToastQueue() {
36
44
  if (!$02c59b34bd70955a$var$globalToastQueue) $02c59b34bd70955a$var$globalToastQueue = new (0, $5lmgI$ToastQueue)({
37
45
  maxVisibleToasts: Infinity,
38
- hasExitAnimation: true
46
+ wrapUpdate: $02c59b34bd70955a$var$wrapInViewTransition
39
47
  });
40
48
  return $02c59b34bd70955a$var$globalToastQueue;
41
49
  }
@@ -62,15 +70,11 @@ function $02c59b34bd70955a$export$f2815235e76a62b9(props) {
62
70
  // Only the first one will actually render.
63
71
  // We use a ref to do this, since it will have a stable identity
64
72
  // over the lifetime of the component.
65
- let ref = (0, $5lmgI$useRef)(undefined);
66
- // eslint-disable-next-line arrow-body-style
73
+ let ref = (0, $5lmgI$useRef)(null);
67
74
  (0, $5lmgI$useEffect)(()=>{
68
75
  $02c59b34bd70955a$var$toastProviders.add(ref);
69
76
  $02c59b34bd70955a$var$triggerSubscriptions();
70
77
  return ()=>{
71
- // When this toast provider unmounts, reset all animations so that
72
- // when the new toast provider renders, it is seamless.
73
- for (let toast of $02c59b34bd70955a$var$getGlobalToastQueue().visibleToasts)toast.animation = null;
74
78
  // Remove this toast provider, and call subscriptions.
75
79
  // This will cause all other instances to re-render,
76
80
  // and the first one to become the new active toast provider.
@@ -81,18 +85,39 @@ function $02c59b34bd70955a$export$f2815235e76a62b9(props) {
81
85
  // Only render if this is the active toast provider instance, and there are visible toasts.
82
86
  let activeToastContainer = $02c59b34bd70955a$var$useActiveToastContainer();
83
87
  let state = (0, $5lmgI$useToastQueue)($02c59b34bd70955a$var$getGlobalToastQueue());
88
+ let { placement: placement, isCentered: isCentered } = (0, $5lmgI$useMemo)(()=>{
89
+ var _props_placement;
90
+ let placements = ((_props_placement = props.placement) !== null && _props_placement !== void 0 ? _props_placement : 'bottom').split(' ');
91
+ let placement = placements[placements.length - 1];
92
+ let isCentered = placements.length === 1;
93
+ return {
94
+ placement: placement,
95
+ isCentered: isCentered
96
+ };
97
+ }, [
98
+ props.placement
99
+ ]);
84
100
  if (ref === activeToastContainer && state.visibleToasts.length > 0) return /*#__PURE__*/ (0, $5lmgI$react).createElement((0, $e46feef4e4c28a4b$export$fb98e3a2a4cd92d7), {
85
101
  state: state,
86
102
  ...props
87
103
  }, /*#__PURE__*/ (0, $5lmgI$react).createElement("ol", {
88
104
  className: (0, $5lmgI$classNames)((0, ($parcel$interopDefault($5lmgI$toastContainer_cssmodulejs))), 'spectrum-ToastContainer-list')
89
- }, state.visibleToasts.slice().reverse().map((toast)=>/*#__PURE__*/ (0, $5lmgI$react).createElement("li", {
105
+ }, state.visibleToasts.map((toast, index)=>{
106
+ let shouldFade = isCentered && index !== 0;
107
+ return /*#__PURE__*/ (0, $5lmgI$react).createElement("li", {
90
108
  key: toast.key,
91
- className: (0, $5lmgI$classNames)((0, ($parcel$interopDefault($5lmgI$toastContainer_cssmodulejs))), 'spectrum-ToastContainer-listitem')
109
+ className: (0, $5lmgI$classNames)((0, ($parcel$interopDefault($5lmgI$toastContainer_cssmodulejs))), 'spectrum-ToastContainer-listitem'),
110
+ style: {
111
+ viewTransitionName: toast.key,
112
+ viewTransitionClass: (0, $5lmgI$classNames)((0, ($parcel$interopDefault($5lmgI$toastContainer_cssmodulejs))), 'toast', placement, {
113
+ 'fadeOnly': shouldFade
114
+ })
115
+ }
92
116
  }, /*#__PURE__*/ (0, $5lmgI$react).createElement((0, $7e7a2952509f3a56$export$8d8dc7d5f743331b), {
93
117
  toast: toast,
94
118
  state: state
95
- })))));
119
+ }));
120
+ })));
96
121
  return null;
97
122
  }
98
123
  function $02c59b34bd70955a$var$addToast(children, variant, options = {}) {
@@ -108,7 +133,7 @@ function $02c59b34bd70955a$var$addToast(children, variant, options = {}) {
108
133
  }
109
134
  });
110
135
  let shouldContinue = window.dispatchEvent(event);
111
- if (!shouldContinue) return;
136
+ if (!shouldContinue) return ()=>{};
112
137
  }
113
138
  let value = {
114
139
  children: children,
@@ -121,7 +146,7 @@ function $02c59b34bd70955a$var$addToast(children, variant, options = {}) {
121
146
  // Minimum time of 5s from https://spectrum.adobe.com/page/toast/#Auto-dismissible
122
147
  // Actionable toasts cannot be auto dismissed. That would fail WCAG SC 2.2.1.
123
148
  // It is debatable whether non-actionable toasts would also fail.
124
- let timeout = options.timeout && !options.onAction ? Math.max(options.timeout, 5000) : null;
149
+ let timeout = options.timeout && !options.onAction ? Math.max(options.timeout, 5000) : undefined;
125
150
  let queue = $02c59b34bd70955a$var$getGlobalToastQueue();
126
151
  let key = queue.add(value, {
127
152
  timeout: timeout,
@@ -1,10 +1,11 @@
1
1
  import {Toast as $7e7a2952509f3a56$export$8d8dc7d5f743331b} from "./Toast.module.js";
2
- import "./toastContainer.da404f80.css";
2
+ import "./toastContainer.6706a095.css";
3
3
  import $5lmgI$toastContainer_cssmodulejs from "./toastContainer_css.module.js";
4
4
  import {Toaster as $e46feef4e4c28a4b$export$fb98e3a2a4cd92d7} from "./Toaster.module.js";
5
5
  import {classNames as $5lmgI$classNames} from "@react-spectrum/utils";
6
6
  import {filterDOMProps as $5lmgI$filterDOMProps} from "@react-aria/utils";
7
- import $5lmgI$react, {useRef as $5lmgI$useRef, useEffect as $5lmgI$useEffect} from "react";
7
+ import {flushSync as $5lmgI$flushSync} from "react-dom";
8
+ import $5lmgI$react, {useRef as $5lmgI$useRef, useEffect as $5lmgI$useEffect, useMemo as $5lmgI$useMemo} from "react";
8
9
  import {ToastQueue as $5lmgI$ToastQueue, useToastQueue as $5lmgI$useToastQueue} from "@react-stately/toast";
9
10
  import {useSyncExternalStore as $5lmgI$useSyncExternalStore} from "use-sync-external-store/shim/index.js";
10
11
 
@@ -30,12 +31,19 @@ function $parcel$interopDefault(a) {
30
31
 
31
32
 
32
33
 
34
+
35
+ function $02c59b34bd70955a$var$wrapInViewTransition(fn) {
36
+ if ('startViewTransition' in document) document.startViewTransition(()=>{
37
+ (0, $5lmgI$flushSync)(fn);
38
+ }).ready.catch(()=>{});
39
+ else fn();
40
+ }
33
41
  // There is a single global toast queue instance for the whole app, initialized lazily.
34
42
  let $02c59b34bd70955a$var$globalToastQueue = null;
35
43
  function $02c59b34bd70955a$var$getGlobalToastQueue() {
36
44
  if (!$02c59b34bd70955a$var$globalToastQueue) $02c59b34bd70955a$var$globalToastQueue = new (0, $5lmgI$ToastQueue)({
37
45
  maxVisibleToasts: Infinity,
38
- hasExitAnimation: true
46
+ wrapUpdate: $02c59b34bd70955a$var$wrapInViewTransition
39
47
  });
40
48
  return $02c59b34bd70955a$var$globalToastQueue;
41
49
  }
@@ -62,15 +70,11 @@ function $02c59b34bd70955a$export$f2815235e76a62b9(props) {
62
70
  // Only the first one will actually render.
63
71
  // We use a ref to do this, since it will have a stable identity
64
72
  // over the lifetime of the component.
65
- let ref = (0, $5lmgI$useRef)(undefined);
66
- // eslint-disable-next-line arrow-body-style
73
+ let ref = (0, $5lmgI$useRef)(null);
67
74
  (0, $5lmgI$useEffect)(()=>{
68
75
  $02c59b34bd70955a$var$toastProviders.add(ref);
69
76
  $02c59b34bd70955a$var$triggerSubscriptions();
70
77
  return ()=>{
71
- // When this toast provider unmounts, reset all animations so that
72
- // when the new toast provider renders, it is seamless.
73
- for (let toast of $02c59b34bd70955a$var$getGlobalToastQueue().visibleToasts)toast.animation = null;
74
78
  // Remove this toast provider, and call subscriptions.
75
79
  // This will cause all other instances to re-render,
76
80
  // and the first one to become the new active toast provider.
@@ -81,18 +85,39 @@ function $02c59b34bd70955a$export$f2815235e76a62b9(props) {
81
85
  // Only render if this is the active toast provider instance, and there are visible toasts.
82
86
  let activeToastContainer = $02c59b34bd70955a$var$useActiveToastContainer();
83
87
  let state = (0, $5lmgI$useToastQueue)($02c59b34bd70955a$var$getGlobalToastQueue());
88
+ let { placement: placement, isCentered: isCentered } = (0, $5lmgI$useMemo)(()=>{
89
+ var _props_placement;
90
+ let placements = ((_props_placement = props.placement) !== null && _props_placement !== void 0 ? _props_placement : 'bottom').split(' ');
91
+ let placement = placements[placements.length - 1];
92
+ let isCentered = placements.length === 1;
93
+ return {
94
+ placement: placement,
95
+ isCentered: isCentered
96
+ };
97
+ }, [
98
+ props.placement
99
+ ]);
84
100
  if (ref === activeToastContainer && state.visibleToasts.length > 0) return /*#__PURE__*/ (0, $5lmgI$react).createElement((0, $e46feef4e4c28a4b$export$fb98e3a2a4cd92d7), {
85
101
  state: state,
86
102
  ...props
87
103
  }, /*#__PURE__*/ (0, $5lmgI$react).createElement("ol", {
88
104
  className: (0, $5lmgI$classNames)((0, ($parcel$interopDefault($5lmgI$toastContainer_cssmodulejs))), 'spectrum-ToastContainer-list')
89
- }, state.visibleToasts.slice().reverse().map((toast)=>/*#__PURE__*/ (0, $5lmgI$react).createElement("li", {
105
+ }, state.visibleToasts.map((toast, index)=>{
106
+ let shouldFade = isCentered && index !== 0;
107
+ return /*#__PURE__*/ (0, $5lmgI$react).createElement("li", {
90
108
  key: toast.key,
91
- className: (0, $5lmgI$classNames)((0, ($parcel$interopDefault($5lmgI$toastContainer_cssmodulejs))), 'spectrum-ToastContainer-listitem')
109
+ className: (0, $5lmgI$classNames)((0, ($parcel$interopDefault($5lmgI$toastContainer_cssmodulejs))), 'spectrum-ToastContainer-listitem'),
110
+ style: {
111
+ viewTransitionName: toast.key,
112
+ viewTransitionClass: (0, $5lmgI$classNames)((0, ($parcel$interopDefault($5lmgI$toastContainer_cssmodulejs))), 'toast', placement, {
113
+ 'fadeOnly': shouldFade
114
+ })
115
+ }
92
116
  }, /*#__PURE__*/ (0, $5lmgI$react).createElement((0, $7e7a2952509f3a56$export$8d8dc7d5f743331b), {
93
117
  toast: toast,
94
118
  state: state
95
- })))));
119
+ }));
120
+ })));
96
121
  return null;
97
122
  }
98
123
  function $02c59b34bd70955a$var$addToast(children, variant, options = {}) {
@@ -108,7 +133,7 @@ function $02c59b34bd70955a$var$addToast(children, variant, options = {}) {
108
133
  }
109
134
  });
110
135
  let shouldContinue = window.dispatchEvent(event);
111
- if (!shouldContinue) return;
136
+ if (!shouldContinue) return ()=>{};
112
137
  }
113
138
  let value = {
114
139
  children: children,
@@ -121,7 +146,7 @@ function $02c59b34bd70955a$var$addToast(children, variant, options = {}) {
121
146
  // Minimum time of 5s from https://spectrum.adobe.com/page/toast/#Auto-dismissible
122
147
  // Actionable toasts cannot be auto dismissed. That would fail WCAG SC 2.2.1.
123
148
  // It is debatable whether non-actionable toasts would also fail.
124
- let timeout = options.timeout && !options.onAction ? Math.max(options.timeout, 5000) : null;
149
+ let timeout = options.timeout && !options.onAction ? Math.max(options.timeout, 5000) : undefined;
125
150
  let queue = $02c59b34bd70955a$var$getGlobalToastQueue();
126
151
  let key = queue.add(value, {
127
152
  timeout: timeout,