@brdgapp/ui 1.8.0 → 1.10.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 CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  Every release of `@brdgapp/ui`. Versions follow the rules in README.md → Versions.
4
4
 
5
+ ## 1.10.0
6
+
7
+ 2026-11-19. Light by default, the top bar's edges, and Lucide's current icon names. Nothing to change in an
8
+ app's code.
9
+
10
+ - Changed: someone who hasn't chosen a theme now sees Light, not their device's setting. Light, Dark and
11
+ System are still the three choices in ThemeSwitch, and a saved choice is kept.
12
+ - Fix: AppShell's top bar has the page's edges at every width (16, then 24px from 640px, then 32px from
13
+ 1024px), so the logo lines up with the page title between 640 and 768px.
14
+ - Fix: the package draws its spinner and ⋮ with Lucide's current names, `LoaderCircle` and
15
+ `EllipsisVertical`. They look the same.
16
+
17
+ ## 1.9.0
18
+
19
+ 2026-11-19. Select, and menus open inside dialogs. Nothing changes for apps already on 1.8.
20
+
21
+ - New: Select (`components/select`), a field that opens a list, for picking one value in a form. It looks
22
+ like Input, works inside Field (FieldLabel, FieldDescription, FieldError), and takes `options` with an
23
+ optional `description` and `icon`. Typing a letter jumps to an option. On phones it opens as a bottom sheet.
24
+ - Menus, popovers, tips, hover cards and bottom sheets (ActionMenu, FilterPill, ColumnFilterMenu, Popover,
25
+ InfoHint, HoverCard, BottomSheet) moved from layer 80 to 95, above dialogs (90) and under toasts (100). Opened
26
+ from inside a Dialog, they were drawn behind its dimmed background and couldn't be clicked.
27
+
5
28
  ## 1.8.0
6
29
 
7
30
  2026-11-19. A label option on Switch. Nothing changes for apps already on 1.7.
@@ -21,7 +44,7 @@ Every release of `@brdgapp/ui`. Versions follow the rules in README.md → Versi
21
44
 
22
45
  ## 1.6.3
23
46
 
24
- 2026-11-17. AppShell on narrow phones. Nothing changes for apps already on 1.6.
47
+ 2026-11-17. AppShell on narrow phones. Apps with `nav="top"` pass `logoMark` too.
25
48
 
26
49
  - AppShell: on a phone too narrow for the full logo beside search, the launcher and your account, the top
27
50
  bar shows `logoMark` instead, and the right of the bar no longer runs over the logo. Pass `logoMark` with
package/README.md CHANGED
@@ -45,7 +45,12 @@ as the family is "Mulish".
45
45
  If Mulish doesn't load, `<Toaster />` says so in the browser console while you develop, and the handbook's
46
46
  `check_code` flags a root layout that doesn't load it.
47
47
 
48
- Themes follow `data-theme="light"` or `data-theme="dark"` on `<html>`, not the device setting.
48
+ Themes follow `data-theme="light"` or `data-theme="dark"` on `<html>`, set before the page paints by
49
+ `themeScript`: Light until the person picks Light, Dark or System in ThemeSwitch.
50
+
51
+ The root layout also wraps the app in `<TipProvider>` with one `<Toaster />`, and draws AppShell, which
52
+ brings the skip link, the top bar and the one `<main>`. The whole layout, for Next.js and Vite:
53
+ https://handbook.brdg.app/using-the-system#setup
49
54
 
50
55
  ## Use
51
56
 
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { createContext, useCallback, useContext, useMemo, useState } from "react";
4
4
  import { Menu } from "@base-ui/react/menu";
5
- import { MoreVertical } from "lucide-react";
5
+ import { EllipsisVertical } from "lucide-react";
6
6
  import { IconButton } from "@brdgapp/ui/components/icon-button";
7
7
  import { Tip } from "@brdgapp/ui/components/info-hint";
8
8
  import { cn } from "@brdgapp/ui/lib/utils";
@@ -36,7 +36,7 @@ function ActionMenu({ ariaLabel = "More options", size = "md", width = 248, alig
36
36
  const stop = stopPropagation ? (e) => e.stopPropagation() : undefined;
37
37
  return (_jsxs(Menu.Root, { open: open, onOpenChange: setOpenAndNotify, children: [renderTrigger ? (_jsx(Menu.Trigger, { render: (props) => renderTrigger(props, { open }) })) : (
38
38
  // The same words as the trigger's name, in a Tip, so people who see it and people who hear it get one name.
39
- _jsx(Tip, { text: ariaLabel, disabled: open, children: _jsx(Menu.Trigger, { render: _jsx(IconButton, { "aria-label": ariaLabel, size: size, className: cn("shrink-0", triggerClassName), children: icon ?? _jsx(MoreVertical, {}) }), onClick: stop, onPointerDown: stop }) })), _jsx(Menu.Portal, { children: _jsx(Menu.Positioner, { side: "bottom", align: align, sideOffset: 6, collisionPadding: 8, className: "z-[80]", children: _jsx(Menu.Popup, { "data-slot": "action-menu", style: { width }, className: cn("max-w-[calc(100vw-16px)] rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] py-1 shadow-[var(--shadow-menu)] outline-none", "origin-[var(--transform-origin)] transition-[opacity,scale] duration-200 ease-out data-[ending-style]:duration-150 data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0", menuClassName), children: _jsx(ActionMenuContext.Provider, { value: ctx, children: typeof children === "function" ? children(close) : children }) }) }) })] }));
39
+ _jsx(Tip, { text: ariaLabel, disabled: open, children: _jsx(Menu.Trigger, { render: _jsx(IconButton, { "aria-label": ariaLabel, size: size, className: cn("shrink-0", triggerClassName), children: icon ?? _jsx(EllipsisVertical, {}) }), onClick: stop, onPointerDown: stop }) })), _jsx(Menu.Portal, { children: _jsx(Menu.Positioner, { side: "bottom", align: align, sideOffset: 6, collisionPadding: 8, className: "z-[95]", children: _jsx(Menu.Popup, { "data-slot": "action-menu", style: { width }, className: cn("max-w-[calc(100vw-16px)] rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] py-1 shadow-[var(--shadow-menu)] outline-none", "origin-[var(--transform-origin)] transition-[opacity,scale] duration-200 ease-out data-[ending-style]:duration-150 data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0", menuClassName), children: _jsx(ActionMenuContext.Provider, { value: ctx, children: typeof children === "function" ? children(close) : children }) }) }) })] }));
40
40
  }
