@the-portland-company/shell 0.3.5 → 0.5.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/chrome.css +235 -73
- package/dist/index.cjs +8 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -28
- package/dist/index.js.map +1 -1
- package/dist/native.cjs +246 -0
- package/dist/native.cjs.map +1 -0
- package/dist/native.d.cts +106 -0
- package/dist/native.d.ts +106 -0
- package/dist/native.js +240 -0
- package/dist/native.js.map +1 -0
- package/package.json +9 -3
package/dist/native.cjs
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
// src/native/index.tsx
|
|
6
|
+
var DefaultLink = ({ href, children, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx("a", { href, ...rest, children });
|
|
7
|
+
function isNavItemActive(pathname, href) {
|
|
8
|
+
if (href === "/") return pathname === "/";
|
|
9
|
+
return pathname === href || pathname.startsWith(`${href}/`);
|
|
10
|
+
}
|
|
11
|
+
function envChipClasses(label) {
|
|
12
|
+
const l = label.toLowerCase();
|
|
13
|
+
if (l === "production")
|
|
14
|
+
return "bg-[rgba(230,57,70,0.12)] text-[color:var(--color-race-red)]";
|
|
15
|
+
if (l === "staging") return "bg-[rgba(242,201,76,0.18)] text-[#a6791f]";
|
|
16
|
+
return "bg-[rgba(0,166,81,0.14)] text-[color:var(--color-green-flag)]";
|
|
17
|
+
}
|
|
18
|
+
var ORG_PILL_DEFAULT = "#2d2f36";
|
|
19
|
+
function NavSidebar({
|
|
20
|
+
pathname,
|
|
21
|
+
brand,
|
|
22
|
+
nav,
|
|
23
|
+
org,
|
|
24
|
+
mode,
|
|
25
|
+
footer,
|
|
26
|
+
linkComponent
|
|
27
|
+
}) {
|
|
28
|
+
const Link = linkComponent ?? DefaultLink;
|
|
29
|
+
const activeFn = nav.isActive ?? isNavItemActive;
|
|
30
|
+
const ModeIcon = mode?.icon;
|
|
31
|
+
const orgBg = org?.brandColor || ORG_PILL_DEFAULT;
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("aside", { className: "fixed inset-y-0 left-0 z-30 hidden w-[240px] flex-col border-r border-[color:var(--line)] bg-[color:var(--panel-elevated)] lg:flex", children: [
|
|
33
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
34
|
+
Link,
|
|
35
|
+
{
|
|
36
|
+
href: brand.homeHref ?? "/",
|
|
37
|
+
className: "flex h-[64px] flex-shrink-0 items-center gap-2.5 px-6",
|
|
38
|
+
children: brand.logoSrc ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
39
|
+
"img",
|
|
40
|
+
{
|
|
41
|
+
src: brand.logoSrc,
|
|
42
|
+
alt: brand.logoAlt ?? brand.title,
|
|
43
|
+
draggable: false,
|
|
44
|
+
className: "h-10 w-auto object-contain"
|
|
45
|
+
}
|
|
46
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
47
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-9 w-9 items-center justify-center rounded-xl bg-[color:var(--color-race-red)] text-base font-black text-white shadow-sm", children: brand.badgeLabel }),
|
|
48
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col leading-tight", children: [
|
|
49
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base font-extrabold tracking-[-0.01em] text-[color:var(--color-race-red)]", children: brand.title }),
|
|
50
|
+
brand.subtitle ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-semibold uppercase tracking-[0.16em] text-[color:var(--muted)]", children: brand.subtitle }) : null
|
|
51
|
+
] })
|
|
52
|
+
] })
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col overflow-y-auto px-4 pb-2", children: [
|
|
56
|
+
org ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-2 px-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-[color:var(--muted)]", children: "Organization" }),
|
|
58
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
59
|
+
"button",
|
|
60
|
+
{
|
|
61
|
+
type: "button",
|
|
62
|
+
onClick: org.onClick,
|
|
63
|
+
style: { backgroundColor: orgBg },
|
|
64
|
+
className: "flex w-full items-center justify-between gap-2 rounded-md px-2.5 py-2 text-left text-white shadow-sm transition hover:opacity-95",
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-2.5", children: [
|
|
67
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-full bg-white/20 text-[11px] font-bold text-white", children: org.logoUrl ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: org.logoUrl, alt: "", className: "h-full w-full object-cover" }) : (org.name ?? "Org").slice(0, 2).toUpperCase() }),
|
|
68
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-semibold", children: org.name ?? "No organizations" })
|
|
69
|
+
] }),
|
|
70
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChevronDown, {})
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] }) : null,
|
|
75
|
+
mode ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
76
|
+
"button",
|
|
77
|
+
{
|
|
78
|
+
type: "button",
|
|
79
|
+
className: "flex w-full items-center justify-between gap-2 rounded-md bg-[color:var(--color-race-red)] px-2.5 py-2 text-white shadow-sm",
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2.5", children: [
|
|
82
|
+
ModeIcon ? /* @__PURE__ */ jsxRuntime.jsx(ModeIcon, { size: 16, className: "shrink-0" }) : null,
|
|
83
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold tracking-[-0.01em]", children: mode.label })
|
|
84
|
+
] }),
|
|
85
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChevronDown, {})
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
) }) : null,
|
|
89
|
+
/* @__PURE__ */ jsxRuntime.jsxs("nav", { className: "flex flex-col gap-1", children: [
|
|
90
|
+
nav.groupLabel ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 pb-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-[color:var(--muted)]", children: nav.groupLabel }) : null,
|
|
91
|
+
nav.items.map((item) => {
|
|
92
|
+
const active = activeFn(pathname, item.href);
|
|
93
|
+
const Icon = item.icon;
|
|
94
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
95
|
+
Link,
|
|
96
|
+
{
|
|
97
|
+
href: item.href,
|
|
98
|
+
"aria-current": active ? "page" : void 0,
|
|
99
|
+
className: [
|
|
100
|
+
"group flex items-center gap-3 rounded-md px-3 py-2 text-sm font-semibold transition",
|
|
101
|
+
active ? "bg-[color:var(--color-race-red)] text-white shadow-sm" : "text-[color:var(--muted)] hover:bg-[color:var(--panel)] hover:text-[color:var(--foreground)]"
|
|
102
|
+
].join(" "),
|
|
103
|
+
children: [
|
|
104
|
+
Icon ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
105
|
+
Icon,
|
|
106
|
+
{
|
|
107
|
+
size: 18,
|
|
108
|
+
className: active ? "text-white" : "text-current"
|
|
109
|
+
}
|
|
110
|
+
) : null,
|
|
111
|
+
item.label
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
item.href
|
|
115
|
+
);
|
|
116
|
+
})
|
|
117
|
+
] })
|
|
118
|
+
] }),
|
|
119
|
+
footer ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-shrink-0 border-t border-[color:var(--line)] px-4 py-3", children: [
|
|
120
|
+
footer.links && footer.links.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center gap-1.5 text-xs", children: footer.links.map((l, idx) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
121
|
+
idx > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[color:var(--muted)]", children: "|" }) : null,
|
|
122
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
123
|
+
"a",
|
|
124
|
+
{
|
|
125
|
+
href: l.href,
|
|
126
|
+
className: "font-medium text-[color:var(--color-race-red)] hover:underline",
|
|
127
|
+
children: l.label
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] }, l.label)) }) : null,
|
|
131
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1.5 font-[family-name:var(--font-plex-mono)] text-[10px] text-[color:var(--muted)]", children: [
|
|
132
|
+
footer.envLabel,
|
|
133
|
+
" \xB7 v",
|
|
134
|
+
footer.version,
|
|
135
|
+
" \xB7 ",
|
|
136
|
+
footer.commit.slice(0, 7)
|
|
137
|
+
] })
|
|
138
|
+
] }) : null
|
|
139
|
+
] });
|
|
140
|
+
}
|
|
141
|
+
function ChevronDown() {
|
|
142
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
143
|
+
"svg",
|
|
144
|
+
{
|
|
145
|
+
width: 16,
|
|
146
|
+
height: 16,
|
|
147
|
+
viewBox: "0 0 24 24",
|
|
148
|
+
fill: "none",
|
|
149
|
+
stroke: "currentColor",
|
|
150
|
+
strokeWidth: 2,
|
|
151
|
+
strokeLinecap: "round",
|
|
152
|
+
strokeLinejoin: "round",
|
|
153
|
+
className: "shrink-0 opacity-80",
|
|
154
|
+
"aria-hidden": "true",
|
|
155
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 9 6 6 6-6" })
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
function NavTopBar({
|
|
160
|
+
title,
|
|
161
|
+
subtitle,
|
|
162
|
+
user,
|
|
163
|
+
onSignOut,
|
|
164
|
+
actions,
|
|
165
|
+
themeToggle
|
|
166
|
+
}) {
|
|
167
|
+
const initials = (user?.name ?? "Politogy").slice(0, 2).toUpperCase();
|
|
168
|
+
const secondary = user?.email || [user?.tier, user?.role].filter(Boolean).join(" \xB7 ") || "member";
|
|
169
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "sticky top-0 z-20 flex h-20 items-center justify-between gap-4 border-b border-[color:var(--line)] bg-[color:var(--panel)] px-4 backdrop-blur-xl", children: [
|
|
170
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
171
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
172
|
+
"h1",
|
|
173
|
+
{
|
|
174
|
+
className: "truncate text-lg font-bold tracking-[-0.01em] text-[color:var(--foreground)]",
|
|
175
|
+
"data-display": "true",
|
|
176
|
+
children: title
|
|
177
|
+
}
|
|
178
|
+
),
|
|
179
|
+
subtitle ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm text-[color:var(--muted)]", children: subtitle }) : null
|
|
180
|
+
] }),
|
|
181
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
182
|
+
actions,
|
|
183
|
+
themeToggle,
|
|
184
|
+
/* @__PURE__ */ jsxRuntime.jsxs("details", { className: "group relative", children: [
|
|
185
|
+
/* @__PURE__ */ jsxRuntime.jsxs("summary", { className: "flex cursor-pointer list-none items-center gap-2.5 rounded-full py-1 pl-1 pr-2 transition hover:bg-[color:var(--panel-elevated)] [&::-webkit-details-marker]:hidden", children: [
|
|
186
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-9 w-9 items-center justify-center overflow-hidden rounded-full bg-[color:var(--color-race-red)] text-xs font-bold text-white", children: user?.avatarUrl ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: user.avatarUrl, alt: "", className: "h-full w-full object-cover" }) : initials }),
|
|
187
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "hidden flex-col leading-tight md:flex", children: [
|
|
188
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold text-[color:var(--foreground)]", children: user?.name ?? "Signed in" }),
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-[color:var(--muted)]", children: secondary })
|
|
190
|
+
] }),
|
|
191
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChevronDown, {})
|
|
192
|
+
] }),
|
|
193
|
+
onSignOut ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute right-0 z-30 mt-2 w-44 overflow-hidden rounded-xl border border-[color:var(--line)] bg-[color:var(--panel-elevated)] py-1 shadow-[var(--shadow-soft)]", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
194
|
+
"button",
|
|
195
|
+
{
|
|
196
|
+
type: "button",
|
|
197
|
+
onClick: onSignOut,
|
|
198
|
+
className: "flex w-full items-center gap-2.5 px-4 py-2 text-left text-sm font-medium text-[color:var(--foreground)] hover:bg-[color:var(--panel)] hover:text-[color:var(--color-race-red)]",
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ jsxRuntime.jsx(SignOutIcon, {}),
|
|
201
|
+
"Sign out"
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
) }) : null
|
|
205
|
+
] })
|
|
206
|
+
] })
|
|
207
|
+
] });
|
|
208
|
+
}
|
|
209
|
+
function SignOutIcon() {
|
|
210
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
211
|
+
"svg",
|
|
212
|
+
{
|
|
213
|
+
width: 15,
|
|
214
|
+
height: 15,
|
|
215
|
+
viewBox: "0 0 24 24",
|
|
216
|
+
fill: "none",
|
|
217
|
+
stroke: "currentColor",
|
|
218
|
+
strokeWidth: 2,
|
|
219
|
+
strokeLinecap: "round",
|
|
220
|
+
strokeLinejoin: "round",
|
|
221
|
+
"aria-hidden": "true",
|
|
222
|
+
children: [
|
|
223
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
|
|
224
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "16 17 21 12 16 7" }),
|
|
225
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "21", x2: "9", y1: "12", y2: "12" })
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
function NavAppShell({ sidebar, topBar, children }) {
|
|
231
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-h-screen bg-[color:var(--background)] text-[color:var(--foreground)]", children: [
|
|
232
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavSidebar, { ...sidebar }),
|
|
233
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lg:pl-[240px]", children: [
|
|
234
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavTopBar, { ...topBar }),
|
|
235
|
+
/* @__PURE__ */ jsxRuntime.jsx("main", { className: "px-6 py-7", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto max-w-7xl", children }) })
|
|
236
|
+
] })
|
|
237
|
+
] });
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
exports.NavAppShell = NavAppShell;
|
|
241
|
+
exports.NavSidebar = NavSidebar;
|
|
242
|
+
exports.NavTopBar = NavTopBar;
|
|
243
|
+
exports.envChipClasses = envChipClasses;
|
|
244
|
+
exports.isNavItemActive = isNavItemActive;
|
|
245
|
+
//# sourceMappingURL=native.cjs.map
|
|
246
|
+
//# sourceMappingURL=native.cjs.map
|
|
@@ -0,0 +1 @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MACf,aAAA,EAAY,MAAA;AAAA,MAEZ,QAAA,EAAA;AAAA,wBAAAD,cAAA,CAAC,MAAA,EAAA,EAAK,GAAE,yCAAA,EAA0C,CAAA;AAAA,wBAClDA,cAAA,CAAC,UAAA,EAAA,EAAS,MAAA,EAAO,kBAAA,EAAmB,CAAA;AAAA,wBACpCA,cAAA,CAAC,UAAK,EAAA,EAAG,IAAA,EAAK,IAAG,GAAA,EAAI,EAAA,EAAG,IAAA,EAAK,EAAA,EAAG,IAAA,EAAK;AAAA;AAAA;AAAA,GACvC;AAEJ;AAcO,SAAS,WAAA,CAAY,EAAE,OAAA,EAAS,MAAA,EAAQ,UAAS,EAAqB;AAC3E,EAAA,uBACEC,eAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,0EAAA,EACb,QAAA,EAAA;AAAA,oBAAAD,cAAA,CAAC,UAAA,EAAA,EAAY,GAAG,OAAA,EAAS,CAAA;AAAA,oBACzBC,eAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,eAAA,EACb,QAAA,EAAA;AAAA,sBAAAD,cAAA,CAAC,SAAA,EAAA,EAAW,GAAG,MAAA,EAAQ,CAAA;AAAA,sBACvBA,cAAA,CAAC,UAAK,SAAA,EAAU,WAAA,EACd,yCAAC,KAAA,EAAA,EAAI,SAAA,EAAU,mBAAA,EAAqB,QAAA,EAAS,CAAA,EAC/C;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"native.cjs","sourcesContent":["// ---------------------------------------------------------------------------\n// Framework-agnostic chrome (sidebar + top navbar) for @the-portland-company/shell.\n//\n// The other chrome in this package (ShellChrome, Sidebar, Header, …) is built\n// on Chakra UI v2 + react-router and targets Vite SPAs. That stack cannot be\n// imported into a Next.js / React 19 / Tailwind app. This \"native\" module is a\n// dependency-light alternative: pure React (no Chakra, no emotion, no\n// react-router, no icon library) whose styling is driven entirely by the CSS\n// design tokens shipped in `@the-portland-company/shell/chrome.css`.\n//\n// It is a FAITHFUL VISUAL TWIN of the Chakra chrome (Sidebar.tsx / Header.tsx /\n// OrgPill / ModePill / NavItem / UserMenu): same 240px sidebar, brand-logo\n// slot, \"ORGANIZATION\" org pill, mode pill, solid active nav rows, pipe-\n// separated footer links + commit string, and an avatar+name+email+chevron user\n// menu — so an app rendering this looks identical to the main VRM app.\n//\n// Every app concern (nav items, org, mode, user, links, icons, the routing\n// Link component, the theme toggle) is injected via props, so both the Contacts\n// app (Next.js) and the VRM app could consume the same components.\n// ---------------------------------------------------------------------------\n\nimport type { ComponentType, ReactNode } from 'react'\n\n// An icon is any component that accepts an optional size + className. This\n// matches both `lucide-react` and `react-icons` icon signatures, so consuming\n// apps pass their own icon set without this package depending on one.\nexport type NavIcon = ComponentType<{ size?: number; className?: string }>\n\nexport type NavItem = {\n href: string\n label: string\n icon?: NavIcon\n}\n\n// The routing primitive is injected so each app supplies its own (Next.js\n// `<Link>`, react-router `<Link>`, or a plain `<a>`). Defaults to an anchor.\nexport type NavLinkProps = {\n href: string\n className?: string\n 'aria-current'?: 'page' | undefined\n children: ReactNode\n}\nexport type NavLinkComponent = ComponentType<NavLinkProps>\n\nconst DefaultLink: NavLinkComponent = ({ href, children, ...rest }) => (\n <a href={href} {...rest}>\n {children}\n </a>\n)\n\n/** Default active-route test: exact match for \"/\", prefix match otherwise. */\nexport function isNavItemActive(pathname: string, href: string): boolean {\n if (href === '/') return pathname === '/'\n return pathname === href || pathname.startsWith(`${href}/`)\n}\n\n/** Token-driven tone classes for the sidebar environment chip. */\nexport function envChipClasses(label: string): string {\n const l = label.toLowerCase()\n if (l === 'production')\n return 'bg-[rgba(230,57,70,0.12)] text-[color:var(--color-race-red)]'\n if (l === 'staging') return 'bg-[rgba(242,201,76,0.18)] text-[#a6791f]'\n return 'bg-[rgba(0,166,81,0.14)] text-[color:var(--color-green-flag)]'\n}\n\n// ---------------------------------------------------------------------------\n\nexport type NavBrand = {\n /** Where the logo links to. Defaults to \"/\". */\n homeHref?: string\n /**\n * Brand logo image src. When supplied this renders as the wordmark logo\n * (matching the main app's BrandLogo), and `badgeLabel`/`title`/`subtitle`\n * are used only as the no-image fallback.\n */\n logoSrc?: string\n logoAlt?: string\n /** Short label shown inside the brand badge fallback (e.g. \"P\"). */\n badgeLabel: string\n title: string\n subtitle?: string\n}\n\nexport type NavOrg = {\n name: string | null\n /** Optional org logo for the pill badge; falls back to initials. */\n logoUrl?: string | null\n /** Solid pill background (the org's brand color). Defaults to a dark slate. */\n brandColor?: string | null\n onClick?: () => void\n}\n\nexport type NavMode = {\n label: string\n icon?: NavIcon\n}\n\nexport type NavFooterLink = { label: string; href: string; external?: boolean }\n\nexport type NavFooter = {\n envLabel: string\n version: string\n commit: string\n links?: NavFooterLink[]\n}\n\nexport type NavSidebarProps = {\n pathname: string\n brand: NavBrand\n nav: {\n groupLabel?: string\n items: NavItem[]\n isActive?: (pathname: string, href: string) => boolean\n }\n org?: NavOrg | null\n mode?: NavMode | null\n footer?: NavFooter | null\n linkComponent?: NavLinkComponent\n}\n\n// Default org-pill background — a dark slate that mirrors the main app's pill\n// when an org has no explicit brand color.\nconst ORG_PILL_DEFAULT = '#2d2f36'\n\nexport function NavSidebar({\n pathname,\n brand,\n nav,\n org,\n mode,\n footer,\n linkComponent,\n}: NavSidebarProps) {\n const Link = linkComponent ?? DefaultLink\n const activeFn = nav.isActive ?? isNavItemActive\n const ModeIcon = mode?.icon\n const orgBg = org?.brandColor || ORG_PILL_DEFAULT\n\n return (\n <aside className=\"fixed inset-y-0 left-0 z-30 hidden w-[240px] flex-col border-r border-[color:var(--line)] bg-[color:var(--panel-elevated)] lg:flex\">\n {/* Brand — logo image (preferred) or badge fallback */}\n <Link\n href={brand.homeHref ?? '/'}\n className=\"flex h-[64px] flex-shrink-0 items-center gap-2.5 px-6\"\n >\n {brand.logoSrc ? (\n <img\n src={brand.logoSrc}\n alt={brand.logoAlt ?? brand.title}\n draggable={false}\n className=\"h-10 w-auto object-contain\"\n />\n ) : (\n <>\n <span className=\"flex h-9 w-9 items-center justify-center rounded-xl bg-[color:var(--color-race-red)] text-base font-black text-white shadow-sm\">\n {brand.badgeLabel}\n </span>\n <span className=\"flex flex-col leading-tight\">\n <span className=\"text-base font-extrabold tracking-[-0.01em] text-[color:var(--color-race-red)]\">\n {brand.title}\n </span>\n {brand.subtitle ? (\n <span className=\"text-[11px] font-semibold uppercase tracking-[0.16em] text-[color:var(--muted)]\">\n {brand.subtitle}\n </span>\n ) : null}\n </span>\n </>\n )}\n </Link>\n\n {/* Scroll region: org pill, mode pill, nav */}\n <div className=\"flex flex-1 flex-col overflow-y-auto px-4 pb-2\">\n {/* Organization switcher */}\n {org ? (\n <div className=\"mb-3\">\n <p className=\"mb-2 px-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-[color:var(--muted)]\">\n Organization\n </p>\n <button\n type=\"button\"\n onClick={org.onClick}\n style={{ backgroundColor: orgBg }}\n className=\"flex w-full items-center justify-between gap-2 rounded-md px-2.5 py-2 text-left text-white shadow-sm transition hover:opacity-95\"\n >\n <span className=\"flex min-w-0 items-center gap-2.5\">\n <span className=\"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-full bg-white/20 text-[11px] font-bold text-white\">\n {org.logoUrl ? (\n <img src={org.logoUrl} alt=\"\" className=\"h-full w-full object-cover\" />\n ) : (\n (org.name ?? 'Org').slice(0, 2).toUpperCase()\n )}\n </span>\n <span className=\"truncate text-sm font-semibold\">\n {org.name ?? 'No organizations'}\n </span>\n </span>\n <ChevronDown />\n </button>\n </div>\n ) : null}\n\n {/* Mode pill */}\n {mode ? (\n <div className=\"mb-4\">\n <button\n type=\"button\"\n className=\"flex w-full items-center justify-between gap-2 rounded-md bg-[color:var(--color-race-red)] px-2.5 py-2 text-white shadow-sm\"\n >\n <span className=\"flex items-center gap-2.5\">\n {ModeIcon ? <ModeIcon size={16} className=\"shrink-0\" /> : null}\n <span className=\"text-sm font-semibold tracking-[-0.01em]\">{mode.label}</span>\n </span>\n <ChevronDown />\n </button>\n </div>\n ) : null}\n\n {/* Nav list */}\n <nav className=\"flex flex-col gap-1\">\n {nav.groupLabel ? (\n <p className=\"px-2 pb-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-[color:var(--muted)]\">\n {nav.groupLabel}\n </p>\n ) : null}\n {nav.items.map((item) => {\n const active = activeFn(pathname, item.href)\n const Icon = item.icon\n return (\n <Link\n key={item.href}\n href={item.href}\n aria-current={active ? 'page' : undefined}\n className={[\n 'group flex items-center gap-3 rounded-md px-3 py-2 text-sm font-semibold transition',\n active\n ? 'bg-[color:var(--color-race-red)] text-white shadow-sm'\n : 'text-[color:var(--muted)] hover:bg-[color:var(--panel)] hover:text-[color:var(--foreground)]',\n ].join(' ')}\n >\n {Icon ? (\n <Icon\n size={18}\n className={active ? 'text-white' : 'text-current'}\n />\n ) : null}\n {item.label}\n </Link>\n )\n })}\n </nav>\n </div>\n\n {/* Footer — pipe-separated links + commit/version string */}\n {footer ? (\n <div className=\"flex-shrink-0 border-t border-[color:var(--line)] px-4 py-3\">\n {footer.links && footer.links.length > 0 ? (\n <div className=\"flex flex-wrap items-center gap-1.5 text-xs\">\n {footer.links.map((l, idx) => (\n <span key={l.label} className=\"inline-flex items-center gap-1.5\">\n {idx > 0 ? <span className=\"text-[color:var(--muted)]\">|</span> : null}\n <a\n href={l.href}\n className=\"font-medium text-[color:var(--color-race-red)] hover:underline\"\n >\n {l.label}\n </a>\n </span>\n ))}\n </div>\n ) : null}\n <p className=\"mt-1.5 font-[family-name:var(--font-plex-mono)] text-[10px] text-[color:var(--muted)]\">\n {footer.envLabel} · v{footer.version} · {footer.commit.slice(0, 7)}\n </p>\n </div>\n ) : null}\n </aside>\n )\n}\n\n// Inline chevron-down (mirrors lucide `ChevronDown`) — no icon dependency.\nfunction ChevronDown() {\n return (\n <svg\n width={16}\n height={16}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"shrink-0 opacity-80\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n )\n}\n\n// ---------------------------------------------------------------------------\n\nexport type NavUser = {\n name: string | null\n email?: string | null\n /** Avatar image URL; falls back to initials on the brand color. */\n avatarUrl?: string | null\n tier?: string | null\n role?: string | null\n}\n\nexport type NavTopBarProps = {\n title: string\n subtitle?: string\n user?: NavUser | null\n onSignOut?: () => void\n /** App-specific action cluster rendered left of the theme toggle. */\n actions?: ReactNode\n /** Theme toggle slot (injected so this package needs no theme dependency). */\n themeToggle?: ReactNode\n}\n\nexport function NavTopBar({\n title,\n subtitle,\n user,\n onSignOut,\n actions,\n themeToggle,\n}: NavTopBarProps) {\n const initials = (user?.name ?? 'Politogy').slice(0, 2).toUpperCase()\n const secondary = user?.email || [user?.tier, user?.role].filter(Boolean).join(' · ') || 'member'\n return (\n <header className=\"sticky top-0 z-20 flex h-20 items-center justify-between gap-4 border-b border-[color:var(--line)] bg-[color:var(--panel)] px-4 backdrop-blur-xl\">\n <div className=\"min-w-0\">\n <h1\n className=\"truncate text-lg font-bold tracking-[-0.01em] text-[color:var(--foreground)]\"\n data-display=\"true\"\n >\n {title}\n </h1>\n {subtitle ? (\n <p className=\"truncate text-sm text-[color:var(--muted)]\">{subtitle}</p>\n ) : null}\n </div>\n\n <div className=\"flex shrink-0 items-center gap-2\">\n {actions}\n {themeToggle}\n\n {/* User menu — avatar + name/email + chevron; sign-out in a native\n <details> popover so the package needs no JS state. */}\n <details className=\"group relative\">\n <summary className=\"flex cursor-pointer list-none items-center gap-2.5 rounded-full py-1 pl-1 pr-2 transition hover:bg-[color:var(--panel-elevated)] [&::-webkit-details-marker]:hidden\">\n <span className=\"flex h-9 w-9 items-center justify-center overflow-hidden rounded-full bg-[color:var(--color-race-red)] text-xs font-bold text-white\">\n {user?.avatarUrl ? (\n <img src={user.avatarUrl} alt=\"\" className=\"h-full w-full object-cover\" />\n ) : (\n initials\n )}\n </span>\n <span className=\"hidden flex-col leading-tight md:flex\">\n <span className=\"text-sm font-semibold text-[color:var(--foreground)]\">\n {user?.name ?? 'Signed in'}\n </span>\n <span className=\"text-xs text-[color:var(--muted)]\">{secondary}</span>\n </span>\n <ChevronDown />\n </summary>\n {onSignOut ? (\n <div className=\"absolute right-0 z-30 mt-2 w-44 overflow-hidden rounded-xl border border-[color:var(--line)] bg-[color:var(--panel-elevated)] py-1 shadow-[var(--shadow-soft)]\">\n <button\n type=\"button\"\n onClick={onSignOut}\n className=\"flex w-full items-center gap-2.5 px-4 py-2 text-left text-sm font-medium text-[color:var(--foreground)] hover:bg-[color:var(--panel)] hover:text-[color:var(--color-race-red)]\"\n >\n <SignOutIcon />\n Sign out\n </button>\n </div>\n ) : null}\n </details>\n </div>\n </header>\n )\n}\n\n// Inline log-out glyph (mirrors lucide `LogOut`) to avoid an icon dependency.\nfunction SignOutIcon() {\n return (\n <svg\n width={15}\n height={15}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\" />\n <polyline points=\"16 17 21 12 16 7\" />\n <line x1=\"21\" x2=\"9\" y1=\"12\" y2=\"12\" />\n </svg>\n )\n}\n\n// ---------------------------------------------------------------------------\n\nexport type NavAppShellProps = {\n sidebar: NavSidebarProps\n topBar: NavTopBarProps\n children: ReactNode\n}\n\n/**\n * Full chrome: branded left sidebar + sticky top navbar + scrollable content\n * region. Presentational only — wrap it in app-level auth/gating as needed.\n */\nexport function NavAppShell({ sidebar, topBar, children }: NavAppShellProps) {\n return (\n <div className=\"min-h-screen bg-[color:var(--background)] text-[color:var(--foreground)]\">\n <NavSidebar {...sidebar} />\n <div className=\"lg:pl-[240px]\">\n <NavTopBar {...topBar} />\n <main className=\"px-6 py-7\">\n <div className=\"mx-auto max-w-7xl\">{children}</div>\n </main>\n </div>\n </div>\n )\n}\n"]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ComponentType, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type NavIcon = ComponentType<{
|
|
5
|
+
size?: number;
|
|
6
|
+
className?: string;
|
|
7
|
+
}>;
|
|
8
|
+
type NavItem = {
|
|
9
|
+
href: string;
|
|
10
|
+
label: string;
|
|
11
|
+
icon?: NavIcon;
|
|
12
|
+
};
|
|
13
|
+
type NavLinkProps = {
|
|
14
|
+
href: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
'aria-current'?: 'page' | undefined;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
};
|
|
19
|
+
type NavLinkComponent = ComponentType<NavLinkProps>;
|
|
20
|
+
/** Default active-route test: exact match for "/", prefix match otherwise. */
|
|
21
|
+
declare function isNavItemActive(pathname: string, href: string): boolean;
|
|
22
|
+
/** Token-driven tone classes for the sidebar environment chip. */
|
|
23
|
+
declare function envChipClasses(label: string): string;
|
|
24
|
+
type NavBrand = {
|
|
25
|
+
/** Where the logo links to. Defaults to "/". */
|
|
26
|
+
homeHref?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Brand logo image src. When supplied this renders as the wordmark logo
|
|
29
|
+
* (matching the main app's BrandLogo), and `badgeLabel`/`title`/`subtitle`
|
|
30
|
+
* are used only as the no-image fallback.
|
|
31
|
+
*/
|
|
32
|
+
logoSrc?: string;
|
|
33
|
+
logoAlt?: string;
|
|
34
|
+
/** Short label shown inside the brand badge fallback (e.g. "P"). */
|
|
35
|
+
badgeLabel: string;
|
|
36
|
+
title: string;
|
|
37
|
+
subtitle?: string;
|
|
38
|
+
};
|
|
39
|
+
type NavOrg = {
|
|
40
|
+
name: string | null;
|
|
41
|
+
/** Optional org logo for the pill badge; falls back to initials. */
|
|
42
|
+
logoUrl?: string | null;
|
|
43
|
+
/** Solid pill background (the org's brand color). Defaults to a dark slate. */
|
|
44
|
+
brandColor?: string | null;
|
|
45
|
+
onClick?: () => void;
|
|
46
|
+
};
|
|
47
|
+
type NavMode = {
|
|
48
|
+
label: string;
|
|
49
|
+
icon?: NavIcon;
|
|
50
|
+
};
|
|
51
|
+
type NavFooterLink = {
|
|
52
|
+
label: string;
|
|
53
|
+
href: string;
|
|
54
|
+
external?: boolean;
|
|
55
|
+
};
|
|
56
|
+
type NavFooter = {
|
|
57
|
+
envLabel: string;
|
|
58
|
+
version: string;
|
|
59
|
+
commit: string;
|
|
60
|
+
links?: NavFooterLink[];
|
|
61
|
+
};
|
|
62
|
+
type NavSidebarProps = {
|
|
63
|
+
pathname: string;
|
|
64
|
+
brand: NavBrand;
|
|
65
|
+
nav: {
|
|
66
|
+
groupLabel?: string;
|
|
67
|
+
items: NavItem[];
|
|
68
|
+
isActive?: (pathname: string, href: string) => boolean;
|
|
69
|
+
};
|
|
70
|
+
org?: NavOrg | null;
|
|
71
|
+
mode?: NavMode | null;
|
|
72
|
+
footer?: NavFooter | null;
|
|
73
|
+
linkComponent?: NavLinkComponent;
|
|
74
|
+
};
|
|
75
|
+
declare function NavSidebar({ pathname, brand, nav, org, mode, footer, linkComponent, }: NavSidebarProps): react_jsx_runtime.JSX.Element;
|
|
76
|
+
type NavUser = {
|
|
77
|
+
name: string | null;
|
|
78
|
+
email?: string | null;
|
|
79
|
+
/** Avatar image URL; falls back to initials on the brand color. */
|
|
80
|
+
avatarUrl?: string | null;
|
|
81
|
+
tier?: string | null;
|
|
82
|
+
role?: string | null;
|
|
83
|
+
};
|
|
84
|
+
type NavTopBarProps = {
|
|
85
|
+
title: string;
|
|
86
|
+
subtitle?: string;
|
|
87
|
+
user?: NavUser | null;
|
|
88
|
+
onSignOut?: () => void;
|
|
89
|
+
/** App-specific action cluster rendered left of the theme toggle. */
|
|
90
|
+
actions?: ReactNode;
|
|
91
|
+
/** Theme toggle slot (injected so this package needs no theme dependency). */
|
|
92
|
+
themeToggle?: ReactNode;
|
|
93
|
+
};
|
|
94
|
+
declare function NavTopBar({ title, subtitle, user, onSignOut, actions, themeToggle, }: NavTopBarProps): react_jsx_runtime.JSX.Element;
|
|
95
|
+
type NavAppShellProps = {
|
|
96
|
+
sidebar: NavSidebarProps;
|
|
97
|
+
topBar: NavTopBarProps;
|
|
98
|
+
children: ReactNode;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Full chrome: branded left sidebar + sticky top navbar + scrollable content
|
|
102
|
+
* region. Presentational only — wrap it in app-level auth/gating as needed.
|
|
103
|
+
*/
|
|
104
|
+
declare function NavAppShell({ sidebar, topBar, children }: NavAppShellProps): react_jsx_runtime.JSX.Element;
|
|
105
|
+
|
|
106
|
+
export { NavAppShell, type NavAppShellProps, type NavBrand, type NavFooter, type NavFooterLink, type NavIcon, type NavItem, type NavLinkComponent, type NavLinkProps, type NavMode, type NavOrg, NavSidebar, type NavSidebarProps, NavTopBar, type NavTopBarProps, type NavUser, envChipClasses, isNavItemActive };
|
package/dist/native.d.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ComponentType, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type NavIcon = ComponentType<{
|
|
5
|
+
size?: number;
|
|
6
|
+
className?: string;
|
|
7
|
+
}>;
|
|
8
|
+
type NavItem = {
|
|
9
|
+
href: string;
|
|
10
|
+
label: string;
|
|
11
|
+
icon?: NavIcon;
|
|
12
|
+
};
|
|
13
|
+
type NavLinkProps = {
|
|
14
|
+
href: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
'aria-current'?: 'page' | undefined;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
};
|
|
19
|
+
type NavLinkComponent = ComponentType<NavLinkProps>;
|
|
20
|
+
/** Default active-route test: exact match for "/", prefix match otherwise. */
|
|
21
|
+
declare function isNavItemActive(pathname: string, href: string): boolean;
|
|
22
|
+
/** Token-driven tone classes for the sidebar environment chip. */
|
|
23
|
+
declare function envChipClasses(label: string): string;
|
|
24
|
+
type NavBrand = {
|
|
25
|
+
/** Where the logo links to. Defaults to "/". */
|
|
26
|
+
homeHref?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Brand logo image src. When supplied this renders as the wordmark logo
|
|
29
|
+
* (matching the main app's BrandLogo), and `badgeLabel`/`title`/`subtitle`
|
|
30
|
+
* are used only as the no-image fallback.
|
|
31
|
+
*/
|
|
32
|
+
logoSrc?: string;
|
|
33
|
+
logoAlt?: string;
|
|
34
|
+
/** Short label shown inside the brand badge fallback (e.g. "P"). */
|
|
35
|
+
badgeLabel: string;
|
|
36
|
+
title: string;
|
|
37
|
+
subtitle?: string;
|
|
38
|
+
};
|
|
39
|
+
type NavOrg = {
|
|
40
|
+
name: string | null;
|
|
41
|
+
/** Optional org logo for the pill badge; falls back to initials. */
|
|
42
|
+
logoUrl?: string | null;
|
|
43
|
+
/** Solid pill background (the org's brand color). Defaults to a dark slate. */
|
|
44
|
+
brandColor?: string | null;
|
|
45
|
+
onClick?: () => void;
|
|
46
|
+
};
|
|
47
|
+
type NavMode = {
|
|
48
|
+
label: string;
|
|
49
|
+
icon?: NavIcon;
|
|
50
|
+
};
|
|
51
|
+
type NavFooterLink = {
|
|
52
|
+
label: string;
|
|
53
|
+
href: string;
|
|
54
|
+
external?: boolean;
|
|
55
|
+
};
|
|
56
|
+
type NavFooter = {
|
|
57
|
+
envLabel: string;
|
|
58
|
+
version: string;
|
|
59
|
+
commit: string;
|
|
60
|
+
links?: NavFooterLink[];
|
|
61
|
+
};
|
|
62
|
+
type NavSidebarProps = {
|
|
63
|
+
pathname: string;
|
|
64
|
+
brand: NavBrand;
|
|
65
|
+
nav: {
|
|
66
|
+
groupLabel?: string;
|
|
67
|
+
items: NavItem[];
|
|
68
|
+
isActive?: (pathname: string, href: string) => boolean;
|
|
69
|
+
};
|
|
70
|
+
org?: NavOrg | null;
|
|
71
|
+
mode?: NavMode | null;
|
|
72
|
+
footer?: NavFooter | null;
|
|
73
|
+
linkComponent?: NavLinkComponent;
|
|
74
|
+
};
|
|
75
|
+
declare function NavSidebar({ pathname, brand, nav, org, mode, footer, linkComponent, }: NavSidebarProps): react_jsx_runtime.JSX.Element;
|
|
76
|
+
type NavUser = {
|
|
77
|
+
name: string | null;
|
|
78
|
+
email?: string | null;
|
|
79
|
+
/** Avatar image URL; falls back to initials on the brand color. */
|
|
80
|
+
avatarUrl?: string | null;
|
|
81
|
+
tier?: string | null;
|
|
82
|
+
role?: string | null;
|
|
83
|
+
};
|
|
84
|
+
type NavTopBarProps = {
|
|
85
|
+
title: string;
|
|
86
|
+
subtitle?: string;
|
|
87
|
+
user?: NavUser | null;
|
|
88
|
+
onSignOut?: () => void;
|
|
89
|
+
/** App-specific action cluster rendered left of the theme toggle. */
|
|
90
|
+
actions?: ReactNode;
|
|
91
|
+
/** Theme toggle slot (injected so this package needs no theme dependency). */
|
|
92
|
+
themeToggle?: ReactNode;
|
|
93
|
+
};
|
|
94
|
+
declare function NavTopBar({ title, subtitle, user, onSignOut, actions, themeToggle, }: NavTopBarProps): react_jsx_runtime.JSX.Element;
|
|
95
|
+
type NavAppShellProps = {
|
|
96
|
+
sidebar: NavSidebarProps;
|
|
97
|
+
topBar: NavTopBarProps;
|
|
98
|
+
children: ReactNode;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Full chrome: branded left sidebar + sticky top navbar + scrollable content
|
|
102
|
+
* region. Presentational only — wrap it in app-level auth/gating as needed.
|
|
103
|
+
*/
|
|
104
|
+
declare function NavAppShell({ sidebar, topBar, children }: NavAppShellProps): react_jsx_runtime.JSX.Element;
|
|
105
|
+
|
|
106
|
+
export { NavAppShell, type NavAppShellProps, type NavBrand, type NavFooter, type NavFooterLink, type NavIcon, type NavItem, type NavLinkComponent, type NavLinkProps, type NavMode, type NavOrg, NavSidebar, type NavSidebarProps, NavTopBar, type NavTopBarProps, type NavUser, envChipClasses, isNavItemActive };
|