@brdgapp/ui 1.6.2 → 1.6.3
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 +8 -0
- package/components/app-shell.d.ts +1 -1
- package/components/app-shell.js +26 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Every release of `@brdgapp/ui`. Versions follow the rules in README.md → Versions.
|
|
4
4
|
|
|
5
|
+
## 1.6.3
|
|
6
|
+
|
|
7
|
+
2026-11-17. AppShell on narrow phones. Nothing changes for apps already on 1.6.
|
|
8
|
+
|
|
9
|
+
- AppShell: on a phone too narrow for the full logo beside search, the launcher and your account, the top
|
|
10
|
+
bar shows `logoMark` instead, and the right of the bar no longer runs over the logo. Pass `logoMark` with
|
|
11
|
+
`nav="top"` too; without it the logo is cut off at its edge.
|
|
12
|
+
|
|
5
13
|
## 1.6.2
|
|
6
14
|
|
|
7
15
|
2026-11-17. A wider search in AppShell. Nothing changes for apps already on 1.6.
|
|
@@ -24,7 +24,7 @@ type AppShellLinkProps = {
|
|
|
24
24
|
type AppShellProps = {
|
|
25
25
|
/** The app's lockup, `<AppLockup name="Bridge OS" />`: the Bridge icon and the app's name, 16px tall. Links home. */
|
|
26
26
|
logo: React.ReactNode;
|
|
27
|
-
/**
|
|
27
|
+
/** `<AppLockup name="Bridge OS" mark />`, the Bridge icon alone: at the top of the shrunk side menu, and in the top bar of a phone too narrow for the full logo. The shell draws it 16px tall, as in the full logo. */
|
|
28
28
|
logoMark?: React.ReactNode;
|
|
29
29
|
/** Where the logo goes. Default "/". */
|
|
30
30
|
homeHref?: string;
|
package/components/app-shell.js
CHANGED
|
@@ -99,6 +99,28 @@ function SideMenu({ items, link, collapsed, footer, onNavigate, }) {
|
|
|
99
99
|
return collapsed ? (_jsx(Tip, { text: item.label, children: row }, item.id)) : (React.cloneElement(row, { key: item.id }));
|
|
100
100
|
})] }, `${group.label ?? ""}-${i}`))) }), footer && !collapsed ? _jsx("div", { className: "shrink-0 px-2 pt-2 pb-3", children: footer }) : null] }));
|
|
101
101
|
}
|
|
102
|
+
// The logo in the top bar. On a narrow phone the full lockup can't fit beside ☰, search, the launcher and
|
|
103
|
+
// your account (Bridge OS needs a 370px bar with a side menu), so it becomes the mark instead of running under
|
|
104
|
+
// them. A hidden copy measures the full logo against the room the bar leaves it.
|
|
105
|
+
function BarLogo({ logo, mark, link, className }) {
|
|
106
|
+
const box = React.useRef(null);
|
|
107
|
+
const full = React.useRef(null);
|
|
108
|
+
const [tight, setTight] = React.useState(false);
|
|
109
|
+
React.useLayoutEffect(() => {
|
|
110
|
+
const b = box.current;
|
|
111
|
+
const f = full.current;
|
|
112
|
+
if (!mark || !b || !f || typeof ResizeObserver === "undefined")
|
|
113
|
+
return;
|
|
114
|
+
const check = () => setTight(f.offsetWidth > b.clientWidth + 0.5);
|
|
115
|
+
const observer = new ResizeObserver(check);
|
|
116
|
+
observer.observe(b);
|
|
117
|
+
observer.observe(f);
|
|
118
|
+
check();
|
|
119
|
+
return () => observer.disconnect();
|
|
120
|
+
}, [mark]);
|
|
121
|
+
const useMark = tight && mark;
|
|
122
|
+
return (_jsxs("span", { ref: box, className: cn("relative flex min-w-0 items-center overflow-hidden", useMark && "[&_img]:h-4 [&_img]:w-auto [&_svg]:h-4 [&_svg]:w-auto", className), children: [link(useMark ? mark : logo), mark ? (_jsx("span", { ref: full, "aria-hidden": "true", inert: true, className: "pointer-events-none invisible absolute top-0 left-0 flex whitespace-nowrap", children: logo })) : null] }));
|
|
123
|
+
}
|
|
102
124
|
// ── The shell ──────────────────────────────────────────────────────────────────────────────────
|
|
103
125
|
function AppShell({ logo, logoMark, homeHref = "/", items, nav = "top", breadcrumbs, search, actions, account, sideFooter, renderLink, children, }) {
|
|
104
126
|
const link = renderLink ?? plainLink;
|
|
@@ -133,9 +155,10 @@ function AppShell({ logo, logoMark, homeHref = "/", items, nav = "top", breadcru
|
|
|
133
155
|
const searchSized = React.isValidElement(search)
|
|
134
156
|
? React.cloneElement(search, { className: cn(search.props.className, SEARCH_SIZE) })
|
|
135
157
|
: search;
|
|
136
|
-
// The right of the top bar, the same in every app: search, the launcher, your account.
|
|
137
|
-
|
|
138
|
-
const
|
|
158
|
+
// The right of the top bar, the same in every app: search, the launcher, your account. Under 640px of bar it
|
|
159
|
+
// keeps its own width, so it never runs over the logo; the logo gives way instead (BarLogo).
|
|
160
|
+
const right = (_jsxs("div", { className: "ml-auto flex min-w-0 flex-1 items-center justify-end gap-3 pl-4 @max-[639px]/bar:flex-none md:gap-4 md:pl-8", children: [search ? _jsx("div", { className: "@container/search flex min-w-9 flex-1 items-center justify-end", 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] }));
|
|
161
|
+
const topBar = (_jsx("header", { "data-slot": "app-shell-top-bar", className: "glass-chrome @container/bar 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(BarLogo, { logo: logo, mark: logoMark, link: (c) => logoLink(c), className: "flex-1 md:hidden" }), breadcrumbs ? _jsx("div", { className: "hidden min-w-0 shrink md:flex", children: breadcrumbs }) : null] })) : (_jsxs(_Fragment, { children: [_jsx(BarLogo, { logo: logo, mark: logoMark, link: (c) => logoLink(c), className: "shrink-0 max-md:flex-1" }), items.length ? (_jsxs(_Fragment, { children: [divider, _jsx(TopTabs, { items: items, link: link })] })) : null] })), right] }) }));
|
|
139
162
|
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] }));
|
|
140
163
|
}
|
|
141
164
|
export { AppShell };
|
package/package.json
CHANGED