quirk-ui 0.0.65 → 0.0.66
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,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as g, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { useState as p, useRef as A, useEffect as x } from "react";
|
|
3
3
|
import { A as F } from "../../arrow-left-BIJvHwNQ.js";
|
|
4
4
|
import { A as H } from "../../arrow-right-QEwnX3Sk.js";
|
|
@@ -27,47 +27,49 @@ function it({
|
|
|
27
27
|
siblingRef: c,
|
|
28
28
|
isSplit: N = !1
|
|
29
29
|
}) {
|
|
30
|
-
const [a, i] = p(0), [d, h] = p(0), [_, P] = p(v), [
|
|
30
|
+
const [a, i] = p(0), [d, h] = p(0), [_, P] = p(v), [y, T] = p(!1), [k, L] = p(W), j = A(null), u = A(null), m = E, R = (t, e) => {
|
|
31
31
|
const o = [];
|
|
32
32
|
for (let r = 0; r < t.length; r += e)
|
|
33
33
|
o.push(t.slice(r, r + e));
|
|
34
34
|
return o;
|
|
35
35
|
};
|
|
36
36
|
x(() => {
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
if (typeof window < "u") {
|
|
38
|
+
const t = () => {
|
|
39
|
+
const e = window.innerWidth < 768;
|
|
40
|
+
T(e), P(e ? 1 : v), i(0);
|
|
41
|
+
};
|
|
42
|
+
return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
43
|
+
}
|
|
42
44
|
}, [v]);
|
|
43
45
|
const f = Math.ceil(_ / M), C = R(b, _), l = C.length, X = 3 * 16, D = 6 * 16;
|
|
44
46
|
x(() => {
|
|
45
47
|
const t = new ResizeObserver((e) => {
|
|
46
48
|
var o;
|
|
47
49
|
for (let r of e)
|
|
48
|
-
r.contentRect && (
|
|
50
|
+
r.contentRect && (y ? h(r.contentRect.width - D) : N && c != null && c.current ? h(
|
|
49
51
|
r.contentRect.width - ((o = c == null ? void 0 : c.current) == null ? void 0 : o.offsetWidth) - X
|
|
50
52
|
) : h(r.contentRect.width), i(0));
|
|
51
53
|
});
|
|
52
54
|
return m != null && m.current && t.observe(m.current), () => t.disconnect();
|
|
53
|
-
}, [
|
|
54
|
-
const
|
|
55
|
+
}, [y, N]);
|
|
56
|
+
const w = () => {
|
|
55
57
|
u.current && clearInterval(u.current), L(!1);
|
|
56
58
|
}, G = () => {
|
|
57
|
-
|
|
59
|
+
w(), i((t) => Math.min(t + 1, l - 1));
|
|
58
60
|
}, O = () => {
|
|
59
|
-
|
|
61
|
+
w(), i((t) => Math.max(t - 1, 0));
|
|
60
62
|
}, q = (t) => {
|
|
61
|
-
|
|
63
|
+
w(), i(t);
|
|
62
64
|
}, B = () => d ? `translateX(-${a * d}px)` : "translateX(0px)", I = () => {
|
|
63
65
|
i((t) => t >= l - 1 ? 0 : t + 1);
|
|
64
66
|
};
|
|
65
|
-
return x(() => (
|
|
67
|
+
return x(() => (k && (u.current = setInterval(
|
|
66
68
|
I,
|
|
67
69
|
$ * 1e3
|
|
68
70
|
)), () => {
|
|
69
71
|
u.current && clearInterval(u.current);
|
|
70
|
-
}), [
|
|
72
|
+
}), [k, $, I]), /* @__PURE__ */ g("div", { className: `${z ?? ""} ${n.carousel}`, ref: j, children: [
|
|
71
73
|
/* @__PURE__ */ s(
|
|
72
74
|
"div",
|
|
73
75
|
{
|
|
@@ -107,7 +109,7 @@ function it({
|
|
|
107
109
|
)
|
|
108
110
|
}
|
|
109
111
|
),
|
|
110
|
-
l > 1 && /* @__PURE__ */
|
|
112
|
+
l > 1 && /* @__PURE__ */ g("div", { className: n.controls, children: [
|
|
111
113
|
/* @__PURE__ */ s("div", { className: n.indicators, children: Array.from({ length: l }).map((t, e) => /* @__PURE__ */ s(
|
|
112
114
|
"button",
|
|
113
115
|
{
|
|
@@ -117,7 +119,7 @@ function it({
|
|
|
117
119
|
},
|
|
118
120
|
e
|
|
119
121
|
)) }),
|
|
120
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ g("div", { className: n.buttons, children: [
|
|
121
123
|
/* @__PURE__ */ s(
|
|
122
124
|
"button",
|
|
123
125
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsx as o, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { useState as k, useRef as T, useCallback as m, useEffect as y } from "react";
|
|
3
3
|
import { X as z } from "../../x-CnsEH4Ox.js";
|
|
4
4
|
import { c as I } from "../../createLucideIcon-C8GTh_Qx.js";
|
|
5
5
|
import { C as O } from "../../chevron-down-DSUzBz9F.js";
|
|
@@ -36,29 +36,35 @@ function ne({
|
|
|
36
36
|
isSticky: x = !1,
|
|
37
37
|
className: N
|
|
38
38
|
}) {
|
|
39
|
-
const [s, _] =
|
|
39
|
+
const [s, _] = k(!1), [C, l] = k(null), i = T(null), E = () => {
|
|
40
40
|
_((a) => !a);
|
|
41
41
|
}, L = (a) => {
|
|
42
|
-
l((
|
|
43
|
-
},
|
|
42
|
+
l((t) => t === a ? null : a);
|
|
43
|
+
}, p = m((a) => {
|
|
44
44
|
i.current && !i.current.contains(a.target) && l(null);
|
|
45
|
-
}, []),
|
|
45
|
+
}, []), v = m(() => {
|
|
46
46
|
l(null);
|
|
47
|
-
}, []),
|
|
48
|
-
window.innerWidth > 768 && (_(!1), l(null), document.body.style.overflow = "");
|
|
47
|
+
}, []), f = m(() => {
|
|
48
|
+
typeof window < "u" && window.innerWidth > 768 && (_(!1), l(null), typeof document < "u" && (document.body.style.overflow = ""));
|
|
49
49
|
}, []);
|
|
50
|
-
y(() =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
y(() => {
|
|
51
|
+
if (typeof window < "u")
|
|
52
|
+
return window.addEventListener("resize", f), document.addEventListener("click", p), window.addEventListener("scroll", v), () => {
|
|
53
|
+
window.removeEventListener("resize", f), document.removeEventListener("click", p), window.removeEventListener("scroll", v);
|
|
54
|
+
};
|
|
55
|
+
}, []), y(() => {
|
|
56
|
+
if (typeof document < "u")
|
|
57
|
+
return document.body.style.overflow = s ? "hidden" : "", () => {
|
|
58
|
+
document.body.style.overflow = "";
|
|
59
|
+
};
|
|
60
|
+
}, [s]);
|
|
61
|
+
const b = (a, t = "") => a.map((n) => {
|
|
62
|
+
var h;
|
|
63
|
+
const r = `${t}/${n.label}`, c = C === r, d = (h = n.sublinks) == null ? void 0 : h.length;
|
|
64
|
+
return /* @__PURE__ */ u(
|
|
59
65
|
"div",
|
|
60
66
|
{
|
|
61
|
-
className: `${e.linkWrapper} ${
|
|
67
|
+
className: `${e.linkWrapper} ${t ? "" : e.parent}`,
|
|
62
68
|
children: [
|
|
63
69
|
/* @__PURE__ */ o("div", { className: e.linkItem, children: n.href ? /* @__PURE__ */ o(
|
|
64
70
|
"a",
|
|
@@ -68,37 +74,37 @@ function ne({
|
|
|
68
74
|
target: n.isExternal ? "_blank" : "_self",
|
|
69
75
|
rel: n.isExternal ? "noopener noreferrer" : void 0,
|
|
70
76
|
onClick: () => {
|
|
71
|
-
var
|
|
72
|
-
l(null), (
|
|
77
|
+
var g;
|
|
78
|
+
l(null), (g = n.onClick) == null || g.call(n);
|
|
73
79
|
},
|
|
74
80
|
role: "menuitem",
|
|
75
81
|
children: n.label
|
|
76
82
|
}
|
|
77
|
-
) : /* @__PURE__ */
|
|
83
|
+
) : /* @__PURE__ */ u(
|
|
78
84
|
"button",
|
|
79
85
|
{
|
|
80
|
-
"aria-haspopup":
|
|
86
|
+
"aria-haspopup": d ? "true" : void 0,
|
|
81
87
|
"aria-expanded": c,
|
|
82
88
|
className: `${e.sublinkToggle} ${c ? e.open : ""}`,
|
|
83
|
-
onClick: () => L(
|
|
89
|
+
onClick: () => L(r),
|
|
84
90
|
children: [
|
|
85
91
|
n.label,
|
|
86
|
-
|
|
92
|
+
d && /* @__PURE__ */ o(O, { size: 21, className: e.chevron })
|
|
87
93
|
]
|
|
88
94
|
}
|
|
89
95
|
) }),
|
|
90
|
-
|
|
96
|
+
d && /* @__PURE__ */ o(
|
|
91
97
|
"div",
|
|
92
98
|
{
|
|
93
99
|
className: `${e.sublinks} ${c ? e.show : ""}`,
|
|
94
100
|
role: "menu",
|
|
95
101
|
"aria-label": `${n.label} submenu`,
|
|
96
|
-
children:
|
|
102
|
+
children: b(n.sublinks, r)
|
|
97
103
|
}
|
|
98
104
|
)
|
|
99
105
|
]
|
|
100
106
|
},
|
|
101
|
-
|
|
107
|
+
r
|
|
102
108
|
);
|
|
103
109
|
});
|
|
104
110
|
return /* @__PURE__ */ o(
|
|
@@ -108,7 +114,7 @@ function ne({
|
|
|
108
114
|
className: `${N ?? ""} ${e.navbar} ${x ? e.sticky : ""} `,
|
|
109
115
|
role: "navigation",
|
|
110
116
|
"aria-label": "Main navigation",
|
|
111
|
-
children: /* @__PURE__ */
|
|
117
|
+
children: /* @__PURE__ */ u("div", { className: e.container, children: [
|
|
112
118
|
/* @__PURE__ */ o("div", { className: e.logo, children: w }),
|
|
113
119
|
/* @__PURE__ */ o(
|
|
114
120
|
"button",
|
|
@@ -127,7 +133,7 @@ function ne({
|
|
|
127
133
|
className: `${e.nav} ${s ? e.open : ""}`,
|
|
128
134
|
id: "main-menu",
|
|
129
135
|
role: "menubar",
|
|
130
|
-
children:
|
|
136
|
+
children: b($)
|
|
131
137
|
}
|
|
132
138
|
)
|
|
133
139
|
] })
|