quirk-ui 0.0.166 → 0.0.167
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.
- package/dist/components/NavBar/index.js +32 -32
- package/package.json +1 -1
|
@@ -15,14 +15,14 @@ const U = [
|
|
|
15
15
|
["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }],
|
|
16
16
|
["line", { x1: "4", x2: "20", y1: "6", y2: "6", key: "1owob3" }],
|
|
17
17
|
["line", { x1: "4", x2: "20", y1: "18", y2: "18", key: "yk5zj1" }]
|
|
18
|
-
], Y = K("menu", U), Z = "_navbar_1auc6_5", ee = "_left_1auc6_18", ne = "_container_1auc6_19", te = "_logo_1auc6_23",
|
|
18
|
+
], Y = K("menu", U), Z = "_navbar_1auc6_5", ee = "_left_1auc6_18", ne = "_container_1auc6_19", te = "_logo_1auc6_23", ae = "_nav_1auc6_5", oe = "_center_1auc6_38", se = "_hidden_1auc6_44", ie = "_visible_1auc6_51", le = "_right_1auc6_66", ce = "_title_1auc6_72", re = "_sublinks_1auc6_82", ue = "_sublinksInner_1auc6_94", de = "_linkItem_1auc6_108", _e = "_minimal_1auc6_113", me = "_menuToggle_1auc6_117", fe = "_linkWrapper_1auc6_121", he = "_triangle_1auc6_159", ve = "_transparent_1auc6_164", ge = "_sticky_1auc6_216", pe = "_twoColumn_1auc6_245", be = "_utilityMobile_1auc6_292", we = "_utility_1auc6_292", ke = "_navInner_1auc6_320", ye = "_grid_1auc6_329", $e = "_sublinkToggle_1auc6_354", Ne = "_link_1auc6_108", Ce = "_open_1auc6_368", xe = "_show_1auc6_419", Me = "_sublinksColumn_1auc6_467", Le = "_chevron_1auc6_477", Ee = "_parent_1auc6_556", e = {
|
|
19
19
|
navbar: Z,
|
|
20
20
|
left: ee,
|
|
21
21
|
container: ne,
|
|
22
22
|
logo: te,
|
|
23
|
-
nav:
|
|
24
|
-
center:
|
|
25
|
-
hidden:
|
|
23
|
+
nav: ae,
|
|
24
|
+
center: oe,
|
|
25
|
+
hidden: se,
|
|
26
26
|
visible: ie,
|
|
27
27
|
right: le,
|
|
28
28
|
title: ce,
|
|
@@ -70,13 +70,13 @@ function Se({
|
|
|
70
70
|
const [l, w] = d(!1), [g, c] = d(null), [D, V] = d(0), [A, G] = d(!1), [P, q] = d(null), p = f(null), r = f(null), k = f(/* @__PURE__ */ new Map()), F = () => {
|
|
71
71
|
w((t) => !t);
|
|
72
72
|
}, H = (t) => {
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
const
|
|
73
|
+
const o = k.current.get(t);
|
|
74
|
+
if (o && r.current) {
|
|
75
|
+
const a = o.getBoundingClientRect(), s = r.current.getBoundingClientRect(), u = a.left - s.left + a.width / 4;
|
|
76
76
|
q(u);
|
|
77
77
|
}
|
|
78
78
|
}, y = (t) => {
|
|
79
|
-
c((
|
|
79
|
+
c((o) => o === t ? null : t);
|
|
80
80
|
}, $ = h((t) => {
|
|
81
81
|
p.current && !p.current.contains(t.target) && c(null);
|
|
82
82
|
}, []), N = h(() => {
|
|
@@ -90,9 +90,9 @@ function Se({
|
|
|
90
90
|
}
|
|
91
91
|
}, []);
|
|
92
92
|
T(() => {
|
|
93
|
-
const t = typeof window < "u",
|
|
94
|
-
return t && (window.addEventListener("resize", C), window.addEventListener("scroll", N)),
|
|
95
|
-
t && (window.removeEventListener("resize", C), window.removeEventListener("scroll", N)),
|
|
93
|
+
const t = typeof window < "u", o = typeof document < "u";
|
|
94
|
+
return t && (window.addEventListener("resize", C), window.addEventListener("scroll", N)), o && document.addEventListener("click", $), x(), () => {
|
|
95
|
+
t && (window.removeEventListener("resize", C), window.removeEventListener("scroll", N)), o && document.removeEventListener("click", $);
|
|
96
96
|
};
|
|
97
97
|
}, []), T(() => {
|
|
98
98
|
if (typeof document < "u")
|
|
@@ -100,30 +100,30 @@ function Se({
|
|
|
100
100
|
document.body.style.overflow = "";
|
|
101
101
|
};
|
|
102
102
|
}, [l]);
|
|
103
|
-
const M = (t,
|
|
103
|
+
const M = (t, o = "") => t.map((a) => {
|
|
104
104
|
var E;
|
|
105
|
-
const
|
|
106
|
-
return k.current.set(
|
|
105
|
+
const s = `${o}/${a.label}`, _ = g === s, u = (E = a.sublinks) == null ? void 0 : E.length, L = f(null);
|
|
106
|
+
return k.current.set(s, L.current), /* @__PURE__ */ m(
|
|
107
107
|
"div",
|
|
108
108
|
{
|
|
109
|
-
className: `${e.linkWrapper} ${
|
|
109
|
+
className: `${e.linkWrapper} ${o ? "" : e.parent}`,
|
|
110
110
|
children: [
|
|
111
|
-
/* @__PURE__ */ n("div", { className: e.linkItem, children:
|
|
111
|
+
/* @__PURE__ */ n("div", { className: e.linkItem, children: a.href ? /* @__PURE__ */ n(
|
|
112
112
|
"a",
|
|
113
113
|
{
|
|
114
|
-
href:
|
|
114
|
+
href: a.href,
|
|
115
115
|
className: e.link,
|
|
116
|
-
target:
|
|
117
|
-
rel:
|
|
116
|
+
target: a.isExternal ? "_blank" : "_self",
|
|
117
|
+
rel: a.isExternal ? "noopener noreferrer" : void 0,
|
|
118
118
|
onClick: () => {
|
|
119
119
|
var R;
|
|
120
|
-
c(null), (R =
|
|
120
|
+
c(null), (R = a.onClick) == null || R.call(a);
|
|
121
121
|
},
|
|
122
122
|
onMouseEnter: () => {
|
|
123
|
-
|
|
123
|
+
o || c(null);
|
|
124
124
|
},
|
|
125
125
|
role: "menuitem",
|
|
126
|
-
children:
|
|
126
|
+
children: a.label
|
|
127
127
|
}
|
|
128
128
|
) : /* @__PURE__ */ m(
|
|
129
129
|
"button",
|
|
@@ -132,12 +132,12 @@ function Se({
|
|
|
132
132
|
"aria-haspopup": u ? "true" : void 0,
|
|
133
133
|
"aria-expanded": _,
|
|
134
134
|
className: `${e.sublinkToggle} ${_ ? e.open : ""}`,
|
|
135
|
-
onClick: () => y(
|
|
135
|
+
onClick: () => y(s),
|
|
136
136
|
onMouseEnter: () => {
|
|
137
|
-
H(
|
|
137
|
+
H(s), c(s);
|
|
138
138
|
},
|
|
139
139
|
children: [
|
|
140
|
-
|
|
140
|
+
a.label,
|
|
141
141
|
u && /* @__PURE__ */ n(Q, { size: 18, className: e.chevron })
|
|
142
142
|
]
|
|
143
143
|
}
|
|
@@ -146,15 +146,15 @@ function Se({
|
|
|
146
146
|
"div",
|
|
147
147
|
{
|
|
148
148
|
className: `${e.sublinks} ${_ ? e.show : ""}`,
|
|
149
|
-
onMouseLeave: () => y(
|
|
149
|
+
onMouseLeave: () => y(s),
|
|
150
150
|
role: "menu",
|
|
151
|
-
"aria-label": `${
|
|
152
|
-
children: /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n("div", { className: e.sublinksInner, children: /* @__PURE__ */ n("div", { className: e.sublinksColumn, children: M(
|
|
151
|
+
"aria-label": `${a.label} submenu`,
|
|
152
|
+
children: /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n("div", { className: e.sublinksInner, children: /* @__PURE__ */ n("div", { className: e.sublinksColumn, children: M(a.sublinks, s) }) }) })
|
|
153
153
|
}
|
|
154
154
|
)
|
|
155
155
|
]
|
|
156
156
|
},
|
|
157
|
-
|
|
157
|
+
s
|
|
158
158
|
);
|
|
159
159
|
});
|
|
160
160
|
return /* @__PURE__ */ n(
|
|
@@ -211,7 +211,7 @@ function Se({
|
|
|
211
211
|
] })
|
|
212
212
|
}
|
|
213
213
|
),
|
|
214
|
-
i && /* @__PURE__ */ n("nav", { className: e.utility, children: /* @__PURE__ */ n(W, { children: i.map((t,
|
|
214
|
+
i && /* @__PURE__ */ n("nav", { className: e.utility, children: /* @__PURE__ */ n(W, { children: i.map((t, o) => /* @__PURE__ */ n(
|
|
215
215
|
I,
|
|
216
216
|
{
|
|
217
217
|
as: "a",
|
|
@@ -219,7 +219,7 @@ function Se({
|
|
|
219
219
|
variant: t.variant,
|
|
220
220
|
children: t.label
|
|
221
221
|
},
|
|
222
|
-
t._key ||
|
|
222
|
+
t._key || o
|
|
223
223
|
)) }) }),
|
|
224
224
|
i && /* @__PURE__ */ n(
|
|
225
225
|
"nav",
|
|
@@ -230,7 +230,7 @@ function Se({
|
|
|
230
230
|
{
|
|
231
231
|
as: "a",
|
|
232
232
|
href: i[1].href ?? "/",
|
|
233
|
-
variant: "
|
|
233
|
+
variant: "primary",
|
|
234
234
|
children: i[1].label
|
|
235
235
|
},
|
|
236
236
|
i[1]._key
|