meticulous-ui 3.1.1 → 3.1.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,148 +1,151 @@
1
1
  import { jsxs as X, jsx as r } from "react/jsx-runtime";
2
- import { useState as a, useRef as T, useEffect as E } from "react";
3
- import le from "../Icons/ChevronLeft/ChevronLeft.js";
4
- import de from "../Icons/ChevronRight/ChevronRight.js";
5
- import { Wrapper as he, SlideArea as fe, NavButton as N, SlideViewport as me, SlideTrack as pe, PauseButton as ve, ProgressBar as we, DotsWrapper as ge, Dot as Me } from "./styles.js";
2
+ import { useState as c, useRef as T, useEffect as E } from "react";
3
+ import de from "../Icons/ChevronLeft/ChevronLeft.js";
4
+ import he from "../Icons/ChevronRight/ChevronRight.js";
5
+ import { Wrapper as fe, SlideArea as me, NavButton as A, SlideViewport as pe, SlideTrack as ve, PauseButton as we, ProgressBar as ge, DotsWrapper as $e, Dot as Me } from "./styles.js";
6
6
  const I = 50, R = 2e3, be = () => /* @__PURE__ */ X("svg", { width: 12, height: 12, viewBox: "0 0 12 12", fill: "currentColor", "aria-hidden": "true", children: [
7
7
  /* @__PURE__ */ r("rect", { x: "2", y: "1", width: "3", height: "10", rx: "1" }),
8
8
  /* @__PURE__ */ r("rect", { x: "7", y: "1", width: "3", height: "10", rx: "1" })
9
- ] }), $e = () => /* @__PURE__ */ r("svg", { width: 12, height: 12, viewBox: "0 0 12 12", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M2 1.5l9 4.5-9 4.5V1.5z" }) }), ke = ({
9
+ ] }), xe = () => /* @__PURE__ */ r("svg", { width: 12, height: 12, viewBox: "0 0 12 12", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M2 1.5l9 4.5-9 4.5V1.5z" }) }), Ce = ({
10
10
  data: P,
11
- renderCarousel: q,
11
+ renderCarousel: Y,
12
12
  visibleSlides: k = 1,
13
- overlayArrows: o = !1,
13
+ hasArrow: B = !0,
14
+ overlayArrows: i = !1,
14
15
  arrowTop: v,
15
- areDotsHidden: Y = !1,
16
+ areDotsHidden: G = !1,
16
17
  autoSlide: w = !1,
17
18
  autoSlideSec: C = 3,
18
19
  loop: l = !1,
19
20
  dragToSlide: g = !1,
20
- liveDrag: M = !1,
21
+ liveDrag: $ = !1,
21
22
  liveDragMobile: L = !0,
22
- showProgress: G = !1,
23
- defaultIndex: J = 0,
23
+ showProgress: J = !1,
24
+ defaultIndex: Q = 0,
24
25
  onSlideChange: y
25
26
  }) => {
26
- var K;
27
- const [n, b] = a(J), [B, d] = a(!0), [V, W] = a(!1), [h, f] = a(!1), [Q, m] = a(0), [F, p] = a(!1), [D, _] = a(!1), c = T(null), i = T(null), u = T(null), z = T(null);
27
+ var q;
28
+ const [n, M] = c(Q), [V, d] = c(!0), [W, F] = c(!1), [h, f] = c(!1), [Z, m] = c(0), [_, p] = c(!1), [D, z] = c(!1), a = T(null), o = T(null), u = T(null), H = T(null);
28
29
  E(() => {
29
30
  const e = window.matchMedia("(max-width: 1024px)");
30
- _(e.matches);
31
- const t = (ue) => _(ue.matches);
31
+ z(e.matches);
32
+ const t = (le) => z(le.matches);
32
33
  return e.addEventListener("change", t), () => e.removeEventListener("change", t);
33
34
  }, []);
34
- const s = P.length - k, $ = () => b((e) => l && e === 0 ? s : Math.max(e - 1, 0)), x = () => b((e) => l && e >= s ? 0 : Math.min(e + 1, s));
35
+ const s = P.length - k, b = () => M((e) => l && e === 0 ? s : Math.max(e - 1, 0)), x = () => M((e) => l && e >= s ? 0 : Math.min(e + 1, s));
35
36
  E(() => {
36
37
  y == null || y(n);
37
38
  }, [n]);
38
- const H = () => {
39
- o && (clearTimeout(u.current), d(!0), u.current = setTimeout(() => d(!1), R));
40
- }, Z = () => {
41
- f(!0), o && (clearTimeout(u.current), d(!0));
39
+ const U = () => {
40
+ i && (clearTimeout(u.current), d(!0), u.current = setTimeout(() => d(!1), R));
42
41
  }, S = () => {
43
- f(!1), o && (u.current = setTimeout(() => d(!1), R));
42
+ f(!0), i && (clearTimeout(u.current), d(!0));
43
+ }, ee = () => {
44
+ f(!1), i && (u.current = setTimeout(() => d(!1), R));
44
45
  };
45
46
  E(() => {
46
- if (o)
47
+ if (i)
47
48
  return u.current = setTimeout(() => d(!1), R), () => clearTimeout(u.current);
48
- }, [o]), E(() => {
49
+ }, [i]), E(() => {
49
50
  if (!w || h) return;
50
51
  const e = setInterval(() => {
51
- b((t) => t >= s ? 0 : t + 1);
52
+ M((t) => t >= s ? 0 : t + 1);
52
53
  }, C * 1e3);
53
54
  return () => clearInterval(e);
54
55
  }, [w, C, h, s]);
55
- const U = (e) => l ? e : n === 0 && e > 0 || n === s && e < 0 ? e * 0.3 : e, ee = (e) => {
56
- c.current = e.touches[0].clientX, L && D && p(!0), H();
57
- }, te = (e) => {
58
- !L || !D || c.current === null || m(U(e.touches[0].clientX - c.current));
56
+ const j = (e) => l ? e : n === 0 && e > 0 || n === s && e < 0 ? e * 0.3 : e, te = (e) => {
57
+ a.current = e.touches[0].clientX, L && D && p(!0), U();
59
58
  }, re = (e) => {
60
- if (L && D && (p(!1), m(0)), c.current === null) return;
61
- const t = c.current - e.changedTouches[0].clientX;
62
- t > I ? x() : t < -I && $(), c.current = null;
59
+ !L || !D || a.current === null || m(j(e.touches[0].clientX - a.current));
63
60
  }, ne = (e) => {
64
- g && (i.current = e.clientX, M && p(!0));
61
+ if (L && D && (p(!1), m(0)), a.current === null) return;
62
+ const t = a.current - e.changedTouches[0].clientX;
63
+ t > I ? x() : t < -I && b(), a.current = null;
65
64
  }, se = (e) => {
66
- !g || !M || i.current === null || m(U(e.clientX - i.current));
67
- }, oe = (e) => {
68
- if (!g || i.current === null) return;
69
- M && (p(!1), m(0));
70
- const t = i.current - e.clientX;
71
- t > I ? x() : t < -I && $(), i.current = null;
65
+ g && (o.current = e.clientX, $ && p(!0));
72
66
  }, ie = (e) => {
73
- e.key === "ArrowLeft" ? (e.preventDefault(), $()) : e.key === "ArrowRight" && (e.preventDefault(), x());
74
- }, j = ((K = z.current) == null ? void 0 : K.clientWidth) ?? 0, ae = j > 0 ? Q / j * 100 : 0, ce = -(n * (100 / k)) + ae, A = v !== void 0 ? typeof v == "number" ? `${v}px` : v : void 0, O = s + 1;
67
+ !g || !$ || o.current === null || m(j(e.clientX - o.current));
68
+ }, oe = (e) => {
69
+ if (!g || o.current === null) return;
70
+ $ && (p(!1), m(0));
71
+ const t = o.current - e.clientX;
72
+ t > I ? x() : t < -I && b(), o.current = null;
73
+ }, ce = (e) => {
74
+ e.key === "ArrowLeft" ? (e.preventDefault(), b()) : e.key === "ArrowRight" && (e.preventDefault(), x());
75
+ }, K = ((q = H.current) == null ? void 0 : q.clientWidth) ?? 0, ae = K > 0 ? Z / K * 100 : 0, ue = -(n * (100 / k)) + ae, N = v !== void 0 ? typeof v == "number" ? `${v}px` : v : void 0, O = s + 1;
75
76
  return /* @__PURE__ */ X(
76
- he,
77
+ fe,
77
78
  {
78
- onClick: H,
79
- onMouseEnter: Z,
80
- onMouseLeave: S,
81
- onMouseMove: se,
79
+ onClick: U,
80
+ onMouseEnter: S,
81
+ onMouseLeave: ee,
82
+ onMouseMove: ie,
82
83
  onMouseUp: oe,
83
- onKeyDown: ie,
84
+ onKeyDown: ce,
84
85
  role: "region",
85
86
  "aria-label": "Carousel",
86
87
  children: [
87
88
  /* @__PURE__ */ X(
88
- fe,
89
+ me,
89
90
  {
90
- onTouchStart: ee,
91
- onTouchMove: te,
92
- onTouchEnd: re,
91
+ onTouchStart: te,
92
+ onTouchMove: re,
93
+ onTouchEnd: ne,
93
94
  children: [
94
- /* @__PURE__ */ r(
95
- N,
95
+ B && /* @__PURE__ */ r(
96
+ A,
96
97
  {
97
- onClick: $,
98
+ onClick: b,
98
99
  disabled: !l && n === 0,
99
100
  "aria-label": "Previous slide",
100
- $overlay: o,
101
- $visible: B,
102
- $arrowTop: A,
103
- $viewportFocused: V,
104
- children: /* @__PURE__ */ r(le, { size: 20, "aria-hidden": "true" })
101
+ $direction: "prev",
102
+ $overlay: i,
103
+ $visible: V,
104
+ $arrowTop: N,
105
+ $viewportFocused: W,
106
+ children: /* @__PURE__ */ r(de, { size: 20, "aria-hidden": "true" })
105
107
  }
106
108
  ),
107
109
  /* @__PURE__ */ r(
108
- me,
110
+ pe,
109
111
  {
110
- ref: z,
112
+ ref: H,
111
113
  tabIndex: 0,
112
114
  "aria-label": "Carousel slides. Use arrow keys to navigate.",
113
115
  $draggable: g,
114
116
  onFocus: () => {
115
- W(!0), f(!0);
117
+ F(!0), f(!0);
116
118
  },
117
119
  onBlur: () => {
118
- W(!1), f(!1);
120
+ F(!1), f(!1);
119
121
  },
120
- onMouseDown: ne,
122
+ onMouseDown: se,
121
123
  onMouseLeave: (e) => {
122
- e.buttons !== 1 && (M && F && (p(!1), m(0)), i.current = null);
124
+ e.buttons !== 1 && ($ && _ && (p(!1), m(0)), o.current = null);
123
125
  },
124
- children: /* @__PURE__ */ r(pe, { $translateX: ce, $visibleSlides: k, $dragging: F, children: P.map(q) })
126
+ children: /* @__PURE__ */ r(ve, { $translateX: ue, $visibleSlides: k, $dragging: _, children: P.map(Y) })
125
127
  }
126
128
  ),
127
- /* @__PURE__ */ r(
128
- N,
129
+ B && /* @__PURE__ */ r(
130
+ A,
129
131
  {
130
132
  onClick: x,
131
133
  disabled: !l && n === s,
132
134
  "aria-label": "Next slide",
133
- $overlay: o,
134
- $visible: B,
135
- $arrowTop: A,
136
- $viewportFocused: V,
137
- children: /* @__PURE__ */ r(de, { size: 20, "aria-hidden": "true" })
135
+ $direction: "next",
136
+ $overlay: i,
137
+ $visible: V,
138
+ $arrowTop: N,
139
+ $viewportFocused: W,
140
+ children: /* @__PURE__ */ r(he, { size: 20, "aria-hidden": "true" })
138
141
  }
139
142
  ),
140
143
  w && /* @__PURE__ */ r(
141
- ve,
144
+ we,
142
145
  {
143
146
  onClick: () => f((e) => !e),
144
147
  "aria-label": h ? "Play slideshow" : "Pause slideshow",
145
- children: h ? /* @__PURE__ */ r($e, {}) : /* @__PURE__ */ r(be, {})
148
+ children: h ? /* @__PURE__ */ r(xe, {}) : /* @__PURE__ */ r(be, {})
146
149
  }
147
150
  )
148
151
  ]
@@ -169,12 +172,12 @@ const I = 50, R = 2e3, be = () => /* @__PURE__ */ X("svg", { width: 12, height:
169
172
  ]
170
173
  }
171
174
  ),
172
- w && G && /* @__PURE__ */ r(we, { $duration: C, $paused: h }, n),
173
- !Y && /* @__PURE__ */ r(ge, { children: Array.from({ length: O }).map((e, t) => /* @__PURE__ */ r(
175
+ w && J && /* @__PURE__ */ r(ge, { $duration: C, $paused: h }, n),
176
+ !G && /* @__PURE__ */ r($e, { children: Array.from({ length: O }).map((e, t) => /* @__PURE__ */ r(
174
177
  Me,
175
178
  {
176
179
  $active: t === n,
177
- onClick: () => b(t),
180
+ onClick: () => M(t),
178
181
  "aria-label": `Slide ${t + 1} of ${O}`,
179
182
  "aria-current": t === n ? "true" : void 0
180
183
  },
@@ -185,5 +188,5 @@ const I = 50, R = 2e3, be = () => /* @__PURE__ */ X("svg", { width: 12, height:
185
188
  );
186
189
  };
187
190
  export {
188
- ke as default
191
+ Ce as default
189
192
  };
@@ -54,13 +54,7 @@ const d = o.div`
54
54
  opacity 0.3s;
55
55
  padding: 0;
56
56
 
57
- &:first-of-type {
58
- left: ${({ $overlay: e }) => e ? "12px" : "-16px"};
59
- }
60
-
61
- &:last-of-type {
62
- right: ${({ $overlay: e }) => e ? "12px" : "-16px"};
63
- }
57
+ ${({ $direction: e, $overlay: t }) => e === "prev" ? `left: ${t ? "12px" : "-16px"};` : `right: ${t ? "12px" : "-16px"};`}
64
58
 
65
59
  &:hover:not(:disabled) {
66
60
  background: #f5f5f5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meticulous-ui",
3
- "version": "3.1.1",
3
+ "version": "3.1.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",