quirk-ui 0.0.66 → 0.0.67

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,5 +1,5 @@
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";
1
+ import { jsx as s, jsxs as u } from "react/jsx-runtime";
2
+ import { useState as k, useRef as T, useCallback as m, useEffect as w } 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";
@@ -13,12 +13,12 @@ const W = [
13
13
  ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }],
14
14
  ["line", { x1: "4", x2: "20", y1: "6", y2: "6", key: "1owob3" }],
15
15
  ["line", { x1: "4", x2: "20", y1: "18", y2: "18", key: "yk5zj1" }]
16
- ], j = I("menu", W), M = "_navbar_12ooa_5", R = "_sticky_12ooa_19", S = "_container_12ooa_25", P = "_logo_12ooa_35", D = "_menuToggle_12ooa_41", X = "_nav_12ooa_5", q = "_linkWrapper_12ooa_57", A = "_linkItem_12ooa_63", B = "_sublinkToggle_12ooa_71", F = "_link_12ooa_57", G = "_sublinks_12ooa_102", H = "_show_12ooa_125", J = "_chevron_12ooa_132", K = "_open_12ooa_136", Q = "_parent_12ooa_178", e = {
16
+ ], j = I("menu", W), M = "_navbar_12ooa_5", R = "_sticky_12ooa_19", S = "_container_12ooa_25", D = "_logo_12ooa_35", P = "_menuToggle_12ooa_41", X = "_nav_12ooa_5", q = "_linkWrapper_12ooa_57", A = "_linkItem_12ooa_63", B = "_sublinkToggle_12ooa_71", F = "_link_12ooa_57", G = "_sublinks_12ooa_102", H = "_show_12ooa_125", J = "_chevron_12ooa_132", K = "_open_12ooa_136", Q = "_parent_12ooa_178", e = {
17
17
  navbar: M,
18
18
  sticky: R,
19
19
  container: S,
20
- logo: P,
21
- menuToggle: D,
20
+ logo: D,
21
+ menuToggle: P,
22
22
  nav: X,
23
23
  linkWrapper: q,
24
24
  linkItem: A,
@@ -31,42 +31,42 @@ const W = [
31
31
  parent: Q
32
32
  };
33
33
  function ne({
34
- logo: w,
34
+ logo: y,
35
35
  items: $,
36
36
  isSticky: x = !1,
37
37
  className: N
38
38
  }) {
39
- const [s, _] = k(!1), [C, l] = k(null), i = T(null), E = () => {
40
- _((a) => !a);
41
- }, L = (a) => {
42
- l((t) => t === a ? null : a);
43
- }, p = m((a) => {
44
- i.current && !i.current.contains(a.target) && l(null);
45
- }, []), v = m(() => {
39
+ const [t, _] = k(!1), [C, l] = k(null), r = T(null), E = () => {
40
+ _((o) => !o);
41
+ }, L = (o) => {
42
+ l((a) => a === o ? null : o);
43
+ }, f = m((o) => {
44
+ r.current && !r.current.contains(o.target) && l(null);
45
+ }, []), p = m(() => {
46
46
  l(null);
47
- }, []), f = m(() => {
47
+ }, []), v = m(() => {
48
48
  typeof window < "u" && window.innerWidth > 768 && (_(!1), l(null), typeof document < "u" && (document.body.style.overflow = ""));
49
49
  }, []);
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(() => {
50
+ w(() => {
51
+ const o = typeof window < "u", a = typeof window < "u";
52
+ return o && (window.addEventListener("resize", v), window.addEventListener("scroll", p)), a && document.addEventListener("click", f), () => {
53
+ o && (window.removeEventListener("resize", v), window.removeEventListener("scroll", p)), a && document.removeEventListener("click", f);
54
+ };
55
+ }, []), w(() => {
56
56
  if (typeof document < "u")
57
- return document.body.style.overflow = s ? "hidden" : "", () => {
57
+ return document.body.style.overflow = t ? "hidden" : "", () => {
58
58
  document.body.style.overflow = "";
59
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;
60
+ }, [t]);
61
+ const h = (o, a = "") => o.map((n) => {
62
+ var b;
63
+ const i = `${a}/${n.label}`, c = C === i, d = (b = n.sublinks) == null ? void 0 : b.length;
64
64
  return /* @__PURE__ */ u(
65
65
  "div",
66
66
  {
67
- className: `${e.linkWrapper} ${t ? "" : e.parent}`,
67
+ className: `${e.linkWrapper} ${a ? "" : e.parent}`,
68
68
  children: [
69
- /* @__PURE__ */ o("div", { className: e.linkItem, children: n.href ? /* @__PURE__ */ o(
69
+ /* @__PURE__ */ s("div", { className: e.linkItem, children: n.href ? /* @__PURE__ */ s(
70
70
  "a",
71
71
  {
72
72
  href: n.href,
@@ -86,54 +86,54 @@ function ne({
86
86
  "aria-haspopup": d ? "true" : void 0,
87
87
  "aria-expanded": c,
88
88
  className: `${e.sublinkToggle} ${c ? e.open : ""}`,
89
- onClick: () => L(r),
89
+ onClick: () => L(i),
90
90
  children: [
91
91
  n.label,
92
- d && /* @__PURE__ */ o(O, { size: 21, className: e.chevron })
92
+ d && /* @__PURE__ */ s(O, { size: 21, className: e.chevron })
93
93
  ]
94
94
  }
95
95
  ) }),
96
- d && /* @__PURE__ */ o(
96
+ d && /* @__PURE__ */ s(
97
97
  "div",
98
98
  {
99
99
  className: `${e.sublinks} ${c ? e.show : ""}`,
100
100
  role: "menu",
101
101
  "aria-label": `${n.label} submenu`,
102
- children: b(n.sublinks, r)
102
+ children: h(n.sublinks, i)
103
103
  }
104
104
  )
105
105
  ]
106
106
  },
107
- r
107
+ i
108
108
  );
109
109
  });
110
- return /* @__PURE__ */ o(
110
+ return /* @__PURE__ */ s(
111
111
  "header",
112
112
  {
113
- ref: i,
113
+ ref: r,
114
114
  className: `${N ?? ""} ${e.navbar} ${x ? e.sticky : ""} `,
115
115
  role: "navigation",
116
116
  "aria-label": "Main navigation",
117
117
  children: /* @__PURE__ */ u("div", { className: e.container, children: [
118
- /* @__PURE__ */ o("div", { className: e.logo, children: w }),
119
- /* @__PURE__ */ o(
118
+ /* @__PURE__ */ s("div", { className: e.logo, children: y }),
119
+ /* @__PURE__ */ s(
120
120
  "button",
121
121
  {
122
122
  className: e.menuToggle,
123
123
  onClick: E,
124
- "aria-label": s ? "Close menu" : "Open menu",
125
- "aria-expanded": s,
124
+ "aria-label": t ? "Close menu" : "Open menu",
125
+ "aria-expanded": t,
126
126
  "aria-controls": "main-menu",
127
- children: s ? /* @__PURE__ */ o(z, { size: 24 }) : /* @__PURE__ */ o(j, { size: 24 })
127
+ children: t ? /* @__PURE__ */ s(z, { size: 24 }) : /* @__PURE__ */ s(j, { size: 24 })
128
128
  }
129
129
  ),
130
- /* @__PURE__ */ o(
130
+ /* @__PURE__ */ s(
131
131
  "nav",
132
132
  {
133
- className: `${e.nav} ${s ? e.open : ""}`,
133
+ className: `${e.nav} ${t ? e.open : ""}`,
134
134
  id: "main-menu",
135
135
  role: "menubar",
136
- children: b($)
136
+ children: h($)
137
137
  }
138
138
  )
139
139
  ] })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quirk-ui",
3
3
  "private": false,
4
- "version": "0.0.66",
4
+ "version": "0.0.67",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {