meticulous-ui 3.0.2 → 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,71 +1,85 @@
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
- import { createPortal as F } from "react-dom";
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";
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
8
  const w = () => {
9
- }, Z = ({ toasts: e, ...r }) => {
10
- const [o, s] = u(e);
11
- g(() => {
9
+ }, ee = ({ toasts: e, ...r }) => {
10
+ const [o, s] = i(e);
11
+ R(() => {
12
12
  s(e);
13
13
  }, [e]);
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
- return F(
16
- /* @__PURE__ */ t(G, { ...r, children: [...o].reverse().map(i) }),
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
- }, M = (e, r, o) => () => {
19
+ }, v = (e, r, o) => () => {
20
20
  e(!0), setTimeout(() => {
21
21
  r(!1), o();
22
22
  }, 500);
23
- }, H = ({
23
+ }, J = ({
24
24
  type: e = A,
25
25
  visible: r = !0,
26
26
  duration: o = 5,
27
27
  onExpire: s = w,
28
- title: i,
29
- subtitle: c,
30
- ...l
28
+ title: l,
29
+ subtitle: a,
30
+ ...u
31
31
  }) => {
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);
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
34
  };
35
- g(() => {
35
+ R(() => {
36
36
  n(r);
37
- }, [r]), g(() => (R(T.current), () => clearTimeout(p.current)), []);
37
+ }, [r]), R(() => (g(p.current), () => clearTimeout(T.current)), []);
38
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;
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
43
  if (m)
44
- return /* @__PURE__ */ a(
44
+ return /* @__PURE__ */ c(
45
45
  D,
46
46
  {
47
47
  $bg: S,
48
+ role: e === M ? "alert" : "status",
49
+ "aria-live": e === M ? "assertive" : "polite",
50
+ "aria-atomic": "true",
48
51
  className: `${d ? "fade-out" : "fade-in"}`,
49
52
  onMouseEnter: L,
50
- onMouseLeave: y,
51
- ...l,
53
+ onMouseLeave: E,
54
+ ...u,
52
55
  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 })
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 })
57
60
  ] }),
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(
61
+ /* @__PURE__ */ c(z, { children: [
62
+ /* @__PURE__ */ c(
64
63
  q,
65
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",
66
80
  size: 13,
67
- color: j.m600,
68
- onClick: M(f, n, s)
81
+ color: k.m600,
82
+ onClick: v(f, n, s)
69
83
  }
70
84
  )
71
85
  ] })
@@ -74,6 +88,6 @@ const w = () => {
74
88
  );
75
89
  };
76
90
  export {
77
- Z as ToastContainer,
78
- H as default
91
+ ee as ToastContainer,
92
+ J as default
79
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 t, { keyframes as a, css as o } from "styled-components";
2
- import i from "../../colors/white.js";
1
+ import t, { keyframes as o, css as i } from "styled-components";
2
+ import s from "../../colors/white.js";
3
3
  import m from "../Icons/Close/Close.js";
4
4
  import d from "../../colors/grey.js";
5
5
  import { WARNING as n } from "./constants.js";
6
- const l = a`
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 l = a`
12
18
  opacity: 1;
13
19
  transform: translateX(0); /* Move to its final position */
14
20
  }
15
- `, c = a`
21
+ `, f = o`
16
22
  from {
17
23
  opacity: 1;
18
24
  transform: translateX(0);
@@ -21,7 +27,7 @@ const l = a`
21
27
  opacity: 0;
22
28
  transform: translateX(100%); /* Move off-screen to the right */
23
29
  }
24
- `, x = t.div`
30
+ `, $ = t.div`
25
31
  position: fixed;
26
32
  top: 1.6rem;
27
33
  right: 1.6rem;
@@ -30,7 +36,7 @@ const l = a`
30
36
  display: flex;
31
37
  flex-direction: column;
32
38
  gap: 1.6rem;
33
- `, b = t.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 l = a`
44
50
 
45
51
  &.fade-in {
46
52
  opacity: 1;
47
- animation: ${l} 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: ${c} 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 l = a`
58
64
  border-radius: 0.96rem;
59
65
  padding: 0.48rem 1.28rem;
60
66
  }
61
- `, $ = t.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: r }) => e === n ? o`
74
+ ${({ type: e, $main: r }) => e === n ? i`
69
75
  top: 48%;
70
- border-color: ${r} ${r} ${i} ${r};
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 l = a`
80
86
  `}
81
87
 
82
88
  @media screen and (max-width: 768px) {
83
- ${({ type: e, $main: r }) => e === n ? o`
89
+ ${({ type: e, $main: r }) => e === n ? i`
84
90
  top: 48%;
85
- border-color: ${r} ${r} ${i} ${r};
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
- `, y = t.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
- `, v = t.div`
115
+ `, C = t.div`
109
116
  position: absolute;
110
117
  top: 50%;
111
118
  left: 50%;
@@ -119,7 +126,7 @@ const l = a`
119
126
  transform: translate(-42.8%, -42.8%);
120
127
  scale: 0.75;
121
128
  }
122
- `, k = t.div`
129
+ `, R = t.div`
123
130
  position: absolute;
124
131
  top: 50%;
125
132
  left: 50%;
@@ -128,15 +135,16 @@ const l = a`
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
- `, s = 75.4, h = a`
137
- from { stroke-dashoffset: ${s}; }
144
+ `, a = 75.4, p = o`
145
+ from { stroke-dashoffset: ${a}; }
138
146
  to { stroke-dashoffset: 0; }
139
- `, C = t.div`
147
+ `, z = t.div`
140
148
  position: relative;
141
149
  display: inline-flex;
142
150
  align-items: center;
@@ -155,7 +163,7 @@ const l = a`
155
163
  stroke: ${({ $color: e }) => e};
156
164
  stroke-width: 2;
157
165
  stroke-linecap: round;
158
- stroke-dasharray: ${s};
166
+ stroke-dasharray: ${a};
159
167
  }
160
168
 
161
169
  circle:first-child {
@@ -164,11 +172,11 @@ const l = a`
164
172
  }
165
173
 
166
174
  circle:last-child {
167
- stroke-dashoffset: ${s};
168
- animation: ${h} ${({ $duration: e }) => e - 0.5}s linear forwards;
175
+ stroke-dashoffset: ${a};
176
+ animation: ${p} ${({ $duration: e }) => e - 0.5}s linear forwards;
169
177
  animation-play-state: ${({ $paused: e }) => e ? "paused" : "running"};
170
178
  }
171
- `, R = t(m)`
179
+ `, G = t(m)`
172
180
  cursor: pointer;
173
181
  `, M = t.div`
174
182
  font-weight: 600;
@@ -189,16 +197,16 @@ const l = a`
189
197
  color: ${d.m700};
190
198
  `;
191
199
  export {
192
- C as CloseButtonContainer,
193
- R as CloseWrapper,
194
- v as Icon,
195
- $ as LogoContainer,
200
+ z as CloseButtonContainer,
201
+ G as CloseWrapper,
202
+ C as Icon,
203
+ v as LogoContainer,
196
204
  N as Message,
197
- y as Outer,
198
- k as OuterChild,
205
+ k as Outer,
206
+ R as OuterChild,
199
207
  I as ProgressRing,
200
208
  X as Subtitle,
201
209
  M as Title,
202
- b as ToastWrapper,
203
- x as ToastsContainer
210
+ y as ToastWrapper,
211
+ $ as ToastsContainer
204
212
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meticulous-ui",
3
- "version": "3.0.2",
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",