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 w, jsx as s } from "react/jsx-runtime";
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), [k, T] = p(!1), [y, L] = p(W), j = A(null), u = A(null), m = E, R = (t, e) => {
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
- const t = () => {
38
- const e = window.innerWidth < 768;
39
- T(e), P(e ? 1 : v), i(0);
40
- };
41
- return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
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 && (k ? h(r.contentRect.width - D) : N && c != null && c.current ? h(
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
- }, [k, N]);
54
- const g = () => {
55
+ }, [y, N]);
56
+ const w = () => {
55
57
  u.current && clearInterval(u.current), L(!1);
56
58
  }, G = () => {
57
- g(), i((t) => Math.min(t + 1, l - 1));
59
+ w(), i((t) => Math.min(t + 1, l - 1));
58
60
  }, O = () => {
59
- g(), i((t) => Math.max(t - 1, 0));
61
+ w(), i((t) => Math.max(t - 1, 0));
60
62
  }, q = (t) => {
61
- g(), i(t);
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(() => (y && (u.current = setInterval(
67
+ return x(() => (k && (u.current = setInterval(
66
68
  I,
67
69
  $ * 1e3
68
70
  )), () => {
69
71
  u.current && clearInterval(u.current);
70
- }), [y, $, I]), /* @__PURE__ */ w("div", { className: `${z ?? ""} ${n.carousel}`, ref: j, children: [
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__ */ w("div", { className: n.controls, children: [
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__ */ w("div", { className: n.buttons, children: [
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 d } from "react/jsx-runtime";
2
- import { useState as f, useRef as T, useCallback as m, useEffect as y } from "react";
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, _] = f(!1), [C, l] = f(null), i = T(null), E = () => {
39
+ const [s, _] = k(!1), [C, l] = k(null), i = T(null), E = () => {
40
40
  _((a) => !a);
41
41
  }, L = (a) => {
42
- l((r) => r === a ? null : a);
43
- }, v = m((a) => {
42
+ l((t) => t === a ? null : a);
43
+ }, p = m((a) => {
44
44
  i.current && !i.current.contains(a.target) && l(null);
45
- }, []), p = m(() => {
45
+ }, []), v = m(() => {
46
46
  l(null);
47
- }, []), b = m(() => {
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(() => (window.addEventListener("resize", b), document.addEventListener("click", v), window.addEventListener("scroll", p), () => {
51
- window.removeEventListener("resize", b), document.removeEventListener("click", v), window.removeEventListener("scroll", p);
52
- }), []), y(() => (document.body.style.overflow = s ? "hidden" : "", () => {
53
- document.body.style.overflow = "";
54
- }), [s]);
55
- const h = (a, r = "") => a.map((n) => {
56
- var g;
57
- const t = `${r}/${n.label}`, c = C === t, u = (g = n.sublinks) == null ? void 0 : g.length;
58
- return /* @__PURE__ */ d(
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} ${r ? "" : e.parent}`,
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 k;
72
- l(null), (k = n.onClick) == null || k.call(n);
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__ */ d(
83
+ ) : /* @__PURE__ */ u(
78
84
  "button",
79
85
  {
80
- "aria-haspopup": u ? "true" : void 0,
86
+ "aria-haspopup": d ? "true" : void 0,
81
87
  "aria-expanded": c,
82
88
  className: `${e.sublinkToggle} ${c ? e.open : ""}`,
83
- onClick: () => L(t),
89
+ onClick: () => L(r),
84
90
  children: [
85
91
  n.label,
86
- u && /* @__PURE__ */ o(O, { size: 21, className: e.chevron })
92
+ d && /* @__PURE__ */ o(O, { size: 21, className: e.chevron })
87
93
  ]
88
94
  }
89
95
  ) }),
90
- u && /* @__PURE__ */ o(
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: h(n.sublinks, t)
102
+ children: b(n.sublinks, r)
97
103
  }
98
104
  )
99
105
  ]
100
106
  },
101
- t
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__ */ d("div", { className: e.container, children: [
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: h($)
136
+ children: b($)
131
137
  }
132
138
  )
133
139
  ] })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quirk-ui",
3
3
  "private": false,
4
- "version": "0.0.65",
4
+ "version": "0.0.66",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {