@brdgapp/ui 1.4.0 → 1.6.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/CHANGELOG.md +34 -0
- package/components/account-menu.d.ts +75 -0
- package/components/account-menu.js +69 -0
- package/components/app-lockup.d.ts +12 -0
- package/components/app-lockup.js +15 -0
- package/components/app-shell.d.ts +52 -0
- package/components/app-shell.js +138 -0
- package/components/breadcrumbs.d.ts +22 -0
- package/components/breadcrumbs.js +16 -0
- package/components/data-table.js +4 -1
- package/components/drawer.d.ts +6 -2
- package/components/drawer.js +10 -3
- package/components/tag.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
Every release of `@brdgapp/ui`. Versions follow the rules in README.md → Versions.
|
|
4
4
|
|
|
5
|
+
## 1.6.0
|
|
6
|
+
|
|
7
|
+
2026-11-16. AppLockup, and the shrunk side menu's logo at the right size. Nothing changes for apps already on 1.5, so they can update without changes.
|
|
8
|
+
|
|
9
|
+
- New: AppLockup (`components/app-lockup`), the Bridge icon and the app's name, for AppShell's `logo`.
|
|
10
|
+
`mark` leaves the name out, for `logoMark`. 16px tall by default; the icon follows the theme.
|
|
11
|
+
- AppShell: the shrunk side menu draws `logoMark` 16px tall, the same as in the full logo, whatever size
|
|
12
|
+
it's passed at.
|
|
13
|
+
|
|
14
|
+
## 1.5.0
|
|
15
|
+
|
|
16
|
+
2026-11-16. AppShell, AccountMenu and Breadcrumbs, and Drawer gains a width and a toolbar. Nothing changes for apps already on 1.4, so they can update without changes.
|
|
17
|
+
|
|
18
|
+
- New: AppShell (`components/app-shell`), every app's navigation. A 56px glass top bar with search,
|
|
19
|
+
`actions` (the AppLauncher) and `account` on its right in every app. `nav="top"`: the logo and the tabs
|
|
20
|
+
(four places or fewer) on its left; five or more use `nav="side"`. `nav="side"`: a full-height 224px side menu, in groups, with the logo and its
|
|
21
|
+
shrink button at the top; it shrinks to 56px of icons (the button or ⌘B, `logoMark` at the top) and
|
|
22
|
+
remembers it, and the top bar beside it takes `breadcrumbs`. Phones: tabs move to a bottom bar; a side
|
|
23
|
+
menu slides in from ☰. `renderLink` takes your router's link. Every app's own header, sidebar and bottom
|
|
24
|
+
bar become this.
|
|
25
|
+
- New: AccountMenu (`components/account-menu`): your account from the top bar's avatar. "Signed in as" always;
|
|
26
|
+
then only the parts an app passes: `tag`, `workspaces`, `profileHref`, `settingsHref`, `adminHref`,
|
|
27
|
+
`bridgeAccountHref`, `connectedAccounts` (with sync and Manage), `extra`, `onSignOut`. Every app's own avatar
|
|
28
|
+
dropdown becomes this, in AppShell's `account`.
|
|
29
|
+
- New: Breadcrumbs (`components/breadcrumbs`): where a page sits, Admin › Directory › Firms, for AppShell's
|
|
30
|
+
`breadcrumbs`.
|
|
31
|
+
- Drawer: `size="wide"`, 1152px (always leaving 64px of the page in view), for a table or a two-pane editor.
|
|
32
|
+
Its body has no padding, so a DataTable runs edge to edge. Bridge OS's "Your contacts" drawer and
|
|
33
|
+
app-directories' page builder become this.
|
|
34
|
+
- Drawer: `toolbar`, pinned under the header. Pass a DataTableToolbar with the search and filters, so they stay
|
|
35
|
+
in view while the list scrolls.
|
|
36
|
+
- DataTableToolbar: with no search, filters start at the left instead of the right (a drawer's row of
|
|
37
|
+
FilterChips). With a search, nothing moves.
|
|
38
|
+
|
|
5
39
|
## 1.4.0
|
|
6
40
|
|
|
7
41
|
2026-11-12. Three new components. Nothing changes for apps already on 1.3, so they can update without changes.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type TagColor } from "@brdgapp/ui/components/tag";
|
|
3
|
+
type AccountMenuUser = {
|
|
4
|
+
name: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
/** Their photo. Without it, initials. */
|
|
7
|
+
avatarUrl?: string;
|
|
8
|
+
};
|
|
9
|
+
type AccountMenuWorkspace = {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
/** A logo or favicon, 24px. Without it, the name's initials. */
|
|
13
|
+
icon?: React.ReactNode;
|
|
14
|
+
/** The one people are in: gets a check. */
|
|
15
|
+
current?: boolean;
|
|
16
|
+
/** Something new there: a count. */
|
|
17
|
+
badge?: number;
|
|
18
|
+
};
|
|
19
|
+
type AccountMenuConnectedAccount = {
|
|
20
|
+
id: string;
|
|
21
|
+
/** The company's domain for a work account ("brdg.app"), or the address for a personal one. */
|
|
22
|
+
name: string;
|
|
23
|
+
/** The line under it: the address, or "Synced 2h ago". */
|
|
24
|
+
detail?: string;
|
|
25
|
+
/** The company's favicon, 20px. */
|
|
26
|
+
icon?: React.ReactNode;
|
|
27
|
+
kind: "work" | "personal";
|
|
28
|
+
primary?: boolean;
|
|
29
|
+
};
|
|
30
|
+
type AccountMenuLinkProps = {
|
|
31
|
+
href: string;
|
|
32
|
+
className: string;
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
onClick?: () => void;
|
|
35
|
+
};
|
|
36
|
+
type AccountMenuProps = {
|
|
37
|
+
/** Who's signed in. Required: the menu always starts with "Signed in as". */
|
|
38
|
+
user: AccountMenuUser;
|
|
39
|
+
/** Their plan or role beside the name: `{ label: "Pro", color: "blue" }`. Free is grey, paid blue, custom purple. */
|
|
40
|
+
tag?: {
|
|
41
|
+
label: string;
|
|
42
|
+
color?: TagColor;
|
|
43
|
+
};
|
|
44
|
+
/** Apps with workspaces: listed under your name. Choosing one calls `onWorkspaceChange`. */
|
|
45
|
+
workspaces?: AccountMenuWorkspace[];
|
|
46
|
+
onWorkspaceChange?: (id: string) => void;
|
|
47
|
+
/** Shows "View profile". */
|
|
48
|
+
profileHref?: string;
|
|
49
|
+
/** Shows "Account settings". */
|
|
50
|
+
settingsHref?: string;
|
|
51
|
+
/** Shows "Bridge account", opening in a new tab: `"https://brdg.app/account"`. */
|
|
52
|
+
bridgeAccountHref?: string;
|
|
53
|
+
/** Shows "Admin controls", for people allowed in. */
|
|
54
|
+
adminHref?: string;
|
|
55
|
+
/** Shows "Connected accounts": the email accounts Bridge reads, under Work and Personal. */
|
|
56
|
+
connectedAccounts?: AccountMenuConnectedAccount[];
|
|
57
|
+
/** While they load, after opening. */
|
|
58
|
+
connectedAccountsLoading?: boolean;
|
|
59
|
+
/** Shows the sync button beside "Connected accounts". Return a promise to show it spinning, then done or failed. */
|
|
60
|
+
onSyncAccounts?: () => void | Promise<unknown>;
|
|
61
|
+
/** Shows "Manage" beside "Connected accounts". */
|
|
62
|
+
manageAccountsHref?: string;
|
|
63
|
+
/** One section of the app's own, before Sign out: a card, a toggle, "Clear cache". */
|
|
64
|
+
extra?: React.ReactNode;
|
|
65
|
+
/** Shows "Sign out", the last row, in red. */
|
|
66
|
+
onSignOut?: () => void;
|
|
67
|
+
/** Your router's link, as in AppShell: `(p) => <Link {...p} />`. Default a plain <a>. */
|
|
68
|
+
renderLink?: (props: AccountMenuLinkProps) => React.ReactElement;
|
|
69
|
+
/** Control it, to load connected accounts when it opens. Leave both out and it opens and closes itself. */
|
|
70
|
+
open?: boolean;
|
|
71
|
+
onOpenChange?: (open: boolean) => void;
|
|
72
|
+
};
|
|
73
|
+
declare function AccountMenu({ user, tag, workspaces, onWorkspaceChange, profileHref, settingsHref, bridgeAccountHref, adminHref, connectedAccounts, connectedAccountsLoading, onSyncAccounts, manageAccountsHref, extra, onSignOut, renderLink, open: openProp, onOpenChange, }: AccountMenuProps): React.JSX.Element;
|
|
74
|
+
export { AccountMenu };
|
|
75
|
+
export type { AccountMenuConnectedAccount, AccountMenuLinkProps, AccountMenuProps, AccountMenuUser, AccountMenuWorkspace };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Check, CircleAlert, CircleCheck, CircleUser, ExternalLink, LogOut, RefreshCw, Settings, Shield, User } from "lucide-react";
|
|
5
|
+
import { Avatar } from "@brdgapp/ui/components/avatar";
|
|
6
|
+
import { IconButton } from "@brdgapp/ui/components/icon-button";
|
|
7
|
+
import { Popover } from "@brdgapp/ui/components/popover";
|
|
8
|
+
import { Skeleton } from "@brdgapp/ui/components/skeleton";
|
|
9
|
+
import { Tag } from "@brdgapp/ui/components/tag";
|
|
10
|
+
import { cn } from "@brdgapp/ui/lib/utils";
|
|
11
|
+
const plainLink = (props) => _jsx("a", { ...props });
|
|
12
|
+
// The same row as ActionMenu's items, run edge to edge across the panel.
|
|
13
|
+
const ROW = "flex w-full items-center gap-3 px-4 py-2.5 max-md:min-h-11 text-left text-13 font-medium leading-normal text-[var(--text-body)] outline-none transition-colors " +
|
|
14
|
+
"hover:bg-[var(--surface-secondary)] hover:text-[var(--text-primary)] focus-visible:bg-[var(--surface-secondary)] focus-visible:text-[var(--text-primary)] " +
|
|
15
|
+
"[&_svg]:size-4 [&_svg]:shrink-0 [&>svg:first-child]:text-[var(--text-muted)]";
|
|
16
|
+
const HEADING = "px-4 pb-1.5 text-12 font-medium text-[var(--text-muted)]";
|
|
17
|
+
function Divider() {
|
|
18
|
+
return _jsx("div", { "aria-hidden": "true", className: "my-1 border-t border-[var(--border-divider)]" });
|
|
19
|
+
}
|
|
20
|
+
function AccountMenu({ user, tag, workspaces, onWorkspaceChange, profileHref, settingsHref, bridgeAccountHref, adminHref, connectedAccounts, connectedAccountsLoading = false, onSyncAccounts, manageAccountsHref, extra, onSignOut, renderLink, open: openProp, onOpenChange, }) {
|
|
21
|
+
const link = renderLink ?? plainLink;
|
|
22
|
+
const [ownOpen, setOwnOpen] = React.useState(false);
|
|
23
|
+
const open = openProp ?? ownOpen;
|
|
24
|
+
const setOpen = (next) => {
|
|
25
|
+
if (openProp === undefined)
|
|
26
|
+
setOwnOpen(next);
|
|
27
|
+
onOpenChange?.(next);
|
|
28
|
+
};
|
|
29
|
+
const close = () => setOpen(false);
|
|
30
|
+
const links = [
|
|
31
|
+
profileHref ? link({ href: profileHref, onClick: close, className: ROW, children: _jsxs(_Fragment, { children: [_jsx(User, { "aria-hidden": "true" }), "View profile"] }) }) : null,
|
|
32
|
+
settingsHref ? link({ href: settingsHref, onClick: close, className: ROW, children: _jsxs(_Fragment, { children: [_jsx(Settings, { "aria-hidden": "true" }), "Account settings"] }) }) : null,
|
|
33
|
+
adminHref ? link({ href: adminHref, onClick: close, className: ROW, children: _jsxs(_Fragment, { children: [_jsx(Shield, { "aria-hidden": "true" }), "Admin controls"] }) }) : null,
|
|
34
|
+
bridgeAccountHref ? (_jsxs("a", { href: bridgeAccountHref, target: "_blank", rel: "noopener noreferrer", onClick: close, className: ROW, children: [_jsx(CircleUser, { "aria-hidden": "true" }), _jsx("span", { className: "flex-1", children: "Bridge account" }), _jsx(ExternalLink, { "aria-hidden": "true", className: "text-[var(--text-muted)]" }), _jsx("span", { className: "sr-only", children: "(opens in a new tab)" })] })) : null,
|
|
35
|
+
].filter(Boolean);
|
|
36
|
+
return (_jsx(Popover, { open: open, onOpenChange: setOpen, title: "Your account", hideTitle: true, align: "end", trigger: _jsx("button", { type: "button", "aria-label": "Your account", className: "flex shrink-0 rounded-full ring-1 ring-[var(--border-default)] transition-shadow outline-none hover:ring-[var(--border-hover)] focus-visible:ring-2 focus-visible:ring-[var(--primary)] focus-visible:ring-offset-2", children: _jsx(Avatar, { name: user.name, src: user.avatarUrl, size: "md" }) }), children: _jsxs("div", { "data-slot": "account-menu", className: "-m-4 py-2", children: [_jsx("p", { className: cn(HEADING, "pt-2"), children: "Signed in as" }), _jsxs("div", { className: "flex items-center gap-3 px-4 pb-3", children: [_jsx(Avatar, { name: user.name, src: user.avatarUrl, size: "lg", className: "shrink-0" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "truncate text-14 font-semibold text-[var(--text-primary)]", children: user.name }), user.email ? _jsx("p", { className: "truncate text-12 text-[var(--text-muted)]", children: user.email }) : null] }), tag ? (_jsx(Tag, { color: tag.color ?? "grey", size: "sm", className: "shrink-0", children: tag.label })) : null] }), workspaces?.length ? (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsxs("div", { role: "group", "aria-label": "Workspaces", className: "py-1", children: [_jsx("p", { className: cn(HEADING, "pt-1.5"), children: "Workspaces" }), workspaces.map((w) => (_jsxs("button", { type: "button", "aria-current": w.current ? "true" : undefined, onClick: () => {
|
|
37
|
+
onWorkspaceChange?.(w.id);
|
|
38
|
+
close();
|
|
39
|
+
}, className: cn(ROW, w.current ? "text-[var(--text-primary)]" : ""), children: [_jsx("span", { "aria-hidden": "true", className: "flex size-6 shrink-0 items-center justify-center overflow-hidden rounded-md [&_img]:size-6", children: w.icon ?? _jsx(Avatar, { name: w.name, size: "sm" }) }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: w.name }), w.badge ? (_jsxs("span", { className: "text-12 text-[var(--text-muted)] tabular-nums", children: [w.badge, _jsx("span", { className: "sr-only", children: " new" })] })) : null, w.current ? _jsx(Check, { "aria-hidden": "true", className: "text-[var(--primary)]" }) : _jsx("span", { "aria-hidden": "true", className: "size-4" })] }, w.id)))] })] })) : null, links.length ? (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsx("div", { className: "py-1", children: links.map((l, i) => React.cloneElement(l, { key: i })) })] })) : null, connectedAccounts ? (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsx(ConnectedAccounts, { accounts: connectedAccounts, loading: connectedAccountsLoading, onSync: onSyncAccounts, manage: manageAccountsHref ? link({ href: manageAccountsHref, onClick: close, className: "rounded-sm text-12 font-semibold text-[var(--primary)] outline-none hover:underline focus-visible:ring-2 focus-visible:ring-[var(--primary)]", children: "Manage" }) : null })] })) : null, extra ? (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsx("div", { className: "px-4 py-2", children: extra })] })) : null, onSignOut ? (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsx("div", { className: "py-1", children: _jsxs("button", { type: "button", onClick: () => {
|
|
40
|
+
close();
|
|
41
|
+
onSignOut();
|
|
42
|
+
}, className: cn(ROW, "text-[var(--danger-text)] hover:bg-[var(--error-bg)] hover:text-[var(--danger-text)] focus-visible:bg-[var(--error-bg)] focus-visible:text-[var(--danger-text)] [&>svg:first-child]:text-[var(--danger-text)]"), children: [_jsx(LogOut, { "aria-hidden": "true" }), "Sign out"] }) })] })) : null] }) }));
|
|
43
|
+
}
|
|
44
|
+
function ConnectedAccounts({ accounts, loading, onSync, manage, }) {
|
|
45
|
+
const [sync, setSync] = React.useState("idle");
|
|
46
|
+
const run = async () => {
|
|
47
|
+
if (!onSync || sync === "syncing")
|
|
48
|
+
return;
|
|
49
|
+
const result = onSync();
|
|
50
|
+
if (!(result instanceof Promise))
|
|
51
|
+
return;
|
|
52
|
+
setSync("syncing");
|
|
53
|
+
try {
|
|
54
|
+
await result;
|
|
55
|
+
setSync("done");
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
setSync("error");
|
|
59
|
+
}
|
|
60
|
+
setTimeout(() => setSync("idle"), 3000);
|
|
61
|
+
};
|
|
62
|
+
const work = accounts.filter((a) => a.kind === "work");
|
|
63
|
+
const personal = accounts.filter((a) => a.kind === "personal");
|
|
64
|
+
return (_jsxs("div", { role: "group", "aria-label": "Connected accounts", className: "px-4 py-2", children: [_jsxs("div", { className: "mb-2 flex items-center justify-between gap-2", children: [_jsx("p", { className: "text-12 font-medium text-[var(--text-muted)]", children: "Connected accounts" }), _jsxs("div", { className: "flex items-center gap-2", children: [onSync ? (_jsx(IconButton, { size: "sm", variant: sync === "error" ? "danger" : "default", loading: sync === "syncing", onClick: run, "aria-label": sync === "syncing" ? "Syncing accounts" : sync === "done" ? "Sync started" : sync === "error" ? "Sync failed" : "Sync accounts", children: sync === "done" ? _jsx(CircleCheck, {}) : sync === "error" ? _jsx(CircleAlert, {}) : _jsx(RefreshCw, {}) })) : null, manage] })] }), loading ? (_jsx("div", { className: "space-y-1.5", children: [0, 1].map((i) => (_jsxs("div", { className: "flex items-center gap-2.5 rounded-lg bg-[var(--surface-secondary)] px-3 py-2", children: [_jsx(Skeleton, { className: "size-5 shrink-0" }), _jsxs("div", { className: "flex-1 space-y-1.5", children: [_jsx(Skeleton, { className: "h-3 w-24" }), _jsx(Skeleton, { className: "h-2.5 w-32" })] })] }, i))) })) : accounts.length ? (_jsx("div", { className: "space-y-3", children: [
|
|
65
|
+
{ label: "Work", list: work },
|
|
66
|
+
{ label: "Personal", list: personal },
|
|
67
|
+
].map((g) => g.list.length ? (_jsxs("div", { children: [_jsx("p", { className: "mb-1.5 text-11 font-medium text-[var(--text-muted)]", children: g.label }), _jsx("ul", { className: "space-y-1.5", children: g.list.map((a) => (_jsxs("li", { className: "flex items-center gap-2.5 rounded-lg bg-[var(--surface-secondary)] px-3 py-2", children: [_jsx("span", { "aria-hidden": "true", className: "flex size-5 shrink-0 items-center justify-center overflow-hidden rounded-sm bg-[var(--border-default)] [&_img]:size-5", children: a.icon }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate text-12 font-medium text-[var(--text-secondary)]", children: a.name }), a.detail ? _jsx("span", { className: "block truncate text-11 text-[var(--text-muted)]", children: a.detail }) : null] }), a.primary ? (_jsx(Tag, { color: "blue", size: "sm", className: "shrink-0", children: "Primary" })) : null] }, a.id))) })] }, g.label)) : null) })) : (_jsx("p", { className: "text-12 text-[var(--text-muted)]", children: "No connected accounts" }))] }));
|
|
68
|
+
}
|
|
69
|
+
export { AccountMenu };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type AppLockupProps = {
|
|
2
|
+
/** The app's name without Bridge: "OS", "Intros", "Together". */
|
|
3
|
+
name: string;
|
|
4
|
+
/** The icon's height in px. 16 in a top bar and side menu, the default; the brand page's other sizes are 24, 32 and 48. */
|
|
5
|
+
height?: number;
|
|
6
|
+
/** The icon alone, for AppShell's `logoMark`. Screen readers still hear "Bridge" and the name. */
|
|
7
|
+
mark?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
declare function AppLockup({ name, height, mark, className }: AppLockupProps): import("react").JSX.Element;
|
|
11
|
+
export { AppLockup };
|
|
12
|
+
export type { AppLockupProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@brdgapp/ui/lib/utils";
|
|
3
|
+
// An app's name with the Bridge icon: the logo's dot icon, then the app's name in the logo's wordmark style.
|
|
4
|
+
// The icon says it's Bridge, so the name never repeats it: OS, not Bridge OS. Screen readers hear "Bridge OS".
|
|
5
|
+
// At 16px (a top bar, the default): an 8px gap, then the name in SemiBold 14px, capitals, 0.1em letter
|
|
6
|
+
// spacing, 16px line height (Aman, 2026-11-02). Everything scales from `height`. The icon is the logo's own
|
|
7
|
+
// blue: --primary, #0038FF light and #4D7AFF dark, as in bridge-logo.svg and bridge-logo-white.svg.
|
|
8
|
+
// `mark` leaves the name out: AppShell's `logoMark`, at the top of the shrunk side menu, at the same 16px
|
|
9
|
+
// as in the full logo (Bridge OS, 2026-11-16: a hand-sized mark came out 11px tall).
|
|
10
|
+
/** The dot icon from bridge-logo.svg, in its own 44 × 25 box. */
|
|
11
|
+
const DOTS = "M8.94906 4.9569C7.6117 4.9569 6.52755 3.84726 6.52755 2.47845C6.52755 1.10964 7.6117 0 8.94906 0C10.2864 0 11.3706 1.10964 11.3706 2.47845C11.3706 3.84726 10.2864 4.9569 8.94906 4.9569ZM8.94906 11.6379C7.6117 11.6379 6.52755 10.5283 6.52755 9.15948C6.52755 7.79067 7.6117 6.68103 8.94906 6.68103C10.2864 6.68103 11.3706 7.79067 11.3706 9.15948C11.3706 10.5283 10.2864 11.6379 8.94906 11.6379ZM15.4766 11.6379C14.1393 11.6379 13.0551 10.5283 13.0551 9.15948C13.0551 7.79067 14.1393 6.68103 15.4766 6.68103C16.814 6.68103 17.8981 7.79067 17.8981 9.15948C17.8981 10.5283 16.814 11.6379 15.4766 11.6379ZM15.4766 18.319C14.1393 18.319 13.0551 17.2093 13.0551 15.8405C13.0551 14.4717 14.1393 13.3621 15.4766 13.3621C16.814 13.3621 17.8981 14.4717 17.8981 15.8405C17.8981 17.2093 16.814 18.319 15.4766 18.319ZM22.0042 18.319C20.6668 18.319 19.5827 17.2093 19.5827 15.8405C19.5827 14.4717 20.6668 13.3621 22.0042 13.3621C23.3415 13.3621 24.4257 14.4717 24.4257 15.8405C24.4257 17.2093 23.3415 18.319 22.0042 18.319ZM28.5317 18.319C27.1944 18.319 26.1102 17.2093 26.1102 15.8405C26.1102 14.4717 27.1944 13.3621 28.5317 13.3621C29.8691 13.3621 30.9532 14.4717 30.9532 15.8405C30.9532 17.2093 29.8691 18.319 28.5317 18.319ZM28.5317 11.6379C27.1944 11.6379 26.1102 10.5283 26.1102 9.15948C26.1102 7.79067 27.1944 6.68103 28.5317 6.68103C29.8691 6.68103 30.9532 7.79067 30.9532 9.15948C30.9532 10.5283 29.8691 11.6379 28.5317 11.6379ZM35.0593 11.6379C33.7219 11.6379 32.6378 10.5283 32.6378 9.15948C32.6378 7.79067 33.7219 6.68103 35.0593 6.68103C36.3966 6.68103 37.4808 7.79067 37.4808 9.15948C37.4808 10.5283 36.3966 11.6379 35.0593 11.6379ZM35.0593 4.9569C33.7219 4.9569 32.6378 3.84726 32.6378 2.47845C32.6378 1.10964 33.7219 0 35.0593 0C36.3966 0 37.4808 1.10964 37.4808 2.47845C37.4808 3.84726 36.3966 4.9569 35.0593 4.9569ZM35.0593 18.319C33.7219 18.319 32.6378 17.2093 32.6378 15.8405C32.6378 14.4717 33.7219 13.3621 35.0593 13.3621C36.3966 13.3621 37.4808 14.4717 37.4808 15.8405C37.4808 17.2093 36.3966 18.319 35.0593 18.319ZM35.0593 25C33.7219 25 32.6378 23.8904 32.6378 22.5216C32.6378 21.1527 33.7219 20.0431 35.0593 20.0431C36.3966 20.0431 37.4808 21.1527 37.4808 22.5216C37.4808 23.8904 36.3966 25 35.0593 25ZM8.94906 18.319C7.6117 18.319 6.52755 17.2093 6.52755 15.8405C6.52755 14.4717 7.6117 13.3621 8.94906 13.3621C10.2864 13.3621 11.3706 14.4717 11.3706 15.8405C11.3706 17.2093 10.2864 18.319 8.94906 18.319ZM2.42151 18.319C1.08415 18.319 0 17.2093 0 15.8405C0 14.4717 1.08415 13.3621 2.42151 13.3621C3.75887 13.3621 4.84302 14.4717 4.84302 15.8405C4.84302 17.2093 3.75887 18.319 2.42151 18.319ZM41.5868 18.319C40.2495 18.319 39.1653 17.2093 39.1653 15.8405C39.1653 14.4717 40.2495 13.3621 41.5868 13.3621C42.9242 13.3621 44.0083 14.4717 44.0083 15.8405C44.0083 17.2093 42.9242 18.319 41.5868 18.319ZM8.94906 25C7.6117 25 6.52755 23.8904 6.52755 22.5216C6.52755 21.1527 7.6117 20.0431 8.94906 20.0431C10.2864 20.0431 11.3706 21.1527 11.3706 22.5216C11.3706 23.8904 10.2864 25 8.94906 25Z";
|
|
12
|
+
function AppLockup({ name, height = 16, mark = false, className }) {
|
|
13
|
+
return (_jsxs("span", { "data-slot": "app-lockup", role: "img", "aria-label": `Bridge ${name}`, className: cn("inline-flex shrink-0 items-center", className), children: [_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 44 25", width: (44 / 25) * height, height: height, className: "shrink-0", children: _jsx("path", { d: DOTS, fill: "var(--primary)", fillRule: "evenodd", clipRule: "evenodd" }) }), mark ? null : (_jsx("span", { "aria-hidden": "true", className: "font-semibold whitespace-nowrap text-[var(--text-primary)] uppercase", style: { marginLeft: 0.5 * height, fontSize: 0.875 * height, letterSpacing: "0.1em", lineHeight: `${height}px` }, children: name }))] }));
|
|
14
|
+
}
|
|
15
|
+
export { AppLockup };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type AppShellItem = {
|
|
3
|
+
/** Unique: "activity". */
|
|
4
|
+
id: string;
|
|
5
|
+
/** The place's name: "Activity". Short: one word where possible. */
|
|
6
|
+
label: string;
|
|
7
|
+
href: string;
|
|
8
|
+
/** A Lucide icon. Shown in the bottom bar and the side menu; the top bar's tabs are words only. */
|
|
9
|
+
icon: React.ReactNode;
|
|
10
|
+
/** The page people are on. Set it from your router: the shell doesn't read the address. */
|
|
11
|
+
active?: boolean;
|
|
12
|
+
/** Something new there: `true` is a red dot; a number is a count in the side menu and a dot elsewhere. */
|
|
13
|
+
badge?: boolean | number;
|
|
14
|
+
/** Side menu only: a heading the item sits under ("Directory", "Inbox"). Items with the same group go together. */
|
|
15
|
+
group?: string;
|
|
16
|
+
};
|
|
17
|
+
type AppShellLinkProps = {
|
|
18
|
+
href: string;
|
|
19
|
+
className: string;
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
"aria-current"?: "page";
|
|
22
|
+
onClick?: () => void;
|
|
23
|
+
};
|
|
24
|
+
type AppShellProps = {
|
|
25
|
+
/** The app's lockup, `<AppLockup name="OS" />`: the Bridge icon and the app's name, 16px tall. Links home. */
|
|
26
|
+
logo: React.ReactNode;
|
|
27
|
+
/** Side menu only: `<AppLockup name="OS" mark />`, the Bridge icon alone, at the top when the side menu is shrunk. The shell draws it 16px tall, as in the full logo. */
|
|
28
|
+
logoMark?: React.ReactNode;
|
|
29
|
+
/** Where the logo goes. Default "/". */
|
|
30
|
+
homeHref?: string;
|
|
31
|
+
/** The app's main places. */
|
|
32
|
+
items: AppShellItem[];
|
|
33
|
+
/** `top`: tabs in the top bar (and a bottom bar on phones), for four places or fewer. `side`: a full-height side menu with the logo at its top, for five or more, or groups. */
|
|
34
|
+
nav?: "top" | "side";
|
|
35
|
+
/** Side menu only: Breadcrumbs, on the left of the top bar. Hidden on phones. */
|
|
36
|
+
breadcrumbs?: React.ReactNode;
|
|
37
|
+
/** A GlobalSearchTrigger. On the right of the top bar, before the launcher; on a phone it shrinks to an icon. */
|
|
38
|
+
search?: React.ReactNode;
|
|
39
|
+
/** Buttons before your account: the AppLauncher, a notifications button. */
|
|
40
|
+
actions?: React.ReactNode;
|
|
41
|
+
/** Your account: an AccountMenu, or a "Log in" button. Always last. */
|
|
42
|
+
account?: React.ReactNode;
|
|
43
|
+
/** Side menu only: a link at the bottom, such as "Back to Bridge OS" in an admin area. */
|
|
44
|
+
sideFooter?: React.ReactNode;
|
|
45
|
+
/** Draws each link with your router's: `(p) => <Link {...p} />` (Next), `({ href, ...p }) => <Link to={href} {...p} />` (React Router). Default a plain <a>. */
|
|
46
|
+
renderLink?: (props: AppShellLinkProps) => React.ReactElement;
|
|
47
|
+
/** The page. */
|
|
48
|
+
children: React.ReactNode;
|
|
49
|
+
};
|
|
50
|
+
declare function AppShell({ logo, logoMark, homeHref, items, nav, breadcrumbs, search, actions, account, sideFooter, renderLink, children, }: AppShellProps): React.JSX.Element;
|
|
51
|
+
export { AppShell };
|
|
52
|
+
export type { AppShellItem, AppShellLinkProps, AppShellProps };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
5
|
+
import { Menu, PanelLeftClose, PanelLeftOpen, X } from "lucide-react";
|
|
6
|
+
import { IconButton } from "@brdgapp/ui/components/icon-button";
|
|
7
|
+
import { SkipLink } from "@brdgapp/ui/components/skip-link";
|
|
8
|
+
import { Tip } from "@brdgapp/ui/components/info-hint";
|
|
9
|
+
import { cn } from "@brdgapp/ui/lib/utils";
|
|
10
|
+
const plainLink = (props) => _jsx("a", { ...props });
|
|
11
|
+
// GlobalSearchTrigger sized by the top bar (see `searchSized`). The `!` beats the trigger's own window-based sizes.
|
|
12
|
+
const SEARCH_SIZE = [
|
|
13
|
+
"w-9! justify-center! px-0! [&>span]:hidden! [&>kbd]:hidden!",
|
|
14
|
+
"@min-[760px]:w-[240px]! @min-[760px]:justify-start! @min-[760px]:px-3.5! @min-[760px]:[&>span]:block! @min-[760px]:[&>kbd]:inline-flex!",
|
|
15
|
+
"@min-[1200px]:w-[280px]!",
|
|
16
|
+
].join(" ");
|
|
17
|
+
function Dot({ className }) {
|
|
18
|
+
return _jsx("span", { "aria-hidden": "true", className: cn("absolute size-2 rounded-full bg-[var(--error)] ring-2 ring-[var(--surface-primary)]", className) });
|
|
19
|
+
}
|
|
20
|
+
function badgeText(badge) {
|
|
21
|
+
if (!badge)
|
|
22
|
+
return "";
|
|
23
|
+
return typeof badge === "number" ? `, ${badge} new` : ", new";
|
|
24
|
+
}
|
|
25
|
+
// ── The side menu's remembered width ───────────────────────────────────────────────────────────
|
|
26
|
+
const KEY = "brdg-side-nav-collapsed";
|
|
27
|
+
const listeners = new Set();
|
|
28
|
+
function readCollapsed() {
|
|
29
|
+
try {
|
|
30
|
+
return window.localStorage.getItem(KEY) === "1";
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function setCollapsed(next) {
|
|
37
|
+
try {
|
|
38
|
+
window.localStorage.setItem(KEY, next ? "1" : "0");
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// Storage blocked: it still collapses until the page reloads.
|
|
42
|
+
}
|
|
43
|
+
memory = next;
|
|
44
|
+
listeners.forEach((l) => l());
|
|
45
|
+
}
|
|
46
|
+
let memory = null;
|
|
47
|
+
function subscribe(l) {
|
|
48
|
+
listeners.add(l);
|
|
49
|
+
return () => listeners.delete(l);
|
|
50
|
+
}
|
|
51
|
+
const getCollapsed = () => memory ?? (memory = readCollapsed());
|
|
52
|
+
function useCollapsed() {
|
|
53
|
+
return React.useSyncExternalStore(subscribe, getCollapsed, () => false);
|
|
54
|
+
}
|
|
55
|
+
// ── Pieces ─────────────────────────────────────────────────────────────────────────────────────
|
|
56
|
+
function TopTabs({ items, link }) {
|
|
57
|
+
return (_jsx("div", { className: "hidden shrink-0 items-center gap-6 self-stretch md:flex", children: items.map((item) => React.cloneElement(link({
|
|
58
|
+
href: item.href,
|
|
59
|
+
"aria-current": item.active ? "page" : undefined,
|
|
60
|
+
className: cn("relative flex h-full items-center text-14 leading-5 font-bold tracking-[0.4px] transition-colors outline-none", "focus-visible:ring-2 focus-visible:ring-[var(--primary)] focus-visible:ring-offset-2 rounded-sm", item.active ? "text-[var(--text-primary)]" : "text-[var(--text-muted)] hover:text-[var(--text-body)]"),
|
|
61
|
+
children: (_jsxs(_Fragment, { children: [_jsxs("span", { className: "relative", children: [item.label, item.badge ? _jsx(Dot, { className: "-top-1 -right-2.5" }) : null, item.badge ? _jsx("span", { className: "sr-only", children: badgeText(item.badge) }) : null] }), _jsx("span", { "aria-hidden": "true", className: cn("absolute inset-x-0 bottom-0 h-0.5 bg-[var(--text-primary)]", item.active ? "opacity-100" : "opacity-0") })] })),
|
|
62
|
+
}), { key: item.id })) }));
|
|
63
|
+
}
|
|
64
|
+
function BottomBar({ items, link }) {
|
|
65
|
+
if (process.env.NODE_ENV !== "production" && items.length > 4) {
|
|
66
|
+
console.warn(`AppShell: ${items.length} places. Four or fewer use tabs; five or more use nav="side".`);
|
|
67
|
+
}
|
|
68
|
+
return (_jsx("nav", { "aria-label": "Main", "data-slot": "app-shell-bottom-bar", className: "fixed inset-x-0 bottom-0 z-50 border-t border-[var(--glass-border)] bg-[var(--glass-bg)] pb-[env(safe-area-inset-bottom)] backdrop-blur-2xl backdrop-saturate-150 md:hidden", children: _jsx("div", { className: "flex h-14 items-stretch", children: items.map((item) => React.cloneElement(link({
|
|
69
|
+
href: item.href,
|
|
70
|
+
"aria-current": item.active ? "page" : undefined,
|
|
71
|
+
className: cn("flex flex-1 flex-col items-center justify-center gap-0.5 transition-colors outline-none focus-visible:bg-[var(--surface-secondary)]", item.active ? "text-[var(--primary)]" : "text-[var(--text-muted)]"),
|
|
72
|
+
children: (_jsxs(_Fragment, { children: [_jsxs("span", { "aria-hidden": "true", className: cn("relative [&>svg]:size-[22px]", item.active ? "[&>svg]:stroke-[2.4]" : ""), children: [item.icon, item.badge ? _jsx(Dot, { className: "-top-1 -right-1.5" }) : null] }), _jsxs("span", { className: "text-11 leading-none font-semibold tracking-[0.2px]", children: [item.label, item.badge ? _jsx("span", { className: "sr-only", children: badgeText(item.badge) }) : null] })] })),
|
|
73
|
+
}), { key: item.id })) }) }));
|
|
74
|
+
}
|
|
75
|
+
function groupsOf(items) {
|
|
76
|
+
const groups = [];
|
|
77
|
+
for (const item of items) {
|
|
78
|
+
const last = groups.at(-1);
|
|
79
|
+
if (last && last.label === item.group)
|
|
80
|
+
last.items.push(item);
|
|
81
|
+
else
|
|
82
|
+
groups.push({ label: item.group, items: [item] });
|
|
83
|
+
}
|
|
84
|
+
return groups;
|
|
85
|
+
}
|
|
86
|
+
function SideMenu({ items, link, collapsed, footer, onNavigate, }) {
|
|
87
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto overscroll-contain px-2 py-3", children: groupsOf(items).map((group, i) => (_jsxs("div", { role: "group", "aria-label": group.label, className: "flex flex-col gap-px", children: [group.label ? (collapsed ? (i > 0 ? _jsx("span", { "aria-hidden": "true", className: "mx-3 mb-2 h-px bg-[var(--border-divider)]" }) : null) : (_jsx("p", { "aria-hidden": "true", className: "truncate px-2.5 pb-1 text-12 font-medium text-[var(--text-muted)]", children: group.label }))) : null, group.items.map((item) => {
|
|
88
|
+
const row = link({
|
|
89
|
+
href: item.href,
|
|
90
|
+
onClick: onNavigate,
|
|
91
|
+
"aria-current": item.active ? "page" : undefined,
|
|
92
|
+
className: cn("group/item relative flex h-8 items-center gap-2.5 rounded-md px-2.5 text-13 font-medium transition-colors outline-none", "focus-visible:ring-2 focus-visible:ring-[var(--primary)]", collapsed ? "justify-center px-0" : "", item.active
|
|
93
|
+
? "bg-[var(--surface-tertiary)] text-[var(--text-primary)]"
|
|
94
|
+
: "text-[var(--text-secondary)] hover:bg-[var(--surface-secondary)] hover:text-[var(--text-primary)]"),
|
|
95
|
+
children: (_jsxs(_Fragment, { children: [_jsxs("span", { "aria-hidden": "true", className: cn("relative flex shrink-0 [&>svg]:size-4", item.active ? "text-[var(--text-primary)]" : "text-[var(--text-muted)] group-hover/item:text-[var(--text-primary)]"), children: [item.icon, collapsed && item.badge ? _jsx(Dot, { className: "-top-1 -right-1" }) : null] }), _jsx("span", { className: cn("min-w-0 flex-1 truncate", collapsed ? "sr-only" : ""), children: item.label }), item.badge ? (collapsed ? (_jsx("span", { className: "sr-only", children: badgeText(item.badge) })) : typeof item.badge === "number" ? (_jsxs("span", { className: "text-12 text-[var(--text-muted)] tabular-nums", children: [item.badge, _jsx("span", { className: "sr-only", children: " new" })] })) : (_jsx("span", { className: "size-1.5 rounded-full bg-[var(--error)]", children: _jsx("span", { className: "sr-only", children: ", new" }) }))) : null] })),
|
|
96
|
+
});
|
|
97
|
+
return collapsed ? (_jsx(Tip, { text: item.label, children: row }, item.id)) : (React.cloneElement(row, { key: item.id }));
|
|
98
|
+
})] }, `${group.label ?? ""}-${i}`))) }), footer && !collapsed ? _jsx("div", { className: "shrink-0 px-2 pt-2 pb-3", children: footer }) : null] }));
|
|
99
|
+
}
|
|
100
|
+
// ── The shell ──────────────────────────────────────────────────────────────────────────────────
|
|
101
|
+
function AppShell({ logo, logoMark, homeHref = "/", items, nav = "top", breadcrumbs, search, actions, account, sideFooter, renderLink, children, }) {
|
|
102
|
+
const link = renderLink ?? plainLink;
|
|
103
|
+
const side = nav === "side";
|
|
104
|
+
const collapsed = useCollapsed();
|
|
105
|
+
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
106
|
+
// ⌘B / Ctrl+B shrinks or widens the side menu, as in shadcn's Sidebar.
|
|
107
|
+
React.useEffect(() => {
|
|
108
|
+
if (!side)
|
|
109
|
+
return;
|
|
110
|
+
const onKey = (e) => {
|
|
111
|
+
if (e.key.toLowerCase() === "b" && (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey) {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
setCollapsed(!getCollapsed());
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
document.addEventListener("keydown", onKey);
|
|
117
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
118
|
+
}, [side]);
|
|
119
|
+
const divider = _jsx("span", { "aria-hidden": "true", className: "hidden h-6 w-px shrink-0 bg-[var(--border-default)] md:block" });
|
|
120
|
+
const logoLink = (children, onClick) => link({
|
|
121
|
+
href: homeHref,
|
|
122
|
+
onClick,
|
|
123
|
+
className: "flex min-w-0 shrink-0 items-center rounded-sm transition-opacity outline-none hover:opacity-80 focus-visible:ring-2 focus-visible:ring-[var(--primary)] focus-visible:ring-offset-2",
|
|
124
|
+
children,
|
|
125
|
+
});
|
|
126
|
+
const toggle = (_jsx(Tip, { text: collapsed ? "Expand menu (⌘B)" : "Collapse menu (⌘B)", children: _jsx(IconButton, { size: "sm", "aria-label": collapsed ? "Expand menu" : "Collapse menu", "aria-keyshortcuts": "Meta+B Control+B", onClick: () => setCollapsed(!collapsed), children: collapsed ? _jsx(PanelLeftOpen, {}) : _jsx(PanelLeftClose, {}) }) }));
|
|
127
|
+
// The search's size follows the top bar's own width (a container query), not the window's, so the bar
|
|
128
|
+
// looks the same in every app and both layouts: an icon below 760px of bar, a 240px pill from 760px,
|
|
129
|
+
// 280px from 1200px. It always sits by the launcher.
|
|
130
|
+
const searchSized = React.isValidElement(search)
|
|
131
|
+
? React.cloneElement(search, { className: cn(search.props.className, SEARCH_SIZE) })
|
|
132
|
+
: search;
|
|
133
|
+
// The right of the top bar, the same in every app: search, the launcher, your account.
|
|
134
|
+
const right = (_jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-3 pl-4 md:gap-4 md:pl-8", children: [search ? _jsx("div", { className: "flex shrink-0 items-center", children: searchSized }) : null, actions ? _jsx("div", { className: "flex shrink-0 items-center gap-2 md:gap-4", children: actions }) : null, account ? (_jsxs(_Fragment, { children: [actions || search ? _jsx("span", { "aria-hidden": "true", className: "h-6 w-px shrink-0 bg-[var(--border-default)]" }) : null, _jsx("div", { className: "flex shrink-0 items-center", children: account })] })) : null] }));
|
|
135
|
+
const topBar = (_jsx("header", { "data-slot": "app-shell-top-bar", className: "glass-chrome @container sticky top-0 z-50 h-14 shrink-0 border-b border-[var(--glass-border)] bg-[var(--glass-bg)] backdrop-blur-2xl backdrop-saturate-150", children: _jsxs("nav", { "aria-label": "Top bar", className: "flex h-full items-center gap-3 px-4 md:gap-5 md:px-6 lg:px-8", children: [side ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "-ml-1.5 md:hidden", children: _jsx(IconButton, { size: "sm", "aria-label": "Open menu", "aria-expanded": menuOpen, onClick: () => setMenuOpen(true), children: _jsx(Menu, {}) }) }), _jsx("span", { className: "flex min-w-0 overflow-hidden md:hidden", children: logoLink(logo) }), breadcrumbs ? _jsx("div", { className: "hidden min-w-0 shrink md:flex", children: breadcrumbs }) : null] })) : (_jsxs(_Fragment, { children: [logoLink(logo), items.length ? (_jsxs(_Fragment, { children: [divider, _jsx(TopTabs, { items: items, link: link })] })) : null] })), right] }) }));
|
|
136
|
+
return (_jsxs("div", { "data-slot": "app-shell", "data-nav": nav, className: cn("flex min-h-dvh", side ? "flex-row" : "flex-col"), children: [_jsx(SkipLink, {}), side ? (_jsxs("nav", { "aria-label": "Main", "data-slot": "app-shell-side-menu", "data-collapsed": collapsed || undefined, className: cn("sticky top-0 hidden h-dvh shrink-0 flex-col border-r border-[var(--border-divider)] bg-[var(--surface-primary)] transition-[width] duration-200 ease-out motion-reduce:transition-none md:flex", collapsed ? "w-14" : "w-56"), children: [collapsed ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex h-14 shrink-0 items-center justify-center border-b border-[var(--glass-border)] [&_img]:h-4 [&_img]:w-auto [&_svg]:h-4 [&_svg]:w-auto", children: logoMark ? logoLink(logoMark) : null }), _jsx("div", { className: "flex shrink-0 justify-center pt-3", children: toggle })] })) : (_jsxs("div", { className: "flex h-14 shrink-0 items-center gap-2 border-b border-[var(--glass-border)] pr-3 pl-4", children: [logoLink(logo), _jsx("span", { className: "ml-auto", children: toggle })] })), _jsx(SideMenu, { items: items, link: link, collapsed: collapsed, footer: sideFooter })] })) : null, _jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [topBar, _jsx("main", { id: "main", tabIndex: -1, className: cn("min-w-0 flex-1 outline-none", side ? "" : "max-md:pb-[calc(56px+env(safe-area-inset-bottom))]"), children: children })] }), !side && items.length ? _jsx(BottomBar, { items: items, link: link }) : null, side ? (_jsx(DialogPrimitive.Root, { open: menuOpen, onOpenChange: setMenuOpen, children: _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Backdrop, { className: "fixed inset-0 z-[60] bg-black/30 transition-opacity duration-300 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 md:hidden" }), _jsxs(DialogPrimitive.Popup, { "data-slot": "app-shell-menu-sheet", className: cn("fixed inset-y-0 left-0 z-[60] flex w-72 max-w-[85vw] flex-col bg-[var(--surface-elevated)] shadow-[var(--shadow-drawer)] outline-none md:hidden", "transition-[translate] duration-300 ease-out data-[ending-style]:-translate-x-full data-[starting-style]:-translate-x-full motion-reduce:transition-none"), children: [_jsxs("div", { className: "flex h-14 shrink-0 items-center justify-between gap-3 border-b border-[var(--border-divider)] px-4 pt-[env(safe-area-inset-top)]", children: [_jsx(DialogPrimitive.Title, { className: "sr-only", children: "Menu" }), link({ href: homeHref, onClick: () => setMenuOpen(false), className: "flex items-center rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)]", children: logo }), _jsx(DialogPrimitive.Close, { render: _jsx(IconButton, { size: "sm", "aria-label": "Close menu", children: _jsx(X, {}) }) })] }), _jsx(SideMenu, { items: items, link: link, collapsed: false, footer: sideFooter, onNavigate: () => setMenuOpen(false) })] })] }) })) : null] }));
|
|
137
|
+
}
|
|
138
|
+
export { AppShell };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type BreadcrumbsItem = {
|
|
3
|
+
/** "Firms". */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Leave it out on the last item: that's the page people are on. */
|
|
6
|
+
href?: string;
|
|
7
|
+
};
|
|
8
|
+
type BreadcrumbsLinkProps = {
|
|
9
|
+
href: string;
|
|
10
|
+
className: string;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
type BreadcrumbsProps = {
|
|
14
|
+
/** From the top down; the last is the page people are on. */
|
|
15
|
+
items: BreadcrumbsItem[];
|
|
16
|
+
/** Your router's link, as in AppShell: `(p) => <Link {...p} />`. Default a plain <a>. */
|
|
17
|
+
renderLink?: (props: BreadcrumbsLinkProps) => React.ReactElement;
|
|
18
|
+
className?: string;
|
|
19
|
+
};
|
|
20
|
+
declare function Breadcrumbs({ items, renderLink, className }: BreadcrumbsProps): React.JSX.Element;
|
|
21
|
+
export { Breadcrumbs };
|
|
22
|
+
export type { BreadcrumbsItem, BreadcrumbsLinkProps, BreadcrumbsProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronRight } from "lucide-react";
|
|
3
|
+
import { cn } from "@brdgapp/ui/lib/utils";
|
|
4
|
+
const plainLink = (props) => _jsx("a", { ...props });
|
|
5
|
+
function Breadcrumbs({ items, renderLink, className }) {
|
|
6
|
+
const link = renderLink ?? plainLink;
|
|
7
|
+
return (_jsx("nav", { "aria-label": "Breadcrumb", "data-slot": "breadcrumbs", className: cn("min-w-0", className), children: _jsx("ol", { className: "flex min-w-0 items-center gap-1.5 text-13", children: items.map((item, i) => {
|
|
8
|
+
const last = i === items.length - 1;
|
|
9
|
+
return (_jsxs("li", { className: cn("flex min-w-0 items-center gap-1.5", i < items.length - 2 ? "max-lg:hidden" : ""), children: [i > 0 ? _jsx(ChevronRight, { "aria-hidden": "true", className: "size-3.5 shrink-0 text-[var(--text-disabled)]" }) : null, last || !item.href ? (_jsx("span", { "aria-current": last ? "page" : undefined, className: cn("truncate", last ? "font-semibold text-[var(--text-primary)]" : "text-[var(--text-muted)]"), children: item.label })) : (link({
|
|
10
|
+
href: item.href,
|
|
11
|
+
className: "truncate rounded-sm text-[var(--text-muted)] transition-colors outline-none hover:text-[var(--text-primary)] focus-visible:ring-2 focus-visible:ring-[var(--primary)]",
|
|
12
|
+
children: item.label,
|
|
13
|
+
}))] }, `${item.label}-${i}`));
|
|
14
|
+
}) }) }));
|
|
15
|
+
}
|
|
16
|
+
export { Breadcrumbs };
|
package/components/data-table.js
CHANGED
|
@@ -90,7 +90,10 @@ function DataTable({ columns, rows, rowKey, onRowClick, onRowPrefetch, rowProps,
|
|
|
90
90
|
* so it stays while the rows load, fail or filter down to nothing.
|
|
91
91
|
*/
|
|
92
92
|
function DataTableToolbar({ search, filters, actions, ...rest }) {
|
|
93
|
-
return (_jsxs("div", { ...rest, "data-slot": "data-table-toolbar", className: "flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-[var(--border-divider)] px-6 py-3", children: [search ? _jsx("div", { className: "w-full md:w-72 [&>*]:w-full", children: search }) : null, filters || actions ? (
|
|
93
|
+
return (_jsxs("div", { ...rest, "data-slot": "data-table-toolbar", className: "flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-[var(--border-divider)] px-6 py-3", children: [search ? _jsx("div", { className: "w-full md:w-72 [&>*]:w-full", children: search }) : null, filters || actions ? (
|
|
94
|
+
// Beside a search, filters and actions sit at the right. Without one, filters start at the left
|
|
95
|
+
// (a drawer's row of FilterChips) and actions stay at the right.
|
|
96
|
+
_jsxs("div", { className: cn("flex flex-1 flex-wrap items-center gap-3", search ? "md:justify-end" : ""), children: [filters ? _jsx("div", { className: "flex flex-wrap items-center gap-2", children: filters }) : null, actions ? _jsx("div", { className: cn("flex flex-wrap items-center gap-2", search ? "" : "ml-auto"), children: actions }) : null] })) : null] }));
|
|
94
97
|
}
|
|
95
98
|
/**
|
|
96
99
|
* The loading body for a DataTable. Takes the same column list (without `render`), so its widths and
|
package/components/drawer.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { DialogAction } from "@brdgapp/ui/components/dialog";
|
|
|
3
3
|
declare const WIDTH: {
|
|
4
4
|
readonly item: "md:max-w-xl";
|
|
5
5
|
readonly list: "md:max-w-2xl";
|
|
6
|
+
readonly wide: "md:max-w-[min(1152px,calc(100vw-64px))]";
|
|
6
7
|
};
|
|
7
8
|
type DrawerProps = {
|
|
8
9
|
open: boolean;
|
|
@@ -11,8 +12,11 @@ type DrawerProps = {
|
|
|
11
12
|
title: React.ReactNode;
|
|
12
13
|
/** One line under the title: who, when. */
|
|
13
14
|
subtitle?: React.ReactNode;
|
|
14
|
-
/** `item` 576px for one record; `list` 672px for a list
|
|
15
|
+
/** `item` 576px for one record; `list` 672px for a list; `wide` 1152px for a table or a two-pane editor, with
|
|
16
|
+
* no padding round the body so it runs edge to edge. A phone fills the screen either way. */
|
|
15
17
|
size?: keyof typeof WIDTH;
|
|
18
|
+
/** Pinned under the header, above the scrolling body: a DataTableToolbar with the search and filters. */
|
|
19
|
+
toolbar?: React.ReactNode;
|
|
16
20
|
/** Actions beside the close button, such as an ActionMenu. Not Save: that goes in `primaryAction`. */
|
|
17
21
|
actions?: React.ReactNode;
|
|
18
22
|
/** For a drawer that edits: the footer's one filled button, bottom right. Spins while `busy`. */
|
|
@@ -26,6 +30,6 @@ type DrawerProps = {
|
|
|
26
30
|
children: React.ReactNode;
|
|
27
31
|
className?: string;
|
|
28
32
|
};
|
|
29
|
-
declare function Drawer({ open, onClose, title, subtitle, size, actions, primaryAction, cancelLabel, dangerAction, busy, children, className, }: DrawerProps): React.JSX.Element;
|
|
33
|
+
declare function Drawer({ open, onClose, title, subtitle, size, actions, toolbar, primaryAction, cancelLabel, dangerAction, busy, children, className, }: DrawerProps): React.JSX.Element;
|
|
30
34
|
export { Drawer };
|
|
31
35
|
export type { DrawerProps };
|
package/components/drawer.js
CHANGED
|
@@ -19,15 +19,22 @@ import { cn } from "@brdgapp/ui/lib/utils";
|
|
|
19
19
|
// still slides in from the right, and it is not a dialog: Save stays in the footer. An edit drawer has a footer pinned at the bottom
|
|
20
20
|
// (`primaryAction`, `cancelLabel`, `dangerAction`, the same options as Dialog); Save is never in the header,
|
|
21
21
|
// next to ✕. The header and footer stay put and only the body scrolls. Reduced motion: it fades, no slide.
|
|
22
|
-
|
|
22
|
+
//
|
|
23
|
+
// Added 2026-11-16 (Aman: "if a variant can solve the problem do the variant"), for Bridge OS's 1152px
|
|
24
|
+
// "Your contacts" table and app-directories' 896px page builder, the only side panels wider than 672px in
|
|
25
|
+
// the 12 apps: a third width, `wide`, 1152px, whose body runs edge to edge for a table or a two-pane editor,
|
|
26
|
+
// and always leaves 64px of the page showing on the left. And `toolbar`, pinned under the header so search and
|
|
27
|
+
// filters stay put while the list scrolls (both Bridge OS list drawers have them). It takes a DataTableToolbar,
|
|
28
|
+
// the one row for search and filters everywhere, so the drawer adds no styling of its own.
|
|
29
|
+
const WIDTH = { item: "md:max-w-xl", list: "md:max-w-2xl", wide: "md:max-w-[min(1152px,calc(100vw-64px))]" };
|
|
23
30
|
const FIRST_FIELD = "input:not([disabled]):not([type=hidden]), textarea:not([disabled]), select:not([disabled]), [contenteditable=true]";
|
|
24
|
-
function Drawer({ open, onClose, title, subtitle, size = "item", actions, primaryAction, cancelLabel = "Cancel", dangerAction, busy = false, children, className, }) {
|
|
31
|
+
function Drawer({ open, onClose, title, subtitle, size = "item", actions, toolbar, primaryAction, cancelLabel = "Cancel", dangerAction, busy = false, children, className, }) {
|
|
25
32
|
const body = React.useRef(null);
|
|
26
33
|
return (_jsx(DialogPrimitive.Root, { open: open, onOpenChange: (next) => !next && !busy && onClose(), children: _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Backdrop, { className: "fixed inset-x-0 top-0 bottom-0 z-[60] md:top-14 bg-black/30 transition-opacity duration-300 ease-out data-[ending-style]:duration-200 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0" }), _jsxs(DialogPrimitive.Popup, { "data-slot": "drawer", "data-size": size,
|
|
27
34
|
// An edit drawer starts in its first field; a details drawer starts on its first control.
|
|
28
35
|
initialFocus: (openType) => (openType === "touch" ? true : (body.current?.querySelector(FIRST_FIELD) ?? true)), className: cn(
|
|
29
36
|
// Phone: the whole screen. Computer: below the top bar, from the right edge.
|
|
30
|
-
"fixed inset-0 z-[60] flex w-full flex-col bg-[var(--surface-elevated)] outline-none md:top-14 md:left-auto md:border-l md:border-[var(--border-default)] md:shadow-[var(--shadow-drawer)]", "transition-[translate,opacity] duration-300 ease-out data-[ending-style]:duration-200 data-[starting-style]:translate-x-full data-[ending-style]:translate-x-full", "motion-reduce:transition-opacity motion-reduce:data-[starting-style]:translate-x-0 motion-reduce:data-[ending-style]:translate-x-0 motion-reduce:data-[starting-style]:opacity-0 motion-reduce:data-[ending-style]:opacity-0", WIDTH[size], className), children: [_jsxs("header", { "data-slot": "drawer-header", className: "flex shrink-0 items-start gap-2 border-b border-[var(--border-divider)] px-6 py-4 max-md:px-5 max-md:pt-[max(16px,env(safe-area-inset-top))]", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx(DialogPrimitive.Title, { className: "truncate text-18 font-bold tracking-tight text-[var(--text-primary)]", children: title }), subtitle ? (_jsx(DialogPrimitive.Description, { className: "mt-0.5 truncate text-12 leading-normal text-[var(--text-muted)]", children: subtitle })) : null] }), actions, _jsx(DialogPrimitive.Close, { disabled: busy, render: _jsx(IconButton, { "aria-label": "Close", size: "sm", children: _jsx(X, {}) }) })] }), _jsx("div", { ref: body, "data-slot": "drawer-body", className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-5 max-md:px-5", children: children }), primaryAction || dangerAction ? (_jsxs("footer", { "data-slot": "drawer-footer", className: "flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-[var(--border-divider)] px-6 py-4 pb-[max(16px,env(safe-area-inset-bottom))] max-md:px-5", children: [dangerAction ? (_jsx(Button, { variant: "danger-ghost", size: "md", icon: dangerAction.icon, disabled: busy || dangerAction.disabled, onClick: dangerAction.onClick,
|
|
37
|
+
"fixed inset-0 z-[60] flex w-full flex-col bg-[var(--surface-elevated)] outline-none md:top-14 md:left-auto md:border-l md:border-[var(--border-default)] md:shadow-[var(--shadow-drawer)]", "transition-[translate,opacity] duration-300 ease-out data-[ending-style]:duration-200 data-[starting-style]:translate-x-full data-[ending-style]:translate-x-full", "motion-reduce:transition-opacity motion-reduce:data-[starting-style]:translate-x-0 motion-reduce:data-[ending-style]:translate-x-0 motion-reduce:data-[starting-style]:opacity-0 motion-reduce:data-[ending-style]:opacity-0", WIDTH[size], className), children: [_jsxs("header", { "data-slot": "drawer-header", className: "flex shrink-0 items-start gap-2 border-b border-[var(--border-divider)] px-6 py-4 max-md:px-5 max-md:pt-[max(16px,env(safe-area-inset-top))]", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx(DialogPrimitive.Title, { className: "truncate text-18 font-bold tracking-tight text-[var(--text-primary)]", children: title }), subtitle ? (_jsx(DialogPrimitive.Description, { className: "mt-0.5 truncate text-12 leading-normal text-[var(--text-muted)]", children: subtitle })) : null] }), actions, _jsx(DialogPrimitive.Close, { disabled: busy, render: _jsx(IconButton, { "aria-label": "Close", size: "sm", children: _jsx(X, {}) }) })] }), toolbar ? (_jsx("div", { "data-slot": "drawer-toolbar", className: "shrink-0", children: toolbar })) : null, _jsx("div", { ref: body, "data-slot": "drawer-body", className: cn("min-h-0 flex-1 overflow-y-auto overscroll-contain", size === "wide" ? "" : "px-6 py-5 max-md:px-5"), children: children }), primaryAction || dangerAction ? (_jsxs("footer", { "data-slot": "drawer-footer", className: "flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-[var(--border-divider)] px-6 py-4 pb-[max(16px,env(safe-area-inset-bottom))] max-md:px-5", children: [dangerAction ? (_jsx(Button, { variant: "danger-ghost", size: "md", icon: dangerAction.icon, disabled: busy || dangerAction.disabled, onClick: dangerAction.onClick,
|
|
31
38
|
// Phone: its own row above Cancel and the main button, so the three never squeeze into one.
|
|
32
39
|
className: "mr-auto max-md:mr-0 max-md:w-full", children: dangerAction.label })) : null, primaryAction ? (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "secondary", size: "md", disabled: busy, onClick: onClose, className: "max-md:flex-1", children: cancelLabel }), _jsx(Button, { size: "md", loading: busy, disabled: primaryAction.disabled, icon: primaryAction.icon, onClick: primaryAction.onClick, className: "max-md:flex-1", children: primaryAction.label })] })) : null] })) : null] })] }) }));
|
|
33
40
|
}
|
package/components/tag.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type * as React from "react";
|
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
import { type ElementProps } from "@brdgapp/ui/lib/utils";
|
|
4
4
|
declare const tagVariants: (props?: ({
|
|
5
|
-
color?: "
|
|
5
|
+
color?: "grey" | "blue" | "green" | "yellow" | "red" | "purple" | null | undefined;
|
|
6
6
|
size?: "sm" | "md" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
type TagProps = VariantProps<typeof tagVariants> & ElementProps & {
|
package/package.json
CHANGED