@react-spectrum/toast 3.0.0-alpha.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/main.js ADDED
@@ -0,0 +1,649 @@
1
+ require("./main.css");
2
+ var $9Oq2J$react = require("react");
3
+ var $9Oq2J$reactstatelytoast = require("@react-stately/toast");
4
+ var $9Oq2J$usesyncexternalstoreshim = require("use-sync-external-store/shim");
5
+ var $9Oq2J$spectrumiconsuiAlertMedium = require("@spectrum-icons/ui/AlertMedium");
6
+ var $9Oq2J$reactspectrumbutton = require("@react-spectrum/button");
7
+ var $9Oq2J$reactspectrumutils = require("@react-spectrum/utils");
8
+ var $9Oq2J$spectrumiconsuiCrossMedium = require("@spectrum-icons/ui/CrossMedium");
9
+ var $9Oq2J$spectrumiconsuiInfoMedium = require("@spectrum-icons/ui/InfoMedium");
10
+ var $9Oq2J$spectrumiconsuiSuccessMedium = require("@spectrum-icons/ui/SuccessMedium");
11
+ var $9Oq2J$reactariai18n = require("@react-aria/i18n");
12
+ var $9Oq2J$reactariatoast = require("@react-aria/toast");
13
+ var $9Oq2J$reactariafocus = require("@react-aria/focus");
14
+ var $9Oq2J$reactspectrumprovider = require("@react-spectrum/provider");
15
+ var $9Oq2J$reactdom = require("react-dom");
16
+
17
+ function $parcel$export(e, n, v, s) {
18
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
19
+ }
20
+ function $parcel$interopDefault(a) {
21
+ return a && a.__esModule ? a.default : a;
22
+ }
23
+
24
+ $parcel$export(module.exports, "ToastContainer", () => $56cdf77f3be52eaf$export$f2815235e76a62b9);
25
+ $parcel$export(module.exports, "ToastQueue", () => $56cdf77f3be52eaf$export$f1f8569633bbbec4);
26
+ /*
27
+ * Copyright 2020 Adobe. All rights reserved.
28
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
29
+ * you may not use this file except in compliance with the License. You may obtain a copy
30
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
31
+ *
32
+ * Unless required by applicable law or agreed to in writing, software distributed under
33
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
34
+ * OF ANY KIND, either express or implied. See the License for the specific language
35
+ * governing permissions and limitations under the License.
36
+ */ /// <reference types="css-module-types" />
37
+ /*
38
+ * Copyright 2020 Adobe. All rights reserved.
39
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
40
+ * you may not use this file except in compliance with the License. You may obtain a copy
41
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
42
+ *
43
+ * Unless required by applicable law or agreed to in writing, software distributed under
44
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
45
+ * OF ANY KIND, either express or implied. See the License for the specific language
46
+ * governing permissions and limitations under the License.
47
+ */
48
+ /*
49
+ * Copyright 2020 Adobe. All rights reserved.
50
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
51
+ * you may not use this file except in compliance with the License. You may obtain a copy
52
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
53
+ *
54
+ * Unless required by applicable law or agreed to in writing, software distributed under
55
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
56
+ * OF ANY KIND, either express or implied. See the License for the specific language
57
+ * governing permissions and limitations under the License.
58
+ */
59
+
60
+
61
+
62
+
63
+ var $00d316cd2c3d157a$exports = {};
64
+ var $0cf579c4d0619650$exports = {};
65
+ $0cf579c4d0619650$exports = {
66
+ "info": `معلومات`,
67
+ "negative": `خطأ`,
68
+ "positive": `تم بنجاح`
69
+ };
70
+
71
+
72
+ var $01a5f2e754a3aca3$exports = {};
73
+ $01a5f2e754a3aca3$exports = {
74
+ "info": `Инфо`,
75
+ "negative": `Грешка`,
76
+ "positive": `Успех`
77
+ };
78
+
79
+
80
+ var $349346d24fea9f93$exports = {};
81
+ $349346d24fea9f93$exports = {
82
+ "info": `Informace`,
83
+ "negative": `Chyba`,
84
+ "positive": `Úspěch`
85
+ };
86
+
87
+
88
+ var $494b47caf5000db5$exports = {};
89
+ $494b47caf5000db5$exports = {
90
+ "info": `Info`,
91
+ "negative": `Fejl`,
92
+ "positive": `Fuldført`
93
+ };
94
+
95
+
96
+ var $42361f52619ce7b5$exports = {};
97
+ $42361f52619ce7b5$exports = {
98
+ "info": `Informationen`,
99
+ "negative": `Fehler`,
100
+ "positive": `Erfolg`
101
+ };
102
+
103
+
104
+ var $2f3eceb7f6af8880$exports = {};
105
+ $2f3eceb7f6af8880$exports = {
106
+ "info": `Πληροφορίες`,
107
+ "negative": `Σφάλμα`,
108
+ "positive": `Επιτυχία`
109
+ };
110
+
111
+
112
+ var $1c4e755cf68da042$exports = {};
113
+ $1c4e755cf68da042$exports = {
114
+ "info": `Info`,
115
+ "negative": `Error`,
116
+ "positive": `Success`
117
+ };
118
+
119
+
120
+ var $36392de7ab7cf0d8$exports = {};
121
+ $36392de7ab7cf0d8$exports = {
122
+ "info": `Información`,
123
+ "negative": `Error`,
124
+ "positive": `Éxito`
125
+ };
126
+
127
+
128
+ var $f8a5185ea50f4353$exports = {};
129
+ $f8a5185ea50f4353$exports = {
130
+ "info": `Teave`,
131
+ "negative": `Viga`,
132
+ "positive": `Valmis`
133
+ };
134
+
135
+
136
+ var $467647dbbf34963d$exports = {};
137
+ $467647dbbf34963d$exports = {
138
+ "info": `Tiedot`,
139
+ "negative": `Virhe`,
140
+ "positive": `Onnistui`
141
+ };
142
+
143
+
144
+ var $0bfd77936feb977b$exports = {};
145
+ $0bfd77936feb977b$exports = {
146
+ "info": `Infos`,
147
+ "negative": `Erreur`,
148
+ "positive": `Succès`
149
+ };
150
+
151
+
152
+ var $8634f5ced1fe2330$exports = {};
153
+ $8634f5ced1fe2330$exports = {
154
+ "info": `מידע`,
155
+ "negative": `שגיאה`,
156
+ "positive": `הצלחה`
157
+ };
158
+
159
+
160
+ var $e8561294409b4f3f$exports = {};
161
+ $e8561294409b4f3f$exports = {
162
+ "info": `Informacije`,
163
+ "negative": `Pogreška`,
164
+ "positive": `Uspješno`
165
+ };
166
+
167
+
168
+ var $1adc73e933a677bc$exports = {};
169
+ $1adc73e933a677bc$exports = {
170
+ "info": `Információ`,
171
+ "negative": `Hiba`,
172
+ "positive": `Siker`
173
+ };
174
+
175
+
176
+ var $7425b3dc28bbc3a1$exports = {};
177
+ $7425b3dc28bbc3a1$exports = {
178
+ "info": `Informazioni`,
179
+ "negative": `Errore`,
180
+ "positive": `Operazione riuscita`
181
+ };
182
+
183
+
184
+ var $ed1abfad0f0fe18c$exports = {};
185
+ $ed1abfad0f0fe18c$exports = {
186
+ "info": `情報`,
187
+ "negative": `エラー`,
188
+ "positive": `成功`
189
+ };
190
+
191
+
192
+ var $209b4fa3dff0b709$exports = {};
193
+ $209b4fa3dff0b709$exports = {
194
+ "info": `정보`,
195
+ "negative": `오류`,
196
+ "positive": `성공`
197
+ };
198
+
199
+
200
+ var $7f853a3d76cc8c7a$exports = {};
201
+ $7f853a3d76cc8c7a$exports = {
202
+ "info": `Informacija`,
203
+ "negative": `Klaida`,
204
+ "positive": `Sėkmingai`
205
+ };
206
+
207
+
208
+ var $db6d2778aa3efd1c$exports = {};
209
+ $db6d2778aa3efd1c$exports = {
210
+ "info": `Informācija`,
211
+ "negative": `Kļūda`,
212
+ "positive": `Izdevās`
213
+ };
214
+
215
+
216
+ var $cbc52695be0ba010$exports = {};
217
+ $cbc52695be0ba010$exports = {
218
+ "info": `Info`,
219
+ "negative": `Feil`,
220
+ "positive": `Vellykket`
221
+ };
222
+
223
+
224
+ var $7349a16c865e9d83$exports = {};
225
+ $7349a16c865e9d83$exports = {
226
+ "info": `Info`,
227
+ "negative": `Fout`,
228
+ "positive": `Geslaagd`
229
+ };
230
+
231
+
232
+ var $9ba752c7df1444c8$exports = {};
233
+ $9ba752c7df1444c8$exports = {
234
+ "info": `Informacje`,
235
+ "negative": `Błąd`,
236
+ "positive": `Powodzenie`
237
+ };
238
+
239
+
240
+ var $e71cba549c8a84b2$exports = {};
241
+ $e71cba549c8a84b2$exports = {
242
+ "info": `Informações`,
243
+ "negative": `Erro`,
244
+ "positive": `Sucesso`
245
+ };
246
+
247
+
248
+ var $e59fbedfd0efbd85$exports = {};
249
+ $e59fbedfd0efbd85$exports = {
250
+ "info": `Informação`,
251
+ "negative": `Erro`,
252
+ "positive": `Sucesso`
253
+ };
254
+
255
+
256
+ var $4f5a4de90ef42f83$exports = {};
257
+ $4f5a4de90ef42f83$exports = {
258
+ "info": `Informaţii`,
259
+ "negative": `Eroare`,
260
+ "positive": `Succes`
261
+ };
262
+
263
+
264
+ var $bbf3a5b56b359b1a$exports = {};
265
+ $bbf3a5b56b359b1a$exports = {
266
+ "info": `Информация`,
267
+ "negative": `Ошибка`,
268
+ "positive": `Успешно`
269
+ };
270
+
271
+
272
+ var $35b1c2966d1d12e1$exports = {};
273
+ $35b1c2966d1d12e1$exports = {
274
+ "info": `Informácie`,
275
+ "negative": `Chyba`,
276
+ "positive": `Úspech`
277
+ };
278
+
279
+
280
+ var $0d987d762afd0da6$exports = {};
281
+ $0d987d762afd0da6$exports = {
282
+ "info": `Informacije`,
283
+ "negative": `Napaka`,
284
+ "positive": `Uspešno`
285
+ };
286
+
287
+
288
+ var $bbb1b12c9819feea$exports = {};
289
+ $bbb1b12c9819feea$exports = {
290
+ "info": `Informacije`,
291
+ "negative": `Greška`,
292
+ "positive": `Uspešno`
293
+ };
294
+
295
+
296
+ var $2e2b2ebfa5ef1eda$exports = {};
297
+ $2e2b2ebfa5ef1eda$exports = {
298
+ "info": `Info`,
299
+ "negative": `Fel`,
300
+ "positive": `Lyckades`
301
+ };
302
+
303
+
304
+ var $c9e3aeb1c2d42bfd$exports = {};
305
+ $c9e3aeb1c2d42bfd$exports = {
306
+ "info": `Bilgiler`,
307
+ "negative": `Hata`,
308
+ "positive": `Başarılı`
309
+ };
310
+
311
+
312
+ var $5026bf09e6af5326$exports = {};
313
+ $5026bf09e6af5326$exports = {
314
+ "info": `Інформація`,
315
+ "negative": `Помилка`,
316
+ "positive": `Успішно`
317
+ };
318
+
319
+
320
+ var $f17a6e030d52029e$exports = {};
321
+ $f17a6e030d52029e$exports = {
322
+ "info": `信息`,
323
+ "negative": `错误`,
324
+ "positive": `成功`
325
+ };
326
+
327
+
328
+ var $a73ba38da5e03e12$exports = {};
329
+ $a73ba38da5e03e12$exports = {
330
+ "info": `資訊`,
331
+ "negative": `錯誤`,
332
+ "positive": `成功`
333
+ };
334
+
335
+
336
+ $00d316cd2c3d157a$exports = {
337
+ "ar-AE": $0cf579c4d0619650$exports,
338
+ "bg-BG": $01a5f2e754a3aca3$exports,
339
+ "cs-CZ": $349346d24fea9f93$exports,
340
+ "da-DK": $494b47caf5000db5$exports,
341
+ "de-DE": $42361f52619ce7b5$exports,
342
+ "el-GR": $2f3eceb7f6af8880$exports,
343
+ "en-US": $1c4e755cf68da042$exports,
344
+ "es-ES": $36392de7ab7cf0d8$exports,
345
+ "et-EE": $f8a5185ea50f4353$exports,
346
+ "fi-FI": $467647dbbf34963d$exports,
347
+ "fr-FR": $0bfd77936feb977b$exports,
348
+ "he-IL": $8634f5ced1fe2330$exports,
349
+ "hr-HR": $e8561294409b4f3f$exports,
350
+ "hu-HU": $1adc73e933a677bc$exports,
351
+ "it-IT": $7425b3dc28bbc3a1$exports,
352
+ "ja-JP": $ed1abfad0f0fe18c$exports,
353
+ "ko-KR": $209b4fa3dff0b709$exports,
354
+ "lt-LT": $7f853a3d76cc8c7a$exports,
355
+ "lv-LV": $db6d2778aa3efd1c$exports,
356
+ "nb-NO": $cbc52695be0ba010$exports,
357
+ "nl-NL": $7349a16c865e9d83$exports,
358
+ "pl-PL": $9ba752c7df1444c8$exports,
359
+ "pt-BR": $e71cba549c8a84b2$exports,
360
+ "pt-PT": $e59fbedfd0efbd85$exports,
361
+ "ro-RO": $4f5a4de90ef42f83$exports,
362
+ "ru-RU": $bbf3a5b56b359b1a$exports,
363
+ "sk-SK": $35b1c2966d1d12e1$exports,
364
+ "sl-SI": $0d987d762afd0da6$exports,
365
+ "sr-SP": $bbb1b12c9819feea$exports,
366
+ "sv-SE": $2e2b2ebfa5ef1eda$exports,
367
+ "tr-TR": $c9e3aeb1c2d42bfd$exports,
368
+ "uk-UA": $5026bf09e6af5326$exports,
369
+ "zh-CN": $f17a6e030d52029e$exports,
370
+ "zh-TW": $a73ba38da5e03e12$exports
371
+ };
372
+
373
+
374
+
375
+ var $b6e6aa676f8f9e47$exports = {};
376
+
377
+ $parcel$export($b6e6aa676f8f9e47$exports, "spectrum-Toast", () => $b6e6aa676f8f9e47$export$c8747d73d7954b9c, (v) => $b6e6aa676f8f9e47$export$c8747d73d7954b9c = v);
378
+ $parcel$export($b6e6aa676f8f9e47$exports, "spectrum-Toast-typeIcon", () => $b6e6aa676f8f9e47$export$8e9e50fe392680b2, (v) => $b6e6aa676f8f9e47$export$8e9e50fe392680b2 = v);
379
+ $parcel$export($b6e6aa676f8f9e47$exports, "spectrum-Toast-content", () => $b6e6aa676f8f9e47$export$454f092ca47c3462, (v) => $b6e6aa676f8f9e47$export$454f092ca47c3462 = v);
380
+ $parcel$export($b6e6aa676f8f9e47$exports, "spectrum-Toast-buttons", () => $b6e6aa676f8f9e47$export$19218cf016f919e5, (v) => $b6e6aa676f8f9e47$export$19218cf016f919e5 = v);
381
+ $parcel$export($b6e6aa676f8f9e47$exports, "spectrum-Button", () => $b6e6aa676f8f9e47$export$1db4cca5b4ade39a, (v) => $b6e6aa676f8f9e47$export$1db4cca5b4ade39a = v);
382
+ $parcel$export($b6e6aa676f8f9e47$exports, "spectrum-ClearButton", () => $b6e6aa676f8f9e47$export$b752ce409e5660c, (v) => $b6e6aa676f8f9e47$export$b752ce409e5660c = v);
383
+ $parcel$export($b6e6aa676f8f9e47$exports, "spectrum-Toast-body", () => $b6e6aa676f8f9e47$export$36e75d1f579741b3, (v) => $b6e6aa676f8f9e47$export$36e75d1f579741b3 = v);
384
+ $parcel$export($b6e6aa676f8f9e47$exports, "spectrum-Toast--negative", () => $b6e6aa676f8f9e47$export$bd5a0b226e8b302, (v) => $b6e6aa676f8f9e47$export$bd5a0b226e8b302 = v);
385
+ $parcel$export($b6e6aa676f8f9e47$exports, "spectrum-Toast--info", () => $b6e6aa676f8f9e47$export$fcf916881d7253a9, (v) => $b6e6aa676f8f9e47$export$fcf916881d7253a9 = v);
386
+ $parcel$export($b6e6aa676f8f9e47$exports, "spectrum-Toast--positive", () => $b6e6aa676f8f9e47$export$5c8e63d2763f4a55, (v) => $b6e6aa676f8f9e47$export$5c8e63d2763f4a55 = v);
387
+ var $b6e6aa676f8f9e47$export$c8747d73d7954b9c;
388
+ var $b6e6aa676f8f9e47$export$8e9e50fe392680b2;
389
+ var $b6e6aa676f8f9e47$export$454f092ca47c3462;
390
+ var $b6e6aa676f8f9e47$export$19218cf016f919e5;
391
+ var $b6e6aa676f8f9e47$export$1db4cca5b4ade39a;
392
+ var $b6e6aa676f8f9e47$export$b752ce409e5660c;
393
+ var $b6e6aa676f8f9e47$export$36e75d1f579741b3;
394
+ var $b6e6aa676f8f9e47$export$bd5a0b226e8b302;
395
+ var $b6e6aa676f8f9e47$export$fcf916881d7253a9;
396
+ var $b6e6aa676f8f9e47$export$5c8e63d2763f4a55;
397
+ $b6e6aa676f8f9e47$export$c8747d73d7954b9c = "spectrum-Toast_11df86";
398
+ $b6e6aa676f8f9e47$export$8e9e50fe392680b2 = "spectrum-Toast-typeIcon_11df86";
399
+ $b6e6aa676f8f9e47$export$454f092ca47c3462 = "spectrum-Toast-content_11df86";
400
+ $b6e6aa676f8f9e47$export$19218cf016f919e5 = "spectrum-Toast-buttons_11df86";
401
+ $b6e6aa676f8f9e47$export$1db4cca5b4ade39a = "spectrum-Button_11df86";
402
+ $b6e6aa676f8f9e47$export$b752ce409e5660c = "spectrum-ClearButton_11df86";
403
+ $b6e6aa676f8f9e47$export$36e75d1f579741b3 = "spectrum-Toast-body_11df86";
404
+ $b6e6aa676f8f9e47$export$bd5a0b226e8b302 = "spectrum-Toast--negative_11df86";
405
+ $b6e6aa676f8f9e47$export$fcf916881d7253a9 = "spectrum-Toast--info_11df86";
406
+ $b6e6aa676f8f9e47$export$5c8e63d2763f4a55 = "spectrum-Toast--positive_11df86";
407
+
408
+
409
+
410
+ var $e20782d0579ed886$exports = {};
411
+
412
+ $parcel$export($e20782d0579ed886$exports, "react-spectrum-ToastContainer", () => $e20782d0579ed886$export$bed15bd1aa62542d, (v) => $e20782d0579ed886$export$bed15bd1aa62542d = v);
413
+ $parcel$export($e20782d0579ed886$exports, "focus-ring", () => $e20782d0579ed886$export$f39a09f249340e2a, (v) => $e20782d0579ed886$export$f39a09f249340e2a = v);
414
+ $parcel$export($e20782d0579ed886$exports, "spectrum-Toast", () => $e20782d0579ed886$export$c8747d73d7954b9c, (v) => $e20782d0579ed886$export$c8747d73d7954b9c = v);
415
+ $parcel$export($e20782d0579ed886$exports, "slide-in", () => $e20782d0579ed886$export$1c220dee9e4dbe34, (v) => $e20782d0579ed886$export$1c220dee9e4dbe34 = v);
416
+ $parcel$export($e20782d0579ed886$exports, "fade-out", () => $e20782d0579ed886$export$f562fd61c53bdcd9, (v) => $e20782d0579ed886$export$f562fd61c53bdcd9 = v);
417
+ var $e20782d0579ed886$export$bed15bd1aa62542d;
418
+ var $e20782d0579ed886$export$f39a09f249340e2a;
419
+ var $e20782d0579ed886$export$c8747d73d7954b9c;
420
+ var $e20782d0579ed886$export$1c220dee9e4dbe34;
421
+ var $e20782d0579ed886$export$f562fd61c53bdcd9;
422
+ $e20782d0579ed886$export$bed15bd1aa62542d = "react-spectrum-ToastContainer_21a698";
423
+ $e20782d0579ed886$export$f39a09f249340e2a = "focus-ring_21a698";
424
+ $e20782d0579ed886$export$c8747d73d7954b9c = "spectrum-Toast_21a698";
425
+ $e20782d0579ed886$export$1c220dee9e4dbe34 = "slide-in_21a698";
426
+ $e20782d0579ed886$export$f562fd61c53bdcd9 = "fade-out_21a698";
427
+
428
+
429
+
430
+
431
+ const $6c5bd1047ecc310e$export$fde44257752a9f60 = {
432
+ info: (0, ($parcel$interopDefault($9Oq2J$spectrumiconsuiInfoMedium))),
433
+ negative: (0, ($parcel$interopDefault($9Oq2J$spectrumiconsuiAlertMedium))),
434
+ positive: (0, ($parcel$interopDefault($9Oq2J$spectrumiconsuiSuccessMedium)))
435
+ };
436
+ function $6c5bd1047ecc310e$var$Toast(props, ref) {
437
+ let { toast: { key: key , animation: animation , content: { children: children , variant: variant , actionLabel: actionLabel , onAction: onAction , shouldCloseOnAction: shouldCloseOnAction } } , state: state , ...otherProps } = props;
438
+ let domRef = (0, $9Oq2J$reactspectrumutils.useDOMRef)(ref);
439
+ let { closeButtonProps: closeButtonProps , titleProps: titleProps , toastProps: toastProps } = (0, $9Oq2J$reactariatoast.useToast)(props, state, domRef);
440
+ let { styleProps: styleProps } = (0, $9Oq2J$reactspectrumutils.useStyleProps)(otherProps);
441
+ let stringFormatter = (0, $9Oq2J$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($00d316cd2c3d157a$exports))));
442
+ let iconLabel = variant && variant !== "neutral" ? stringFormatter.format(variant) : null;
443
+ let Icon = $6c5bd1047ecc310e$export$fde44257752a9f60[variant];
444
+ const handleAction = ()=>{
445
+ if (onAction) onAction();
446
+ if (shouldCloseOnAction) state.close(key);
447
+ };
448
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).createElement("div", {
449
+ ...styleProps,
450
+ ...toastProps,
451
+ ref: domRef,
452
+ className: (0, $9Oq2J$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($b6e6aa676f8f9e47$exports))), "spectrum-Toast", {
453
+ ["spectrum-Toast--" + variant]: variant
454
+ }, styleProps.className, (0, $9Oq2J$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($e20782d0579ed886$exports))), "spectrum-Toast")),
455
+ style: {
456
+ ...styleProps.style,
457
+ zIndex: props.toast.priority
458
+ },
459
+ "data-animation": animation,
460
+ onAnimationEnd: ()=>{
461
+ if (animation === "exiting") state.remove(key);
462
+ }
463
+ }, Icon && /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).createElement(Icon, {
464
+ "aria-label": iconLabel,
465
+ UNSAFE_className: (0, $9Oq2J$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($b6e6aa676f8f9e47$exports))), "spectrum-Toast-typeIcon")
466
+ }), /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).createElement("div", {
467
+ className: (0, $9Oq2J$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($b6e6aa676f8f9e47$exports))), "spectrum-Toast-body")
468
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).createElement("div", {
469
+ className: (0, $9Oq2J$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($b6e6aa676f8f9e47$exports))), "spectrum-Toast-content"),
470
+ ...titleProps
471
+ }, children), actionLabel && /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).createElement((0, $9Oq2J$reactspectrumbutton.Button), {
472
+ onPress: handleAction,
473
+ UNSAFE_className: (0, $9Oq2J$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($b6e6aa676f8f9e47$exports))), "spectrum-Button"),
474
+ variant: "secondary",
475
+ staticColor: "white"
476
+ }, actionLabel)), /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).createElement("div", {
477
+ className: (0, $9Oq2J$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($b6e6aa676f8f9e47$exports))), "spectrum-Toast-buttons")
478
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).createElement((0, $9Oq2J$reactspectrumbutton.ClearButton), {
479
+ ...closeButtonProps,
480
+ variant: "overBackground"
481
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).createElement((0, ($parcel$interopDefault($9Oq2J$spectrumiconsuiCrossMedium))), null))));
482
+ }
483
+ let $6c5bd1047ecc310e$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).forwardRef($6c5bd1047ecc310e$var$Toast);
484
+
485
+
486
+ /*
487
+ * Copyright 2020 Adobe. All rights reserved.
488
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
489
+ * you may not use this file except in compliance with the License. You may obtain a copy
490
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
491
+ *
492
+ * Unless required by applicable law or agreed to in writing, software distributed under
493
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
494
+ * OF ANY KIND, either express or implied. See the License for the specific language
495
+ * governing permissions and limitations under the License.
496
+ */
497
+
498
+
499
+
500
+
501
+
502
+
503
+ function $5b9f2c86c1b1395c$export$fb98e3a2a4cd92d7(props) {
504
+ let { children: children , state: state } = props;
505
+ let containerPlacement = (0, $9Oq2J$reactspectrumutils.useIsMobileDevice)() ? "center" : "right";
506
+ let ref = (0, $9Oq2J$react.useRef)();
507
+ let { regionProps: regionProps } = (0, $9Oq2J$reactariatoast.useToastRegion)(props, state, ref);
508
+ let contents = /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).createElement((0, $9Oq2J$reactspectrumprovider.Provider), {
509
+ UNSAFE_style: {
510
+ background: "transparent"
511
+ }
512
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).createElement((0, $9Oq2J$reactariafocus.FocusRing), {
513
+ focusRingClass: (0, $9Oq2J$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($e20782d0579ed886$exports))), "focus-ring")
514
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).createElement("div", {
515
+ ...regionProps,
516
+ ref: ref,
517
+ "data-position": "bottom",
518
+ "data-placement": containerPlacement,
519
+ className: (0, $9Oq2J$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($e20782d0579ed886$exports))), "react-spectrum-ToastContainer")
520
+ }, children)));
521
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$reactdom))).createPortal(contents, document.body);
522
+ }
523
+
524
+
525
+
526
+
527
+ // There is a single global toast queue instance for the whole app, initialized lazily.
528
+ let $56cdf77f3be52eaf$var$globalToastQueue = null;
529
+ function $56cdf77f3be52eaf$var$getGlobalToastQueue() {
530
+ if (!$56cdf77f3be52eaf$var$globalToastQueue) $56cdf77f3be52eaf$var$globalToastQueue = new (0, $9Oq2J$reactstatelytoast.ToastQueue)({
531
+ maxVisibleToasts: 1,
532
+ hasExitAnimation: true
533
+ });
534
+ return $56cdf77f3be52eaf$var$globalToastQueue;
535
+ }
536
+ function $56cdf77f3be52eaf$export$320311f0e4ecb3ae() {
537
+ $56cdf77f3be52eaf$var$globalToastQueue = null;
538
+ }
539
+ let $56cdf77f3be52eaf$var$toastProviders = new Set();
540
+ let $56cdf77f3be52eaf$var$subscriptions = new Set();
541
+ function $56cdf77f3be52eaf$var$subscribe(fn) {
542
+ $56cdf77f3be52eaf$var$subscriptions.add(fn);
543
+ return ()=>$56cdf77f3be52eaf$var$subscriptions.delete(fn);
544
+ }
545
+ function $56cdf77f3be52eaf$var$getActiveToastContainer() {
546
+ return $56cdf77f3be52eaf$var$toastProviders.values().next().value;
547
+ }
548
+ function $56cdf77f3be52eaf$var$useActiveToastContainer() {
549
+ return (0, $9Oq2J$usesyncexternalstoreshim.useSyncExternalStore)($56cdf77f3be52eaf$var$subscribe, $56cdf77f3be52eaf$var$getActiveToastContainer);
550
+ }
551
+ function $56cdf77f3be52eaf$export$f2815235e76a62b9(props) {
552
+ // Track all toast provider instances in a set.
553
+ // Only the first one will actually render.
554
+ // We use a ref to do this, since it will have a stable identity
555
+ // over the lifetime of the component.
556
+ let ref = (0, $9Oq2J$react.useRef)();
557
+ $56cdf77f3be52eaf$var$toastProviders.add(ref);
558
+ // eslint-disable-next-line arrow-body-style
559
+ (0, $9Oq2J$react.useEffect)(()=>{
560
+ return ()=>{
561
+ // When this toast provider unmounts, reset all animations so that
562
+ // when the new toast provider renders, it is seamless.
563
+ for (let toast of $56cdf77f3be52eaf$var$getGlobalToastQueue().visibleToasts)toast.animation = null;
564
+ // Remove this toast provider, and call subscriptions.
565
+ // This will cause all other instances to re-render,
566
+ // and the first one to become the new active toast provider.
567
+ $56cdf77f3be52eaf$var$toastProviders.delete(ref);
568
+ for (let fn of $56cdf77f3be52eaf$var$subscriptions)fn();
569
+ };
570
+ }, []);
571
+ // Only render if this is the active toast provider instance, and there are visible toasts.
572
+ let activeToastContainer = $56cdf77f3be52eaf$var$useActiveToastContainer();
573
+ let state = (0, $9Oq2J$reactstatelytoast.useToastQueue)($56cdf77f3be52eaf$var$getGlobalToastQueue());
574
+ if (ref === activeToastContainer && state.visibleToasts.length > 0) return /*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).createElement((0, $5b9f2c86c1b1395c$export$fb98e3a2a4cd92d7), {
575
+ state: state,
576
+ ...props
577
+ }, state.visibleToasts.map((toast)=>/*#__PURE__*/ (0, ($parcel$interopDefault($9Oq2J$react))).createElement((0, $6c5bd1047ecc310e$export$8d8dc7d5f743331b), {
578
+ key: toast.key,
579
+ toast: toast,
580
+ state: state
581
+ })));
582
+ return null;
583
+ }
584
+ function $56cdf77f3be52eaf$var$addToast(children, variant, options = {}) {
585
+ // Dispatch a custom event so that toasts can be intercepted and re-targeted, e.g. when inside an iframe.
586
+ if (typeof CustomEvent !== "undefined" && typeof window !== "undefined") {
587
+ let event = new CustomEvent("react-spectrum-toast", {
588
+ cancelable: true,
589
+ bubbles: true,
590
+ detail: {
591
+ children: children,
592
+ variant: variant,
593
+ options: options
594
+ }
595
+ });
596
+ let shouldContinue = window.dispatchEvent(event);
597
+ if (!shouldContinue) return;
598
+ }
599
+ let value = {
600
+ children: children,
601
+ variant: variant,
602
+ actionLabel: options.actionLabel,
603
+ onAction: options.onAction,
604
+ shouldCloseOnAction: options.shouldCloseOnAction
605
+ };
606
+ // Minimum time of 5s from https://spectrum.adobe.com/page/toast/#Auto-dismissible
607
+ // Actionable toasts cannot be auto dismissed. That would fail WCAG SC 2.2.1.
608
+ // It is debatable whether non-actionable toasts would also fail.
609
+ let timeout = options.timeout && !options.onAction ? Math.max(options.timeout, 5000) : null;
610
+ let queue = $56cdf77f3be52eaf$var$getGlobalToastQueue();
611
+ let key = queue.add(value, {
612
+ priority: $56cdf77f3be52eaf$var$getPriority(variant, options),
613
+ timeout: timeout,
614
+ onClose: options.onClose
615
+ });
616
+ return ()=>queue.close(key);
617
+ }
618
+ const $56cdf77f3be52eaf$export$f1f8569633bbbec4 = {
619
+ /** Queues a neutral toast. */ neutral (children, options = {}) {
620
+ return $56cdf77f3be52eaf$var$addToast(children, "neutral", options);
621
+ },
622
+ /** Queues a positive toast. */ positive (children, options = {}) {
623
+ return $56cdf77f3be52eaf$var$addToast(children, "positive", options);
624
+ },
625
+ /** Queues a negative toast. */ negative (children, options = {}) {
626
+ return $56cdf77f3be52eaf$var$addToast(children, "negative", options);
627
+ },
628
+ /** Queues an informational toast. */ info (children, options = {}) {
629
+ return $56cdf77f3be52eaf$var$addToast(children, "info", options);
630
+ }
631
+ };
632
+ // https://spectrum.adobe.com/page/toast/#Priority-queue
633
+ // TODO: if a lower priority toast comes in, no way to know until you dismiss the higher priority one.
634
+ const $56cdf77f3be52eaf$var$VARIANT_PRIORITY = {
635
+ negative: 10,
636
+ positive: 3,
637
+ info: 2,
638
+ neutral: 1
639
+ };
640
+ function $56cdf77f3be52eaf$var$getPriority(variant, options) {
641
+ let priority = $56cdf77f3be52eaf$var$VARIANT_PRIORITY[variant] || 1;
642
+ if (options.onAction) priority += 4;
643
+ return priority;
644
+ }
645
+
646
+
647
+
648
+
649
+ //# sourceMappingURL=main.js.map