quirk-ui 0.0.176 → 0.0.178
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
1
|
import { jsxs as A, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { useState as c, useRef as
|
|
2
|
+
import { useState as c, useRef as C, useEffect as E } from "react";
|
|
3
3
|
import { A as Mt } from "../../arrow-left-BIJvHwNQ.js";
|
|
4
4
|
import { A as bt } from "../../arrow-right-QEwnX3Sk.js";
|
|
5
5
|
import '../../assets/index31.css';const gt = "_carousel_wqwci_1", xt = "_noPointerEvents_wqwci_10", $t = "_trackContainer_wqwci_14", Ct = "_track_wqwci_14", Et = "_page_wqwci_29", Xt = "_controls_wqwci_39", yt = "_indicators_wqwci_50", It = "_indicator_wqwci_50", Nt = "_active_wqwci_67", kt = "_buttons_wqwci_71", qt = "_prev_wqwci_76", Tt = "_disabled_wqwci_76", At = "_next_wqwci_77", o = {
|
|
@@ -28,32 +28,32 @@ function Pt({
|
|
|
28
28
|
siblingRef: l,
|
|
29
29
|
isSplit: D = !1
|
|
30
30
|
}) {
|
|
31
|
-
const [d, u] = c(0), [w, M] = c(0), [S, Z] = c(0), [
|
|
32
|
-
Math.abs((
|
|
31
|
+
const [d, u] = c(0), [w, M] = c(0), [S, Z] = c(0), [f, tt] = c(i), [b, et] = c(!1), [L, nt] = c(K), ot = C(null), g = C(null), p = C(null), x = V, [v, X] = c(!1), [P, z] = c(null), [$, Y] = c(null), [R, j] = c(null), [st, U] = c(!1), [_, B] = c(null), [y, G] = c(null), ct = (t) => {
|
|
32
|
+
Math.abs((y ?? 0) - (_ ?? 0)) > 25 && (t.stopPropagation(), t.preventDefault());
|
|
33
33
|
}, rt = (t) => {
|
|
34
34
|
B(t.clientX);
|
|
35
35
|
}, at = (t) => {
|
|
36
36
|
_ !== null && Math.abs(t.clientX - _) > 5 && (U(!0), G(t.clientX));
|
|
37
37
|
}, it = () => {
|
|
38
|
-
if (!_ || !
|
|
39
|
-
|
|
38
|
+
if (!_ || !y) {
|
|
39
|
+
I();
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
const t = _ -
|
|
43
|
-
Math.abs(t) > 50 && (t > 0 ? q() : T()),
|
|
42
|
+
const t = _ - y;
|
|
43
|
+
Math.abs(t) > 50 && (t > 0 ? q() : T()), I();
|
|
44
44
|
}, lt = () => {
|
|
45
|
-
|
|
46
|
-
},
|
|
45
|
+
I();
|
|
46
|
+
}, I = () => {
|
|
47
47
|
U(!1), B(null), G(null);
|
|
48
48
|
}, dt = (t) => {
|
|
49
|
-
Y(t.touches[0].clientX), z(t.touches[0].clientY),
|
|
50
|
-
}, O =
|
|
51
|
-
|
|
49
|
+
Y(t.touches[0].clientX), z(t.touches[0].clientY), X(!1);
|
|
50
|
+
}, O = C(null);
|
|
51
|
+
E(() => {
|
|
52
52
|
const t = O.current;
|
|
53
53
|
if (!t) return;
|
|
54
54
|
const e = (n) => {
|
|
55
55
|
const s = n.touches[0].clientX - ($ ?? 0), a = n.touches[0].clientY - (P ?? 0);
|
|
56
|
-
!v && Math.abs(s) > Math.abs(a) &&
|
|
56
|
+
!v && Math.abs(s) > Math.abs(a) && X(!0), v && (n.preventDefault(), j(n.touches[0].clientX));
|
|
57
57
|
};
|
|
58
58
|
return t.addEventListener("touchmove", e), () => {
|
|
59
59
|
t.removeEventListener("touchmove", e);
|
|
@@ -62,14 +62,14 @@ function Pt({
|
|
|
62
62
|
const ut = () => {
|
|
63
63
|
if ($ === null || R === null) return;
|
|
64
64
|
const t = $ - R;
|
|
65
|
-
Math.abs(t) > 50 && (t > 0 ? q() : T()), Y(null), j(null), z(null),
|
|
65
|
+
Math.abs(t) > 50 && (t > 0 ? q() : T()), Y(null), j(null), z(null), X(!1);
|
|
66
66
|
}, ht = (t, e) => {
|
|
67
67
|
const n = [];
|
|
68
68
|
for (let s = 0; s < t.length; s += e)
|
|
69
69
|
n.push(t.slice(s, s + e));
|
|
70
70
|
return n;
|
|
71
71
|
};
|
|
72
|
-
|
|
72
|
+
E(() => {
|
|
73
73
|
if (typeof window < "u") {
|
|
74
74
|
const t = () => {
|
|
75
75
|
const e = window.innerWidth < 768, n = e ? 1 : i;
|
|
@@ -80,25 +80,25 @@ function Pt({
|
|
|
80
80
|
return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
81
81
|
}
|
|
82
82
|
}, [i]);
|
|
83
|
-
const
|
|
84
|
-
|
|
83
|
+
const N = Math.ceil(f / J), F = ht(m, f), h = F.length, wt = 3 * 16, ft = 3 * 16;
|
|
84
|
+
E(() => {
|
|
85
85
|
const t = new ResizeObserver((e) => {
|
|
86
86
|
var n, s;
|
|
87
87
|
for (let a of e)
|
|
88
88
|
if (a.contentRect) {
|
|
89
|
-
|
|
89
|
+
b ? M(a.contentRect.width - ft) : D ? l != null && l.current ? M(
|
|
90
90
|
a.contentRect.width - ((n = l == null ? void 0 : l.current) == null ? void 0 : n.offsetWidth) - wt
|
|
91
91
|
) : M(a.contentRect.width) : (M(a.contentRect.width), Z(
|
|
92
92
|
((s = g == null ? void 0 : g.current) == null ? void 0 : s.children[0].children[0].children[0].getBoundingClientRect().width) ?? 0
|
|
93
93
|
));
|
|
94
|
-
const _t =
|
|
94
|
+
const _t = b ? 1 : i;
|
|
95
95
|
u(
|
|
96
96
|
(mt) => Math.min(mt, Math.ceil(m.length / _t) - 1)
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
return x != null && x.current && t.observe(x.current), () => t.disconnect();
|
|
101
|
-
}, [
|
|
101
|
+
}, [b, D]);
|
|
102
102
|
const k = () => {
|
|
103
103
|
p.current && clearInterval(p.current), nt(!1);
|
|
104
104
|
}, q = () => {
|
|
@@ -110,7 +110,7 @@ function Pt({
|
|
|
110
110
|
}, vt = () => w ? `translateX(-${d * w}px)` : "translateX(0px)", H = () => {
|
|
111
111
|
u((t) => t >= h - 1 ? 0 : t + 1);
|
|
112
112
|
};
|
|
113
|
-
return
|
|
113
|
+
return E(() => (L && (p.current = setInterval(
|
|
114
114
|
H,
|
|
115
115
|
W * 1e3
|
|
116
116
|
)), () => {
|
|
@@ -143,11 +143,11 @@ function Pt({
|
|
|
143
143
|
{
|
|
144
144
|
className: o.page,
|
|
145
145
|
style: {
|
|
146
|
-
display:
|
|
146
|
+
display: N > 1 ? "grid" : "flex",
|
|
147
147
|
gridTemplateColumns: `repeat(${Math.ceil(
|
|
148
|
-
|
|
148
|
+
f / N
|
|
149
149
|
)}, 1fr)`,
|
|
150
|
-
gridTemplateRows: `repeat(${
|
|
150
|
+
gridTemplateRows: `repeat(${N}, auto)`,
|
|
151
151
|
width: `${w}px`
|
|
152
152
|
},
|
|
153
153
|
children: t.map((n, s) => /* @__PURE__ */ r(
|
|
@@ -155,7 +155,7 @@ function Pt({
|
|
|
155
155
|
{
|
|
156
156
|
onClickCapture: ct,
|
|
157
157
|
style: {
|
|
158
|
-
width:
|
|
158
|
+
width: `${w / f - 16}px`
|
|
159
159
|
},
|
|
160
160
|
children: n
|
|
161
161
|
},
|
|
@@ -173,7 +173,7 @@ function Pt({
|
|
|
173
173
|
{
|
|
174
174
|
className: o.controls,
|
|
175
175
|
style: {
|
|
176
|
-
maxWidth: S > 0 && i === 1 && !
|
|
176
|
+
maxWidth: S > 0 && i === 1 && !b ? `${S}px` : "unset"
|
|
177
177
|
},
|
|
178
178
|
children: [
|
|
179
179
|
/* @__PURE__ */ r("div", { className: o.indicators, children: Array.from({ length: h }).map((t, e) => /* @__PURE__ */ r(
|
|
@@ -202,7 +202,7 @@ function Pt({
|
|
|
202
202
|
"aria-label": "Next slide",
|
|
203
203
|
className: `${o.next} ${d >= h - 1 ? o.disabled : ""}`,
|
|
204
204
|
onClick: q,
|
|
205
|
-
disabled: d >= m.length -
|
|
205
|
+
disabled: d >= m.length - f,
|
|
206
206
|
children: /* @__PURE__ */ r(bt, { size: 36 })
|
|
207
207
|
}
|
|
208
208
|
)
|