quirk-ui 0.0.72 → 0.0.74
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,109 +1,107 @@
|
|
|
1
1
|
import { jsxs as z, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { useState 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:
|
|
15
|
-
prev:
|
|
16
|
-
disabled:
|
|
17
|
-
next:
|
|
2
|
+
import { useState as d, useRef as $, useEffect as y } from "react";
|
|
3
|
+
import { A as Q } from "../../arrow-left-BIJvHwNQ.js";
|
|
4
|
+
import { A as S } from "../../arrow-right-QEwnX3Sk.js";
|
|
5
|
+
import '../../assets/index31.css';const U = "_carousel_oeqfz_1", V = "_trackContainer_oeqfz_9", Y = "_track_oeqfz_9", Z = "_page_oeqfz_24", tt = "_controls_oeqfz_30", et = "_indicators_oeqfz_41", nt = "_indicator_oeqfz_41", ot = "_active_oeqfz_58", rt = "_buttons_oeqfz_62", st = "_prev_oeqfz_67", ct = "_disabled_oeqfz_67", at = "_next_oeqfz_68", n = {
|
|
6
|
+
carousel: U,
|
|
7
|
+
trackContainer: V,
|
|
8
|
+
track: Y,
|
|
9
|
+
page: Z,
|
|
10
|
+
controls: tt,
|
|
11
|
+
indicators: et,
|
|
12
|
+
indicator: nt,
|
|
13
|
+
active: ot,
|
|
14
|
+
buttons: rt,
|
|
15
|
+
prev: st,
|
|
16
|
+
disabled: ct,
|
|
17
|
+
next: at
|
|
18
18
|
};
|
|
19
|
-
function
|
|
19
|
+
function ht({
|
|
20
20
|
items: N,
|
|
21
|
-
itemsPerPage:
|
|
22
|
-
itemsPerRow:
|
|
23
|
-
autoplay:
|
|
21
|
+
itemsPerPage: _ = 9,
|
|
22
|
+
itemsPerRow: M = 3,
|
|
23
|
+
autoplay: E = !1,
|
|
24
24
|
autoplayInterval: C = 3,
|
|
25
|
-
className:
|
|
26
|
-
externalRef:
|
|
27
|
-
siblingRef:
|
|
28
|
-
isSplit:
|
|
25
|
+
className: T,
|
|
26
|
+
externalRef: L,
|
|
27
|
+
siblingRef: c,
|
|
28
|
+
isSplit: q = !1
|
|
29
29
|
}) {
|
|
30
|
-
const [
|
|
31
|
-
const
|
|
30
|
+
const [a, i] = d(0), [u, m] = d(0), [g, j] = d(0), [p, P] = d(_), [k, R] = d(!1), [I, X] = d(E), B = $(null), v = $(null), h = $(null), w = L, D = (t, e) => {
|
|
31
|
+
const s = [];
|
|
32
32
|
for (let r = 0; r < t.length; r += e)
|
|
33
|
-
|
|
34
|
-
return
|
|
33
|
+
s.push(t.slice(r, r + e));
|
|
34
|
+
return s;
|
|
35
35
|
};
|
|
36
36
|
y(() => {
|
|
37
37
|
if (typeof window < "u") {
|
|
38
38
|
const t = () => {
|
|
39
39
|
const e = window.innerWidth < 768;
|
|
40
|
-
|
|
40
|
+
R(e), P(e ? 1 : _), i(0);
|
|
41
41
|
};
|
|
42
42
|
return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
43
43
|
}
|
|
44
|
-
}, [
|
|
45
|
-
const x = Math.ceil(
|
|
44
|
+
}, [_]);
|
|
45
|
+
const x = Math.ceil(p / M), W = D(N, p), l = W.length, G = 3 * 16, O = 6 * 16;
|
|
46
46
|
y(() => {
|
|
47
47
|
const t = new ResizeObserver((e) => {
|
|
48
|
-
var
|
|
49
|
-
for (let
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
) :
|
|
53
|
-
(r =
|
|
54
|
-
),
|
|
55
|
-
((M = s == null ? void 0 : s.current) == null ? void 0 : M.children[0].children[0].children[0].getBoundingClientRect().width) ?? 0
|
|
56
|
-
)), l(0));
|
|
48
|
+
var s, r;
|
|
49
|
+
for (let f of e)
|
|
50
|
+
f.contentRect && (k ? m(f.contentRect.width - O) : q ? c != null && c.current ? m(
|
|
51
|
+
f.contentRect.width - ((s = c == null ? void 0 : c.current) == null ? void 0 : s.offsetWidth) - G
|
|
52
|
+
) : m(f.contentRect.width) : (m(f.contentRect.width), j(
|
|
53
|
+
((r = v == null ? void 0 : v.current) == null ? void 0 : r.children[0].children[0].children[0].getBoundingClientRect().width) ?? 0
|
|
54
|
+
)), i(0));
|
|
57
55
|
});
|
|
58
56
|
return w != null && w.current && t.observe(w.current), () => t.disconnect();
|
|
59
|
-
}, [
|
|
57
|
+
}, [k, q]);
|
|
60
58
|
const b = () => {
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
b(),
|
|
64
|
-
},
|
|
65
|
-
b(),
|
|
66
|
-
},
|
|
67
|
-
b(),
|
|
68
|
-
},
|
|
69
|
-
|
|
59
|
+
h.current && clearInterval(h.current), X(!1);
|
|
60
|
+
}, F = () => {
|
|
61
|
+
b(), i((t) => Math.min(t + 1, l - 1));
|
|
62
|
+
}, H = () => {
|
|
63
|
+
b(), i((t) => Math.max(t - 1, 0));
|
|
64
|
+
}, J = (t) => {
|
|
65
|
+
b(), i(t);
|
|
66
|
+
}, K = () => u ? `translateX(-${a * u}px)` : "translateX(0px)", A = () => {
|
|
67
|
+
i((t) => t >= l - 1 ? 0 : t + 1);
|
|
70
68
|
};
|
|
71
|
-
return y(() => (
|
|
69
|
+
return y(() => (I && (h.current = setInterval(
|
|
72
70
|
A,
|
|
73
71
|
C * 1e3
|
|
74
72
|
)), () => {
|
|
75
|
-
|
|
76
|
-
}), [
|
|
73
|
+
h.current && clearInterval(h.current);
|
|
74
|
+
}), [I, C, A]), /* @__PURE__ */ z("div", { className: `${T ?? ""} ${n.carousel}`, ref: B, children: [
|
|
77
75
|
/* @__PURE__ */ o(
|
|
78
76
|
"div",
|
|
79
77
|
{
|
|
80
78
|
className: n.trackContainer,
|
|
81
|
-
style: { maxWidth: `${
|
|
79
|
+
style: { maxWidth: `${u}px` },
|
|
82
80
|
children: /* @__PURE__ */ o(
|
|
83
81
|
"div",
|
|
84
82
|
{
|
|
85
|
-
ref:
|
|
83
|
+
ref: v,
|
|
86
84
|
className: n.track,
|
|
87
|
-
style: { width: `${
|
|
88
|
-
children:
|
|
85
|
+
style: { width: `${l * 100}%`, transform: K() },
|
|
86
|
+
children: W.map((t, e) => /* @__PURE__ */ o(
|
|
89
87
|
"div",
|
|
90
88
|
{
|
|
91
89
|
className: n.page,
|
|
92
90
|
style: {
|
|
93
91
|
display: x > 1 ? "grid" : "flex",
|
|
94
92
|
gridTemplateColumns: `repeat(${Math.ceil(
|
|
95
|
-
|
|
93
|
+
p / x
|
|
96
94
|
)}, 1fr)`,
|
|
97
95
|
gridTemplateRows: `repeat(${x}, auto)`,
|
|
98
|
-
width: `${
|
|
96
|
+
width: `${u}px`
|
|
99
97
|
},
|
|
100
|
-
children: t.map((
|
|
98
|
+
children: t.map((s, r) => /* @__PURE__ */ o(
|
|
101
99
|
"div",
|
|
102
100
|
{
|
|
103
101
|
style: {
|
|
104
|
-
width: `${
|
|
102
|
+
width: `${u / x - 16}px`
|
|
105
103
|
},
|
|
106
|
-
children:
|
|
104
|
+
children: s
|
|
107
105
|
},
|
|
108
106
|
r
|
|
109
107
|
))
|
|
@@ -114,19 +112,19 @@ function ft({
|
|
|
114
112
|
)
|
|
115
113
|
}
|
|
116
114
|
),
|
|
117
|
-
|
|
115
|
+
l > 1 && /* @__PURE__ */ z(
|
|
118
116
|
"div",
|
|
119
117
|
{
|
|
120
118
|
className: n.controls,
|
|
121
119
|
style: {
|
|
122
|
-
maxWidth:
|
|
120
|
+
maxWidth: g > 0 && _ === 1 ? `${g}px` : "unset"
|
|
123
121
|
},
|
|
124
122
|
children: [
|
|
125
|
-
/* @__PURE__ */ o("div", { className: n.indicators, children: Array.from({ length:
|
|
123
|
+
/* @__PURE__ */ o("div", { className: n.indicators, children: Array.from({ length: l }).map((t, e) => /* @__PURE__ */ o(
|
|
126
124
|
"button",
|
|
127
125
|
{
|
|
128
|
-
className: `${n.indicator} ${e ===
|
|
129
|
-
onClick: () =>
|
|
126
|
+
className: `${n.indicator} ${e === a ? n.active : ""}`,
|
|
127
|
+
onClick: () => J(e),
|
|
130
128
|
"aria-label": `Go to group ${e + 1}`
|
|
131
129
|
},
|
|
132
130
|
e
|
|
@@ -136,20 +134,20 @@ function ft({
|
|
|
136
134
|
"button",
|
|
137
135
|
{
|
|
138
136
|
"aria-label": "Previous slide",
|
|
139
|
-
className: `${n.prev} ${
|
|
140
|
-
onClick:
|
|
141
|
-
disabled:
|
|
142
|
-
children: /* @__PURE__ */ o(
|
|
137
|
+
className: `${n.prev} ${a === 0 ? n.disabled : ""}`,
|
|
138
|
+
onClick: H,
|
|
139
|
+
disabled: a === 0,
|
|
140
|
+
children: /* @__PURE__ */ o(Q, { size: 36 })
|
|
143
141
|
}
|
|
144
142
|
),
|
|
145
143
|
/* @__PURE__ */ o(
|
|
146
144
|
"button",
|
|
147
145
|
{
|
|
148
146
|
"aria-label": "Next slide",
|
|
149
|
-
className: `${n.next} ${
|
|
150
|
-
onClick:
|
|
151
|
-
disabled:
|
|
152
|
-
children: /* @__PURE__ */ o(
|
|
147
|
+
className: `${n.next} ${a >= l - 1 ? n.disabled : ""}`,
|
|
148
|
+
onClick: F,
|
|
149
|
+
disabled: a >= N.length - p,
|
|
150
|
+
children: /* @__PURE__ */ o(S, { size: 36 })
|
|
153
151
|
}
|
|
154
152
|
)
|
|
155
153
|
] })
|
|
@@ -159,5 +157,5 @@ function ft({
|
|
|
159
157
|
] });
|
|
160
158
|
}
|
|
161
159
|
export {
|
|
162
|
-
|
|
160
|
+
ht as Carousel
|
|
163
161
|
};
|