meticulous-ui 3.1.1 → 3.1.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,45 +1,46 @@
1
1
  import { jsxs as X, jsx as r } from "react/jsx-runtime";
2
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";
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: [
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 Me, Dot as be } from "./styles.js";
6
+ const I = 50, R = 2e3, $e = () => /* @__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
+ hasArrow: B = !0,
13
14
  overlayArrows: o = !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
21
  liveDrag: M = !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, b] = a(Q), [V, d] = a(!0), [W, F] = a(!1), [h, f] = a(!1), [Z, m] = a(0), [_, p] = a(!1), [D, z] = a(!1), c = T(null), i = 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
35
  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
36
  E(() => {
36
37
  y == null || y(n);
37
38
  }, [n]);
38
- const H = () => {
39
+ const U = () => {
39
40
  o && (clearTimeout(u.current), d(!0), u.current = setTimeout(() => d(!1), R));
40
- }, Z = () => {
41
- f(!0), o && (clearTimeout(u.current), d(!0));
42
41
  }, S = () => {
42
+ f(!0), o && (clearTimeout(u.current), d(!0));
43
+ }, ee = () => {
43
44
  f(!1), o && (u.current = setTimeout(() => d(!1), R));
44
45
  };
45
46
  E(() => {
@@ -52,97 +53,97 @@ const I = 50, R = 2e3, be = () => /* @__PURE__ */ X("svg", { width: 12, height:
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
+ c.current = e.touches[0].clientX, L && D && p(!0), U();
59
58
  }, re = (e) => {
59
+ !L || !D || c.current === null || m(j(e.touches[0].clientX - c.current));
60
+ }, ne = (e) => {
60
61
  if (L && D && (p(!1), m(0)), c.current === null) return;
61
62
  const t = c.current - e.changedTouches[0].clientX;
62
63
  t > I ? x() : t < -I && $(), c.current = null;
63
- }, ne = (e) => {
64
- g && (i.current = e.clientX, M && p(!0));
65
64
  }, se = (e) => {
66
- !g || !M || i.current === null || m(U(e.clientX - i.current));
65
+ g && (i.current = e.clientX, M && p(!0));
67
66
  }, oe = (e) => {
67
+ !g || !M || i.current === null || m(j(e.clientX - i.current));
68
+ }, ie = (e) => {
68
69
  if (!g || i.current === null) return;
69
70
  M && (p(!1), m(0));
70
71
  const t = i.current - e.clientX;
71
72
  t > I ? x() : t < -I && $(), i.current = null;
72
- }, ie = (e) => {
73
+ }, ae = (e) => {
73
74
  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;
75
+ }, K = ((q = H.current) == null ? void 0 : q.clientWidth) ?? 0, ce = K > 0 ? Z / K * 100 : 0, ue = -(n * (100 / k)) + ce, 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,
82
- onMouseUp: oe,
83
- onKeyDown: ie,
79
+ onClick: U,
80
+ onMouseEnter: S,
81
+ onMouseLeave: ee,
82
+ onMouseMove: oe,
83
+ onMouseUp: ie,
84
+ onKeyDown: ae,
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
98
  onClick: $,
98
99
  disabled: !l && n === 0,
99
100
  "aria-label": "Previous slide",
100
101
  $overlay: o,
101
- $visible: B,
102
- $arrowTop: A,
103
- $viewportFocused: V,
104
- children: /* @__PURE__ */ r(le, { size: 20, "aria-hidden": "true" })
102
+ $visible: V,
103
+ $arrowTop: N,
104
+ $viewportFocused: W,
105
+ children: /* @__PURE__ */ r(de, { size: 20, "aria-hidden": "true" })
105
106
  }
106
107
  ),
107
108
  /* @__PURE__ */ r(
108
- me,
109
+ pe,
109
110
  {
110
- ref: z,
111
+ ref: H,
111
112
  tabIndex: 0,
112
113
  "aria-label": "Carousel slides. Use arrow keys to navigate.",
113
114
  $draggable: g,
114
115
  onFocus: () => {
115
- W(!0), f(!0);
116
+ F(!0), f(!0);
116
117
  },
117
118
  onBlur: () => {
118
- W(!1), f(!1);
119
+ F(!1), f(!1);
119
120
  },
120
- onMouseDown: ne,
121
+ onMouseDown: se,
121
122
  onMouseLeave: (e) => {
122
- e.buttons !== 1 && (M && F && (p(!1), m(0)), i.current = null);
123
+ e.buttons !== 1 && (M && _ && (p(!1), m(0)), i.current = null);
123
124
  },
124
- children: /* @__PURE__ */ r(pe, { $translateX: ce, $visibleSlides: k, $dragging: F, children: P.map(q) })
125
+ children: /* @__PURE__ */ r(ve, { $translateX: ue, $visibleSlides: k, $dragging: _, children: P.map(Y) })
125
126
  }
126
127
  ),
127
- /* @__PURE__ */ r(
128
- N,
128
+ B && /* @__PURE__ */ r(
129
+ A,
129
130
  {
130
131
  onClick: x,
131
132
  disabled: !l && n === s,
132
133
  "aria-label": "Next slide",
133
134
  $overlay: o,
134
- $visible: B,
135
- $arrowTop: A,
136
- $viewportFocused: V,
137
- children: /* @__PURE__ */ r(de, { size: 20, "aria-hidden": "true" })
135
+ $visible: V,
136
+ $arrowTop: N,
137
+ $viewportFocused: W,
138
+ children: /* @__PURE__ */ r(he, { size: 20, "aria-hidden": "true" })
138
139
  }
139
140
  ),
140
141
  w && /* @__PURE__ */ r(
141
- ve,
142
+ we,
142
143
  {
143
144
  onClick: () => f((e) => !e),
144
145
  "aria-label": h ? "Play slideshow" : "Pause slideshow",
145
- children: h ? /* @__PURE__ */ r($e, {}) : /* @__PURE__ */ r(be, {})
146
+ children: h ? /* @__PURE__ */ r(xe, {}) : /* @__PURE__ */ r($e, {})
146
147
  }
147
148
  )
148
149
  ]
@@ -169,9 +170,9 @@ const I = 50, R = 2e3, be = () => /* @__PURE__ */ X("svg", { width: 12, height:
169
170
  ]
170
171
  }
171
172
  ),
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(
174
- Me,
173
+ w && J && /* @__PURE__ */ r(ge, { $duration: C, $paused: h }, n),
174
+ !G && /* @__PURE__ */ r(Me, { children: Array.from({ length: O }).map((e, t) => /* @__PURE__ */ r(
175
+ be,
175
176
  {
176
177
  $active: t === n,
177
178
  onClick: () => b(t),
@@ -185,5 +186,5 @@ const I = 50, R = 2e3, be = () => /* @__PURE__ */ X("svg", { width: 12, height:
185
186
  );
186
187
  };
187
188
  export {
188
- ke as default
189
+ Ce as default
189
190
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meticulous-ui",
3
- "version": "3.1.1",
3
+ "version": "3.1.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",