@mechane-ai/elements 0.36.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/dist/ai.js +3 -3
- package/dist/{chart-theme-Bwr9YSP1.js → categorical-values-BECG-J6R.js} +4 -54
- package/dist/{chart-frame-C0UBu4ku.js → chart-frame-CJFnI39T.js} +78 -93
- package/dist/{chart-input-Ccr2NJ6J.js → chart-input-DwAobO8Y.js} +2 -2
- package/dist/chart-navigation-CBIeNtJq.js +67 -0
- package/dist/charts/cartesian.js +631 -618
- package/dist/charts/distribution.js +298 -267
- package/dist/charts/graph.js +113 -122
- package/dist/charts/hierarchy.js +12 -12
- package/dist/charts/matrix.js +208 -200
- package/dist/charts/timeline.js +2 -2
- package/dist/charts.js +3 -3
- package/dist/{code-block-DT1TCkTC.js → code-block-aC0Htt4N.js} +33 -32
- package/dist/collections.js +597 -351
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +1 -1
- package/dist/content/markdown.js +1 -1
- package/dist/content.js +1 -1
- package/dist/elements.css +22 -2
- package/dist/feedback.js +1 -1
- package/dist/navigation/commands.js +4 -3
- package/dist/packages/charts/src/chart-data.d.ts +13 -3
- package/dist/packages/charts/src/chart-frame.d.ts +2 -5
- package/dist/packages/charts/src/chart-navigation.d.ts +19 -0
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +4 -2
- package/dist/packages/collections/src/collection-filters.d.ts +20 -0
- package/dist/packages/collections/src/data-table.d.ts +4 -6
- package/dist/packages/collections/src/index.d.ts +4 -0
- package/dist/packages/collections/src/use-collection-controls.d.ts +30 -0
- package/dist/packages/feedback/src/index.d.ts +2 -2
- package/dist/packages/feedback/src/notifications.d.ts +35 -0
- package/dist/packages/feedback/src/toast.d.ts +1 -1
- package/dist/packages/navigation/src/commands/command.d.ts +1 -0
- package/dist/plot-width-BQQS-mw9.js +67 -0
- package/dist/{src-D9DktxEq.js → src-DWjAoOyd.js} +1 -1
- package/dist/{src-DXdsMc_Z.js → src-nkgFDl-g.js} +246 -207
- package/package.json +1 -1
- package/dist/plot-width--OgdohB5.js +0 -18
|
@@ -10,7 +10,7 @@ import { Meter as k } from "@base-ui/react/meter";
|
|
|
10
10
|
import { Progress as A } from "@base-ui/react/progress";
|
|
11
11
|
import ne from "react-dom";
|
|
12
12
|
// packages/feedback/src/feedback.tsx
|
|
13
|
-
function
|
|
13
|
+
function re({ title: e, children: t, action: r, ...i }) {
|
|
14
14
|
return /* @__PURE__ */ C("div", {
|
|
15
15
|
...p({ className: "x78zum5 xdt5ytf x6s0dn4 xl56j7k x2b8uid xeuugli x193iq5w x9f619 x9w77qv xnx3t7k x1n8ia3y x1hz01jw xj57cvi xvmahel xj0a0fe" }, i),
|
|
16
16
|
children: [
|
|
@@ -28,14 +28,14 @@ function j({ title: e, children: t, action: r, ...i }) {
|
|
|
28
28
|
]
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function j({ hasError: e = !1, ...t }) {
|
|
32
32
|
return /* @__PURE__ */ S("div", { ...p({ role: e ? "alert" : "status" }, {
|
|
33
33
|
0: { className: "xeuugli x193iq5w x9f619 x1qokhjc x1doqdfy x1ok0vyi x1hz01jw xvmahel xtqrqnz x1778rvt xj57cvi x1dqe72f x1f9ixgr xj0a0fe" },
|
|
34
34
|
1: { className: "xeuugli x193iq5w x9f619 x1qokhjc x1doqdfy x1ok0vyi x1hz01jw xvmahel xtqrqnz x1778rvt xj57cvi xj0a0fe xr5kp14 xcqwzn" }
|
|
35
35
|
}[!!e | 0], t) });
|
|
36
36
|
}
|
|
37
37
|
// packages/feedback/src/skeleton.tsx
|
|
38
|
-
var
|
|
38
|
+
var M = {
|
|
39
39
|
skeleton: {
|
|
40
40
|
k1xSpc: "x1lliihq",
|
|
41
41
|
ks0D6T: "x193iq5w",
|
|
@@ -73,30 +73,30 @@ var N = {
|
|
|
73
73
|
k7Eaqz: "xeuugli",
|
|
74
74
|
$$css: !0
|
|
75
75
|
}
|
|
76
|
-
},
|
|
77
|
-
rectangle:
|
|
78
|
-
circle:
|
|
76
|
+
}, ie = {
|
|
77
|
+
rectangle: M.rectangle,
|
|
78
|
+
circle: M.circle
|
|
79
79
|
};
|
|
80
|
-
function
|
|
80
|
+
function N({ width: e = "100%", height: t = 8, shape: n = "rectangle" }) {
|
|
81
81
|
return /* @__PURE__ */ S("span", {
|
|
82
82
|
"aria-hidden": !0,
|
|
83
|
-
...m.props(
|
|
83
|
+
...m.props(M.skeleton, M.dimensions(e, t), ie[n])
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function P({ lines: e = 1, width: t = "100%" }) {
|
|
87
87
|
return /* @__PURE__ */ S("span", {
|
|
88
88
|
"aria-hidden": !0,
|
|
89
|
-
...m.props(
|
|
89
|
+
...m.props(M.text, M.width(t)),
|
|
90
90
|
children: Array.from({ length: e }, (t, n) => /* @__PURE__ */ S("span", {
|
|
91
91
|
className: "x78zum5 x6s0dn4 xg2ss61",
|
|
92
|
-
children: /* @__PURE__ */ S(
|
|
92
|
+
children: /* @__PURE__ */ S(N, {
|
|
93
93
|
width: e > 1 && n === e - 1 ? "65%" : "100%",
|
|
94
94
|
height: "0.6em"
|
|
95
95
|
})
|
|
96
96
|
}, `placeholder-${n}`))
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function F({ label: e, showLabel: t = !1 }) {
|
|
100
100
|
return /* @__PURE__ */ C("span", {
|
|
101
101
|
role: "status",
|
|
102
102
|
className: "x3nfvp2 x1n2onr6 x6s0dn4 xeuugli x193iq5w x1hnptsi x153jb6y x1hz01jw xtqrqnz x1778rvt xj57cvi xj0a0fe",
|
|
@@ -104,19 +104,19 @@ function L({ label: e, showLabel: t = !1 }) {
|
|
|
104
104
|
"aria-hidden": !0,
|
|
105
105
|
className: "xtwnzbg x18utl2x x2lah0s"
|
|
106
106
|
}), /* @__PURE__ */ S("span", {
|
|
107
|
-
...m.props(
|
|
107
|
+
...m.props(M.label, !t && f.hidden),
|
|
108
108
|
children: e
|
|
109
109
|
})]
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
// packages/feedback/src/control-placeholders.tsx
|
|
113
|
-
var
|
|
113
|
+
var ae = {
|
|
114
114
|
ks0D6T: "x193iq5w",
|
|
115
115
|
$$css: !0
|
|
116
|
-
},
|
|
116
|
+
}, I = {
|
|
117
117
|
kZKoxP: "x16ye13r",
|
|
118
118
|
$$css: !0
|
|
119
|
-
},
|
|
119
|
+
}, L = {
|
|
120
120
|
button: {
|
|
121
121
|
kWkggS: "x1r7kqkb",
|
|
122
122
|
kXLuUW: "xxymvpz",
|
|
@@ -128,39 +128,39 @@ var re = {
|
|
|
128
128
|
$$css: !0
|
|
129
129
|
},
|
|
130
130
|
width: (e) => [
|
|
131
|
-
|
|
131
|
+
ae,
|
|
132
132
|
{
|
|
133
133
|
kzqmXN: e == null ? e : "x5lhr3w",
|
|
134
134
|
$$css: !0
|
|
135
135
|
},
|
|
136
136
|
{ "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
|
|
137
137
|
],
|
|
138
|
-
rows: (e) => [
|
|
138
|
+
rows: (e) => [I, { "--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(`calc(${e} * 1lh + 2 * ${s.paddingBlock} + 2px)`) }]
|
|
139
139
|
};
|
|
140
|
-
function
|
|
140
|
+
function oe({ width: t = "7ch", isIconOnly: n = !1, density: a = "standard", xstyle: o }) {
|
|
141
141
|
return /* @__PURE__ */ S("span", {
|
|
142
142
|
"aria-hidden": !0,
|
|
143
143
|
inert: !0,
|
|
144
|
-
...m.props(r.base, r.button, e[a], i[a], n && r.iconButton,
|
|
145
|
-
children: n ? /* @__PURE__ */ S(
|
|
144
|
+
...m.props(r.base, r.button, e[a], i[a], n && r.iconButton, L.button, o),
|
|
145
|
+
children: n ? /* @__PURE__ */ S(N, {
|
|
146
146
|
width: s.iconSize,
|
|
147
147
|
height: s.iconSize
|
|
148
|
-
}) : /* @__PURE__ */ S(
|
|
148
|
+
}) : /* @__PURE__ */ S(P, { width: t })
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function R({ label: n, hint: i, isMultiline: a = !1, density: o = "standard", rows: s = 4, width: c = "100%", xstyle: l }) {
|
|
152
152
|
let u = a ? Math.min(s, 6) : 1;
|
|
153
153
|
return /* @__PURE__ */ C("div", {
|
|
154
154
|
"aria-hidden": !0,
|
|
155
|
-
...m.props(r.fieldRoot,
|
|
155
|
+
...m.props(r.fieldRoot, L.width(c), l),
|
|
156
156
|
children: [
|
|
157
157
|
n !== void 0 && /* @__PURE__ */ S("span", {
|
|
158
158
|
...m.props(r.label),
|
|
159
159
|
children: n
|
|
160
160
|
}),
|
|
161
161
|
/* @__PURE__ */ S("div", {
|
|
162
|
-
...m.props(r.base, r.field, e[o], !a && r.singleLineField, !a && t[o], !a &&
|
|
163
|
-
children: /* @__PURE__ */ S(
|
|
162
|
+
...m.props(r.base, r.field, e[o], !a && r.singleLineField, !a && t[o], !a && L.singleLine, a && r.textarea, a && L.rows(s)),
|
|
163
|
+
children: /* @__PURE__ */ S(P, {
|
|
164
164
|
width: "60%",
|
|
165
165
|
lines: u
|
|
166
166
|
})
|
|
@@ -173,7 +173,7 @@ function B({ label: n, hint: i, isMultiline: a = !1, density: o = "standard", ro
|
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
// packages/foundations/src/chart-tones.ts
|
|
176
|
-
var
|
|
176
|
+
var z = {
|
|
177
177
|
series1: c.series1,
|
|
178
178
|
series2: c.series2,
|
|
179
179
|
series3: c.series3,
|
|
@@ -183,7 +183,7 @@ var V = {
|
|
|
183
183
|
positive: c.positive,
|
|
184
184
|
negative: c.negative,
|
|
185
185
|
neutral: l.muted
|
|
186
|
-
},
|
|
186
|
+
}, B = {
|
|
187
187
|
root: {
|
|
188
188
|
k1xSpc: "x78zum5",
|
|
189
189
|
kXwgrk: "xdt5ytf",
|
|
@@ -264,7 +264,7 @@ var V = {
|
|
|
264
264
|
kB7OPa: "x9f619",
|
|
265
265
|
$$css: !0
|
|
266
266
|
}
|
|
267
|
-
},
|
|
267
|
+
}, se = {
|
|
268
268
|
stacked: {
|
|
269
269
|
root: void 0,
|
|
270
270
|
heading: void 0,
|
|
@@ -273,14 +273,14 @@ var V = {
|
|
|
273
273
|
track: void 0
|
|
274
274
|
},
|
|
275
275
|
inline: {
|
|
276
|
-
root:
|
|
277
|
-
heading:
|
|
276
|
+
root: B.inline,
|
|
277
|
+
heading: B.inlineHeading,
|
|
278
278
|
label: f.hidden,
|
|
279
|
-
value:
|
|
280
|
-
track:
|
|
279
|
+
value: B.inlineValue,
|
|
280
|
+
track: B.inlineTrack
|
|
281
281
|
}
|
|
282
282
|
};
|
|
283
|
-
function
|
|
283
|
+
function ce({ label: e, value: t, max: n, valueLabel: r }) {
|
|
284
284
|
return /* @__PURE__ */ C(A.Root, {
|
|
285
285
|
value: t,
|
|
286
286
|
max: n,
|
|
@@ -305,60 +305,60 @@ function oe({ label: e, value: t, max: n, valueLabel: r }) {
|
|
|
305
305
|
})]
|
|
306
306
|
});
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
let o =
|
|
308
|
+
function V({ label: e, value: t, max: n, valueLabel: r, layout: i = "stacked", tone: a }) {
|
|
309
|
+
let o = se[i], s = a === void 0 ? void 0 : B.tone(z[a]), c = t !== null && Number.isFinite(t);
|
|
310
310
|
return Number.isFinite(n) && n > 0 && c && t >= 0 && t <= n ? /* @__PURE__ */ C(k.Root, {
|
|
311
311
|
value: t,
|
|
312
312
|
max: n,
|
|
313
313
|
locale: "en-US",
|
|
314
314
|
getAriaValueText: () => r,
|
|
315
|
-
...m.props(
|
|
315
|
+
...m.props(B.root, o.root),
|
|
316
316
|
children: [/* @__PURE__ */ C("div", {
|
|
317
|
-
...m.props(
|
|
317
|
+
...m.props(B.heading, o.heading),
|
|
318
318
|
children: [/* @__PURE__ */ S(k.Label, {
|
|
319
|
-
...m.props(
|
|
319
|
+
...m.props(B.label, o.label),
|
|
320
320
|
children: e
|
|
321
321
|
}), /* @__PURE__ */ S("span", {
|
|
322
|
-
...m.props(
|
|
322
|
+
...m.props(B.value, o.value),
|
|
323
323
|
children: r
|
|
324
324
|
})]
|
|
325
325
|
}), /* @__PURE__ */ S(k.Track, {
|
|
326
|
-
...m.props(
|
|
327
|
-
children: /* @__PURE__ */ S(k.Indicator, { ...m.props(
|
|
326
|
+
...m.props(B.track, o.track),
|
|
327
|
+
children: /* @__PURE__ */ S(k.Indicator, { ...m.props(B.indicator, s) })
|
|
328
328
|
})]
|
|
329
329
|
}) : /* @__PURE__ */ C("div", {
|
|
330
|
-
...m.props(
|
|
330
|
+
...m.props(B.root, o.root),
|
|
331
331
|
children: [/* @__PURE__ */ C("div", {
|
|
332
|
-
...m.props(
|
|
332
|
+
...m.props(B.heading, o.heading),
|
|
333
333
|
children: [/* @__PURE__ */ S("span", {
|
|
334
|
-
...m.props(
|
|
334
|
+
...m.props(B.label, o.label),
|
|
335
335
|
children: e
|
|
336
336
|
}), /* @__PURE__ */ S("span", {
|
|
337
|
-
...m.props(
|
|
337
|
+
...m.props(B.value, o.value),
|
|
338
338
|
children: r
|
|
339
339
|
})]
|
|
340
340
|
}), /* @__PURE__ */ S("div", {
|
|
341
341
|
"aria-hidden": !0,
|
|
342
|
-
...m.props(
|
|
342
|
+
...m.props(B.track, o.track, B.unknown)
|
|
343
343
|
})]
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
346
|
// ../../../node_modules/.pnpm/sonner@2.0.8_@types+react@19.3.0_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/sonner/dist/index.mjs
|
|
347
|
-
var
|
|
347
|
+
var le = (e) => {
|
|
348
348
|
switch (e) {
|
|
349
|
-
case "success": return
|
|
350
|
-
case "info": return
|
|
351
|
-
case "warning": return
|
|
352
|
-
case "error": return
|
|
349
|
+
case "success": return H;
|
|
350
|
+
case "info": return pe;
|
|
351
|
+
case "warning": return fe;
|
|
352
|
+
case "error": return U;
|
|
353
353
|
default: return null;
|
|
354
354
|
}
|
|
355
|
-
},
|
|
355
|
+
}, ue = Array(12).fill(0), de = ({ visible: e, className: t }) => /*#__PURE__*/ h.createElement("div", {
|
|
356
356
|
className: ["sonner-loading-wrapper", t].filter(Boolean).join(" "),
|
|
357
357
|
"data-visible": e
|
|
358
|
-
}, /*#__PURE__*/ h.createElement("div", { className: "sonner-spinner" },
|
|
358
|
+
}, /*#__PURE__*/ h.createElement("div", { className: "sonner-spinner" }, ue.map((e, t) => /*#__PURE__*/ h.createElement("div", {
|
|
359
359
|
className: "sonner-loading-bar",
|
|
360
360
|
key: `spinner-bar-${t}`
|
|
361
|
-
})))),
|
|
361
|
+
})))), H = /*#__PURE__*/ h.createElement("svg", {
|
|
362
362
|
xmlns: "http://www.w3.org/2000/svg",
|
|
363
363
|
viewBox: "0 0 20 20",
|
|
364
364
|
fill: "currentColor",
|
|
@@ -369,7 +369,7 @@ var se = (e) => {
|
|
|
369
369
|
fillRule: "evenodd",
|
|
370
370
|
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
|
|
371
371
|
clipRule: "evenodd"
|
|
372
|
-
})),
|
|
372
|
+
})), fe = /*#__PURE__*/ h.createElement("svg", {
|
|
373
373
|
xmlns: "http://www.w3.org/2000/svg",
|
|
374
374
|
viewBox: "0 0 24 24",
|
|
375
375
|
fill: "currentColor",
|
|
@@ -380,7 +380,7 @@ var se = (e) => {
|
|
|
380
380
|
fillRule: "evenodd",
|
|
381
381
|
d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
|
|
382
382
|
clipRule: "evenodd"
|
|
383
|
-
})),
|
|
383
|
+
})), pe = /*#__PURE__*/ h.createElement("svg", {
|
|
384
384
|
xmlns: "http://www.w3.org/2000/svg",
|
|
385
385
|
viewBox: "0 0 20 20",
|
|
386
386
|
fill: "currentColor",
|
|
@@ -391,7 +391,7 @@ var se = (e) => {
|
|
|
391
391
|
fillRule: "evenodd",
|
|
392
392
|
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
|
|
393
393
|
clipRule: "evenodd"
|
|
394
|
-
})),
|
|
394
|
+
})), U = /*#__PURE__*/ h.createElement("svg", {
|
|
395
395
|
xmlns: "http://www.w3.org/2000/svg",
|
|
396
396
|
viewBox: "0 0 20 20",
|
|
397
397
|
fill: "currentColor",
|
|
@@ -402,7 +402,7 @@ var se = (e) => {
|
|
|
402
402
|
fillRule: "evenodd",
|
|
403
403
|
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
|
|
404
404
|
clipRule: "evenodd"
|
|
405
|
-
})),
|
|
405
|
+
})), me = /*#__PURE__*/ h.createElement("svg", {
|
|
406
406
|
xmlns: "http://www.w3.org/2000/svg",
|
|
407
407
|
width: "12",
|
|
408
408
|
height: "12",
|
|
@@ -423,7 +423,7 @@ var se = (e) => {
|
|
|
423
423
|
y1: "6",
|
|
424
424
|
x2: "18",
|
|
425
425
|
y2: "18"
|
|
426
|
-
})),
|
|
426
|
+
})), he = () => {
|
|
427
427
|
let [e, t] = h.useState(document.hidden);
|
|
428
428
|
return h.useEffect(() => {
|
|
429
429
|
let e = () => {
|
|
@@ -431,7 +431,7 @@ var se = (e) => {
|
|
|
431
431
|
};
|
|
432
432
|
return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
|
|
433
433
|
}, []), e;
|
|
434
|
-
},
|
|
434
|
+
}, ge = 1, _e = 100, W = (e) => typeof e?.id == "number" || e?.id?.length > 0 ? e.id : ge++, G = new class {
|
|
435
435
|
constructor() {
|
|
436
436
|
this.subscribe = (e) => (this.subscribers.push(e), this.getActiveToasts().forEach((t) => e(t)), () => {
|
|
437
437
|
let t = this.subscribers.indexOf(e);
|
|
@@ -441,10 +441,10 @@ var se = (e) => {
|
|
|
441
441
|
}, this.addToast = (e) => {
|
|
442
442
|
this.publish(e), this.toasts = [...this.toasts, e], this.trimHistory();
|
|
443
443
|
}, this.trimHistory = () => {
|
|
444
|
-
let e = this.toasts.length -
|
|
444
|
+
let e = this.toasts.length - _e;
|
|
445
445
|
e <= 0 || (this.toasts = this.toasts.filter((t) => e > 0 && this.dismissedToasts.has(t.id) ? (this.dismissedToasts.delete(t.id), e--, !1) : !0));
|
|
446
446
|
}, this.create = (e) => {
|
|
447
|
-
let { message: t, ...n } = e, r =
|
|
447
|
+
let { message: t, ...n } = e, r = W(e), i = this.pendingDismissals.get(r);
|
|
448
448
|
i !== void 0 && (cancelAnimationFrame(i), this.pendingDismissals.delete(r), this.dismissedToasts.delete(r));
|
|
449
449
|
let a = this.dismissedToasts.has(r), o = e.dismissible === void 0 || e.dismissible;
|
|
450
450
|
return a && (this.dismissedToasts.delete(r), this.toasts = this.toasts.filter((e) => e.id !== r)), !a && this.toasts.find((e) => e.id === r) ? this.toasts = this.toasts.map((n) => n.id === r ? (this.publish({
|
|
@@ -519,7 +519,7 @@ var se = (e) => {
|
|
|
519
519
|
type: "default",
|
|
520
520
|
message: e
|
|
521
521
|
});
|
|
522
|
-
else if (
|
|
522
|
+
else if (K(e) && !e.ok) {
|
|
523
523
|
i = !1;
|
|
524
524
|
let r = typeof t.error == "function" ? await t.error(`HTTP error! status: ${e.status}`) : t.error, a = typeof t.description == "function" ? await t.description(`HTTP error! status: ${e.status}`) : t.description, o = typeof r == "object" && !h.isValidElement(r) ? r : { message: r };
|
|
525
525
|
this.create({
|
|
@@ -563,7 +563,7 @@ var se = (e) => {
|
|
|
563
563
|
}), s = () => new Promise((e, t) => o.then(() => a[0] === "reject" ? t(a[1]) : e(a[1])).catch(t));
|
|
564
564
|
return typeof n != "string" && typeof n != "number" ? { unwrap: s } : Object.assign(n, { unwrap: s });
|
|
565
565
|
}, this.custom = (e, t) => {
|
|
566
|
-
let n =
|
|
566
|
+
let n = W(t);
|
|
567
567
|
return this.create({
|
|
568
568
|
...t,
|
|
569
569
|
jsx: e(n),
|
|
@@ -572,42 +572,42 @@ var se = (e) => {
|
|
|
572
572
|
}), n;
|
|
573
573
|
}, this.getActiveToasts = () => this.toasts.filter((e) => !this.dismissedToasts.has(e.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set(), this.pendingDismissals = /* @__PURE__ */ new Map();
|
|
574
574
|
}
|
|
575
|
-
}(),
|
|
576
|
-
success:
|
|
577
|
-
info:
|
|
578
|
-
warning:
|
|
579
|
-
error:
|
|
580
|
-
custom:
|
|
581
|
-
message:
|
|
582
|
-
promise:
|
|
583
|
-
dismiss:
|
|
584
|
-
loading:
|
|
575
|
+
}(), ve = (e, t) => G.message(e, t), K = (e) => e && typeof e == "object" && "ok" in e && typeof e.ok == "boolean" && "status" in e && typeof e.status == "number", q = Object.assign(ve, {
|
|
576
|
+
success: G.success,
|
|
577
|
+
info: G.info,
|
|
578
|
+
warning: G.warning,
|
|
579
|
+
error: G.error,
|
|
580
|
+
custom: G.custom,
|
|
581
|
+
message: G.message,
|
|
582
|
+
promise: G.promise,
|
|
583
|
+
dismiss: G.dismiss,
|
|
584
|
+
loading: G.loading
|
|
585
585
|
}, {
|
|
586
|
-
getHistory: () =>
|
|
587
|
-
getToasts: () =>
|
|
586
|
+
getHistory: () => G.toasts,
|
|
587
|
+
getToasts: () => G.getActiveToasts()
|
|
588
588
|
});
|
|
589
|
-
function
|
|
589
|
+
function J(e) {
|
|
590
590
|
return e.label !== void 0;
|
|
591
591
|
}
|
|
592
|
-
var
|
|
593
|
-
function
|
|
592
|
+
var ye = 3, be = "24px", xe = "16px", Se = 4e3, Y = 356, Ce = 14, we = 45, Te = 200;
|
|
593
|
+
function X(...e) {
|
|
594
594
|
return e.filter(Boolean).join(" ");
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function Ee(e) {
|
|
597
597
|
let [t, n] = e.split("-"), r = [];
|
|
598
598
|
return t && r.push(t), n && r.push(n), r;
|
|
599
599
|
}
|
|
600
|
-
var
|
|
601
|
-
let { invert: t, toast: n, unstyled: r, interacting: i, setHeights: a, visibleToasts: o, heights: s, index: c, toasts: l, expanded: u, removeToast: d, defaultRichColors: f, closeButton: p, style: m, cancelButtonStyle: g, actionButtonStyle: _, className: v = "", descriptionClassName: y = "", duration: b, position: x, gap: S, expandByDefault: C, classNames: w, icons: T, closeButtonAriaLabel: ee = "Close toast" } = e, [E, D] = h.useState(null), [te, O] = h.useState(null), [k, A] = h.useState(!1), [ne,
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
}, [
|
|
600
|
+
var Z = (e) => {
|
|
601
|
+
let { invert: t, toast: n, unstyled: r, interacting: i, setHeights: a, visibleToasts: o, heights: s, index: c, toasts: l, expanded: u, removeToast: d, defaultRichColors: f, closeButton: p, style: m, cancelButtonStyle: g, actionButtonStyle: _, className: v = "", descriptionClassName: y = "", duration: b, position: x, gap: S, expandByDefault: C, classNames: w, icons: T, closeButtonAriaLabel: ee = "Close toast" } = e, [E, D] = h.useState(null), [te, O] = h.useState(null), [k, A] = h.useState(!1), [ne, re] = h.useState(!1), [j, M] = h.useState(!1), [ie, N] = h.useState(!1), [P, F] = h.useState(!1), [ae, I] = h.useState(0), [L, oe] = h.useState(0), R = h.useRef(n.duration || b || Se), z = h.useRef(null), B = h.useRef(null), se = c === 0, ce = c + 1 <= o, V = n.type, ue = V ?? "default", H = n.dismissible !== !1, fe = n.className || "", pe = n.descriptionClassName || "", U = h.useMemo(() => s.findIndex((e) => e.toastId === n.id) || 0, [s, n.id]), ge = h.useMemo(() => n.closeButton ?? p, [n.closeButton, p]), _e = h.useMemo(() => n.duration || b || Se, [n.duration, b]), W = h.useRef(0), G = h.useRef(0), ve = h.useRef(0), K = h.useRef(null), [q, ye] = x.split("-"), be = h.useMemo(() => s.reduce((e, t, n) => n >= U ? e : e + t.height, 0), [s, U]), xe = he(), Y = h.useMemo(() => e.swipeDirections ?? Ee(x), [e.swipeDirections, x]), Ce = n.invert || t, Z = V === "loading";
|
|
602
|
+
G.current = h.useMemo(() => U * S + be, [U, be]), h.useEffect(() => {
|
|
603
|
+
R.current = _e;
|
|
604
|
+
}, [_e]), h.useEffect(() => {
|
|
605
605
|
A(!0);
|
|
606
606
|
}, []), h.useEffect(() => {
|
|
607
|
-
let e =
|
|
607
|
+
let e = B.current;
|
|
608
608
|
if (e) {
|
|
609
609
|
let t = e.getBoundingClientRect().height;
|
|
610
|
-
return
|
|
610
|
+
return oe(t), a((e) => [{
|
|
611
611
|
toastId: n.id,
|
|
612
612
|
height: t,
|
|
613
613
|
position: n.position
|
|
@@ -615,10 +615,10 @@ var Q = (e) => {
|
|
|
615
615
|
}
|
|
616
616
|
}, [a, n.id]), h.useLayoutEffect(() => {
|
|
617
617
|
if (!k) return;
|
|
618
|
-
let e =
|
|
618
|
+
let e = B.current, t = e.style.height;
|
|
619
619
|
e.style.height = "auto";
|
|
620
620
|
let r = e.getBoundingClientRect().height;
|
|
621
|
-
e.style.height = t,
|
|
621
|
+
e.style.height = t, oe(r), a((e) => e.find((e) => e.toastId === n.id) ? e.map((e) => e.toastId === n.id ? {
|
|
622
622
|
...e,
|
|
623
623
|
height: r
|
|
624
624
|
} : e) : [{
|
|
@@ -636,69 +636,69 @@ var Q = (e) => {
|
|
|
636
636
|
n.action,
|
|
637
637
|
n.cancel
|
|
638
638
|
]);
|
|
639
|
-
let
|
|
640
|
-
|
|
639
|
+
let Q = h.useCallback(() => {
|
|
640
|
+
re(!0), I(G.current), a((e) => e.filter((e) => e.toastId !== n.id)), setTimeout(() => {
|
|
641
641
|
d(n);
|
|
642
|
-
},
|
|
642
|
+
}, Te);
|
|
643
643
|
}, [
|
|
644
644
|
n,
|
|
645
645
|
d,
|
|
646
646
|
a,
|
|
647
|
-
|
|
647
|
+
G
|
|
648
648
|
]);
|
|
649
649
|
h.useEffect(() => {
|
|
650
|
-
if (n.promise &&
|
|
650
|
+
if (n.promise && V === "loading" || n.duration === Infinity || n.type === "loading") return;
|
|
651
651
|
let e;
|
|
652
|
-
return u || i ||
|
|
653
|
-
if (
|
|
654
|
-
let e = (/* @__PURE__ */ new Date()).getTime() -
|
|
655
|
-
|
|
652
|
+
return u || i || xe ? (() => {
|
|
653
|
+
if (ve.current < W.current) {
|
|
654
|
+
let e = (/* @__PURE__ */ new Date()).getTime() - W.current;
|
|
655
|
+
R.current -= e;
|
|
656
656
|
}
|
|
657
|
-
|
|
658
|
-
})() :
|
|
659
|
-
n.onAutoClose == null || n.onAutoClose.call(n, n),
|
|
660
|
-
},
|
|
657
|
+
ve.current = (/* @__PURE__ */ new Date()).getTime();
|
|
658
|
+
})() : R.current !== Infinity && (W.current = (/* @__PURE__ */ new Date()).getTime(), e = setTimeout(() => {
|
|
659
|
+
n.onAutoClose == null || n.onAutoClose.call(n, n), Q();
|
|
660
|
+
}, R.current)), () => clearTimeout(e);
|
|
661
661
|
}, [
|
|
662
662
|
u,
|
|
663
663
|
i,
|
|
664
664
|
n,
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
665
|
+
V,
|
|
666
|
+
xe,
|
|
667
|
+
Q
|
|
668
668
|
]), h.useEffect(() => {
|
|
669
|
-
n.delete && (
|
|
670
|
-
}, [
|
|
671
|
-
function
|
|
669
|
+
n.delete && (Q(), n.onDismiss == null || n.onDismiss.call(n, n));
|
|
670
|
+
}, [Q, n.delete]);
|
|
671
|
+
function De() {
|
|
672
672
|
return T?.loading ? /*#__PURE__*/ h.createElement("div", {
|
|
673
|
-
className:
|
|
674
|
-
"data-visible":
|
|
675
|
-
}, T.loading) : /*#__PURE__*/ h.createElement(
|
|
676
|
-
className:
|
|
677
|
-
visible:
|
|
673
|
+
className: X(w?.loader, n?.classNames?.loader, "sonner-loader"),
|
|
674
|
+
"data-visible": V === "loading"
|
|
675
|
+
}, T.loading) : /*#__PURE__*/ h.createElement(de, {
|
|
676
|
+
className: X(w?.loader, n?.classNames?.loader),
|
|
677
|
+
visible: V === "loading"
|
|
678
678
|
});
|
|
679
679
|
}
|
|
680
|
-
let
|
|
680
|
+
let Oe = n.icon || T?.[V] || le(V);
|
|
681
681
|
return /*#__PURE__*/ h.createElement("li", {
|
|
682
682
|
tabIndex: 0,
|
|
683
|
-
ref:
|
|
684
|
-
className:
|
|
683
|
+
ref: B,
|
|
684
|
+
className: X(v, fe, w?.toast, n?.classNames?.toast, w?.[ue], n?.classNames?.[ue]),
|
|
685
685
|
"data-sonner-toast": "",
|
|
686
686
|
"data-rich-colors": n.richColors ?? f,
|
|
687
687
|
"data-styled": !(n.jsx || n.unstyled || r),
|
|
688
688
|
"data-mounted": k,
|
|
689
689
|
"data-promise": !!n.promise,
|
|
690
|
-
"data-swiped":
|
|
690
|
+
"data-swiped": P,
|
|
691
691
|
"data-removed": ne,
|
|
692
|
-
"data-visible":
|
|
693
|
-
"data-y-position":
|
|
694
|
-
"data-x-position":
|
|
692
|
+
"data-visible": ce,
|
|
693
|
+
"data-y-position": q,
|
|
694
|
+
"data-x-position": ye,
|
|
695
695
|
"data-index": c,
|
|
696
|
-
"data-front":
|
|
697
|
-
"data-swiping":
|
|
698
|
-
"data-dismissible":
|
|
699
|
-
"data-type":
|
|
700
|
-
"data-invert":
|
|
701
|
-
"data-swipe-out":
|
|
696
|
+
"data-front": se,
|
|
697
|
+
"data-swiping": j,
|
|
698
|
+
"data-dismissible": H,
|
|
699
|
+
"data-type": V,
|
|
700
|
+
"data-invert": Ce,
|
|
701
|
+
"data-swipe-out": ie,
|
|
702
702
|
"data-swipe-direction": te,
|
|
703
703
|
"data-expanded": !!(u || C && k),
|
|
704
704
|
"data-testid": n.testId,
|
|
@@ -706,103 +706,103 @@ var Q = (e) => {
|
|
|
706
706
|
"--index": c,
|
|
707
707
|
"--toasts-before": c,
|
|
708
708
|
"--z-index": l.length - c,
|
|
709
|
-
"--offset": `${ne ?
|
|
710
|
-
"--initial-height": C ? "auto" : `${
|
|
709
|
+
"--offset": `${ne ? ae : G.current}px`,
|
|
710
|
+
"--initial-height": C ? "auto" : `${L}px`,
|
|
711
711
|
...m,
|
|
712
712
|
...n.style
|
|
713
713
|
},
|
|
714
714
|
onDragEnd: () => {
|
|
715
|
-
|
|
715
|
+
M(!1), D(null), K.current = null;
|
|
716
716
|
},
|
|
717
717
|
onPointerDown: (e) => {
|
|
718
|
-
e.button !== 2 && !
|
|
718
|
+
e.button !== 2 && !Z && H && (z.current = /* @__PURE__ */ new Date(), I(G.current), e.target.setPointerCapture(e.pointerId), e.target.tagName !== "BUTTON" && (M(!0), K.current = {
|
|
719
719
|
x: e.clientX,
|
|
720
720
|
y: e.clientY
|
|
721
721
|
}));
|
|
722
722
|
},
|
|
723
723
|
onPointerUp: () => {
|
|
724
|
-
if (
|
|
725
|
-
|
|
726
|
-
let e = Number(
|
|
727
|
-
if ((E === "x" ?
|
|
724
|
+
if (ie || !H) return;
|
|
725
|
+
K.current = null;
|
|
726
|
+
let e = Number(B.current?.style.getPropertyValue("--swipe-amount-x").replace("px", "") || 0), t = Number(B.current?.style.getPropertyValue("--swipe-amount-y").replace("px", "") || 0), r = (/* @__PURE__ */ new Date()).getTime() - z.current?.getTime(), i = E === "x" ? e : t, a = Math.abs(i) / r;
|
|
727
|
+
if ((E === "x" ? Y.includes(e > 0 ? "right" : "left") : Y.includes(t > 0 ? "bottom" : "top")) && (Math.abs(i) >= we || a > .11)) I(G.current), n.onDismiss == null || n.onDismiss.call(n, n), O(E === "x" ? e > 0 ? "right" : "left" : t > 0 ? "down" : "up"), Q(), N(!0);
|
|
728
728
|
else {
|
|
729
729
|
var o, s;
|
|
730
|
-
(o =
|
|
730
|
+
(o = B.current) == null || o.style.setProperty("--swipe-amount-x", "0px"), (s = B.current) == null || s.style.setProperty("--swipe-amount-y", "0px"), F(!1), M(!1), D(null);
|
|
731
731
|
}
|
|
732
732
|
},
|
|
733
733
|
onPointerMove: (e) => {
|
|
734
734
|
var t, n;
|
|
735
|
-
if (!
|
|
736
|
-
let r = e.clientY -
|
|
735
|
+
if (!K.current || !H || window.getSelection()?.toString().length > 0) return;
|
|
736
|
+
let r = e.clientY - K.current.y, i = e.clientX - K.current.x;
|
|
737
737
|
!E && (Math.abs(i) > 1 || Math.abs(r) > 1) && D(Math.abs(i) > Math.abs(r) ? "x" : "y");
|
|
738
738
|
let a = {
|
|
739
739
|
x: 0,
|
|
740
740
|
y: 0
|
|
741
741
|
}, o = (e) => 1 / (1.5 + Math.abs(e) / 20);
|
|
742
742
|
if (E === "y") {
|
|
743
|
-
if (
|
|
744
|
-
if (
|
|
743
|
+
if (Y.includes("top") || Y.includes("bottom")) {
|
|
744
|
+
if (Y.includes("top") && r < 0 || Y.includes("bottom") && r > 0) a.y = r;
|
|
745
745
|
else {
|
|
746
746
|
let e = r * o(r);
|
|
747
747
|
a.y = Math.abs(e) < Math.abs(r) ? e : r;
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
} else if (E === "x" && (
|
|
751
|
-
if (
|
|
750
|
+
} else if (E === "x" && (Y.includes("left") || Y.includes("right"))) {
|
|
751
|
+
if (Y.includes("left") && i < 0 || Y.includes("right") && i > 0) a.x = i;
|
|
752
752
|
else {
|
|
753
753
|
let e = i * o(i);
|
|
754
754
|
a.x = Math.abs(e) < Math.abs(i) ? e : i;
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
|
-
(Math.abs(a.x) > 0 || Math.abs(a.y) > 0) &&
|
|
757
|
+
(Math.abs(a.x) > 0 || Math.abs(a.y) > 0) && F(!0), (t = B.current) == null || t.style.setProperty("--swipe-amount-x", `${a.x}px`), (n = B.current) == null || n.style.setProperty("--swipe-amount-y", `${a.y}px`);
|
|
758
758
|
}
|
|
759
|
-
},
|
|
759
|
+
}, ge && !n.jsx && V !== "loading" ? /*#__PURE__*/ h.createElement("button", {
|
|
760
760
|
"aria-label": ee,
|
|
761
|
-
"data-disabled":
|
|
761
|
+
"data-disabled": Z,
|
|
762
762
|
"data-close-button": !0,
|
|
763
|
-
onClick:
|
|
764
|
-
|
|
763
|
+
onClick: Z || !H ? () => {} : () => {
|
|
764
|
+
Q(), n.onDismiss == null || n.onDismiss.call(n, n);
|
|
765
765
|
},
|
|
766
|
-
className:
|
|
767
|
-
}, T?.close ??
|
|
766
|
+
className: X(w?.closeButton, n?.classNames?.closeButton)
|
|
767
|
+
}, T?.close ?? me) : null, (V || n.icon || n.promise) && n.icon !== null && (T?.[V] !== null || n.icon) ? /*#__PURE__*/ h.createElement("div", {
|
|
768
768
|
"data-icon": "",
|
|
769
|
-
className:
|
|
770
|
-
},
|
|
769
|
+
className: X(w?.icon, n?.classNames?.icon)
|
|
770
|
+
}, V === "loading" ? n.icon || De() : n.promise ? De() : null, V === "loading" ? null : Oe) : null, /*#__PURE__*/ h.createElement("div", {
|
|
771
771
|
"data-content": "",
|
|
772
|
-
className:
|
|
772
|
+
className: X(w?.content, n?.classNames?.content)
|
|
773
773
|
}, /*#__PURE__*/ h.createElement("div", {
|
|
774
774
|
"data-title": "",
|
|
775
|
-
className:
|
|
775
|
+
className: X(w?.title, n?.classNames?.title)
|
|
776
776
|
}, n.jsx ? n.jsx : typeof n.title == "function" ? n.title() : n.title), n.description ? /*#__PURE__*/ h.createElement("div", {
|
|
777
777
|
"data-description": "",
|
|
778
|
-
className:
|
|
779
|
-
}, typeof n.description == "function" ? n.description() : n.description) : null), /*#__PURE__*/ h.isValidElement(n.cancel) ? n.cancel : n.cancel &&
|
|
778
|
+
className: X(y, pe, w?.description, n?.classNames?.description)
|
|
779
|
+
}, typeof n.description == "function" ? n.description() : n.description) : null), /*#__PURE__*/ h.isValidElement(n.cancel) ? n.cancel : n.cancel && J(n.cancel) ? /*#__PURE__*/ h.createElement("button", {
|
|
780
780
|
"data-button": !0,
|
|
781
781
|
"data-cancel": !0,
|
|
782
782
|
style: n.cancelButtonStyle || g,
|
|
783
783
|
onClick: (e) => {
|
|
784
|
-
|
|
784
|
+
J(n.cancel) && H && (n.cancel.onClick == null || n.cancel.onClick.call(n.cancel, e), Q());
|
|
785
785
|
},
|
|
786
|
-
className:
|
|
787
|
-
}, n.cancel.label) : null, /*#__PURE__*/ h.isValidElement(n.action) ? n.action : n.action &&
|
|
786
|
+
className: X(w?.cancelButton, n?.classNames?.cancelButton)
|
|
787
|
+
}, n.cancel.label) : null, /*#__PURE__*/ h.isValidElement(n.action) ? n.action : n.action && J(n.action) ? /*#__PURE__*/ h.createElement("button", {
|
|
788
788
|
"data-button": !0,
|
|
789
789
|
"data-action": !0,
|
|
790
790
|
style: n.actionButtonStyle || _,
|
|
791
791
|
onClick: (e) => {
|
|
792
|
-
|
|
792
|
+
J(n.action) && (n.action.onClick == null || n.action.onClick.call(n.action, e), e.defaultPrevented || Q());
|
|
793
793
|
},
|
|
794
|
-
className:
|
|
794
|
+
className: X(w?.actionButton, n?.classNames?.actionButton)
|
|
795
795
|
}, n.action.label) : null);
|
|
796
796
|
};
|
|
797
|
-
function
|
|
797
|
+
function Q() {
|
|
798
798
|
if (typeof window > "u" || typeof document > "u") return "ltr";
|
|
799
799
|
let e = document.documentElement.getAttribute("dir");
|
|
800
800
|
return e === "auto" || !e ? window.getComputedStyle(document.documentElement).direction : e;
|
|
801
801
|
}
|
|
802
|
-
function
|
|
802
|
+
function De(e, t) {
|
|
803
803
|
let n = {};
|
|
804
804
|
return [e, t].forEach((e, t) => {
|
|
805
|
-
let r = t === 1, i = r ? "--mobile-offset" : "--offset", a = r ?
|
|
805
|
+
let r = t === 1, i = r ? "--mobile-offset" : "--offset", a = r ? xe : be;
|
|
806
806
|
function o(e) {
|
|
807
807
|
[
|
|
808
808
|
"top",
|
|
@@ -823,11 +823,11 @@ function Ee(e, t) {
|
|
|
823
823
|
}) : o(a);
|
|
824
824
|
}), n;
|
|
825
825
|
}
|
|
826
|
-
var
|
|
827
|
-
let { id: n, invert: r, position: i = "bottom-right", hotkey: a = ["altKey", "KeyT"], expand: o, closeButton: s, className: c, offset: l, mobileOffset: u, theme: d = "light", richColors: f, duration: p, style: m, visibleToasts: g =
|
|
828
|
-
w((t) => (t.find((t) => t.id === e.id)?.delete ||
|
|
826
|
+
var Oe = /*#__PURE__*/ h.forwardRef(function(e, t) {
|
|
827
|
+
let { id: n, invert: r, position: i = "bottom-right", hotkey: a = ["altKey", "KeyT"], expand: o, closeButton: s, className: c, offset: l, mobileOffset: u, theme: d = "light", richColors: f, duration: p, style: m, visibleToasts: g = ye, toastOptions: _, dir: v = Q(), gap: y = Ce, icons: b, customAriaLabel: x, containerAriaLabel: S = "Notifications" } = e, [C, w] = h.useState([]), T = h.useMemo(() => n ? C.filter((e) => e.toasterId === n) : C.filter((e) => !e.toasterId), [C, n]), ee = h.useMemo(() => Array.from(new Set([i].concat(T.filter((e) => e.position).map((e) => e.position)))), [T, i]), [E, D] = h.useState([]), [te, O] = h.useState(!1), [k, A] = h.useState(!1), [re, j] = h.useState(d === "system" ? typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : d), M = h.useRef(null), ie = a.join("+").replace(/Key/g, "").replace(/Digit/g, ""), N = h.useRef(null), P = h.useRef(!1), F = h.useCallback((e) => {
|
|
828
|
+
w((t) => (t.find((t) => t.id === e.id)?.delete || G.dismiss(e.id), t.filter(({ id: t }) => t !== e.id)));
|
|
829
829
|
}, []);
|
|
830
|
-
return h.useEffect(() =>
|
|
830
|
+
return h.useEffect(() => G.subscribe((e) => {
|
|
831
831
|
e.dismiss ? requestAnimationFrame(() => {
|
|
832
832
|
w((t) => t.map((t) => t.id === e.id ? {
|
|
833
833
|
...t,
|
|
@@ -850,19 +850,19 @@ var De = /*#__PURE__*/ h.forwardRef(function(e, t) {
|
|
|
850
850
|
});
|
|
851
851
|
}), []), h.useEffect(() => {
|
|
852
852
|
if (d !== "system") {
|
|
853
|
-
|
|
853
|
+
j(d);
|
|
854
854
|
return;
|
|
855
855
|
}
|
|
856
|
-
if (d === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ?
|
|
856
|
+
if (d === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? j("dark") : j("light")), typeof window > "u") return;
|
|
857
857
|
let e = window.matchMedia("(prefers-color-scheme: dark)");
|
|
858
858
|
try {
|
|
859
859
|
e.addEventListener("change", ({ matches: e }) => {
|
|
860
|
-
|
|
860
|
+
j(e ? "dark" : "light");
|
|
861
861
|
});
|
|
862
862
|
} catch {
|
|
863
863
|
e.addListener(({ matches: e }) => {
|
|
864
864
|
try {
|
|
865
|
-
|
|
865
|
+
j(e ? "dark" : "light");
|
|
866
866
|
} catch (e) {
|
|
867
867
|
console.error(e);
|
|
868
868
|
}
|
|
@@ -874,18 +874,18 @@ var De = /*#__PURE__*/ h.forwardRef(function(e, t) {
|
|
|
874
874
|
let e = (e) => {
|
|
875
875
|
if (a.length > 0 && a.every((t) => e[t] || e.code === t)) {
|
|
876
876
|
var t;
|
|
877
|
-
O(!0), (t =
|
|
877
|
+
O(!0), (t = M.current) == null || t.focus();
|
|
878
878
|
}
|
|
879
|
-
e.code === "Escape" && (document.activeElement ===
|
|
879
|
+
e.code === "Escape" && (document.activeElement === M.current || M.current?.contains(document.activeElement)) && O(!1);
|
|
880
880
|
};
|
|
881
881
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
882
882
|
}, [a]), h.useEffect(() => {
|
|
883
|
-
if (
|
|
884
|
-
|
|
883
|
+
if (M.current) return () => {
|
|
884
|
+
N.current && (N.current.focus({ preventScroll: !0 }), N.current = null, P.current = !1);
|
|
885
885
|
};
|
|
886
|
-
}, [
|
|
886
|
+
}, [M.current]), /*#__PURE__*/ h.createElement("section", {
|
|
887
887
|
ref: t,
|
|
888
|
-
"aria-label": x ?? `${S} ${
|
|
888
|
+
"aria-label": x ?? `${S} ${ie}`,
|
|
889
889
|
tabIndex: -1,
|
|
890
890
|
"aria-live": "polite",
|
|
891
891
|
"aria-relevant": "additions text",
|
|
@@ -896,26 +896,26 @@ var De = /*#__PURE__*/ h.forwardRef(function(e, t) {
|
|
|
896
896
|
let [i, a] = t.split("-");
|
|
897
897
|
return T.length ? /*#__PURE__*/ h.createElement("ol", {
|
|
898
898
|
key: t,
|
|
899
|
-
dir: v === "auto" ?
|
|
899
|
+
dir: v === "auto" ? Q() : v,
|
|
900
900
|
tabIndex: -1,
|
|
901
|
-
ref:
|
|
901
|
+
ref: M,
|
|
902
902
|
className: c,
|
|
903
903
|
"data-sonner-toaster": !0,
|
|
904
|
-
"data-sonner-theme":
|
|
904
|
+
"data-sonner-theme": re,
|
|
905
905
|
"data-y-position": i,
|
|
906
906
|
"data-x-position": a,
|
|
907
907
|
style: {
|
|
908
908
|
"--front-toast-height": `${E[0]?.height || 0}px`,
|
|
909
|
-
"--width": `${
|
|
909
|
+
"--width": `${Y}px`,
|
|
910
910
|
"--gap": `${y}px`,
|
|
911
911
|
...m,
|
|
912
|
-
...
|
|
912
|
+
...De(l, u)
|
|
913
913
|
},
|
|
914
914
|
onBlur: (e) => {
|
|
915
|
-
|
|
915
|
+
P.current && !e.currentTarget.contains(e.relatedTarget) && (P.current = !1, N.current &&= (N.current.focus({ preventScroll: !0 }), null));
|
|
916
916
|
},
|
|
917
917
|
onFocus: (e) => {
|
|
918
|
-
e.target instanceof HTMLElement && e.target.dataset.dismissible === "false" ||
|
|
918
|
+
e.target instanceof HTMLElement && e.target.dataset.dismissible === "false" || P.current || (P.current = !0, N.current = e.relatedTarget);
|
|
919
919
|
},
|
|
920
920
|
onMouseEnter: () => O(!0),
|
|
921
921
|
onMouseMove: () => O(!0),
|
|
@@ -927,7 +927,7 @@ var De = /*#__PURE__*/ h.forwardRef(function(e, t) {
|
|
|
927
927
|
e.target instanceof HTMLElement && e.target.dataset.dismissible === "false" || A(!0);
|
|
928
928
|
},
|
|
929
929
|
onPointerUp: () => A(!1)
|
|
930
|
-
}, T.filter((e) => !e.position && n === 0 || e.position === t).map((n, i) => /*#__PURE__*/ h.createElement(
|
|
930
|
+
}, T.filter((e) => !e.position && n === 0 || e.position === t).map((n, i) => /*#__PURE__*/ h.createElement(Z, {
|
|
931
931
|
key: n.id,
|
|
932
932
|
icons: b,
|
|
933
933
|
index: i,
|
|
@@ -947,7 +947,7 @@ var De = /*#__PURE__*/ h.forwardRef(function(e, t) {
|
|
|
947
947
|
cancelButtonStyle: _?.cancelButtonStyle,
|
|
948
948
|
actionButtonStyle: _?.actionButtonStyle,
|
|
949
949
|
closeButtonAriaLabel: _?.closeButtonAriaLabel,
|
|
950
|
-
removeToast:
|
|
950
|
+
removeToast: F,
|
|
951
951
|
toasts: T.filter((e) => e.position == n.position),
|
|
952
952
|
heights: E.filter((e) => e.position == n.position),
|
|
953
953
|
setHeights: D,
|
|
@@ -958,9 +958,48 @@ var De = /*#__PURE__*/ h.forwardRef(function(e, t) {
|
|
|
958
958
|
}))) : null;
|
|
959
959
|
}));
|
|
960
960
|
});
|
|
961
|
+
// packages/feedback/src/notifications.ts
|
|
962
|
+
function $({ title: e, shouldPersist: t, ...n }) {
|
|
963
|
+
let r = {
|
|
964
|
+
...n,
|
|
965
|
+
description: n.description,
|
|
966
|
+
action: n.action ?? null,
|
|
967
|
+
duration: 4e3
|
|
968
|
+
};
|
|
969
|
+
return (t === !0 || n.action !== void 0) && (r.duration = Infinity), r;
|
|
970
|
+
}
|
|
971
|
+
function ke(e) {
|
|
972
|
+
return q.success(e.title, $(e));
|
|
973
|
+
}
|
|
974
|
+
function Ae(e) {
|
|
975
|
+
return q.error(e.title, $(e));
|
|
976
|
+
}
|
|
977
|
+
function je(e) {
|
|
978
|
+
return q.info(e.title, $(e));
|
|
979
|
+
}
|
|
980
|
+
function Me(e) {
|
|
981
|
+
return q.warning(e.title, $(e));
|
|
982
|
+
}
|
|
983
|
+
function Ne(e) {
|
|
984
|
+
return q.loading(e.title, {
|
|
985
|
+
...$(e),
|
|
986
|
+
duration: Infinity
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
function Pe({ id: e }) {
|
|
990
|
+
q.dismiss(e);
|
|
991
|
+
}
|
|
992
|
+
var Fe = {
|
|
993
|
+
success: ke,
|
|
994
|
+
error: Ae,
|
|
995
|
+
info: je,
|
|
996
|
+
warning: Me,
|
|
997
|
+
loading: Ne,
|
|
998
|
+
dismiss: Pe
|
|
999
|
+
};
|
|
961
1000
|
// packages/feedback/src/toast.tsx
|
|
962
|
-
function
|
|
963
|
-
return /* @__PURE__ */ S(
|
|
1001
|
+
function Ie({ closeButton: e = !0, closeButtonAriaLabel: t = "Dismiss notification", offset: n = u.xl, mobileOffset: r = u.lg, ...i }) {
|
|
1002
|
+
return /* @__PURE__ */ S(Oe, {
|
|
964
1003
|
...i,
|
|
965
1004
|
className: "x7kce61 xkwcdv0 x19hn9gq x350ok5 x1dknavn x1qgcmqu x19j7ixz xgam3oh x7s97pk",
|
|
966
1005
|
style: {
|
|
@@ -1002,8 +1041,8 @@ function Oe({ closeButton: e = !0, closeButtonAriaLabel: t = "Dismiss notificati
|
|
|
1002
1041
|
style: { transitionProperty: "opacity, transform" },
|
|
1003
1042
|
classNames: {
|
|
1004
1043
|
toast: { className: "x1bl4301 x78zum5 x1a02dak x6s0dn4 x1hnptsi x1mvvolr xx4ccz x1l38xx4 xmkeg23 x1y0btm7 x1ey3b81 xy32g2j xpvm0e4 xbixft x16hm2kh x1hz01jw xvmahel xtqrqnz x1778rvt xj57cvi x7kce61 xkwcdv0 x19hn9gq x350ok5 x1dknavn x1qgcmqu x19j7ixz xgam3oh x7s97pk x-default-marker" }.className ?? "",
|
|
1005
|
-
title: { className: "xk4h15q x104kibb x1ua5tub
|
|
1006
|
-
description: { className: "x153jb6y x104kibb x1ua5tub
|
|
1044
|
+
title: { className: "xk4h15q x104kibb x1ua5tub xh0615m xb3r6kr xj0a0fe" }.className ?? "",
|
|
1045
|
+
description: { className: "x153jb6y x104kibb x1ua5tub xh0615m xb3r6kr xj0a0fe" }.className ?? "",
|
|
1007
1046
|
content: { className: "x78zum5 xdt5ytf x148l3ej xeuugli xfko13i x1hc1fzr xnglhca x19991ni xkwcdv0 x19hn9gq" }.className ?? "",
|
|
1008
1047
|
icon: { className: "x78zum5 x1n2onr6 x2lah0s xtwnzbg x18utl2x x1hc1fzr xnglhca x19991ni xkwcdv0 x19hn9gq" }.className ?? "",
|
|
1009
1048
|
loader: { className: "x7kce61 xkwcdv0 x19hn9gq x350ok5 x1dknavn" }.className ?? "",
|
|
@@ -1015,7 +1054,7 @@ function Oe({ closeButton: e = !0, closeButtonAriaLabel: t = "Dismiss notificati
|
|
|
1015
1054
|
});
|
|
1016
1055
|
}
|
|
1017
1056
|
// packages/feedback/src/async-region.tsx
|
|
1018
|
-
var
|
|
1057
|
+
var Le = g(void 0), Re = g(!1), ze = o.delaySeconds * 1e3, Be = {
|
|
1019
1058
|
content: {
|
|
1020
1059
|
k7Eaqz: "xeuugli",
|
|
1021
1060
|
kAzted: "x2lwn1j",
|
|
@@ -1034,11 +1073,11 @@ var ke = g(void 0), Ae = g(!1), je = o.delaySeconds * 1e3, Me = {
|
|
|
1034
1073
|
k44tkh: "x11hm9ij",
|
|
1035
1074
|
$$css: !0
|
|
1036
1075
|
}
|
|
1037
|
-
},
|
|
1076
|
+
}, Ve = {
|
|
1038
1077
|
content: null,
|
|
1039
|
-
image:
|
|
1078
|
+
image: Be.imageReveal
|
|
1040
1079
|
};
|
|
1041
|
-
function
|
|
1080
|
+
function He({ identity: e, initialStartedAt: t, children: n }) {
|
|
1042
1081
|
let [r, i] = b(() => ({
|
|
1043
1082
|
identity: e,
|
|
1044
1083
|
startedAt: t ?? Date.now()
|
|
@@ -1046,13 +1085,13 @@ function Pe({ identity: e, initialStartedAt: t, children: n }) {
|
|
|
1046
1085
|
return r.identity !== e && (a = {
|
|
1047
1086
|
identity: e,
|
|
1048
1087
|
startedAt: Date.now()
|
|
1049
|
-
}, i(a)), /* @__PURE__ */ S(
|
|
1088
|
+
}, i(a)), /* @__PURE__ */ S(Le, {
|
|
1050
1089
|
value: a,
|
|
1051
1090
|
children: n
|
|
1052
1091
|
});
|
|
1053
1092
|
}
|
|
1054
|
-
function
|
|
1055
|
-
let r = _(
|
|
1093
|
+
function Ue({ shouldEnter: e, presentation: t = "content", children: n }) {
|
|
1094
|
+
let r = _(Re), [i, a] = b(e && !r), o = y(null);
|
|
1056
1095
|
return v(() => {
|
|
1057
1096
|
let e = o.current;
|
|
1058
1097
|
if (!i || e === null) return;
|
|
@@ -1064,17 +1103,17 @@ function Fe({ shouldEnter: e, presentation: t = "content", children: n }) {
|
|
|
1064
1103
|
};
|
|
1065
1104
|
}, [i]), /* @__PURE__ */ S("div", {
|
|
1066
1105
|
ref: o,
|
|
1067
|
-
...m.props(
|
|
1068
|
-
children: /* @__PURE__ */ S(
|
|
1106
|
+
...m.props(Be.content, i && Be.reveal, Ve[t]),
|
|
1107
|
+
children: /* @__PURE__ */ S(Re, {
|
|
1069
1108
|
value: r || i,
|
|
1070
1109
|
children: n
|
|
1071
1110
|
})
|
|
1072
1111
|
});
|
|
1073
1112
|
}
|
|
1074
|
-
function
|
|
1075
|
-
let [i, a] = b(() => Date.now() - n >=
|
|
1113
|
+
function We({ label: e, placeholder: t, startedAt: n, presentation: r }) {
|
|
1114
|
+
let [i, a] = b(() => Date.now() - n >= ze ? n : void 0), o = i === n, s = r === "image";
|
|
1076
1115
|
return v(() => {
|
|
1077
|
-
let e = Math.max(0,
|
|
1116
|
+
let e = Math.max(0, ze - (Date.now() - n)), t = setTimeout(() => a(n), e);
|
|
1078
1117
|
return () => clearTimeout(t);
|
|
1079
1118
|
}, [n]), /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("div", {
|
|
1080
1119
|
"aria-busy": !0,
|
|
@@ -1096,8 +1135,8 @@ function Ie({ label: e, placeholder: t, startedAt: n, presentation: r }) {
|
|
|
1096
1135
|
children: e
|
|
1097
1136
|
})] });
|
|
1098
1137
|
}
|
|
1099
|
-
function
|
|
1100
|
-
let t = _(
|
|
1138
|
+
function Ge(e) {
|
|
1139
|
+
let t = _(Le), [n, r] = b(() => ({
|
|
1101
1140
|
state: e.state,
|
|
1102
1141
|
scope: t,
|
|
1103
1142
|
startedAt: t?.startedAt ?? Date.now(),
|
|
@@ -1114,7 +1153,7 @@ function Le(e) {
|
|
|
1114
1153
|
}
|
|
1115
1154
|
return /* @__PURE__ */ S("div", {
|
|
1116
1155
|
className: "x1n2onr6 xeuugli x2lwn1j x78zum5 xdt5ytf x98rzlu",
|
|
1117
|
-
children: e.state === "pending" ? /* @__PURE__ */ S(
|
|
1156
|
+
children: e.state === "pending" ? /* @__PURE__ */ S(We, {
|
|
1118
1157
|
label: e.label,
|
|
1119
1158
|
placeholder: e.placeholder,
|
|
1120
1159
|
startedAt: i.startedAt,
|
|
@@ -1122,11 +1161,11 @@ function Le(e) {
|
|
|
1122
1161
|
}) : e.state === "failed" ? /* @__PURE__ */ S("div", {
|
|
1123
1162
|
className: "xeuugli x2lwn1j x78zum5 xdt5ytf x98rzlu",
|
|
1124
1163
|
children: e.children
|
|
1125
|
-
}) : /* @__PURE__ */ S(
|
|
1164
|
+
}) : /* @__PURE__ */ S(Ue, {
|
|
1126
1165
|
shouldEnter: i.wasPending,
|
|
1127
1166
|
presentation: e.presentation ?? "content",
|
|
1128
1167
|
children: e.children
|
|
1129
1168
|
})
|
|
1130
1169
|
});
|
|
1131
1170
|
}
|
|
1132
|
-
export {
|
|
1171
|
+
export { Fe as a, z as c, N as d, P as f, j as h, Ie as i, oe as l, re as m, Ue as n, V as o, F as p, He as r, ce as s, Ge as t, R as u };
|