quirk-ui 0.0.170 → 0.0.172
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,7 +18,7 @@ import '../../assets/index31.css';const gt = "_carousel_1e9ij_1", xt = "_noPoint
|
|
|
18
18
|
next: At
|
|
19
19
|
};
|
|
20
20
|
function Pt({
|
|
21
|
-
items:
|
|
21
|
+
items: M,
|
|
22
22
|
itemsPerPage: i = 9,
|
|
23
23
|
itemsPerRow: J = 3,
|
|
24
24
|
autoplay: K = !1,
|
|
@@ -28,18 +28,18 @@ function Pt({
|
|
|
28
28
|
siblingRef: l,
|
|
29
29
|
isSplit: D = !1
|
|
30
30
|
}) {
|
|
31
|
-
const [d, u] = c(0), [
|
|
32
|
-
Math.abs((y ?? 0) - (
|
|
31
|
+
const [d, u] = c(0), [p, w] = c(0), [S, Z] = c(0), [b, tt] = c(i), [h, et] = c(!1), [L, nt] = c(K), ot = E(null), g = E(null), v = E(null), x = V, [_, j] = c(!1), [P, z] = c(null), [$, Y] = c(null), [R, U] = c(null), [st, B] = c(!1), [m, G] = c(null), [y, O] = c(null), ct = (t) => {
|
|
32
|
+
Math.abs((y ?? 0) - (m ?? 0)) > 25 && (t.stopPropagation(), t.preventDefault());
|
|
33
33
|
}, rt = (t) => {
|
|
34
34
|
G(t.clientX);
|
|
35
35
|
}, at = (t) => {
|
|
36
|
-
|
|
36
|
+
m !== null && Math.abs(t.clientX - m) > 5 && (B(!0), O(t.clientX));
|
|
37
37
|
}, it = () => {
|
|
38
|
-
if (!
|
|
38
|
+
if (!m || !y) {
|
|
39
39
|
I();
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
const t =
|
|
42
|
+
const t = m - y;
|
|
43
43
|
Math.abs(t) > 50 && (t > 0 ? k() : T()), I();
|
|
44
44
|
}, lt = () => {
|
|
45
45
|
I();
|
|
@@ -53,12 +53,12 @@ function Pt({
|
|
|
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
|
-
!
|
|
56
|
+
!_ && Math.abs(s) > Math.abs(a) && j(!0), _ && (n.preventDefault(), U(n.touches[0].clientX));
|
|
57
57
|
};
|
|
58
58
|
return t.addEventListener("touchmove", e), () => {
|
|
59
59
|
t.removeEventListener("touchmove", e);
|
|
60
60
|
};
|
|
61
|
-
}, [
|
|
61
|
+
}, [_, $, P]);
|
|
62
62
|
const ut = () => {
|
|
63
63
|
if ($ === null || R === null) return;
|
|
64
64
|
const t = $ - R;
|
|
@@ -74,57 +74,57 @@ function Pt({
|
|
|
74
74
|
const t = () => {
|
|
75
75
|
const e = window.innerWidth < 768, n = e ? 1 : i;
|
|
76
76
|
et(e), tt(e ? 1 : i), u(
|
|
77
|
-
(s) => Math.min(s, Math.ceil(
|
|
77
|
+
(s) => Math.min(s, Math.ceil(M.length / n) - 1)
|
|
78
78
|
);
|
|
79
79
|
};
|
|
80
80
|
return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
81
81
|
}
|
|
82
82
|
}, [i]);
|
|
83
|
-
const C = Math.ceil(
|
|
83
|
+
const C = Math.ceil(b / J), F = ht(M, b), f = F.length, ft = 3 * 16, pt = 3 * 16;
|
|
84
84
|
X(() => {
|
|
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
|
+
h ? w(a.contentRect.width - pt) : D ? l != null && l.current ? w(
|
|
90
90
|
a.contentRect.width - ((n = l == null ? void 0 : l.current) == null ? void 0 : n.offsetWidth) - ft
|
|
91
|
-
) :
|
|
91
|
+
) : w(a.contentRect.width) : (w(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 mt =
|
|
94
|
+
const mt = h ? 1 : i;
|
|
95
95
|
u(
|
|
96
|
-
(Mt) => Math.min(Mt, Math.ceil(
|
|
96
|
+
(Mt) => Math.min(Mt, Math.ceil(M.length / mt) - 1)
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
return x != null && x.current && t.observe(x.current), () => t.disconnect();
|
|
101
|
-
}, [
|
|
101
|
+
}, [h, D]);
|
|
102
102
|
const N = () => {
|
|
103
|
-
|
|
103
|
+
v.current && clearInterval(v.current), nt(!1);
|
|
104
104
|
}, k = () => {
|
|
105
|
-
N(), u((t) => Math.min(t + 1,
|
|
105
|
+
N(), u((t) => Math.min(t + 1, f - 1));
|
|
106
106
|
}, T = () => {
|
|
107
107
|
N(), u((t) => Math.max(t - 1, 0));
|
|
108
108
|
}, vt = (t) => {
|
|
109
109
|
N(), u(t);
|
|
110
|
-
}, _t = () =>
|
|
111
|
-
u((t) => t >=
|
|
110
|
+
}, _t = () => p ? `translateX(-${d * p}px)` : "translateX(0px)", H = () => {
|
|
111
|
+
u((t) => t >= f - 1 ? 0 : t + 1);
|
|
112
112
|
};
|
|
113
|
-
return X(() => (L && (
|
|
113
|
+
return X(() => (L && (v.current = setInterval(
|
|
114
114
|
H,
|
|
115
115
|
W * 1e3
|
|
116
116
|
)), () => {
|
|
117
|
-
|
|
117
|
+
v.current && clearInterval(v.current);
|
|
118
118
|
}), [L, W, H]), /* @__PURE__ */ A("div", { className: `${Q ?? ""} ${o.carousel}`, ref: ot, children: [
|
|
119
119
|
/* @__PURE__ */ r(
|
|
120
120
|
"div",
|
|
121
121
|
{
|
|
122
122
|
ref: q,
|
|
123
|
-
className: `${o.trackContainer} ${st ||
|
|
123
|
+
className: `${o.trackContainer} ${st || _ ? o.noPointerEvents : ""}
|
|
124
124
|
`,
|
|
125
125
|
style: {
|
|
126
|
-
maxWidth: `${
|
|
127
|
-
touchAction:
|
|
126
|
+
maxWidth: `${p}px`,
|
|
127
|
+
touchAction: _ ? "none" : "pan-y"
|
|
128
128
|
},
|
|
129
129
|
onTouchStart: dt,
|
|
130
130
|
onTouchEnd: ut,
|
|
@@ -137,7 +137,7 @@ function Pt({
|
|
|
137
137
|
{
|
|
138
138
|
ref: g,
|
|
139
139
|
className: o.track,
|
|
140
|
-
style: { width: `${
|
|
140
|
+
style: { width: `${f * 100}%`, transform: _t() },
|
|
141
141
|
children: F.map((t, e) => /* @__PURE__ */ r(
|
|
142
142
|
"div",
|
|
143
143
|
{
|
|
@@ -145,17 +145,17 @@ function Pt({
|
|
|
145
145
|
style: {
|
|
146
146
|
display: C > 1 ? "grid" : "flex",
|
|
147
147
|
gridTemplateColumns: `repeat(${Math.ceil(
|
|
148
|
-
|
|
148
|
+
b / C
|
|
149
149
|
)}, 1fr)`,
|
|
150
150
|
gridTemplateRows: `repeat(${C}, auto)`,
|
|
151
|
-
width: `${
|
|
151
|
+
width: h ? `${p}px` : "unset"
|
|
152
152
|
},
|
|
153
153
|
children: t.map((n, s) => /* @__PURE__ */ r(
|
|
154
154
|
"div",
|
|
155
155
|
{
|
|
156
156
|
onClickCapture: ct,
|
|
157
157
|
style: {
|
|
158
|
-
width: `${
|
|
158
|
+
width: h ? `${p / C - 16}px` : "unset"
|
|
159
159
|
},
|
|
160
160
|
children: n
|
|
161
161
|
},
|
|
@@ -168,15 +168,15 @@ function Pt({
|
|
|
168
168
|
)
|
|
169
169
|
}
|
|
170
170
|
),
|
|
171
|
-
|
|
171
|
+
f > 1 && /* @__PURE__ */ A(
|
|
172
172
|
"div",
|
|
173
173
|
{
|
|
174
174
|
className: o.controls,
|
|
175
175
|
style: {
|
|
176
|
-
maxWidth: S > 0 && i === 1 && !
|
|
176
|
+
maxWidth: S > 0 && i === 1 && !h ? `${S}px` : "unset"
|
|
177
177
|
},
|
|
178
178
|
children: [
|
|
179
|
-
/* @__PURE__ */ r("div", { className: o.indicators, children: Array.from({ length:
|
|
179
|
+
/* @__PURE__ */ r("div", { className: o.indicators, children: Array.from({ length: f }).map((t, e) => /* @__PURE__ */ r(
|
|
180
180
|
"button",
|
|
181
181
|
{
|
|
182
182
|
className: `${o.indicator} ${e === d ? o.active : ""}`,
|
|
@@ -200,9 +200,9 @@ function Pt({
|
|
|
200
200
|
"button",
|
|
201
201
|
{
|
|
202
202
|
"aria-label": "Next slide",
|
|
203
|
-
className: `${o.next} ${d >=
|
|
203
|
+
className: `${o.next} ${d >= f - 1 ? o.disabled : ""}`,
|
|
204
204
|
onClick: k,
|
|
205
|
-
disabled: d >=
|
|
205
|
+
disabled: d >= M.length - b,
|
|
206
206
|
children: /* @__PURE__ */ r(bt, { size: 36 })
|
|
207
207
|
}
|
|
208
208
|
)
|