@aseguragonzalez/ui 1.0.5 → 1.2.0
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/AppShell/AppShell.cjs +1 -1
- package/dist/components/AppShell/AppShell.d.ts +5 -0
- package/dist/components/AppShell/AppShell.js +18 -9
- package/dist/components/AppShell/AppShell.module.css.cjs +1 -1
- package/dist/components/AppShell/AppShell.module.css.js +6 -3
- package/dist/components/Breadcrumb/Breadcrumb.cjs +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +6 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +22 -20
- package/dist/components/Navbar/Navbar.cjs +1 -1
- package/dist/components/Navbar/Navbar.d.ts +6 -0
- package/dist/components/Navbar/Navbar.js +70 -67
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.d.ts +6 -0
- package/dist/components/Sidebar/Sidebar.js +95 -91
- package/dist/components/shared/ItemLink.cjs +1 -0
- package/dist/components/shared/ItemLink.d.ts +7 -0
- package/dist/components/shared/ItemLink.js +10 -0
- package/dist/components/shared/LinkComponent.d.ts +16 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/patterns/AuthLayout/AuthLayout.cjs +1 -1
- package/dist/patterns/AuthLayout/AuthLayout.d.ts +6 -1
- package/dist/patterns/AuthLayout/AuthLayout.js +38 -31
- package/dist/patterns/AuthLayout/AuthLayout.module.css.cjs +1 -1
- package/dist/patterns/AuthLayout/AuthLayout.module.css.js +5 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./AppShell.module.css.cjs");let t=require("react"),n=require("react/jsx-runtime");var r={"sidebar-only":e.default.sidebarOnly,"navbar-only":e.default.navbarOnly,both:e.default.both},i=(0,t.forwardRef)(({variant:t,sidebar:i,navbar:a,
|
|
1
|
+
const e=require("./AppShell.module.css.cjs");let t=require("react"),n=require("react/jsx-runtime");var r={"sidebar-only":e.default.sidebarOnly,"navbar-only":e.default.navbarOnly,both:e.default.both},i=(0,t.forwardRef)(({variant:t,sidebar:i,navbar:a,footer:o,children:s,className:c,...l},u)=>{let d=t??(i&&a?`both`:i?`sidebar-only`:`navbar-only`),f=[e.default.shell,r[d],c??``].filter(Boolean).join(` `);return(0,n.jsxs)(`div`,{ref:u,className:f,...l,children:[i&&(0,n.jsx)(`div`,{className:e.default.sidebarSlot,children:i}),a&&(0,n.jsx)(`div`,{className:e.default.navbarSlot,children:a}),o?(0,n.jsxs)(`div`,{className:[e.default.mainArea,e.default.withFooter].join(` `),children:[(0,n.jsx)(`main`,{className:e.default.main,children:s}),(0,n.jsx)(`footer`,{className:e.default.footer,children:o})]}):(0,n.jsx)(`main`,{className:e.default.mainArea,children:s})]})});i.displayName=`AppShell`,exports.AppShell=i;
|
|
@@ -12,6 +12,11 @@ export interface AppShellProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
12
12
|
navbar?: ReactNode;
|
|
13
13
|
/** Main page content. Rendered inside a `<main>` element. */
|
|
14
14
|
children: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Page footer. Rendered in a `<footer>` after `<main>`, not inside it, so it is exposed as the
|
|
17
|
+
* `contentinfo` landmark. It scrolls with the main content and sits at the bottom when the content is short.
|
|
18
|
+
*/
|
|
19
|
+
footer?: ReactNode;
|
|
15
20
|
}
|
|
16
21
|
declare const AppShell: import("react").ForwardRefExoticComponent<AppShellProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
22
|
export { AppShell };
|
|
@@ -6,16 +6,16 @@ var i = {
|
|
|
6
6
|
"sidebar-only": e.sidebarOnly,
|
|
7
7
|
"navbar-only": e.navbarOnly,
|
|
8
8
|
both: e.both
|
|
9
|
-
}, a = t(({ variant: t, sidebar: a, navbar: o,
|
|
10
|
-
let
|
|
9
|
+
}, a = t(({ variant: t, sidebar: a, navbar: o, footer: s, children: c, className: l, ...u }, d) => {
|
|
10
|
+
let f = t ?? (a && o ? "both" : a ? "sidebar-only" : "navbar-only"), p = [
|
|
11
11
|
e.shell,
|
|
12
|
-
i[
|
|
13
|
-
|
|
12
|
+
i[f],
|
|
13
|
+
l ?? ""
|
|
14
14
|
].filter(Boolean).join(" ");
|
|
15
15
|
return /* @__PURE__ */ r("div", {
|
|
16
|
-
ref:
|
|
17
|
-
className:
|
|
18
|
-
...
|
|
16
|
+
ref: d,
|
|
17
|
+
className: p,
|
|
18
|
+
...u,
|
|
19
19
|
children: [
|
|
20
20
|
a && /* @__PURE__ */ n("div", {
|
|
21
21
|
className: e.sidebarSlot,
|
|
@@ -25,9 +25,18 @@ var i = {
|
|
|
25
25
|
className: e.navbarSlot,
|
|
26
26
|
children: o
|
|
27
27
|
}),
|
|
28
|
-
/* @__PURE__ */
|
|
28
|
+
s ? /* @__PURE__ */ r("div", {
|
|
29
|
+
className: [e.mainArea, e.withFooter].join(" "),
|
|
30
|
+
children: [/* @__PURE__ */ n("main", {
|
|
31
|
+
className: e.main,
|
|
32
|
+
children: c
|
|
33
|
+
}), /* @__PURE__ */ n("footer", {
|
|
34
|
+
className: e.footer,
|
|
35
|
+
children: s
|
|
36
|
+
})]
|
|
37
|
+
}) : /* @__PURE__ */ n("main", {
|
|
29
38
|
className: e.mainArea,
|
|
30
|
-
children:
|
|
39
|
+
children: c
|
|
31
40
|
})
|
|
32
41
|
]
|
|
33
42
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`
|
|
1
|
+
var e=`_shell_1fhn5_1`,t=`_sidebarOnly_1fhn5_9`,n=`_mainArea_1fhn5_13`,r=`_navbarOnly_1fhn5_19`,i=`_navbarSlot_1fhn5_23`,a=`_both_1fhn5_33`,o=`_sidebarSlot_1fhn5_38`,s=`_withFooter_1fhn5_70`,c=`_main_1fhn5_13`,l=`_footer_1fhn5_79`,u={shell:e,sidebarOnly:t,mainArea:n,navbarOnly:r,navbarSlot:i,both:a,sidebarSlot:o,withFooter:s,main:c,footer:l};exports.both=a,exports.default=u,exports.footer=l,exports.main=c,exports.mainArea=n,exports.navbarOnly=r,exports.navbarSlot=i,exports.shell=e,exports.sidebarOnly=t,exports.sidebarSlot=o,exports.withFooter=s;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
//#region src/components/AppShell/AppShell.module.css
|
|
2
|
-
var e = "
|
|
2
|
+
var e = "_shell_1fhn5_1", t = "_sidebarOnly_1fhn5_9", n = "_mainArea_1fhn5_13", r = "_navbarOnly_1fhn5_19", i = "_navbarSlot_1fhn5_23", a = "_both_1fhn5_33", o = "_sidebarSlot_1fhn5_38", s = "_withFooter_1fhn5_70", c = "_main_1fhn5_13", l = "_footer_1fhn5_79", u = {
|
|
3
3
|
shell: e,
|
|
4
4
|
sidebarOnly: t,
|
|
5
5
|
mainArea: n,
|
|
6
6
|
navbarOnly: r,
|
|
7
7
|
navbarSlot: i,
|
|
8
8
|
both: a,
|
|
9
|
-
sidebarSlot: o
|
|
9
|
+
sidebarSlot: o,
|
|
10
|
+
withFooter: s,
|
|
11
|
+
main: c,
|
|
12
|
+
footer: l
|
|
10
13
|
};
|
|
11
14
|
//#endregion
|
|
12
|
-
export { a as both,
|
|
15
|
+
export { a as both, u as default, l as footer, c as main, n as mainArea, r as navbarOnly, i as navbarSlot, e as shell, t as sidebarOnly, o as sidebarSlot, s as withFooter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./Breadcrumb.module.css.cjs");let
|
|
1
|
+
const e=require("./Breadcrumb.module.css.cjs"),t=require("../shared/ItemLink.cjs");let n=require("react"),r=require("react/jsx-runtime");var i=(0,n.forwardRef)(({items:n,"aria-label":i=`Breadcrumb`,linkComponent:a,className:o},s)=>(0,r.jsx)(`nav`,{ref:s,"aria-label":i,className:[e.default.nav,o??``].filter(Boolean).join(` `),children:(0,r.jsx)(`ol`,{className:e.default.list,children:n.map((i,o)=>{let s=o===n.length-1;return(0,r.jsx)(`li`,{className:e.default.item,children:s?(0,r.jsx)(`span`,{className:e.default.current,"aria-current":`page`,children:i.label}):i.href?(0,r.jsx)(t.ItemLink,{linkComponent:a,href:i.href,className:e.default.link,children:i.label}):(0,r.jsx)(`span`,{className:e.default.link,children:i.label})},`${i.label}-${o}`)})})}));i.displayName=`Breadcrumb`,exports.Breadcrumb=i;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LinkComponent } from '../shared/LinkComponent';
|
|
1
2
|
export interface BreadcrumbItem {
|
|
2
3
|
label: string;
|
|
3
4
|
href?: string;
|
|
@@ -5,6 +6,11 @@ export interface BreadcrumbItem {
|
|
|
5
6
|
export interface BreadcrumbProps {
|
|
6
7
|
items: BreadcrumbItem[];
|
|
7
8
|
'aria-label'?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Component rendered for ancestor items with an `href` instead of a plain `<a>`, such as an adapter over the
|
|
11
|
+
* router's link, so navigation happens without a full page load. Defaults to `<a>`.
|
|
12
|
+
*/
|
|
13
|
+
linkComponent?: LinkComponent;
|
|
8
14
|
className?: string;
|
|
9
15
|
}
|
|
10
16
|
declare const Breadcrumb: import("react").ForwardRefExoticComponent<BreadcrumbProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
import e from "./Breadcrumb.module.css.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ItemLink as t } from "../shared/ItemLink.js";
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
5
|
//#region src/components/Breadcrumb/Breadcrumb.tsx
|
|
5
|
-
var
|
|
6
|
-
ref:
|
|
7
|
-
"aria-label":
|
|
8
|
-
className: [e.nav,
|
|
9
|
-
children: /* @__PURE__ */
|
|
6
|
+
var i = n(({ items: n, "aria-label": i = "Breadcrumb", linkComponent: a, className: o }, s) => /* @__PURE__ */ r("nav", {
|
|
7
|
+
ref: s,
|
|
8
|
+
"aria-label": i,
|
|
9
|
+
className: [e.nav, o ?? ""].filter(Boolean).join(" "),
|
|
10
|
+
children: /* @__PURE__ */ r("ol", {
|
|
10
11
|
className: e.list,
|
|
11
|
-
children:
|
|
12
|
-
let
|
|
13
|
-
return /* @__PURE__ */
|
|
12
|
+
children: n.map((i, o) => {
|
|
13
|
+
let s = o === n.length - 1;
|
|
14
|
+
return /* @__PURE__ */ r("li", {
|
|
14
15
|
className: e.item,
|
|
15
|
-
children:
|
|
16
|
+
children: s ? /* @__PURE__ */ r("span", {
|
|
16
17
|
className: e.current,
|
|
17
18
|
"aria-current": "page",
|
|
18
|
-
children:
|
|
19
|
-
}) :
|
|
20
|
-
|
|
19
|
+
children: i.label
|
|
20
|
+
}) : i.href ? /* @__PURE__ */ r(t, {
|
|
21
|
+
linkComponent: a,
|
|
22
|
+
href: i.href,
|
|
21
23
|
className: e.link,
|
|
22
|
-
children:
|
|
23
|
-
}) : /* @__PURE__ */
|
|
24
|
+
children: i.label
|
|
25
|
+
}) : /* @__PURE__ */ r("span", {
|
|
24
26
|
className: e.link,
|
|
25
|
-
children:
|
|
27
|
+
children: i.label
|
|
26
28
|
})
|
|
27
|
-
}, `${
|
|
29
|
+
}, `${i.label}-${o}`);
|
|
28
30
|
})
|
|
29
31
|
})
|
|
30
32
|
}));
|
|
31
|
-
|
|
33
|
+
i.displayName = "Breadcrumb";
|
|
32
34
|
//#endregion
|
|
33
|
-
export {
|
|
35
|
+
export { i as Breadcrumb };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./Navbar.module.css.cjs");let
|
|
1
|
+
const e=require("../shared/ItemLink.cjs"),t=require("./Navbar.module.css.cjs");let n=require("react"),r=require("react/jsx-runtime");var i=()=>(0,r.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,r.jsx)(`path`,{fillRule:`evenodd`,d:`M2 4.75A.75.75 0 0 1 2.75 4h14.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 4.75ZM2 10a.75.75 0 0 1 .75-.75h14.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 10Zm0 5.25a.75.75 0 0 1 .75-.75h14.5a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1-.75-.75Z`,clipRule:`evenodd`})}),a=()=>(0,r.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,r.jsx)(`path`,{d:`M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z`})}),o=(0,n.forwardRef)(({brand:o,items:s=[],actions:c,sticky:l=!1,"aria-label":u=`Main navigation`,linkComponent:d,defaultMobileOpen:f=!1,isMobileOpen:p,onMobileOpenChange:m,className:h},g)=>{let[_,v]=(0,n.useState)(f),y=p??_,b=(0,n.useId)(),x=()=>{let e=!y;p===void 0&&v(e),m?.(e)},S=()=>{p===void 0&&v(!1),m?.(!1)},C=[t.default.navbar,l?t.default.sticky:``,h??``].filter(Boolean).join(` `);return(0,r.jsxs)(`header`,{ref:g,className:C,children:[(0,r.jsxs)(`div`,{className:t.default.inner,children:[o&&(0,r.jsx)(`div`,{className:t.default.brand,children:o}),s.length>0&&(0,r.jsx)(`nav`,{className:t.default.nav,"aria-label":u,children:(0,r.jsx)(`ul`,{className:t.default.navList,children:s.map(n=>(0,r.jsx)(`li`,{className:t.default.navItem,children:(0,r.jsx)(e.ItemLink,{linkComponent:d,href:n.href,onClick:n.onClick,className:[t.default.navLink,n.isActive?t.default.navLinkActive:``].filter(Boolean).join(` `),"aria-current":n.isActive?`page`:void 0,children:n.label})},n.key))})}),c&&(0,r.jsx)(`div`,{className:t.default.actions,children:c}),(0,r.jsx)(`button`,{type:`button`,className:t.default.menuButton,onClick:x,"aria-expanded":y,"aria-controls":b,"aria-label":y?`Close menu`:`Open menu`,children:y?(0,r.jsx)(a,{}):(0,r.jsx)(i,{})})]}),(0,r.jsx)(`div`,{id:b,className:[t.default.mobileMenu,y?t.default.mobileMenuOpen:``].filter(Boolean).join(` `),children:(0,r.jsx)(`nav`,{"aria-label":`${u} — menu`,children:(0,r.jsx)(`ul`,{className:t.default.mobileNavList,children:s.map(n=>(0,r.jsx)(`li`,{className:t.default.mobileNavItem,children:(0,r.jsx)(e.ItemLink,{linkComponent:d,href:n.href,onClick:()=>{n.onClick?.(),S()},className:[t.default.mobileNavLink,n.isActive?t.default.mobileNavLinkActive:``].filter(Boolean).join(` `),"aria-current":n.isActive?`page`:void 0,children:n.label})},n.key))})})})]})});o.displayName=`Navbar`,exports.Navbar=o;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LinkComponent } from '../shared/LinkComponent';
|
|
1
2
|
export interface NavItem {
|
|
2
3
|
key: string;
|
|
3
4
|
label: string;
|
|
@@ -11,6 +12,11 @@ export interface NavbarProps {
|
|
|
11
12
|
actions?: React.ReactNode;
|
|
12
13
|
sticky?: boolean;
|
|
13
14
|
'aria-label'?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Component rendered for items with an `href` instead of a plain `<a>`, such as an adapter over the
|
|
17
|
+
* router's link, so navigation happens without a full page load. Defaults to `<a>`.
|
|
18
|
+
*/
|
|
19
|
+
linkComponent?: LinkComponent;
|
|
14
20
|
defaultMobileOpen?: boolean;
|
|
15
21
|
isMobileOpen?: boolean;
|
|
16
22
|
onMobileOpenChange?: (open: boolean) => void;
|
|
@@ -1,101 +1,104 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { ItemLink as e } from "../shared/ItemLink.js";
|
|
2
|
+
import t from "./Navbar.module.css.js";
|
|
3
|
+
import { forwardRef as n, useId as r, useState as i } from "react";
|
|
4
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
5
|
//#region src/components/Navbar/Navbar.tsx
|
|
5
|
-
var
|
|
6
|
+
var s = () => /* @__PURE__ */ a("svg", {
|
|
6
7
|
width: "20",
|
|
7
8
|
height: "20",
|
|
8
9
|
viewBox: "0 0 20 20",
|
|
9
10
|
fill: "currentColor",
|
|
10
11
|
"aria-hidden": "true",
|
|
11
|
-
children: /* @__PURE__ */
|
|
12
|
+
children: /* @__PURE__ */ a("path", {
|
|
12
13
|
fillRule: "evenodd",
|
|
13
14
|
d: "M2 4.75A.75.75 0 0 1 2.75 4h14.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 4.75ZM2 10a.75.75 0 0 1 .75-.75h14.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 10Zm0 5.25a.75.75 0 0 1 .75-.75h14.5a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1-.75-.75Z",
|
|
14
15
|
clipRule: "evenodd"
|
|
15
16
|
})
|
|
16
|
-
}),
|
|
17
|
+
}), c = () => /* @__PURE__ */ a("svg", {
|
|
17
18
|
width: "20",
|
|
18
19
|
height: "20",
|
|
19
20
|
viewBox: "0 0 20 20",
|
|
20
21
|
fill: "currentColor",
|
|
21
22
|
"aria-hidden": "true",
|
|
22
|
-
children: /* @__PURE__ */
|
|
23
|
-
}),
|
|
24
|
-
let [
|
|
25
|
-
let e = !
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
children: /* @__PURE__ */ a("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" })
|
|
24
|
+
}), l = n(({ brand: n, items: l = [], actions: u, sticky: d = !1, "aria-label": f = "Main navigation", linkComponent: p, defaultMobileOpen: m = !1, isMobileOpen: h, onMobileOpenChange: g, className: _ }, v) => {
|
|
25
|
+
let [y, b] = i(m), x = h ?? y, S = r(), C = () => {
|
|
26
|
+
let e = !x;
|
|
27
|
+
h === void 0 && b(e), g?.(e);
|
|
28
|
+
}, w = () => {
|
|
29
|
+
h === void 0 && b(!1), g?.(!1);
|
|
30
|
+
}, T = [
|
|
31
|
+
t.navbar,
|
|
32
|
+
d ? t.sticky : "",
|
|
33
|
+
_ ?? ""
|
|
33
34
|
].filter(Boolean).join(" ");
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
ref:
|
|
36
|
-
className:
|
|
37
|
-
children: [/* @__PURE__ */
|
|
38
|
-
className:
|
|
35
|
+
return /* @__PURE__ */ o("header", {
|
|
36
|
+
ref: v,
|
|
37
|
+
className: T,
|
|
38
|
+
children: [/* @__PURE__ */ o("div", {
|
|
39
|
+
className: t.inner,
|
|
39
40
|
children: [
|
|
40
|
-
|
|
41
|
-
className:
|
|
42
|
-
children:
|
|
41
|
+
n && /* @__PURE__ */ a("div", {
|
|
42
|
+
className: t.brand,
|
|
43
|
+
children: n
|
|
43
44
|
}),
|
|
44
|
-
|
|
45
|
-
className:
|
|
46
|
-
"aria-label":
|
|
47
|
-
children: /* @__PURE__ */
|
|
48
|
-
className:
|
|
49
|
-
children:
|
|
50
|
-
className:
|
|
51
|
-
children: /* @__PURE__ */
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
l.length > 0 && /* @__PURE__ */ a("nav", {
|
|
46
|
+
className: t.nav,
|
|
47
|
+
"aria-label": f,
|
|
48
|
+
children: /* @__PURE__ */ a("ul", {
|
|
49
|
+
className: t.navList,
|
|
50
|
+
children: l.map((n) => /* @__PURE__ */ a("li", {
|
|
51
|
+
className: t.navItem,
|
|
52
|
+
children: /* @__PURE__ */ a(e, {
|
|
53
|
+
linkComponent: p,
|
|
54
|
+
href: n.href,
|
|
55
|
+
onClick: n.onClick,
|
|
56
|
+
className: [t.navLink, n.isActive ? t.navLinkActive : ""].filter(Boolean).join(" "),
|
|
57
|
+
"aria-current": n.isActive ? "page" : void 0,
|
|
58
|
+
children: n.label
|
|
57
59
|
})
|
|
58
|
-
},
|
|
60
|
+
}, n.key))
|
|
59
61
|
})
|
|
60
62
|
}),
|
|
61
|
-
|
|
62
|
-
className:
|
|
63
|
-
children:
|
|
63
|
+
u && /* @__PURE__ */ a("div", {
|
|
64
|
+
className: t.actions,
|
|
65
|
+
children: u
|
|
64
66
|
}),
|
|
65
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ a("button", {
|
|
66
68
|
type: "button",
|
|
67
|
-
className:
|
|
68
|
-
onClick:
|
|
69
|
-
"aria-expanded":
|
|
70
|
-
"aria-controls":
|
|
71
|
-
"aria-label":
|
|
72
|
-
children:
|
|
69
|
+
className: t.menuButton,
|
|
70
|
+
onClick: C,
|
|
71
|
+
"aria-expanded": x,
|
|
72
|
+
"aria-controls": S,
|
|
73
|
+
"aria-label": x ? "Close menu" : "Open menu",
|
|
74
|
+
children: a(x ? c : s, {})
|
|
73
75
|
})
|
|
74
76
|
]
|
|
75
|
-
}), /* @__PURE__ */
|
|
76
|
-
id:
|
|
77
|
-
className: [
|
|
78
|
-
children: /* @__PURE__ */
|
|
79
|
-
"aria-label": `${
|
|
80
|
-
children: /* @__PURE__ */
|
|
81
|
-
className:
|
|
82
|
-
children:
|
|
83
|
-
className:
|
|
84
|
-
children: /* @__PURE__ */
|
|
85
|
-
|
|
77
|
+
}), /* @__PURE__ */ a("div", {
|
|
78
|
+
id: S,
|
|
79
|
+
className: [t.mobileMenu, x ? t.mobileMenuOpen : ""].filter(Boolean).join(" "),
|
|
80
|
+
children: /* @__PURE__ */ a("nav", {
|
|
81
|
+
"aria-label": `${f} — menu`,
|
|
82
|
+
children: /* @__PURE__ */ a("ul", {
|
|
83
|
+
className: t.mobileNavList,
|
|
84
|
+
children: l.map((n) => /* @__PURE__ */ a("li", {
|
|
85
|
+
className: t.mobileNavItem,
|
|
86
|
+
children: /* @__PURE__ */ a(e, {
|
|
87
|
+
linkComponent: p,
|
|
88
|
+
href: n.href,
|
|
86
89
|
onClick: () => {
|
|
87
|
-
|
|
90
|
+
n.onClick?.(), w();
|
|
88
91
|
},
|
|
89
|
-
className: [
|
|
90
|
-
"aria-current":
|
|
91
|
-
children:
|
|
92
|
+
className: [t.mobileNavLink, n.isActive ? t.mobileNavLinkActive : ""].filter(Boolean).join(" "),
|
|
93
|
+
"aria-current": n.isActive ? "page" : void 0,
|
|
94
|
+
children: n.label
|
|
92
95
|
})
|
|
93
|
-
},
|
|
96
|
+
}, n.key))
|
|
94
97
|
})
|
|
95
98
|
})
|
|
96
99
|
})]
|
|
97
100
|
});
|
|
98
101
|
});
|
|
99
|
-
|
|
102
|
+
l.displayName = "Navbar";
|
|
100
103
|
//#endregion
|
|
101
|
-
export {
|
|
104
|
+
export { l as Navbar };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./Sidebar.module.css.cjs");let
|
|
1
|
+
const e=require("../shared/ItemLink.cjs"),t=require("./Sidebar.module.css.cjs");let n=require("react"),r=require("react/jsx-runtime"),i=require("react-dom");var a=`a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])`,o=()=>(0,r.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,r.jsx)(`path`,{d:`M10 4L6 8L10 12`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}),s=()=>(0,r.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,r.jsx)(`path`,{d:`M6 4L10 8L6 12`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}),c=()=>(0,r.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,r.jsx)(`path`,{d:`M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z`})}),l=(0,n.forwardRef)(({items:l,logo:u,header:d,footer:f,"aria-label":p=`Sidebar navigation`,linkComponent:m,defaultCollapsed:h=!1,isCollapsed:g,onCollapsedChange:_,defaultMobileOpen:v=!1,isMobileOpen:y,onMobileOpenChange:b,className:x},S)=>{let[C,w]=(0,n.useState)(h),T=g??C,[E,D]=(0,n.useState)(v),O=y??E,[k]=(0,n.useState)(()=>typeof document<`u`),A=(0,n.useRef)(null),j=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(window.matchMedia?.(`(max-width: 767px)`)?.matches??!1)return O?(j.current=document.activeElement,document.body.style.overflow=`hidden`,(A.current?.querySelector(a))?.focus()):(document.body.style.overflow=``,j.current?.focus(),j.current=null),()=>{document.body.style.overflow=``}},[O]);let M=(0,n.useCallback)(()=>{let e=!T;g===void 0&&w(e),_?.(e)},[T,g,_]),N=(0,n.useCallback)(()=>{y===void 0&&D(!1),b?.(!1)},[y,b]),P=(0,n.useCallback)(e=>{e.key===`Escape`&&N()},[N]),F=[t.default.sidebar,T?t.default.collapsed:``,O?t.default.mobileOpen:``,x??``].filter(Boolean).join(` `);return(0,r.jsxs)(`aside`,{ref:S,className:F,children:[k&&O&&(0,i.createPortal)((0,r.jsx)(`div`,{className:t.default.backdrop,onClick:N,"aria-hidden":`true`}),document.body),(0,r.jsxs)(`div`,{ref:A,className:t.default.panel,onKeyDown:P,tabIndex:-1,children:[(u||d)&&(0,r.jsxs)(`div`,{className:t.default.panelTop,children:[(0,r.jsxs)(`div`,{className:t.default.logoRow,children:[u&&(0,r.jsx)(`div`,{className:t.default.logoSlot,children:u}),d&&(0,r.jsx)(`div`,{className:t.default.headerContent,children:d})]}),(0,r.jsx)(`button`,{type:`button`,className:t.default.mobileCloseButton,onClick:N,"aria-label":`Close sidebar`,children:(0,r.jsx)(c,{})})]}),!u&&!d&&(0,r.jsx)(`div`,{className:t.default.mobileCloseRow,children:(0,r.jsx)(`button`,{type:`button`,className:t.default.mobileCloseButton,onClick:N,"aria-label":`Close sidebar`,children:(0,r.jsx)(c,{})})}),(0,r.jsx)(`nav`,{"aria-label":p,className:t.default.nav,children:(0,r.jsx)(`ul`,{className:t.default.navList,tabIndex:0,children:l.map(n=>(0,r.jsx)(`li`,{className:t.default.navItem,children:(0,r.jsxs)(e.ItemLink,{linkComponent:m,href:n.href,onClick:()=>{n.onClick?.(),O&&N()},className:[t.default.navLink,n.isActive?t.default.navLinkActive:``].filter(Boolean).join(` `),"aria-current":n.isActive?`page`:void 0,"aria-label":n.icon&&T?n.label:void 0,title:n.icon&&T?n.label:void 0,children:[n.icon&&(0,r.jsx)(`span`,{className:t.default.navLinkIcon,"aria-hidden":`true`,children:n.icon}),(0,r.jsx)(`span`,{className:t.default.navLinkLabel,children:n.label})]})},n.key))})}),f&&(0,r.jsx)(`div`,{className:t.default.footer,children:f}),(0,r.jsx)(`button`,{type:`button`,className:t.default.collapseButton,onClick:M,"aria-label":T?`Expand sidebar`:`Collapse sidebar`,"aria-expanded":!T,children:T?(0,r.jsx)(s,{}):(0,r.jsx)(o,{})})]})]})});l.displayName=`Sidebar`,exports.Sidebar=l;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LinkComponent } from '../shared/LinkComponent';
|
|
1
2
|
export interface SidebarItem {
|
|
2
3
|
key: string;
|
|
3
4
|
label: string;
|
|
@@ -15,6 +16,11 @@ export interface SidebarProps {
|
|
|
15
16
|
/** Pinned to the bottom of the panel, above the collapse button. */
|
|
16
17
|
footer?: React.ReactNode;
|
|
17
18
|
'aria-label'?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Component rendered for items with an `href` instead of a plain `<a>`, such as an adapter over the
|
|
21
|
+
* router's link, so navigation happens without a full page load. Defaults to `<a>`.
|
|
22
|
+
*/
|
|
23
|
+
linkComponent?: LinkComponent;
|
|
18
24
|
/** Desktop collapse — uncontrolled default */
|
|
19
25
|
defaultCollapsed?: boolean;
|
|
20
26
|
/** Desktop collapse — controlled */
|