quirk-ui 0.0.62 → 0.0.63
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,33 +1,33 @@
|
|
|
1
1
|
import { jsxs as w, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { useState as v, useRef as
|
|
3
|
-
import { A as
|
|
4
|
-
import { A as
|
|
5
|
-
import '../../assets/index31.css';const
|
|
6
|
-
carousel:
|
|
7
|
-
trackContainer:
|
|
8
|
-
track:
|
|
9
|
-
page:
|
|
10
|
-
controls:
|
|
11
|
-
indicators:
|
|
12
|
-
indicator:
|
|
13
|
-
active:
|
|
14
|
-
buttons:
|
|
2
|
+
import { useState as v, useRef as M, useEffect as x } from "react";
|
|
3
|
+
import { A as q } from "../../arrow-left-BIJvHwNQ.js";
|
|
4
|
+
import { A as B } from "../../arrow-right-QEwnX3Sk.js";
|
|
5
|
+
import '../../assets/index31.css';const F = "_carousel_u7gup_1", H = "_trackContainer_u7gup_9", J = "_track_u7gup_9", K = "_page_u7gup_24", Q = "_controls_u7gup_30", S = "_indicators_u7gup_47", U = "_indicator_u7gup_47", V = "_active_u7gup_64", Y = "_buttons_u7gup_68", Z = "_prev_u7gup_73", P = "_disabled_u7gup_73", tt = "_next_u7gup_74", n = {
|
|
6
|
+
carousel: F,
|
|
7
|
+
trackContainer: H,
|
|
8
|
+
track: J,
|
|
9
|
+
page: K,
|
|
10
|
+
controls: Q,
|
|
11
|
+
indicators: S,
|
|
12
|
+
indicator: U,
|
|
13
|
+
active: V,
|
|
14
|
+
buttons: Y,
|
|
15
15
|
prev: Z,
|
|
16
16
|
disabled: P,
|
|
17
17
|
next: tt
|
|
18
18
|
};
|
|
19
19
|
function ct({
|
|
20
|
-
items:
|
|
20
|
+
items: $,
|
|
21
21
|
itemsPerPage: f = 9,
|
|
22
|
-
itemsPerRow:
|
|
22
|
+
itemsPerRow: W = 3,
|
|
23
23
|
autoPlay: o = !1,
|
|
24
|
-
autoPlayInterval:
|
|
25
|
-
className:
|
|
24
|
+
autoPlayInterval: N = 3,
|
|
25
|
+
className: A,
|
|
26
26
|
externalRef: z,
|
|
27
27
|
siblingRef: a,
|
|
28
28
|
isSplit: b = !1
|
|
29
29
|
}) {
|
|
30
|
-
const [i, l] = v(0), [u, h] = v(0), [p,
|
|
30
|
+
const [i, l] = v(0), [u, h] = v(0), [p, y] = v(f), [k, T] = v(!1), E = M(null), g = M(null), _ = z, L = (t, e) => {
|
|
31
31
|
const c = [];
|
|
32
32
|
for (let s = 0; s < t.length; s += e)
|
|
33
33
|
c.push(t.slice(s, s + e));
|
|
@@ -36,36 +36,36 @@ function ct({
|
|
|
36
36
|
x(() => {
|
|
37
37
|
const t = () => {
|
|
38
38
|
const e = window.innerWidth < 768;
|
|
39
|
-
|
|
39
|
+
T(e), y(e ? 1 : f), l(0);
|
|
40
40
|
};
|
|
41
41
|
return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
42
42
|
}, [f]);
|
|
43
|
-
const m = Math.ceil(p /
|
|
43
|
+
const m = Math.ceil(p / W), C = L($, p), d = C.length, j = 3 * 16, R = 6 * 16;
|
|
44
44
|
x(() => {
|
|
45
45
|
const t = new ResizeObserver((e) => {
|
|
46
46
|
var c;
|
|
47
47
|
for (let s of e)
|
|
48
|
-
s.contentRect && (k ? h(s.contentRect.width -
|
|
49
|
-
s.contentRect.width - ((c = a == null ? void 0 : a.current) == null ? void 0 : c.offsetWidth) -
|
|
48
|
+
s.contentRect && (k ? h(s.contentRect.width - R) : b && a != null && a.current ? h(
|
|
49
|
+
s.contentRect.width - ((c = a == null ? void 0 : a.current) == null ? void 0 : c.offsetWidth) - j
|
|
50
50
|
) : h(s.contentRect.width), l(0));
|
|
51
51
|
});
|
|
52
52
|
return _ != null && _.current && t.observe(_.current), () => t.disconnect();
|
|
53
53
|
}, [k, b]);
|
|
54
|
-
const
|
|
54
|
+
const X = () => {
|
|
55
55
|
l((t) => Math.min(t + 1, d - 1));
|
|
56
|
-
},
|
|
56
|
+
}, D = () => {
|
|
57
57
|
l((t) => Math.max(t - 1, 0));
|
|
58
|
-
},
|
|
58
|
+
}, G = (t) => {
|
|
59
59
|
l(t);
|
|
60
|
-
},
|
|
60
|
+
}, O = () => u ? `translateX(-${i * u}px)` : "translateX(0px)", I = () => {
|
|
61
61
|
l((t) => t >= d - 1 ? 0 : t + 1);
|
|
62
62
|
};
|
|
63
|
-
return x(() => (o && (
|
|
63
|
+
return x(() => (o && (g.current = setInterval(
|
|
64
64
|
I,
|
|
65
|
-
|
|
65
|
+
N * 1e3
|
|
66
66
|
)), () => {
|
|
67
67
|
g.current && clearInterval(g.current);
|
|
68
|
-
}), [o,
|
|
68
|
+
}), [o, N, I]), /* @__PURE__ */ w("div", { className: `${A ?? ""} ${n.carousel}`, ref: E, children: [
|
|
69
69
|
/* @__PURE__ */ r(
|
|
70
70
|
"div",
|
|
71
71
|
{
|
|
@@ -75,7 +75,7 @@ function ct({
|
|
|
75
75
|
"div",
|
|
76
76
|
{
|
|
77
77
|
className: n.track,
|
|
78
|
-
style: { width: `${d * 100}%`, transform:
|
|
78
|
+
style: { width: `${d * 100}%`, transform: O() },
|
|
79
79
|
children: C.map((t, e) => /* @__PURE__ */ r(
|
|
80
80
|
"div",
|
|
81
81
|
{
|
|
@@ -111,7 +111,7 @@ function ct({
|
|
|
111
111
|
"button",
|
|
112
112
|
{
|
|
113
113
|
className: `${n.indicator} ${e === i ? n.active : ""}`,
|
|
114
|
-
onClick: () =>
|
|
114
|
+
onClick: () => G(e),
|
|
115
115
|
"aria-label": `Go to group ${e + 1}`
|
|
116
116
|
},
|
|
117
117
|
e
|
|
@@ -122,9 +122,9 @@ function ct({
|
|
|
122
122
|
{
|
|
123
123
|
"aria-label": "Previous slide",
|
|
124
124
|
className: `${n.prev} ${!o && i === 0 ? n.disabled : ""}`,
|
|
125
|
-
onClick:
|
|
125
|
+
onClick: D,
|
|
126
126
|
disabled: !o && i === 0,
|
|
127
|
-
children: /* @__PURE__ */ r(
|
|
127
|
+
children: /* @__PURE__ */ r(q, { size: 36 })
|
|
128
128
|
}
|
|
129
129
|
),
|
|
130
130
|
/* @__PURE__ */ r(
|
|
@@ -132,9 +132,9 @@ function ct({
|
|
|
132
132
|
{
|
|
133
133
|
"aria-label": "Next slide",
|
|
134
134
|
className: `${n.next} ${!o && i >= d - 1 ? n.disabled : ""}`,
|
|
135
|
-
onClick:
|
|
136
|
-
disabled: !o && i >=
|
|
137
|
-
children: /* @__PURE__ */ r(
|
|
135
|
+
onClick: X,
|
|
136
|
+
disabled: !o && i >= $.length - p,
|
|
137
|
+
children: /* @__PURE__ */ r(B, { size: 36 })
|
|
138
138
|
}
|
|
139
139
|
)
|
|
140
140
|
] })
|