@react-spectrum/toast 3.1.6 → 3.2.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/dist/import.mjs +2 -2
- package/dist/main.js +3 -3
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -2
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/package.json +13 -35
- package/src/index.ts +2 -2
- package/dist/Toast.main.js +0 -109
- package/dist/Toast.main.js.map +0 -1
- package/dist/Toast.mjs +0 -104
- package/dist/Toast.module.js +0 -104
- package/dist/Toast.module.js.map +0 -1
- package/dist/ToastContainer.main.js +0 -180
- package/dist/ToastContainer.main.js.map +0 -1
- package/dist/ToastContainer.mjs +0 -174
- package/dist/ToastContainer.module.js +0 -174
- package/dist/ToastContainer.module.js.map +0 -1
- package/dist/Toaster.main.js +0 -78
- package/dist/Toaster.main.js.map +0 -1
- package/dist/Toaster.mjs +0 -73
- package/dist/Toaster.module.js +0 -73
- package/dist/Toaster.module.js.map +0 -1
- package/dist/ar-AE.main.js +0 -8
- package/dist/ar-AE.main.js.map +0 -1
- package/dist/ar-AE.mjs +0 -10
- package/dist/ar-AE.module.js +0 -10
- package/dist/ar-AE.module.js.map +0 -1
- package/dist/bg-BG.main.js +0 -8
- package/dist/bg-BG.main.js.map +0 -1
- package/dist/bg-BG.mjs +0 -10
- package/dist/bg-BG.module.js +0 -10
- package/dist/bg-BG.module.js.map +0 -1
- package/dist/cs-CZ.main.js +0 -8
- package/dist/cs-CZ.main.js.map +0 -1
- package/dist/cs-CZ.mjs +0 -10
- package/dist/cs-CZ.module.js +0 -10
- package/dist/cs-CZ.module.js.map +0 -1
- package/dist/da-DK.main.js +0 -8
- package/dist/da-DK.main.js.map +0 -1
- package/dist/da-DK.mjs +0 -10
- package/dist/da-DK.module.js +0 -10
- package/dist/da-DK.module.js.map +0 -1
- package/dist/de-DE.main.js +0 -8
- package/dist/de-DE.main.js.map +0 -1
- package/dist/de-DE.mjs +0 -10
- package/dist/de-DE.module.js +0 -10
- package/dist/de-DE.module.js.map +0 -1
- package/dist/el-GR.main.js +0 -8
- package/dist/el-GR.main.js.map +0 -1
- package/dist/el-GR.mjs +0 -10
- package/dist/el-GR.module.js +0 -10
- package/dist/el-GR.module.js.map +0 -1
- package/dist/en-US.main.js +0 -8
- package/dist/en-US.main.js.map +0 -1
- package/dist/en-US.mjs +0 -10
- package/dist/en-US.module.js +0 -10
- package/dist/en-US.module.js.map +0 -1
- package/dist/es-ES.main.js +0 -8
- package/dist/es-ES.main.js.map +0 -1
- package/dist/es-ES.mjs +0 -10
- package/dist/es-ES.module.js +0 -10
- package/dist/es-ES.module.js.map +0 -1
- package/dist/et-EE.main.js +0 -8
- package/dist/et-EE.main.js.map +0 -1
- package/dist/et-EE.mjs +0 -10
- package/dist/et-EE.module.js +0 -10
- package/dist/et-EE.module.js.map +0 -1
- package/dist/fi-FI.main.js +0 -8
- package/dist/fi-FI.main.js.map +0 -1
- package/dist/fi-FI.mjs +0 -10
- package/dist/fi-FI.module.js +0 -10
- package/dist/fi-FI.module.js.map +0 -1
- package/dist/fr-FR.main.js +0 -8
- package/dist/fr-FR.main.js.map +0 -1
- package/dist/fr-FR.mjs +0 -10
- package/dist/fr-FR.module.js +0 -10
- package/dist/fr-FR.module.js.map +0 -1
- package/dist/he-IL.main.js +0 -8
- package/dist/he-IL.main.js.map +0 -1
- package/dist/he-IL.mjs +0 -10
- package/dist/he-IL.module.js +0 -10
- package/dist/he-IL.module.js.map +0 -1
- package/dist/hr-HR.main.js +0 -8
- package/dist/hr-HR.main.js.map +0 -1
- package/dist/hr-HR.mjs +0 -10
- package/dist/hr-HR.module.js +0 -10
- package/dist/hr-HR.module.js.map +0 -1
- package/dist/hu-HU.main.js +0 -8
- package/dist/hu-HU.main.js.map +0 -1
- package/dist/hu-HU.mjs +0 -10
- package/dist/hu-HU.module.js +0 -10
- package/dist/hu-HU.module.js.map +0 -1
- package/dist/intlStrings.main.js +0 -108
- package/dist/intlStrings.main.js.map +0 -1
- package/dist/intlStrings.mjs +0 -110
- package/dist/intlStrings.module.js +0 -110
- package/dist/intlStrings.module.js.map +0 -1
- package/dist/it-IT.main.js +0 -8
- package/dist/it-IT.main.js.map +0 -1
- package/dist/it-IT.mjs +0 -10
- package/dist/it-IT.module.js +0 -10
- package/dist/it-IT.module.js.map +0 -1
- package/dist/ja-JP.main.js +0 -8
- package/dist/ja-JP.main.js.map +0 -1
- package/dist/ja-JP.mjs +0 -10
- package/dist/ja-JP.module.js +0 -10
- package/dist/ja-JP.module.js.map +0 -1
- package/dist/ko-KR.main.js +0 -8
- package/dist/ko-KR.main.js.map +0 -1
- package/dist/ko-KR.mjs +0 -10
- package/dist/ko-KR.module.js +0 -10
- package/dist/ko-KR.module.js.map +0 -1
- package/dist/lt-LT.main.js +0 -8
- package/dist/lt-LT.main.js.map +0 -1
- package/dist/lt-LT.mjs +0 -10
- package/dist/lt-LT.module.js +0 -10
- package/dist/lt-LT.module.js.map +0 -1
- package/dist/lv-LV.main.js +0 -8
- package/dist/lv-LV.main.js.map +0 -1
- package/dist/lv-LV.mjs +0 -10
- package/dist/lv-LV.module.js +0 -10
- package/dist/lv-LV.module.js.map +0 -1
- package/dist/nb-NO.main.js +0 -8
- package/dist/nb-NO.main.js.map +0 -1
- package/dist/nb-NO.mjs +0 -10
- package/dist/nb-NO.module.js +0 -10
- package/dist/nb-NO.module.js.map +0 -1
- package/dist/nl-NL.main.js +0 -8
- package/dist/nl-NL.main.js.map +0 -1
- package/dist/nl-NL.mjs +0 -10
- package/dist/nl-NL.module.js +0 -10
- package/dist/nl-NL.module.js.map +0 -1
- package/dist/pl-PL.main.js +0 -8
- package/dist/pl-PL.main.js.map +0 -1
- package/dist/pl-PL.mjs +0 -10
- package/dist/pl-PL.module.js +0 -10
- package/dist/pl-PL.module.js.map +0 -1
- package/dist/pt-BR.main.js +0 -8
- package/dist/pt-BR.main.js.map +0 -1
- package/dist/pt-BR.mjs +0 -10
- package/dist/pt-BR.module.js +0 -10
- package/dist/pt-BR.module.js.map +0 -1
- package/dist/pt-PT.main.js +0 -8
- package/dist/pt-PT.main.js.map +0 -1
- package/dist/pt-PT.mjs +0 -10
- package/dist/pt-PT.module.js +0 -10
- package/dist/pt-PT.module.js.map +0 -1
- package/dist/ro-RO.main.js +0 -8
- package/dist/ro-RO.main.js.map +0 -1
- package/dist/ro-RO.mjs +0 -10
- package/dist/ro-RO.module.js +0 -10
- package/dist/ro-RO.module.js.map +0 -1
- package/dist/ru-RU.main.js +0 -8
- package/dist/ru-RU.main.js.map +0 -1
- package/dist/ru-RU.mjs +0 -10
- package/dist/ru-RU.module.js +0 -10
- package/dist/ru-RU.module.js.map +0 -1
- package/dist/sk-SK.main.js +0 -8
- package/dist/sk-SK.main.js.map +0 -1
- package/dist/sk-SK.mjs +0 -10
- package/dist/sk-SK.module.js +0 -10
- package/dist/sk-SK.module.js.map +0 -1
- package/dist/sl-SI.main.js +0 -8
- package/dist/sl-SI.main.js.map +0 -1
- package/dist/sl-SI.mjs +0 -10
- package/dist/sl-SI.module.js +0 -10
- package/dist/sl-SI.module.js.map +0 -1
- package/dist/sr-SP.main.js +0 -8
- package/dist/sr-SP.main.js.map +0 -1
- package/dist/sr-SP.mjs +0 -10
- package/dist/sr-SP.module.js +0 -10
- package/dist/sr-SP.module.js.map +0 -1
- package/dist/sv-SE.main.js +0 -8
- package/dist/sv-SE.main.js.map +0 -1
- package/dist/sv-SE.mjs +0 -10
- package/dist/sv-SE.module.js +0 -10
- package/dist/sv-SE.module.js.map +0 -1
- package/dist/toast.62356566.css +0 -91
- package/dist/toast.62356566.css.map +0 -1
- package/dist/toast.69f125e3.css +0 -187
- package/dist/toast.69f125e3.css.map +0 -1
- package/dist/toastContainer_css.main.js +0 -65
- package/dist/toastContainer_css.main.js.map +0 -1
- package/dist/toastContainer_css.mjs +0 -67
- package/dist/toastContainer_css.module.js +0 -67
- package/dist/toastContainer_css.module.js.map +0 -1
- package/dist/toast_vars_css.main.js +0 -38
- package/dist/toast_vars_css.main.js.map +0 -1
- package/dist/toast_vars_css.mjs +0 -40
- package/dist/toast_vars_css.module.js +0 -40
- package/dist/toast_vars_css.module.js.map +0 -1
- package/dist/tr-TR.main.js +0 -8
- package/dist/tr-TR.main.js.map +0 -1
- package/dist/tr-TR.mjs +0 -10
- package/dist/tr-TR.module.js +0 -10
- package/dist/tr-TR.module.js.map +0 -1
- package/dist/types.d.ts +0 -34
- package/dist/types.d.ts.map +0 -1
- package/dist/uk-UA.main.js +0 -8
- package/dist/uk-UA.main.js.map +0 -1
- package/dist/uk-UA.mjs +0 -10
- package/dist/uk-UA.module.js +0 -10
- package/dist/uk-UA.module.js.map +0 -1
- package/dist/zh-CN.main.js +0 -8
- package/dist/zh-CN.main.js.map +0 -1
- package/dist/zh-CN.mjs +0 -10
- package/dist/zh-CN.module.js +0 -10
- package/dist/zh-CN.module.js.map +0 -1
- package/dist/zh-TW.main.js +0 -8
- package/dist/zh-TW.main.js.map +0 -1
- package/dist/zh-TW.mjs +0 -10
- package/dist/zh-TW.module.js +0 -10
- package/dist/zh-TW.module.js.map +0 -1
- package/src/Toast.tsx +0 -135
- package/src/ToastContainer.tsx +0 -216
- package/src/Toaster.tsx +0 -71
- package/src/toastContainer.css +0 -154
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;AEwBA,sBAA6B,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,YAAY,CAAC;AAEzE,4CAA6C,SAAQ,oBAAoB;IACvE,SAAS,CAAC,EAAE,cAAc,CAAA;CAC3B;AAED,qCAAsC,SAAQ,YAAY,EAAE,QAAQ;IAClE,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,gFAAgF;IAChF,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B;AAED,qBAAqB,MAAM,IAAI,CAAC;AAmDhC;;;GAGG;AACH,+BAA+B,KAAK,EAAE,2BAA2B,GAAG,YAAY,GAAG,IAAI,CA+DtF;AAuCD,OAAA,MAAM;IACJ,8BAA8B;sBACZ,MAAM,YAAW,oBAAoB,GAAQ,aAAa;IAG5E,+BAA+B;uBACZ,MAAM,YAAW,oBAAoB,GAAQ,aAAa;IAG7E,+BAA+B;uBACZ,MAAM,YAAW,oBAAoB,GAAQ,aAAa;IAG7E,qCAAqC;mBACtB,MAAM,YAAW,oBAAoB,GAAQ,aAAa;CAG1E,CAAC","sources":["packages/@react-spectrum/toast/src/packages/@react-spectrum/toast/src/Toast.tsx","packages/@react-spectrum/toast/src/packages/@react-spectrum/toast/src/Toaster.tsx","packages/@react-spectrum/toast/src/packages/@react-spectrum/toast/src/ToastContainer.tsx","packages/@react-spectrum/toast/src/packages/@react-spectrum/toast/src/index.ts","packages/@react-spectrum/toast/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\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/// <reference types=\"css-module-types\" />\n\nexport {ToastContainer, ToastQueue} from './ToastContainer';\n\nexport type {SpectrumToastOptions, SpectrumToastContainerProps} from './ToastContainer';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/dist/uk-UA.main.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"info": `\u{406}\u{43D}\u{444}\u{43E}\u{440}\u{43C}\u{430}\u{446}\u{456}\u{44F}`,
|
|
3
|
-
"negative": `\u{41F}\u{43E}\u{43C}\u{438}\u{43B}\u{43A}\u{430}`,
|
|
4
|
-
"positive": `\u{423}\u{441}\u{43F}\u{456}\u{448}\u{43D}\u{43E}`
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
//# sourceMappingURL=uk-UA.main.js.map
|
package/dist/uk-UA.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAAA,iBAAiB;IAAG,QAAQ,CAAC,sEAAU,CAAC;IACtC,YAAY,CAAC,iDAAO,CAAC;IACrB,YAAY,CAAC,iDAAO,CAAC;AACvB","sources":["packages/@react-spectrum/toast/intl/uk-UA.json"],"sourcesContent":["{\n \"info\": \"Інформація\",\n \"negative\": \"Помилка\",\n \"positive\": \"Успішно\"\n}\n"],"names":[],"version":3,"file":"uk-UA.main.js.map"}
|
package/dist/uk-UA.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var $6764c871b5447c7a$exports = {};
|
|
2
|
-
$6764c871b5447c7a$exports = {
|
|
3
|
-
"info": `\u{406}\u{43D}\u{444}\u{43E}\u{440}\u{43C}\u{430}\u{446}\u{456}\u{44F}`,
|
|
4
|
-
"negative": `\u{41F}\u{43E}\u{43C}\u{438}\u{43B}\u{43A}\u{430}`,
|
|
5
|
-
"positive": `\u{423}\u{441}\u{43F}\u{456}\u{448}\u{43D}\u{43E}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {$6764c871b5447c7a$exports as default};
|
|
10
|
-
//# sourceMappingURL=uk-UA.module.js.map
|
package/dist/uk-UA.module.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var $6764c871b5447c7a$exports = {};
|
|
2
|
-
$6764c871b5447c7a$exports = {
|
|
3
|
-
"info": `\u{406}\u{43D}\u{444}\u{43E}\u{440}\u{43C}\u{430}\u{446}\u{456}\u{44F}`,
|
|
4
|
-
"negative": `\u{41F}\u{43E}\u{43C}\u{438}\u{43B}\u{43A}\u{430}`,
|
|
5
|
-
"positive": `\u{423}\u{441}\u{43F}\u{456}\u{448}\u{43D}\u{43E}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {$6764c871b5447c7a$exports as default};
|
|
10
|
-
//# sourceMappingURL=uk-UA.module.js.map
|
package/dist/uk-UA.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";AAAA,4BAAiB;IAAG,QAAQ,CAAC,sEAAU,CAAC;IACtC,YAAY,CAAC,iDAAO,CAAC;IACrB,YAAY,CAAC,iDAAO,CAAC;AACvB","sources":["packages/@react-spectrum/toast/intl/uk-UA.json"],"sourcesContent":["{\n \"info\": \"Інформація\",\n \"negative\": \"Помилка\",\n \"positive\": \"Успішно\"\n}\n"],"names":[],"version":3,"file":"uk-UA.module.js.map"}
|
package/dist/zh-CN.main.js
DELETED
package/dist/zh-CN.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAAA,iBAAiB;IAAG,QAAQ,CAAC,gBAAE,CAAC;IAC9B,YAAY,CAAC,gBAAE,CAAC;IAChB,YAAY,CAAC,gBAAE,CAAC;AAClB","sources":["packages/@react-spectrum/toast/intl/zh-CN.json"],"sourcesContent":["{\n \"info\": \"信息\",\n \"negative\": \"错误\",\n \"positive\": \"成功\"\n}\n"],"names":[],"version":3,"file":"zh-CN.main.js.map"}
|
package/dist/zh-CN.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var $b1634d37b87f243f$exports = {};
|
|
2
|
-
$b1634d37b87f243f$exports = {
|
|
3
|
-
"info": `\u{4FE1}\u{606F}`,
|
|
4
|
-
"negative": `\u{9519}\u{8BEF}`,
|
|
5
|
-
"positive": `\u{6210}\u{529F}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {$b1634d37b87f243f$exports as default};
|
|
10
|
-
//# sourceMappingURL=zh-CN.module.js.map
|
package/dist/zh-CN.module.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var $b1634d37b87f243f$exports = {};
|
|
2
|
-
$b1634d37b87f243f$exports = {
|
|
3
|
-
"info": `\u{4FE1}\u{606F}`,
|
|
4
|
-
"negative": `\u{9519}\u{8BEF}`,
|
|
5
|
-
"positive": `\u{6210}\u{529F}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {$b1634d37b87f243f$exports as default};
|
|
10
|
-
//# sourceMappingURL=zh-CN.module.js.map
|
package/dist/zh-CN.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";AAAA,4BAAiB;IAAG,QAAQ,CAAC,gBAAE,CAAC;IAC9B,YAAY,CAAC,gBAAE,CAAC;IAChB,YAAY,CAAC,gBAAE,CAAC;AAClB","sources":["packages/@react-spectrum/toast/intl/zh-CN.json"],"sourcesContent":["{\n \"info\": \"信息\",\n \"negative\": \"错误\",\n \"positive\": \"成功\"\n}\n"],"names":[],"version":3,"file":"zh-CN.module.js.map"}
|
package/dist/zh-TW.main.js
DELETED
package/dist/zh-TW.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAAA,iBAAiB;IAAG,QAAQ,CAAC,gBAAE,CAAC;IAC9B,YAAY,CAAC,gBAAE,CAAC;IAChB,YAAY,CAAC,gBAAE,CAAC;AAClB","sources":["packages/@react-spectrum/toast/intl/zh-TW.json"],"sourcesContent":["{\n \"info\": \"資訊\",\n \"negative\": \"錯誤\",\n \"positive\": \"成功\"\n}\n"],"names":[],"version":3,"file":"zh-TW.main.js.map"}
|
package/dist/zh-TW.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var $19cbd4230357935e$exports = {};
|
|
2
|
-
$19cbd4230357935e$exports = {
|
|
3
|
-
"info": `\u{8CC7}\u{8A0A}`,
|
|
4
|
-
"negative": `\u{932F}\u{8AA4}`,
|
|
5
|
-
"positive": `\u{6210}\u{529F}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {$19cbd4230357935e$exports as default};
|
|
10
|
-
//# sourceMappingURL=zh-TW.module.js.map
|
package/dist/zh-TW.module.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var $19cbd4230357935e$exports = {};
|
|
2
|
-
$19cbd4230357935e$exports = {
|
|
3
|
-
"info": `\u{8CC7}\u{8A0A}`,
|
|
4
|
-
"negative": `\u{932F}\u{8AA4}`,
|
|
5
|
-
"positive": `\u{6210}\u{529F}`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {$19cbd4230357935e$exports as default};
|
|
10
|
-
//# sourceMappingURL=zh-TW.module.js.map
|
package/dist/zh-TW.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";AAAA,4BAAiB;IAAG,QAAQ,CAAC,gBAAE,CAAC;IAC9B,YAAY,CAAC,gBAAE,CAAC;IAChB,YAAY,CAAC,gBAAE,CAAC;AAClB","sources":["packages/@react-spectrum/toast/intl/zh-TW.json"],"sourcesContent":["{\n \"info\": \"資訊\",\n \"negative\": \"錯誤\",\n \"positive\": \"成功\"\n}\n"],"names":[],"version":3,"file":"zh-TW.module.js.map"}
|
package/src/Toast.tsx
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import AlertMedium from '@spectrum-icons/ui/AlertMedium';
|
|
14
|
-
import {Button, ClearButton} from '@react-spectrum/button';
|
|
15
|
-
import {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';
|
|
16
|
-
import CrossMedium from '@spectrum-icons/ui/CrossMedium';
|
|
17
|
-
import {DOMProps, DOMRef} from '@react-types/shared';
|
|
18
|
-
import {filterDOMProps, mergeProps} from '@react-aria/utils';
|
|
19
|
-
import InfoMedium from '@spectrum-icons/ui/InfoMedium';
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
import intlMessages from '../intl/*.json';
|
|
22
|
-
import {QueuedToast, ToastState} from '@react-stately/toast';
|
|
23
|
-
import React from 'react';
|
|
24
|
-
import styles from '@adobe/spectrum-css-temp/components/toast/vars.css';
|
|
25
|
-
import SuccessMedium from '@spectrum-icons/ui/SuccessMedium';
|
|
26
|
-
import toastContainerStyles from './toastContainer.css';
|
|
27
|
-
import {useFocusRing} from '@react-aria/focus';
|
|
28
|
-
import {useLocalizedStringFormatter} from '@react-aria/i18n';
|
|
29
|
-
import {useToast} from '@react-aria/toast';
|
|
30
|
-
|
|
31
|
-
export interface SpectrumToastValue extends DOMProps {
|
|
32
|
-
children: string,
|
|
33
|
-
variant: 'positive' | 'negative' | 'info' | 'neutral',
|
|
34
|
-
actionLabel?: string,
|
|
35
|
-
onAction?: () => void,
|
|
36
|
-
shouldCloseOnAction?: boolean
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface SpectrumToastProps {
|
|
40
|
-
toast: QueuedToast<SpectrumToastValue>,
|
|
41
|
-
state: ToastState<SpectrumToastValue>
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// TODO: express should use filled icons...
|
|
45
|
-
export const ICONS = {
|
|
46
|
-
info: InfoMedium,
|
|
47
|
-
negative: AlertMedium,
|
|
48
|
-
positive: SuccessMedium
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const Toast = React.forwardRef(function Toast(props: SpectrumToastProps, ref: DOMRef<HTMLDivElement>) {
|
|
52
|
-
let {
|
|
53
|
-
toast: {
|
|
54
|
-
key,
|
|
55
|
-
content: {
|
|
56
|
-
children,
|
|
57
|
-
variant,
|
|
58
|
-
actionLabel,
|
|
59
|
-
onAction,
|
|
60
|
-
shouldCloseOnAction
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
state,
|
|
64
|
-
...otherProps
|
|
65
|
-
} = props;
|
|
66
|
-
let domRef = useDOMRef(ref);
|
|
67
|
-
let {
|
|
68
|
-
closeButtonProps,
|
|
69
|
-
titleProps,
|
|
70
|
-
toastProps,
|
|
71
|
-
contentProps
|
|
72
|
-
} = useToast(props, state, domRef);
|
|
73
|
-
let {styleProps} = useStyleProps(otherProps);
|
|
74
|
-
|
|
75
|
-
let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/toast');
|
|
76
|
-
let iconLabel = variant && variant !== 'neutral' ? stringFormatter.format(variant) : null;
|
|
77
|
-
let Icon = ICONS[variant];
|
|
78
|
-
let {isFocusVisible, focusProps} = useFocusRing();
|
|
79
|
-
|
|
80
|
-
const handleAction = () => {
|
|
81
|
-
if (onAction) {
|
|
82
|
-
onAction();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (shouldCloseOnAction) {
|
|
86
|
-
state.close(key);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<div
|
|
92
|
-
{...styleProps}
|
|
93
|
-
{...mergeProps(toastProps, focusProps)}
|
|
94
|
-
{...filterDOMProps(props.toast.content)}
|
|
95
|
-
ref={domRef}
|
|
96
|
-
className={classNames(styles,
|
|
97
|
-
'spectrum-Toast',
|
|
98
|
-
{['spectrum-Toast--' + variant]: variant},
|
|
99
|
-
styleProps.className,
|
|
100
|
-
classNames(
|
|
101
|
-
toastContainerStyles,
|
|
102
|
-
'spectrum-Toast',
|
|
103
|
-
{'focus-ring': isFocusVisible}
|
|
104
|
-
)
|
|
105
|
-
)}>
|
|
106
|
-
<div
|
|
107
|
-
{...contentProps}
|
|
108
|
-
className={classNames(toastContainerStyles, 'spectrum-Toast-contentWrapper')}>
|
|
109
|
-
{Icon &&
|
|
110
|
-
<Icon
|
|
111
|
-
aria-label={iconLabel}
|
|
112
|
-
UNSAFE_className={classNames(styles, 'spectrum-Toast-typeIcon')} />
|
|
113
|
-
}
|
|
114
|
-
<div className={classNames(styles, 'spectrum-Toast-body')} role="presentation">
|
|
115
|
-
<div className={classNames(styles, 'spectrum-Toast-content')} role="presentation" {...titleProps}>{children}</div>
|
|
116
|
-
{actionLabel &&
|
|
117
|
-
<Button
|
|
118
|
-
onPress={handleAction}
|
|
119
|
-
UNSAFE_className={classNames(styles, 'spectrum-Button')}
|
|
120
|
-
variant="secondary"
|
|
121
|
-
staticColor="white"
|
|
122
|
-
data-testid="rsp-Toast-secondaryButton">
|
|
123
|
-
{actionLabel}
|
|
124
|
-
</Button>
|
|
125
|
-
}
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
<div className={classNames(styles, 'spectrum-Toast-buttons')}>
|
|
129
|
-
<ClearButton {...closeButtonProps} variant="overBackground" data-testid="rsp-Toast-closeButton">
|
|
130
|
-
<CrossMedium />
|
|
131
|
-
</ClearButton>
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
);
|
|
135
|
-
});
|
package/src/ToastContainer.tsx
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {AriaToastRegionProps} from '@react-aria/toast';
|
|
14
|
-
import {classNames} from '@react-spectrum/utils';
|
|
15
|
-
import {DOMProps} from '@react-types/shared';
|
|
16
|
-
import {filterDOMProps} from '@react-aria/utils';
|
|
17
|
-
import {flushSync} from 'react-dom';
|
|
18
|
-
import React, {ReactElement, useEffect, useMemo, useRef} from 'react';
|
|
19
|
-
import {SpectrumToastValue, Toast} from './Toast';
|
|
20
|
-
import toastContainerStyles from './toastContainer.css';
|
|
21
|
-
import {Toaster} from './Toaster';
|
|
22
|
-
import {ToastOptions, ToastQueue, useToastQueue} from '@react-stately/toast';
|
|
23
|
-
import {useSyncExternalStore} from 'use-sync-external-store/shim/index.js';
|
|
24
|
-
|
|
25
|
-
export type ToastPlacement = 'top' | 'top end' | 'bottom' | 'bottom end';
|
|
26
|
-
|
|
27
|
-
export interface SpectrumToastContainerProps extends AriaToastRegionProps {
|
|
28
|
-
placement?: ToastPlacement
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface SpectrumToastOptions extends ToastOptions, DOMProps {
|
|
32
|
-
/** A label for the action button within the toast. */
|
|
33
|
-
actionLabel?: string,
|
|
34
|
-
/** Handler that is called when the action button is pressed. */
|
|
35
|
-
onAction?: () => void,
|
|
36
|
-
/** Whether the toast should automatically close when an action is performed. */
|
|
37
|
-
shouldCloseOnAction?: boolean
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
type CloseFunction = () => void;
|
|
41
|
-
|
|
42
|
-
function wrapInViewTransition(fn: () => void): void {
|
|
43
|
-
if ('startViewTransition' in document) {
|
|
44
|
-
document.startViewTransition(() => {
|
|
45
|
-
flushSync(fn);
|
|
46
|
-
}).ready.catch(() => {});
|
|
47
|
-
} else {
|
|
48
|
-
fn();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// There is a single global toast queue instance for the whole app, initialized lazily.
|
|
53
|
-
let globalToastQueue: ToastQueue<SpectrumToastValue> | null = null;
|
|
54
|
-
function getGlobalToastQueue() {
|
|
55
|
-
if (!globalToastQueue) {
|
|
56
|
-
globalToastQueue = new ToastQueue({
|
|
57
|
-
maxVisibleToasts: Infinity,
|
|
58
|
-
wrapUpdate: wrapInViewTransition
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return globalToastQueue;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// For testing. Not exported from the package index.
|
|
66
|
-
export function clearToastQueue(): void {
|
|
67
|
-
globalToastQueue = null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
let toastProviders = new Set();
|
|
71
|
-
let subscriptions = new Set<() => void>();
|
|
72
|
-
function subscribe(fn: () => void) {
|
|
73
|
-
subscriptions.add(fn);
|
|
74
|
-
return () => subscriptions.delete(fn);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function triggerSubscriptions() {
|
|
78
|
-
for (let fn of subscriptions) {
|
|
79
|
-
fn();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function getActiveToastContainer() {
|
|
84
|
-
return toastProviders.values().next().value;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function useActiveToastContainer() {
|
|
88
|
-
return useSyncExternalStore(subscribe, getActiveToastContainer, getActiveToastContainer);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* A ToastContainer renders the queued toasts in an application. It should be placed
|
|
93
|
-
* at the root of the app.
|
|
94
|
-
*/
|
|
95
|
-
export function ToastContainer(props: SpectrumToastContainerProps): ReactElement | null {
|
|
96
|
-
// Track all toast provider instances in a set.
|
|
97
|
-
// Only the first one will actually render.
|
|
98
|
-
// We use a ref to do this, since it will have a stable identity
|
|
99
|
-
// over the lifetime of the component.
|
|
100
|
-
let ref = useRef(null);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
useEffect(() => {
|
|
104
|
-
toastProviders.add(ref);
|
|
105
|
-
triggerSubscriptions();
|
|
106
|
-
|
|
107
|
-
return () => {
|
|
108
|
-
// Remove this toast provider, and call subscriptions.
|
|
109
|
-
// This will cause all other instances to re-render,
|
|
110
|
-
// and the first one to become the new active toast provider.
|
|
111
|
-
toastProviders.delete(ref);
|
|
112
|
-
triggerSubscriptions();
|
|
113
|
-
};
|
|
114
|
-
}, []);
|
|
115
|
-
|
|
116
|
-
// Only render if this is the active toast provider instance, and there are visible toasts.
|
|
117
|
-
let activeToastContainer = useActiveToastContainer();
|
|
118
|
-
let state = useToastQueue(getGlobalToastQueue());
|
|
119
|
-
|
|
120
|
-
let {placement, isCentered} = useMemo(() => {
|
|
121
|
-
let placements = (props.placement ?? 'bottom').split(' ');
|
|
122
|
-
let placement = placements[placements.length - 1];
|
|
123
|
-
let isCentered = placements.length === 1;
|
|
124
|
-
return {placement, isCentered};
|
|
125
|
-
}, [props.placement]);
|
|
126
|
-
|
|
127
|
-
if (ref === activeToastContainer && state.visibleToasts.length > 0) {
|
|
128
|
-
return (
|
|
129
|
-
<Toaster state={state} {...props}>
|
|
130
|
-
<ol className={classNames(toastContainerStyles, 'spectrum-ToastContainer-list')}>
|
|
131
|
-
{state.visibleToasts.map((toast, index) => {
|
|
132
|
-
let shouldFade = isCentered && index !== 0;
|
|
133
|
-
return (
|
|
134
|
-
<li
|
|
135
|
-
key={toast.key}
|
|
136
|
-
className={classNames(toastContainerStyles, 'spectrum-ToastContainer-listitem')}
|
|
137
|
-
style={{
|
|
138
|
-
viewTransitionName: toast.key,
|
|
139
|
-
viewTransitionClass: classNames(
|
|
140
|
-
toastContainerStyles,
|
|
141
|
-
'toast',
|
|
142
|
-
placement,
|
|
143
|
-
{'fadeOnly': shouldFade}
|
|
144
|
-
)
|
|
145
|
-
}}>
|
|
146
|
-
<Toast
|
|
147
|
-
toast={toast}
|
|
148
|
-
state={state} />
|
|
149
|
-
</li>
|
|
150
|
-
);
|
|
151
|
-
})}
|
|
152
|
-
</ol>
|
|
153
|
-
</Toaster>
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function addToast(children: string, variant: SpectrumToastValue['variant'], options: SpectrumToastOptions = {}) {
|
|
161
|
-
// Dispatch a custom event so that toasts can be intercepted and re-targeted, e.g. when inside an iframe.
|
|
162
|
-
if (typeof CustomEvent !== 'undefined' && typeof window !== 'undefined') {
|
|
163
|
-
let event = new CustomEvent('react-spectrum-toast', {
|
|
164
|
-
cancelable: true,
|
|
165
|
-
bubbles: true,
|
|
166
|
-
detail: {
|
|
167
|
-
children,
|
|
168
|
-
variant,
|
|
169
|
-
options
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
let shouldContinue = window.dispatchEvent(event);
|
|
174
|
-
if (!shouldContinue) {
|
|
175
|
-
return () => {};
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
let value = {
|
|
180
|
-
children,
|
|
181
|
-
variant,
|
|
182
|
-
actionLabel: options.actionLabel,
|
|
183
|
-
onAction: options.onAction,
|
|
184
|
-
shouldCloseOnAction: options.shouldCloseOnAction,
|
|
185
|
-
...filterDOMProps(options)
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
// Minimum time of 5s from https://spectrum.adobe.com/page/toast/#Auto-dismissible
|
|
189
|
-
// Actionable toasts cannot be auto dismissed. That would fail WCAG SC 2.2.1.
|
|
190
|
-
// It is debatable whether non-actionable toasts would also fail.
|
|
191
|
-
let timeout = options.timeout && !options.onAction ? Math.max(options.timeout, 5000) : undefined;
|
|
192
|
-
let queue = getGlobalToastQueue();
|
|
193
|
-
let key = queue.add(value, {timeout, onClose: options.onClose});
|
|
194
|
-
return () => queue.close(key);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
const SpectrumToastQueue = {
|
|
198
|
-
/** Queues a neutral toast. */
|
|
199
|
-
neutral(children: string, options: SpectrumToastOptions = {}): CloseFunction {
|
|
200
|
-
return addToast(children, 'neutral', options);
|
|
201
|
-
},
|
|
202
|
-
/** Queues a positive toast. */
|
|
203
|
-
positive(children: string, options: SpectrumToastOptions = {}): CloseFunction {
|
|
204
|
-
return addToast(children, 'positive', options);
|
|
205
|
-
},
|
|
206
|
-
/** Queues a negative toast. */
|
|
207
|
-
negative(children: string, options: SpectrumToastOptions = {}): CloseFunction {
|
|
208
|
-
return addToast(children, 'negative', options);
|
|
209
|
-
},
|
|
210
|
-
/** Queues an informational toast. */
|
|
211
|
-
info(children: string, options: SpectrumToastOptions = {}): CloseFunction {
|
|
212
|
-
return addToast(children, 'info', options);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
export {SpectrumToastQueue as ToastQueue};
|
package/src/Toaster.tsx
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {AriaToastRegionProps, useToastRegion} from '@react-aria/toast';
|
|
14
|
-
import {classNames} from '@react-spectrum/utils';
|
|
15
|
-
import {FocusScope, useFocusRing} from '@react-aria/focus';
|
|
16
|
-
import {mergeProps} from '@react-aria/utils';
|
|
17
|
-
import {Provider} from '@react-spectrum/provider';
|
|
18
|
-
import React, {createContext, ReactElement, ReactNode, useMemo, useRef} from 'react';
|
|
19
|
-
import ReactDOM from 'react-dom';
|
|
20
|
-
import toastContainerStyles from './toastContainer.css';
|
|
21
|
-
import type {ToastPlacement} from './ToastContainer';
|
|
22
|
-
import {ToastState} from '@react-stately/toast';
|
|
23
|
-
import {useUNSAFE_PortalContext} from '@react-aria/overlays';
|
|
24
|
-
|
|
25
|
-
interface ToastContainerProps extends AriaToastRegionProps {
|
|
26
|
-
children: ReactNode,
|
|
27
|
-
state: ToastState<unknown>,
|
|
28
|
-
placement?: ToastPlacement
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const ToasterContext = createContext(false);
|
|
32
|
-
|
|
33
|
-
export function Toaster(props: ToastContainerProps): ReactElement {
|
|
34
|
-
let {
|
|
35
|
-
children,
|
|
36
|
-
state
|
|
37
|
-
} = props;
|
|
38
|
-
|
|
39
|
-
let ref = useRef(null);
|
|
40
|
-
let {regionProps} = useToastRegion(props, state, ref);
|
|
41
|
-
let {focusProps, isFocusVisible} = useFocusRing();
|
|
42
|
-
let {getContainer} = useUNSAFE_PortalContext();
|
|
43
|
-
|
|
44
|
-
let [position, placement] = useMemo(() => {
|
|
45
|
-
let [pos = 'bottom', place = 'center'] = props.placement?.split(' ') || [];
|
|
46
|
-
return [pos, place];
|
|
47
|
-
}, [props.placement]);
|
|
48
|
-
|
|
49
|
-
let contents = (
|
|
50
|
-
<Provider UNSAFE_style={{background: 'transparent'}}>
|
|
51
|
-
<FocusScope>
|
|
52
|
-
<ToasterContext.Provider value={isFocusVisible}>
|
|
53
|
-
<div
|
|
54
|
-
{...mergeProps(regionProps, focusProps)}
|
|
55
|
-
ref={ref}
|
|
56
|
-
data-position={position}
|
|
57
|
-
data-placement={placement}
|
|
58
|
-
className={classNames(
|
|
59
|
-
toastContainerStyles,
|
|
60
|
-
'react-spectrum-ToastContainer',
|
|
61
|
-
{'focus-ring': isFocusVisible}
|
|
62
|
-
)}>
|
|
63
|
-
{children}
|
|
64
|
-
</div>
|
|
65
|
-
</ToasterContext.Provider>
|
|
66
|
-
</FocusScope>
|
|
67
|
-
</Provider>
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
return ReactDOM.createPortal(contents, getContainer?.() ?? document.body);
|
|
71
|
-
}
|