@react-spectrum/toast 3.0.0-beta.17 → 3.0.0-beta.18
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/dist/Toast.main.js +3 -4
- package/dist/Toast.main.js.map +1 -1
- package/dist/Toast.mjs +3 -4
- package/dist/Toast.module.js +3 -4
- package/dist/Toast.module.js.map +1 -1
- package/dist/{vars.fdf6eb7e.css → vars.84eec607.css} +2 -2
- package/dist/{vars.fdf6eb7e.css.map → vars.84eec607.css.map} +1 -1
- package/package.json +11 -11
- package/src/Toast.tsx +2 -5
package/dist/Toast.main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var $1e709ec471c88b75$exports = require("./intlStrings.main.js");
|
|
2
|
-
require("./vars.
|
|
2
|
+
require("./vars.84eec607.css");
|
|
3
3
|
var $b6e6aa676f8f9e47$exports = require("./toast_vars_css.main.js");
|
|
4
4
|
require("./toastContainer.5957ce49.css");
|
|
5
5
|
var $e20782d0579ed886$exports = require("./toastContainer_css.main.js");
|
|
@@ -54,7 +54,7 @@ const $6c5bd1047ecc310e$export$fde44257752a9f60 = {
|
|
|
54
54
|
negative: (0, ($parcel$interopDefault($8Jify$spectrumiconsuiAlertMedium))),
|
|
55
55
|
positive: (0, ($parcel$interopDefault($8Jify$spectrumiconsuiSuccessMedium)))
|
|
56
56
|
};
|
|
57
|
-
|
|
57
|
+
const $6c5bd1047ecc310e$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, ($parcel$interopDefault($8Jify$react))).forwardRef(function Toast(props, ref) {
|
|
58
58
|
let { toast: { key: key, animation: animation, 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);
|
|
@@ -109,8 +109,7 @@ function $6c5bd1047ecc310e$var$Toast(props, ref) {
|
|
|
109
109
|
...closeButtonProps,
|
|
110
110
|
variant: "overBackground"
|
|
111
111
|
}, /*#__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);
|
|
112
|
+
});
|
|
114
113
|
|
|
115
114
|
|
|
116
115
|
//# sourceMappingURL=Toast.main.js.map
|
package/dist/Toast.main.js.map
CHANGED
|
@@ -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;
|
|
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,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,oB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AAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAAwB,MAAK;qBAC9D,0DAAC;QAAI,WAAW,CAAA,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","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 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"],"names":[],"version":3,"file":"Toast.main.js.map"}
|
package/dist/Toast.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import $iu2Jc$intlStringsmodulejs from "./intlStrings.mjs";
|
|
2
|
-
import "./vars.
|
|
2
|
+
import "./vars.84eec607.css";
|
|
3
3
|
import $iu2Jc$toast_vars_cssmodulejs from "./toast_vars_css.mjs";
|
|
4
4
|
import "./toastContainer.5957ce49.css";
|
|
5
5
|
import $iu2Jc$toastContainer_cssmodulejs from "./toastContainer_css.mjs";
|
|
@@ -48,7 +48,7 @@ const $7e7a2952509f3a56$export$fde44257752a9f60 = {
|
|
|
48
48
|
negative: (0, $iu2Jc$spectrumiconsuiAlertMedium),
|
|
49
49
|
positive: (0, $iu2Jc$spectrumiconsuiSuccessMedium)
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
const $7e7a2952509f3a56$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $iu2Jc$react).forwardRef(function Toast(props, ref) {
|
|
52
52
|
let { toast: { key: key, animation: animation, 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);
|
|
@@ -103,8 +103,7 @@ function $7e7a2952509f3a56$var$Toast(props, ref) {
|
|
|
103
103
|
...closeButtonProps,
|
|
104
104
|
variant: "overBackground"
|
|
105
105
|
}, /*#__PURE__*/ (0, $iu2Jc$react).createElement((0, $iu2Jc$spectrumiconsuiCrossMedium), null))));
|
|
106
|
-
}
|
|
107
|
-
let $7e7a2952509f3a56$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $iu2Jc$react).forwardRef($7e7a2952509f3a56$var$Toast);
|
|
106
|
+
});
|
|
108
107
|
|
|
109
108
|
|
|
110
109
|
export {$7e7a2952509f3a56$export$fde44257752a9f60 as ICONS, $7e7a2952509f3a56$export$8d8dc7d5f743331b as Toast};
|
package/dist/Toast.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import $iu2Jc$intlStringsmodulejs from "./intlStrings.module.js";
|
|
2
|
-
import "./vars.
|
|
2
|
+
import "./vars.84eec607.css";
|
|
3
3
|
import $iu2Jc$toast_vars_cssmodulejs from "./toast_vars_css.module.js";
|
|
4
4
|
import "./toastContainer.5957ce49.css";
|
|
5
5
|
import $iu2Jc$toastContainer_cssmodulejs from "./toastContainer_css.module.js";
|
|
@@ -48,7 +48,7 @@ const $7e7a2952509f3a56$export$fde44257752a9f60 = {
|
|
|
48
48
|
negative: (0, $iu2Jc$spectrumiconsuiAlertMedium),
|
|
49
49
|
positive: (0, $iu2Jc$spectrumiconsuiSuccessMedium)
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
const $7e7a2952509f3a56$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $iu2Jc$react).forwardRef(function Toast(props, ref) {
|
|
52
52
|
let { toast: { key: key, animation: animation, 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);
|
|
@@ -103,8 +103,7 @@ function $7e7a2952509f3a56$var$Toast(props, ref) {
|
|
|
103
103
|
...closeButtonProps,
|
|
104
104
|
variant: "overBackground"
|
|
105
105
|
}, /*#__PURE__*/ (0, $iu2Jc$react).createElement((0, $iu2Jc$spectrumiconsuiCrossMedium), null))));
|
|
106
|
-
}
|
|
107
|
-
let $7e7a2952509f3a56$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $iu2Jc$react).forwardRef($7e7a2952509f3a56$var$Toast);
|
|
106
|
+
});
|
|
108
107
|
|
|
109
108
|
|
|
110
109
|
export {$7e7a2952509f3a56$export$fde44257752a9f60 as ICONS, $7e7a2952509f3a56$export$8d8dc7d5f743331b as Toast};
|
package/dist/Toast.module.js.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAkCM,MAAM,4CAAQ;IACnB,MAAM,CAAA,GAAA,gCAAS;IACf,UAAU,CAAA,GAAA,iCAAU;IACpB,UAAU,CAAA,GAAA,mCAAY;AACxB;AAEO,MAAM,0DAAQ,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,MAAM,KAAyB,EAAE,GAA2B;IACzG,IAAI,EACF,OAAO,OACL,GAAG,aACH,SAAS,EACT,SAAS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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 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"],"names":[],"version":3,"file":"Toast.module.js.map"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
.swo6Nq_spectrum-Toast {
|
|
2
2
|
box-sizing: border-box;
|
|
3
3
|
border-radius: var(--spectrum-toast-border-radius, var(--spectrum-global-dimension-static-size-50));
|
|
4
|
+
max-width: 500px;
|
|
4
5
|
font-size: var(--spectrum-toast-text-size, var(--spectrum-alias-font-size-default));
|
|
5
6
|
-webkit-font-smoothing: antialiased;
|
|
6
7
|
flex-direction: row;
|
|
7
8
|
align-items: stretch;
|
|
8
|
-
max-width: 500px;
|
|
9
9
|
padding-block-start: var(--spectrum-toast-padding-y, var(--spectrum-global-dimension-size-100));
|
|
10
10
|
padding-block-end: var(--spectrum-toast-padding-y, var(--spectrum-global-dimension-size-100));
|
|
11
11
|
padding-inline-start: var(--spectrum-toast-padding-left, var(--spectrum-global-dimension-size-200));
|
|
@@ -88,4 +88,4 @@
|
|
|
88
88
|
border: 1px solid #0000;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
/*# sourceMappingURL=vars.
|
|
91
|
+
/*# sourceMappingURL=vars.84eec607.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAwBA;;;;;;;;;;;;;;;AAkBA;;;;;;;;;AAUA;;;;;;;;;AASA;;;;;;;;;AAUI;;;;AAOJ;;;;;;;;;;AAwBA;;;;;AAKA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;EACE","sources":["packages/@adobe/spectrum-css-temp/components/toast/vars.css"],"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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.
|
|
1
|
+
{"mappings":"AAwBA;;;;;;;;;;;;;;;AAkBA;;;;;;;;;AAUA;;;;;;;;;AASA;;;;;;;;;AAUI;;;;AAOJ;;;;;;;;;;AAwBA;;;;;AAKA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;EACE","sources":["packages/@adobe/spectrum-css-temp/components/toast/vars.css"],"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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.84eec607.css.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/toast",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.18",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@react-aria/focus": "^3.19.
|
|
40
|
-
"@react-aria/i18n": "^3.12.
|
|
41
|
-
"@react-aria/overlays": "^3.
|
|
42
|
-
"@react-aria/toast": "3.0.0-beta.
|
|
43
|
-
"@react-aria/utils": "^3.
|
|
44
|
-
"@react-spectrum/button": "^3.16.
|
|
45
|
-
"@react-spectrum/utils": "^3.12.
|
|
39
|
+
"@react-aria/focus": "^3.19.1",
|
|
40
|
+
"@react-aria/i18n": "^3.12.5",
|
|
41
|
+
"@react-aria/overlays": "^3.25.0",
|
|
42
|
+
"@react-aria/toast": "3.0.0-beta.19",
|
|
43
|
+
"@react-aria/utils": "^3.27.0",
|
|
44
|
+
"@react-spectrum/button": "^3.16.10",
|
|
45
|
+
"@react-spectrum/utils": "^3.12.1",
|
|
46
46
|
"@react-stately/toast": "3.0.0-beta.7",
|
|
47
|
-
"@react-types/shared": "^3.
|
|
48
|
-
"@spectrum-icons/ui": "^3.6.
|
|
47
|
+
"@react-types/shared": "^3.27.0",
|
|
48
|
+
"@spectrum-icons/ui": "^3.6.12",
|
|
49
49
|
"@swc/helpers": "^0.5.0",
|
|
50
50
|
"use-sync-external-store": "^1.2.0"
|
|
51
51
|
},
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "09e7f44bebdc9d89122926b2b439a0a38a2814ea"
|
|
66
66
|
}
|
package/src/Toast.tsx
CHANGED
|
@@ -48,7 +48,7 @@ export const ICONS = {
|
|
|
48
48
|
positive: SuccessMedium
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
function Toast(props: SpectrumToastProps, ref: DOMRef<HTMLDivElement>) {
|
|
51
|
+
export const Toast = React.forwardRef(function Toast(props: SpectrumToastProps, ref: DOMRef<HTMLDivElement>) {
|
|
52
52
|
let {
|
|
53
53
|
toast: {
|
|
54
54
|
key,
|
|
@@ -142,7 +142,4 @@ function Toast(props: SpectrumToastProps, ref: DOMRef<HTMLDivElement>) {
|
|
|
142
142
|
</div>
|
|
143
143
|
</div>
|
|
144
144
|
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
let _Toast = React.forwardRef(Toast);
|
|
148
|
-
export {_Toast as Toast};
|
|
145
|
+
});
|