quirk-ui 0.0.174 → 0.0.176
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.
|
@@ -28,7 +28,7 @@ function Pt({
|
|
|
28
28
|
siblingRef: l,
|
|
29
29
|
isSplit: D = !1
|
|
30
30
|
}) {
|
|
31
|
-
const [d, u] = c(0), [
|
|
31
|
+
const [d, u] = c(0), [w, M] = c(0), [S, Z] = c(0), [b, tt] = c(i), [f, et] = c(!1), [L, nt] = c(K), ot = E(null), g = E(null), p = E(null), x = V, [v, y] = c(!1), [P, z] = c(null), [$, Y] = c(null), [R, j] = c(null), [st, U] = c(!1), [_, B] = c(null), [I, G] = c(null), ct = (t) => {
|
|
32
32
|
Math.abs((I ?? 0) - (_ ?? 0)) > 25 && (t.stopPropagation(), t.preventDefault());
|
|
33
33
|
}, rt = (t) => {
|
|
34
34
|
B(t.clientX);
|
|
@@ -80,35 +80,35 @@ function Pt({
|
|
|
80
80
|
return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
81
81
|
}
|
|
82
82
|
}, [i]);
|
|
83
|
-
const C = Math.ceil(b / J), F = ht(m, b),
|
|
83
|
+
const C = Math.ceil(b / J), F = ht(m, b), h = F.length, wt = 3 * 16, ft = 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
|
+
f ? 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 = f ? 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
|
+
}, [f, D]);
|
|
102
102
|
const k = () => {
|
|
103
103
|
p.current && clearInterval(p.current), nt(!1);
|
|
104
104
|
}, q = () => {
|
|
105
|
-
k(), u((t) => Math.min(t + 1,
|
|
105
|
+
k(), u((t) => Math.min(t + 1, h - 1));
|
|
106
106
|
}, T = () => {
|
|
107
107
|
k(), u((t) => Math.max(t - 1, 0));
|
|
108
108
|
}, pt = (t) => {
|
|
109
109
|
k(), u(t);
|
|
110
|
-
}, vt = () =>
|
|
111
|
-
u((t) => t >=
|
|
110
|
+
}, vt = () => w ? `translateX(-${d * w}px)` : "translateX(0px)", H = () => {
|
|
111
|
+
u((t) => t >= h - 1 ? 0 : t + 1);
|
|
112
112
|
};
|
|
113
113
|
return X(() => (L && (p.current = setInterval(
|
|
114
114
|
H,
|
|
@@ -123,7 +123,7 @@ function Pt({
|
|
|
123
123
|
className: `${o.trackContainer} ${st || v ? o.noPointerEvents : ""}
|
|
124
124
|
`,
|
|
125
125
|
style: {
|
|
126
|
-
maxWidth: `${
|
|
126
|
+
maxWidth: `${w}px`,
|
|
127
127
|
touchAction: v ? "none" : "pan-y"
|
|
128
128
|
},
|
|
129
129
|
onTouchStart: dt,
|
|
@@ -137,7 +137,7 @@ function Pt({
|
|
|
137
137
|
{
|
|
138
138
|
ref: g,
|
|
139
139
|
className: o.track,
|
|
140
|
-
style: { width: `${
|
|
140
|
+
style: { width: `${h * 100}%`, transform: vt() },
|
|
141
141
|
children: F.map((t, e) => /* @__PURE__ */ r(
|
|
142
142
|
"div",
|
|
143
143
|
{
|
|
@@ -148,14 +148,14 @@ function Pt({
|
|
|
148
148
|
b / C
|
|
149
149
|
)}, 1fr)`,
|
|
150
150
|
gridTemplateRows: `repeat(${C}, auto)`,
|
|
151
|
-
width:
|
|
151
|
+
width: `${w}px`
|
|
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: f ? `${w / 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
|
+
h > 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 && !f ? `${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: h }).map((t, e) => /* @__PURE__ */ r(
|
|
180
180
|
"button",
|
|
181
181
|
{
|
|
182
182
|
className: `${o.indicator} ${e === d ? o.active : ""}`,
|
|
@@ -200,7 +200,7 @@ function Pt({
|
|
|
200
200
|
"button",
|
|
201
201
|
{
|
|
202
202
|
"aria-label": "Next slide",
|
|
203
|
-
className: `${o.next} ${d >=
|
|
203
|
+
className: `${o.next} ${d >= h - 1 ? o.disabled : ""}`,
|
|
204
204
|
onClick: q,
|
|
205
205
|
disabled: d >= m.length - b,
|
|
206
206
|
children: /* @__PURE__ */ r(bt, { size: 36 })
|