41
41
  function ActionMenuItem({ icon, children, description, onClick, href, external = false, danger = false, disabled = false, closeOnClick = true, render, className, }) {
42
42
  const classes = cn(ACTION_MENU_ITEM_CLASS, danger && ACTION_MENU_ITEM_DANGER_CLASS, description && "items-start", className);
@@ -158,7 +158,7 @@ function AppShell({ logo, logoMark, homeHref = "/", items, nav = "top", breadcru
158
158
  // The right of the top bar, the same in every app: search, the launcher, your account. Under 640px of bar it
159
159
  // keeps its own width, so it never runs over the logo; the logo gives way instead (BarLogo).
160
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] }) }));
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 sm:px-6 md:gap-5 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] }) }));
162
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] }));
163
163
  }
164
164
  export { AppShell };
@@ -38,7 +38,7 @@ function BottomSheet({ open, onClose, title, children, primaryAction, cancelLabe
38
38
  return (_jsx(DialogPrimitive.Root, { open: open, onOpenChange: (next) => !next && onClose(), onOpenChangeComplete: (isOpen) => {
39
39
  if (!isOpen)
40
40
  setDrag(null);
41
- }, children: _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Backdrop, { className: "fixed inset-0 z-[80] 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, { ref: popup, "data-slot": "bottom-sheet", "aria-labelledby": titleId, style: drag === null ? undefined : { translate: `0 ${drag}px`, transition: dragging ? "none" : undefined }, className: cn("fixed inset-x-0 bottom-0 z-[80] flex max-h-[85dvh] flex-col rounded-t-2xl border-t border-[var(--border-default)] bg-[var(--surface-elevated)] shadow-[var(--shadow-dialog)] outline-none", primaryAction ? null : "pb-[max(12px,env(safe-area-inset-bottom))]", "transition-[translate] duration-300 ease-out data-[ending-style]:duration-200 data-[starting-style]:translate-y-full data-[ending-style]:translate-y-full motion-reduce:transition-none"), children: [_jsxs("div", { "data-slot": "bottom-sheet-grab", className: "shrink-0 cursor-grab touch-none select-none active:cursor-grabbing", onPointerDown: (e) => {
41
+ }, children: _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Backdrop, { className: "fixed inset-0 z-[95] 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, { ref: popup, "data-slot": "bottom-sheet", "aria-labelledby": titleId, style: drag === null ? undefined : { translate: `0 ${drag}px`, transition: dragging ? "none" : undefined }, className: cn("fixed inset-x-0 bottom-0 z-[95] flex max-h-[85dvh] flex-col rounded-t-2xl border-t border-[var(--border-default)] bg-[var(--surface-elevated)] shadow-[var(--shadow-dialog)] outline-none", primaryAction ? null : "pb-[max(12px,env(safe-area-inset-bottom))]", "transition-[translate] duration-300 ease-out data-[ending-style]:duration-200 data-[starting-style]:translate-y-full data-[ending-style]:translate-y-full motion-reduce:transition-none"), children: [_jsxs("div", { "data-slot": "bottom-sheet-grab", className: "shrink-0 cursor-grab touch-none select-none active:cursor-grabbing", onPointerDown: (e) => {
42
42
  if (e.button !== 0)
43
43
  return;
44
44
  start.current = { y: e.clientY, t: performance.now() };
@@ -4,7 +4,7 @@ import { Button as ButtonPrimitive } from "@base-ui/react/button";
4
4
  import { mergeProps } from "@base-ui/react/merge-props";
5
5
  import { useRender } from "@base-ui/react/use-render";
6
6
  import { cva } from "class-variance-authority";
7
- import { Loader2 } from "lucide-react";
7
+ import { LoaderCircle } from "lucide-react";
8
8
  import { cn } from "@brdgapp/ui/lib/utils";
9
9
  // Started from shadcn's Base UI button (style base-nova), then moved onto Bridge's tokens and API.
10
10
  // Look and API match Bridge OS src/components/ui/button.tsx (components.md, 2026-10-29); `asChild`
@@ -71,7 +71,7 @@ function Button({ className, variant, size, fullWidth, icon, loading = false, di
71
71
  });
72
72
  if (rendered)
73
73
  return rendered;
74
- return (_jsxs(ButtonPrimitive, { "data-slot": "button", className: classes, disabled: disabled || loading, "aria-busy": loading || undefined, ...props, children: [loading ? (_jsx(Loader2, { "data-slot": "button-spinner", className: "animate-spin", "aria-hidden": "true" })) : icon ? (_jsx("span", { "data-slot": "button-icon", className: "inline-flex shrink-0", "aria-hidden": "true", children: icon })) : null, children] }));
74
+ return (_jsxs(ButtonPrimitive, { "data-slot": "button", className: classes, disabled: disabled || loading, "aria-busy": loading || undefined, ...props, children: [loading ? (_jsx(LoaderCircle, { "data-slot": "button-spinner", className: "animate-spin", "aria-hidden": "true" })) : icon ? (_jsx("span", { "data-slot": "button-icon", className: "inline-flex shrink-0", "aria-hidden": "true", children: icon })) : null, children] }));
75
75
  }
76
76
  const buttonSkeletonHeights = { xs: "h-7", sm: "h-8", md: "h-11 md:h-10", lg: "h-12" };
77
77
  /**
@@ -3,7 +3,7 @@ import { createElement as _createElement } from "react";
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import { Button as ButtonPrimitive } from "@base-ui/react/button";
5
5
  import * as React from "react";
6
- import { ChevronLeft, ChevronRight, Loader2, Plus } from "lucide-react";
6
+ import { ChevronLeft, ChevronRight, LoaderCircle, Plus } from "lucide-react";
7
7
  import { IconButton } from "@brdgapp/ui/components/icon-button";
8
8
  import { Tip } from "@brdgapp/ui/components/info-hint";
9
9
  import { cn } from "@brdgapp/ui/lib/utils";
@@ -131,6 +131,6 @@ function DataTablePagination({ page, pageSize, totalCount, loading = false, onPa
131
131
  if (totalPages <= 1)
132
132
  return null;
133
133
  const n = (v) => v.toLocaleString("en-US");
134
- return (_jsxs("nav", { "data-slot": "data-table-pagination", "aria-label": "Pages", className: "flex items-center justify-between gap-4 px-6 py-3", children: [_jsxs("p", { className: "shrink-0 text-12 leading-normal tabular-nums text-[var(--text-muted)]", children: [n((page - 1) * pageSize + 1), "\u2013", n(Math.min(page * pageSize, totalCount)), " of ", n(totalCount)] }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx(ButtonPrimitive, { onClick: () => onPageChange(page - 1), disabled: page === 1 || loading, "aria-label": "Previous page", className: pagerButton, children: _jsx(ChevronLeft, { "aria-hidden": "true", className: "size-3.5" }) }), pageList(page, totalPages).map((p, i) => p === "…" ? (_jsx("span", { "aria-hidden": "true", className: "flex size-7 items-center justify-center text-12 text-[var(--text-muted)]", children: "\u2026" }, `gap-${i}`)) : (_jsx(ButtonPrimitive, { onClick: () => onPageChange(p), disabled: loading, "aria-label": `Page ${p}`, "aria-current": p === page ? "page" : undefined, className: cn(pagerButton, "w-auto min-w-7 px-1.5 text-12 font-semibold tabular-nums disabled:opacity-100", p === page && "bg-[var(--primary-solid)] text-white hover:bg-[var(--primary-solid)] hover:text-white"), children: loading && p === page ? _jsx(Loader2, { "aria-hidden": "true", className: "mx-auto size-3 animate-spin" }) : p }, p))), _jsx(ButtonPrimitive, { onClick: () => onPageChange(page + 1), disabled: page === totalPages || loading, "aria-label": "Next page", className: pagerButton, children: _jsx(ChevronRight, { "aria-hidden": "true", className: "size-3.5" }) })] })] }));
134
+ return (_jsxs("nav", { "data-slot": "data-table-pagination", "aria-label": "Pages", className: "flex items-center justify-between gap-4 px-6 py-3", children: [_jsxs("p", { className: "shrink-0 text-12 leading-normal tabular-nums text-[var(--text-muted)]", children: [n((page - 1) * pageSize + 1), "\u2013", n(Math.min(page * pageSize, totalCount)), " of ", n(totalCount)] }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx(ButtonPrimitive, { onClick: () => onPageChange(page - 1), disabled: page === 1 || loading, "aria-label": "Previous page", className: pagerButton, children: _jsx(ChevronLeft, { "aria-hidden": "true", className: "size-3.5" }) }), pageList(page, totalPages).map((p, i) => p === "…" ? (_jsx("span", { "aria-hidden": "true", className: "flex size-7 items-center justify-center text-12 text-[var(--text-muted)]", children: "\u2026" }, `gap-${i}`)) : (_jsx(ButtonPrimitive, { onClick: () => onPageChange(p), disabled: loading, "aria-label": `Page ${p}`, "aria-current": p === page ? "page" : undefined, className: cn(pagerButton, "w-auto min-w-7 px-1.5 text-12 font-semibold tabular-nums disabled:opacity-100", p === page && "bg-[var(--primary-solid)] text-white hover:bg-[var(--primary-solid)] hover:text-white"), children: loading && p === page ? _jsx(LoaderCircle, { "aria-hidden": "true", className: "mx-auto size-3 animate-spin" }) : p }, p))), _jsx(ButtonPrimitive, { onClick: () => onPageChange(page + 1), disabled: page === totalPages || loading, "aria-label": "Next page", className: pagerButton, children: _jsx(ChevronRight, { "aria-hidden": "true", className: "size-3.5" }) })] })] }));
135
135
  }
136
136
  export { DataTable, DataTableHeader, DataTableSkeleton, DataTablePagination, DataTableToolbar };
@@ -11,7 +11,7 @@ import { cn } from "@brdgapp/ui/lib/utils";
11
11
  // below the 56px top bar, over a dimmed page; Escape, the scrim or ✕ closes it. Two widths: `item` (576px,
12
12
  // one intro) and `list` (672px, a relationship or a week of contacts). Built on Base UI Dialog: focus is
13
13
  // trapped and returns to the opener; a drawer opened from a drawer closes first on Escape. z-[60], Bridge's
14
- // layer for search and drawers, so menus (80) and confirms (90) opened from it sit above.
14
+ // layer for search and drawers, so confirms (90) and menus (95) opened from it sit above.
15
15
  //
16
16
  // Decisions (Aman, 2026-11-06), after Canon's Sheet and shadcn's Sheet: a side panel is for a computer's big
17
17
  // screen. On a phone (below 768px) the drawer fills the whole screen, over the top bar too, keeping the same
@@ -11,7 +11,7 @@ import { useIsMobile } from "@brdgapp/ui/hooks/use-is-mobile";
11
11
  import { cn } from "@brdgapp/ui/lib/utils";
12
12
  /** The menu body shared by FilterPill and ColumnFilterMenu. */
13
13
  function FilterMenuPopup({ value, options, onChange, width, align, }) {
14
- return (_jsx(Menu.Portal, { children: _jsx(Menu.Positioner, { side: "bottom", align: align, sideOffset: 6, collisionPadding: 8, className: "z-[80]", children: _jsx(Menu.Popup, { "data-slot": "filter-menu", style: { minWidth: width }, className: "max-h-[320px] overflow-y-auto rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] py-1 shadow-[var(--shadow-menu)] outline-none transition-opacity duration-200 ease-out data-[ending-style]:duration-150 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0", children: _jsx(Menu.RadioGroup, { value: value, onValueChange: (v) => onChange(v), children: options.map((option) => (_jsxs(Menu.RadioItem, { value: option.value, closeOnClick: true, "data-slot": "filter-menu-option", className: "group flex w-full cursor-default items-center justify-between gap-3 px-3 py-2 text-left text-13 leading-normal text-[var(--text-body)] outline-none transition-colors data-[checked]:font-semibold data-[checked]:text-[var(--text-primary)] data-[highlighted]:bg-[var(--surface-secondary)] hover:bg-[var(--surface-secondary)]", children: [_jsx("span", { className: "truncate", children: option.label }), _jsx(Menu.RadioItemIndicator, { className: "inline-flex shrink-0", children: _jsx(Check, { "aria-hidden": "true", className: "size-4 text-[var(--primary)]" }) })] }, option.value))) }) }) }) }));
14
+ return (_jsx(Menu.Portal, { children: _jsx(Menu.Positioner, { side: "bottom", align: align, sideOffset: 6, collisionPadding: 8, className: "z-[95]", children: _jsx(Menu.Popup, { "data-slot": "filter-menu", style: { minWidth: width }, className: "max-h-[320px] overflow-y-auto rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] py-1 shadow-[var(--shadow-menu)] outline-none transition-opacity duration-200 ease-out data-[ending-style]:duration-150 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0", children: _jsx(Menu.RadioGroup, { value: value, onValueChange: (v) => onChange(v), children: options.map((option) => (_jsxs(Menu.RadioItem, { value: option.value, closeOnClick: true, "data-slot": "filter-menu-option", className: "group flex w-full cursor-default items-center justify-between gap-3 px-3 py-2 text-left text-13 leading-normal text-[var(--text-body)] outline-none transition-colors data-[checked]:font-semibold data-[checked]:text-[var(--text-primary)] data-[highlighted]:bg-[var(--surface-secondary)] hover:bg-[var(--surface-secondary)]", children: [_jsx("span", { className: "truncate", children: option.label }), _jsx(Menu.RadioItemIndicator, { className: "inline-flex shrink-0", children: _jsx(Check, { "aria-hidden": "true", className: "size-4 text-[var(--primary)]" }) })] }, option.value))) }) }) }) }));
15
15
  }
16
16
  /** The same choices as FilterMenuPopup, as a bottom sheet: what phones get below 768px. */
17
17
  function FilterSheet({ open, onClose, title, value, options, onChange, }) {
@@ -74,7 +74,7 @@ function FilterPill({ value, options, onChange, ariaLabel = "Filter", search, cl
74
74
  if (mobile) {
75
75
  return (_jsxs(_Fragment, { children: [_jsx("button", { ...rest, type: "button", "data-slot": "filter-pill", "aria-haspopup": "dialog", "aria-label": `${ariaLabel}: ${label}`, className: triggerClass, onClick: () => setOpen(true), children: inner }), _jsx(BottomSheet, { open: open, onClose: () => setOpen(false), title: ariaLabel, children: _jsx(SearchPanel, { value: value, options: options, search: search, onPick: pick, phone: true }) })] }));
76
76
  }
77
- return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { ...rest, "data-slot": "filter-pill", "aria-label": `${ariaLabel}: ${label}`, className: triggerClass, children: inner }), _jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Positioner, { side: "bottom", align: "end", sideOffset: 6, collisionPadding: 8, className: "z-[80]", children: _jsx(PopoverPrimitive.Popup, { "data-slot": "filter-menu", "aria-label": ariaLabel, className: "w-[300px] max-w-[calc(100vw-16px)] rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] shadow-[var(--shadow-menu)] outline-none transition-opacity duration-200 ease-out data-[ending-style]:duration-150 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0", children: _jsx(SearchPanel, { value: value, options: options, search: search, onPick: pick }) }) }) })] }));
77
+ return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { ...rest, "data-slot": "filter-pill", "aria-label": `${ariaLabel}: ${label}`, className: triggerClass, children: inner }), _jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Positioner, { side: "bottom", align: "end", sideOffset: 6, collisionPadding: 8, className: "z-[95]", children: _jsx(PopoverPrimitive.Popup, { "data-slot": "filter-menu", "aria-label": ariaLabel, className: "w-[300px] max-w-[calc(100vw-16px)] rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] shadow-[var(--shadow-menu)] outline-none transition-opacity duration-200 ease-out data-[ending-style]:duration-150 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0", children: _jsx(SearchPanel, { value: value, options: options, search: search, onPick: pick }) }) }) })] }));
78
78
  }
