@koide-labs/ui 0.0.14 → 0.0.15
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/components/toast/toast.js +202 -202
- package/dist/toast.css +1 -1
- package/package.json +16 -19
|
@@ -9,7 +9,7 @@ import { View as Pe } from "../view/index.js";
|
|
|
9
9
|
import { T as ft, a as be, u as dt } from "../../use-toast-manager-Dq-44AuW.js";
|
|
10
10
|
import * as e from "react";
|
|
11
11
|
import { o as ne } from "../../owner-rKN292Q9.js";
|
|
12
|
-
import { u as
|
|
12
|
+
import { u as W } from "../../useStableCallback-CkTrVkNX.js";
|
|
13
13
|
import { T as Oe } from "../../useTimeout-CflX-kz3.js";
|
|
14
14
|
import { h as pe, f as re, m as Ee, e as Re } from "../../element-CZEOj04G.js";
|
|
15
15
|
import { F as pt } from "../../FloatingPortalLite-DVyq6YhV.js";
|
|
@@ -20,9 +20,9 @@ import { d as Ce } from "../../floating-ui.utils.dom-C7FS5id0.js";
|
|
|
20
20
|
import * as ht from "react-dom";
|
|
21
21
|
import { i as gt } from "../../inertValue-BCYGsdmf.js";
|
|
22
22
|
import { u as me } from "../../useIsoLayoutEffect-CIDbvm3Q.js";
|
|
23
|
-
import { f as
|
|
24
|
-
import { a as
|
|
25
|
-
import { u as
|
|
23
|
+
import { f as _t } from "../../formatErrorMessage-BqPuTBN-.js";
|
|
24
|
+
import { a as vt, t as wt } from "../../useOpenChangeComplete-Dse9kY9E.js";
|
|
25
|
+
import { u as Le } from "../../useId-C5kyn6tA.js";
|
|
26
26
|
import { u as yt } from "../../useButton-DfIwsdb8.js";
|
|
27
27
|
import '../../toast.css';let Fe = 0;
|
|
28
28
|
function xt(f) {
|
|
@@ -41,62 +41,62 @@ function De(f, d) {
|
|
|
41
41
|
}
|
|
42
42
|
return f;
|
|
43
43
|
}
|
|
44
|
-
const
|
|
44
|
+
const He = function(d) {
|
|
45
45
|
const {
|
|
46
46
|
children: h,
|
|
47
47
|
timeout: s = 5e3,
|
|
48
48
|
limit: F = 3,
|
|
49
49
|
toastManager: M
|
|
50
|
-
} = d, [y, a] = e.useState([]), [g, t] = e.useState(!1), [l,
|
|
51
|
-
y.length === 0 && (g && t(!1), l &&
|
|
52
|
-
const b = g || l, N = e.useRef(/* @__PURE__ */ new Map()),
|
|
53
|
-
function
|
|
54
|
-
const m = pe(ne(
|
|
55
|
-
if (!
|
|
50
|
+
} = d, [y, a] = e.useState([]), [g, t] = e.useState(!1), [l, v] = e.useState(!1), [o, R] = e.useState(null);
|
|
51
|
+
y.length === 0 && (g && t(!1), l && v(!1));
|
|
52
|
+
const b = g || l, N = e.useRef(/* @__PURE__ */ new Map()), A = e.useRef(null), C = e.useRef(!0), Y = e.useRef(!1);
|
|
53
|
+
function K(n) {
|
|
54
|
+
const m = pe(ne(A.current));
|
|
55
|
+
if (!A.current || !re(A.current, m) || !Ee(m))
|
|
56
56
|
return;
|
|
57
57
|
const w = y.findIndex((r) => r.id === n);
|
|
58
|
-
let i = null,
|
|
59
|
-
for (;
|
|
60
|
-
if (y[
|
|
61
|
-
i = y[
|
|
58
|
+
let i = null, _ = w + 1;
|
|
59
|
+
for (; _ < y.length; ) {
|
|
60
|
+
if (y[_].transitionStatus !== "ending") {
|
|
61
|
+
i = y[_];
|
|
62
62
|
break;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
_ += 1;
|
|
65
65
|
}
|
|
66
66
|
if (!i)
|
|
67
|
-
for (
|
|
68
|
-
if (y[
|
|
69
|
-
i = y[
|
|
67
|
+
for (_ = w - 1; _ >= 0; ) {
|
|
68
|
+
if (y[_].transitionStatus !== "ending") {
|
|
69
|
+
i = y[_];
|
|
70
70
|
break;
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
_ -= 1;
|
|
73
73
|
}
|
|
74
74
|
i ? i.ref?.current?.focus() : o?.focus({
|
|
75
75
|
preventScroll: !0
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
const D =
|
|
79
|
-
|
|
78
|
+
const D = W(() => {
|
|
79
|
+
Y.current || (Y.current = !0, N.current.forEach((n) => {
|
|
80
80
|
if (n.timeout) {
|
|
81
81
|
n.timeout.clear();
|
|
82
82
|
const m = Date.now() - n.start, w = n.delay - m;
|
|
83
83
|
n.remaining = w > 0 ? w : 0;
|
|
84
84
|
}
|
|
85
85
|
}));
|
|
86
|
-
}),
|
|
87
|
-
|
|
86
|
+
}), k = W(() => {
|
|
87
|
+
Y.current && (Y.current = !1, N.current.forEach((n, m) => {
|
|
88
88
|
n.remaining = n.remaining > 0 ? n.remaining : n.delay, n.timeout ??= Oe.create(), n.timeout.start(n.remaining, () => {
|
|
89
89
|
N.current.delete(m), n.callback();
|
|
90
90
|
}), n.start = Date.now();
|
|
91
91
|
}));
|
|
92
|
-
}),
|
|
92
|
+
}), I = W((n) => {
|
|
93
93
|
a((i) => {
|
|
94
|
-
const
|
|
94
|
+
const _ = i.map((p) => p.id === n ? {
|
|
95
95
|
...p,
|
|
96
96
|
transitionStatus: "ending",
|
|
97
97
|
height: 0
|
|
98
|
-
} : p), r =
|
|
99
|
-
return
|
|
98
|
+
} : p), r = _.filter((p) => p.transitionStatus !== "ending");
|
|
99
|
+
return _.map((p) => {
|
|
100
100
|
if (p.transitionStatus === "ending")
|
|
101
101
|
return p;
|
|
102
102
|
const x = r.indexOf(p) >= F;
|
|
@@ -107,35 +107,35 @@ const ke = function(d) {
|
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
const m = N.current.get(n);
|
|
110
|
-
m && m.timeout && (m.timeout.clear(), N.current.delete(n)), y.find((i) => i.id === n)?.onClose?.(),
|
|
111
|
-
}),
|
|
110
|
+
m && m.timeout && (m.timeout.clear(), N.current.delete(n)), y.find((i) => i.id === n)?.onClose?.(), K(n), y.length === 1 && (t(!1), v(!1));
|
|
111
|
+
}), U = W((n) => {
|
|
112
112
|
a((w) => w.filter((i) => i.id !== n)), y.find((w) => w.id === n)?.onRemove?.();
|
|
113
|
-
}),
|
|
114
|
-
const i = Date.now(),
|
|
113
|
+
}), $ = W((n, m, w) => {
|
|
114
|
+
const i = Date.now(), _ = C.current && !g && !l, r = _ ? Oe.create() : void 0;
|
|
115
115
|
r?.start(m, () => {
|
|
116
116
|
N.current.delete(n), w();
|
|
117
117
|
}), N.current.set(n, {
|
|
118
118
|
timeout: r,
|
|
119
|
-
start:
|
|
119
|
+
start: _ ? i : 0,
|
|
120
120
|
delay: m,
|
|
121
121
|
remaining: m,
|
|
122
122
|
callback: w
|
|
123
123
|
});
|
|
124
|
-
}),
|
|
124
|
+
}), z = W((n) => {
|
|
125
125
|
const m = n.id || xt("toast"), w = {
|
|
126
126
|
...n,
|
|
127
127
|
id: m,
|
|
128
128
|
transitionStatus: "starting"
|
|
129
129
|
};
|
|
130
|
-
a((
|
|
131
|
-
const r = [w, ...
|
|
130
|
+
a((_) => {
|
|
131
|
+
const r = [w, ..._], p = r.filter((x) => x.transitionStatus !== "ending");
|
|
132
132
|
if (p.length > F) {
|
|
133
133
|
const x = p.length - F, T = p.slice(-x);
|
|
134
|
-
return r.map((
|
|
135
|
-
...
|
|
134
|
+
return r.map((L) => T.some((Z) => Z.id === L.id) ? {
|
|
135
|
+
...L,
|
|
136
136
|
limited: !0
|
|
137
137
|
} : {
|
|
138
|
-
...
|
|
138
|
+
...L,
|
|
139
139
|
limited: !1
|
|
140
140
|
});
|
|
141
141
|
}
|
|
@@ -145,77 +145,77 @@ const ke = function(d) {
|
|
|
145
145
|
}));
|
|
146
146
|
});
|
|
147
147
|
const i = w.timeout ?? s;
|
|
148
|
-
return w.type !== "loading" && i > 0 &&
|
|
149
|
-
}),
|
|
148
|
+
return w.type !== "loading" && i > 0 && $(m, i, () => I(m)), (g || l || !C.current) && D(), m;
|
|
149
|
+
}), X = W((n, m) => {
|
|
150
150
|
a((w) => w.map((i) => i.id === n ? {
|
|
151
151
|
...i,
|
|
152
152
|
...m
|
|
153
153
|
} : i));
|
|
154
|
-
}), O =
|
|
155
|
-
const w = De(m.loading), i =
|
|
154
|
+
}), O = W((n, m) => {
|
|
155
|
+
const w = De(m.loading), i = z({
|
|
156
156
|
...w,
|
|
157
157
|
type: "loading"
|
|
158
|
-
}),
|
|
158
|
+
}), _ = n.then((r) => {
|
|
159
159
|
const p = De(m.success, r);
|
|
160
|
-
|
|
160
|
+
X(i, {
|
|
161
161
|
...p,
|
|
162
162
|
type: "success"
|
|
163
163
|
});
|
|
164
164
|
const x = p.timeout ?? s;
|
|
165
|
-
return x > 0 &&
|
|
165
|
+
return x > 0 && $(i, x, () => I(i)), (g || l || !C.current) && D(), r;
|
|
166
166
|
}).catch((r) => {
|
|
167
167
|
const p = De(m.error, r);
|
|
168
|
-
|
|
168
|
+
X(i, {
|
|
169
169
|
...p,
|
|
170
170
|
type: "error"
|
|
171
171
|
});
|
|
172
172
|
const x = p.timeout ?? s;
|
|
173
|
-
return x > 0 &&
|
|
173
|
+
return x > 0 && $(i, x, () => I(i)), (g || l || !C.current) && D(), Promise.reject(r);
|
|
174
174
|
});
|
|
175
|
-
return {}.hasOwnProperty.call(m, "setPromise") && m.setPromise(
|
|
175
|
+
return {}.hasOwnProperty.call(m, "setPromise") && m.setPromise(_), _;
|
|
176
176
|
});
|
|
177
177
|
e.useEffect(function() {
|
|
178
178
|
return M ? M[" subscribe"](({
|
|
179
179
|
action: w,
|
|
180
180
|
options: i
|
|
181
181
|
}) => {
|
|
182
|
-
const
|
|
183
|
-
w === "promise" && i.promise ? O(i.promise, i) : w === "update" &&
|
|
182
|
+
const _ = i.id;
|
|
183
|
+
w === "promise" && i.promise ? O(i.promise, i) : w === "update" && _ ? X(_, i) : w === "close" && _ ? I(_) : z(i);
|
|
184
184
|
}) : void 0;
|
|
185
|
-
}, [
|
|
185
|
+
}, [z, X, $, s, M, O, I]);
|
|
186
186
|
const J = e.useMemo(() => ({
|
|
187
187
|
toasts: y,
|
|
188
188
|
setToasts: a,
|
|
189
189
|
hovering: g,
|
|
190
190
|
setHovering: t,
|
|
191
191
|
focused: l,
|
|
192
|
-
setFocused:
|
|
192
|
+
setFocused: v,
|
|
193
193
|
expanded: b,
|
|
194
|
-
add:
|
|
195
|
-
close:
|
|
196
|
-
remove:
|
|
197
|
-
update:
|
|
194
|
+
add: z,
|
|
195
|
+
close: I,
|
|
196
|
+
remove: U,
|
|
197
|
+
update: X,
|
|
198
198
|
promise: O,
|
|
199
199
|
pauseTimers: D,
|
|
200
|
-
resumeTimers:
|
|
200
|
+
resumeTimers: k,
|
|
201
201
|
prevFocusElement: o,
|
|
202
202
|
setPrevFocusElement: R,
|
|
203
|
-
viewportRef:
|
|
204
|
-
scheduleTimer:
|
|
203
|
+
viewportRef: A,
|
|
204
|
+
scheduleTimer: $,
|
|
205
205
|
windowFocusedRef: C
|
|
206
|
-
}), [
|
|
206
|
+
}), [z, I, l, g, b, D, o, O, U, k, $, y, X]);
|
|
207
207
|
return /* @__PURE__ */ E(ft.Provider, {
|
|
208
208
|
value: J,
|
|
209
209
|
children: h
|
|
210
210
|
});
|
|
211
211
|
};
|
|
212
|
-
process.env.NODE_ENV !== "production" && (
|
|
213
|
-
const
|
|
214
|
-
process.env.NODE_ENV !== "production" && (
|
|
212
|
+
process.env.NODE_ENV !== "production" && (He.displayName = "ToastProvider");
|
|
213
|
+
const Ve = /* @__PURE__ */ e.createContext(void 0);
|
|
214
|
+
process.env.NODE_ENV !== "production" && (Ve.displayName = "ToastViewportContext");
|
|
215
215
|
let Tt = /* @__PURE__ */ (function(f) {
|
|
216
216
|
return f.frontmostHeight = "--toast-frontmost-height", f;
|
|
217
217
|
})({});
|
|
218
|
-
const
|
|
218
|
+
const $e = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
219
219
|
const {
|
|
220
220
|
render: s,
|
|
221
221
|
className: F,
|
|
@@ -226,27 +226,27 @@ const Ve = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
226
226
|
pauseTimers: g,
|
|
227
227
|
resumeTimers: t,
|
|
228
228
|
setHovering: l,
|
|
229
|
-
setFocused:
|
|
229
|
+
setFocused: v,
|
|
230
230
|
viewportRef: o,
|
|
231
231
|
windowFocusedRef: R,
|
|
232
232
|
prevFocusElement: b,
|
|
233
233
|
setPrevFocusElement: N,
|
|
234
|
-
expanded:
|
|
234
|
+
expanded: A,
|
|
235
235
|
focused: C
|
|
236
|
-
} = be(),
|
|
236
|
+
} = be(), Y = e.useRef(!1), K = e.useRef(!1), D = a.length, k = a[0]?.height ?? 0, I = e.useMemo(() => a.some((r) => r.transitionStatus === "ending"), [a]);
|
|
237
237
|
e.useEffect(() => {
|
|
238
238
|
if (!o.current)
|
|
239
239
|
return;
|
|
240
240
|
function r(x) {
|
|
241
241
|
D !== 0 && x.key === "F6" && x.target !== o.current && (x.preventDefault(), N(pe(ne(o.current))), o.current?.focus({
|
|
242
242
|
preventScroll: !0
|
|
243
|
-
}), g(),
|
|
243
|
+
}), g(), v(!0));
|
|
244
244
|
}
|
|
245
245
|
const p = Ce(o.current);
|
|
246
246
|
return p.addEventListener("keydown", r), () => {
|
|
247
247
|
p.removeEventListener("keydown", r);
|
|
248
248
|
};
|
|
249
|
-
}, [g,
|
|
249
|
+
}, [g, v, N, D, o]), e.useEffect(() => {
|
|
250
250
|
if (!o.current || !D)
|
|
251
251
|
return;
|
|
252
252
|
const r = Ce(o.current);
|
|
@@ -256,8 +256,8 @@ const Ve = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
256
256
|
function x(T) {
|
|
257
257
|
if (T.relatedTarget || T.target === r)
|
|
258
258
|
return;
|
|
259
|
-
const
|
|
260
|
-
(!re(o.current,
|
|
259
|
+
const L = Re(T), Z = pe(ne(o.current));
|
|
260
|
+
(!re(o.current, L) || !Ee(Z)) && t(), setTimeout(() => {
|
|
261
261
|
R.current = !0;
|
|
262
262
|
});
|
|
263
263
|
}
|
|
@@ -269,7 +269,7 @@ const Ve = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
269
269
|
t,
|
|
270
270
|
o,
|
|
271
271
|
R,
|
|
272
|
-
|
|
272
|
+
v,
|
|
273
273
|
// `viewportRef.current` isn't available on the first render,
|
|
274
274
|
// since the portal node hasn't yet been created.
|
|
275
275
|
// By adding this dependency, we ensure the window listeners
|
|
@@ -283,41 +283,41 @@ const Ve = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
283
283
|
function x(T) {
|
|
284
284
|
if (T.pointerType !== "touch")
|
|
285
285
|
return;
|
|
286
|
-
const
|
|
287
|
-
re(r,
|
|
286
|
+
const L = Re(T);
|
|
287
|
+
re(r, L) || (t(), l(!1), v(!1));
|
|
288
288
|
}
|
|
289
289
|
return p.addEventListener("pointerdown", x, !0), () => {
|
|
290
290
|
p.removeEventListener("pointerdown", x, !0);
|
|
291
291
|
};
|
|
292
|
-
}, [D, t,
|
|
293
|
-
function
|
|
294
|
-
o.current && (
|
|
292
|
+
}, [D, t, v, l, o]);
|
|
293
|
+
function U(r) {
|
|
294
|
+
o.current && (Y.current = !0, r.relatedTarget === o.current ? a[0]?.ref?.current?.focus() : b?.focus({
|
|
295
295
|
preventScroll: !0
|
|
296
296
|
}));
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function $(r) {
|
|
299
299
|
r.key === "Tab" && r.shiftKey && r.target === o.current && (r.preventDefault(), b?.focus({
|
|
300
300
|
preventScroll: !0
|
|
301
301
|
}), t());
|
|
302
302
|
}
|
|
303
303
|
e.useEffect(() => {
|
|
304
|
-
!R.current ||
|
|
305
|
-
}, [
|
|
306
|
-
function
|
|
307
|
-
g(), l(!0),
|
|
304
|
+
!R.current || I || !K.current || (t(), l(!1), K.current = !1);
|
|
305
|
+
}, [I, t, l, R]);
|
|
306
|
+
function z() {
|
|
307
|
+
g(), l(!0), K.current = !1;
|
|
308
308
|
}
|
|
309
|
-
function
|
|
310
|
-
a.some((r) => r.transitionStatus === "ending") ?
|
|
309
|
+
function X() {
|
|
310
|
+
a.some((r) => r.transitionStatus === "ending") ? K.current = !0 : (t(), l(!1));
|
|
311
311
|
}
|
|
312
312
|
function O() {
|
|
313
|
-
if (
|
|
314
|
-
|
|
313
|
+
if (Y.current) {
|
|
314
|
+
Y.current = !1;
|
|
315
315
|
return;
|
|
316
316
|
}
|
|
317
|
-
C || Ee(ne(o.current).activeElement) && (
|
|
317
|
+
C || Ee(ne(o.current).activeElement) && (v(!0), g());
|
|
318
318
|
}
|
|
319
319
|
function J(r) {
|
|
320
|
-
!C || re(o.current, r.relatedTarget) || (
|
|
320
|
+
!C || re(o.current, r.relatedTarget) || (v(!1), t());
|
|
321
321
|
}
|
|
322
322
|
const n = {
|
|
323
323
|
tabIndex: -1,
|
|
@@ -326,41 +326,41 @@ const Ve = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
326
326
|
"aria-atomic": !1,
|
|
327
327
|
"aria-relevant": "additions text",
|
|
328
328
|
"aria-label": "Notifications",
|
|
329
|
-
onMouseEnter:
|
|
330
|
-
onMouseMove:
|
|
331
|
-
onMouseLeave:
|
|
329
|
+
onMouseEnter: z,
|
|
330
|
+
onMouseMove: z,
|
|
331
|
+
onMouseLeave: X,
|
|
332
332
|
onFocus: O,
|
|
333
333
|
onBlur: J,
|
|
334
|
-
onKeyDown:
|
|
334
|
+
onKeyDown: $,
|
|
335
335
|
onClick: O
|
|
336
336
|
}, m = e.useMemo(() => ({
|
|
337
|
-
expanded:
|
|
338
|
-
}), [
|
|
337
|
+
expanded: A
|
|
338
|
+
}), [A]), w = oe("div", d, {
|
|
339
339
|
ref: [h, o],
|
|
340
340
|
state: m,
|
|
341
341
|
props: [n, {
|
|
342
342
|
style: {
|
|
343
|
-
[Tt.frontmostHeight]:
|
|
343
|
+
[Tt.frontmostHeight]: k ? `${k}px` : void 0
|
|
344
344
|
}
|
|
345
345
|
}, y, {
|
|
346
346
|
children: /* @__PURE__ */ ae(e.Fragment, {
|
|
347
347
|
children: [D > 0 && b && /* @__PURE__ */ E(Te, {
|
|
348
|
-
onFocus:
|
|
348
|
+
onFocus: U
|
|
349
349
|
}), M, D > 0 && b && /* @__PURE__ */ E(Te, {
|
|
350
|
-
onFocus:
|
|
350
|
+
onFocus: U
|
|
351
351
|
})]
|
|
352
352
|
})
|
|
353
353
|
}]
|
|
354
354
|
}), i = e.useMemo(() => ({
|
|
355
355
|
viewportRef: o
|
|
356
|
-
}), [o]),
|
|
357
|
-
return /* @__PURE__ */ ae(
|
|
356
|
+
}), [o]), _ = e.useMemo(() => a.filter((r) => r.priority === "high"), [a]);
|
|
357
|
+
return /* @__PURE__ */ ae(Ve.Provider, {
|
|
358
358
|
value: i,
|
|
359
359
|
children: [D > 0 && b && /* @__PURE__ */ E(Te, {
|
|
360
|
-
onFocus:
|
|
361
|
-
}), w, !C &&
|
|
360
|
+
onFocus: U
|
|
361
|
+
}), w, !C && _.length > 0 && /* @__PURE__ */ E("div", {
|
|
362
362
|
style: mt,
|
|
363
|
-
children:
|
|
363
|
+
children: _.map((r) => /* @__PURE__ */ ae("div", {
|
|
364
364
|
role: "alert",
|
|
365
365
|
"aria-atomic": !0,
|
|
366
366
|
children: [/* @__PURE__ */ E("div", {
|
|
@@ -372,13 +372,13 @@ const Ve = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
372
372
|
})]
|
|
373
373
|
});
|
|
374
374
|
});
|
|
375
|
-
process.env.NODE_ENV !== "production" && (
|
|
375
|
+
process.env.NODE_ENV !== "production" && ($e.displayName = "ToastViewport");
|
|
376
376
|
const Se = /* @__PURE__ */ e.createContext(void 0);
|
|
377
377
|
process.env.NODE_ENV !== "production" && (Se.displayName = "ToastRootContext");
|
|
378
378
|
function se() {
|
|
379
379
|
const f = e.useContext(Se);
|
|
380
380
|
if (!f)
|
|
381
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>." :
|
|
381
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>." : _t(66));
|
|
382
382
|
return f;
|
|
383
383
|
}
|
|
384
384
|
let ee = /* @__PURE__ */ (function(f) {
|
|
@@ -392,7 +392,7 @@ const Dt = {
|
|
|
392
392
|
} : null;
|
|
393
393
|
}
|
|
394
394
|
}, ie = 40, Et = 10, Q = 0.5, Rt = 1;
|
|
395
|
-
function
|
|
395
|
+
function ke(f, d, h) {
|
|
396
396
|
switch (f) {
|
|
397
397
|
case "up":
|
|
398
398
|
return -h;
|
|
@@ -422,7 +422,7 @@ function bt(f) {
|
|
|
422
422
|
scale: M
|
|
423
423
|
};
|
|
424
424
|
}
|
|
425
|
-
const
|
|
425
|
+
const je = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
426
426
|
const {
|
|
427
427
|
toast: s,
|
|
428
428
|
render: F,
|
|
@@ -433,40 +433,40 @@ const $e = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
433
433
|
let t = [];
|
|
434
434
|
g || (t = Array.isArray(y) ? y : [y]);
|
|
435
435
|
const l = t.length > 0, {
|
|
436
|
-
toasts:
|
|
436
|
+
toasts: v,
|
|
437
437
|
focused: o,
|
|
438
438
|
close: R,
|
|
439
439
|
remove: b,
|
|
440
440
|
setToasts: N,
|
|
441
|
-
pauseTimers:
|
|
441
|
+
pauseTimers: A,
|
|
442
442
|
expanded: C,
|
|
443
|
-
setHovering:
|
|
444
|
-
} = be(), [
|
|
443
|
+
setHovering: Y
|
|
444
|
+
} = be(), [K, D] = e.useState(void 0), [k, I] = e.useState(!1), [U, $] = e.useState(!1), [z, X] = e.useState(!1), [O, J] = e.useState({
|
|
445
445
|
x: 0,
|
|
446
446
|
y: 0
|
|
447
447
|
}), [n, m] = e.useState({
|
|
448
448
|
x: 0,
|
|
449
449
|
y: 0,
|
|
450
450
|
scale: 1
|
|
451
|
-
}), [w, i] = e.useState(), [
|
|
451
|
+
}), [w, i] = e.useState(), [_, r] = e.useState(), [p, x] = e.useState(null), T = e.useRef(null), L = e.useRef({
|
|
452
452
|
x: 0,
|
|
453
453
|
y: 0
|
|
454
454
|
}), Z = e.useRef({
|
|
455
455
|
x: 0,
|
|
456
456
|
y: 0,
|
|
457
457
|
scale: 1
|
|
458
|
-
}), ce = e.useRef(void 0), he = e.useRef(0), ue = e.useRef(!1),
|
|
458
|
+
}), ce = e.useRef(void 0), he = e.useRef(0), ue = e.useRef(!1), j = e.useRef({
|
|
459
459
|
x: 0,
|
|
460
460
|
y: 0
|
|
461
|
-
}), ge = e.useRef(!1),
|
|
462
|
-
|
|
461
|
+
}), ge = e.useRef(!1), _e = e.useMemo(() => v.indexOf(s), [s, v]), ve = e.useMemo(() => v.filter((c) => c.transitionStatus !== "ending").indexOf(s), [s, v]), ze = e.useMemo(() => v.slice(0, v.indexOf(s)).reduce((c, u) => c + (u.height || 0), 0), [v, s]);
|
|
462
|
+
vt({
|
|
463
463
|
open: s.transitionStatus !== "ending",
|
|
464
464
|
ref: T,
|
|
465
465
|
onComplete() {
|
|
466
466
|
s.transitionStatus === "ending" && b(s.id);
|
|
467
467
|
}
|
|
468
468
|
});
|
|
469
|
-
const le =
|
|
469
|
+
const le = W((c = !1) => {
|
|
470
470
|
const u = T.current;
|
|
471
471
|
if (!u)
|
|
472
472
|
return;
|
|
@@ -475,46 +475,46 @@ const $e = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
475
475
|
const P = u.offsetHeight;
|
|
476
476
|
u.style.height = S;
|
|
477
477
|
function B() {
|
|
478
|
-
N((
|
|
479
|
-
...
|
|
478
|
+
N((H) => H.map((V) => V.id === s.id ? {
|
|
479
|
+
...V,
|
|
480
480
|
ref: T,
|
|
481
481
|
height: P,
|
|
482
482
|
transitionStatus: void 0
|
|
483
|
-
} :
|
|
483
|
+
} : V));
|
|
484
484
|
}
|
|
485
485
|
c ? ht.flushSync(B) : B();
|
|
486
486
|
});
|
|
487
487
|
me(le, [le]);
|
|
488
|
-
function
|
|
488
|
+
function Xe(c, u) {
|
|
489
489
|
let S = c, P = u;
|
|
490
490
|
return !t.includes("left") && !t.includes("right") ? S = c > 0 ? c ** Q : -(Math.abs(c) ** Q) : (!t.includes("right") && c > 0 && (S = c ** Q), !t.includes("left") && c < 0 && (S = -(Math.abs(c) ** Q))), !t.includes("up") && !t.includes("down") ? P = u > 0 ? u ** Q : -(Math.abs(u) ** Q) : (!t.includes("down") && u > 0 && (P = u ** Q), !t.includes("up") && u < 0 && (P = -(Math.abs(u) ** Q))), {
|
|
491
491
|
x: S,
|
|
492
492
|
y: P
|
|
493
493
|
};
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function Ge(c) {
|
|
496
496
|
if (c.button !== 0)
|
|
497
497
|
return;
|
|
498
|
-
c.pointerType === "touch" &&
|
|
498
|
+
c.pointerType === "touch" && A();
|
|
499
499
|
const u = Re(c.nativeEvent);
|
|
500
500
|
if (!(u && u.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))) {
|
|
501
|
-
if (ue.current = !1, ce.current = void 0, he.current = 0,
|
|
501
|
+
if (ue.current = !1, ce.current = void 0, he.current = 0, L.current = {
|
|
502
502
|
x: c.clientX,
|
|
503
503
|
y: c.clientY
|
|
504
|
-
},
|
|
504
|
+
}, j.current = L.current, T.current) {
|
|
505
505
|
const P = bt(T.current);
|
|
506
506
|
Z.current = P, m(P), J({
|
|
507
507
|
x: P.x,
|
|
508
508
|
y: P.y
|
|
509
509
|
});
|
|
510
510
|
}
|
|
511
|
-
|
|
511
|
+
Y(!0), I(!0), $(!1), x(null), ge.current = !0, T.current?.setPointerCapture(c.pointerId);
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
|
-
function
|
|
515
|
-
if (!
|
|
514
|
+
function Ke(c) {
|
|
515
|
+
if (!k)
|
|
516
516
|
return;
|
|
517
|
-
c.preventDefault(), ge.current && (
|
|
517
|
+
c.preventDefault(), ge.current && (L.current = {
|
|
518
518
|
x: c.clientX,
|
|
519
519
|
y: c.clientY
|
|
520
520
|
}, ge.current = !1);
|
|
@@ -524,39 +524,39 @@ const $e = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
524
524
|
movementX: P,
|
|
525
525
|
movementY: B
|
|
526
526
|
} = c;
|
|
527
|
-
(B < 0 && u >
|
|
528
|
-
x:
|
|
527
|
+
(B < 0 && u > j.current.y || B > 0 && u < j.current.y) && (j.current = {
|
|
528
|
+
x: j.current.x,
|
|
529
529
|
y: u
|
|
530
|
-
}), (P < 0 && S >
|
|
530
|
+
}), (P < 0 && S > j.current.x || P > 0 && S < j.current.x) && (j.current = {
|
|
531
531
|
x: S,
|
|
532
|
-
y:
|
|
532
|
+
y: j.current.y
|
|
533
533
|
});
|
|
534
|
-
const
|
|
535
|
-
if (!
|
|
534
|
+
const H = S - L.current.x, V = u - L.current.y, tt = u - j.current.y, nt = S - j.current.x;
|
|
535
|
+
if (!U && Math.sqrt(H * H + V * V) >= Rt && ($(!0), p === null)) {
|
|
536
536
|
const de = t.includes("left") || t.includes("right"), rt = t.includes("up") || t.includes("down");
|
|
537
537
|
if (de && rt) {
|
|
538
|
-
const st = Math.abs(
|
|
538
|
+
const st = Math.abs(H), ot = Math.abs(V);
|
|
539
539
|
x(st > ot ? "horizontal" : "vertical");
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
|
-
let
|
|
542
|
+
let q;
|
|
543
543
|
if (!ce.current)
|
|
544
|
-
p === "vertical" ?
|
|
544
|
+
p === "vertical" ? V > 0 ? q = "down" : V < 0 && (q = "up") : p === "horizontal" ? H > 0 ? q = "right" : H < 0 && (q = "left") : Math.abs(H) >= Math.abs(V) ? q = H > 0 ? "right" : "left" : q = V > 0 ? "down" : "up", q && t.includes(q) && (ce.current = q, he.current = ke(q, H, V), D(q));
|
|
545
545
|
else {
|
|
546
|
-
const xe = ce.current, de =
|
|
546
|
+
const xe = ce.current, de = ke(xe, nt, tt);
|
|
547
547
|
de > ie ? (ue.current = !1, D(xe)) : !(t.includes("left") && t.includes("right")) && !(t.includes("up") && t.includes("down")) && he.current - de >= Et && (ue.current = !0);
|
|
548
548
|
}
|
|
549
|
-
const fe =
|
|
549
|
+
const fe = Xe(H, V);
|
|
550
550
|
let we = Z.current.x, ye = Z.current.y;
|
|
551
551
|
p === "horizontal" ? (t.includes("left") || t.includes("right")) && (we += fe.x) : (p === "vertical" || (t.includes("left") || t.includes("right")) && (we += fe.x), (t.includes("up") || t.includes("down")) && (ye += fe.y)), J({
|
|
552
552
|
x: we,
|
|
553
553
|
y: ye
|
|
554
554
|
});
|
|
555
555
|
}
|
|
556
|
-
function
|
|
557
|
-
if (!
|
|
556
|
+
function We(c) {
|
|
557
|
+
if (!k)
|
|
558
558
|
return;
|
|
559
|
-
if (
|
|
559
|
+
if (I(!1), $(!1), x(null), T.current?.releasePointerCapture(c.pointerId), ue.current) {
|
|
560
560
|
J({
|
|
561
561
|
x: n.x,
|
|
562
562
|
y: n.y
|
|
@@ -566,8 +566,8 @@ const $e = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
566
566
|
let u = !1;
|
|
567
567
|
const S = O.x - n.x, P = O.y - n.y;
|
|
568
568
|
let B;
|
|
569
|
-
for (const
|
|
570
|
-
switch (
|
|
569
|
+
for (const H of t) {
|
|
570
|
+
switch (H) {
|
|
571
571
|
case "right":
|
|
572
572
|
S > ie && (u = !0, B = "right");
|
|
573
573
|
break;
|
|
@@ -584,12 +584,12 @@ const $e = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
584
584
|
if (u)
|
|
585
585
|
break;
|
|
586
586
|
}
|
|
587
|
-
u ? (D(B),
|
|
587
|
+
u ? (D(B), X(!0), R(s.id)) : (J({
|
|
588
588
|
x: n.x,
|
|
589
589
|
y: n.y
|
|
590
590
|
}), D(void 0));
|
|
591
591
|
}
|
|
592
|
-
function
|
|
592
|
+
function Ue(c) {
|
|
593
593
|
if (c.key === "Escape") {
|
|
594
594
|
if (!T.current || !re(T.current, pe(ne(T.current))))
|
|
595
595
|
return;
|
|
@@ -612,17 +612,17 @@ const $e = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
612
612
|
};
|
|
613
613
|
}, [l]);
|
|
614
614
|
function Je() {
|
|
615
|
-
if (!
|
|
615
|
+
if (!k && O.x === n.x && O.y === n.y && !z)
|
|
616
616
|
return {
|
|
617
617
|
[ee.swipeMovementX]: "0px",
|
|
618
618
|
[ee.swipeMovementY]: "0px"
|
|
619
619
|
};
|
|
620
620
|
const c = O.x - n.x, u = O.y - n.y;
|
|
621
621
|
return {
|
|
622
|
-
transition:
|
|
622
|
+
transition: k ? "none" : void 0,
|
|
623
623
|
// While swiping, freeze the element at its current visual transform so it doesn't snap to the
|
|
624
624
|
// end position.
|
|
625
|
-
transform:
|
|
625
|
+
transform: k ? `translateX(${O.x}px) translateY(${O.y}px) scale(${n.scale})` : void 0,
|
|
626
626
|
[ee.swipeMovementX]: `${c}px`,
|
|
627
627
|
[ee.swipeMovementY]: `${u}px`
|
|
628
628
|
};
|
|
@@ -632,17 +632,17 @@ const $e = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
632
632
|
tabIndex: 0,
|
|
633
633
|
"aria-modal": !1,
|
|
634
634
|
"aria-labelledby": w,
|
|
635
|
-
"aria-describedby":
|
|
635
|
+
"aria-describedby": _,
|
|
636
636
|
"aria-hidden": Me && !o ? !0 : void 0,
|
|
637
|
-
onPointerDown: l ?
|
|
638
|
-
onPointerMove: l ?
|
|
639
|
-
onPointerUp: l ?
|
|
640
|
-
onKeyDown:
|
|
637
|
+
onPointerDown: l ? Ge : void 0,
|
|
638
|
+
onPointerMove: l ? Ke : void 0,
|
|
639
|
+
onPointerUp: l ? We : void 0,
|
|
640
|
+
onKeyDown: Ue,
|
|
641
641
|
inert: gt(s.limited),
|
|
642
642
|
style: {
|
|
643
643
|
...Je(),
|
|
644
|
-
[ee.index]: s.transitionStatus === "ending" ?
|
|
645
|
-
[ee.offsetY]: `${
|
|
644
|
+
[ee.index]: s.transitionStatus === "ending" ? _e : ve,
|
|
645
|
+
[ee.offsetY]: `${ze}px`,
|
|
646
646
|
[ee.height]: s.height ? `${s.height}px` : void 0
|
|
647
647
|
}
|
|
648
648
|
}, te = e.useMemo(() => ({
|
|
@@ -650,15 +650,15 @@ const $e = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
650
650
|
toast: s,
|
|
651
651
|
titleId: w,
|
|
652
652
|
setTitleId: i,
|
|
653
|
-
descriptionId:
|
|
653
|
+
descriptionId: _,
|
|
654
654
|
setDescriptionId: r,
|
|
655
|
-
swiping:
|
|
656
|
-
swipeDirection:
|
|
655
|
+
swiping: k,
|
|
656
|
+
swipeDirection: K,
|
|
657
657
|
recalculateHeight: le,
|
|
658
|
-
index:
|
|
659
|
-
visibleIndex:
|
|
658
|
+
index: _e,
|
|
659
|
+
visibleIndex: ve,
|
|
660
660
|
expanded: C
|
|
661
|
-
}), [s, w,
|
|
661
|
+
}), [s, w, _, k, K, le, _e, ve, C]), Ze = e.useMemo(() => ({
|
|
662
662
|
transitionStatus: s.transitionStatus,
|
|
663
663
|
expanded: C,
|
|
664
664
|
limited: s.limited || !1,
|
|
@@ -676,7 +676,7 @@ const $e = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
676
676
|
children: et
|
|
677
677
|
});
|
|
678
678
|
});
|
|
679
|
-
process.env.NODE_ENV !== "production" && (
|
|
679
|
+
process.env.NODE_ENV !== "production" && (je.displayName = "ToastRoot");
|
|
680
680
|
const Be = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
681
681
|
const {
|
|
682
682
|
render: s,
|
|
@@ -700,18 +700,18 @@ const Be = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
700
700
|
b.disconnect(), N.disconnect();
|
|
701
701
|
};
|
|
702
702
|
}, [g]);
|
|
703
|
-
const l = y > 0,
|
|
703
|
+
const l = y > 0, v = e.useMemo(() => ({
|
|
704
704
|
expanded: a,
|
|
705
705
|
behind: l
|
|
706
706
|
}), [a, l]);
|
|
707
707
|
return oe("div", d, {
|
|
708
708
|
ref: [h, t],
|
|
709
|
-
state:
|
|
709
|
+
state: v,
|
|
710
710
|
props: M
|
|
711
711
|
});
|
|
712
712
|
});
|
|
713
713
|
process.env.NODE_ENV !== "production" && (Be.displayName = "ToastContent");
|
|
714
|
-
const
|
|
714
|
+
const qe = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
715
715
|
const {
|
|
716
716
|
render: s,
|
|
717
717
|
className: F,
|
|
@@ -720,15 +720,15 @@ const Ae = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
720
720
|
...a
|
|
721
721
|
} = d, {
|
|
722
722
|
toast: g
|
|
723
|
-
} = se(), t = y ?? g.description, l = !!t,
|
|
723
|
+
} = se(), t = y ?? g.description, l = !!t, v = Le(M), {
|
|
724
724
|
setDescriptionId: o
|
|
725
725
|
} = se();
|
|
726
726
|
me(() => {
|
|
727
727
|
if (l)
|
|
728
|
-
return o(
|
|
728
|
+
return o(v), () => {
|
|
729
729
|
o(void 0);
|
|
730
730
|
};
|
|
731
|
-
}, [l,
|
|
731
|
+
}, [l, v, o]);
|
|
732
732
|
const R = e.useMemo(() => ({
|
|
733
733
|
type: g.type
|
|
734
734
|
}), [g.type]), b = oe("p", d, {
|
|
@@ -736,14 +736,14 @@ const Ae = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
736
736
|
state: R,
|
|
737
737
|
props: {
|
|
738
738
|
...a,
|
|
739
|
-
id:
|
|
739
|
+
id: v,
|
|
740
740
|
children: t
|
|
741
741
|
}
|
|
742
742
|
});
|
|
743
743
|
return l ? b : null;
|
|
744
744
|
});
|
|
745
|
-
process.env.NODE_ENV !== "production" && (
|
|
746
|
-
const
|
|
745
|
+
process.env.NODE_ENV !== "production" && (qe.displayName = "ToastDescription");
|
|
746
|
+
const Ae = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
747
747
|
const {
|
|
748
748
|
render: s,
|
|
749
749
|
className: F,
|
|
@@ -752,15 +752,15 @@ const Ye = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
752
752
|
...a
|
|
753
753
|
} = d, {
|
|
754
754
|
toast: g
|
|
755
|
-
} = se(), t = y ?? g.title, l = !!t,
|
|
755
|
+
} = se(), t = y ?? g.title, l = !!t, v = Le(M), {
|
|
756
756
|
setTitleId: o
|
|
757
757
|
} = se();
|
|
758
758
|
me(() => {
|
|
759
759
|
if (l)
|
|
760
|
-
return o(
|
|
760
|
+
return o(v), () => {
|
|
761
761
|
o(void 0);
|
|
762
762
|
};
|
|
763
|
-
}, [l,
|
|
763
|
+
}, [l, v, o]);
|
|
764
764
|
const R = e.useMemo(() => ({
|
|
765
765
|
type: g.type
|
|
766
766
|
}), [g.type]), b = oe("h2", d, {
|
|
@@ -768,14 +768,14 @@ const Ye = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
768
768
|
state: R,
|
|
769
769
|
props: {
|
|
770
770
|
...a,
|
|
771
|
-
id:
|
|
771
|
+
id: v,
|
|
772
772
|
children: t
|
|
773
773
|
}
|
|
774
774
|
});
|
|
775
775
|
return l ? b : null;
|
|
776
776
|
});
|
|
777
|
-
process.env.NODE_ENV !== "production" && (
|
|
778
|
-
const
|
|
777
|
+
process.env.NODE_ENV !== "production" && (Ae.displayName = "ToastTitle");
|
|
778
|
+
const Ye = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
779
779
|
const {
|
|
780
780
|
render: s,
|
|
781
781
|
className: F,
|
|
@@ -787,7 +787,7 @@ const Xe = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
787
787
|
expanded: t
|
|
788
788
|
} = be(), {
|
|
789
789
|
toast: l
|
|
790
|
-
} = se(), [
|
|
790
|
+
} = se(), [v, o] = e.useState(!1), {
|
|
791
791
|
getButtonProps: R,
|
|
792
792
|
buttonRef: b
|
|
793
793
|
} = yt({
|
|
@@ -800,7 +800,7 @@ const Xe = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
800
800
|
ref: [h, b],
|
|
801
801
|
state: N,
|
|
802
802
|
props: [{
|
|
803
|
-
"aria-hidden": !t && !
|
|
803
|
+
"aria-hidden": !t && !v,
|
|
804
804
|
onClick() {
|
|
805
805
|
g(l.id);
|
|
806
806
|
},
|
|
@@ -813,55 +813,55 @@ const Xe = /* @__PURE__ */ e.forwardRef(function(d, h) {
|
|
|
813
813
|
}, a, R]
|
|
814
814
|
});
|
|
815
815
|
});
|
|
816
|
-
process.env.NODE_ENV !== "production" && (
|
|
817
|
-
const St = pt, Mt = "
|
|
816
|
+
process.env.NODE_ENV !== "production" && (Ye.displayName = "ToastClose");
|
|
817
|
+
const St = pt, Mt = "_toast__viewport_fjqk1_1", Nt = "_toast_fjqk1_1", Pt = "_toast_variant_neutral_fjqk1_111", Ot = "_toast_variant_colorway_fjqk1_117", Ct = "_toast__content_fjqk1_123", Ft = "_toast__header_fjqk1_142", kt = "_toast__header_pad_fjqk1_146", It = "_toast__title_fjqk1_150", Lt = "_toast__description_fjqk1_154", Ht = "_toast__close_fjqk1_158", G = {
|
|
818
818
|
toast__viewport: Mt,
|
|
819
819
|
toast: Nt,
|
|
820
820
|
toast_variant_neutral: Pt,
|
|
821
821
|
toast_variant_colorway: Ot,
|
|
822
822
|
toast__content: Ct,
|
|
823
823
|
toast__header: Ft,
|
|
824
|
-
toast__header_pad:
|
|
825
|
-
toast__title:
|
|
826
|
-
toast__description:
|
|
827
|
-
toast__close:
|
|
828
|
-
}, ln =
|
|
824
|
+
toast__header_pad: kt,
|
|
825
|
+
toast__title: It,
|
|
826
|
+
toast__description: Lt,
|
|
827
|
+
toast__close: Ht
|
|
828
|
+
}, ln = He, Ie = {
|
|
829
829
|
info: "blue",
|
|
830
830
|
error: "red",
|
|
831
831
|
warning: "yellow",
|
|
832
832
|
success: "green"
|
|
833
833
|
};
|
|
834
834
|
function fn() {
|
|
835
|
-
return /* @__PURE__ */ E(St, { children: /* @__PURE__ */ E(
|
|
835
|
+
return /* @__PURE__ */ E(St, { children: /* @__PURE__ */ E($e, { className: G.toast__viewport, children: /* @__PURE__ */ E(Vt, {}) }) });
|
|
836
836
|
}
|
|
837
|
-
function
|
|
837
|
+
function Vt() {
|
|
838
838
|
return dt().toasts.map((d) => {
|
|
839
|
-
const h = d.type && d.type in
|
|
839
|
+
const h = d.type && d.type in Ie ? Ie[d.type] : void 0;
|
|
840
840
|
return /* @__PURE__ */ E(
|
|
841
|
-
|
|
841
|
+
je,
|
|
842
842
|
{
|
|
843
843
|
toast: d,
|
|
844
844
|
className: Ne(
|
|
845
|
-
|
|
846
|
-
h ?
|
|
845
|
+
G.toast,
|
|
846
|
+
h ? G.toast_variant_colorway : G.toast_variant_neutral
|
|
847
847
|
),
|
|
848
848
|
render: /* @__PURE__ */ E(ut, { background: "default", color: h }),
|
|
849
849
|
children: /* @__PURE__ */ ae(
|
|
850
850
|
Pe,
|
|
851
851
|
{
|
|
852
852
|
render: /* @__PURE__ */ E(Be, {}),
|
|
853
|
-
className:
|
|
853
|
+
className: G.toast__content,
|
|
854
854
|
children: [
|
|
855
855
|
/* @__PURE__ */ ae(
|
|
856
856
|
Pe,
|
|
857
857
|
{
|
|
858
858
|
className: Ne(
|
|
859
|
-
|
|
860
|
-
!d.title &&
|
|
859
|
+
G.toast__header,
|
|
860
|
+
!d.title && G.toast__header_pad
|
|
861
861
|
),
|
|
862
862
|
children: [
|
|
863
863
|
/* @__PURE__ */ E(
|
|
864
|
-
|
|
864
|
+
Ae,
|
|
865
865
|
{
|
|
866
866
|
render: /* @__PURE__ */ E(
|
|
867
867
|
at,
|
|
@@ -869,23 +869,23 @@ function zt() {
|
|
|
869
869
|
level: 2,
|
|
870
870
|
size: "lg",
|
|
871
871
|
color: "inherit",
|
|
872
|
-
className:
|
|
872
|
+
className: G.toast__title
|
|
873
873
|
}
|
|
874
874
|
)
|
|
875
875
|
}
|
|
876
876
|
),
|
|
877
877
|
/* @__PURE__ */ E(
|
|
878
|
-
|
|
878
|
+
qe,
|
|
879
879
|
{
|
|
880
880
|
render: /* @__PURE__ */ E(lt, { multiline: !0, color: h ? "inherit" : "dimmer" }),
|
|
881
|
-
className:
|
|
881
|
+
className: G.toast__description
|
|
882
882
|
}
|
|
883
883
|
)
|
|
884
884
|
]
|
|
885
885
|
}
|
|
886
886
|
),
|
|
887
887
|
/* @__PURE__ */ E(
|
|
888
|
-
|
|
888
|
+
Ye,
|
|
889
889
|
{
|
|
890
890
|
render: /* @__PURE__ */ E(
|
|
891
891
|
ct,
|
|
@@ -894,7 +894,7 @@ function zt() {
|
|
|
894
894
|
icon: "close-line",
|
|
895
895
|
size: "sm",
|
|
896
896
|
alt: "Close",
|
|
897
|
-
className:
|
|
897
|
+
className: G.toast__close
|
|
898
898
|
}
|
|
899
899
|
)
|
|
900
900
|
}
|
package/dist/toast.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._toast__viewport_fjqk1_1{position:fixed;right:var(--space-8);bottom:var(--space-8);z-index:49;margin:0 auto;isolation:isolate;width:var(--space-256)}@media(min-width:512px){._toast__viewport_fjqk1_1{right:var(--space-16);bottom:var(--space-16)}}._toast_fjqk1_1{--toast-custom-gap: var(--space-12);--toast-custom-peek: var(--space-12);--toast-custom-scale: max(0, 1 - (var(--toast-index) * .1)) ;--toast-custom-shrink: calc(1 - var(--toast-custom-scale));--toast-custom-height: var(--toast-frontmost-height, var(--toast-height));--toast-custom-offset-y: calc( var(--toast-offset-y) * -1 + (var(--toast-index) * var(--toast-custom-gap) * -1) + var(--toast-swipe-movement-y) );display:flex;position:absolute;right:0;bottom:0;left:auto;flex-direction:row;align-items:center;gap:var(--space-8);transform:translate(var(--toast-swipe-movement-x)) translateY(calc(var(--toast-swipe-movement-y) - (var(--toast-index) * var(--toast-custom-peek)) - (var(--toast-custom-shrink) * var(--toast-custom-height)))) scale(var(--toast-custom-scale));transform-origin:bottom center;z-index:calc(1000 - var(--toast-index));transition:transform .6s cubic-bezier(.22,1,.36,1),opacity .6s,height var(--transition-duration-snappy);cursor:default;box-sizing:border-box;margin:0 0 0 auto;border-width:1px;border-style:solid;border-radius:var(--border-radius-default);background-clip:padding-box;width:100%;height:var(--toast-custom-height);-webkit-user-select:none;-moz-user-select:none;user-select:none}._toast_fjqk1_1[data-expanded]{transform:translate(var(--toast-swipe-movement-x)) translateY(var(--toast-custom-offset-y));height:var(--toast-height)}._toast_fjqk1_1[data-starting-style],._toast_fjqk1_1[data-ending-style]{transform:translateY(150%)}._toast_fjqk1_1[data-limited],._toast_fjqk1_1[data-ending-style]{opacity:0}._toast_fjqk1_1[data-ending-style][data-swipe-direction=up]{transform:translateY(calc(var(--toast-swipe-movement-y) - 50%))}._toast_fjqk1_1[data-ending-style][data-swipe-direction=left]{transform:translate(calc(var(--toast-swipe-movement-x) - 50%)) translateY(var(--toast-custom-offset-y))}._toast_fjqk1_1[data-ending-style][data-swipe-direction=right]{transform:translate(calc(var(--toast-swipe-movement-x) + 50%)) translateY(var(--toast-custom-offset-y))}._toast_fjqk1_1[data-ending-style][data-swipe-direction=down]{transform:translateY(calc(var(--toast-swipe-movement-y) + 50%))}._toast_fjqk1_1:after{display:block;position:absolute;top:100%;left:0;width:100%;height:calc(var(--toast-custom-gap) + 1px);content:""}._toast_variant_neutral_fjqk1_111{border-color:var(--surface-interactive-border);background:var(--surface-background);color:var(--foreground-default)}._toast_variant_colorway_fjqk1_117{border-color:var(--view-colorway-dimmer);background:var(--view-colorway-dimmest);color:var(--view-colorway-strongest)}._toast__content_fjqk1_123{position:relative;flex-grow:1;flex-shrink:1;gap:var(--space-8);transition:opacity var(--transition-duration-snappy) var(--transition-timing-function-snappy);padding:var(--space-12);overflow:hidden}._toast__content_fjqk1_123[data-behind]{opacity:0}._toast__content_fjqk1_123[data-expanded]{opacity:1}._toast__header_fjqk1_142{gap:var(--space-4)}._toast__header_pad_fjqk1_146{padding-right:var(--space-28)}._toast__title_fjqk1_150,._toast__description_fjqk1_154{flex:1 1 auto}._toast__close_fjqk1_158{position:absolute;top:var(--space-12);right:var(--space-12)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koide-labs/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -29,23 +29,6 @@
|
|
|
29
29
|
"sideEffects": [
|
|
30
30
|
"**/*.css"
|
|
31
31
|
],
|
|
32
|
-
"packageManager": "pnpm@10.19.0",
|
|
33
|
-
"scripts": {
|
|
34
|
-
"dev": "vite",
|
|
35
|
-
"build": "npm-run-all build:icons build:vite",
|
|
36
|
-
"build:icons": "tsx ./scripts/build-icon-types.ts",
|
|
37
|
-
"build:vite": "tsc -b && vite build",
|
|
38
|
-
"preview": "vite preview",
|
|
39
|
-
"prepare": "husky",
|
|
40
|
-
"typecheck": "tsc -b --noEmit",
|
|
41
|
-
"lint": "npm-run-all --parallel lint:*",
|
|
42
|
-
"lint:ts": "eslint .",
|
|
43
|
-
"lint:style": "stylelint src/**/*.module.css",
|
|
44
|
-
"format": "prettier --write .",
|
|
45
|
-
"storybook": "storybook dev -p 6006",
|
|
46
|
-
"build-storybook": "storybook build",
|
|
47
|
-
"prepublishOnly": "pnpm run build"
|
|
48
|
-
},
|
|
49
32
|
"dependencies": {
|
|
50
33
|
"@base-ui/react": "^1.0.0",
|
|
51
34
|
"@npham-dev/cmdk": "^0.0.0",
|
|
@@ -116,5 +99,19 @@
|
|
|
116
99
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
117
100
|
"vite-tsconfig-paths": "^6.0.3",
|
|
118
101
|
"vitest": "^4.0.16"
|
|
102
|
+
},
|
|
103
|
+
"scripts": {
|
|
104
|
+
"dev": "vite",
|
|
105
|
+
"build": "npm-run-all build:icons build:vite",
|
|
106
|
+
"build:icons": "tsx ./scripts/build-icon-types.ts",
|
|
107
|
+
"build:vite": "tsc -b && vite build",
|
|
108
|
+
"preview": "vite preview",
|
|
109
|
+
"typecheck": "tsc -b --noEmit",
|
|
110
|
+
"lint": "npm-run-all --parallel lint:*",
|
|
111
|
+
"lint:ts": "eslint .",
|
|
112
|
+
"lint:style": "stylelint src/**/*.module.css",
|
|
113
|
+
"format": "prettier --write .",
|
|
114
|
+
"storybook": "storybook dev -p 6006",
|
|
115
|
+
"build-storybook": "storybook build"
|
|
119
116
|
}
|
|
120
|
-
}
|
|
117
|
+
}
|