meticulous-ui 3.1.2 → 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,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as X, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as c, useRef as T, useEffect as E } from "react";
|
|
3
3
|
import de from "../Icons/ChevronLeft/ChevronLeft.js";
|
|
4
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
|
|
6
|
-
const I = 50, R = 2e3,
|
|
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
|
+
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
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 = ({
|
|
@@ -11,77 +11,77 @@ const I = 50, R = 2e3, $e = () => /* @__PURE__ */ X("svg", { width: 12, height:
|
|
|
11
11
|
renderCarousel: Y,
|
|
12
12
|
visibleSlides: k = 1,
|
|
13
13
|
hasArrow: B = !0,
|
|
14
|
-
overlayArrows:
|
|
14
|
+
overlayArrows: i = !1,
|
|
15
15
|
arrowTop: v,
|
|
16
16
|
areDotsHidden: G = !1,
|
|
17
17
|
autoSlide: w = !1,
|
|
18
18
|
autoSlideSec: C = 3,
|
|
19
19
|
loop: l = !1,
|
|
20
20
|
dragToSlide: g = !1,
|
|
21
|
-
liveDrag:
|
|
21
|
+
liveDrag: $ = !1,
|
|
22
22
|
liveDragMobile: L = !0,
|
|
23
23
|
showProgress: J = !1,
|
|
24
24
|
defaultIndex: Q = 0,
|
|
25
25
|
onSlideChange: y
|
|
26
26
|
}) => {
|
|
27
27
|
var q;
|
|
28
|
-
const [n,
|
|
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);
|
|
29
29
|
E(() => {
|
|
30
30
|
const e = window.matchMedia("(max-width: 1024px)");
|
|
31
31
|
z(e.matches);
|
|
32
32
|
const t = (le) => z(le.matches);
|
|
33
33
|
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
34
34
|
}, []);
|
|
35
|
-
const s = P.length - k,
|
|
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));
|
|
36
36
|
E(() => {
|
|
37
37
|
y == null || y(n);
|
|
38
38
|
}, [n]);
|
|
39
39
|
const U = () => {
|
|
40
|
-
|
|
40
|
+
i && (clearTimeout(u.current), d(!0), u.current = setTimeout(() => d(!1), R));
|
|
41
41
|
}, S = () => {
|
|
42
|
-
f(!0),
|
|
42
|
+
f(!0), i && (clearTimeout(u.current), d(!0));
|
|
43
43
|
}, ee = () => {
|
|
44
|
-
f(!1),
|
|
44
|
+
f(!1), i && (u.current = setTimeout(() => d(!1), R));
|
|
45
45
|
};
|
|
46
46
|
E(() => {
|
|
47
|
-
if (
|
|
47
|
+
if (i)
|
|
48
48
|
return u.current = setTimeout(() => d(!1), R), () => clearTimeout(u.current);
|
|
49
|
-
}, [
|
|
49
|
+
}, [i]), E(() => {
|
|
50
50
|
if (!w || h) return;
|
|
51
51
|
const e = setInterval(() => {
|
|
52
|
-
|
|
52
|
+
M((t) => t >= s ? 0 : t + 1);
|
|
53
53
|
}, C * 1e3);
|
|
54
54
|
return () => clearInterval(e);
|
|
55
55
|
}, [w, C, h, s]);
|
|
56
56
|
const j = (e) => l ? e : n === 0 && e > 0 || n === s && e < 0 ? e * 0.3 : e, te = (e) => {
|
|
57
|
-
|
|
57
|
+
a.current = e.touches[0].clientX, L && D && p(!0), U();
|
|
58
58
|
}, re = (e) => {
|
|
59
|
-
!L || !D ||
|
|
59
|
+
!L || !D || a.current === null || m(j(e.touches[0].clientX - a.current));
|
|
60
60
|
}, ne = (e) => {
|
|
61
|
-
if (L && D && (p(!1), m(0)),
|
|
62
|
-
const t =
|
|
63
|
-
t > I ? x() : t < -I &&
|
|
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;
|
|
64
64
|
}, se = (e) => {
|
|
65
|
-
g && (
|
|
66
|
-
}, oe = (e) => {
|
|
67
|
-
!g || !M || i.current === null || m(j(e.clientX - i.current));
|
|
65
|
+
g && (o.current = e.clientX, $ && p(!0));
|
|
68
66
|
}, ie = (e) => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
},
|
|
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;
|
|
76
76
|
return /* @__PURE__ */ X(
|
|
77
77
|
fe,
|
|
78
78
|
{
|
|
79
79
|
onClick: U,
|
|
80
80
|
onMouseEnter: S,
|
|
81
81
|
onMouseLeave: ee,
|
|
82
|
-
onMouseMove:
|
|
83
|
-
onMouseUp:
|
|
84
|
-
onKeyDown:
|
|
82
|
+
onMouseMove: ie,
|
|
83
|
+
onMouseUp: oe,
|
|
84
|
+
onKeyDown: ce,
|
|
85
85
|
role: "region",
|
|
86
86
|
"aria-label": "Carousel",
|
|
87
87
|
children: [
|
|
@@ -95,10 +95,11 @@ const I = 50, R = 2e3, $e = () => /* @__PURE__ */ X("svg", { width: 12, height:
|
|
|
95
95
|
B && /* @__PURE__ */ r(
|
|
96
96
|
A,
|
|
97
97
|
{
|
|
98
|
-
onClick:
|
|
98
|
+
onClick: b,
|
|
99
99
|
disabled: !l && n === 0,
|
|
100
100
|
"aria-label": "Previous slide",
|
|
101
|
-
$
|
|
101
|
+
$direction: "prev",
|
|
102
|
+
$overlay: i,
|
|
102
103
|
$visible: V,
|
|
103
104
|
$arrowTop: N,
|
|
104
105
|
$viewportFocused: W,
|
|
@@ -120,7 +121,7 @@ const I = 50, R = 2e3, $e = () => /* @__PURE__ */ X("svg", { width: 12, height:
|
|
|
120
121
|
},
|
|
121
122
|
onMouseDown: se,
|
|
122
123
|
onMouseLeave: (e) => {
|
|
123
|
-
e.buttons !== 1 && (
|
|
124
|
+
e.buttons !== 1 && ($ && _ && (p(!1), m(0)), o.current = null);
|
|
124
125
|
},
|
|
125
126
|
children: /* @__PURE__ */ r(ve, { $translateX: ue, $visibleSlides: k, $dragging: _, children: P.map(Y) })
|
|
126
127
|
}
|
|
@@ -131,7 +132,8 @@ const I = 50, R = 2e3, $e = () => /* @__PURE__ */ X("svg", { width: 12, height:
|
|
|
131
132
|
onClick: x,
|
|
132
133
|
disabled: !l && n === s,
|
|
133
134
|
"aria-label": "Next slide",
|
|
134
|
-
$
|
|
135
|
+
$direction: "next",
|
|
136
|
+
$overlay: i,
|
|
135
137
|
$visible: V,
|
|
136
138
|
$arrowTop: N,
|
|
137
139
|
$viewportFocused: W,
|
|
@@ -143,7 +145,7 @@ const I = 50, R = 2e3, $e = () => /* @__PURE__ */ X("svg", { width: 12, height:
|
|
|
143
145
|
{
|
|
144
146
|
onClick: () => f((e) => !e),
|
|
145
147
|
"aria-label": h ? "Play slideshow" : "Pause slideshow",
|
|
146
|
-
children: h ? /* @__PURE__ */ r(xe, {}) : /* @__PURE__ */ r(
|
|
148
|
+
children: h ? /* @__PURE__ */ r(xe, {}) : /* @__PURE__ */ r(be, {})
|
|
147
149
|
}
|
|
148
150
|
)
|
|
149
151
|
]
|
|
@@ -171,11 +173,11 @@ const I = 50, R = 2e3, $e = () => /* @__PURE__ */ X("svg", { width: 12, height:
|
|
|
171
173
|
}
|
|
172
174
|
),
|
|
173
175
|
w && J && /* @__PURE__ */ r(ge, { $duration: C, $paused: h }, n),
|
|
174
|
-
!G && /* @__PURE__ */ r(
|
|
175
|
-
|
|
176
|
+
!G && /* @__PURE__ */ r($e, { children: Array.from({ length: O }).map((e, t) => /* @__PURE__ */ r(
|
|
177
|
+
Me,
|
|
176
178
|
{
|
|
177
179
|
$active: t === n,
|
|
178
|
-
onClick: () =>
|
|
180
|
+
onClick: () => M(t),
|
|
179
181
|
"aria-label": `Slide ${t + 1} of ${O}`,
|
|
180
182
|
"aria-current": t === n ? "true" : void 0
|
|
181
183
|
},
|
|
@@ -54,13 +54,7 @@ const d = o.div`
|
|
|
54
54
|
opacity 0.3s;
|
|
55
55
|
padding: 0;
|
|
56
56
|
|
|
57
|
-
|
|
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.
|
|
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",
|