79
79
  // Phones: the choices slide up from the bottom, near the thumb, in 44px rows.
80
80
  if (mobile) {
@@ -17,6 +17,6 @@ function HoverCardTrigger({ delay = 300, closeDelay = 150, className, ...props }
17
17
  }
18
18
  /** The card. Read-only: what something is, never buttons. */
19
19
  function HoverCardContent({ side = "bottom", align = "start", className, ...props }) {
20
- return (_jsx(PreviewCardPrimitive.Portal, { children: _jsx(PreviewCardPrimitive.Positioner, { side: side, align: align, sideOffset: 6, collisionPadding: 12, className: "z-[80]", children: _jsx(PreviewCardPrimitive.Popup, { "data-slot": "hover-card-content", className: cn("w-80 max-w-[calc(100vw-24px)] origin-[var(--transform-origin)] rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-3 text-13 leading-[1.625] text-[var(--text-body)] shadow-[var(--shadow-dropdown)] outline-none", "transition-[opacity,scale] duration-200 ease-out data-[ending-style]:duration-150 motion-reduce:transition-none", "data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0", className), ...props }) }) }));
20
+ return (_jsx(PreviewCardPrimitive.Portal, { children: _jsx(PreviewCardPrimitive.Positioner, { side: side, align: align, sideOffset: 6, collisionPadding: 12, className: "z-[95]", children: _jsx(PreviewCardPrimitive.Popup, { "data-slot": "hover-card-content", className: cn("w-80 max-w-[calc(100vw-24px)] origin-[var(--transform-origin)] rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-3 text-13 leading-[1.625] text-[var(--text-body)] shadow-[var(--shadow-dropdown)] outline-none", "transition-[opacity,scale] duration-200 ease-out data-[ending-style]:duration-150 motion-reduce:transition-none", "data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0", className), ...props }) }) }));
21
21
  }
22
22
  export { HoverCard, HoverCardContent, HoverCardTrigger };
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { Button as ButtonPrimitive } from "@base-ui/react/button";
4
4
  import { cva } from "class-variance-authority";
5
- import { Loader2 } from "lucide-react";
5
+ import { LoaderCircle } from "lucide-react";
6
6
  import { cn } from "@brdgapp/ui/lib/utils";
7
7
  // The one icon-only button: close, kebab, back, copy, sync. Always round. Ported from Bridge OS
8
8
  // src/components/ui/icon-button.tsx onto Base UI Button. All sizes meet the 24px minimum target.
@@ -32,6 +32,6 @@ const iconButtonVariants = cva([
32
32
  defaultVariants: { variant: "default", size: "md" },
33
33
  });
34
34
  function IconButton({ className, variant, size, loading = false, disabled, children, ...props }) {
35
- return (_jsx(ButtonPrimitive, { "data-slot": "icon-button", className: cn(iconButtonVariants({ variant, size }), className), disabled: disabled || loading, "aria-busy": loading || undefined, ...props, children: _jsx("span", { "aria-hidden": "true", className: "inline-grid place-items-center", children: loading ? _jsx(Loader2, { className: "animate-spin" }) : children }) }));
35
+ return (_jsx(ButtonPrimitive, { "data-slot": "icon-button", className: cn(iconButtonVariants({ variant, size }), className), disabled: disabled || loading, "aria-busy": loading || undefined, ...props, children: _jsx("span", { "aria-hidden": "true", className: "inline-grid place-items-center", children: loading ? _jsx(LoaderCircle, { className: "animate-spin" }) : children }) }));
36
36
  }
37
37
  export { IconButton, iconButtonVariants };
@@ -18,16 +18,16 @@ import { cn } from "@brdgapp/ui/lib/utils";
18
18
  const TIP_DELAY = 300;
19
19
  /** Focus: a 2px outline with a 2px gap, so it clears the content on any surface. */
20
20
  const FOCUS = "outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-[var(--primary)]";
21
- const BUBBLE = "z-[80] w-max max-w-[min(16rem,calc(100vw-24px))] rounded-lg border border-[var(--border-default)] bg-[var(--surface-elevated)] px-3 py-2 text-12 leading-snug text-[var(--text-body)] shadow-[var(--shadow-dropdown)] outline-none " +
21
+ const BUBBLE = "z-[95] w-max max-w-[min(16rem,calc(100vw-24px))] rounded-lg border border-[var(--border-default)] bg-[var(--surface-elevated)] px-3 py-2 text-12 leading-snug text-[var(--text-body)] shadow-[var(--shadow-dropdown)] outline-none " +
22
22
  "transition-opacity duration-200 ease-out data-[ending-style]:duration-150 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0";
23
23
  /** An ⓘ that explains the thing next to it. Opens on hover, focus or tap. */
24
24
  function InfoHint({ text, className, ...rest }) {
25
25
  return (_jsxs(Popover.Root, { children: [_jsx(Popover.Trigger, { ...rest, openOnHover: true, delay: 0, "data-slot": "info-hint", "aria-label": text, className: cn("relative inline-flex shrink-0 rounded-full text-[var(--text-muted)] transition-colors hover:text-[var(--text-secondary)] focus-visible:text-[var(--text-secondary)] data-[popup-open]:text-[var(--text-secondary)]",
26
26
  // The icon is 14px; the click area reaches 24px, WCAG's smallest target.
27
- "after:absolute after:-inset-[5px] after:content-['']", FOCUS, className), children: _jsx(Info, { "aria-hidden": "true", className: "size-3.5" }) }), _jsx(Popover.Portal, { children: _jsx(Popover.Positioner, { side: "bottom", sideOffset: 6, collisionPadding: 12, className: "z-[80]", children: _jsx(Popover.Popup, { "data-slot": "info-hint-popup", className: cn(BUBBLE, "w-60"), children: text }) }) })] }));
27
+ "after:absolute after:-inset-[5px] after:content-['']", FOCUS, className), children: _jsx(Info, { "aria-hidden": "true", className: "size-3.5" }) }), _jsx(Popover.Portal, { children: _jsx(Popover.Positioner, { side: "bottom", sideOffset: 6, collisionPadding: 12, className: "z-[95]", children: _jsx(Popover.Popup, { "data-slot": "info-hint-popup", className: cn(BUBBLE, "w-60"), children: text }) }) })] }));
28
28
  }
