@react-aria/toast 3.0.0-beta.1 → 3.0.0-beta.11
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/ar-AE.main.js +7 -0
- package/dist/ar-AE.main.js.map +1 -0
- package/dist/ar-AE.mjs +9 -0
- package/dist/ar-AE.module.js +9 -0
- package/dist/ar-AE.module.js.map +1 -0
- package/dist/bg-BG.main.js +7 -0
- package/dist/bg-BG.main.js.map +1 -0
- package/dist/bg-BG.mjs +9 -0
- package/dist/bg-BG.module.js +9 -0
- package/dist/bg-BG.module.js.map +1 -0
- package/dist/cs-CZ.main.js +7 -0
- package/dist/cs-CZ.main.js.map +1 -0
- package/dist/cs-CZ.mjs +9 -0
- package/dist/cs-CZ.module.js +9 -0
- package/dist/cs-CZ.module.js.map +1 -0
- package/dist/da-DK.main.js +7 -0
- package/dist/da-DK.main.js.map +1 -0
- package/dist/da-DK.mjs +9 -0
- package/dist/da-DK.module.js +9 -0
- package/dist/da-DK.module.js.map +1 -0
- package/dist/de-DE.main.js +7 -0
- package/dist/de-DE.main.js.map +1 -0
- package/dist/de-DE.mjs +9 -0
- package/dist/de-DE.module.js +9 -0
- package/dist/de-DE.module.js.map +1 -0
- package/dist/el-GR.main.js +7 -0
- package/dist/el-GR.main.js.map +1 -0
- package/dist/el-GR.mjs +9 -0
- package/dist/el-GR.module.js +9 -0
- package/dist/el-GR.module.js.map +1 -0
- package/dist/en-US.main.js +7 -0
- package/dist/en-US.main.js.map +1 -0
- package/dist/en-US.mjs +9 -0
- package/dist/en-US.module.js +9 -0
- package/dist/en-US.module.js.map +1 -0
- package/dist/es-ES.main.js +7 -0
- package/dist/es-ES.main.js.map +1 -0
- package/dist/es-ES.mjs +9 -0
- package/dist/es-ES.module.js +9 -0
- package/dist/es-ES.module.js.map +1 -0
- package/dist/et-EE.main.js +7 -0
- package/dist/et-EE.main.js.map +1 -0
- package/dist/et-EE.mjs +9 -0
- package/dist/et-EE.module.js +9 -0
- package/dist/et-EE.module.js.map +1 -0
- package/dist/fi-FI.main.js +7 -0
- package/dist/fi-FI.main.js.map +1 -0
- package/dist/fi-FI.mjs +9 -0
- package/dist/fi-FI.module.js +9 -0
- package/dist/fi-FI.module.js.map +1 -0
- package/dist/fr-FR.main.js +7 -0
- package/dist/fr-FR.main.js.map +1 -0
- package/dist/fr-FR.mjs +9 -0
- package/dist/fr-FR.module.js +9 -0
- package/dist/fr-FR.module.js.map +1 -0
- package/dist/he-IL.main.js +7 -0
- package/dist/he-IL.main.js.map +1 -0
- package/dist/he-IL.mjs +9 -0
- package/dist/he-IL.module.js +9 -0
- package/dist/he-IL.module.js.map +1 -0
- package/dist/hr-HR.main.js +7 -0
- package/dist/hr-HR.main.js.map +1 -0
- package/dist/hr-HR.mjs +9 -0
- package/dist/hr-HR.module.js +9 -0
- package/dist/hr-HR.module.js.map +1 -0
- package/dist/hu-HU.main.js +7 -0
- package/dist/hu-HU.main.js.map +1 -0
- package/dist/hu-HU.mjs +9 -0
- package/dist/hu-HU.module.js +9 -0
- package/dist/hu-HU.module.js.map +1 -0
- package/dist/import.mjs +3 -414
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/it-IT.main.js +7 -0
- package/dist/it-IT.main.js.map +1 -0
- package/dist/it-IT.mjs +9 -0
- package/dist/it-IT.module.js +9 -0
- package/dist/it-IT.module.js.map +1 -0
- package/dist/ja-JP.main.js +7 -0
- package/dist/ja-JP.main.js.map +1 -0
- package/dist/ja-JP.mjs +9 -0
- package/dist/ja-JP.module.js +9 -0
- package/dist/ja-JP.module.js.map +1 -0
- package/dist/ko-KR.main.js +7 -0
- package/dist/ko-KR.main.js.map +1 -0
- package/dist/ko-KR.mjs +9 -0
- package/dist/ko-KR.module.js +9 -0
- package/dist/ko-KR.module.js.map +1 -0
- package/dist/lt-LT.main.js +7 -0
- package/dist/lt-LT.main.js.map +1 -0
- package/dist/lt-LT.mjs +9 -0
- package/dist/lt-LT.module.js +9 -0
- package/dist/lt-LT.module.js.map +1 -0
- package/dist/lv-LV.main.js +7 -0
- package/dist/lv-LV.main.js.map +1 -0
- package/dist/lv-LV.mjs +9 -0
- package/dist/lv-LV.module.js +9 -0
- package/dist/lv-LV.module.js.map +1 -0
- package/dist/main.js +6 -416
- package/dist/main.js.map +1 -1
- package/dist/module.js +3 -414
- package/dist/module.js.map +1 -1
- package/dist/nb-NO.main.js +7 -0
- package/dist/nb-NO.main.js.map +1 -0
- package/dist/nb-NO.mjs +9 -0
- package/dist/nb-NO.module.js +9 -0
- package/dist/nb-NO.module.js.map +1 -0
- package/dist/nl-NL.main.js +7 -0
- package/dist/nl-NL.main.js.map +1 -0
- package/dist/nl-NL.mjs +9 -0
- package/dist/nl-NL.module.js +9 -0
- package/dist/nl-NL.module.js.map +1 -0
- package/dist/pl-PL.main.js +7 -0
- package/dist/pl-PL.main.js.map +1 -0
- package/dist/pl-PL.mjs +9 -0
- package/dist/pl-PL.module.js +9 -0
- package/dist/pl-PL.module.js.map +1 -0
- package/dist/pt-BR.main.js +7 -0
- package/dist/pt-BR.main.js.map +1 -0
- package/dist/pt-BR.mjs +9 -0
- package/dist/pt-BR.module.js +9 -0
- package/dist/pt-BR.module.js.map +1 -0
- package/dist/pt-PT.main.js +7 -0
- package/dist/pt-PT.main.js.map +1 -0
- package/dist/pt-PT.mjs +9 -0
- package/dist/pt-PT.module.js +9 -0
- package/dist/pt-PT.module.js.map +1 -0
- package/dist/ro-RO.main.js +7 -0
- package/dist/ro-RO.main.js.map +1 -0
- package/dist/ro-RO.mjs +9 -0
- package/dist/ro-RO.module.js +9 -0
- package/dist/ro-RO.module.js.map +1 -0
- package/dist/ru-RU.main.js +7 -0
- package/dist/ru-RU.main.js.map +1 -0
- package/dist/ru-RU.mjs +9 -0
- package/dist/ru-RU.module.js +9 -0
- package/dist/ru-RU.module.js.map +1 -0
- package/dist/sk-SK.main.js +7 -0
- package/dist/sk-SK.main.js.map +1 -0
- package/dist/sk-SK.mjs +9 -0
- package/dist/sk-SK.module.js +9 -0
- package/dist/sk-SK.module.js.map +1 -0
- package/dist/sl-SI.main.js +7 -0
- package/dist/sl-SI.main.js.map +1 -0
- package/dist/sl-SI.mjs +9 -0
- package/dist/sl-SI.module.js +9 -0
- package/dist/sl-SI.module.js.map +1 -0
- package/dist/sr-SP.main.js +7 -0
- package/dist/sr-SP.main.js.map +1 -0
- package/dist/sr-SP.mjs +9 -0
- package/dist/sr-SP.module.js +9 -0
- package/dist/sr-SP.module.js.map +1 -0
- package/dist/sv-SE.main.js +7 -0
- package/dist/sv-SE.main.js.map +1 -0
- package/dist/sv-SE.mjs +9 -0
- package/dist/sv-SE.module.js +9 -0
- package/dist/sv-SE.module.js.map +1 -0
- package/dist/tr-TR.main.js +7 -0
- package/dist/tr-TR.main.js.map +1 -0
- package/dist/tr-TR.mjs +9 -0
- package/dist/tr-TR.module.js +9 -0
- package/dist/tr-TR.module.js.map +1 -0
- package/dist/uk-UA.main.js +7 -0
- package/dist/uk-UA.main.js.map +1 -0
- package/dist/uk-UA.mjs +9 -0
- package/dist/uk-UA.module.js +9 -0
- package/dist/uk-UA.module.js.map +1 -0
- package/dist/useToast.main.js +92 -0
- package/dist/useToast.main.js.map +1 -0
- package/dist/useToast.mjs +87 -0
- package/dist/useToast.module.js +87 -0
- package/dist/useToast.module.js.map +1 -0
- package/dist/useToastRegion.main.js +73 -0
- package/dist/useToastRegion.main.js.map +1 -0
- package/dist/useToastRegion.mjs +68 -0
- package/dist/useToastRegion.module.js +68 -0
- package/dist/useToastRegion.module.js.map +1 -0
- package/dist/zh-CN.main.js +7 -0
- package/dist/zh-CN.main.js.map +1 -0
- package/dist/zh-CN.mjs +9 -0
- package/dist/zh-CN.module.js +9 -0
- package/dist/zh-CN.module.js.map +1 -0
- package/dist/zh-TW.main.js +7 -0
- package/dist/zh-TW.main.js.map +1 -0
- package/dist/zh-TW.mjs +9 -0
- package/dist/zh-TW.module.js +9 -0
- package/dist/zh-TW.module.js.map +1 -0
- package/package.json +10 -10
- package/src/useToast.ts +1 -1
- package/src/useToastRegion.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,MAAM,CAAC;IACnC,iBAAiB,CAAC,kBAAY,CAAC;AACjC","sources":["packages/@react-aria/toast/intl/pt-PT.json"],"sourcesContent":["{\n \"close\": \"Fechar\",\n \"notifications\": \"Notificações\"\n}\n"],"names":[],"version":3,"file":"pt-PT.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,kBAAS,CAAC;IACtC,iBAAiB,CAAC,gBAAU,CAAC;AAC/B","sources":["packages/@react-aria/toast/intl/ro-RO.json"],"sourcesContent":["{\n \"close\": \"Închideţi\",\n \"notifications\": \"Notificări\"\n}\n"],"names":[],"version":3,"file":"ro-RO.main.js.map"}
|
package/dist/ro-RO.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,kBAAS,CAAC;IACtC,iBAAiB,CAAC,gBAAU,CAAC;AAC/B","sources":["packages/@react-aria/toast/intl/ro-RO.json"],"sourcesContent":["{\n \"close\": \"Închideţi\",\n \"notifications\": \"Notificări\"\n}\n"],"names":[],"version":3,"file":"ro-RO.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,iDAAO,CAAC;IACpC,iBAAiB,CAAC,6EAAW,CAAC;AAChC","sources":["packages/@react-aria/toast/intl/ru-RU.json"],"sourcesContent":["{\n \"close\": \"Закрыть\",\n \"notifications\": \"Уведомления\"\n}\n"],"names":[],"version":3,"file":"ru-RU.main.js.map"}
|
package/dist/ru-RU.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var $9a7dcb914b29cd9f$exports = {};
|
|
2
|
+
$9a7dcb914b29cd9f$exports = {
|
|
3
|
+
"close": `\u{417}\u{430}\u{43A}\u{440}\u{44B}\u{442}\u{44C}`,
|
|
4
|
+
"notifications": `\u{423}\u{432}\u{435}\u{434}\u{43E}\u{43C}\u{43B}\u{435}\u{43D}\u{438}\u{44F}`
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export {$9a7dcb914b29cd9f$exports as default};
|
|
9
|
+
//# sourceMappingURL=ru-RU.mjs.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var $9a7dcb914b29cd9f$exports = {};
|
|
2
|
+
$9a7dcb914b29cd9f$exports = {
|
|
3
|
+
"close": `\u{417}\u{430}\u{43A}\u{440}\u{44B}\u{442}\u{44C}`,
|
|
4
|
+
"notifications": `\u{423}\u{432}\u{435}\u{434}\u{43E}\u{43C}\u{43B}\u{435}\u{43D}\u{438}\u{44F}`
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export {$9a7dcb914b29cd9f$exports as default};
|
|
9
|
+
//# sourceMappingURL=ru-RU.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,iDAAO,CAAC;IACpC,iBAAiB,CAAC,6EAAW,CAAC;AAChC","sources":["packages/@react-aria/toast/intl/ru-RU.json"],"sourcesContent":["{\n \"close\": \"Закрыть\",\n \"notifications\": \"Уведомления\"\n}\n"],"names":[],"version":3,"file":"ru-RU.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,cAAQ,CAAC;IACrC,iBAAiB,CAAC,YAAS,CAAC;AAC9B","sources":["packages/@react-aria/toast/intl/sk-SK.json"],"sourcesContent":["{\n \"close\": \"Zatvoriť\",\n \"notifications\": \"Oznámenia\"\n}\n"],"names":[],"version":3,"file":"sk-SK.main.js.map"}
|
package/dist/sk-SK.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,cAAQ,CAAC;IACrC,iBAAiB,CAAC,YAAS,CAAC;AAC9B","sources":["packages/@react-aria/toast/intl/sk-SK.json"],"sourcesContent":["{\n \"close\": \"Zatvoriť\",\n \"notifications\": \"Oznámenia\"\n}\n"],"names":[],"version":3,"file":"sk-SK.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,iBAAiB,CAAC,SAAS,CAAC;AAC9B","sources":["packages/@react-aria/toast/intl/sl-SI.json"],"sourcesContent":["{\n \"close\": \"Zapri\",\n \"notifications\": \"Obvestila\"\n}\n"],"names":[],"version":3,"file":"sl-SI.main.js.map"}
|
package/dist/sl-SI.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,iBAAiB,CAAC,SAAS,CAAC;AAC9B","sources":["packages/@react-aria/toast/intl/sl-SI.json"],"sourcesContent":["{\n \"close\": \"Zapri\",\n \"notifications\": \"Obvestila\"\n}\n"],"names":[],"version":3,"file":"sl-SI.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,OAAO,CAAC;IACpC,iBAAiB,CAAC,iBAAW,CAAC;AAChC","sources":["packages/@react-aria/toast/intl/sr-SP.json"],"sourcesContent":["{\n \"close\": \"Zatvori\",\n \"notifications\": \"Obaveštenja\"\n}\n"],"names":[],"version":3,"file":"sr-SP.main.js.map"}
|
package/dist/sr-SP.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,OAAO,CAAC;IACpC,iBAAiB,CAAC,iBAAW,CAAC;AAChC","sources":["packages/@react-aria/toast/intl/sr-SP.json"],"sourcesContent":["{\n \"close\": \"Zatvori\",\n \"notifications\": \"Obaveštenja\"\n}\n"],"names":[],"version":3,"file":"sr-SP.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,QAAK,CAAC;IAClC,iBAAiB,CAAC,WAAW,CAAC;AAChC","sources":["packages/@react-aria/toast/intl/sv-SE.json"],"sourcesContent":["{\n \"close\": \"Stäng\",\n \"notifications\": \"Aviseringar\"\n}\n"],"names":[],"version":3,"file":"sv-SE.main.js.map"}
|
package/dist/sv-SE.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,QAAK,CAAC;IAClC,iBAAiB,CAAC,WAAW,CAAC;AAChC","sources":["packages/@react-aria/toast/intl/sv-SE.json"],"sourcesContent":["{\n \"close\": \"Stäng\",\n \"notifications\": \"Aviseringar\"\n}\n"],"names":[],"version":3,"file":"sv-SE.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,iBAAiB,CAAC,WAAW,CAAC;AAChC","sources":["packages/@react-aria/toast/intl/tr-TR.json"],"sourcesContent":["{\n \"close\": \"Kapat\",\n \"notifications\": \"Bildirimler\"\n}\n"],"names":[],"version":3,"file":"tr-TR.main.js.map"}
|
package/dist/tr-TR.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,iBAAiB,CAAC,WAAW,CAAC;AAChC","sources":["packages/@react-aria/toast/intl/tr-TR.json"],"sourcesContent":["{\n \"close\": \"Kapat\",\n \"notifications\": \"Bildirimler\"\n}\n"],"names":[],"version":3,"file":"tr-TR.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,iDAAO,CAAC;IACpC,iBAAiB,CAAC,sEAAU,CAAC;AAC/B","sources":["packages/@react-aria/toast/intl/uk-UA.json"],"sourcesContent":["{\n \"close\": \"Закрити\",\n \"notifications\": \"Сповіщення\"\n}\n"],"names":[],"version":3,"file":"uk-UA.main.js.map"}
|
package/dist/uk-UA.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var $32ee419c7b9b7a83$exports = {};
|
|
2
|
+
$32ee419c7b9b7a83$exports = {
|
|
3
|
+
"close": `\u{417}\u{430}\u{43A}\u{440}\u{438}\u{442}\u{438}`,
|
|
4
|
+
"notifications": `\u{421}\u{43F}\u{43E}\u{432}\u{456}\u{449}\u{435}\u{43D}\u{43D}\u{44F}`
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export {$32ee419c7b9b7a83$exports as default};
|
|
9
|
+
//# sourceMappingURL=uk-UA.mjs.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var $32ee419c7b9b7a83$exports = {};
|
|
2
|
+
$32ee419c7b9b7a83$exports = {
|
|
3
|
+
"close": `\u{417}\u{430}\u{43A}\u{440}\u{438}\u{442}\u{438}`,
|
|
4
|
+
"notifications": `\u{421}\u{43F}\u{43E}\u{432}\u{456}\u{449}\u{435}\u{43D}\u{43D}\u{44F}`
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export {$32ee419c7b9b7a83$exports as default};
|
|
9
|
+
//# sourceMappingURL=uk-UA.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,iDAAO,CAAC;IACpC,iBAAiB,CAAC,sEAAU,CAAC;AAC/B","sources":["packages/@react-aria/toast/intl/uk-UA.json"],"sourcesContent":["{\n \"close\": \"Закрити\",\n \"notifications\": \"Сповіщення\"\n}\n"],"names":[],"version":3,"file":"uk-UA.module.js.map"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var $f49b2d6c91681304$exports = require("./intlStrings.main.js");
|
|
2
|
+
var $ijFUR$react = require("react");
|
|
3
|
+
var $ijFUR$reactariautils = require("@react-aria/utils");
|
|
4
|
+
var $ijFUR$reactariai18n = require("@react-aria/i18n");
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function $parcel$export(e, n, v, s) {
|
|
12
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
$parcel$export(module.exports, "useToast", () => $ec537504faac71d2$export$a407b657d3044108);
|
|
16
|
+
/*
|
|
17
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
+
* governing permissions and limitations under the License.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
function $ec537504faac71d2$export$a407b657d3044108(props, state, ref) {
|
|
31
|
+
let { key: key, timer: timer, timeout: timeout, animation: animation } = props.toast;
|
|
32
|
+
(0, $ijFUR$react.useEffect)(()=>{
|
|
33
|
+
if (!timer) return;
|
|
34
|
+
timer.reset(timeout);
|
|
35
|
+
return ()=>{
|
|
36
|
+
timer.pause();
|
|
37
|
+
};
|
|
38
|
+
}, [
|
|
39
|
+
timer,
|
|
40
|
+
timeout
|
|
41
|
+
]);
|
|
42
|
+
// Restore focus to the toast container on unmount.
|
|
43
|
+
// If there are no more toasts, the container will be unmounted
|
|
44
|
+
// and will restore focus to wherever focus was before the user
|
|
45
|
+
// focused the toast region.
|
|
46
|
+
let focusOnUnmount = (0, $ijFUR$react.useRef)(null);
|
|
47
|
+
(0, $ijFUR$reactariautils.useLayoutEffect)(()=>{
|
|
48
|
+
let container = ref.current.closest("[role=region]");
|
|
49
|
+
return ()=>{
|
|
50
|
+
if (container && container.contains(document.activeElement)) // Focus must be delayed for focus ring to appear, but we can't wait
|
|
51
|
+
// until useEffect cleanup to check if focus was inside the container.
|
|
52
|
+
focusOnUnmount.current = container;
|
|
53
|
+
};
|
|
54
|
+
}, [
|
|
55
|
+
ref
|
|
56
|
+
]);
|
|
57
|
+
// eslint-disable-next-line
|
|
58
|
+
(0, $ijFUR$react.useEffect)(()=>{
|
|
59
|
+
return ()=>{
|
|
60
|
+
if (focusOnUnmount.current) focusOnUnmount.current.focus();
|
|
61
|
+
};
|
|
62
|
+
}, [
|
|
63
|
+
ref
|
|
64
|
+
]);
|
|
65
|
+
let titleId = (0, $ijFUR$reactariautils.useId)();
|
|
66
|
+
let descriptionId = (0, $ijFUR$reactariautils.useSlotId)();
|
|
67
|
+
let stringFormatter = (0, $ijFUR$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($f49b2d6c91681304$exports))), "@react-aria/toast");
|
|
68
|
+
return {
|
|
69
|
+
toastProps: {
|
|
70
|
+
role: "alert",
|
|
71
|
+
"aria-label": props["aria-label"],
|
|
72
|
+
"aria-labelledby": props["aria-labelledby"] || titleId,
|
|
73
|
+
"aria-describedby": props["aria-describedby"] || descriptionId,
|
|
74
|
+
"aria-details": props["aria-details"],
|
|
75
|
+
// Hide toasts that are animating out so VoiceOver doesn't announce them.
|
|
76
|
+
"aria-hidden": animation === "exiting" ? "true" : undefined
|
|
77
|
+
},
|
|
78
|
+
titleProps: {
|
|
79
|
+
id: titleId
|
|
80
|
+
},
|
|
81
|
+
descriptionProps: {
|
|
82
|
+
id: descriptionId
|
|
83
|
+
},
|
|
84
|
+
closeButtonProps: {
|
|
85
|
+
"aria-label": stringFormatter.format("close"),
|
|
86
|
+
onPress: ()=>state.close(key)
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=useToast.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AA+BM,SAAS,0CAAY,KAAwB,EAAE,KAAoB,EAAE,GAAgC;IAC1G,IAAI,OACF,GAAG,SACH,KAAK,WACL,OAAO,aACP,SAAS,EACV,GAAG,MAAM,KAAK;IAEf,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAC,OACH;QAGF,MAAM,KAAK,CAAC;QACZ,OAAO;YACL,MAAM,KAAK;QACb;IACF,GAAG;QAAC;QAAO;KAAQ;IAEnB,mDAAmD;IACnD,+DAA+D;IAC/D,+DAA+D;IAC/D,4BAA4B;IAC5B,IAAI,iBAAiB,CAAA,GAAA,mBAAK,EAAE;IAC5B,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;QACpC,OAAO;YACL,IAAI,aAAa,UAAU,QAAQ,CAAC,SAAS,aAAa,GACxD,oEAAoE;YACpE,sEAAsE;YACtE,eAAe,OAAO,GAAG;QAE7B;IACF,GAAG;QAAC;KAAI;IAER,2BAA2B;IAC3B,CAAA,GAAA,sBAAQ,EAAE;QACR,OAAO;YACL,IAAI,eAAe,OAAO,EACxB,eAAe,OAAO,CAAC,KAAK;QAEhC;IACF,GAAG;QAAC;KAAI;IAER,IAAI,UAAU,CAAA,GAAA,2BAAI;IAClB,IAAI,gBAAgB,CAAA,GAAA,+BAAQ;IAC5B,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAEhE,OAAO;QACL,YAAY;YACV,MAAM;YACN,cAAc,KAAK,CAAC,aAAa;YACjC,mBAAmB,KAAK,CAAC,kBAAkB,IAAI;YAC/C,oBAAoB,KAAK,CAAC,mBAAmB,IAAI;YACjD,gBAAgB,KAAK,CAAC,eAAe;YACrC,yEAAyE;YACzE,eAAe,cAAc,YAAY,SAAS;QACpD;QACA,YAAY;YACV,IAAI;QACN;QACA,kBAAkB;YAChB,IAAI;QACN;QACA,kBAAkB;YAChB,cAAc,gBAAgB,MAAM,CAAC;YACrC,SAAS,IAAM,MAAM,KAAK,CAAC;QAC7B;IACF;AACF","sources":["packages/@react-aria/toast/src/useToast.ts"],"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 {AriaButtonProps} from '@react-types/button';\nimport {AriaLabelingProps, DOMAttributes, FocusableElement} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {QueuedToast, ToastState} from '@react-stately/toast';\nimport {RefObject, useEffect, useRef} from 'react';\nimport {useId, useLayoutEffect, useSlotId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaToastProps<T> extends AriaLabelingProps {\n /** The toast object. */\n toast: QueuedToast<T>\n}\n\nexport interface ToastAria {\n /** Props for the toast container element. */\n toastProps: DOMAttributes,\n /** Props for the toast title element. */\n titleProps: DOMAttributes,\n /** Props for the toast description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the toast close button. */\n closeButtonProps: AriaButtonProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a toast component.\n * Toasts display brief, temporary notifications of actions, errors, or other events in an application.\n */\nexport function useToast<T>(props: AriaToastProps<T>, state: ToastState<T>, ref: RefObject<FocusableElement>): ToastAria {\n let {\n key,\n timer,\n timeout,\n animation\n } = props.toast;\n\n useEffect(() => {\n if (!timer) {\n return;\n }\n\n timer.reset(timeout);\n return () => {\n timer.pause();\n };\n }, [timer, timeout]);\n\n // Restore focus to the toast container on unmount.\n // If there are no more toasts, the container will be unmounted\n // and will restore focus to wherever focus was before the user\n // focused the toast region.\n let focusOnUnmount = useRef(null);\n useLayoutEffect(() => {\n let container = ref.current.closest('[role=region]') as HTMLElement;\n return () => {\n if (container && container.contains(document.activeElement)) {\n // Focus must be delayed for focus ring to appear, but we can't wait\n // until useEffect cleanup to check if focus was inside the container.\n focusOnUnmount.current = container;\n }\n };\n }, [ref]);\n\n // eslint-disable-next-line\n useEffect(() => {\n return () => {\n if (focusOnUnmount.current) {\n focusOnUnmount.current.focus();\n }\n };\n }, [ref]);\n\n let titleId = useId();\n let descriptionId = useSlotId();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/toast');\n\n return {\n toastProps: {\n role: 'alert',\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'] || titleId,\n 'aria-describedby': props['aria-describedby'] || descriptionId,\n 'aria-details': props['aria-details'],\n // Hide toasts that are animating out so VoiceOver doesn't announce them.\n 'aria-hidden': animation === 'exiting' ? 'true' : undefined\n },\n titleProps: {\n id: titleId\n },\n descriptionProps: {\n id: descriptionId\n },\n closeButtonProps: {\n 'aria-label': stringFormatter.format('close'),\n onPress: () => state.close(key)\n }\n };\n}\n"],"names":[],"version":3,"file":"useToast.main.js.map"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import $7WpW4$intlStringsmodulejs from "./intlStrings.mjs";
|
|
2
|
+
import {useEffect as $7WpW4$useEffect, useRef as $7WpW4$useRef} from "react";
|
|
3
|
+
import {useLayoutEffect as $7WpW4$useLayoutEffect, useId as $7WpW4$useId, useSlotId as $7WpW4$useSlotId} from "@react-aria/utils";
|
|
4
|
+
import {useLocalizedStringFormatter as $7WpW4$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
function $d6542812f0669241$export$a407b657d3044108(props, state, ref) {
|
|
25
|
+
let { key: key, timer: timer, timeout: timeout, animation: animation } = props.toast;
|
|
26
|
+
(0, $7WpW4$useEffect)(()=>{
|
|
27
|
+
if (!timer) return;
|
|
28
|
+
timer.reset(timeout);
|
|
29
|
+
return ()=>{
|
|
30
|
+
timer.pause();
|
|
31
|
+
};
|
|
32
|
+
}, [
|
|
33
|
+
timer,
|
|
34
|
+
timeout
|
|
35
|
+
]);
|
|
36
|
+
// Restore focus to the toast container on unmount.
|
|
37
|
+
// If there are no more toasts, the container will be unmounted
|
|
38
|
+
// and will restore focus to wherever focus was before the user
|
|
39
|
+
// focused the toast region.
|
|
40
|
+
let focusOnUnmount = (0, $7WpW4$useRef)(null);
|
|
41
|
+
(0, $7WpW4$useLayoutEffect)(()=>{
|
|
42
|
+
let container = ref.current.closest("[role=region]");
|
|
43
|
+
return ()=>{
|
|
44
|
+
if (container && container.contains(document.activeElement)) // Focus must be delayed for focus ring to appear, but we can't wait
|
|
45
|
+
// until useEffect cleanup to check if focus was inside the container.
|
|
46
|
+
focusOnUnmount.current = container;
|
|
47
|
+
};
|
|
48
|
+
}, [
|
|
49
|
+
ref
|
|
50
|
+
]);
|
|
51
|
+
// eslint-disable-next-line
|
|
52
|
+
(0, $7WpW4$useEffect)(()=>{
|
|
53
|
+
return ()=>{
|
|
54
|
+
if (focusOnUnmount.current) focusOnUnmount.current.focus();
|
|
55
|
+
};
|
|
56
|
+
}, [
|
|
57
|
+
ref
|
|
58
|
+
]);
|
|
59
|
+
let titleId = (0, $7WpW4$useId)();
|
|
60
|
+
let descriptionId = (0, $7WpW4$useSlotId)();
|
|
61
|
+
let stringFormatter = (0, $7WpW4$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7WpW4$intlStringsmodulejs))), "@react-aria/toast");
|
|
62
|
+
return {
|
|
63
|
+
toastProps: {
|
|
64
|
+
role: "alert",
|
|
65
|
+
"aria-label": props["aria-label"],
|
|
66
|
+
"aria-labelledby": props["aria-labelledby"] || titleId,
|
|
67
|
+
"aria-describedby": props["aria-describedby"] || descriptionId,
|
|
68
|
+
"aria-details": props["aria-details"],
|
|
69
|
+
// Hide toasts that are animating out so VoiceOver doesn't announce them.
|
|
70
|
+
"aria-hidden": animation === "exiting" ? "true" : undefined
|
|
71
|
+
},
|
|
72
|
+
titleProps: {
|
|
73
|
+
id: titleId
|
|
74
|
+
},
|
|
75
|
+
descriptionProps: {
|
|
76
|
+
id: descriptionId
|
|
77
|
+
},
|
|
78
|
+
closeButtonProps: {
|
|
79
|
+
"aria-label": stringFormatter.format("close"),
|
|
80
|
+
onPress: ()=>state.close(key)
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
export {$d6542812f0669241$export$a407b657d3044108 as useToast};
|
|
87
|
+
//# sourceMappingURL=useToast.mjs.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import $7WpW4$intlStringsmodulejs from "./intlStrings.module.js";
|
|
2
|
+
import {useEffect as $7WpW4$useEffect, useRef as $7WpW4$useRef} from "react";
|
|
3
|
+
import {useLayoutEffect as $7WpW4$useLayoutEffect, useId as $7WpW4$useId, useSlotId as $7WpW4$useSlotId} from "@react-aria/utils";
|
|
4
|
+
import {useLocalizedStringFormatter as $7WpW4$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
function $d6542812f0669241$export$a407b657d3044108(props, state, ref) {
|
|
25
|
+
let { key: key, timer: timer, timeout: timeout, animation: animation } = props.toast;
|
|
26
|
+
(0, $7WpW4$useEffect)(()=>{
|
|
27
|
+
if (!timer) return;
|
|
28
|
+
timer.reset(timeout);
|
|
29
|
+
return ()=>{
|
|
30
|
+
timer.pause();
|
|
31
|
+
};
|
|
32
|
+
}, [
|
|
33
|
+
timer,
|
|
34
|
+
timeout
|
|
35
|
+
]);
|
|
36
|
+
// Restore focus to the toast container on unmount.
|
|
37
|
+
// If there are no more toasts, the container will be unmounted
|
|
38
|
+
// and will restore focus to wherever focus was before the user
|
|
39
|
+
// focused the toast region.
|
|
40
|
+
let focusOnUnmount = (0, $7WpW4$useRef)(null);
|
|
41
|
+
(0, $7WpW4$useLayoutEffect)(()=>{
|
|
42
|
+
let container = ref.current.closest("[role=region]");
|
|
43
|
+
return ()=>{
|
|
44
|
+
if (container && container.contains(document.activeElement)) // Focus must be delayed for focus ring to appear, but we can't wait
|
|
45
|
+
// until useEffect cleanup to check if focus was inside the container.
|
|
46
|
+
focusOnUnmount.current = container;
|
|
47
|
+
};
|
|
48
|
+
}, [
|
|
49
|
+
ref
|
|
50
|
+
]);
|
|
51
|
+
// eslint-disable-next-line
|
|
52
|
+
(0, $7WpW4$useEffect)(()=>{
|
|
53
|
+
return ()=>{
|
|
54
|
+
if (focusOnUnmount.current) focusOnUnmount.current.focus();
|
|
55
|
+
};
|
|
56
|
+
}, [
|
|
57
|
+
ref
|
|
58
|
+
]);
|
|
59
|
+
let titleId = (0, $7WpW4$useId)();
|
|
60
|
+
let descriptionId = (0, $7WpW4$useSlotId)();
|
|
61
|
+
let stringFormatter = (0, $7WpW4$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7WpW4$intlStringsmodulejs))), "@react-aria/toast");
|
|
62
|
+
return {
|
|
63
|
+
toastProps: {
|
|
64
|
+
role: "alert",
|
|
65
|
+
"aria-label": props["aria-label"],
|
|
66
|
+
"aria-labelledby": props["aria-labelledby"] || titleId,
|
|
67
|
+
"aria-describedby": props["aria-describedby"] || descriptionId,
|
|
68
|
+
"aria-details": props["aria-details"],
|
|
69
|
+
// Hide toasts that are animating out so VoiceOver doesn't announce them.
|
|
70
|
+
"aria-hidden": animation === "exiting" ? "true" : undefined
|
|
71
|
+
},
|
|
72
|
+
titleProps: {
|
|
73
|
+
id: titleId
|
|
74
|
+
},
|
|
75
|
+
descriptionProps: {
|
|
76
|
+
id: descriptionId
|
|
77
|
+
},
|
|
78
|
+
closeButtonProps: {
|
|
79
|
+
"aria-label": stringFormatter.format("close"),
|
|
80
|
+
onPress: ()=>state.close(key)
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
export {$d6542812f0669241$export$a407b657d3044108 as useToast};
|
|
87
|
+
//# sourceMappingURL=useToast.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AA+BM,SAAS,0CAAY,KAAwB,EAAE,KAAoB,EAAE,GAAgC;IAC1G,IAAI,OACF,GAAG,SACH,KAAK,WACL,OAAO,aACP,SAAS,EACV,GAAG,MAAM,KAAK;IAEf,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAC,OACH;QAGF,MAAM,KAAK,CAAC;QACZ,OAAO;YACL,MAAM,KAAK;QACb;IACF,GAAG;QAAC;QAAO;KAAQ;IAEnB,mDAAmD;IACnD,+DAA+D;IAC/D,+DAA+D;IAC/D,4BAA4B;IAC5B,IAAI,iBAAiB,CAAA,GAAA,aAAK,EAAE;IAC5B,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;QACpC,OAAO;YACL,IAAI,aAAa,UAAU,QAAQ,CAAC,SAAS,aAAa,GACxD,oEAAoE;YACpE,sEAAsE;YACtE,eAAe,OAAO,GAAG;QAE7B;IACF,GAAG;QAAC;KAAI;IAER,2BAA2B;IAC3B,CAAA,GAAA,gBAAQ,EAAE;QACR,OAAO;YACL,IAAI,eAAe,OAAO,EACxB,eAAe,OAAO,CAAC,KAAK;QAEhC;IACF,GAAG;QAAC;KAAI;IAER,IAAI,UAAU,CAAA,GAAA,YAAI;IAClB,IAAI,gBAAgB,CAAA,GAAA,gBAAQ;IAC5B,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAEhE,OAAO;QACL,YAAY;YACV,MAAM;YACN,cAAc,KAAK,CAAC,aAAa;YACjC,mBAAmB,KAAK,CAAC,kBAAkB,IAAI;YAC/C,oBAAoB,KAAK,CAAC,mBAAmB,IAAI;YACjD,gBAAgB,KAAK,CAAC,eAAe;YACrC,yEAAyE;YACzE,eAAe,cAAc,YAAY,SAAS;QACpD;QACA,YAAY;YACV,IAAI;QACN;QACA,kBAAkB;YAChB,IAAI;QACN;QACA,kBAAkB;YAChB,cAAc,gBAAgB,MAAM,CAAC;YACrC,SAAS,IAAM,MAAM,KAAK,CAAC;QAC7B;IACF;AACF","sources":["packages/@react-aria/toast/src/useToast.ts"],"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 {AriaButtonProps} from '@react-types/button';\nimport {AriaLabelingProps, DOMAttributes, FocusableElement} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {QueuedToast, ToastState} from '@react-stately/toast';\nimport {RefObject, useEffect, useRef} from 'react';\nimport {useId, useLayoutEffect, useSlotId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaToastProps<T> extends AriaLabelingProps {\n /** The toast object. */\n toast: QueuedToast<T>\n}\n\nexport interface ToastAria {\n /** Props for the toast container element. */\n toastProps: DOMAttributes,\n /** Props for the toast title element. */\n titleProps: DOMAttributes,\n /** Props for the toast description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the toast close button. */\n closeButtonProps: AriaButtonProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a toast component.\n * Toasts display brief, temporary notifications of actions, errors, or other events in an application.\n */\nexport function useToast<T>(props: AriaToastProps<T>, state: ToastState<T>, ref: RefObject<FocusableElement>): ToastAria {\n let {\n key,\n timer,\n timeout,\n animation\n } = props.toast;\n\n useEffect(() => {\n if (!timer) {\n return;\n }\n\n timer.reset(timeout);\n return () => {\n timer.pause();\n };\n }, [timer, timeout]);\n\n // Restore focus to the toast container on unmount.\n // If there are no more toasts, the container will be unmounted\n // and will restore focus to wherever focus was before the user\n // focused the toast region.\n let focusOnUnmount = useRef(null);\n useLayoutEffect(() => {\n let container = ref.current.closest('[role=region]') as HTMLElement;\n return () => {\n if (container && container.contains(document.activeElement)) {\n // Focus must be delayed for focus ring to appear, but we can't wait\n // until useEffect cleanup to check if focus was inside the container.\n focusOnUnmount.current = container;\n }\n };\n }, [ref]);\n\n // eslint-disable-next-line\n useEffect(() => {\n return () => {\n if (focusOnUnmount.current) {\n focusOnUnmount.current.focus();\n }\n };\n }, [ref]);\n\n let titleId = useId();\n let descriptionId = useSlotId();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/toast');\n\n return {\n toastProps: {\n role: 'alert',\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'] || titleId,\n 'aria-describedby': props['aria-describedby'] || descriptionId,\n 'aria-details': props['aria-details'],\n // Hide toasts that are animating out so VoiceOver doesn't announce them.\n 'aria-hidden': animation === 'exiting' ? 'true' : undefined\n },\n titleProps: {\n id: titleId\n },\n descriptionProps: {\n id: descriptionId\n },\n closeButtonProps: {\n 'aria-label': stringFormatter.format('close'),\n onPress: () => state.close(key)\n }\n };\n}\n"],"names":[],"version":3,"file":"useToast.module.js.map"}
|