quirk-ui 0.0.252 → 0.0.253
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.
|
@@ -18,17 +18,17 @@ import '../../assets/index30.css';const xt = "_carousel_ifeug_1", $t = "_noPoint
|
|
|
18
18
|
next: Dt
|
|
19
19
|
};
|
|
20
20
|
function Yt({
|
|
21
|
-
items:
|
|
22
|
-
itemsPerPage:
|
|
21
|
+
items: l,
|
|
22
|
+
itemsPerPage: u = 9,
|
|
23
23
|
itemsPerRow: K = 3,
|
|
24
24
|
autoplay: Q = !1,
|
|
25
25
|
autoplayInterval: D = 3,
|
|
26
26
|
className: V,
|
|
27
27
|
externalRef: Z,
|
|
28
|
-
siblingRef:
|
|
28
|
+
siblingRef: d,
|
|
29
29
|
isSplit: L = !1
|
|
30
30
|
}) {
|
|
31
|
-
const [
|
|
31
|
+
const [h, f] = c(0), [_, b] = c(0), [S, P] = c(0), [p, tt] = c(u), [v, et] = c(!1), [z, nt] = c(Q), ot = C(null), a = C(null), m = C(null), x = Z, [w, X] = c(!1), [Y, B] = c(null), [$, j] = c(null), [R, U] = c(null), [st, G] = c(!1), [M, O] = c(null), [y, q] = c(null), ct = (t) => {
|
|
32
32
|
Math.abs((y ?? 0) - (M ?? 0)) > 25 && (t.stopPropagation(), t.preventDefault());
|
|
33
33
|
}, rt = (t) => {
|
|
34
34
|
O(t.clientX);
|
|
@@ -76,46 +76,46 @@ function Yt({
|
|
|
76
76
|
const n = t.getBoundingClientRect().width;
|
|
77
77
|
n && P(n);
|
|
78
78
|
}
|
|
79
|
-
}, [
|
|
79
|
+
}, [l.length]), E(() => {
|
|
80
80
|
if (typeof window < "u") {
|
|
81
81
|
const t = () => {
|
|
82
|
-
const e = window.innerWidth < 768, n = e ? 1 :
|
|
83
|
-
et(e), tt(e ? 1 :
|
|
84
|
-
(s) => Math.min(s, Math.ceil(
|
|
82
|
+
const e = window.innerWidth < 768, n = e ? 1 : u;
|
|
83
|
+
et(e), tt(e ? 1 : u), f(
|
|
84
|
+
(s) => Math.min(s, Math.ceil(l.length / n) - 1)
|
|
85
85
|
);
|
|
86
86
|
};
|
|
87
87
|
return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
88
88
|
}
|
|
89
|
-
}, [
|
|
90
|
-
const N = Math.ceil(
|
|
89
|
+
}, [u]);
|
|
90
|
+
const N = Math.ceil(p / K), H = ht(l, p), g = H.length, ft = 3 * 16, pt = 3 * 16;
|
|
91
91
|
E(() => {
|
|
92
92
|
const t = new ResizeObserver((e) => {
|
|
93
93
|
var n, s;
|
|
94
94
|
for (let i of e)
|
|
95
95
|
if (i.contentRect) {
|
|
96
|
-
|
|
97
|
-
i.contentRect.width - ((n =
|
|
96
|
+
v ? b(i.contentRect.width - pt) : L ? d != null && d.current ? b(
|
|
97
|
+
i.contentRect.width - ((n = d == null ? void 0 : d.current) == null ? void 0 : n.offsetWidth) - ft
|
|
98
98
|
) : b(i.contentRect.width) : (b(i.contentRect.width), P(
|
|
99
99
|
((s = a == null ? void 0 : a.current) == null ? void 0 : s.children[0].children[0].children[0].getBoundingClientRect().width) ?? 0
|
|
100
100
|
));
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
(mt) => Math.min(mt, Math.ceil(
|
|
101
|
+
const _t = v ? 1 : u;
|
|
102
|
+
f(
|
|
103
|
+
(mt) => Math.min(mt, Math.ceil(l.length / _t) - 1)
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
107
|
return x != null && x.current && t.observe(x.current), () => t.disconnect();
|
|
108
|
-
}, [
|
|
108
|
+
}, [v, L, l.length]);
|
|
109
109
|
const k = () => {
|
|
110
110
|
m.current && clearInterval(m.current), nt(!1);
|
|
111
111
|
}, T = () => {
|
|
112
|
-
k(),
|
|
112
|
+
k(), f((t) => Math.min(t + 1, g - 1));
|
|
113
113
|
}, A = () => {
|
|
114
|
-
k(),
|
|
114
|
+
k(), f((t) => Math.max(t - 1, 0));
|
|
115
115
|
}, vt = (t) => {
|
|
116
|
-
k(),
|
|
117
|
-
},
|
|
118
|
-
|
|
116
|
+
k(), f(t);
|
|
117
|
+
}, gt = () => _ ? `translateX(-${h * _}px)` : "translateX(0px)", J = () => {
|
|
118
|
+
f((t) => t >= g - 1 ? 0 : t + 1);
|
|
119
119
|
};
|
|
120
120
|
return E(() => (z && (m.current = setInterval(
|
|
121
121
|
J,
|
|
@@ -130,7 +130,7 @@ function Yt({
|
|
|
130
130
|
className: `${o.trackContainer} ${st || w ? o.noPointerEvents : ""}
|
|
131
131
|
`,
|
|
132
132
|
style: {
|
|
133
|
-
maxWidth: `${
|
|
133
|
+
maxWidth: `${_}px`,
|
|
134
134
|
touchAction: w ? "none" : "pan-y"
|
|
135
135
|
},
|
|
136
136
|
onTouchStart: ut,
|
|
@@ -144,7 +144,7 @@ function Yt({
|
|
|
144
144
|
{
|
|
145
145
|
ref: a,
|
|
146
146
|
className: o.track,
|
|
147
|
-
style: { width: `${
|
|
147
|
+
style: { width: `${g * 100}%`, transform: gt() },
|
|
148
148
|
children: H.map((t, e) => /* @__PURE__ */ r(
|
|
149
149
|
"div",
|
|
150
150
|
{
|
|
@@ -152,18 +152,18 @@ function Yt({
|
|
|
152
152
|
style: {
|
|
153
153
|
display: N > 1 ? "grid" : "flex",
|
|
154
154
|
gridTemplateColumns: `repeat(${Math.ceil(
|
|
155
|
-
|
|
155
|
+
p / N
|
|
156
156
|
)}, 1fr)`,
|
|
157
157
|
gridTemplateRows: `repeat(${N}, auto)`,
|
|
158
|
-
width: `${
|
|
158
|
+
width: `${_}px`
|
|
159
159
|
},
|
|
160
160
|
children: t.map((n, s) => /* @__PURE__ */ r(
|
|
161
161
|
"div",
|
|
162
162
|
{
|
|
163
163
|
onClickCapture: ct,
|
|
164
164
|
style: {
|
|
165
|
-
flexBasis:
|
|
166
|
-
width:
|
|
165
|
+
flexBasis: v ? "100%" : `${100 / p}%`,
|
|
166
|
+
width: v ? `${_ / p - 16}px` : "unset"
|
|
167
167
|
},
|
|
168
168
|
children: n
|
|
169
169
|
},
|
|
@@ -176,18 +176,18 @@ function Yt({
|
|
|
176
176
|
)
|
|
177
177
|
}
|
|
178
178
|
),
|
|
179
|
-
|
|
179
|
+
g > 1 && /* @__PURE__ */ W(
|
|
180
180
|
"div",
|
|
181
181
|
{
|
|
182
182
|
className: o.controls,
|
|
183
183
|
style: {
|
|
184
|
-
maxWidth: S > 0 &&
|
|
184
|
+
maxWidth: S > 0 && u === 1 && !v ? `${S}px` : "unset"
|
|
185
185
|
},
|
|
186
186
|
children: [
|
|
187
|
-
/* @__PURE__ */ r("div", { className: o.indicators, children: Array.from({ length:
|
|
187
|
+
/* @__PURE__ */ r("div", { className: o.indicators, children: Array.from({ length: g }).map((t, e) => /* @__PURE__ */ r(
|
|
188
188
|
"button",
|
|
189
189
|
{
|
|
190
|
-
className: `${o.indicator} ${e ===
|
|
190
|
+
className: `${o.indicator} ${e === h ? o.active : ""}`,
|
|
191
191
|
onClick: () => vt(e),
|
|
192
192
|
"aria-label": `Go to group ${e + 1}`
|
|
193
193
|
},
|
|
@@ -198,9 +198,9 @@ function Yt({
|
|
|
198
198
|
"button",
|
|
199
199
|
{
|
|
200
200
|
"aria-label": "Previous slide",
|
|
201
|
-
className: `${o.prev} ${
|
|
201
|
+
className: `${o.prev} ${h === 0 ? o.disabled : ""}`,
|
|
202
202
|
onClick: A,
|
|
203
|
-
disabled:
|
|
203
|
+
disabled: h === 0,
|
|
204
204
|
children: /* @__PURE__ */ r(Mt, { size: 36 })
|
|
205
205
|
}
|
|
206
206
|
),
|
|
@@ -208,9 +208,9 @@ function Yt({
|
|
|
208
208
|
"button",
|
|
209
209
|
{
|
|
210
210
|
"aria-label": "Next slide",
|
|
211
|
-
className: `${o.next} ${
|
|
211
|
+
className: `${o.next} ${h >= g - 1 ? o.disabled : ""}`,
|
|
212
212
|
onClick: T,
|
|
213
|
-
disabled:
|
|
213
|
+
disabled: h >= l.length - p,
|
|
214
214
|
children: /* @__PURE__ */ r(bt, { size: 36 })
|
|
215
215
|
}
|
|
216
216
|
)
|