29
29
  function TipBubble({ text }) {
30
- return (_jsx(Tooltip.Portal, { children: _jsx(Tooltip.Positioner, { side: "bottom", sideOffset: 6, collisionPadding: 12, className: "z-[80]", children: _jsx(Tooltip.Popup, { "data-slot": "tip-popup", className: BUBBLE, children: text }) }) }));
30
+ return (_jsx(Tooltip.Portal, { children: _jsx(Tooltip.Positioner, { side: "bottom", sideOffset: 6, collisionPadding: 12, className: "z-[95]", children: _jsx(Tooltip.Popup, { "data-slot": "tip-popup", className: BUBBLE, children: text }) }) }));
31
31
  }
32
32
  /**
33
33
  * Wraps content that isn't already a control (a chip, a count) in a button with a tooltip.
@@ -16,7 +16,7 @@ import { cn } from "@brdgapp/ui/lib/utils";
16
16
  // - An optional heading row: the title, with one link or button beside it ("See more").
17
17
  // - On a phone (below 768px) it slides up from the bottom as a BottomSheet, like every other sheet.
18
18
  // For a list of actions use ActionMenu; for a preview on hover, HoverCard; for a hint, InfoHint.
19
- // The surface is the menus': --surface-elevated, a border, --shadow-menu, 12px corners, z-[80].
19
+ // The surface is the menus': --surface-elevated, a border, --shadow-menu, 12px corners, z-[95].
20
20
  const WIDTHS = { default: "w-80", wide: "w-[460px]" };
21
21
  function Popover({ trigger, title, hideTitle = false, action, size = "default", align = "start", open: openProp, onOpenChange, children }) {
22
22
  const mobile = useIsMobile();
@@ -40,6 +40,6 @@ function Popover({ trigger, title, hideTitle = false, action, size = "default",
40
40
  },
41
41
  }), _jsx(BottomSheet, { open: open, onClose: () => setOpen(false), title: title, action: action, children: _jsx("div", { "data-slot": "popover-body", className: "px-5 pt-1 pb-3", children: children }) })] }));
42
42
  }
43
- return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { render: trigger }), _jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Positioner, { side: "bottom", align: align, sideOffset: 8, collisionPadding: 12, className: "z-[80]", children: _jsxs(PopoverPrimitive.Popup, { "data-slot": "popover", "aria-label": hideTitle ? title : undefined, className: cn("flex max-h-[min(70vh,var(--available-height))] max-w-[calc(100vw-24px)] origin-[var(--transform-origin)] flex-col overflow-hidden rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] shadow-[var(--shadow-menu)] outline-none", "transition-[opacity,scale] duration-200 ease-out data-[ending-style]:duration-150 motion-reduce:transition-none", "data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0", WIDTHS[size]), children: [hideTitle ? null : (_jsxs("div", { "data-slot": "popover-header", className: "flex h-12 shrink-0 items-center justify-between gap-3 border-b border-[var(--border-divider)] px-4", children: [_jsx(PopoverPrimitive.Title, { className: "min-w-0 truncate text-14 font-bold tracking-[-0.01em] text-[var(--text-primary)]", children: title }), action] })), _jsx("div", { "data-slot": "popover-body", className: "min-h-0 flex-1 overflow-y-auto overscroll-contain p-4", children: children })] }) }) })] }));
43
+ return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { render: trigger }), _jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Positioner, { side: "bottom", align: align, sideOffset: 8, collisionPadding: 12, className: "z-[95]", children: _jsxs(PopoverPrimitive.Popup, { "data-slot": "popover", "aria-label": hideTitle ? title : undefined, className: cn("flex max-h-[min(70vh,var(--available-height))] max-w-[calc(100vw-24px)] origin-[var(--transform-origin)] flex-col overflow-hidden rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] shadow-[var(--shadow-menu)] outline-none", "transition-[opacity,scale] duration-200 ease-out data-[ending-style]:duration-150 motion-reduce:transition-none", "data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0", WIDTHS[size]), children: [hideTitle ? null : (_jsxs("div", { "data-slot": "popover-header", className: "flex h-12 shrink-0 items-center justify-between gap-3 border-b border-[var(--border-divider)] px-4", children: [_jsx(PopoverPrimitive.Title, { className: "min-w-0 truncate text-14 font-bold tracking-[-0.01em] text-[var(--text-primary)]", children: title }), action] })), _jsx("div", { "data-slot": "popover-body", className: "min-h-0 flex-1 overflow-y-auto overscroll-contain p-4", children: children })] }) }) })] }));
44
44
  }
45
45
  export { Popover };
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { Input as InputPrimitive } from "@base-ui/react/input";
5
- import { Loader2, Search, X } from "lucide-react";
5
+ import { LoaderCircle, Search, X } from "lucide-react";
6
6
  import { IconButton } from "@brdgapp/ui/components/icon-button";
7
7
  import { cn } from "@brdgapp/ui/lib/utils";
8
8
  // `className` goes on the wrapper, not the input, so a width limit keeps the clear button inside the pill.
@@ -27,7 +27,7 @@ function SearchInput({ className, value, onClear, loading = false, onKeyDown, di
27
27
  }
28
28
  }, className: cn("h-11 md:h-10 w-full rounded-full border border-[var(--border-field)] bg-[var(--surface-secondary)] py-2 pr-10 pl-10", "text-16 md:text-14 text-[var(--text-primary)] placeholder:text-[var(--text-muted)]", "transition-all duration-150 ease-out outline-none hover:border-[var(--text-muted)]", "focus:border-[var(--primary)] focus:bg-[var(--surface-primary)] focus:ring-2 focus:ring-[var(--primary)]/20", "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-[var(--border-field)]",
29
29
  // Hide the browser's own clear button; this component draws its own.
30
- "[&::-webkit-search-cancel-button]:appearance-none"), ...props }), loading ? (_jsxs("span", { className: "pointer-events-none absolute top-1/2 right-3.5 -translate-y-1/2 text-[var(--text-muted)]", children: [_jsx(Loader2, { "data-slot": "search-input-spinner", "aria-hidden": "true", className: "size-4 animate-spin" }), _jsx("span", { role: "status", className: "sr-only", children: "Searching" })] })) : canClear ? (_jsx(IconButton, { "aria-label": "Clear search", size: "sm", onClick: () => {
30
+ "[&::-webkit-search-cancel-button]:appearance-none"), ...props }), loading ? (_jsxs("span", { className: "pointer-events-none absolute top-1/2 right-3.5 -translate-y-1/2 text-[var(--text-muted)]", children: [_jsx(LoaderCircle, { "data-slot": "search-input-spinner", "aria-hidden": "true", className: "size-4 animate-spin" }), _jsx("span", { role: "status", className: "sr-only", children: "Searching" })] })) : canClear ? (_jsx(IconButton, { "aria-label": "Clear search", size: "sm", onClick: () => {
31
31
  onClear?.();
32
32
  inner.current?.focus();
33
33
  }, className: "absolute top-1/2 right-1.5 -translate-y-1/2", children: _jsx(X, {}) })) : null] }));
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ type SelectOption<T extends string> = {
3
+ value: T;
4
+ label: string;
5
+ /** A muted second line under the label. */
6
+ description?: string;
7
+ /** A Lucide icon or small Avatar before the label. */
8
+ icon?: React.ReactNode;
9
+ };
10
+ type SelectProps<T extends string> = {
11
+ /** The chosen option, or `null` for none yet (the placeholder shows). */
12
+ value: T | null;
13
+ onChange: (value: T) => void;
14
+ options: SelectOption<T>[];
15
+ /** Shown, muted, until something is chosen: "Choose a type". */
16
+ placeholder?: string;
17
+ disabled?: boolean;
18
+ /** Its name in a submitted form. */
19
+ name?: string;
20
+ /** Use FieldLabel inside a Field; this is for a select with no visible label. */
21
+ "aria-label"?: string;
22
+ /** Layout only: `max-w-xs`. */
23
+ className?: string;
24
+ };
25
+ declare function Select<T extends string>({ value, onChange, options, placeholder, disabled, name, className, ...props }: SelectProps<T>): React.JSX.Element;
26
+ export { Select };
27
+ export type { SelectOption, SelectProps };
@@ -0,0 +1,44 @@
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 { Select as SelectPrimitive } from "@base-ui/react/select";
5
+ import { Check, ChevronDown } from "lucide-react";
6
+ import { BottomSheet, BottomSheetOption, BottomSheetOptions } from "@brdgapp/ui/components/bottom-sheet";
7
+ import { useIsMobile } from "@brdgapp/ui/hooks/use-is-mobile";
8
+ import { cn } from "@brdgapp/ui/lib/utils";
9
+ // The same box as Input: 40px (44 on phones), 8px corners, the field border, blue focus, red when invalid.
10
+ const triggerClasses = cn("flex h-11 md:h-10 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-[var(--border-field)] bg-[var(--surface-primary)] px-3.5 text-left", "text-16 md:text-14 text-[var(--text-primary)]", "transition-colors duration-150 ease-out outline-none", "hover:border-[var(--text-muted)]", "focus-visible:border-[var(--primary)] focus-visible:ring-2 focus-visible:ring-[var(--primary)]/20", "data-[popup-open]:border-[var(--primary)]", "aria-invalid:border-[var(--error)] aria-invalid:hover:border-[var(--error)] aria-invalid:focus-visible:ring-[var(--error)]/20", "data-[invalid]:border-[var(--error)] data-[invalid]:hover:border-[var(--error)] data-[invalid]:focus-visible:ring-[var(--error)]/20", "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50");
11
+ function OptionBody({ option, phone = false }) {
12
+ return (_jsxs("span", { className: "flex min-w-0 items-center gap-3", children: [option.icon ? _jsx("span", { className: "flex shrink-0 text-[var(--text-muted)] [&_svg]:size-4", children: option.icon }) : null, _jsxs("span", { className: "min-w-0", children: [_jsx("span", { className: "block truncate", children: option.label }), option.description ? _jsx("span", { className: cn("block truncate font-normal text-[var(--text-muted)]", phone ? "text-13" : "text-12"), children: option.description }) : null] })] }));
13
+ }
14
+ function Select({ value, onChange, options, placeholder = "Choose", disabled = false, name, className, ...props }) {
15
+ const mobile = useIsMobile();
16
+ const [sheet, setSheet] = React.useState(false);
17
+ const [listOpen, setListOpen] = React.useState(false);
18
+ // The phone sheet's title is the field's label (FieldLabel), read when it opens.
19
+ const trigger = React.useRef(null);
20
+ const [title, setTitle] = React.useState("");
21
+ const openSheet = () => {
22
+ const ids = trigger.current?.getAttribute("aria-labelledby")?.split(" ") ?? [];
23
+ const text = ids.map((id) => document.getElementById(id)?.textContent?.trim()).find(Boolean);
24
+ setTitle(text || props["aria-label"] || placeholder);
25
+ setSheet(true);
26
+ };
27
+ const chosen = options.find((o) => o.value === value);
28
+ const items = options.map((o) => ({ value: o.value, label: o.label }));
29
+ return (_jsxs(_Fragment, { children: [_jsxs(SelectPrimitive.Root, { value: value, onValueChange: (v) => v != null && onChange(v), items: items, disabled: disabled, name: name,
30
+ // Phones: the list never opens; the trigger's click opens the bottom sheet instead. (On the click, not
31
+ // when Base UI would open, on finger-down: the click that follows would land outside the sheet and close it.)
32
+ open: mobile ? false : listOpen, onOpenChange: (open) => setListOpen(open), children: [_jsxs(SelectPrimitive.Trigger, { ref: trigger, "data-slot": "select", "aria-label": props["aria-label"], className: cn(triggerClasses, className), onClick: mobile && !disabled ? openSheet : undefined, onKeyDown: mobile && !disabled
33
+ ? (e) => {
34
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
35
+ e.preventDefault();
36
+ openSheet();
37
+ }
38
+ }
39
+ : undefined, children: [_jsx(SelectPrimitive.Value, { className: cn("min-w-0 truncate", !chosen && "text-[var(--text-muted)]"), children: () => (chosen ? chosen.label : placeholder) }), _jsx(SelectPrimitive.Icon, { className: "flex shrink-0 text-[var(--text-muted)] transition-transform data-[popup-open]:rotate-180", children: _jsx(ChevronDown, { "aria-hidden": "true", className: "size-4" }) })] }), _jsx(SelectPrimitive.Portal, { children: _jsx(SelectPrimitive.Positioner, { side: "bottom", align: "start", sideOffset: 6, collisionPadding: 8, alignItemWithTrigger: false, className: "z-[95]", children: _jsx(SelectPrimitive.Popup, { "data-slot": "select-menu", className: "max-h-[320px] min-w-[var(--anchor-width)] overflow-y-auto rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] py-1 shadow-[var(--shadow-menu)] outline-none transition-opacity duration-200 ease-out data-[ending-style]:duration-150 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0", children: _jsx(SelectPrimitive.List, { children: options.map((option) => (_jsxs(SelectPrimitive.Item, { value: option.value, label: option.label, "data-slot": "select-option", className: "flex w-full cursor-default items-center justify-between gap-3 px-3 py-2 text-left text-13 leading-normal text-[var(--text-body)] outline-none transition-colors data-[selected]:font-semibold data-[selected]:text-[var(--text-primary)] data-[highlighted]:bg-[var(--surface-secondary)]", children: [_jsx(SelectPrimitive.ItemText, { className: "min-w-0", children: _jsx(OptionBody, { option: option }) }), _jsx(SelectPrimitive.ItemIndicator, { className: "inline-flex shrink-0", children: _jsx(Check, { "aria-hidden": "true", className: "size-4 text-[var(--primary)]" }) })] }, option.value))) }) }) }) })] }), mobile ? (_jsx(BottomSheet, { open: sheet, onClose: () => setSheet(false), title: title, children: _jsx(BottomSheetOptions, { children: options.map((option) => (_jsx(BottomSheetOption, { selected: option.value === value, onSelect: () => {
40
+ onChange(option.value);
41
+ setSheet(false);
42
+ }, children: _jsx(OptionBody, { option: option, phone: true }) }, option.value))) }) })) : null] }));
43
+ }
44
+ export { Select };
@@ -2,7 +2,7 @@
2
2
  import { useCallback, useSyncExternalStore } from "react";
