@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,150 +1,154 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { ItemLink as e } from "../shared/ItemLink.js";
|
|
2
|
+
import t from "./Sidebar.module.css.js";
|
|
3
|
+
import { forwardRef as n, useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
|
|
4
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
|
+
import { createPortal as l } from "react-dom";
|
|
5
6
|
//#region src/components/Sidebar/Sidebar.tsx
|
|
6
|
-
var
|
|
7
|
+
var u = "a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", d = () => /* @__PURE__ */ s("svg", {
|
|
7
8
|
width: "16",
|
|
8
9
|
height: "16",
|
|
9
10
|
viewBox: "0 0 16 16",
|
|
10
11
|
fill: "none",
|
|
11
12
|
"aria-hidden": "true",
|
|
12
|
-
children: /* @__PURE__ */
|
|
13
|
+
children: /* @__PURE__ */ s("path", {
|
|
13
14
|
d: "M10 4L6 8L10 12",
|
|
14
15
|
stroke: "currentColor",
|
|
15
16
|
strokeWidth: "1.5",
|
|
16
17
|
strokeLinecap: "round",
|
|
17
18
|
strokeLinejoin: "round"
|
|
18
19
|
})
|
|
19
|
-
}),
|
|
20
|
+
}), f = () => /* @__PURE__ */ s("svg", {
|
|
20
21
|
width: "16",
|
|
21
22
|
height: "16",
|
|
22
23
|
viewBox: "0 0 16 16",
|
|
23
24
|
fill: "none",
|
|
24
25
|
"aria-hidden": "true",
|
|
25
|
-
children: /* @__PURE__ */
|
|
26
|
+
children: /* @__PURE__ */ s("path", {
|
|
26
27
|
d: "M6 4L10 8L6 12",
|
|
27
28
|
stroke: "currentColor",
|
|
28
29
|
strokeWidth: "1.5",
|
|
29
30
|
strokeLinecap: "round",
|
|
30
31
|
strokeLinejoin: "round"
|
|
31
32
|
})
|
|
32
|
-
}),
|
|
33
|
+
}), p = () => /* @__PURE__ */ s("svg", {
|
|
33
34
|
width: "20",
|
|
34
35
|
height: "20",
|
|
35
36
|
viewBox: "0 0 20 20",
|
|
36
37
|
fill: "currentColor",
|
|
37
38
|
"aria-hidden": "true",
|
|
38
|
-
children: /* @__PURE__ */
|
|
39
|
-
}),
|
|
40
|
-
let [
|
|
41
|
-
|
|
42
|
-
if (window.matchMedia?.("(max-width: 767px)")?.matches ?? !1) return
|
|
39
|
+
children: /* @__PURE__ */ s("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" })
|
|
40
|
+
}), m = n(({ items: n, logo: m, header: h, footer: g, "aria-label": _ = "Sidebar navigation", linkComponent: v, defaultCollapsed: y = !1, isCollapsed: b, onCollapsedChange: x, defaultMobileOpen: S = !1, isMobileOpen: C, onMobileOpenChange: w, className: T }, E) => {
|
|
41
|
+
let [D, O] = o(y), k = b ?? D, [A, j] = o(S), M = C ?? A, [N] = o(() => typeof document < "u"), P = a(null), F = a(null);
|
|
42
|
+
i(() => {
|
|
43
|
+
if (window.matchMedia?.("(max-width: 767px)")?.matches ?? !1) return M ? (F.current = document.activeElement, document.body.style.overflow = "hidden", (P.current?.querySelector(u))?.focus()) : (document.body.style.overflow = "", F.current?.focus(), F.current = null), () => {
|
|
43
44
|
document.body.style.overflow = "";
|
|
44
45
|
};
|
|
45
|
-
}, [
|
|
46
|
-
let
|
|
47
|
-
let e = !
|
|
48
|
-
|
|
46
|
+
}, [M]);
|
|
47
|
+
let I = r(() => {
|
|
48
|
+
let e = !k;
|
|
49
|
+
b === void 0 && O(e), x?.(e);
|
|
49
50
|
}, [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
]),
|
|
54
|
-
|
|
55
|
-
}, [
|
|
56
|
-
e.key === "Escape" &&
|
|
57
|
-
}, [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
k,
|
|
52
|
+
b,
|
|
53
|
+
x
|
|
54
|
+
]), L = r(() => {
|
|
55
|
+
C === void 0 && j(!1), w?.(!1);
|
|
56
|
+
}, [C, w]), R = r((e) => {
|
|
57
|
+
e.key === "Escape" && L();
|
|
58
|
+
}, [L]), z = [
|
|
59
|
+
t.sidebar,
|
|
60
|
+
k ? t.collapsed : "",
|
|
61
|
+
M ? t.mobileOpen : "",
|
|
62
|
+
T ?? ""
|
|
62
63
|
].filter(Boolean).join(" ");
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
-
ref:
|
|
65
|
-
className:
|
|
66
|
-
children: [
|
|
67
|
-
className:
|
|
68
|
-
onClick:
|
|
64
|
+
return /* @__PURE__ */ c("aside", {
|
|
65
|
+
ref: E,
|
|
66
|
+
className: z,
|
|
67
|
+
children: [N && M && l(/* @__PURE__ */ s("div", {
|
|
68
|
+
className: t.backdrop,
|
|
69
|
+
onClick: L,
|
|
69
70
|
"aria-hidden": "true"
|
|
70
|
-
}), document.body), /* @__PURE__ */
|
|
71
|
-
ref:
|
|
72
|
-
className:
|
|
73
|
-
onKeyDown:
|
|
71
|
+
}), document.body), /* @__PURE__ */ c("div", {
|
|
72
|
+
ref: P,
|
|
73
|
+
className: t.panel,
|
|
74
|
+
onKeyDown: R,
|
|
74
75
|
tabIndex: -1,
|
|
75
76
|
children: [
|
|
76
|
-
(
|
|
77
|
-
className:
|
|
78
|
-
children: [/* @__PURE__ */
|
|
79
|
-
className:
|
|
80
|
-
children: [
|
|
81
|
-
className:
|
|
82
|
-
children: p
|
|
83
|
-
}), m && /* @__PURE__ */ o("div", {
|
|
84
|
-
className: e.headerContent,
|
|
77
|
+
(m || h) && /* @__PURE__ */ c("div", {
|
|
78
|
+
className: t.panelTop,
|
|
79
|
+
children: [/* @__PURE__ */ c("div", {
|
|
80
|
+
className: t.logoRow,
|
|
81
|
+
children: [m && /* @__PURE__ */ s("div", {
|
|
82
|
+
className: t.logoSlot,
|
|
85
83
|
children: m
|
|
84
|
+
}), h && /* @__PURE__ */ s("div", {
|
|
85
|
+
className: t.headerContent,
|
|
86
|
+
children: h
|
|
86
87
|
})]
|
|
87
|
-
}), /* @__PURE__ */
|
|
88
|
+
}), /* @__PURE__ */ s("button", {
|
|
88
89
|
type: "button",
|
|
89
|
-
className:
|
|
90
|
-
onClick:
|
|
90
|
+
className: t.mobileCloseButton,
|
|
91
|
+
onClick: L,
|
|
91
92
|
"aria-label": "Close sidebar",
|
|
92
|
-
children: /* @__PURE__ */
|
|
93
|
+
children: /* @__PURE__ */ s(p, {})
|
|
93
94
|
})]
|
|
94
95
|
}),
|
|
95
|
-
!
|
|
96
|
-
className:
|
|
97
|
-
children: /* @__PURE__ */
|
|
96
|
+
!m && !h && /* @__PURE__ */ s("div", {
|
|
97
|
+
className: t.mobileCloseRow,
|
|
98
|
+
children: /* @__PURE__ */ s("button", {
|
|
98
99
|
type: "button",
|
|
99
|
-
className:
|
|
100
|
-
onClick:
|
|
100
|
+
className: t.mobileCloseButton,
|
|
101
|
+
onClick: L,
|
|
101
102
|
"aria-label": "Close sidebar",
|
|
102
|
-
children: /* @__PURE__ */
|
|
103
|
+
children: /* @__PURE__ */ s(p, {})
|
|
103
104
|
})
|
|
104
105
|
}),
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
"aria-label":
|
|
107
|
-
className:
|
|
108
|
-
children: /* @__PURE__ */
|
|
109
|
-
className:
|
|
106
|
+
/* @__PURE__ */ s("nav", {
|
|
107
|
+
"aria-label": _,
|
|
108
|
+
className: t.nav,
|
|
109
|
+
children: /* @__PURE__ */ s("ul", {
|
|
110
|
+
className: t.navList,
|
|
110
111
|
tabIndex: 0,
|
|
111
|
-
children:
|
|
112
|
-
className:
|
|
113
|
-
children: /* @__PURE__ */
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
112
|
+
children: n.map((n) => /* @__PURE__ */ s("li", {
|
|
113
|
+
className: t.navItem,
|
|
114
|
+
children: /* @__PURE__ */ c(e, {
|
|
115
|
+
linkComponent: v,
|
|
116
|
+
href: n.href,
|
|
117
|
+
onClick: () => {
|
|
118
|
+
n.onClick?.(), M && L();
|
|
119
|
+
},
|
|
120
|
+
className: [t.navLink, n.isActive ? t.navLinkActive : ""].filter(Boolean).join(" "),
|
|
121
|
+
"aria-current": n.isActive ? "page" : void 0,
|
|
122
|
+
"aria-label": n.icon && k ? n.label : void 0,
|
|
123
|
+
title: n.icon && k ? n.label : void 0,
|
|
124
|
+
children: [n.icon && /* @__PURE__ */ s("span", {
|
|
125
|
+
className: t.navLinkIcon,
|
|
122
126
|
"aria-hidden": "true",
|
|
123
|
-
children:
|
|
124
|
-
}), /* @__PURE__ */
|
|
125
|
-
className:
|
|
126
|
-
children:
|
|
127
|
+
children: n.icon
|
|
128
|
+
}), /* @__PURE__ */ s("span", {
|
|
129
|
+
className: t.navLinkLabel,
|
|
130
|
+
children: n.label
|
|
127
131
|
})]
|
|
128
132
|
})
|
|
129
|
-
},
|
|
133
|
+
}, n.key))
|
|
130
134
|
})
|
|
131
135
|
}),
|
|
132
|
-
|
|
133
|
-
className:
|
|
134
|
-
children:
|
|
136
|
+
g && /* @__PURE__ */ s("div", {
|
|
137
|
+
className: t.footer,
|
|
138
|
+
children: g
|
|
135
139
|
}),
|
|
136
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ s("button", {
|
|
137
141
|
type: "button",
|
|
138
|
-
className:
|
|
139
|
-
onClick:
|
|
140
|
-
"aria-label":
|
|
141
|
-
"aria-expanded": !
|
|
142
|
-
children:
|
|
142
|
+
className: t.collapseButton,
|
|
143
|
+
onClick: I,
|
|
144
|
+
"aria-label": k ? "Expand sidebar" : "Collapse sidebar",
|
|
145
|
+
"aria-expanded": !k,
|
|
146
|
+
children: s(k ? f : d, {})
|
|
143
147
|
})
|
|
144
148
|
]
|
|
145
149
|
})]
|
|
146
150
|
});
|
|
147
151
|
});
|
|
148
|
-
|
|
152
|
+
m.displayName = "Sidebar";
|
|
149
153
|
//#endregion
|
|
150
|
-
export {
|
|
154
|
+
export { m as Sidebar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("react/jsx-runtime");function t({linkComponent:t,href:n,...r}){return t&&n?(0,e.jsx)(t,{href:n,...r}):(0,e.jsx)(`a`,{href:n,...r})}exports.ItemLink=t;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LinkComponent, LinkComponentProps } from './LinkComponent';
|
|
2
|
+
export interface ItemLinkProps extends Omit<LinkComponentProps, 'href'> {
|
|
3
|
+
href?: string;
|
|
4
|
+
linkComponent?: LinkComponent;
|
|
5
|
+
}
|
|
6
|
+
/** Renders a navigation item's link through `linkComponent` when it has an `href`, otherwise as a plain `<a>`. */
|
|
7
|
+
export declare function ItemLink({ linkComponent: Link, href, ...rest }: ItemLinkProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AriaAttributes, ComponentType, MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
/** Props a navigation component passes to a consumer-supplied link component. */
|
|
3
|
+
export interface LinkComponentProps {
|
|
4
|
+
href: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
onClick?: MouseEventHandler<HTMLAnchorElement>;
|
|
8
|
+
'aria-current'?: AriaAttributes['aria-current'];
|
|
9
|
+
'aria-label'?: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A link component, typically a thin adapter over the router's own (`<Link to={href} … />`), that a
|
|
14
|
+
* navigation component renders for items with an `href` instead of a plain `<a>`.
|
|
15
|
+
*/
|
|
16
|
+
export type LinkComponent = ComponentType<LinkComponentProps>;
|