quirk-ui 0.0.54 → 0.0.55
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,66 +1,66 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as f, useRef as M, useEffect as
|
|
1
|
+
import { jsxs as x, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f, useRef as M, useEffect as $ } from "react";
|
|
3
3
|
import { A as O } from "../../arrow-left-BIJvHwNQ.js";
|
|
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:
|
|
4
|
+
import { A as q } from "../../arrow-right-QEwnX3Sk.js";
|
|
5
|
+
import '../../assets/index31.css';const B = "_carousel_pk3a7_1", F = "_trackContainer_pk3a7_9", H = "_track_pk3a7_9", J = "_page_pk3a7_24", K = "_controls_pk3a7_30", Q = "_indicators_pk3a7_47", S = "_indicator_pk3a7_47", U = "_active_pk3a7_64", V = "_buttons_pk3a7_68", Y = "_prev_pk3a7_73", Z = "_disabled_pk3a7_73", P = "_next_pk3a7_74", n = {
|
|
6
|
+
carousel: B,
|
|
7
|
+
trackContainer: F,
|
|
8
|
+
track: H,
|
|
9
|
+
page: J,
|
|
10
|
+
controls: K,
|
|
11
|
+
indicators: Q,
|
|
12
|
+
indicator: S,
|
|
13
|
+
active: U,
|
|
14
|
+
buttons: V,
|
|
15
|
+
prev: Y,
|
|
16
|
+
disabled: Z,
|
|
17
|
+
next: P
|
|
18
18
|
};
|
|
19
19
|
function oe({
|
|
20
|
-
items:
|
|
21
|
-
itemsPerPage:
|
|
20
|
+
items: N,
|
|
21
|
+
itemsPerPage: v = 9,
|
|
22
22
|
itemsPerRow: W = 3,
|
|
23
23
|
autoPlay: c = !1,
|
|
24
|
-
autoPlayInterval:
|
|
24
|
+
autoPlayInterval: C = 3e3,
|
|
25
25
|
className: z,
|
|
26
26
|
externalRef: A,
|
|
27
27
|
siblingRef: a,
|
|
28
|
-
isSplit:
|
|
28
|
+
isSplit: k = !1
|
|
29
29
|
}) {
|
|
30
|
-
const [i, l] = f(0), [d, u] = f(0), [_, y] = f(
|
|
30
|
+
const [i, l] = f(0), [d, u] = f(0), [_, y] = f(v), [w, R] = f(!1), T = M(null), b = M(null), h = A, E = (e, t) => {
|
|
31
31
|
const r = [];
|
|
32
32
|
for (let s = 0; s < e.length; s += t)
|
|
33
33
|
r.push(e.slice(s, s + t));
|
|
34
34
|
return r;
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
$(() => {
|
|
37
37
|
const e = () => {
|
|
38
38
|
const t = window.innerWidth < 768;
|
|
39
|
-
R(t), y(t ? 1 :
|
|
39
|
+
R(t), y(t ? 1 : v), l(0);
|
|
40
40
|
};
|
|
41
41
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
42
|
-
}, []);
|
|
43
|
-
const m = Math.ceil(_ / W), I = E(
|
|
44
|
-
|
|
42
|
+
}, [v]);
|
|
43
|
+
const m = Math.ceil(_ / W), I = E(N, _), p = I.length, L = 3 * 16, j = 6 * 16;
|
|
44
|
+
$(() => {
|
|
45
45
|
const e = new ResizeObserver((t) => {
|
|
46
46
|
var r;
|
|
47
47
|
for (let s of t)
|
|
48
|
-
s.contentRect && (
|
|
48
|
+
s.contentRect && (w ? u(s.contentRect.width - j) : k ? a != null && a.current ? (console.log("has sibling"), u(
|
|
49
49
|
s.contentRect.width - ((r = a == null ? void 0 : a.current) == null ? void 0 : r.offsetWidth) - L
|
|
50
|
-
)) : (console.log("no sibling found"), u(s.contentRect.width)) : u(s.contentRect.width), console.log("isMobile",
|
|
50
|
+
)) : (console.log("no sibling found"), u(s.contentRect.width)) : u(s.contentRect.width), console.log("isMobile", w), console.log("isSplit", k), l(0));
|
|
51
51
|
});
|
|
52
52
|
return h != null && h.current ? (console.log("has observedRef", h.current), e.observe(h.current)) : console.log("no observedRef found"), () => e.disconnect();
|
|
53
|
-
}, [
|
|
54
|
-
const
|
|
53
|
+
}, [w, k]);
|
|
54
|
+
const g = () => {
|
|
55
55
|
l((e) => Math.min(e + 1, p - 1));
|
|
56
56
|
}, X = () => {
|
|
57
57
|
l((e) => Math.max(e - 1, 0));
|
|
58
58
|
}, D = (e) => {
|
|
59
59
|
l(e);
|
|
60
60
|
}, G = () => d ? `translateX(-${i * d}px)` : "translateX(0px)";
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
}), [c,
|
|
61
|
+
return $(() => (c && (b.current = setInterval(g, C)), () => {
|
|
62
|
+
b.current && clearInterval(b.current);
|
|
63
|
+
}), [c, C, g]), /* @__PURE__ */ x("div", { className: `${z ?? ""} ${n.carousel}`, ref: T, children: [
|
|
64
64
|
/* @__PURE__ */ o(
|
|
65
65
|
"div",
|
|
66
66
|
{
|
|
@@ -101,7 +101,7 @@ function oe({
|
|
|
101
101
|
)
|
|
102
102
|
}
|
|
103
103
|
),
|
|
104
|
-
p > 1 && /* @__PURE__ */
|
|
104
|
+
p > 1 && /* @__PURE__ */ x("div", { className: n.controls, children: [
|
|
105
105
|
/* @__PURE__ */ o("div", { className: n.indicators, children: Array.from({ length: p }).map((e, t) => /* @__PURE__ */ o(
|
|
106
106
|
"button",
|
|
107
107
|
{
|
|
@@ -111,7 +111,7 @@ function oe({
|
|
|
111
111
|
},
|
|
112
112
|
t
|
|
113
113
|
)) }),
|
|
114
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ x("div", { className: n.buttons, children: [
|
|
115
115
|
/* @__PURE__ */ o(
|
|
116
116
|
"button",
|
|
117
117
|
{
|
|
@@ -127,9 +127,9 @@ function oe({
|
|
|
127
127
|
{
|
|
128
128
|
"aria-label": "Next slide",
|
|
129
129
|
className: `${n.next} ${!c && i >= p - 1 ? n.disabled : ""}`,
|
|
130
|
-
onClick:
|
|
131
|
-
disabled: !c && i >=
|
|
132
|
-
children: /* @__PURE__ */ o(
|
|
130
|
+
onClick: g,
|
|
131
|
+
disabled: !c && i >= N.length - _,
|
|
132
|
+
children: /* @__PURE__ */ o(q, { size: 36 })
|
|
133
133
|
}
|
|
134
134
|
)
|
|
135
135
|
] })
|
|
@@ -7,8 +7,8 @@ type CarouselProps = {
|
|
|
7
7
|
autoPlayInterval?: number;
|
|
8
8
|
externalRef?: React.RefObject<HTMLElement>;
|
|
9
9
|
siblingRef?: React.RefObject<HTMLElement>;
|
|
10
|
-
isSplit?: boolean;
|
|
11
10
|
className?: string;
|
|
11
|
+
isSplit?: boolean;
|
|
12
12
|
};
|
|
13
13
|
export declare function Carousel({ items, itemsPerPage, itemsPerRow, autoPlay, autoPlayInterval, className, externalRef, siblingRef, isSplit, }: CarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export {};
|