@pittorica/toast-react 0.23.2 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +263 -293
- package/package.json +8 -9
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { createPortal as
|
|
1
|
+
import { jsx as $, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as X, createElement as L, useState as O, useRef as V, useCallback as D, useEffect as G } from "react";
|
|
3
|
+
import { createPortal as H } from "react-dom";
|
|
4
4
|
/**
|
|
5
5
|
* @license @tabler/icons-react v3.36.1 - MIT
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license.
|
|
8
8
|
* See the LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
var
|
|
10
|
+
var J = {
|
|
11
11
|
outline: {
|
|
12
12
|
xmlns: "http://www.w3.org/2000/svg",
|
|
13
13
|
width: 24,
|
|
@@ -34,27 +34,27 @@ var K = {
|
|
|
34
34
|
* This source code is licensed under the MIT license.
|
|
35
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
36
36
|
*/
|
|
37
|
-
const
|
|
38
|
-
const o =
|
|
39
|
-
({ color:
|
|
37
|
+
const K = (r, e, t, i) => {
|
|
38
|
+
const o = X(
|
|
39
|
+
({ color: c = "currentColor", size: n = 24, stroke: p = 2, title: s, className: l, children: d, ...g }, f) => L(
|
|
40
40
|
"svg",
|
|
41
41
|
{
|
|
42
42
|
ref: f,
|
|
43
|
-
...
|
|
44
|
-
width:
|
|
45
|
-
height:
|
|
46
|
-
className: ["tabler-icon", `tabler-icon-${
|
|
47
|
-
fill:
|
|
48
|
-
...
|
|
43
|
+
...J[r],
|
|
44
|
+
width: n,
|
|
45
|
+
height: n,
|
|
46
|
+
className: ["tabler-icon", `tabler-icon-${e}`, l].join(" "),
|
|
47
|
+
fill: c,
|
|
48
|
+
...g
|
|
49
49
|
},
|
|
50
50
|
[
|
|
51
|
-
s &&
|
|
52
|
-
...
|
|
51
|
+
s && L("title", { key: "svg-title" }, s),
|
|
52
|
+
...i.map(([v, u]) => L(v, u)),
|
|
53
53
|
...Array.isArray(d) ? d : [d]
|
|
54
54
|
]
|
|
55
55
|
)
|
|
56
56
|
);
|
|
57
|
-
return o.displayName = `${
|
|
57
|
+
return o.displayName = `${t}`, o;
|
|
58
58
|
};
|
|
59
59
|
/**
|
|
60
60
|
* @license @tabler/icons-react v3.36.1 - MIT
|
|
@@ -62,284 +62,249 @@ const Q = (e, i, r, t) => {
|
|
|
62
62
|
* This source code is licensed under the MIT license.
|
|
63
63
|
* See the LICENSE file in the root directory of this source tree.
|
|
64
64
|
*/
|
|
65
|
-
const
|
|
66
|
-
function
|
|
67
|
-
var
|
|
68
|
-
if (typeof
|
|
69
|
-
else if (typeof
|
|
70
|
-
var o =
|
|
71
|
-
for (
|
|
72
|
-
} else for (
|
|
73
|
-
return
|
|
65
|
+
const Q = [["path", { d: "M12 2l.324 .001l.318 .004l.616 .017l.299 .013l.579 .034l.553 .046c4.785 .464 6.732 2.411 7.196 7.196l.046 .553l.034 .579c.005 .098 .01 .198 .013 .299l.017 .616l.005 .642l-.005 .642l-.017 .616l-.013 .299l-.034 .579l-.046 .553c-.464 4.785 -2.411 6.732 -7.196 7.196l-.553 .046l-.579 .034c-.098 .005 -.198 .01 -.299 .013l-.616 .017l-.642 .005l-.642 -.005l-.616 -.017l-.299 -.013l-.579 -.034l-.553 -.046c-4.785 -.464 -6.732 -2.411 -7.196 -7.196l-.046 -.553l-.034 -.579a28.058 28.058 0 0 1 -.013 -.299l-.017 -.616c-.003 -.21 -.005 -.424 -.005 -.642l.001 -.324l.004 -.318l.017 -.616l.013 -.299l.034 -.579l.046 -.553c.464 -4.785 2.411 -6.732 7.196 -7.196l.553 -.046l.579 -.034c.098 -.005 .198 -.01 .299 -.013l.616 -.017c.21 -.003 .424 -.005 .642 -.005zm-1.489 7.14a1 1 0 0 0 -1.218 1.567l1.292 1.293l-1.292 1.293l-.083 .094a1 1 0 0 0 1.497 1.32l1.293 -1.292l1.293 1.292l.094 .083a1 1 0 0 0 1.32 -1.497l-1.292 -1.293l1.292 -1.293l.083 -.094a1 1 0 0 0 -1.497 -1.32l-1.293 1.292l-1.293 -1.292l-.094 -.083z", fill: "currentColor", key: "svg-0", strokeWidth: "0" }]], U = K("filled", "square-rounded-x-filled", "SquareRoundedXFilled", Q);
|
|
66
|
+
function S(r) {
|
|
67
|
+
var e, t, i = "";
|
|
68
|
+
if (typeof r == "string" || typeof r == "number") i += r;
|
|
69
|
+
else if (typeof r == "object") if (Array.isArray(r)) {
|
|
70
|
+
var o = r.length;
|
|
71
|
+
for (e = 0; e < o; e++) r[e] && (t = S(r[e])) && (i && (i += " "), i += t);
|
|
72
|
+
} else for (t in r) r[t] && (i && (i += " "), i += t);
|
|
73
|
+
return i;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
for (var
|
|
77
|
-
return
|
|
75
|
+
function Y() {
|
|
76
|
+
for (var r, e, t = 0, i = "", o = arguments.length; t < o; t++) (r = arguments[t]) && (e = S(r)) && (i && (i += " "), i += e);
|
|
77
|
+
return i;
|
|
78
78
|
}
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
children: r,
|
|
79
|
+
const k = ({
|
|
80
|
+
as: r,
|
|
81
|
+
children: e,
|
|
83
82
|
display: t,
|
|
84
|
-
m:
|
|
85
|
-
mt:
|
|
83
|
+
m: i,
|
|
84
|
+
mt: o,
|
|
86
85
|
mr: c,
|
|
87
|
-
mb:
|
|
88
|
-
ml:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
disabled: R,
|
|
106
|
-
...B
|
|
86
|
+
mb: n,
|
|
87
|
+
ml: p,
|
|
88
|
+
mx: s,
|
|
89
|
+
my: l,
|
|
90
|
+
p: d,
|
|
91
|
+
pt: g,
|
|
92
|
+
pr: f,
|
|
93
|
+
pb: v,
|
|
94
|
+
pl: u,
|
|
95
|
+
px: m,
|
|
96
|
+
py: h,
|
|
97
|
+
width: y,
|
|
98
|
+
height: b,
|
|
99
|
+
position: x,
|
|
100
|
+
style: w,
|
|
101
|
+
className: T,
|
|
102
|
+
disabled: N,
|
|
103
|
+
...A
|
|
107
104
|
}) => {
|
|
108
|
-
const a = {};
|
|
109
|
-
t && (a.display = t),
|
|
110
|
-
const
|
|
111
|
-
...
|
|
105
|
+
const B = r || "div", a = {};
|
|
106
|
+
t && (a.display = t), y && (a.width = y), b && (a.height = b), x && (a.position = x), i && (a.margin = `var(--pittorica-space-${i})`), o && (a.marginTop = `var(--pittorica-space-${o})`), c && (a.marginRight = `var(--pittorica-space-${c})`), n && (a.marginBottom = `var(--pittorica-space-${n})`), p && (a.marginLeft = `var(--pittorica-space-${p})`), s && (a.marginLeft = `var(--pittorica-space-${s})`, a.marginRight = `var(--pittorica-space-${s})`), l && (a.marginTop = `var(--pittorica-space-${l})`, a.marginBottom = `var(--pittorica-space-${l})`), d && (a.padding = `var(--pittorica-space-${d})`), g && (a.paddingTop = `var(--pittorica-space-${g})`), f && (a.paddingRight = `var(--pittorica-space-${f})`), v && (a.paddingBottom = `var(--pittorica-space-${v})`), u && (a.paddingLeft = `var(--pittorica-space-${u})`), m && (a.paddingLeft = `var(--pittorica-space-${m})`, a.paddingRight = `var(--pittorica-space-${m})`), h && (a.paddingTop = `var(--pittorica-space-${h})`, a.paddingBottom = `var(--pittorica-space-${h})`);
|
|
107
|
+
const R = {
|
|
108
|
+
...w,
|
|
112
109
|
...a
|
|
113
110
|
};
|
|
114
|
-
return /* @__PURE__ */
|
|
115
|
-
|
|
111
|
+
return /* @__PURE__ */ $(
|
|
112
|
+
B,
|
|
116
113
|
{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
rel: x,
|
|
123
|
-
htmlFor: T,
|
|
124
|
-
type: A,
|
|
125
|
-
name: k,
|
|
126
|
-
disabled: R,
|
|
127
|
-
...B,
|
|
128
|
-
children: r
|
|
114
|
+
className: Y("pittorica-box", T),
|
|
115
|
+
style: R,
|
|
116
|
+
disabled: N,
|
|
117
|
+
...A,
|
|
118
|
+
children: e
|
|
129
119
|
}
|
|
130
120
|
);
|
|
131
121
|
};
|
|
132
|
-
|
|
133
|
-
function
|
|
134
|
-
var
|
|
135
|
-
if (typeof
|
|
136
|
-
else if (typeof
|
|
137
|
-
var o =
|
|
138
|
-
for (
|
|
139
|
-
} else for (
|
|
140
|
-
return
|
|
122
|
+
k.displayName = "Box";
|
|
123
|
+
function W(r) {
|
|
124
|
+
var e, t, i = "";
|
|
125
|
+
if (typeof r == "string" || typeof r == "number") i += r;
|
|
126
|
+
else if (typeof r == "object") if (Array.isArray(r)) {
|
|
127
|
+
var o = r.length;
|
|
128
|
+
for (e = 0; e < o; e++) r[e] && (t = W(r[e])) && (i && (i += " "), i += t);
|
|
129
|
+
} else for (t in r) r[t] && (i && (i += " "), i += t);
|
|
130
|
+
return i;
|
|
141
131
|
}
|
|
142
|
-
function
|
|
143
|
-
for (var
|
|
144
|
-
return
|
|
132
|
+
function Z() {
|
|
133
|
+
for (var r, e, t = 0, i = "", o = arguments.length; t < o; t++) (r = arguments[t]) && (e = W(r)) && (i && (i += " "), i += e);
|
|
134
|
+
return i;
|
|
145
135
|
}
|
|
146
|
-
function
|
|
147
|
-
var
|
|
148
|
-
if (typeof
|
|
149
|
-
else if (typeof
|
|
150
|
-
var o =
|
|
151
|
-
for (
|
|
152
|
-
} else for (
|
|
153
|
-
return
|
|
136
|
+
function q(r) {
|
|
137
|
+
var e, t, i = "";
|
|
138
|
+
if (typeof r == "string" || typeof r == "number") i += r;
|
|
139
|
+
else if (typeof r == "object") if (Array.isArray(r)) {
|
|
140
|
+
var o = r.length;
|
|
141
|
+
for (e = 0; e < o; e++) r[e] && (t = q(r[e])) && (i && (i += " "), i += t);
|
|
142
|
+
} else for (t in r) r[t] && (i && (i += " "), i += t);
|
|
143
|
+
return i;
|
|
154
144
|
}
|
|
155
|
-
function
|
|
156
|
-
for (var
|
|
157
|
-
return
|
|
145
|
+
function tt() {
|
|
146
|
+
for (var r, e, t = 0, i = "", o = arguments.length; t < o; t++) (r = arguments[t]) && (e = q(r)) && (i && (i += " "), i += e);
|
|
147
|
+
return i;
|
|
158
148
|
}
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
children: r,
|
|
149
|
+
const I = ({
|
|
150
|
+
as: r,
|
|
151
|
+
children: e,
|
|
163
152
|
display: t,
|
|
164
|
-
m:
|
|
165
|
-
mt:
|
|
153
|
+
m: i,
|
|
154
|
+
mt: o,
|
|
166
155
|
mr: c,
|
|
167
|
-
mb:
|
|
168
|
-
ml:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
disabled: R,
|
|
186
|
-
...B
|
|
156
|
+
mb: n,
|
|
157
|
+
ml: p,
|
|
158
|
+
mx: s,
|
|
159
|
+
my: l,
|
|
160
|
+
p: d,
|
|
161
|
+
pt: g,
|
|
162
|
+
pr: f,
|
|
163
|
+
pb: v,
|
|
164
|
+
pl: u,
|
|
165
|
+
px: m,
|
|
166
|
+
py: h,
|
|
167
|
+
width: y,
|
|
168
|
+
height: b,
|
|
169
|
+
position: x,
|
|
170
|
+
style: w,
|
|
171
|
+
className: T,
|
|
172
|
+
disabled: N,
|
|
173
|
+
...A
|
|
187
174
|
}) => {
|
|
188
|
-
const a = {};
|
|
189
|
-
t && (a.display = t),
|
|
190
|
-
const
|
|
191
|
-
...
|
|
175
|
+
const B = r || "div", a = {};
|
|
176
|
+
t && (a.display = t), y && (a.width = y), b && (a.height = b), x && (a.position = x), i && (a.margin = `var(--pittorica-space-${i})`), o && (a.marginTop = `var(--pittorica-space-${o})`), c && (a.marginRight = `var(--pittorica-space-${c})`), n && (a.marginBottom = `var(--pittorica-space-${n})`), p && (a.marginLeft = `var(--pittorica-space-${p})`), s && (a.marginLeft = `var(--pittorica-space-${s})`, a.marginRight = `var(--pittorica-space-${s})`), l && (a.marginTop = `var(--pittorica-space-${l})`, a.marginBottom = `var(--pittorica-space-${l})`), d && (a.padding = `var(--pittorica-space-${d})`), g && (a.paddingTop = `var(--pittorica-space-${g})`), f && (a.paddingRight = `var(--pittorica-space-${f})`), v && (a.paddingBottom = `var(--pittorica-space-${v})`), u && (a.paddingLeft = `var(--pittorica-space-${u})`), m && (a.paddingLeft = `var(--pittorica-space-${m})`, a.paddingRight = `var(--pittorica-space-${m})`), h && (a.paddingTop = `var(--pittorica-space-${h})`, a.paddingBottom = `var(--pittorica-space-${h})`);
|
|
177
|
+
const R = {
|
|
178
|
+
...w,
|
|
192
179
|
...a
|
|
193
180
|
};
|
|
194
|
-
return /* @__PURE__ */
|
|
195
|
-
|
|
181
|
+
return /* @__PURE__ */ $(
|
|
182
|
+
B,
|
|
196
183
|
{
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
rel: x,
|
|
203
|
-
htmlFor: T,
|
|
204
|
-
type: A,
|
|
205
|
-
name: k,
|
|
206
|
-
disabled: R,
|
|
207
|
-
...B,
|
|
208
|
-
children: r
|
|
184
|
+
className: tt("pittorica-box", T),
|
|
185
|
+
style: R,
|
|
186
|
+
disabled: N,
|
|
187
|
+
...A,
|
|
188
|
+
children: e
|
|
209
189
|
}
|
|
210
190
|
);
|
|
211
191
|
};
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
children:
|
|
215
|
-
variant:
|
|
216
|
-
color:
|
|
217
|
-
size:
|
|
192
|
+
I.displayName = "Box";
|
|
193
|
+
const _ = ({
|
|
194
|
+
children: r,
|
|
195
|
+
variant: e = "filled",
|
|
196
|
+
color: t = "indigo",
|
|
197
|
+
size: i = "3",
|
|
218
198
|
className: o,
|
|
219
|
-
style:
|
|
220
|
-
|
|
221
|
-
...
|
|
199
|
+
style: c,
|
|
200
|
+
as: n,
|
|
201
|
+
...p
|
|
222
202
|
}) => {
|
|
223
|
-
const s =
|
|
224
|
-
...
|
|
225
|
-
"--pittorica-source-color": s ? `var(--pittorica-${
|
|
203
|
+
const s = t !== "inherit" && !(t != null && t.startsWith("#")) && !(t != null && t.startsWith("rgb")), l = {
|
|
204
|
+
...c,
|
|
205
|
+
"--pittorica-source-color": s ? `var(--pittorica-${t}-9)` : t,
|
|
226
206
|
"--pittorica-on-source-color": "#ffffff"
|
|
227
|
-
};
|
|
228
|
-
return /* @__PURE__ */
|
|
229
|
-
|
|
207
|
+
}, d = n || (p.href ? "a" : "button");
|
|
208
|
+
return /* @__PURE__ */ $(
|
|
209
|
+
I,
|
|
230
210
|
{
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
ref: c,
|
|
234
|
-
className: tt(
|
|
211
|
+
as: d,
|
|
212
|
+
className: Z(
|
|
235
213
|
"pittorica-icon-button",
|
|
214
|
+
`pittorica-icon-button--${e}`,
|
|
236
215
|
`pittorica-icon-button--${i}`,
|
|
237
|
-
`pittorica-icon-button--${t}`,
|
|
238
216
|
o
|
|
239
217
|
),
|
|
240
|
-
style:
|
|
241
|
-
|
|
218
|
+
style: l,
|
|
219
|
+
...p,
|
|
220
|
+
children: r
|
|
242
221
|
}
|
|
243
222
|
);
|
|
244
223
|
};
|
|
245
|
-
|
|
246
|
-
function
|
|
247
|
-
var
|
|
248
|
-
if (typeof
|
|
249
|
-
else if (typeof
|
|
250
|
-
var o =
|
|
251
|
-
for (
|
|
252
|
-
} else for (
|
|
253
|
-
return
|
|
224
|
+
_.displayName = "IconButton";
|
|
225
|
+
function F(r) {
|
|
226
|
+
var e, t, i = "";
|
|
227
|
+
if (typeof r == "string" || typeof r == "number") i += r;
|
|
228
|
+
else if (typeof r == "object") if (Array.isArray(r)) {
|
|
229
|
+
var o = r.length;
|
|
230
|
+
for (e = 0; e < o; e++) r[e] && (t = F(r[e])) && (i && (i += " "), i += t);
|
|
231
|
+
} else for (t in r) r[t] && (i && (i += " "), i += t);
|
|
232
|
+
return i;
|
|
254
233
|
}
|
|
255
|
-
function
|
|
256
|
-
for (var
|
|
257
|
-
return
|
|
234
|
+
function E() {
|
|
235
|
+
for (var r, e, t = 0, i = "", o = arguments.length; t < o; t++) (r = arguments[t]) && (e = F(r)) && (i && (i += " "), i += e);
|
|
236
|
+
return i;
|
|
258
237
|
}
|
|
259
|
-
function
|
|
260
|
-
var
|
|
261
|
-
if (typeof
|
|
262
|
-
else if (typeof
|
|
263
|
-
var o =
|
|
264
|
-
for (
|
|
265
|
-
} else for (
|
|
266
|
-
return
|
|
238
|
+
function M(r) {
|
|
239
|
+
var e, t, i = "";
|
|
240
|
+
if (typeof r == "string" || typeof r == "number") i += r;
|
|
241
|
+
else if (typeof r == "object") if (Array.isArray(r)) {
|
|
242
|
+
var o = r.length;
|
|
243
|
+
for (e = 0; e < o; e++) r[e] && (t = M(r[e])) && (i && (i += " "), i += t);
|
|
244
|
+
} else for (t in r) r[t] && (i && (i += " "), i += t);
|
|
245
|
+
return i;
|
|
267
246
|
}
|
|
268
247
|
function it() {
|
|
269
|
-
for (var
|
|
270
|
-
return
|
|
248
|
+
for (var r, e, t = 0, i = "", o = arguments.length; t < o; t++) (r = arguments[t]) && (e = M(r)) && (i && (i += " "), i += e);
|
|
249
|
+
return i;
|
|
271
250
|
}
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
children: r,
|
|
251
|
+
const P = ({
|
|
252
|
+
as: r,
|
|
253
|
+
children: e,
|
|
276
254
|
display: t,
|
|
277
|
-
m:
|
|
278
|
-
mt:
|
|
255
|
+
m: i,
|
|
256
|
+
mt: o,
|
|
279
257
|
mr: c,
|
|
280
|
-
mb:
|
|
281
|
-
ml:
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
disabled: R,
|
|
299
|
-
...B
|
|
258
|
+
mb: n,
|
|
259
|
+
ml: p,
|
|
260
|
+
mx: s,
|
|
261
|
+
my: l,
|
|
262
|
+
p: d,
|
|
263
|
+
pt: g,
|
|
264
|
+
pr: f,
|
|
265
|
+
pb: v,
|
|
266
|
+
pl: u,
|
|
267
|
+
px: m,
|
|
268
|
+
py: h,
|
|
269
|
+
width: y,
|
|
270
|
+
height: b,
|
|
271
|
+
position: x,
|
|
272
|
+
style: w,
|
|
273
|
+
className: T,
|
|
274
|
+
disabled: N,
|
|
275
|
+
...A
|
|
300
276
|
}) => {
|
|
301
|
-
const a = {};
|
|
302
|
-
t && (a.display = t),
|
|
303
|
-
const
|
|
304
|
-
...
|
|
277
|
+
const B = r || "div", a = {};
|
|
278
|
+
t && (a.display = t), y && (a.width = y), b && (a.height = b), x && (a.position = x), i && (a.margin = `var(--pittorica-space-${i})`), o && (a.marginTop = `var(--pittorica-space-${o})`), c && (a.marginRight = `var(--pittorica-space-${c})`), n && (a.marginBottom = `var(--pittorica-space-${n})`), p && (a.marginLeft = `var(--pittorica-space-${p})`), s && (a.marginLeft = `var(--pittorica-space-${s})`, a.marginRight = `var(--pittorica-space-${s})`), l && (a.marginTop = `var(--pittorica-space-${l})`, a.marginBottom = `var(--pittorica-space-${l})`), d && (a.padding = `var(--pittorica-space-${d})`), g && (a.paddingTop = `var(--pittorica-space-${g})`), f && (a.paddingRight = `var(--pittorica-space-${f})`), v && (a.paddingBottom = `var(--pittorica-space-${v})`), u && (a.paddingLeft = `var(--pittorica-space-${u})`), m && (a.paddingLeft = `var(--pittorica-space-${m})`, a.paddingRight = `var(--pittorica-space-${m})`), h && (a.paddingTop = `var(--pittorica-space-${h})`, a.paddingBottom = `var(--pittorica-space-${h})`);
|
|
279
|
+
const R = {
|
|
280
|
+
...w,
|
|
305
281
|
...a
|
|
306
282
|
};
|
|
307
|
-
return /* @__PURE__ */
|
|
308
|
-
|
|
283
|
+
return /* @__PURE__ */ $(
|
|
284
|
+
B,
|
|
309
285
|
{
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
rel: x,
|
|
316
|
-
htmlFor: T,
|
|
317
|
-
type: A,
|
|
318
|
-
name: k,
|
|
319
|
-
disabled: R,
|
|
320
|
-
...B,
|
|
321
|
-
children: r
|
|
286
|
+
className: it("pittorica-box", T),
|
|
287
|
+
style: R,
|
|
288
|
+
disabled: N,
|
|
289
|
+
...A,
|
|
290
|
+
children: e
|
|
322
291
|
}
|
|
323
292
|
);
|
|
324
293
|
};
|
|
325
|
-
|
|
326
|
-
const
|
|
327
|
-
children:
|
|
328
|
-
as:
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
294
|
+
P.displayName = "Box";
|
|
295
|
+
const z = ({
|
|
296
|
+
children: r,
|
|
297
|
+
as: e,
|
|
298
|
+
size: t,
|
|
299
|
+
weight: i = "regular",
|
|
300
|
+
align: o,
|
|
301
|
+
truncate: c = !1,
|
|
332
302
|
color: n,
|
|
333
|
-
className:
|
|
334
|
-
style:
|
|
335
|
-
|
|
336
|
-
target: p,
|
|
337
|
-
rel: d,
|
|
338
|
-
htmlFor: m,
|
|
339
|
-
name: f,
|
|
340
|
-
...g
|
|
303
|
+
className: p,
|
|
304
|
+
style: s,
|
|
305
|
+
...l
|
|
341
306
|
}) => {
|
|
342
|
-
const
|
|
307
|
+
const d = e || "span", g = (n == null ? void 0 : n.startsWith("#")) || (n == null ? void 0 : n.startsWith("rgb")) || (n == null ? void 0 : n.startsWith("hsl")), f = /* @__PURE__ */ new Set([
|
|
343
308
|
"danger",
|
|
344
309
|
"success",
|
|
345
310
|
"error",
|
|
@@ -353,81 +318,86 @@ const S = ({
|
|
|
353
318
|
"red"
|
|
354
319
|
]), v = (() => {
|
|
355
320
|
if (n)
|
|
356
|
-
return n === "inherit" ? "inherit" :
|
|
357
|
-
})(),
|
|
358
|
-
|
|
359
|
-
|
|
321
|
+
return n === "inherit" ? "inherit" : g ? n : f.has(n) ? `var(--pittorica-${n}-9)` : n;
|
|
322
|
+
})(), u = t ? typeof t == "string" ? `pittorica-text--size-${t}` : E({
|
|
323
|
+
[`pittorica-text--size-${t.initial}`]: t.initial,
|
|
324
|
+
[`pittorica-text--xs-size-${t.xs}`]: t.xs,
|
|
325
|
+
[`pittorica-text--sm-size-${t.sm}`]: t.sm,
|
|
326
|
+
[`pittorica-text--md-size-${t.md}`]: t.md,
|
|
327
|
+
[`pittorica-text--lg-size-${t.lg}`]: t.lg,
|
|
328
|
+
[`pittorica-text--xl-size-${t.xl}`]: t.xl
|
|
329
|
+
}) : null, m = {
|
|
330
|
+
...s,
|
|
331
|
+
textAlign: o,
|
|
360
332
|
color: v
|
|
361
333
|
};
|
|
362
|
-
return /* @__PURE__ */
|
|
363
|
-
|
|
334
|
+
return /* @__PURE__ */ $(
|
|
335
|
+
P,
|
|
364
336
|
{
|
|
365
|
-
as:
|
|
366
|
-
className:
|
|
337
|
+
as: d,
|
|
338
|
+
className: E(
|
|
367
339
|
"pittorica-text",
|
|
368
|
-
|
|
369
|
-
c
|
|
340
|
+
u,
|
|
341
|
+
{ "pittorica-text--truncate": c },
|
|
342
|
+
p
|
|
370
343
|
),
|
|
371
|
-
"data-weight":
|
|
372
|
-
style:
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
rel: d,
|
|
376
|
-
htmlFor: m,
|
|
377
|
-
name: f,
|
|
378
|
-
...g,
|
|
379
|
-
children: e
|
|
344
|
+
"data-weight": i,
|
|
345
|
+
style: m,
|
|
346
|
+
...l,
|
|
347
|
+
children: r
|
|
380
348
|
}
|
|
381
349
|
);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
350
|
+
};
|
|
351
|
+
z.displayName = "Text";
|
|
352
|
+
const j = "pittorica-toast", ot = (r) => {
|
|
353
|
+
const e = Math.random().toString(36).slice(2, 9), t = new CustomEvent(j, { detail: { ...r, id: e } });
|
|
354
|
+
globalThis.dispatchEvent(t);
|
|
355
|
+
}, nt = () => {
|
|
356
|
+
const [r, e] = O([]), t = V(/* @__PURE__ */ new Set()), i = D((o) => {
|
|
357
|
+
e((c) => c.filter((n) => n.id !== o));
|
|
388
358
|
}, []);
|
|
389
|
-
return
|
|
390
|
-
const o = (
|
|
391
|
-
const
|
|
392
|
-
if (
|
|
359
|
+
return G(() => {
|
|
360
|
+
const o = (c) => {
|
|
361
|
+
const p = c.detail;
|
|
362
|
+
if (e((s) => [...s, p]), p.duration !== 0) {
|
|
393
363
|
const s = setTimeout(() => {
|
|
394
|
-
|
|
395
|
-
},
|
|
396
|
-
|
|
364
|
+
i(p.id), t.current.delete(s);
|
|
365
|
+
}, p.duration || 3e3);
|
|
366
|
+
t.current.add(s);
|
|
397
367
|
}
|
|
398
368
|
};
|
|
399
|
-
return globalThis.addEventListener(
|
|
400
|
-
globalThis.removeEventListener(
|
|
401
|
-
for (const
|
|
402
|
-
|
|
369
|
+
return globalThis.addEventListener(j, o), () => {
|
|
370
|
+
globalThis.removeEventListener(j, o);
|
|
371
|
+
for (const c of t.current) clearTimeout(c);
|
|
372
|
+
t.current.clear();
|
|
403
373
|
};
|
|
404
|
-
}, [
|
|
405
|
-
/* @__PURE__ */
|
|
406
|
-
|
|
374
|
+
}, [i]), typeof document > "u" ? null : H(
|
|
375
|
+
/* @__PURE__ */ $(
|
|
376
|
+
k,
|
|
407
377
|
{
|
|
408
378
|
className: "pittorica-toast-viewport",
|
|
409
379
|
role: "region",
|
|
410
380
|
"aria-label": "Notifications",
|
|
411
|
-
children:
|
|
412
|
-
|
|
381
|
+
children: r.map((o) => /* @__PURE__ */ C(
|
|
382
|
+
k,
|
|
413
383
|
{
|
|
414
384
|
className: "pittorica-toast-root",
|
|
415
385
|
role: "status",
|
|
416
386
|
"aria-live": "polite",
|
|
417
387
|
children: [
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
/* @__PURE__ */
|
|
420
|
-
o.description && /* @__PURE__ */
|
|
388
|
+
/* @__PURE__ */ C(k, { className: "pittorica-toast-content", children: [
|
|
389
|
+
/* @__PURE__ */ $(z, { weight: "bold", style: { display: "block" }, children: o.title }),
|
|
390
|
+
o.description && /* @__PURE__ */ $(z, { color: "slate", style: { display: "block" }, children: o.description })
|
|
421
391
|
] }),
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
-
|
|
392
|
+
/* @__PURE__ */ $(
|
|
393
|
+
_,
|
|
424
394
|
{
|
|
425
395
|
variant: "text",
|
|
426
396
|
color: "slate",
|
|
427
397
|
size: "1",
|
|
428
|
-
onClick: () =>
|
|
398
|
+
onClick: () => i(o.id),
|
|
429
399
|
"aria-label": "Close",
|
|
430
|
-
children: /* @__PURE__ */
|
|
400
|
+
children: /* @__PURE__ */ $(U, { size: 18 })
|
|
431
401
|
}
|
|
432
402
|
)
|
|
433
403
|
]
|
|
@@ -440,6 +410,6 @@ const S = ({
|
|
|
440
410
|
);
|
|
441
411
|
};
|
|
442
412
|
export {
|
|
443
|
-
|
|
444
|
-
|
|
413
|
+
nt as ToastProvider,
|
|
414
|
+
ot as toast
|
|
445
415
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pittorica/toast-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@tabler/icons-react": "^3.36.1",
|
|
13
13
|
"clsx": "^2.1.1",
|
|
14
|
-
"@pittorica/box-react": "0.
|
|
15
|
-
"@pittorica/
|
|
16
|
-
"@pittorica/
|
|
14
|
+
"@pittorica/box-react": "0.25.0",
|
|
15
|
+
"@pittorica/icon-button-react": "0.25.0",
|
|
16
|
+
"@pittorica/text-react": "0.25.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"typescript": "^5.0.0",
|
|
26
26
|
"vite": "^5.0.0",
|
|
27
27
|
"vitest": "^2.1.9",
|
|
28
|
-
"@pittorica/
|
|
29
|
-
"@pittorica/
|
|
30
|
-
"pittorica": "0.
|
|
31
|
-
"
|
|
28
|
+
"@pittorica/flex-react": "0.25.0",
|
|
29
|
+
"@pittorica/button-react": "0.25.0",
|
|
30
|
+
"@pittorica/theme-react": "0.25.0",
|
|
31
|
+
"pittorica": "0.25.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": ">=19",
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"build:js": "vite build",
|
|
40
40
|
"build:types": "tsc -p tsconfig.json",
|
|
41
41
|
"clean": "rm -rf dist",
|
|
42
|
-
"dev": "vite",
|
|
43
42
|
"test": "vitest run",
|
|
44
43
|
"test:watch": "vitest"
|
|
45
44
|
}
|