meticulous-ui 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,55 +1,79 @@
1
- import { jsxs as T, jsx as s } from "react/jsx-runtime";
2
- import { useState as u, useEffect as p, createElement as $ } from "react";
1
+ import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
+ import { useState as u, useRef as h, useEffect as g, createElement as E } from "react";
3
3
  import { createPortal as F } from "react-dom";
4
- import { Logo as L } from "./helpers.js";
5
- import N from "../../colors/grey.js";
6
- import { COLOR_MAP as j, INFO as k, INFO_COLORS as w } from "./constants.js";
7
- import { ToastWrapper as x, Message as y, Title as A, Subtitle as I, CloseWrapper as M, ToastsContainer as P } from "./styles.js";
8
- const O = () => {
9
- }, B = ({ toasts: e, ...o }) => {
10
- const [t, a] = u(e);
11
- p(() => {
12
- a(e);
4
+ import { Logo as N } from "./helpers.js";
5
+ import j from "../../colors/grey.js";
6
+ import { COLOR_MAP as k, INFO as A, INFO_COLORS as B } from "./constants.js";
7
+ import { ToastWrapper as D, Message as I, Title as W, Subtitle as _, CloseButtonContainer as b, ProgressRing as z, CloseWrapper as q, ToastsContainer as G } from "./styles.js";
8
+ const w = () => {
9
+ }, Z = ({ toasts: e, ...r }) => {
10
+ const [o, s] = u(e);
11
+ g(() => {
12
+ s(e);
13
13
  }, [e]);
14
- const m = ({ type: n, id: c, title: i, subtitle: r, onExpire: l = O }, f) => /* @__PURE__ */ $(R, { type: n, title: i, subtitle: r, key: c, onExpire: l });
14
+ const i = ({ type: c, id: l, title: m, subtitle: n, onExpire: d = w }, f) => /* @__PURE__ */ E(H, { type: c, title: m, subtitle: n, key: l, onExpire: d });
15
15
  return F(
16
- /* @__PURE__ */ s(P, { ...o, children: [...t].reverse().map(m) }),
16
+ /* @__PURE__ */ t(G, { ...r, children: [...o].reverse().map(i) }),
17
17
  document.body
18
18
  );
19
- }, d = (e, o, t) => () => {
19
+ }, M = (e, r, o) => () => {
20
20
  e(!0), setTimeout(() => {
21
- o(!1), t();
21
+ r(!1), o();
22
22
  }, 500);
23
- }, R = ({
24
- type: e = k,
25
- visible: o = !0,
26
- duration: t = 5,
27
- onExpire: a = O,
28
- title: m,
29
- subtitle: n,
30
- ...c
23
+ }, H = ({
24
+ type: e = A,
25
+ visible: r = !0,
26
+ duration: o = 5,
27
+ onExpire: s = w,
28
+ title: i,
29
+ subtitle: c,
30
+ ...l
31
31
  }) => {
32
- const [i, r] = u(o), [l, f] = u(!1);
33
- p(() => {
34
- r(o);
35
- }, [o]), p(() => {
36
- const S = setTimeout(d(f, r, a), t * 1e3 - 500);
37
- return () => {
38
- clearTimeout(S);
39
- };
40
- }, [t, d]);
41
- const { main: h, side: C, bg: g } = j[e] ?? w;
42
- if (i)
43
- return /* @__PURE__ */ T(x, { $bg: g, className: `${l ? "fade-out" : "fade-in"}`, ...c, children: [
44
- /* @__PURE__ */ s(L, { type: e, $main: h, $side: C }),
45
- /* @__PURE__ */ T(y, { children: [
46
- /* @__PURE__ */ s(A, { children: m }),
47
- n && /* @__PURE__ */ s(I, { children: n })
48
- ] }),
49
- /* @__PURE__ */ s(M, { size: 20, color: N.m600, onClick: d(f, r, a) })
50
- ] });
32
+ const [m, n] = u(r), [d, f] = u(!1), [x, C] = u(!1), p = h(null), T = h((o - 0.5) * 1e3), O = h(null), R = (v) => {
33
+ O.current = Date.now(), p.current = setTimeout(M(f, n, s), v);
34
+ };
35
+ g(() => {
36
+ n(r);
37
+ }, [r]), g(() => (R(T.current), () => clearTimeout(p.current)), []);
38
+ const L = () => {
39
+ clearTimeout(p.current), T.current -= Date.now() - O.current, C(!0);
40
+ }, y = () => {
41
+ C(!1), R(T.current);
42
+ }, { main: $, side: P, bg: S } = k[e] ?? B;
43
+ if (m)
44
+ return /* @__PURE__ */ a(
45
+ D,
46
+ {
47
+ $bg: S,
48
+ className: `${d ? "fade-out" : "fade-in"}`,
49
+ onMouseEnter: L,
50
+ onMouseLeave: y,
51
+ ...l,
52
+ children: [
53
+ /* @__PURE__ */ t(N, { type: e, $main: $, $side: P }),
54
+ /* @__PURE__ */ a(I, { children: [
55
+ /* @__PURE__ */ t(W, { children: i }),
56
+ c && /* @__PURE__ */ t(_, { children: c })
57
+ ] }),
58
+ /* @__PURE__ */ a(b, { children: [
59
+ /* @__PURE__ */ a(z, { viewBox: "0 0 28 28", $duration: o, $color: $, $paused: x, children: [
60
+ /* @__PURE__ */ t("circle", { cx: "14", cy: "14", r: "12" }),
61
+ /* @__PURE__ */ t("circle", { cx: "14", cy: "14", r: "12" })
62
+ ] }),
63
+ /* @__PURE__ */ t(
64
+ q,
65
+ {
66
+ size: 13,
67
+ color: j.m600,
68
+ onClick: M(f, n, s)
69
+ }
70
+ )
71
+ ] })
72
+ ]
73
+ }
74
+ );
51
75
  };
52
76
  export {
53
- B as ToastContainer,
54
- R as default
77
+ Z as ToastContainer,
78
+ H as default
55
79
  };
@@ -1,9 +1,9 @@
1
- import r, { keyframes as s, css as o } from "styled-components";
1
+ import t, { keyframes as a, css as o } from "styled-components";
2
2
  import i from "../../colors/white.js";
3
- import n from "../Icons/Close/Close.js";
3
+ import m from "../Icons/Close/Close.js";
4
4
  import d from "../../colors/grey.js";
5
- import { WARNING as a } from "./constants.js";
6
- const m = s`
5
+ import { WARNING as n } from "./constants.js";
6
+ const l = a`
7
7
  from {
8
8
  opacity: 0;
9
9
  transform: translateX(100%); /* Start off-screen to the right */
@@ -12,7 +12,7 @@ const m = s`
12
12
  opacity: 1;
13
13
  transform: translateX(0); /* Move to its final position */
14
14
  }
15
- `, h = s`
15
+ `, c = a`
16
16
  from {
17
17
  opacity: 1;
18
18
  transform: translateX(0);
@@ -21,7 +21,7 @@ const m = s`
21
21
  opacity: 0;
22
22
  transform: translateX(100%); /* Move off-screen to the right */
23
23
  }
24
- `, w = r.div`
24
+ `, x = t.div`
25
25
  position: fixed;
26
26
  top: 1.6rem;
27
27
  right: 1.6rem;
@@ -30,7 +30,7 @@ const m = s`
30
30
  display: flex;
31
31
  flex-direction: column;
32
32
  gap: 1.6rem;
33
- `, x = r.div`
33
+ `, b = t.div`
34
34
  display: flex;
35
35
  align-items: center;
36
36
  justify-content: space-between;
@@ -44,12 +44,12 @@ const m = s`
44
44
 
45
45
  &.fade-in {
46
46
  opacity: 1;
47
- animation: ${m} 0.5s ease-out forwards; /* slide down + fade */
47
+ animation: ${l} 0.5s ease-out forwards; /* slide down + fade */
48
48
  }
49
49
 
50
50
  &.fade-out {
51
51
  opacity: 0;
52
- animation: ${h} 0.5s ease-in forwards; /* slide right */
52
+ animation: ${c} 0.5s ease-in forwards; /* slide right */
53
53
  }
54
54
 
55
55
  @media screen and (max-width: 768px) {
@@ -58,16 +58,16 @@ const m = s`
58
58
  border-radius: 0.96rem;
59
59
  padding: 0.48rem 1.28rem;
60
60
  }
61
- `, b = r.div`
61
+ `, $ = t.div`
62
62
  position: absolute;
63
63
  top: 50%;
64
64
  left: 50%;
65
65
  transform: translate(-50%, -50%);
66
66
  background-color: ${i};
67
67
 
68
- ${({ type: e, $main: t }) => e === a ? o`
68
+ ${({ type: e, $main: r }) => e === n ? o`
69
69
  top: 48%;
70
- border-color: ${t} ${t} ${i} ${t};
70
+ border-color: ${r} ${r} ${i} ${r};
71
71
  border-style: solid;
72
72
  border-width: 0 1.44rem 2.24rem 1.44rem;
73
73
  height: 0;
@@ -80,9 +80,9 @@ const m = s`
80
80
  `}
81
81
 
82
82
  @media screen and (max-width: 768px) {
83
- ${({ type: e, $main: t }) => e === a ? o`
83
+ ${({ type: e, $main: r }) => e === n ? o`
84
84
  top: 48%;
85
- border-color: ${t} ${t} ${i} ${t};
85
+ border-color: ${r} ${r} ${i} ${r};
86
86
  border-style: solid;
87
87
  border-width: 0 1.12rem 1.68rem 1.088rem;
88
88
  height: 0;
@@ -94,7 +94,7 @@ const m = s`
94
94
  border-radius: 50%;
95
95
  `}
96
96
  }
97
- `, u = r.div`
97
+ `, y = t.div`
98
98
  position: relative;
99
99
  width: 6.4rem;
100
100
  height: 6.4rem;
@@ -105,7 +105,7 @@ const m = s`
105
105
  width: 4.8rem;
106
106
  height: 4.8rem;
107
107
  }
108
- `, $ = r.div`
108
+ `, v = t.div`
109
109
  position: absolute;
110
110
  top: 50%;
111
111
  left: 50%;
@@ -119,7 +119,7 @@ const m = s`
119
119
  transform: translate(-42.8%, -42.8%);
120
120
  scale: 0.75;
121
121
  }
122
- `, y = r.div`
122
+ `, k = t.div`
123
123
  position: absolute;
124
124
  top: 50%;
125
125
  left: 50%;
@@ -133,13 +133,48 @@ const m = s`
133
133
  width: 3.6rem;
134
134
  height: 3.6rem;
135
135
  }
136
- `, v = r(n)`
136
+ `, s = 75.4, h = a`
137
+ from { stroke-dashoffset: ${s}; }
138
+ to { stroke-dashoffset: 0; }
139
+ `, C = t.div`
140
+ position: relative;
141
+ display: inline-flex;
142
+ align-items: center;
143
+ justify-content: center;
144
+ flex-shrink: 0;
145
+ width: 2.8rem;
146
+ height: 2.8rem;
147
+ `, I = t.svg`
148
+ position: absolute;
149
+ inset: 0;
150
+ transform: rotate(-90deg);
151
+ pointer-events: none;
152
+
153
+ circle {
154
+ fill: none;
155
+ stroke: ${({ $color: e }) => e};
156
+ stroke-width: 2;
157
+ stroke-linecap: round;
158
+ stroke-dasharray: ${s};
159
+ }
160
+
161
+ circle:first-child {
162
+ opacity: 0.15;
163
+ stroke-dashoffset: 0;
164
+ }
165
+
166
+ circle:last-child {
167
+ stroke-dashoffset: ${s};
168
+ animation: ${h} ${({ $duration: e }) => e - 0.5}s linear forwards;
169
+ animation-play-state: ${({ $paused: e }) => e ? "paused" : "running"};
170
+ }
171
+ `, R = t(m)`
137
172
  cursor: pointer;
138
- `, k = r.div`
173
+ `, M = t.div`
139
174
  font-weight: 600;
140
175
  font-size: 1.92rem;
141
176
  color: ${d.m800};
142
- `, C = r.div`
177
+ `, N = t.div`
143
178
  display: flex;
144
179
  flex-direction: column;
145
180
  gap: 0.32rem;
@@ -148,20 +183,22 @@ const m = s`
148
183
  @media screen and (max-width: 768px) {
149
184
  width: 24rem;
150
185
  }
151
- `, X = r.div`
186
+ `, X = t.div`
152
187
  font-weight: 400;
153
188
  font-size: 1.6rem;
154
189
  color: ${d.m700};
155
190
  `;
156
191
  export {
157
- v as CloseWrapper,
158
- $ as Icon,
159
- b as LogoContainer,
160
- C as Message,
161
- u as Outer,
162
- y as OuterChild,
192
+ C as CloseButtonContainer,
193
+ R as CloseWrapper,
194
+ v as Icon,
195
+ $ as LogoContainer,
196
+ N as Message,
197
+ y as Outer,
198
+ k as OuterChild,
199
+ I as ProgressRing,
163
200
  X as Subtitle,
164
- k as Title,
165
- x as ToastWrapper,
166
- w as ToastsContainer
201
+ M as Title,
202
+ b as ToastWrapper,
203
+ x as ToastsContainer
167
204
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meticulous-ui",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "license": "MIT",
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
  "main": "./index.js",