meticulous-ui 3.0.1 → 3.0.3

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