boreal-ui 0.0.896 → 0.0.897
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/core/Dropdown-CpVnd2Rl.cjs +1 -0
- package/dist/core/Dropdown-DJt7qBhC.js +482 -0
- package/dist/core/Dropdown.cjs.js +1 -1
- package/dist/core/Dropdown.css +1 -1
- package/dist/core/Dropdown.js +1 -1
- package/dist/core/Sidebar-C0HYR4mK.js +403 -0
- package/dist/core/Sidebar-DtZeE-tR.cjs +1 -0
- package/dist/core/Sidebar.cjs.js +1 -1
- package/dist/core/Sidebar.js +1 -1
- package/dist/core/index.cjs.js +3 -3
- package/dist/core/index.js +168 -15
- package/dist/generated-docs/Sidebar.props.js +153 -0
- package/dist/next/Dropdown-ghc8m7E8.js +486 -0
- package/dist/next/Dropdown.css +1 -1
- package/dist/next/Dropdown.js +1 -1
- package/dist/next/Sidebar-DBrOAu-S.js +408 -0
- package/dist/next/Sidebar.js +1 -1
- package/dist/next/index.js +165 -12
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/Dropdown/Dropdown.types.d.ts +15 -0
- package/dist/types/components/Dropdown/Dropdown.types.d.ts.map +1 -1
- package/dist/types/components/Dropdown/DropdownBase.d.ts.map +1 -1
- package/dist/types/components/Dropdown/core/Dropdown.d.ts.map +1 -1
- package/dist/types/components/Sidebar/Sidebar.types.d.ts +68 -0
- package/dist/types/components/Sidebar/Sidebar.types.d.ts.map +1 -1
- package/dist/types/components/Sidebar/SidebarBase.d.ts.map +1 -1
- package/dist/types/generated-docs/Sidebar.props.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/core/Dropdown-Bn5CJ_cq.js +0 -326
- package/dist/core/Dropdown-uphBEoU4.cjs +0 -1
- package/dist/core/Sidebar-BcSPbLsY.cjs +0 -1
- package/dist/core/Sidebar-Bh2jCCus.js +0 -331
- package/dist/next/Dropdown-tmE5RI-T.js +0 -330
- package/dist/next/Sidebar-DYNqARud.js +0 -336
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { jsxs as w, jsx as l, Fragment as De } from "react/jsx-runtime";
|
|
2
|
+
import { e as qe } from "./propAliases-XRHC6471.js";
|
|
3
|
+
import { useState as ee, useRef as M, useEffect as ze, useMemo as He } from "react";
|
|
4
|
+
import { c as o } from "./classNames-Dz0_huu_.js";
|
|
5
|
+
import { g as Pe, b as je, a as Fe, e as Ve, f as We } from "./boreal-style-config-rYvfCHLY.js";
|
|
6
|
+
import { c as A } from "./capitalize-D_pj4b3P.js";
|
|
7
|
+
import { C as xe } from "./CheveronDownIcon-2JerSa2p.js";
|
|
8
|
+
import './Sidebar.css';const re = ({
|
|
9
|
+
links: d,
|
|
10
|
+
classMap: e,
|
|
11
|
+
LinkComponent: b = "a",
|
|
12
|
+
isLinkActive: r,
|
|
13
|
+
hasActiveChild: c,
|
|
14
|
+
theme: S = Pe(),
|
|
15
|
+
rounding: O = je(),
|
|
16
|
+
shadow: v = Fe(),
|
|
17
|
+
state: m = "",
|
|
18
|
+
showFooter: g = !1,
|
|
19
|
+
footerLinks: I,
|
|
20
|
+
footerVersion: G,
|
|
21
|
+
outline: T = Ve(),
|
|
22
|
+
glass: J = We(),
|
|
23
|
+
className: K = "",
|
|
24
|
+
navClassName: ne = "",
|
|
25
|
+
listClassName: oe = "",
|
|
26
|
+
childListClassName: de = "",
|
|
27
|
+
itemClassName: ie = "",
|
|
28
|
+
linkClassName: z = "",
|
|
29
|
+
childLinkClassName: Q = "",
|
|
30
|
+
activeClassName: H = "",
|
|
31
|
+
expandButtonClassName: te = "",
|
|
32
|
+
iconClassName: R = "",
|
|
33
|
+
expandLabelClassName: se = "",
|
|
34
|
+
chevronClassName: le = "",
|
|
35
|
+
chevronOpenClassName: be = "",
|
|
36
|
+
submenuClassName: ce = "",
|
|
37
|
+
submenuOpenClassName: ue = "",
|
|
38
|
+
footerClassName: me = "",
|
|
39
|
+
footerLinkClassName: fe = "",
|
|
40
|
+
footerVersionClassName: _e = "",
|
|
41
|
+
"data-testid": he,
|
|
42
|
+
testId: t = he ?? "sidebar",
|
|
43
|
+
"aria-label": ge = "Sidebar navigation",
|
|
44
|
+
"aria-labelledby": U,
|
|
45
|
+
"aria-describedby": $e,
|
|
46
|
+
footerAriaLabel: we = "Sidebar footer",
|
|
47
|
+
footerAriaLabelledBy: X,
|
|
48
|
+
getExpandButtonAriaLabel: P,
|
|
49
|
+
getExpandButtonAriaDescription: j,
|
|
50
|
+
...ye
|
|
51
|
+
}) => {
|
|
52
|
+
const [pe, Y] = ee({}), F = M({}), Ne = M(0), Se = (i) => {
|
|
53
|
+
if (!F.current[i]) {
|
|
54
|
+
const n = i.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9_-]/g, "");
|
|
55
|
+
F.current[i] = `${t}-section-${n}-${Ne.current++}`;
|
|
56
|
+
}
|
|
57
|
+
return F.current[i];
|
|
58
|
+
};
|
|
59
|
+
ze(() => {
|
|
60
|
+
const i = {}, n = (s) => {
|
|
61
|
+
var y;
|
|
62
|
+
for (const a of s)
|
|
63
|
+
(y = a.children) != null && y.length && ((c == null ? void 0 : c(a)) ?? a.children.some(
|
|
64
|
+
(_) => {
|
|
65
|
+
var p;
|
|
66
|
+
return ((r == null ? void 0 : r(_)) ?? !1) || !!((p = _.children) != null && p.length) && n(_.children);
|
|
67
|
+
}
|
|
68
|
+
)) && (i[a.label] = !0);
|
|
69
|
+
return s.some(
|
|
70
|
+
(a) => {
|
|
71
|
+
var f;
|
|
72
|
+
return ((r == null ? void 0 : r(a)) ?? !1) || !!((f = a.children) != null && f.length) && n(a.children);
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
n(d), Y((s) => ({ ...s, ...i }));
|
|
77
|
+
}, [d, r, c]);
|
|
78
|
+
const ve = (i) => Y((n) => ({ ...n, [i]: !n[i] })), Ie = He(
|
|
79
|
+
() => o(
|
|
80
|
+
e.wrapper,
|
|
81
|
+
K,
|
|
82
|
+
e[S],
|
|
83
|
+
e[m],
|
|
84
|
+
v && e[`shadow${A(v)}`],
|
|
85
|
+
O && e[`round${A(O)}`],
|
|
86
|
+
T && e.outline,
|
|
87
|
+
J && e.glass
|
|
88
|
+
),
|
|
89
|
+
[e, K, S, m, T, J, O, v]
|
|
90
|
+
), Z = (i, n = !1) => /* @__PURE__ */ l(
|
|
91
|
+
"ul",
|
|
92
|
+
{
|
|
93
|
+
className: o(
|
|
94
|
+
e.list,
|
|
95
|
+
oe,
|
|
96
|
+
n && e.childList,
|
|
97
|
+
n && de
|
|
98
|
+
),
|
|
99
|
+
"data-testid": `${t}-list`,
|
|
100
|
+
children: i.map((s, y) => {
|
|
101
|
+
const {
|
|
102
|
+
label: a,
|
|
103
|
+
href: f,
|
|
104
|
+
target: _,
|
|
105
|
+
rel: p,
|
|
106
|
+
children: h,
|
|
107
|
+
icon: N,
|
|
108
|
+
"aria-label": V,
|
|
109
|
+
"aria-description": W,
|
|
110
|
+
"aria-disabled": D
|
|
111
|
+
} = s, Oe = `${a}-${y}`, $ = (r == null ? void 0 : r(s)) ?? !1, B = (c == null ? void 0 : c(s)) ?? !!(h != null && h.some(
|
|
112
|
+
(x) => {
|
|
113
|
+
var C;
|
|
114
|
+
return ((r == null ? void 0 : r(x)) ?? !1) || ((C = x.children) == null ? void 0 : C.length) && ((c == null ? void 0 : c(x)) ?? !1);
|
|
115
|
+
}
|
|
116
|
+
)), u = !!pe[a], E = Se(a), L = `${E}-button`, k = `${E}-panel`, Re = p ?? (_ === "_blank" ? "noopener noreferrer" : void 0);
|
|
117
|
+
return /* @__PURE__ */ l(
|
|
118
|
+
"li",
|
|
119
|
+
{
|
|
120
|
+
className: o(e.item, ie),
|
|
121
|
+
"data-testid": `${t}-listItem`,
|
|
122
|
+
children: h && h.length > 0 ? /* @__PURE__ */ w(De, { children: [
|
|
123
|
+
/* @__PURE__ */ w(
|
|
124
|
+
"button",
|
|
125
|
+
{
|
|
126
|
+
type: "button",
|
|
127
|
+
id: L,
|
|
128
|
+
className: o(
|
|
129
|
+
e.link,
|
|
130
|
+
z,
|
|
131
|
+
te,
|
|
132
|
+
($ || u || B) && e.active,
|
|
133
|
+
($ || u || B) && H
|
|
134
|
+
),
|
|
135
|
+
onClick: () => ve(a),
|
|
136
|
+
"aria-expanded": u,
|
|
137
|
+
"aria-controls": k,
|
|
138
|
+
"aria-label": (P == null ? void 0 : P(s, u)) ?? V,
|
|
139
|
+
"aria-description": (j == null ? void 0 : j(s, u)) ?? W,
|
|
140
|
+
"aria-disabled": D ? !0 : void 0,
|
|
141
|
+
"data-testid": `${t}-expandItemButton`,
|
|
142
|
+
children: [
|
|
143
|
+
N && /* @__PURE__ */ l(
|
|
144
|
+
"span",
|
|
145
|
+
{
|
|
146
|
+
className: o(
|
|
147
|
+
e.icon,
|
|
148
|
+
R
|
|
149
|
+
),
|
|
150
|
+
children: N
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ l(
|
|
154
|
+
"span",
|
|
155
|
+
{
|
|
156
|
+
className: se,
|
|
157
|
+
"data-testid": `${t}-expandItemLabel`,
|
|
158
|
+
children: a
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
/* @__PURE__ */ l(
|
|
162
|
+
xe,
|
|
163
|
+
{
|
|
164
|
+
className: o(
|
|
165
|
+
e.chevron,
|
|
166
|
+
le,
|
|
167
|
+
u && e.chevronOpen,
|
|
168
|
+
u && be
|
|
169
|
+
),
|
|
170
|
+
"aria-hidden": "true",
|
|
171
|
+
focusable: !1,
|
|
172
|
+
"data-testid": `${t}-expandIcon`
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
/* @__PURE__ */ l(
|
|
179
|
+
"div",
|
|
180
|
+
{
|
|
181
|
+
id: k,
|
|
182
|
+
className: o(
|
|
183
|
+
e.submenu,
|
|
184
|
+
ce,
|
|
185
|
+
u && e.submenuOpen,
|
|
186
|
+
u && ue
|
|
187
|
+
),
|
|
188
|
+
role: "group",
|
|
189
|
+
"aria-labelledby": L,
|
|
190
|
+
hidden: !u,
|
|
191
|
+
"data-testid": `${t}-subMenu`,
|
|
192
|
+
children: Z(h, !0)
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
] }) : f && !D ? /* @__PURE__ */ w(
|
|
196
|
+
b,
|
|
197
|
+
{
|
|
198
|
+
href: f,
|
|
199
|
+
target: _,
|
|
200
|
+
rel: Re,
|
|
201
|
+
className: o(
|
|
202
|
+
e.link,
|
|
203
|
+
z,
|
|
204
|
+
n && e.childLink,
|
|
205
|
+
n && Q,
|
|
206
|
+
$ && e.active,
|
|
207
|
+
$ && H
|
|
208
|
+
),
|
|
209
|
+
"aria-current": $ ? "page" : void 0,
|
|
210
|
+
"aria-label": V,
|
|
211
|
+
"aria-description": W,
|
|
212
|
+
"aria-disabled": D ? !0 : void 0,
|
|
213
|
+
"data-testid": `${t}-sidebarLink`,
|
|
214
|
+
children: [
|
|
215
|
+
N && /* @__PURE__ */ l(
|
|
216
|
+
"span",
|
|
217
|
+
{
|
|
218
|
+
className: o(e.icon, R),
|
|
219
|
+
children: N
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
a
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
) : /* @__PURE__ */ w(
|
|
226
|
+
"span",
|
|
227
|
+
{
|
|
228
|
+
className: o(
|
|
229
|
+
e.link,
|
|
230
|
+
z,
|
|
231
|
+
n && e.childLink,
|
|
232
|
+
n && Q,
|
|
233
|
+
$ && e.active,
|
|
234
|
+
$ && H
|
|
235
|
+
),
|
|
236
|
+
"aria-label": V,
|
|
237
|
+
"aria-description": W,
|
|
238
|
+
"aria-disabled": D ? !0 : void 0,
|
|
239
|
+
"data-testid": `${t}-sidebarLabel`,
|
|
240
|
+
children: [
|
|
241
|
+
N && /* @__PURE__ */ l(
|
|
242
|
+
"span",
|
|
243
|
+
{
|
|
244
|
+
className: o(e.icon, R),
|
|
245
|
+
children: N
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
a
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
},
|
|
253
|
+
Oe
|
|
254
|
+
);
|
|
255
|
+
})
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
return /* @__PURE__ */ w(
|
|
259
|
+
"nav",
|
|
260
|
+
{
|
|
261
|
+
className: Ie,
|
|
262
|
+
"aria-label": U ? void 0 : ge,
|
|
263
|
+
"aria-labelledby": U,
|
|
264
|
+
"aria-describedby": $e,
|
|
265
|
+
"data-testid": t,
|
|
266
|
+
...ye,
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ l("div", { className: o(e.nav, ne), children: Z(d) }),
|
|
269
|
+
g && /* @__PURE__ */ w(
|
|
270
|
+
"footer",
|
|
271
|
+
{
|
|
272
|
+
className: o(e.footer, me),
|
|
273
|
+
"aria-label": X ? void 0 : we,
|
|
274
|
+
"aria-labelledby": X,
|
|
275
|
+
"data-testid": `${t}-footer`,
|
|
276
|
+
children: [
|
|
277
|
+
I == null ? void 0 : I.map(
|
|
278
|
+
({
|
|
279
|
+
label: i,
|
|
280
|
+
href: n,
|
|
281
|
+
target: s,
|
|
282
|
+
rel: y,
|
|
283
|
+
icon: a,
|
|
284
|
+
"aria-label": f,
|
|
285
|
+
"aria-description": _,
|
|
286
|
+
"aria-disabled": p
|
|
287
|
+
}, h) => /* @__PURE__ */ w(
|
|
288
|
+
b,
|
|
289
|
+
{
|
|
290
|
+
href: n,
|
|
291
|
+
target: s,
|
|
292
|
+
rel: y ?? (s === "_blank" ? "noopener noreferrer" : void 0),
|
|
293
|
+
className: o(
|
|
294
|
+
e.footerLink,
|
|
295
|
+
fe
|
|
296
|
+
),
|
|
297
|
+
"aria-label": f,
|
|
298
|
+
"aria-description": _,
|
|
299
|
+
"aria-disabled": p ? !0 : void 0,
|
|
300
|
+
"data-testid": `${t}-footerLink`,
|
|
301
|
+
children: [
|
|
302
|
+
a && /* @__PURE__ */ l(
|
|
303
|
+
"span",
|
|
304
|
+
{
|
|
305
|
+
className: o(e.icon, R),
|
|
306
|
+
children: a
|
|
307
|
+
}
|
|
308
|
+
),
|
|
309
|
+
i
|
|
310
|
+
]
|
|
311
|
+
},
|
|
312
|
+
`${i}-${h}`
|
|
313
|
+
)
|
|
314
|
+
),
|
|
315
|
+
G && /* @__PURE__ */ l(
|
|
316
|
+
"span",
|
|
317
|
+
{
|
|
318
|
+
className: o(
|
|
319
|
+
e.footerVersion,
|
|
320
|
+
_e
|
|
321
|
+
),
|
|
322
|
+
"data-testid": `${t}-footerVersion`,
|
|
323
|
+
children: G
|
|
324
|
+
}
|
|
325
|
+
)
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
)
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
);
|
|
332
|
+
};
|
|
333
|
+
re.displayName = "SidebarBase";
|
|
334
|
+
const q = (d) => d.endsWith("/") && d.length > 1 ? d.slice(0, -1) : d, Ge = (d, e) => {
|
|
335
|
+
const b = q(d), r = q(e);
|
|
336
|
+
return b === "/" ? r === "/" : r === b || r.startsWith(`${b}/`);
|
|
337
|
+
}, ae = (d, e) => {
|
|
338
|
+
var b;
|
|
339
|
+
return e(d) ? !0 : !!((b = d.children) != null && b.some((r) => ae(r, e)));
|
|
340
|
+
}, Te = {
|
|
341
|
+
wrapper: "sidebar",
|
|
342
|
+
nav: "sidebar_nav",
|
|
343
|
+
list: "sidebar_list",
|
|
344
|
+
childList: "sidebar_child_list",
|
|
345
|
+
item: "sidebar_item",
|
|
346
|
+
link: "sidebar_link",
|
|
347
|
+
childLink: "sidebar_child_link",
|
|
348
|
+
active: "sidebar_active",
|
|
349
|
+
icon: "sidebar_icon",
|
|
350
|
+
footer: "sidebar_footer",
|
|
351
|
+
footerLink: "sidebar_footer_link",
|
|
352
|
+
footerVersion: "sidebar_footer_version",
|
|
353
|
+
chevron: "sidebar_chevron",
|
|
354
|
+
chevronOpen: "sidebar_chevron_open",
|
|
355
|
+
submenu: "sidebar_submenu",
|
|
356
|
+
submenuOpen: "sidebar_submenu_open",
|
|
357
|
+
outline: "sidebar_outline",
|
|
358
|
+
glass: "sidebar_glass",
|
|
359
|
+
primary: "sidebar_primary",
|
|
360
|
+
secondary: "sidebar_secondary",
|
|
361
|
+
tertiary: "sidebar_tertiary",
|
|
362
|
+
quaternary: "sidebar_quaternary",
|
|
363
|
+
success: "sidebar_success",
|
|
364
|
+
error: "sidebar_error",
|
|
365
|
+
warning: "sidebar_warning",
|
|
366
|
+
clear: "sidebar_clear",
|
|
367
|
+
shadowNone: "sidebar_shadow-None",
|
|
368
|
+
shadowLight: "sidebar_shadow-Light",
|
|
369
|
+
shadowMedium: "sidebar_shadow-Medium",
|
|
370
|
+
shadowStrong: "sidebar_shadow-Strong",
|
|
371
|
+
shadowIntense: "sidebar_shadow-Intense",
|
|
372
|
+
roundNone: "sidebar_round-None",
|
|
373
|
+
roundSmall: "sidebar_round-Small",
|
|
374
|
+
roundMedium: "sidebar_round-Medium",
|
|
375
|
+
roundLarge: "sidebar_round-Large"
|
|
376
|
+
}, Je = () => typeof window < "u" && window.location.pathname || "/", Ke = ({
|
|
377
|
+
isLinkActive: d,
|
|
378
|
+
hasActiveChild: e,
|
|
379
|
+
...b
|
|
380
|
+
}) => {
|
|
381
|
+
const [r] = ee(Je), S = d ?? ((m) => {
|
|
382
|
+
var g;
|
|
383
|
+
return m.href ? (g = m.children) != null && g.length ? Ge(m.href, r) : q(m.href) === q(r) : !1;
|
|
384
|
+
}), v = e ?? ((m) => {
|
|
385
|
+
var g;
|
|
386
|
+
return !!((g = m.children) != null && g.some(
|
|
387
|
+
(I) => ae(I, S)
|
|
388
|
+
));
|
|
389
|
+
});
|
|
390
|
+
return /* @__PURE__ */ l(
|
|
391
|
+
re,
|
|
392
|
+
{
|
|
393
|
+
...b,
|
|
394
|
+
classMap: qe(Te),
|
|
395
|
+
isLinkActive: S,
|
|
396
|
+
hasActiveChild: v
|
|
397
|
+
}
|
|
398
|
+
);
|
|
399
|
+
};
|
|
400
|
+
Ke.displayName = "Sidebar";
|
|
401
|
+
export {
|
|
402
|
+
Ke as S
|
|
403
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require('./Sidebar.css');const a=require("react/jsx-runtime"),Re=require("./propAliases-Bfsf5cJN.cjs"),x=require("react"),i=require("./classNames-C7V3kfBj.cjs"),q=require("./boreal-style-config-BB8MdwYx.cjs"),A=require("./capitalize-CnTiekgk.cjs"),Ie=require("./CheveronDownIcon-DlOyETj2.cjs"),ee=({links:o,classMap:e,LinkComponent:c="a",isLinkActive:r,hasActiveChild:b,theme:y=q.getDefaultTheme(),rounding:v=q.getDefaultRounding(),shadow:S=q.getDefaultShadow(),state:m="",showFooter:N=!1,footerLinks:p,footerVersion:T,outline:C=q.getDefaultOutline(),glass:J=q.getDefaultGlass(),className:K="",navClassName:se="",listClassName:ne="",childListClassName:ie="",itemClassName:oe="",linkClassName:D="",childLinkClassName:Q="",activeClassName:z="",expandButtonClassName:de="",iconClassName:R="",expandLabelClassName:te="",chevronClassName:le="",chevronOpenClassName:ce="",submenuClassName:be="",submenuOpenClassName:ue="",footerClassName:me="",footerLinkClassName:fe="",footerVersionClassName:_e="","data-testid":he,testId:t=he??"sidebar","aria-label":Ne="Sidebar navigation","aria-labelledby":U,"aria-describedby":ge,footerAriaLabel:$e="Sidebar footer",footerAriaLabelledBy:X,getExpandButtonAriaLabel:H,getExpandButtonAriaDescription:P,...we})=>{const[je,Y]=x.useState({}),F=x.useRef({}),xe=x.useRef(0),ye=d=>{if(!F.current[d]){const n=d.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_-]/g,"");F.current[d]=`${t}-section-${n}-${xe.current++}`}return F.current[d]};x.useEffect(()=>{const d={},n=l=>{var $;for(const s of l)($=s.children)!=null&&$.length&&((b==null?void 0:b(s))??s.children.some(_=>{var w;return((r==null?void 0:r(_))??!1)||!!((w=_.children)!=null&&w.length)&&n(_.children)}))&&(d[s.label]=!0);return l.some(s=>{var f;return((r==null?void 0:r(s))??!1)||!!((f=s.children)!=null&&f.length)&&n(s.children)})};n(o),Y(l=>({...l,...d}))},[o,r,b]);const Se=d=>Y(n=>({...n,[d]:!n[d]})),pe=x.useMemo(()=>i.combineClassNames(e.wrapper,K,e[y],e[m],S&&e[`shadow${A.capitalize(S)}`],v&&e[`round${A.capitalize(v)}`],C&&e.outline,J&&e.glass),[e,K,y,m,C,J,v,S]),Z=(d,n=!1)=>a.jsx("ul",{className:i.combineClassNames(e.list,ne,n&&e.childList,n&&ie),"data-testid":`${t}-list`,children:d.map((l,$)=>{const{label:s,href:f,target:_,rel:w,children:h,icon:j,"aria-label":V,"aria-description":W,"aria-disabled":I}=l,qe=`${s}-${$}`,g=(r==null?void 0:r(l))??!1,B=(b==null?void 0:b(l))??!!(h!=null&&h.some(G=>{var M;return((r==null?void 0:r(G))??!1)||((M=G.children)==null?void 0:M.length)&&((b==null?void 0:b(G))??!1)})),u=!!je[s],E=ye(s),L=`${E}-button`,k=`${E}-panel`,ve=w??(_==="_blank"?"noopener noreferrer":void 0);return a.jsx("li",{className:i.combineClassNames(e.item,oe),"data-testid":`${t}-listItem`,children:h&&h.length>0?a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",id:L,className:i.combineClassNames(e.link,D,de,(g||u||B)&&e.active,(g||u||B)&&z),onClick:()=>Se(s),"aria-expanded":u,"aria-controls":k,"aria-label":(H==null?void 0:H(l,u))??V,"aria-description":(P==null?void 0:P(l,u))??W,"aria-disabled":I?!0:void 0,"data-testid":`${t}-expandItemButton`,children:[j&&a.jsx("span",{className:i.combineClassNames(e.icon,R),children:j}),a.jsx("span",{className:te,"data-testid":`${t}-expandItemLabel`,children:s}),a.jsx(Ie.ChevronDownIcon,{className:i.combineClassNames(e.chevron,le,u&&e.chevronOpen,u&&ce),"aria-hidden":"true",focusable:!1,"data-testid":`${t}-expandIcon`})]}),a.jsx("div",{id:k,className:i.combineClassNames(e.submenu,be,u&&e.submenuOpen,u&&ue),role:"group","aria-labelledby":L,hidden:!u,"data-testid":`${t}-subMenu`,children:Z(h,!0)})]}):f&&!I?a.jsxs(c,{href:f,target:_,rel:ve,className:i.combineClassNames(e.link,D,n&&e.childLink,n&&Q,g&&e.active,g&&z),"aria-current":g?"page":void 0,"aria-label":V,"aria-description":W,"aria-disabled":I?!0:void 0,"data-testid":`${t}-sidebarLink`,children:[j&&a.jsx("span",{className:i.combineClassNames(e.icon,R),children:j}),s]}):a.jsxs("span",{className:i.combineClassNames(e.link,D,n&&e.childLink,n&&Q,g&&e.active,g&&z),"aria-label":V,"aria-description":W,"aria-disabled":I?!0:void 0,"data-testid":`${t}-sidebarLabel`,children:[j&&a.jsx("span",{className:i.combineClassNames(e.icon,R),children:j}),s]})},qe)})});return a.jsxs("nav",{className:pe,"aria-label":U?void 0:Ne,"aria-labelledby":U,"aria-describedby":ge,"data-testid":t,...we,children:[a.jsx("div",{className:i.combineClassNames(e.nav,se),children:Z(o)}),N&&a.jsxs("footer",{className:i.combineClassNames(e.footer,me),"aria-label":X?void 0:$e,"aria-labelledby":X,"data-testid":`${t}-footer`,children:[p==null?void 0:p.map(({label:d,href:n,target:l,rel:$,icon:s,"aria-label":f,"aria-description":_,"aria-disabled":w},h)=>a.jsxs(c,{href:n,target:l,rel:$??(l==="_blank"?"noopener noreferrer":void 0),className:i.combineClassNames(e.footerLink,fe),"aria-label":f,"aria-description":_,"aria-disabled":w?!0:void 0,"data-testid":`${t}-footerLink`,children:[s&&a.jsx("span",{className:i.combineClassNames(e.icon,R),children:s}),d]},`${d}-${h}`)),T&&a.jsx("span",{className:i.combineClassNames(e.footerVersion,_e),"data-testid":`${t}-footerVersion`,children:T})]})]})};ee.displayName="SidebarBase";const O=o=>o.endsWith("/")&&o.length>1?o.slice(0,-1):o,Oe=(o,e)=>{const c=O(o),r=O(e);return c==="/"?r==="/":r===c||r.startsWith(`${c}/`)},re=(o,e)=>{var c;return e(o)?!0:!!((c=o.children)!=null&&c.some(r=>re(r,e)))},De={wrapper:"sidebar",nav:"sidebar_nav",list:"sidebar_list",childList:"sidebar_child_list",item:"sidebar_item",link:"sidebar_link",childLink:"sidebar_child_link",active:"sidebar_active",icon:"sidebar_icon",footer:"sidebar_footer",footerLink:"sidebar_footer_link",footerVersion:"sidebar_footer_version",chevron:"sidebar_chevron",chevronOpen:"sidebar_chevron_open",submenu:"sidebar_submenu",submenuOpen:"sidebar_submenu_open",outline:"sidebar_outline",glass:"sidebar_glass",primary:"sidebar_primary",secondary:"sidebar_secondary",tertiary:"sidebar_tertiary",quaternary:"sidebar_quaternary",success:"sidebar_success",error:"sidebar_error",warning:"sidebar_warning",clear:"sidebar_clear",shadowNone:"sidebar_shadow-None",shadowLight:"sidebar_shadow-Light",shadowMedium:"sidebar_shadow-Medium",shadowStrong:"sidebar_shadow-Strong",shadowIntense:"sidebar_shadow-Intense",roundNone:"sidebar_round-None",roundSmall:"sidebar_round-Small",roundMedium:"sidebar_round-Medium",roundLarge:"sidebar_round-Large"},ze=()=>typeof window<"u"&&window.location.pathname||"/",ae=({isLinkActive:o,hasActiveChild:e,...c})=>{const[r]=x.useState(ze),y=o??(m=>{var N;return m.href?(N=m.children)!=null&&N.length?Oe(m.href,r):O(m.href)===O(r):!1}),S=e??(m=>{var N;return!!((N=m.children)!=null&&N.some(p=>re(p,y)))});return a.jsx(ee,{...c,classMap:Re.expandClassMap(De),isLinkActive:y,hasActiveChild:S})};ae.displayName="Sidebar";exports.Sidebar=ae;
|
package/dist/core/Sidebar.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Sidebar-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Sidebar-DtZeE-tR.cjs");exports.default=e.Sidebar;
|
package/dist/core/Sidebar.js
CHANGED