meticulous-ui 3.11.2 → 3.11.4
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/cjs/components/Toast/Toast.cjs +14 -15
- package/cjs/utils/randomValue.cjs +1 -1
- package/components/Toast/Toast.js +24 -33
- package/package.json +1 -1
- package/utils/randomValue.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),s=require("react"),G=require("react-dom"),A=require("prop-types"),l=require("styled-components"),S=require("../Icons/Close.cjs"),F=require("../Icons/Check.cjs"),X=require("../Icons/Info.cjs"),D=require("../Icons/WarningTriangleFilled.cjs"),z=require("../../colors/white.cjs"),$=require("../../colors/grey.cjs"),i=require("./constants.cjs"),E=e=>e&&e.__esModule?e:{default:e},a=E(A),n=E(l),q=()=>{},U=l.keyframes`
|
|
2
2
|
from { transform: scale(0); }
|
|
3
3
|
to { transform: scale(1); }
|
|
4
4
|
`,B=l.keyframes`
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
opacity: 0;
|
|
23
23
|
transform: translateX(100%); /* Move off-screen to the right */
|
|
24
24
|
}
|
|
25
|
-
`,K=
|
|
25
|
+
`,K=n.default.div`
|
|
26
26
|
position: fixed;
|
|
27
27
|
top: 1.6rem;
|
|
28
28
|
right: 1.6rem;
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
display: flex;
|
|
32
32
|
flex-direction: column;
|
|
33
33
|
gap: 1.6rem;
|
|
34
|
-
`,Q=
|
|
34
|
+
`,Q=n.default.div`
|
|
35
35
|
display: flex;
|
|
36
36
|
align-items: center;
|
|
37
37
|
justify-content: space-between;
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
border-radius: 0.8rem;
|
|
74
74
|
padding: 0.4rem 1rem;
|
|
75
75
|
}
|
|
76
|
-
`,V=
|
|
76
|
+
`,V=n.default.div`
|
|
77
77
|
position: absolute;
|
|
78
78
|
top: 50%;
|
|
79
79
|
left: 50%;
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
width: 1.76rem;
|
|
98
98
|
height: 1.76rem;
|
|
99
99
|
}
|
|
100
|
-
`,Y=
|
|
100
|
+
`,Y=n.default.div`
|
|
101
101
|
position: relative;
|
|
102
102
|
width: 6.4rem;
|
|
103
103
|
height: 6.4rem;
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
width: 3.9rem;
|
|
120
120
|
height: 3.9rem;
|
|
121
121
|
}
|
|
122
|
-
`,Z=
|
|
122
|
+
`,Z=n.default.div`
|
|
123
123
|
position: absolute;
|
|
124
124
|
top: ${({$isWarning:e})=>e?"49%":"50%"};
|
|
125
125
|
left: 50%;
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
);
|
|
140
140
|
scale: 0.75;
|
|
141
141
|
}
|
|
142
|
-
`,ee=
|
|
142
|
+
`,ee=n.default.div`
|
|
143
143
|
position: absolute;
|
|
144
144
|
top: 50%;
|
|
145
145
|
left: 50%;
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
`,R=75.4,te=l.keyframes`
|
|
168
168
|
from { stroke-dashoffset: ${R}; }
|
|
169
169
|
to { stroke-dashoffset: 0; }
|
|
170
|
-
`,re=
|
|
170
|
+
`,re=n.default.div`
|
|
171
171
|
position: relative;
|
|
172
172
|
display: inline-flex;
|
|
173
173
|
align-items: center;
|
|
@@ -175,7 +175,8 @@
|
|
|
175
175
|
flex-shrink: 0;
|
|
176
176
|
width: 2.8rem;
|
|
177
177
|
height: 2.8rem;
|
|
178
|
-
|
|
178
|
+
cursor: pointer;
|
|
179
|
+
`,ae=n.default.svg`
|
|
179
180
|
position: absolute;
|
|
180
181
|
inset: 0;
|
|
181
182
|
transform: ${({$hasClockwiseRotation:e})=>e?"rotate(-90deg)":"rotate(90deg) scaleX(-1)"};
|
|
@@ -199,9 +200,7 @@
|
|
|
199
200
|
animation: ${te} ${({$duration:e})=>e-.5}s linear forwards;
|
|
200
201
|
animation-play-state: ${({$paused:e})=>e?"paused":"running"};
|
|
201
202
|
}
|
|
202
|
-
`,
|
|
203
|
-
cursor: pointer;
|
|
204
|
-
`,ie=i.default.div`
|
|
203
|
+
`,ie=n.default.div`
|
|
205
204
|
font-weight: 600;
|
|
206
205
|
font-size: 1.92rem;
|
|
207
206
|
color: ${$.default.m800};
|
|
@@ -213,7 +212,7 @@
|
|
|
213
212
|
@media screen and (max-width: 380px) {
|
|
214
213
|
font-size: 1.56rem;
|
|
215
214
|
}
|
|
216
|
-
`,
|
|
215
|
+
`,se=n.default.div`
|
|
217
216
|
display: flex;
|
|
218
217
|
flex-direction: column;
|
|
219
218
|
gap: 0.32rem;
|
|
@@ -231,7 +230,7 @@
|
|
|
231
230
|
max-width: 18rem;
|
|
232
231
|
width: auto;
|
|
233
232
|
}
|
|
234
|
-
`,
|
|
233
|
+
`,ne=n.default.div`
|
|
235
234
|
font-weight: 400;
|
|
236
235
|
font-size: 1.6rem;
|
|
237
236
|
color: ${$.default.m700};
|
|
@@ -243,4 +242,4 @@
|
|
|
243
242
|
@media screen and (max-width: 380px) {
|
|
244
243
|
font-size: 1.32rem;
|
|
245
244
|
}
|
|
246
|
-
`,
|
|
245
|
+
`,oe=(e,r)=>e===i.ERROR?t.jsx(S.default,{size:16,color:r}):e===i.SUCCESS?t.jsx(F.default,{size:18,color:r}):e===i.WARNING?t.jsx(D.default,{size:28,color:z.default}):t.jsx(X.default,{size:22,color:r}),de=e=>e===i.ERROR?1.6:e===i.SUCCESS?1.76:e===i.WARNING?2.8:2.08,ce=({type:e,$main:r,$side:o})=>{const d=oe(e,r),c=e===i.WARNING;return t.jsxs(Y,{"aria-hidden":"true",$side:o,children:[t.jsx(ee,{$main:r}),!c&&t.jsx(V,{$main:r,type:e}),t.jsx(Z,{size:de(e),$isWarning:c,children:d})]})},I=({toasts:e,...r})=>{const[o,d]=s.useState(e);s.useEffect(()=>{d(e)},[e]);const c=({type:f,id:u,title:h,subtitle:x,duration:m,onExpire:g=q},p)=>s.createElement(y,{type:f,title:h,subtitle:x,duration:m,key:u,onExpire:g});return G.createPortal(t.jsx(K,{...r,children:[...o].reverse().map(c)}),document.body)};I.propTypes={toasts:a.default.arrayOf(a.default.shape({id:a.default.any,type:a.default.string,title:a.default.string,subtitle:a.default.string,duration:a.default.number,onExpire:a.default.func}))};const O=(e,r,o)=>()=>{e(!0),setTimeout(()=>{r(!1),o()},500)},y=({type:e=i.INFO,visible:r=!0,duration:o=5,onExpire:d=q,hasClockwiseRotation:c=!1,title:f,subtitle:u,...h})=>{var T;const[x,m]=s.useState(r),[g,p]=s.useState(!1),[M,j]=s.useState(!1),w=s.useRef(null),b=s.useRef((o-.5)*1e3),v=s.useRef(null),k=W=>{v.current=Date.now(),w.current=setTimeout(O(p,m,d),W)};s.useEffect(()=>{m(r)},[r]),s.useEffect(()=>(k(b.current),()=>clearTimeout(w.current)),[]);const _=()=>{clearTimeout(w.current),b.current-=Date.now()-v.current,j(!0)},N=()=>{j(!1),k(b.current)},{main:C,side:L,bg:P}=(T=i.COLOR_MAP[e])!=null?T:i.INFO_COLORS;if(x)return t.jsxs(Q,{$bg:P,role:e===i.ERROR?"alert":"status","aria-live":e===i.ERROR?"assertive":"polite","aria-atomic":"true",className:`${g?"fade-out":"fade-in"}`,onMouseEnter:_,onMouseLeave:N,...h,children:[t.jsx(ce,{type:e,$main:C,$side:L}),t.jsxs(se,{children:[t.jsx(ie,{children:f}),u&&t.jsx(ne,{children:u})]}),t.jsxs(re,{onClick:O(p,m,d),children:[t.jsxs(ae,{"aria-hidden":"true",viewBox:"0 0 28 28",$duration:o,$color:C,$paused:M,$hasClockwiseRotation:c,children:[t.jsx("circle",{cx:"14",cy:"14",r:"12"}),t.jsx("circle",{cx:"14",cy:"14",r:"12"})]}),t.jsx(S.default,{"aria-label":"Close notification",size:13,color:$.default.m600})]})]})};y.propTypes={type:a.default.string,visible:a.default.bool,duration:a.default.number,onExpire:a.default.func,hasClockwiseRotation:a.default.bool,title:a.default.string,subtitle:a.default.string};exports.ToastContainer=I;exports.default=y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=(e,t)=>Math.random()*(t-e)+e;exports.default=r;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=(e,t)=>Math.random()*(t-e+1)+e;exports.default=r;
|
|
@@ -188,6 +188,7 @@ const P = () => {
|
|
|
188
188
|
flex-shrink: 0;
|
|
189
189
|
width: 2.8rem;
|
|
190
190
|
height: 2.8rem;
|
|
191
|
+
cursor: pointer;
|
|
191
192
|
`, me = o.svg`
|
|
192
193
|
position: absolute;
|
|
193
194
|
inset: 0;
|
|
@@ -212,9 +213,7 @@ const P = () => {
|
|
|
212
213
|
animation: ${se} ${({ $duration: e }) => e - 0.5}s linear forwards;
|
|
213
214
|
animation-play-state: ${({ $paused: e }) => e ? "paused" : "running"};
|
|
214
215
|
}
|
|
215
|
-
`, ce = o
|
|
216
|
-
cursor: pointer;
|
|
217
|
-
`, le = o.div`
|
|
216
|
+
`, ce = o.div`
|
|
218
217
|
font-weight: 600;
|
|
219
218
|
font-size: 1.92rem;
|
|
220
219
|
color: ${k.m800};
|
|
@@ -226,7 +225,7 @@ const P = () => {
|
|
|
226
225
|
@media screen and (max-width: 380px) {
|
|
227
226
|
font-size: 1.56rem;
|
|
228
227
|
}
|
|
229
|
-
`,
|
|
228
|
+
`, le = o.div`
|
|
230
229
|
display: flex;
|
|
231
230
|
flex-direction: column;
|
|
232
231
|
gap: 0.32rem;
|
|
@@ -244,7 +243,7 @@ const P = () => {
|
|
|
244
243
|
max-width: 18rem;
|
|
245
244
|
width: auto;
|
|
246
245
|
}
|
|
247
|
-
`,
|
|
246
|
+
`, he = o.div`
|
|
248
247
|
font-weight: 400;
|
|
249
248
|
font-size: 1.6rem;
|
|
250
249
|
color: ${k.m700};
|
|
@@ -256,25 +255,25 @@ const P = () => {
|
|
|
256
255
|
@media screen and (max-width: 380px) {
|
|
257
256
|
font-size: 1.32rem;
|
|
258
257
|
}
|
|
259
|
-
`,
|
|
260
|
-
const a =
|
|
258
|
+
`, fe = (e, r) => e === f ? /* @__PURE__ */ i(S, { size: 16, color: r }) : e === N ? /* @__PURE__ */ i(U, { size: 18, color: r }) : e === R ? /* @__PURE__ */ i(H, { size: 28, color: L }) : /* @__PURE__ */ i(q, { size: 22, color: r }), ue = (e) => e === f ? 1.6 : e === N ? 1.76 : e === R ? 2.8 : 2.08, pe = ({ type: e, $main: r, $side: n }) => {
|
|
259
|
+
const a = fe(e, r), s = e === R;
|
|
261
260
|
return /* @__PURE__ */ m(oe, { "aria-hidden": "true", $side: n, children: [
|
|
262
261
|
/* @__PURE__ */ i(ae, { $main: r }),
|
|
263
262
|
!s && /* @__PURE__ */ i(ie, { $main: r, type: e }),
|
|
264
|
-
/* @__PURE__ */ i(ne, { size:
|
|
263
|
+
/* @__PURE__ */ i(ne, { size: ue(e), $isWarning: s, children: a })
|
|
265
264
|
] });
|
|
266
|
-
},
|
|
265
|
+
}, ge = ({ toasts: e, ...r }) => {
|
|
267
266
|
const [n, a] = h(e);
|
|
268
267
|
y(() => {
|
|
269
268
|
a(e);
|
|
270
269
|
}, [e]);
|
|
271
|
-
const s = ({ type: u, id: l, title: p, subtitle: g, duration: d, onExpire: w = P }, x) => /* @__PURE__ */ B(
|
|
270
|
+
const s = ({ type: u, id: l, title: p, subtitle: g, duration: d, onExpire: w = P }, x) => /* @__PURE__ */ B(j, { type: u, title: p, subtitle: g, duration: d, key: l, onExpire: w });
|
|
272
271
|
return D(
|
|
273
272
|
/* @__PURE__ */ i(re, { ...r, children: [...n].reverse().map(s) }),
|
|
274
273
|
document.body
|
|
275
274
|
);
|
|
276
275
|
};
|
|
277
|
-
|
|
276
|
+
ge.propTypes = {
|
|
278
277
|
/** Array of toast config objects, each with `{ id, type, title, subtitle, duration, onExpire }` */
|
|
279
278
|
toasts: t.arrayOf(
|
|
280
279
|
t.shape({
|
|
@@ -291,7 +290,7 @@ const M = (e, r, n) => () => {
|
|
|
291
290
|
e(!0), setTimeout(() => {
|
|
292
291
|
r(!1), n();
|
|
293
292
|
}, 500);
|
|
294
|
-
},
|
|
293
|
+
}, j = ({
|
|
295
294
|
type: e = K,
|
|
296
295
|
visible: r = !0,
|
|
297
296
|
duration: n = 5,
|
|
@@ -302,13 +301,13 @@ const M = (e, r, n) => () => {
|
|
|
302
301
|
...p
|
|
303
302
|
}) => {
|
|
304
303
|
var I;
|
|
305
|
-
const [g, d] = h(r), [w, x] = h(!1), [
|
|
304
|
+
const [g, d] = h(r), [w, x] = h(!1), [F, T] = h(!1), b = v(null), $ = v((n - 0.5) * 1e3), z = v(null), O = (_) => {
|
|
306
305
|
z.current = Date.now(), b.current = setTimeout(M(x, d, a), _);
|
|
307
306
|
};
|
|
308
307
|
y(() => {
|
|
309
308
|
d(r);
|
|
310
309
|
}, [r]), y(() => (O($.current), () => clearTimeout(b.current)), []);
|
|
311
|
-
const
|
|
310
|
+
const W = () => {
|
|
312
311
|
clearTimeout(b.current), $.current -= Date.now() - z.current, T(!0);
|
|
313
312
|
}, X = () => {
|
|
314
313
|
T(!1), O($.current);
|
|
@@ -322,16 +321,16 @@ const M = (e, r, n) => () => {
|
|
|
322
321
|
"aria-live": e === f ? "assertive" : "polite",
|
|
323
322
|
"aria-atomic": "true",
|
|
324
323
|
className: `${w ? "fade-out" : "fade-in"}`,
|
|
325
|
-
onMouseEnter:
|
|
324
|
+
onMouseEnter: W,
|
|
326
325
|
onMouseLeave: X,
|
|
327
326
|
...p,
|
|
328
327
|
children: [
|
|
329
|
-
/* @__PURE__ */ i(
|
|
330
|
-
/* @__PURE__ */ m(
|
|
331
|
-
/* @__PURE__ */ i(
|
|
332
|
-
l && /* @__PURE__ */ i(
|
|
328
|
+
/* @__PURE__ */ i(pe, { type: e, $main: E, $side: G }),
|
|
329
|
+
/* @__PURE__ */ m(le, { children: [
|
|
330
|
+
/* @__PURE__ */ i(ce, { children: u }),
|
|
331
|
+
l && /* @__PURE__ */ i(he, { children: l })
|
|
333
332
|
] }),
|
|
334
|
-
/* @__PURE__ */ m(de, { children: [
|
|
333
|
+
/* @__PURE__ */ m(de, { onClick: M(x, d, a), children: [
|
|
335
334
|
/* @__PURE__ */ m(
|
|
336
335
|
me,
|
|
337
336
|
{
|
|
@@ -339,7 +338,7 @@ const M = (e, r, n) => () => {
|
|
|
339
338
|
viewBox: "0 0 28 28",
|
|
340
339
|
$duration: n,
|
|
341
340
|
$color: E,
|
|
342
|
-
$paused:
|
|
341
|
+
$paused: F,
|
|
343
342
|
$hasClockwiseRotation: s,
|
|
344
343
|
children: [
|
|
345
344
|
/* @__PURE__ */ i("circle", { cx: "14", cy: "14", r: "12" }),
|
|
@@ -347,21 +346,13 @@ const M = (e, r, n) => () => {
|
|
|
347
346
|
]
|
|
348
347
|
}
|
|
349
348
|
),
|
|
350
|
-
/* @__PURE__ */ i(
|
|
351
|
-
ce,
|
|
352
|
-
{
|
|
353
|
-
"aria-label": "Close notification",
|
|
354
|
-
size: 13,
|
|
355
|
-
color: k.m600,
|
|
356
|
-
onClick: M(x, d, a)
|
|
357
|
-
}
|
|
358
|
-
)
|
|
349
|
+
/* @__PURE__ */ i(S, { "aria-label": "Close notification", size: 13, color: k.m600 })
|
|
359
350
|
] })
|
|
360
351
|
]
|
|
361
352
|
}
|
|
362
353
|
);
|
|
363
354
|
};
|
|
364
|
-
|
|
355
|
+
j.propTypes = {
|
|
365
356
|
/** Notification variant: `'info'`, `'success'`, `'warning'`, or `'error'`. Defaults to `'info'` */
|
|
366
357
|
type: t.string,
|
|
367
358
|
/** Controls initial visibility. Defaults to `true` */
|
|
@@ -378,6 +369,6 @@ W.propTypes = {
|
|
|
378
369
|
subtitle: t.string
|
|
379
370
|
};
|
|
380
371
|
export {
|
|
381
|
-
|
|
382
|
-
|
|
372
|
+
ge as ToastContainer,
|
|
373
|
+
j as default
|
|
383
374
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meticulous-ui",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.4",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"description": "A comprehensive React UI component library with a wide range of customizable components, icons, colors, and utilities for building modern web applications.",
|
|
6
6
|
"types": "./index.d.ts",
|
package/utils/randomValue.js
CHANGED