@starasia/toast 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/toast.es.js CHANGED
@@ -1,648 +1,7 @@
1
- import z, { useState as Cr, useRef as pe, useEffect as Sr } from "react";
2
- import me from "react-dom";
3
- var nr = { exports: {} }, Y = {};
4
- /**
5
- * @license React
6
- * react-jsx-runtime.production.min.js
7
- *
8
- * Copyright (c) Facebook, Inc. and its affiliates.
9
- *
10
- * This source code is licensed under the MIT license found in the
11
- * LICENSE file in the root directory of this source tree.
12
- */
13
- var jr;
14
- function be() {
15
- if (jr)
16
- return Y;
17
- jr = 1;
18
- var l = z, a = Symbol.for("react.element"), b = Symbol.for("react.fragment"), y = Object.prototype.hasOwnProperty, v = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, w = { key: !0, ref: !0, __self: !0, __source: !0 };
19
- function T(E, d, C) {
20
- var p, k = {}, j = null, x = null;
21
- C !== void 0 && (j = "" + C), d.key !== void 0 && (j = "" + d.key), d.ref !== void 0 && (x = d.ref);
22
- for (p in d)
23
- y.call(d, p) && !w.hasOwnProperty(p) && (k[p] = d[p]);
24
- if (E && E.defaultProps)
25
- for (p in d = E.defaultProps, d)
26
- k[p] === void 0 && (k[p] = d[p]);
27
- return { $$typeof: a, type: E, key: j, ref: x, props: k, _owner: v.current };
28
- }
29
- return Y.Fragment = b, Y.jsx = T, Y.jsxs = T, Y;
30
- }
31
- var N = {};
32
- /**
33
- * @license React
34
- * react-jsx-runtime.development.js
35
- *
36
- * Copyright (c) Facebook, Inc. and its affiliates.
37
- *
38
- * This source code is licensed under the MIT license found in the
39
- * LICENSE file in the root directory of this source tree.
40
- */
41
- var Or;
42
- function he() {
43
- return Or || (Or = 1, process.env.NODE_ENV !== "production" && function() {
44
- var l = z, a = Symbol.for("react.element"), b = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), w = Symbol.for("react.profiler"), T = Symbol.for("react.provider"), E = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), k = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), x = Symbol.for("react.offscreen"), I = Symbol.iterator, Ar = "@@iterator";
45
- function Dr(r) {
46
- if (r === null || typeof r != "object")
47
- return null;
48
- var e = I && r[I] || r[Ar];
49
- return typeof e == "function" ? e : null;
50
- }
51
- var D = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
52
- function m(r) {
53
- {
54
- for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), t = 1; t < e; t++)
55
- n[t - 1] = arguments[t];
56
- Fr("error", r, n);
57
- }
58
- }
59
- function Fr(r, e, n) {
60
- {
61
- var t = D.ReactDebugCurrentFrame, s = t.getStackAddendum();
62
- s !== "" && (e += "%s", n = n.concat([s]));
63
- var u = n.map(function(i) {
64
- return String(i);
65
- });
66
- u.unshift("Warning: " + e), Function.prototype.apply.call(console[r], console, u);
67
- }
68
- }
69
- var Lr = !1, Ir = !1, $r = !1, Wr = !1, Mr = !1, tr;
70
- tr = Symbol.for("react.module.reference");
71
- function Yr(r) {
72
- return !!(typeof r == "string" || typeof r == "function" || r === y || r === w || Mr || r === v || r === C || r === p || Wr || r === x || Lr || Ir || $r || typeof r == "object" && r !== null && (r.$$typeof === j || r.$$typeof === k || r.$$typeof === T || r.$$typeof === E || r.$$typeof === d || // This needs to include all possible module reference object
73
- // types supported by any Flight configuration anywhere since
74
- // we don't know which Flight build this will end up being used
75
- // with.
76
- r.$$typeof === tr || r.getModuleId !== void 0));
77
- }
78
- function Nr(r, e, n) {
79
- var t = r.displayName;
80
- if (t)
81
- return t;
82
- var s = e.displayName || e.name || "";
83
- return s !== "" ? n + "(" + s + ")" : n;
84
- }
85
- function ar(r) {
86
- return r.displayName || "Context";
87
- }
88
- function S(r) {
89
- if (r == null)
90
- return null;
91
- if (typeof r.tag == "number" && m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof r == "function")
92
- return r.displayName || r.name || null;
93
- if (typeof r == "string")
94
- return r;
95
- switch (r) {
96
- case y:
97
- return "Fragment";
98
- case b:
99
- return "Portal";
100
- case w:
101
- return "Profiler";
102
- case v:
103
- return "StrictMode";
104
- case C:
105
- return "Suspense";
106
- case p:
107
- return "SuspenseList";
108
- }
109
- if (typeof r == "object")
110
- switch (r.$$typeof) {
111
- case E:
112
- var e = r;
113
- return ar(e) + ".Consumer";
114
- case T:
115
- var n = r;
116
- return ar(n._context) + ".Provider";
117
- case d:
118
- return Nr(r, r.render, "ForwardRef");
119
- case k:
120
- var t = r.displayName || null;
121
- return t !== null ? t : S(r.type) || "Memo";
122
- case j: {
123
- var s = r, u = s._payload, i = s._init;
124
- try {
125
- return S(i(u));
126
- } catch {
127
- return null;
128
- }
129
- }
130
- }
131
- return null;
132
- }
133
- var P = Object.assign, $ = 0, or, ir, sr, ur, lr, cr, fr;
134
- function dr() {
135
- }
136
- dr.__reactDisabledLog = !0;
137
- function Ur() {
138
- {
139
- if ($ === 0) {
140
- or = console.log, ir = console.info, sr = console.warn, ur = console.error, lr = console.group, cr = console.groupCollapsed, fr = console.groupEnd;
141
- var r = {
142
- configurable: !0,
143
- enumerable: !0,
144
- value: dr,
145
- writable: !0
146
- };
147
- Object.defineProperties(console, {
148
- info: r,
149
- log: r,
150
- warn: r,
151
- error: r,
152
- group: r,
153
- groupCollapsed: r,
154
- groupEnd: r
155
- });
156
- }
157
- $++;
158
- }
159
- }
160
- function Br() {
161
- {
162
- if ($--, $ === 0) {
163
- var r = {
164
- configurable: !0,
165
- enumerable: !0,
166
- writable: !0
167
- };
168
- Object.defineProperties(console, {
169
- log: P({}, r, {
170
- value: or
171
- }),
172
- info: P({}, r, {
173
- value: ir
174
- }),
175
- warn: P({}, r, {
176
- value: sr
177
- }),
178
- error: P({}, r, {
179
- value: ur
180
- }),
181
- group: P({}, r, {
182
- value: lr
183
- }),
184
- groupCollapsed: P({}, r, {
185
- value: cr
186
- }),
187
- groupEnd: P({}, r, {
188
- value: fr
189
- })
190
- });
191
- }
192
- $ < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
193
- }
194
- }
195
- var G = D.ReactCurrentDispatcher, J;
196
- function U(r, e, n) {
197
- {
198
- if (J === void 0)
199
- try {
200
- throw Error();
201
- } catch (s) {
202
- var t = s.stack.trim().match(/\n( *(at )?)/);
203
- J = t && t[1] || "";
204
- }
205
- return `
206
- ` + J + r;
207
- }
208
- }
209
- var q = !1, B;
210
- {
211
- var Vr = typeof WeakMap == "function" ? WeakMap : Map;
212
- B = new Vr();
213
- }
214
- function vr(r, e) {
215
- if (!r || q)
216
- return "";
217
- {
218
- var n = B.get(r);
219
- if (n !== void 0)
220
- return n;
221
- }
222
- var t;
223
- q = !0;
224
- var s = Error.prepareStackTrace;
225
- Error.prepareStackTrace = void 0;
226
- var u;
227
- u = G.current, G.current = null, Ur();
228
- try {
229
- if (e) {
230
- var i = function() {
231
- throw Error();
232
- };
233
- if (Object.defineProperty(i.prototype, "props", {
234
- set: function() {
235
- throw Error();
236
- }
237
- }), typeof Reflect == "object" && Reflect.construct) {
238
- try {
239
- Reflect.construct(i, []);
240
- } catch (R) {
241
- t = R;
242
- }
243
- Reflect.construct(r, [], i);
244
- } else {
245
- try {
246
- i.call();
247
- } catch (R) {
248
- t = R;
249
- }
250
- r.call(i.prototype);
251
- }
252
- } else {
253
- try {
254
- throw Error();
255
- } catch (R) {
256
- t = R;
257
- }
258
- r();
259
- }
260
- } catch (R) {
261
- if (R && t && typeof R.stack == "string") {
262
- for (var o = R.stack.split(`
263
- `), h = t.stack.split(`
264
- `), c = o.length - 1, f = h.length - 1; c >= 1 && f >= 0 && o[c] !== h[f]; )
265
- f--;
266
- for (; c >= 1 && f >= 0; c--, f--)
267
- if (o[c] !== h[f]) {
268
- if (c !== 1 || f !== 1)
269
- do
270
- if (c--, f--, f < 0 || o[c] !== h[f]) {
271
- var _ = `
272
- ` + o[c].replace(" at new ", " at ");
273
- return r.displayName && _.includes("<anonymous>") && (_ = _.replace("<anonymous>", r.displayName)), typeof r == "function" && B.set(r, _), _;
274
- }
275
- while (c >= 1 && f >= 0);
276
- break;
277
- }
278
- }
279
- } finally {
280
- q = !1, G.current = u, Br(), Error.prepareStackTrace = s;
281
- }
282
- var L = r ? r.displayName || r.name : "", A = L ? U(L) : "";
283
- return typeof r == "function" && B.set(r, A), A;
284
- }
285
- function Xr(r, e, n) {
286
- return vr(r, !1);
287
- }
288
- function zr(r) {
289
- var e = r.prototype;
290
- return !!(e && e.isReactComponent);
291
- }
292
- function V(r, e, n) {
293
- if (r == null)
294
- return "";
295
- if (typeof r == "function")
296
- return vr(r, zr(r));
297
- if (typeof r == "string")
298
- return U(r);
299
- switch (r) {
300
- case C:
301
- return U("Suspense");
302
- case p:
303
- return U("SuspenseList");
304
- }
305
- if (typeof r == "object")
306
- switch (r.$$typeof) {
307
- case d:
308
- return Xr(r.render);
309
- case k:
310
- return V(r.type, e, n);
311
- case j: {
312
- var t = r, s = t._payload, u = t._init;
313
- try {
314
- return V(u(s), e, n);
315
- } catch {
316
- }
317
- }
318
- }
319
- return "";
320
- }
321
- var W = Object.prototype.hasOwnProperty, gr = {}, pr = D.ReactDebugCurrentFrame;
322
- function X(r) {
323
- if (r) {
324
- var e = r._owner, n = V(r.type, r._source, e ? e.type : null);
325
- pr.setExtraStackFrame(n);
326
- } else
327
- pr.setExtraStackFrame(null);
328
- }
329
- function Gr(r, e, n, t, s) {
330
- {
331
- var u = Function.call.bind(W);
332
- for (var i in r)
333
- if (u(r, i)) {
334
- var o = void 0;
335
- try {
336
- if (typeof r[i] != "function") {
337
- var h = Error((t || "React class") + ": " + n + " type `" + i + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof r[i] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
338
- throw h.name = "Invariant Violation", h;
339
- }
340
- o = r[i](e, i, t, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
341
- } catch (c) {
342
- o = c;
343
- }
344
- o && !(o instanceof Error) && (X(s), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", t || "React class", n, i, typeof o), X(null)), o instanceof Error && !(o.message in gr) && (gr[o.message] = !0, X(s), m("Failed %s type: %s", n, o.message), X(null));
345
- }
346
- }
347
- }
348
- var Jr = Array.isArray;
349
- function K(r) {
350
- return Jr(r);
351
- }
352
- function qr(r) {
353
- {
354
- var e = typeof Symbol == "function" && Symbol.toStringTag, n = e && r[Symbol.toStringTag] || r.constructor.name || "Object";
355
- return n;
356
- }
357
- }
358
- function Kr(r) {
359
- try {
360
- return mr(r), !1;
361
- } catch {
362
- return !0;
363
- }
364
- }
365
- function mr(r) {
366
- return "" + r;
367
- }
368
- function br(r) {
369
- if (Kr(r))
370
- return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", qr(r)), mr(r);
371
- }
372
- var M = D.ReactCurrentOwner, Hr = {
373
- key: !0,
374
- ref: !0,
375
- __self: !0,
376
- __source: !0
377
- }, hr, yr, H;
378
- H = {};
379
- function Zr(r) {
380
- if (W.call(r, "ref")) {
381
- var e = Object.getOwnPropertyDescriptor(r, "ref").get;
382
- if (e && e.isReactWarning)
383
- return !1;
384
- }
385
- return r.ref !== void 0;
386
- }
387
- function Qr(r) {
388
- if (W.call(r, "key")) {
389
- var e = Object.getOwnPropertyDescriptor(r, "key").get;
390
- if (e && e.isReactWarning)
391
- return !1;
392
- }
393
- return r.key !== void 0;
394
- }
395
- function re(r, e) {
396
- if (typeof r.ref == "string" && M.current && e && M.current.stateNode !== e) {
397
- var n = S(M.current.type);
398
- H[n] || (m('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', S(M.current.type), r.ref), H[n] = !0);
399
- }
400
- }
401
- function ee(r, e) {
402
- {
403
- var n = function() {
404
- hr || (hr = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", e));
405
- };
406
- n.isReactWarning = !0, Object.defineProperty(r, "key", {
407
- get: n,
408
- configurable: !0
409
- });
410
- }
411
- }
412
- function ne(r, e) {
413
- {
414
- var n = function() {
415
- yr || (yr = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", e));
416
- };
417
- n.isReactWarning = !0, Object.defineProperty(r, "ref", {
418
- get: n,
419
- configurable: !0
420
- });
421
- }
422
- }
423
- var te = function(r, e, n, t, s, u, i) {
424
- var o = {
425
- // This tag allows us to uniquely identify this as a React Element
426
- $$typeof: a,
427
- // Built-in properties that belong on the element
428
- type: r,
429
- key: e,
430
- ref: n,
431
- props: i,
432
- // Record the component responsible for creating this element.
433
- _owner: u
434
- };
435
- return o._store = {}, Object.defineProperty(o._store, "validated", {
436
- configurable: !1,
437
- enumerable: !1,
438
- writable: !0,
439
- value: !1
440
- }), Object.defineProperty(o, "_self", {
441
- configurable: !1,
442
- enumerable: !1,
443
- writable: !1,
444
- value: t
445
- }), Object.defineProperty(o, "_source", {
446
- configurable: !1,
447
- enumerable: !1,
448
- writable: !1,
449
- value: s
450
- }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
451
- };
452
- function ae(r, e, n, t, s) {
453
- {
454
- var u, i = {}, o = null, h = null;
455
- n !== void 0 && (br(n), o = "" + n), Qr(e) && (br(e.key), o = "" + e.key), Zr(e) && (h = e.ref, re(e, s));
456
- for (u in e)
457
- W.call(e, u) && !Hr.hasOwnProperty(u) && (i[u] = e[u]);
458
- if (r && r.defaultProps) {
459
- var c = r.defaultProps;
460
- for (u in c)
461
- i[u] === void 0 && (i[u] = c[u]);
462
- }
463
- if (o || h) {
464
- var f = typeof r == "function" ? r.displayName || r.name || "Unknown" : r;
465
- o && ee(i, f), h && ne(i, f);
466
- }
467
- return te(r, o, h, s, t, M.current, i);
468
- }
469
- }
470
- var Z = D.ReactCurrentOwner, Er = D.ReactDebugCurrentFrame;
471
- function F(r) {
472
- if (r) {
473
- var e = r._owner, n = V(r.type, r._source, e ? e.type : null);
474
- Er.setExtraStackFrame(n);
475
- } else
476
- Er.setExtraStackFrame(null);
477
- }
478
- var Q;
479
- Q = !1;
480
- function rr(r) {
481
- return typeof r == "object" && r !== null && r.$$typeof === a;
482
- }
483
- function Rr() {
484
- {
485
- if (Z.current) {
486
- var r = S(Z.current.type);
487
- if (r)
488
- return `
489
-
490
- Check the render method of \`` + r + "`.";
491
- }
492
- return "";
493
- }
494
- }
495
- function oe(r) {
496
- {
497
- if (r !== void 0) {
498
- var e = r.fileName.replace(/^.*[\\\/]/, ""), n = r.lineNumber;
499
- return `
500
-
501
- Check your code at ` + e + ":" + n + ".";
502
- }
503
- return "";
504
- }
505
- }
506
- var wr = {};
507
- function ie(r) {
508
- {
509
- var e = Rr();
510
- if (!e) {
511
- var n = typeof r == "string" ? r : r.displayName || r.name;
512
- n && (e = `
513
-
514
- Check the top-level render call using <` + n + ">.");
515
- }
516
- return e;
517
- }
518
- }
519
- function _r(r, e) {
520
- {
521
- if (!r._store || r._store.validated || r.key != null)
522
- return;
523
- r._store.validated = !0;
524
- var n = ie(e);
525
- if (wr[n])
526
- return;
527
- wr[n] = !0;
528
- var t = "";
529
- r && r._owner && r._owner !== Z.current && (t = " It was passed a child from " + S(r._owner.type) + "."), F(r), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, t), F(null);
530
- }
531
- }
532
- function kr(r, e) {
533
- {
534
- if (typeof r != "object")
535
- return;
536
- if (K(r))
537
- for (var n = 0; n < r.length; n++) {
538
- var t = r[n];
539
- rr(t) && _r(t, e);
540
- }
541
- else if (rr(r))
542
- r._store && (r._store.validated = !0);
543
- else if (r) {
544
- var s = Dr(r);
545
- if (typeof s == "function" && s !== r.entries)
546
- for (var u = s.call(r), i; !(i = u.next()).done; )
547
- rr(i.value) && _r(i.value, e);
548
- }
549
- }
550
- }
551
- function se(r) {
552
- {
553
- var e = r.type;
554
- if (e == null || typeof e == "string")
555
- return;
556
- var n;
557
- if (typeof e == "function")
558
- n = e.propTypes;
559
- else if (typeof e == "object" && (e.$$typeof === d || // Note: Memo only checks outer props here.
560
- // Inner props are checked in the reconciler.
561
- e.$$typeof === k))
562
- n = e.propTypes;
563
- else
564
- return;
565
- if (n) {
566
- var t = S(e);
567
- Gr(n, r.props, "prop", t, r);
568
- } else if (e.PropTypes !== void 0 && !Q) {
569
- Q = !0;
570
- var s = S(e);
571
- m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", s || "Unknown");
572
- }
573
- typeof e.getDefaultProps == "function" && !e.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
574
- }
575
- }
576
- function ue(r) {
577
- {
578
- for (var e = Object.keys(r.props), n = 0; n < e.length; n++) {
579
- var t = e[n];
580
- if (t !== "children" && t !== "key") {
581
- F(r), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", t), F(null);
582
- break;
583
- }
584
- }
585
- r.ref !== null && (F(r), m("Invalid attribute `ref` supplied to `React.Fragment`."), F(null));
586
- }
587
- }
588
- var xr = {};
589
- function Tr(r, e, n, t, s, u) {
590
- {
591
- var i = Yr(r);
592
- if (!i) {
593
- var o = "";
594
- (r === void 0 || typeof r == "object" && r !== null && Object.keys(r).length === 0) && (o += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
595
- var h = oe(s);
596
- h ? o += h : o += Rr();
597
- var c;
598
- r === null ? c = "null" : K(r) ? c = "array" : r !== void 0 && r.$$typeof === a ? (c = "<" + (S(r.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : c = typeof r, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", c, o);
599
- }
600
- var f = ae(r, e, n, s, u);
601
- if (f == null)
602
- return f;
603
- if (i) {
604
- var _ = e.children;
605
- if (_ !== void 0)
606
- if (t)
607
- if (K(_)) {
608
- for (var L = 0; L < _.length; L++)
609
- kr(_[L], r);
610
- Object.freeze && Object.freeze(_);
611
- } else
612
- m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
613
- else
614
- kr(_, r);
615
- }
616
- if (W.call(e, "key")) {
617
- var A = S(r), R = Object.keys(e).filter(function(ge) {
618
- return ge !== "key";
619
- }), er = R.length > 0 ? "{key: someKey, " + R.join(": ..., ") + ": ...}" : "{key: someKey}";
620
- if (!xr[A + er]) {
621
- var ve = R.length > 0 ? "{" + R.join(": ..., ") + ": ...}" : "{}";
622
- m(`A props object containing a "key" prop is being spread into JSX:
623
- let props = %s;
624
- <%s {...props} />
625
- React keys must be passed directly to JSX without using spread:
626
- let props = %s;
627
- <%s key={someKey} {...props} />`, er, A, ve, A), xr[A + er] = !0;
628
- }
629
- }
630
- return r === y ? ue(f) : se(f), f;
631
- }
632
- }
633
- function le(r, e, n) {
634
- return Tr(r, e, n, !0);
635
- }
636
- function ce(r, e, n) {
637
- return Tr(r, e, n, !1);
638
- }
639
- var fe = ce, de = le;
640
- N.Fragment = y, N.jsx = fe, N.jsxs = de;
641
- }()), N;
642
- }
643
- process.env.NODE_ENV === "production" ? nr.exports = be() : nr.exports = he();
644
- var g = nr.exports;
645
- const ye = `@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");
1
+ import { jsx as t, jsxs as w } from "react/jsx-runtime";
2
+ import p, { useState as b, useRef as x, useEffect as h } from "react";
3
+ import C from "react-dom";
4
+ const L = `@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");
646
5
 
647
6
  * {
648
7
  margin: 0;
@@ -942,123 +301,123 @@ const ye = `@import url("https://fonts.googleapis.com/css2?family=Poppins&displa
942
301
  }
943
302
  }
944
303
  `;
945
- let Ee = 1;
946
- class Re {
304
+ let E = 1;
305
+ class T {
947
306
  constructor() {
948
- this.subscribe = (a) => (this.subscribers.push(a), () => {
949
- const b = this.subscribers.indexOf(a);
950
- this.subscribers.splice(b, 1);
951
- }), this.publish = (a) => {
952
- this.subscribers.forEach((b) => b(a));
953
- }, this.addToast = (a) => {
954
- this.publish(a), this.toasts = [...this.toasts, a];
955
- }, this.create = (a) => {
956
- const { message: b, type: y } = a, v = Ee++;
957
- return this.addToast({ title: b, type: y, id: v }), v;
958
- }, this.dismiss = (a) => (this.subscribers.forEach((b) => b({ id: a, dismiss: !0 })), a), this.danger = (a) => this.create({ message: a, type: "danger" }), this.warning = (a) => this.create({ message: a, type: "warning" }), this.success = (a) => this.create({ type: "success", message: a }), this.info = (a) => this.create({ type: "info", message: a }), this.default = (a) => this.create({ type: "default", message: a }), this.subscribers = [], this.toasts = [];
307
+ this.subscribe = (n) => (this.subscribers.push(n), () => {
308
+ const r = this.subscribers.indexOf(n);
309
+ this.subscribers.splice(r, 1);
310
+ }), this.publish = (n) => {
311
+ this.subscribers.forEach((r) => r(n));
312
+ }, this.addToast = (n) => {
313
+ this.publish(n), this.toasts = [...this.toasts, n];
314
+ }, this.create = (n) => {
315
+ const { message: r, type: i } = n, s = E++;
316
+ return this.addToast({ title: r, type: i, id: s }), s;
317
+ }, this.dismiss = (n) => (this.subscribers.forEach((r) => r({ id: n, dismiss: !0 })), n), this.danger = (n) => this.create({ message: n, type: "danger" }), this.warning = (n) => this.create({ message: n, type: "warning" }), this.success = (n) => this.create({ type: "success", message: n }), this.info = (n) => this.create({ type: "info", message: n }), this.default = (n) => this.create({ type: "default", message: n }), this.subscribers = [], this.toasts = [];
959
318
  }
960
319
  }
961
- const O = new Re(), je = Object.assign({
962
- success: O.success,
963
- info: O.info,
964
- default: O.default,
965
- danger: O.danger,
966
- warning: O.warning
967
- }), Pr = "starasia-toast-styles", we = (l) => {
968
- if (!document.getElementById(Pr)) {
969
- const a = document.createElement("style");
970
- a.id = Pr, a.textContent = l, document.head.appendChild(a);
320
+ const o = new T(), D = Object.assign({
321
+ success: o.success,
322
+ info: o.info,
323
+ default: o.default,
324
+ danger: o.danger,
325
+ warning: o.warning
326
+ }), v = "starasia-toast-styles", S = (a) => {
327
+ if (!document.getElementById(v)) {
328
+ const n = document.createElement("style");
329
+ n.id = v, n.textContent = a, document.head.appendChild(n);
971
330
  }
972
331
  };
973
- we(ye);
974
- const Oe = ({
975
- type: l = "outline",
976
- direction: a = "bottom-right"
332
+ S(L);
333
+ const N = ({
334
+ type: a = "outline",
335
+ direction: n = "bottom-right"
977
336
  }) => {
978
- const [b, y] = z.useState([]);
979
- return z.useEffect(() => O.subscribe((v) => {
980
- if (v.dismiss) {
981
- y((w) => w.filter((T) => T.id !== v.id));
337
+ const [r, i] = p.useState([]);
338
+ return p.useEffect(() => o.subscribe((s) => {
339
+ if (s.dismiss) {
340
+ i((e) => e.filter((u) => u.id !== s.id));
982
341
  return;
983
342
  }
984
343
  setTimeout(() => {
985
- me.flushSync(() => {
986
- y((w) => [v, ...w]);
344
+ C.flushSync(() => {
345
+ i((e) => [s, ...e]);
987
346
  });
988
347
  });
989
- }), []), /* @__PURE__ */ g.jsx(
348
+ }), []), /* @__PURE__ */ t(
990
349
  "div",
991
350
  {
992
- className: `starasia-toast-container starasia-toast-container-${a}`,
993
- children: b.map((v) => /* @__PURE__ */ g.jsx(
994
- _e,
351
+ className: `starasia-toast-container starasia-toast-container-${n}`,
352
+ children: r.map((s) => /* @__PURE__ */ t(
353
+ R,
995
354
  {
996
- data: v,
997
- type: l,
998
- direction: a
355
+ data: s,
356
+ type: a,
357
+ direction: n
999
358
  },
1000
- v.id
359
+ s.id
1001
360
  ))
1002
361
  }
1003
362
  );
1004
- }, _e = ({ data: l, type: a = "solid", direction: b }) => {
1005
- const [y, v] = Cr(null), [w, T] = Cr(!1), E = pe(null), d = () => {
1006
- const x = setTimeout(() => {
1007
- p();
363
+ }, R = ({ data: a, type: n = "solid", direction: r }) => {
364
+ const [i, s] = b(null), [e, u] = b(!1), l = x(null), f = () => {
365
+ const c = setTimeout(() => {
366
+ g();
1008
367
  }, 5e3);
1009
- v(x);
1010
- }, C = () => {
1011
- y && (clearTimeout(y), v(null));
1012
- }, p = () => {
1013
- O.dismiss(l.id);
368
+ s(c);
369
+ }, d = () => {
370
+ i && (clearTimeout(i), s(null));
371
+ }, g = () => {
372
+ o.dismiss(a.id);
1014
373
  };
1015
- Sr(() => (w ? C() : d(), () => {
1016
- C();
1017
- }), [w]), Sr(() => {
1018
- const x = E.current, I = () => {
1019
- p();
374
+ h(() => (e ? d() : f(), () => {
375
+ d();
376
+ }), [e]), h(() => {
377
+ const c = l.current, m = () => {
378
+ g();
1020
379
  };
1021
- return x && x.addEventListener("animationend", I), () => {
1022
- x && x.removeEventListener("animationend", I);
380
+ return c && c.addEventListener("animationend", m), () => {
381
+ c && c.removeEventListener("animationend", m);
1023
382
  };
1024
383
  }, []);
1025
- const k = () => {
1026
- T(!0), C(), E.current && (E.current.style.animationPlayState = "paused");
1027
- }, j = () => {
1028
- T(!1), d(), E.current && (E.current.style.animationPlayState = "running");
384
+ const y = () => {
385
+ u(!0), d(), l.current && (l.current.style.animationPlayState = "paused");
386
+ }, k = () => {
387
+ u(!1), f(), l.current && (l.current.style.animationPlayState = "running");
1029
388
  };
1030
- return /* @__PURE__ */ g.jsxs(
389
+ return /* @__PURE__ */ w(
1031
390
  "div",
1032
391
  {
1033
- className: `starasia-toast-item-container starasia-toast-item-container-${a}-${l.type} starasia-toast-item-container-animation-${b}`,
1034
- onMouseEnter: k,
1035
- onMouseLeave: j,
392
+ className: `starasia-toast-item-container starasia-toast-item-container-${n}-${a.type} starasia-toast-item-container-animation-${r}`,
393
+ onMouseEnter: y,
394
+ onMouseLeave: k,
1036
395
  children: [
1037
- /* @__PURE__ */ g.jsx("div", { style: { display: "flex" }, children: l.type === "success" ? /* @__PURE__ */ g.jsx(xe, { style: { color: "inherit" } }) : /* @__PURE__ */ g.jsx(ke, { style: { color: "inherit" } }) }),
1038
- /* @__PURE__ */ g.jsx("div", { style: { flex: 1 }, children: l.title }),
1039
- /* @__PURE__ */ g.jsx(
396
+ /* @__PURE__ */ t("div", { style: { display: "flex" }, children: a.type === "success" ? /* @__PURE__ */ t(M, { style: { color: "inherit" } }) : /* @__PURE__ */ t(I, { style: { color: "inherit" } }) }),
397
+ /* @__PURE__ */ t("div", { style: { flex: 1 }, children: a.title }),
398
+ /* @__PURE__ */ t(
1040
399
  "div",
1041
400
  {
1042
401
  style: { display: "flex", cursor: "pointer" },
1043
- onClick: () => O.dismiss(l.id),
1044
- children: /* @__PURE__ */ g.jsx(Te, { style: { color: "inherit" } })
402
+ onClick: () => o.dismiss(a.id),
403
+ children: /* @__PURE__ */ t(A, { style: { color: "inherit" } })
1045
404
  }
1046
405
  ),
1047
- a === "outline" ? /* @__PURE__ */ g.jsx(
406
+ n === "outline" ? /* @__PURE__ */ t(
1048
407
  "div",
1049
408
  {
1050
- ref: E,
1051
- className: `starasia-toast-item-progress starasia-toast-item-progress-outline-${l.type}`,
409
+ ref: l,
410
+ className: `starasia-toast-item-progress starasia-toast-item-progress-outline-${a.type}`,
1052
411
  style: {
1053
412
  animation: "progressBarr 5s linear forwards",
1054
- animationPlayState: w ? "paused" : "running"
413
+ animationPlayState: e ? "paused" : "running"
1055
414
  }
1056
415
  }
1057
416
  ) : null
1058
417
  ]
1059
418
  }
1060
419
  );
1061
- }, ke = (l) => /* @__PURE__ */ g.jsx(
420
+ }, I = (a) => /* @__PURE__ */ t(
1062
421
  "svg",
1063
422
  {
1064
423
  xmlns: "http://www.w3.org/2000/svg",
@@ -1066,8 +425,8 @@ const Oe = ({
1066
425
  height: "20",
1067
426
  viewBox: "0 0 24 24",
1068
427
  fill: "none",
1069
- ...l,
1070
- children: /* @__PURE__ */ g.jsx(
428
+ ...a,
429
+ children: /* @__PURE__ */ t(
1071
430
  "path",
1072
431
  {
1073
432
  d: "M12 7.01001V7.00002M12 17L12 10M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",
@@ -1079,7 +438,7 @@ const Oe = ({
1079
438
  }
1080
439
  )
1081
440
  }
1082
- ), xe = (l) => /* @__PURE__ */ g.jsx(
441
+ ), M = (a) => /* @__PURE__ */ t(
1083
442
  "svg",
1084
443
  {
1085
444
  width: "20",
@@ -1087,8 +446,8 @@ const Oe = ({
1087
446
  viewBox: "0 0 20 20",
1088
447
  fill: "none",
1089
448
  xmlns: "http://www.w3.org/2000/svg",
1090
- ...l,
1091
- children: /* @__PURE__ */ g.jsx("g", { id: "Curved/Basic-actions-and-state", children: /* @__PURE__ */ g.jsx(
449
+ ...a,
450
+ children: /* @__PURE__ */ t("g", { id: "Curved/Basic-actions-and-state", children: /* @__PURE__ */ t(
1092
451
  "path",
1093
452
  {
1094
453
  id: "shape",
@@ -1100,7 +459,7 @@ const Oe = ({
1100
459
  }
1101
460
  ) })
1102
461
  }
1103
- ), Te = (l) => /* @__PURE__ */ g.jsx(
462
+ ), A = (a) => /* @__PURE__ */ t(
1104
463
  "svg",
1105
464
  {
1106
465
  xmlns: "http://www.w3.org/2000/svg",
@@ -1108,8 +467,8 @@ const Oe = ({
1108
467
  height: "20",
1109
468
  viewBox: "0 0 24 24",
1110
469
  fill: "none",
1111
- ...l,
1112
- children: /* @__PURE__ */ g.jsx(
470
+ ...a,
471
+ children: /* @__PURE__ */ t(
1113
472
  "path",
1114
473
  {
1115
474
  d: "M19 5L5 19M5.00003 5L19 19",
@@ -1122,6 +481,6 @@ const Oe = ({
1122
481
  }
1123
482
  );
1124
483
  export {
1125
- Oe as ToastContainer,
1126
- je as toast
484
+ N as ToastContainer,
485
+ D as toast
1127
486
  };
package/dist/toast.umd.js CHANGED
@@ -1,35 +1,4 @@
1
- (function(O,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],w):(O=typeof globalThis<"u"?globalThis:O||self,w(O.Toast={},O.React,O.ReactDOM))})(this,function(O,w,Pr){"use strict";var J={exports:{}},W={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var ar;function Ar(){if(ar)return W;ar=1;var l=w,a=Symbol.for("react.element"),b=Symbol.for("react.fragment"),y=Object.prototype.hasOwnProperty,p=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_={key:!0,ref:!0,__self:!0,__source:!0};function C(E,d,S){var g,x={},P=null,T=null;S!==void 0&&(P=""+S),d.key!==void 0&&(P=""+d.key),d.ref!==void 0&&(T=d.ref);for(g in d)y.call(d,g)&&!_.hasOwnProperty(g)&&(x[g]=d[g]);if(E&&E.defaultProps)for(g in d=E.defaultProps,d)x[g]===void 0&&(x[g]=d[g]);return{$$typeof:a,type:E,key:P,ref:T,props:x,_owner:p.current}}return W.Fragment=b,W.jsx=C,W.jsxs=C,W}var Y={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var or;function Dr(){return or||(or=1,process.env.NODE_ENV!=="production"&&function(){var l=w,a=Symbol.for("react.element"),b=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),C=Symbol.for("react.provider"),E=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),N=Symbol.iterator,Vr="@@iterator";function Xr(r){if(r===null||typeof r!="object")return null;var e=N&&r[N]||r[Vr];return typeof e=="function"?e:null}var L=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function m(r){{for(var e=arguments.length,n=new Array(e>1?e-1:0),t=1;t<e;t++)n[t-1]=arguments[t];$r("error",r,n)}}function $r(r,e,n){{var t=L.ReactDebugCurrentFrame,s=t.getStackAddendum();s!==""&&(e+="%s",n=n.concat([s]));var u=n.map(function(i){return String(i)});u.unshift("Warning: "+e),Function.prototype.apply.call(console[r],console,u)}}var zr=!1,Gr=!1,Jr=!1,Kr=!1,Hr=!1,sr;sr=Symbol.for("react.module.reference");function Zr(r){return!!(typeof r=="string"||typeof r=="function"||r===y||r===_||Hr||r===p||r===S||r===g||Kr||r===T||zr||Gr||Jr||typeof r=="object"&&r!==null&&(r.$$typeof===P||r.$$typeof===x||r.$$typeof===C||r.$$typeof===E||r.$$typeof===d||r.$$typeof===sr||r.getModuleId!==void 0))}function qr(r,e,n){var t=r.displayName;if(t)return t;var s=e.displayName||e.name||"";return s!==""?n+"("+s+")":n}function ur(r){return r.displayName||"Context"}function j(r){if(r==null)return null;if(typeof r.tag=="number"&&m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case y:return"Fragment";case b:return"Portal";case _:return"Profiler";case p:return"StrictMode";case S:return"Suspense";case g:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case E:var e=r;return ur(e)+".Consumer";case C:var n=r;return ur(n._context)+".Provider";case d:return qr(r,r.render,"ForwardRef");case x:var t=r.displayName||null;return t!==null?t:j(r.type)||"Memo";case P:{var s=r,u=s._payload,i=s._init;try{return j(i(u))}catch{return null}}}return null}var D=Object.assign,U=0,lr,cr,fr,dr,vr,pr,gr;function mr(){}mr.__reactDisabledLog=!0;function Qr(){{if(U===0){lr=console.log,cr=console.info,fr=console.warn,dr=console.error,vr=console.group,pr=console.groupCollapsed,gr=console.groupEnd;var r={configurable:!0,enumerable:!0,value:mr,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}U++}}function re(){{if(U--,U===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},r,{value:lr}),info:D({},r,{value:cr}),warn:D({},r,{value:fr}),error:D({},r,{value:dr}),group:D({},r,{value:vr}),groupCollapsed:D({},r,{value:pr}),groupEnd:D({},r,{value:gr})})}U<0&&m("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=L.ReactCurrentDispatcher,H;function X(r,e,n){{if(H===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);H=t&&t[1]||""}return`
18
- `+H+r}}var Z=!1,$;{var ee=typeof WeakMap=="function"?WeakMap:Map;$=new ee}function br(r,e){if(!r||Z)return"";{var n=$.get(r);if(n!==void 0)return n}var t;Z=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=K.current,K.current=null,Qr();try{if(e){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(R){t=R}Reflect.construct(r,[],i)}else{try{i.call()}catch(R){t=R}r.call(i.prototype)}}else{try{throw Error()}catch(R){t=R}r()}}catch(R){if(R&&t&&typeof R.stack=="string"){for(var o=R.stack.split(`
19
- `),h=t.stack.split(`
20
- `),c=o.length-1,f=h.length-1;c>=1&&f>=0&&o[c]!==h[f];)f--;for(;c>=1&&f>=0;c--,f--)if(o[c]!==h[f]){if(c!==1||f!==1)do if(c--,f--,f<0||o[c]!==h[f]){var k=`
21
- `+o[c].replace(" at new "," at ");return r.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",r.displayName)),typeof r=="function"&&$.set(r,k),k}while(c>=1&&f>=0);break}}}finally{Z=!1,K.current=u,re(),Error.prepareStackTrace=s}var M=r?r.displayName||r.name:"",F=M?X(M):"";return typeof r=="function"&&$.set(r,F),F}function ne(r,e,n){return br(r,!1)}function te(r){var e=r.prototype;return!!(e&&e.isReactComponent)}function z(r,e,n){if(r==null)return"";if(typeof r=="function")return br(r,te(r));if(typeof r=="string")return X(r);switch(r){case S:return X("Suspense");case g:return X("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case d:return ne(r.render);case x:return z(r.type,e,n);case P:{var t=r,s=t._payload,u=t._init;try{return z(u(s),e,n)}catch{}}}return""}var B=Object.prototype.hasOwnProperty,hr={},yr=L.ReactDebugCurrentFrame;function G(r){if(r){var e=r._owner,n=z(r.type,r._source,e?e.type:null);yr.setExtraStackFrame(n)}else yr.setExtraStackFrame(null)}function ae(r,e,n,t,s){{var u=Function.call.bind(B);for(var i in r)if(u(r,i)){var o=void 0;try{if(typeof r[i]!="function"){var h=Error((t||"React class")+": "+n+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}o=r[i](e,i,t,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(c){o=c}o&&!(o instanceof Error)&&(G(s),m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",t||"React class",n,i,typeof o),G(null)),o instanceof Error&&!(o.message in hr)&&(hr[o.message]=!0,G(s),m("Failed %s type: %s",n,o.message),G(null))}}}var oe=Array.isArray;function q(r){return oe(r)}function ie(r){{var e=typeof Symbol=="function"&&Symbol.toStringTag,n=e&&r[Symbol.toStringTag]||r.constructor.name||"Object";return n}}function se(r){try{return Er(r),!1}catch{return!0}}function Er(r){return""+r}function Rr(r){if(se(r))return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ie(r)),Er(r)}var V=L.ReactCurrentOwner,ue={key:!0,ref:!0,__self:!0,__source:!0},wr,_r,Q;Q={};function le(r){if(B.call(r,"ref")){var e=Object.getOwnPropertyDescriptor(r,"ref").get;if(e&&e.isReactWarning)return!1}return r.ref!==void 0}function ce(r){if(B.call(r,"key")){var e=Object.getOwnPropertyDescriptor(r,"key").get;if(e&&e.isReactWarning)return!1}return r.key!==void 0}function fe(r,e){if(typeof r.ref=="string"&&V.current&&e&&V.current.stateNode!==e){var n=j(V.current.type);Q[n]||(m('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',j(V.current.type),r.ref),Q[n]=!0)}}function de(r,e){{var n=function(){wr||(wr=!0,m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",e))};n.isReactWarning=!0,Object.defineProperty(r,"key",{get:n,configurable:!0})}}function ve(r,e){{var n=function(){_r||(_r=!0,m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",e))};n.isReactWarning=!0,Object.defineProperty(r,"ref",{get:n,configurable:!0})}}var pe=function(r,e,n,t,s,u,i){var o={$$typeof:a,type:r,key:e,ref:n,props:i,_owner:u};return o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(o,"_self",{configurable:!1,enumerable:!1,writable:!1,value:t}),Object.defineProperty(o,"_source",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o};function ge(r,e,n,t,s){{var u,i={},o=null,h=null;n!==void 0&&(Rr(n),o=""+n),ce(e)&&(Rr(e.key),o=""+e.key),le(e)&&(h=e.ref,fe(e,s));for(u in e)B.call(e,u)&&!ue.hasOwnProperty(u)&&(i[u]=e[u]);if(r&&r.defaultProps){var c=r.defaultProps;for(u in c)i[u]===void 0&&(i[u]=c[u])}if(o||h){var f=typeof r=="function"?r.displayName||r.name||"Unknown":r;o&&de(i,f),h&&ve(i,f)}return pe(r,o,h,s,t,V.current,i)}}var rr=L.ReactCurrentOwner,kr=L.ReactDebugCurrentFrame;function I(r){if(r){var e=r._owner,n=z(r.type,r._source,e?e.type:null);kr.setExtraStackFrame(n)}else kr.setExtraStackFrame(null)}var er;er=!1;function nr(r){return typeof r=="object"&&r!==null&&r.$$typeof===a}function xr(){{if(rr.current){var r=j(rr.current.type);if(r)return`
22
-
23
- Check the render method of \``+r+"`."}return""}}function me(r){{if(r!==void 0){var e=r.fileName.replace(/^.*[\\\/]/,""),n=r.lineNumber;return`
24
-
25
- Check your code at `+e+":"+n+"."}return""}}var Tr={};function be(r){{var e=xr();if(!e){var n=typeof r=="string"?r:r.displayName||r.name;n&&(e=`
26
-
27
- Check the top-level render call using <`+n+">.")}return e}}function Cr(r,e){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var n=be(e);if(Tr[n])return;Tr[n]=!0;var t="";r&&r._owner&&r._owner!==rr.current&&(t=" It was passed a child from "+j(r._owner.type)+"."),I(r),m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,t),I(null)}}function Sr(r,e){{if(typeof r!="object")return;if(q(r))for(var n=0;n<r.length;n++){var t=r[n];nr(t)&&Cr(t,e)}else if(nr(r))r._store&&(r._store.validated=!0);else if(r){var s=Xr(r);if(typeof s=="function"&&s!==r.entries)for(var u=s.call(r),i;!(i=u.next()).done;)nr(i.value)&&Cr(i.value,e)}}}function he(r){{var e=r.type;if(e==null||typeof e=="string")return;var n;if(typeof e=="function")n=e.propTypes;else if(typeof e=="object"&&(e.$$typeof===d||e.$$typeof===x))n=e.propTypes;else return;if(n){var t=j(e);ae(n,r.props,"prop",t,r)}else if(e.PropTypes!==void 0&&!er){er=!0;var s=j(e);m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",s||"Unknown")}typeof e.getDefaultProps=="function"&&!e.getDefaultProps.isReactClassApproved&&m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ye(r){{for(var e=Object.keys(r.props),n=0;n<e.length;n++){var t=e[n];if(t!=="children"&&t!=="key"){I(r),m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",t),I(null);break}}r.ref!==null&&(I(r),m("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}var jr={};function Or(r,e,n,t,s,u){{var i=Zr(r);if(!i){var o="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(o+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var h=me(s);h?o+=h:o+=xr();var c;r===null?c="null":q(r)?c="array":r!==void 0&&r.$$typeof===a?(c="<"+(j(r.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):c=typeof r,m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",c,o)}var f=ge(r,e,n,s,u);if(f==null)return f;if(i){var k=e.children;if(k!==void 0)if(t)if(q(k)){for(var M=0;M<k.length;M++)Sr(k[M],r);Object.freeze&&Object.freeze(k)}else m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Sr(k,r)}if(B.call(e,"key")){var F=j(r),R=Object.keys(e).filter(function(xe){return xe!=="key"}),tr=R.length>0?"{key: someKey, "+R.join(": ..., ")+": ...}":"{key: someKey}";if(!jr[F+tr]){var ke=R.length>0?"{"+R.join(": ..., ")+": ...}":"{}";m(`A props object containing a "key" prop is being spread into JSX:
28
- let props = %s;
29
- <%s {...props} />
30
- React keys must be passed directly to JSX without using spread:
31
- let props = %s;
32
- <%s key={someKey} {...props} />`,tr,F,ke,F),jr[F+tr]=!0}}return r===y?ye(f):he(f),f}}function Ee(r,e,n){return Or(r,e,n,!0)}function Re(r,e,n){return Or(r,e,n,!1)}var we=Re,_e=Ee;Y.Fragment=y,Y.jsx=we,Y.jsxs=_e}()),Y}process.env.NODE_ENV==="production"?J.exports=Ar():J.exports=Dr();var v=J.exports;const Fr=`@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");
1
+ (function(o,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],a):(o=typeof globalThis<"u"?globalThis:o||self,a(o.Toast={},o.jsxRuntime,o.React,o.ReactDOM))})(this,function(o,a,e,v){"use strict";const y=`@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");
33
2
 
34
3
  * {
35
4
  margin: 0;
@@ -328,4 +297,4 @@ React keys must be passed directly to JSX without using spread:
328
297
  width: 0px;
329
298
  }
330
299
  }
331
- `;let Lr=1;class Ir{constructor(){this.subscribe=a=>(this.subscribers.push(a),()=>{const b=this.subscribers.indexOf(a);this.subscribers.splice(b,1)}),this.publish=a=>{this.subscribers.forEach(b=>b(a))},this.addToast=a=>{this.publish(a),this.toasts=[...this.toasts,a]},this.create=a=>{const{message:b,type:y}=a,p=Lr++;return this.addToast({title:b,type:y,id:p}),p},this.dismiss=a=>(this.subscribers.forEach(b=>b({id:a,dismiss:!0})),a),this.danger=a=>this.create({message:a,type:"danger"}),this.warning=a=>this.create({message:a,type:"warning"}),this.success=a=>this.create({type:"success",message:a}),this.info=a=>this.create({type:"info",message:a}),this.default=a=>this.create({type:"default",message:a}),this.subscribers=[],this.toasts=[]}}const A=new Ir,Mr=Object.assign({success:A.success,info:A.info,default:A.default,danger:A.danger,warning:A.warning}),ir="starasia-toast-styles";(l=>{if(!document.getElementById(ir)){const a=document.createElement("style");a.id=ir,a.textContent=l,document.head.appendChild(a)}})(Fr);const Wr=({type:l="outline",direction:a="bottom-right"})=>{const[b,y]=w.useState([]);return w.useEffect(()=>A.subscribe(p=>{if(p.dismiss){y(_=>_.filter(C=>C.id!==p.id));return}setTimeout(()=>{Pr.flushSync(()=>{y(_=>[p,..._])})})}),[]),v.jsx("div",{className:`starasia-toast-container starasia-toast-container-${a}`,children:b.map(p=>v.jsx(Yr,{data:p,type:l,direction:a},p.id))})},Yr=({data:l,type:a="solid",direction:b})=>{const[y,p]=w.useState(null),[_,C]=w.useState(!1),E=w.useRef(null),d=()=>{const T=setTimeout(()=>{g()},5e3);p(T)},S=()=>{y&&(clearTimeout(y),p(null))},g=()=>{A.dismiss(l.id)};w.useEffect(()=>(_?S():d(),()=>{S()}),[_]),w.useEffect(()=>{const T=E.current,N=()=>{g()};return T&&T.addEventListener("animationend",N),()=>{T&&T.removeEventListener("animationend",N)}},[]);const x=()=>{C(!0),S(),E.current&&(E.current.style.animationPlayState="paused")},P=()=>{C(!1),d(),E.current&&(E.current.style.animationPlayState="running")};return v.jsxs("div",{className:`starasia-toast-item-container starasia-toast-item-container-${a}-${l.type} starasia-toast-item-container-animation-${b}`,onMouseEnter:x,onMouseLeave:P,children:[v.jsx("div",{style:{display:"flex"},children:l.type==="success"?v.jsx(Ur,{style:{color:"inherit"}}):v.jsx(Nr,{style:{color:"inherit"}})}),v.jsx("div",{style:{flex:1},children:l.title}),v.jsx("div",{style:{display:"flex",cursor:"pointer"},onClick:()=>A.dismiss(l.id),children:v.jsx(Br,{style:{color:"inherit"}})}),a==="outline"?v.jsx("div",{ref:E,className:`starasia-toast-item-progress starasia-toast-item-progress-outline-${l.type}`,style:{animation:"progressBarr 5s linear forwards",animationPlayState:_?"paused":"running"}}):null]})},Nr=l=>v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",...l,children:v.jsx("path",{d:"M12 7.01001V7.00002M12 17L12 10M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",cursor:"pointer"})}),Ur=l=>v.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...l,children:v.jsx("g",{id:"Curved/Basic-actions-and-state",children:v.jsx("path",{id:"shape",d:"M14.1667 7.5L8.33332 13.3333L5.83328 10.8333M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),Br=l=>v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",...l,children:v.jsx("path",{d:"M19 5L5 19M5.00003 5L19 19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});O.ToastContainer=Wr,O.toast=Mr,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
300
+ `;let k=1;class w{constructor(){this.subscribe=n=>(this.subscribers.push(n),()=>{const r=this.subscribers.indexOf(n);this.subscribers.splice(r,1)}),this.publish=n=>{this.subscribers.forEach(r=>r(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n]},this.create=n=>{const{message:r,type:c}=n,s=k++;return this.addToast({title:r,type:c,id:s}),s},this.dismiss=n=>(this.subscribers.forEach(r=>r({id:n,dismiss:!0})),n),this.danger=n=>this.create({message:n,type:"danger"}),this.warning=n=>this.create({message:n,type:"warning"}),this.success=n=>this.create({type:"success",message:n}),this.info=n=>this.create({type:"info",message:n}),this.default=n=>this.create({type:"default",message:n}),this.subscribers=[],this.toasts=[]}}const i=new w,x=Object.assign({success:i.success,info:i.info,default:i.default,danger:i.danger,warning:i.warning}),m="starasia-toast-styles";(t=>{if(!document.getElementById(m)){const n=document.createElement("style");n.id=m,n.textContent=t,document.head.appendChild(n)}})(y);const C=({type:t="outline",direction:n="bottom-right"})=>{const[r,c]=e.useState([]);return e.useEffect(()=>i.subscribe(s=>{if(s.dismiss){c(l=>l.filter(f=>f.id!==s.id));return}setTimeout(()=>{v.flushSync(()=>{c(l=>[s,...l])})})}),[]),a.jsx("div",{className:`starasia-toast-container starasia-toast-container-${n}`,children:r.map(s=>a.jsx(T,{data:s,type:t,direction:n},s.id))})},T=({data:t,type:n="solid",direction:r})=>{const[c,s]=e.useState(null),[l,f]=e.useState(!1),u=e.useRef(null),p=()=>{const d=setTimeout(()=>{b()},5e3);s(d)},g=()=>{c&&(clearTimeout(c),s(null))},b=()=>{i.dismiss(t.id)};e.useEffect(()=>(l?g():p(),()=>{g()}),[l]),e.useEffect(()=>{const d=u.current,h=()=>{b()};return d&&d.addEventListener("animationend",h),()=>{d&&d.removeEventListener("animationend",h)}},[]);const M=()=>{f(!0),g(),u.current&&(u.current.style.animationPlayState="paused")},j=()=>{f(!1),p(),u.current&&(u.current.style.animationPlayState="running")};return a.jsxs("div",{className:`starasia-toast-item-container starasia-toast-item-container-${n}-${t.type} starasia-toast-item-container-animation-${r}`,onMouseEnter:M,onMouseLeave:j,children:[a.jsx("div",{style:{display:"flex"},children:t.type==="success"?a.jsx(E,{style:{color:"inherit"}}):a.jsx(L,{style:{color:"inherit"}})}),a.jsx("div",{style:{flex:1},children:t.title}),a.jsx("div",{style:{display:"flex",cursor:"pointer"},onClick:()=>i.dismiss(t.id),children:a.jsx(S,{style:{color:"inherit"}})}),n==="outline"?a.jsx("div",{ref:u,className:`starasia-toast-item-progress starasia-toast-item-progress-outline-${t.type}`,style:{animation:"progressBarr 5s linear forwards",animationPlayState:l?"paused":"running"}}):null]})},L=t=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",...t,children:a.jsx("path",{d:"M12 7.01001V7.00002M12 17L12 10M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",cursor:"pointer"})}),E=t=>a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:a.jsx("g",{id:"Curved/Basic-actions-and-state",children:a.jsx("path",{id:"shape",d:"M14.1667 7.5L8.33332 13.3333L5.83328 10.8333M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),S=t=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",...t,children:a.jsx("path",{d:"M19 5L5 19M5.00003 5L19 19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});o.ToastContainer=C,o.toast=x,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starasia/toast",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "toast component for starasia UI",
5
5
  "author": "Prawito Hudoro",
6
6
  "main": "dist/toast.umd.js",
@@ -12,16 +12,16 @@
12
12
  "dist/*.map",
13
13
  "dist/*.css"
14
14
  ],
15
- "scripts": {
16
- "dev": "vite --config vite.config.ts --port 3000",
17
- "build": "vite build --config vite.config.ts"
18
- },
19
15
  "keywords": [],
20
16
  "license": "ISC",
21
17
  "type": "module",
22
18
  "engines": {
23
19
  "node": ">=18.0.0"
24
20
  },
21
+ "peerDependencies": {
22
+ "react": ">=18.0.0 <20.0.0",
23
+ "react-dom": ">=18.0.0 <20.0.0"
24
+ },
25
25
  "devDependencies": {
26
26
  "@types/node": "^20.11.16",
27
27
  "@vitejs/plugin-react": "^4.2.1",
@@ -33,5 +33,9 @@
33
33
  "react-dom": "^18.2.0",
34
34
  "@types/react": "^18.2.55",
35
35
  "@types/react-dom": "^18.2.19"
36
+ },
37
+ "scripts": {
38
+ "dev": "vite --config vite.config.ts --port 3000",
39
+ "build": "vite build --config vite.config.ts"
36
40
  }
37
- }
41
+ }