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
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Wrapper as
|
|
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
|
-
] }),
|
|
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:
|
|
11
|
+
renderCarousel: Y,
|
|
12
12
|
visibleSlides: k = 1,
|
|
13
|
-
|
|
13
|
+
hasArrow: B = !0,
|
|
14
|
+
overlayArrows: i = !1,
|
|
14
15
|
arrowTop: v,
|
|
15
|
-
areDotsHidden:
|
|
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:
|
|
21
|
+
liveDrag: $ = !1,
|
|
21
22
|
liveDragMobile: L = !0,
|
|
22
|
-
showProgress:
|
|
23
|
-
defaultIndex:
|
|
23
|
+
showProgress: J = !1,
|
|
24
|
+
defaultIndex: Q = 0,
|
|
24
25
|
onSlideChange: y
|
|
25
26
|
}) => {
|
|
26
|
-
var
|
|
27
|
-
const [n,
|
|
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
|
-
|
|
31
|
-
const t = (
|
|
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,
|
|
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
|
|
39
|
-
|
|
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(!
|
|
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 (
|
|
47
|
+
if (i)
|
|
47
48
|
return u.current = setTimeout(() => d(!1), R), () => clearTimeout(u.current);
|
|
48
|
-
}, [
|
|
49
|
+
}, [i]), E(() => {
|
|
49
50
|
if (!w || h) return;
|
|
50
51
|
const e = setInterval(() => {
|
|
51
|
-
|
|
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
|
|
56
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
74
|
-
},
|
|
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
|
-
|
|
77
|
+
fe,
|
|
77
78
|
{
|
|
78
|
-
onClick:
|
|
79
|
-
onMouseEnter:
|
|
80
|
-
onMouseLeave:
|
|
81
|
-
onMouseMove:
|
|
79
|
+
onClick: U,
|
|
80
|
+
onMouseEnter: S,
|
|
81
|
+
onMouseLeave: ee,
|
|
82
|
+
onMouseMove: ie,
|
|
82
83
|
onMouseUp: oe,
|
|
83
|
-
onKeyDown:
|
|
84
|
+
onKeyDown: ce,
|
|
84
85
|
role: "region",
|
|
85
86
|
"aria-label": "Carousel",
|
|
86
87
|
children: [
|
|
87
88
|
/* @__PURE__ */ X(
|
|
88
|
-
|
|
89
|
+
me,
|
|
89
90
|
{
|
|
90
|
-
onTouchStart:
|
|
91
|
-
onTouchMove:
|
|
92
|
-
onTouchEnd:
|
|
91
|
+
onTouchStart: te,
|
|
92
|
+
onTouchMove: re,
|
|
93
|
+
onTouchEnd: ne,
|
|
93
94
|
children: [
|
|
94
|
-
/* @__PURE__ */ r(
|
|
95
|
-
|
|
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
|
-
$
|
|
101
|
-
$
|
|
102
|
-
$
|
|
103
|
-
$
|
|
104
|
-
|
|
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
|
-
|
|
110
|
+
pe,
|
|
109
111
|
{
|
|
110
|
-
ref:
|
|
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
|
-
|
|
117
|
+
F(!0), f(!0);
|
|
116
118
|
},
|
|
117
119
|
onBlur: () => {
|
|
118
|
-
|
|
120
|
+
F(!1), f(!1);
|
|
119
121
|
},
|
|
120
|
-
onMouseDown:
|
|
122
|
+
onMouseDown: se,
|
|
121
123
|
onMouseLeave: (e) => {
|
|
122
|
-
e.buttons !== 1 && (
|
|
124
|
+
e.buttons !== 1 && ($ && _ && (p(!1), m(0)), o.current = null);
|
|
123
125
|
},
|
|
124
|
-
children: /* @__PURE__ */ r(
|
|
126
|
+
children: /* @__PURE__ */ r(ve, { $translateX: ue, $visibleSlides: k, $dragging: _, children: P.map(Y) })
|
|
125
127
|
}
|
|
126
128
|
),
|
|
127
|
-
/* @__PURE__ */ r(
|
|
128
|
-
|
|
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
|
-
$
|
|
134
|
-
$
|
|
135
|
-
$
|
|
136
|
-
$
|
|
137
|
-
|
|
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
|
-
|
|
144
|
+
we,
|
|
142
145
|
{
|
|
143
146
|
onClick: () => f((e) => !e),
|
|
144
147
|
"aria-label": h ? "Play slideshow" : "Pause slideshow",
|
|
145
|
-
children: h ? /* @__PURE__ */ r(
|
|
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 &&
|
|
173
|
-
!
|
|
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: () =>
|
|
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
|
-
|
|
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
|
-
|
|
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",
|