quirk-ui 0.0.55 → 0.0.56
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,5 +1,5 @@
|
|
|
1
|
-
import { jsxs as x, jsx as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as x, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v, useRef as M, useEffect as $ } from "react";
|
|
3
3
|
import { A as O } from "../../arrow-left-BIJvHwNQ.js";
|
|
4
4
|
import { A as q } from "../../arrow-right-QEwnX3Sk.js";
|
|
5
5
|
import '../../assets/index31.css';const B = "_carousel_pk3a7_1", F = "_trackContainer_pk3a7_9", H = "_track_pk3a7_9", J = "_page_pk3a7_24", K = "_controls_pk3a7_30", Q = "_indicators_pk3a7_47", S = "_indicator_pk3a7_47", U = "_active_pk3a7_64", V = "_buttons_pk3a7_68", Y = "_prev_pk3a7_73", Z = "_disabled_pk3a7_73", P = "_next_pk3a7_74", n = {
|
|
@@ -16,62 +16,62 @@ import '../../assets/index31.css';const B = "_carousel_pk3a7_1", F = "_trackCont
|
|
|
16
16
|
disabled: Z,
|
|
17
17
|
next: P
|
|
18
18
|
};
|
|
19
|
-
function
|
|
20
|
-
items:
|
|
21
|
-
itemsPerPage:
|
|
19
|
+
function st({
|
|
20
|
+
items: b,
|
|
21
|
+
itemsPerPage: k = 9,
|
|
22
22
|
itemsPerRow: W = 3,
|
|
23
|
-
autoPlay:
|
|
24
|
-
autoPlayInterval:
|
|
23
|
+
autoPlay: a = !1,
|
|
24
|
+
autoPlayInterval: N = 3e3,
|
|
25
25
|
className: z,
|
|
26
26
|
externalRef: A,
|
|
27
|
-
siblingRef:
|
|
28
|
-
isSplit:
|
|
27
|
+
siblingRef: o,
|
|
28
|
+
isSplit: C = !1
|
|
29
29
|
}) {
|
|
30
|
-
const [i, l] =
|
|
31
|
-
const
|
|
32
|
-
for (let
|
|
33
|
-
|
|
34
|
-
return
|
|
30
|
+
const [i, l] = v(0), [d, h] = v(0), [_, y] = v(k), [g, T] = v(!1), E = M(null), f = M(null), u = A, L = (t, e) => {
|
|
31
|
+
const c = [];
|
|
32
|
+
for (let r = 0; r < t.length; r += e)
|
|
33
|
+
c.push(t.slice(r, r + e));
|
|
34
|
+
return c;
|
|
35
35
|
};
|
|
36
36
|
$(() => {
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
37
|
+
const t = () => {
|
|
38
|
+
const e = window.innerWidth < 768;
|
|
39
|
+
T(e), y(e ? 1 : k), l(0);
|
|
40
40
|
};
|
|
41
|
-
return
|
|
42
|
-
}, [
|
|
43
|
-
const m = Math.ceil(_ / W), I =
|
|
41
|
+
return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
42
|
+
}, [k]);
|
|
43
|
+
const m = Math.ceil(_ / W), I = L(b, _), p = I.length, j = 3 * 16, R = 6 * 16;
|
|
44
44
|
$(() => {
|
|
45
|
-
const
|
|
46
|
-
var
|
|
47
|
-
for (let
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
)
|
|
45
|
+
const t = new ResizeObserver((e) => {
|
|
46
|
+
var c;
|
|
47
|
+
for (let r of e)
|
|
48
|
+
r.contentRect && (g ? h(r.contentRect.width - R) : C && o != null && o.current ? h(
|
|
49
|
+
r.contentRect.width - ((c = o == null ? void 0 : o.current) == null ? void 0 : c.offsetWidth) - j
|
|
50
|
+
) : h(r.contentRect.width), l(0));
|
|
51
51
|
});
|
|
52
|
-
return
|
|
53
|
-
}, [
|
|
54
|
-
const
|
|
55
|
-
l((
|
|
52
|
+
return u != null && u.current && t.observe(u.current), () => t.disconnect();
|
|
53
|
+
}, [g, C]);
|
|
54
|
+
const w = () => {
|
|
55
|
+
l((t) => Math.min(t + 1, p - 1));
|
|
56
56
|
}, X = () => {
|
|
57
|
-
l((
|
|
58
|
-
}, D = (
|
|
59
|
-
l(
|
|
57
|
+
l((t) => Math.max(t - 1, 0));
|
|
58
|
+
}, D = (t) => {
|
|
59
|
+
l(t);
|
|
60
60
|
}, G = () => d ? `translateX(-${i * d}px)` : "translateX(0px)";
|
|
61
|
-
return $(() => (
|
|
62
|
-
|
|
63
|
-
}), [
|
|
64
|
-
/* @__PURE__ */
|
|
61
|
+
return $(() => (a && (f.current = setInterval(w, N)), () => {
|
|
62
|
+
f.current && clearInterval(f.current);
|
|
63
|
+
}), [a, N, w]), /* @__PURE__ */ x("div", { className: `${z ?? ""} ${n.carousel}`, ref: E, children: [
|
|
64
|
+
/* @__PURE__ */ s(
|
|
65
65
|
"div",
|
|
66
66
|
{
|
|
67
67
|
className: n.trackContainer,
|
|
68
68
|
style: { maxWidth: `${d}px` },
|
|
69
|
-
children: /* @__PURE__ */
|
|
69
|
+
children: /* @__PURE__ */ s(
|
|
70
70
|
"div",
|
|
71
71
|
{
|
|
72
72
|
className: n.track,
|
|
73
73
|
style: { width: `${p * 100}%`, transform: G() },
|
|
74
|
-
children: I.map((
|
|
74
|
+
children: I.map((t, e) => /* @__PURE__ */ s(
|
|
75
75
|
"div",
|
|
76
76
|
{
|
|
77
77
|
className: n.page,
|
|
@@ -83,53 +83,53 @@ function oe({
|
|
|
83
83
|
gridTemplateRows: `repeat(${m}, auto)`,
|
|
84
84
|
width: `${d}px`
|
|
85
85
|
},
|
|
86
|
-
children:
|
|
86
|
+
children: t.map((c, r) => /* @__PURE__ */ s(
|
|
87
87
|
"div",
|
|
88
88
|
{
|
|
89
89
|
className: n.slide,
|
|
90
90
|
style: {
|
|
91
91
|
width: `${d / m - 16}px`
|
|
92
92
|
},
|
|
93
|
-
children:
|
|
93
|
+
children: c
|
|
94
94
|
},
|
|
95
|
-
|
|
95
|
+
r
|
|
96
96
|
))
|
|
97
97
|
},
|
|
98
|
-
|
|
98
|
+
e
|
|
99
99
|
))
|
|
100
100
|
}
|
|
101
101
|
)
|
|
102
102
|
}
|
|
103
103
|
),
|
|
104
104
|
p > 1 && /* @__PURE__ */ x("div", { className: n.controls, children: [
|
|
105
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ s("div", { className: n.indicators, children: Array.from({ length: p }).map((t, e) => /* @__PURE__ */ s(
|
|
106
106
|
"button",
|
|
107
107
|
{
|
|
108
|
-
className: `${n.indicator} ${
|
|
109
|
-
onClick: () => D(
|
|
110
|
-
"aria-label": `Go to group ${
|
|
108
|
+
className: `${n.indicator} ${e === i ? n.active : ""}`,
|
|
109
|
+
onClick: () => D(e),
|
|
110
|
+
"aria-label": `Go to group ${e + 1}`
|
|
111
111
|
},
|
|
112
|
-
|
|
112
|
+
e
|
|
113
113
|
)) }),
|
|
114
114
|
/* @__PURE__ */ x("div", { className: n.buttons, children: [
|
|
115
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ s(
|
|
116
116
|
"button",
|
|
117
117
|
{
|
|
118
118
|
"aria-label": "Previous slide",
|
|
119
|
-
className: `${n.prev} ${!
|
|
119
|
+
className: `${n.prev} ${!a && i === 0 ? n.disabled : ""}`,
|
|
120
120
|
onClick: X,
|
|
121
|
-
disabled: !
|
|
122
|
-
children: /* @__PURE__ */
|
|
121
|
+
disabled: !a && i === 0,
|
|
122
|
+
children: /* @__PURE__ */ s(O, { size: 36 })
|
|
123
123
|
}
|
|
124
124
|
),
|
|
125
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ s(
|
|
126
126
|
"button",
|
|
127
127
|
{
|
|
128
128
|
"aria-label": "Next slide",
|
|
129
|
-
className: `${n.next} ${!
|
|
130
|
-
onClick:
|
|
131
|
-
disabled: !
|
|
132
|
-
children: /* @__PURE__ */
|
|
129
|
+
className: `${n.next} ${!a && i >= p - 1 ? n.disabled : ""}`,
|
|
130
|
+
onClick: w,
|
|
131
|
+
disabled: !a && i >= b.length - _,
|
|
132
|
+
children: /* @__PURE__ */ s(q, { size: 36 })
|
|
133
133
|
}
|
|
134
134
|
)
|
|
135
135
|
] })
|
|
@@ -137,5 +137,5 @@ function oe({
|
|
|
137
137
|
] });
|
|
138
138
|
}
|
|
139
139
|
export {
|
|
140
|
-
|
|
140
|
+
st as Carousel
|
|
141
141
|
};
|