3
3
  import { applyTheme, DARK_QUERY, readPreference, resolveTheme, writePreference } from "@brdgapp/ui/lib/theme";
4
4
  // One small store for the theme, shared by every useTheme() on the page. No provider to wrap the app in.
5
- // It follows the device while the choice is System, and picks up a choice made in another Bridge app when
5
+ // Light until someone chooses. It follows the device while the choice is System, and picks up a choice made in another Bridge app when
6
6
  // people come back to this tab.
7
7
  const CHANGE = "bridge-theme-change";
8
8
  let listening = false;
@@ -21,8 +21,8 @@ function subscribe(onChange) {
21
21
  return () => window.removeEventListener(CHANGE, onChange);
22
22
  }
23
23
  const snapshot = () => `${readPreference()}:${resolveTheme(readPreference())}`;
24
- // Before the page has loaded there's no saved choice to read: report System, drawn light.
25
- const serverSnapshot = () => "system:light";
24
+ // Before the page has loaded there's no saved choice to read: report the default, Light.
25
+ const serverSnapshot = () => "light:light";
26
26
  /** The theme choice, what's drawn, and a way to change it. Needs `themeScript` in the root layout's <head>. */
27
27
  export function useTheme() {
28
28
  const [theme, resolvedTheme] = useSyncExternalStore(subscribe, snapshot, serverSnapshot).split(":");
package/lib/theme.d.ts CHANGED
@@ -2,7 +2,7 @@ export type ThemePreference = "light" | "dark" | "system";
2
2
  export type ResolvedTheme = "light" | "dark";
3
3
  export declare const THEME_COOKIE = "bridge-theme";
4
4
  declare const DARK_QUERY = "(prefers-color-scheme: dark)";
5
- /** The saved choice: the shared cookie, then Bridge OS's old per-app key, then System. */
5
+ /** The saved choice: the shared cookie, then Bridge OS's old per-app key, then Light. */
6
6
  export declare function readPreference(): ThemePreference;
7
7
  /** Saves the choice for every Bridge app: on brdg.app it's shared by all subdomains; elsewhere (localhost, previews) by this site. */
8
8
  export declare function writePreference(preference: ThemePreference): void;
@@ -17,5 +17,5 @@ export declare function applyTheme(theme: ResolvedTheme): void;
17
17
  * Runs in <head> before the page paints, so someone in dark never sees a white flash. The same steps as
18
18
  * readPreference and resolveTheme, written out because it can't import anything.
19
19
  */
20
- export declare const themeScript = "(function(){try{var m=document.cookie.match(/(?:^|; )bridge-theme=(light|dark|system)/),p=m?m[1]:null;if(!p){try{p=localStorage.getItem(\"bridge-theme\")}catch(e){}}if(p!==\"light\"&&p!==\"dark\")p=\"system\";var t=p===\"dark\"||(p===\"system\"&&matchMedia(\"(prefers-color-scheme: dark)\").matches)?\"dark\":\"light\",r=document.documentElement;r.dataset.theme=t;r.style.colorScheme=t}catch(e){}})()";
20
+ export declare const themeScript = "(function(){try{var m=document.cookie.match(/(?:^|; )bridge-theme=(light|dark|system)/),p=m?m[1]:null;if(!p){try{p=localStorage.getItem(\"bridge-theme\")}catch(e){}}if(p!==\"light\"&&p!==\"dark\"&&p!==\"system\")p=\"light\";var t=p===\"dark\"||(p===\"system\"&&matchMedia(\"(prefers-color-scheme: dark)\").matches)?\"dark\":\"light\",r=document.documentElement;r.dataset.theme=t;r.style.colorScheme=t}catch(e){}})()";
21
21
  export { DARK_QUERY };
package/lib/theme.js CHANGED
@@ -1,19 +1,19 @@
1
1
  // Light, dark or system, the same in every Bridge app. Decided 2026-11-03 (Aman): every web app offers dark
2
- // mode; the choice is Light, Dark or System (the default, following the device); one choice applies across
2
+ // mode; the choice is Light, Dark or System (following the device); one choice applies across
3
3
  // all Bridge apps, so it's kept in a cookie for the whole brdg.app domain. Built on Bridge OS's version
4
4
  // (src/lib/hooks/use-theme.tsx and the init script in its root layout), which kept it per app in
5
5
  // localStorage under "bridge-theme" and offered Light and Dark only; that key is still read, so people who
6
- // chose dark in Bridge OS keep it.
6
+ // chose dark in Bridge OS keep it. Light is the default until someone chooses (Aman, 2026-11-19).
7
7
  export const THEME_COOKIE = "bridge-theme";
8
8
  const ONE_YEAR = 60 * 60 * 24 * 365;
9
9
  const DARK_QUERY = "(prefers-color-scheme: dark)";
10
10
  function isPreference(v) {
11
11
  return v === "light" || v === "dark" || v === "system";
12
12
  }
13
- /** The saved choice: the shared cookie, then Bridge OS's old per-app key, then System. */
13
+ /** The saved choice: the shared cookie, then Bridge OS's old per-app key, then Light. */
14
14
  export function readPreference() {
15
15
  if (typeof document === "undefined")
16
- return "system";
16
+ return "light";
17
17
  const match = document.cookie.match(new RegExp(`(?:^|; )${THEME_COOKIE}=(light|dark|system)`));
18
18
  if (match && isPreference(match[1]))
19
19
  return match[1];
@@ -23,9 +23,9 @@ export function readPreference() {
23
23
  return old;
24
24
  }
25
25
  catch {
26
- // Storage blocked: fall through to System.
26
+ // Storage blocked: fall through to Light.
27
27
  }
28
- return "system";
28
+ return "light";
29
29
  }
30
30
  /** Saves the choice for every Bridge app: on brdg.app it's shared by all subdomains; elsewhere (localhost, previews) by this site. */
31
31
  export function writePreference(preference) {
@@ -59,5 +59,5 @@ export function applyTheme(theme) {
59
59
  * Runs in <head> before the page paints, so someone in dark never sees a white flash. The same steps as
60
60
  * readPreference and resolveTheme, written out because it can't import anything.
61
61
  */
62
- export const themeScript = `(function(){try{var m=document.cookie.match(/(?:^|; )${THEME_COOKIE}=(light|dark|system)/),p=m?m[1]:null;if(!p){try{p=localStorage.getItem("${THEME_COOKIE}")}catch(e){}}if(p!=="light"&&p!=="dark")p="system";var t=p==="dark"||(p==="system"&&matchMedia("${DARK_QUERY}").matches)?"dark":"light",r=document.documentElement;r.dataset.theme=t;r.style.colorScheme=t}catch(e){}})()`;
62
+ export const themeScript = `(function(){try{var m=document.cookie.match(/(?:^|; )${THEME_COOKIE}=(light|dark|system)/),p=m?m[1]:null;if(!p){try{p=localStorage.getItem("${THEME_COOKIE}")}catch(e){}}if(p!=="light"&&p!=="dark"&&p!=="system")p="light";var t=p==="dark"||(p==="system"&&matchMedia("${DARK_QUERY}").matches)?"dark":"light",r=document.documentElement;r.dataset.theme=t;r.style.colorScheme=t}catch(e){}})()`;
63
63
  export { DARK_QUERY };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brdgapp/ui",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "description": "Bridge's shared components, tokens and styles. Documented at handbook.brdg.app.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://handbook.brdg.app",