@brdgapp/ui 1.0.0 → 1.1.1
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 +65 -0
- package/README.md +14 -3
- package/components/action-menu.d.ts +9 -2
- package/components/action-menu.js +14 -5
- package/components/avatar.d.ts +1 -1
- package/components/avatar.js +7 -5
- package/components/badge.js +2 -1
- package/components/bottom-sheet.d.ts +21 -4
- package/components/bottom-sheet.js +90 -6
- package/components/button-group.d.ts +2 -2
- package/components/button-group.js +1 -1
- package/components/button.d.ts +2 -2
- package/components/button.js +8 -6
- package/components/card.d.ts +2 -2
- package/components/card.js +1 -1
- package/components/checkbox.js +2 -2
- package/components/collapsible.js +4 -3
- package/components/column-filter-menu.d.ts +2 -1
- package/components/column-filter-menu.js +3 -2
- package/components/column-sort-button.d.ts +8 -2
- package/components/column-sort-button.js +12 -2
- package/components/confirm-dialog.d.ts +11 -3
- package/components/confirm-dialog.js +41 -6
- package/components/copy-field.js +4 -2
- package/components/data-state.js +2 -2
- package/components/data-table.d.ts +54 -5
- package/components/data-table.js +79 -30
- package/components/dialog.d.ts +29 -5
- package/components/dialog.js +27 -3
- package/components/drawer.d.ts +16 -6
- package/components/drawer.js +26 -9
- package/components/expandable-bio.js +2 -1
- package/components/field.js +3 -3
- package/components/filter-chip.js +4 -1
- package/components/filter-pill.js +6 -6
- package/components/hover-card.js +4 -2
- package/components/icon-button.d.ts +2 -2
- package/components/icon-button.js +6 -1
- package/components/info-hint.d.ts +8 -1
- package/components/info-hint.js +22 -7
- package/components/input.js +1 -1
- package/components/network-graph.js +1 -1
- package/components/page-banner.js +11 -5
- package/components/scene.d.ts +3 -1
- package/components/scene.js +2 -2
- package/components/search-input.d.ts +2 -2
- package/components/search-input.js +24 -3
- package/components/segmented-control.js +5 -1
- package/components/skeleton.js +3 -1
- package/components/skip-link.js +3 -1
- package/components/stat-box.d.ts +23 -5
- package/components/stat-box.js +33 -16
- package/components/switch.js +5 -1
- package/components/tabs.js +10 -2
- package/components/tag-input.d.ts +3 -1
- package/components/tag-input.js +27 -8
- package/components/tag.js +4 -2
- package/components/textarea.js +2 -2
- package/components/toast.d.ts +12 -5
- package/components/toast.js +15 -5
- package/lib/font-check.d.ts +3 -0
- package/lib/font-check.js +31 -0
- package/package.json +1 -1
- package/styles/globals.css +26 -3
package/components/drawer.d.ts
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DialogAction } from "@brdgapp/ui/components/dialog";
|
|
2
3
|
declare const WIDTH: {
|
|
3
|
-
readonly item: "max-w-xl";
|
|
4
|
-
readonly list: "max-w-2xl";
|
|
4
|
+
readonly item: "md:max-w-xl";
|
|
5
|
+
readonly list: "md:max-w-2xl";
|
|
5
6
|
};
|
|
6
7
|
type DrawerProps = {
|
|
7
8
|
open: boolean;
|
|
9
|
+
/** Called on ✕, Cancel, Esc or the scrim (never while `busy`). */
|
|
8
10
|
onClose: () => void;
|
|
9
11
|
title: React.ReactNode;
|
|
10
12
|
/** One line under the title: who, when. */
|
|
11
13
|
subtitle?: React.ReactNode;
|
|
12
|
-
/** `item` 576px for one record; `list` 672px for a list. */
|
|
14
|
+
/** `item` 576px for one record; `list` 672px for a list. A phone fills the screen either way. */
|
|
13
15
|
size?: keyof typeof WIDTH;
|
|
14
|
-
/** Actions beside the close button, such as an ActionMenu. */
|
|
16
|
+
/** Actions beside the close button, such as an ActionMenu. Not Save: that goes in `primaryAction`. */
|
|
15
17
|
actions?: React.ReactNode;
|
|
18
|
+
/** For a drawer that edits: the footer's one filled button, bottom right. Spins while `busy`. */
|
|
19
|
+
primaryAction?: DialogAction;
|
|
20
|
+
/** The footer button that closes without saving. Default "Cancel". Shown with `primaryAction`. */
|
|
21
|
+
cancelLabel?: string;
|
|
22
|
+
/** A red action, like Remove, alone at the bottom left. Ask with a ConfirmDialog before doing it. */
|
|
23
|
+
dangerAction?: DialogAction;
|
|
24
|
+
/** A save is running: the primary action spins and the drawer can't be dismissed until it finishes. */
|
|
25
|
+
busy?: boolean;
|
|
16
26
|
children: React.ReactNode;
|
|
17
27
|
className?: string;
|
|
18
28
|
};
|
|
19
|
-
declare function Drawer({ open, onClose, title, subtitle, size, actions, children, className }: DrawerProps): React.JSX.Element;
|
|
29
|
+
declare function Drawer({ open, onClose, title, subtitle, size, actions, primaryAction, cancelLabel, dangerAction, busy, children, className, }: DrawerProps): React.JSX.Element;
|
|
20
30
|
export { Drawer };
|
|
21
31
|
export type { DrawerProps };
|
package/components/drawer.js
CHANGED
|
@@ -1,17 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
3
4
|
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
4
5
|
import { X } from "lucide-react";
|
|
6
|
+
import { Button } from "@brdgapp/ui/components/button";
|
|
5
7
|
import { IconButton } from "@brdgapp/ui/components/icon-button";
|
|
6
8
|
import { cn } from "@brdgapp/ui/lib/utils";
|
|
7
|
-
// The right-hand panel for one item's details
|
|
8
|
-
// sheets"). Shape from Bridge OS's intro / relationship / week drawers: slides in from the right,
|
|
9
|
-
// the 56px top bar, over a dimmed page; Escape or ✕ closes it. Two widths: `item` (576px,
|
|
10
|
-
// and `list` (672px, a relationship or a week of contacts). Built on Base UI Dialog: focus is
|
|
11
|
-
// and returns to the opener; a drawer opened from a drawer closes first on Escape. z-[60], Bridge's
|
|
9
|
+
// The right-hand panel for one item's details, a short list, or a longer edit (approved 2026-11-02, "Panes,
|
|
10
|
+
// rails and sheets"). Shape from Bridge OS's intro / relationship / week drawers: slides in from the right,
|
|
11
|
+
// below the 56px top bar, over a dimmed page; Escape, the scrim or ✕ closes it. Two widths: `item` (576px,
|
|
12
|
+
// one intro) and `list` (672px, a relationship or a week of contacts). Built on Base UI Dialog: focus is
|
|
13
|
+
// trapped and returns to the opener; a drawer opened from a drawer closes first on Escape. z-[60], Bridge's
|
|
12
14
|
// layer for search and drawers, so menus (80) and confirms (90) opened from it sit above.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
//
|
|
16
|
+
// Decisions (Aman, 2026-11-06), after Canon's Sheet and shadcn's Sheet: a side panel is for a computer's big
|
|
17
|
+
// screen. On a phone (below 768px) the drawer fills the whole screen, over the top bar too, keeping the same
|
|
18
|
+
// header, body and footer, as Canon keeps a panel's title and actions when it becomes a sheet on a phone. It
|
|
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
|
+
// (`primaryAction`, `cancelLabel`, `dangerAction`, the same options as Dialog); Save is never in the header,
|
|
21
|
+
// next to ✕. The header and footer stay put and only the body scrolls. Reduced motion: it fades, no slide.
|
|
22
|
+
const WIDTH = { item: "md:max-w-xl", list: "md:max-w-2xl" };
|
|
23
|
+
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, }) {
|
|
25
|
+
const body = React.useRef(null);
|
|
26
|
+
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
|
+
// An edit drawer starts in its first field; a details drawer starts on its first control.
|
|
28
|
+
initialFocus: (openType) => (openType === "touch" ? true : (body.current?.querySelector(FIRST_FIELD) ?? true)), className: cn(
|
|
29
|
+
// 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,
|
|
31
|
+
// Phone: its own row above Cancel and the main button, so the three never squeeze into one.
|
|
32
|
+
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] })] }) }));
|
|
16
33
|
}
|
|
17
34
|
export { Drawer };
|
|
@@ -21,6 +21,7 @@ function ExpandableBio({ text, size = 12, className }) {
|
|
|
21
21
|
}, [trimmed, expanded]);
|
|
22
22
|
return (_jsxs("div", { "data-slot": "expandable-bio", className: className, children: [_jsx("p", { id: id, ref: ref,
|
|
23
23
|
// Size before line height: the class merger lets a font size override an earlier line height.
|
|
24
|
-
|
|
24
|
+
// pre-line keeps the person's own line breaks; a bio with two paragraphs shows both when open.
|
|
25
|
+
className: cn("whitespace-pre-line text-[var(--text-body)]", size === 14 ? "text-14" : "text-12", "leading-relaxed", !expanded && "line-clamp-1"), children: trimmed }), truncatable || expanded ? (_jsx(Button, { variant: "link", size: "xs", className: "mt-1", "aria-expanded": expanded, "aria-controls": id, onClick: () => setExpanded((v) => !v), children: expanded ? "See less" : "See more" })) : null] }));
|
|
25
26
|
}
|
|
26
27
|
export { ExpandableBio };
|
package/components/field.js
CHANGED
|
@@ -8,17 +8,17 @@ function Field({ className, invalid, ...props }) {
|
|
|
8
8
|
return _jsx(FieldPrimitive.Root, { "data-slot": "field", invalid: invalid, className: cn("flex flex-col gap-1.5", className), ...props });
|
|
9
9
|
}
|
|
10
10
|
function FieldLabel({ className, optional, children, ...props }) {
|
|
11
|
-
return (_jsxs(FieldPrimitive.Label, { "data-slot": "field-label", className: cn("text-[
|
|
11
|
+
return (_jsxs(FieldPrimitive.Label, { "data-slot": "field-label", className: cn("text-14 leading-[1.625] font-medium text-[var(--text-primary)] data-[disabled]:opacity-50", className), ...props, children: [children, optional ? _jsx("span", { className: "font-normal text-[var(--text-muted)]", children: " (optional)" }) : null] }));
|
|
12
12
|
}
|
|
13
13
|
/** Help text under the control: what the value is for. Read out with the field. */
|
|
14
14
|
function FieldDescription({ className, ...props }) {
|
|
15
|
-
return _jsx(FieldPrimitive.Description, { "data-slot": "field-description", className: cn("text-[
|
|
15
|
+
return _jsx(FieldPrimitive.Description, { "data-slot": "field-description", className: cn("text-12 leading-[1.625] text-[var(--text-muted)]", className), ...props });
|
|
16
16
|
}
|
|
17
17
|
/** What's wrong and how to fix it. Shows whenever it has text; pair it with `invalid` on the Field. */
|
|
18
18
|
function FieldError({ className, children, ...props }) {
|
|
19
19
|
if (!children)
|
|
20
20
|
return null;
|
|
21
|
-
return (_jsxs(FieldPrimitive.Error, { "data-slot": "field-error", match: true, className: cn("flex items-start gap-1.5 text-[
|
|
21
|
+
return (_jsxs(FieldPrimitive.Error, { "data-slot": "field-error", match: true, className: cn("flex items-start gap-1.5 text-12 leading-[1.625] text-[var(--danger-text)]", className), ...props, children: [_jsx(AlertCircle, { "aria-hidden": "true", className: "mt-px size-3.5 shrink-0" }), _jsx("span", { children: children })] }));
|
|
22
22
|
}
|
|
23
23
|
/** Stacks fields 16px apart. */
|
|
24
24
|
function FieldGroup({ className, ...props }) {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Toggle } from "@base-ui/react/toggle";
|
|
4
|
+
import { formatCount } from "@brdgapp/ui/lib/format";
|
|
4
5
|
import { cn } from "@brdgapp/ui/lib/utils";
|
|
5
6
|
function FilterChip({ active = false, count, className, children, ...props }) {
|
|
6
|
-
return (_jsxs(Toggle, { "data-slot": "filter-chip", pressed: active, className: cn("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-[
|
|
7
|
+
return (_jsxs(Toggle, { "data-slot": "filter-chip", pressed: active, className: cn("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-13 leading-[1.625] font-semibold transition-colors duration-150 outline-none", "focus-visible:ring-2 focus-visible:ring-[var(--primary)]", "border-[var(--text-disabled)] bg-transparent text-[var(--text-secondary)] hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]", "data-[pressed]:border-[var(--text-muted)] data-[pressed]:bg-[var(--surface-tertiary)] data-[pressed]:text-[var(--text-primary)]",
|
|
8
|
+
// An on chip still reacts to the pointer: pressing it turns the filter off.
|
|
9
|
+
"data-[pressed]:hover:border-[var(--text-secondary)]", "disabled:pointer-events-none disabled:opacity-50", className), ...props, children: [children, count != null ? (_jsx("span", { "data-slot": "filter-chip-count", className: "font-normal tabular-nums text-[var(--text-muted)]", children: formatCount(count) })) : null] }));
|
|
7
10
|
}
|
|
8
11
|
export { FilterChip };
|
|
@@ -3,16 +3,16 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { Menu } from "@base-ui/react/menu";
|
|
5
5
|
import { Check, ChevronDown } from "lucide-react";
|
|
6
|
-
import { BottomSheet, BottomSheetOption } from "@brdgapp/ui/components/bottom-sheet";
|
|
6
|
+
import { BottomSheet, BottomSheetOption, BottomSheetOptions } from "@brdgapp/ui/components/bottom-sheet";
|
|
7
7
|
import { useIsMobile } from "@brdgapp/ui/hooks/use-is-mobile";
|
|
8
8
|
import { cn } from "@brdgapp/ui/lib/utils";
|
|
9
9
|
/** The menu body shared by FilterPill and ColumnFilterMenu. */
|
|
10
10
|
function FilterMenuPopup({ value, options, onChange, width, align, }) {
|
|
11
|
-
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-
|
|
11
|
+
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))) }) }) }) }));
|
|
12
12
|
}
|
|
13
13
|
/** The same choices as FilterMenuPopup, as a bottom sheet: what phones get below 768px. */
|
|
14
14
|
function FilterSheet({ open, onClose, title, value, options, onChange, }) {
|
|
15
|
-
return (_jsx(BottomSheet, { open: open, onClose: onClose, title: title, children: _jsx(
|
|
15
|
+
return (_jsx(BottomSheet, { open: open, onClose: onClose, title: title, children: _jsx(BottomSheetOptions, { children: options.map((option) => (_jsx(BottomSheetOption, { selected: option.value === value, onSelect: () => {
|
|
16
16
|
onChange(option.value);
|
|
17
17
|
onClose();
|
|
18
18
|
}, children: option.label }, option.value))) }) }));
|
|
@@ -22,9 +22,9 @@ function FilterPill({ value, options, onChange, ariaLabel = "Filter", className,
|
|
|
22
22
|
const mobile = useIsMobile();
|
|
23
23
|
const active = value !== options[0]?.value;
|
|
24
24
|
const label = options.find((o) => o.value === value)?.label ?? options[0]?.label ?? "";
|
|
25
|
-
const triggerClass = cn("inline-flex shrink-0 items-center gap-1.5 rounded-full border px-3 py-1.5 text-
|
|
26
|
-
? "border-[var(--
|
|
27
|
-
: "border-[var(--
|
|
25
|
+
const triggerClass = cn("inline-flex shrink-0 items-center gap-1.5 rounded-full border px-3 py-1.5 text-13 leading-normal font-semibold outline-none transition-colors duration-150", "focus-visible:ring-2 focus-visible:ring-[var(--primary)]", active
|
|
26
|
+
? "border-[var(--text-muted)] bg-[var(--surface-tertiary)] text-[var(--text-primary)] hover:border-[var(--text-secondary)]"
|
|
27
|
+
: "border-[var(--text-disabled)] bg-transparent text-[var(--text-secondary)] hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]", className);
|
|
28
28
|
const inner = (_jsxs(_Fragment, { children: [label, _jsx(ChevronDown, { "aria-hidden": "true", className: cn("size-3.5 text-[var(--text-muted)] transition-transform", open && "rotate-180") })] }));
|
|
29
29
|
// Phones: the choices slide up from the bottom, near the thumb, in 44px rows.
|
|
30
30
|
if (mobile) {
|
package/components/hover-card.js
CHANGED
|
@@ -11,10 +11,12 @@ function HoverCard(props) {
|
|
|
11
11
|
* use your router's link or a button instead.
|
|
12
12
|
*/
|
|
13
13
|
function HoverCardTrigger({ delay = 300, closeDelay = 150, className, ...props }) {
|
|
14
|
-
return (_jsx(PreviewCardPrimitive.Trigger, { "data-slot": "hover-card-trigger", delay: delay, closeDelay: closeDelay, className: cn(
|
|
14
|
+
return (_jsx(PreviewCardPrimitive.Trigger, { "data-slot": "hover-card-trigger", delay: delay, closeDelay: closeDelay, className: cn(
|
|
15
|
+
// An outline with a 2px gap, so the ring clears the name without moving it.
|
|
16
|
+
"rounded-sm outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-[var(--primary)]", className), ...props }));
|
|
15
17
|
}
|
|
16
18
|
/** The card. Read-only: what something is, never buttons. */
|
|
17
19
|
function HoverCardContent({ side = "bottom", align = "start", className, ...props }) {
|
|
18
|
-
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-[
|
|
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 }) }) }));
|
|
19
21
|
}
|
|
20
22
|
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const iconButtonVariants: (props?: ({
|
|
4
|
-
variant?: "default" | "danger" | null | undefined;
|
|
5
|
-
size?: "sm" | "md" | "lg" | null | undefined;
|
|
4
|
+
variant?: "default" | "danger" | "outline" | null | undefined;
|
|
5
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
type IconButtonProps = Omit<ButtonPrimitive.Props, "className" | "aria-label"> & VariantProps<typeof iconButtonVariants> & {
|
|
8
8
|
/** Required: an icon has no visible name, so this is what screen readers say. Name the action: "Close". */
|
|
@@ -5,7 +5,9 @@ import { cva } from "class-variance-authority";
|
|
|
5
5
|
import { Loader2 } 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
|
-
// src/components/ui/icon-button.tsx onto Base UI Button. All sizes
|
|
8
|
+
// src/components/ui/icon-button.tsx onto Base UI Button. All sizes meet the 24px minimum target.
|
|
9
|
+
// 2026-11-06 (Aman): `outline`, Button `secondary`'s edge and fill on a circle; `xs`, 24px (the apps draw
|
|
10
|
+
// 24px icon buttons by hand 73 times).
|
|
9
11
|
const iconButtonVariants = cva([
|
|
10
12
|
"inline-grid shrink-0 place-items-center rounded-full border border-transparent",
|
|
11
13
|
"transition-colors duration-150 ease-out outline-none",
|
|
@@ -17,8 +19,11 @@ const iconButtonVariants = cva([
|
|
|
17
19
|
variant: {
|
|
18
20
|
default: "text-[var(--text-muted)] hover:bg-[var(--surface-secondary)] hover:text-[var(--text-primary)] focus-visible:ring-[var(--primary)]",
|
|
19
21
|
danger: "text-[var(--text-muted)] hover:bg-[var(--error-bg)] hover:text-[var(--danger-text)] focus-visible:ring-[var(--error)]",
|
|
22
|
+
// Button `secondary` on a circle: a solid fill (page glow never shows through) and a grey edge.
|
|
23
|
+
outline: "border-[var(--text-disabled)] bg-[var(--surface-elevated)] text-[var(--text-secondary)] hover:border-[var(--text-muted)] hover:bg-[var(--surface-secondary)] hover:text-[var(--text-primary)] focus-visible:ring-[var(--primary)]",
|
|
20
24
|
},
|
|
21
25
|
size: {
|
|
26
|
+
xs: "size-6 [&_svg]:size-3.5",
|
|
22
27
|
sm: "size-7",
|
|
23
28
|
md: "size-8",
|
|
24
29
|
lg: "size-9",
|
|
@@ -26,4 +26,11 @@ declare function Tip({ text, children, disabled, focusable, className, }: {
|
|
|
26
26
|
focusable?: boolean;
|
|
27
27
|
className?: string;
|
|
28
28
|
}): React.JSX.Element;
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Mount once around the app (or a toolbar): after one tooltip opens, the next one opens at once
|
|
31
|
+
* instead of waiting again. Without it every tooltip waits 300ms.
|
|
32
|
+
*/
|
|
33
|
+
declare function TipProvider({ children }: {
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
}): React.JSX.Element;
|
|
36
|
+
export { InfoHint, HoverTip, Tip, TipProvider };
|
package/components/info-hint.js
CHANGED
|
@@ -11,12 +11,20 @@ import { cn } from "@brdgapp/ui/lib/utils";
|
|
|
11
11
|
// (Base UI: "popups that open when hovering an info icon should use Popover").
|
|
12
12
|
// HoverTip, Tip → Tooltip: a visual extra for mouse and keyboard users; the control keeps its own name.
|
|
13
13
|
// All render outside the page (portal), so a glass card's overflow can't clip them, and they shift to
|
|
14
|
-
// stay on screen.
|
|
15
|
-
|
|
14
|
+
// stay on screen. InfoHint opens instantly, as in Bridge OS. Tooltips wait 300ms (the apps used 200–300ms;
|
|
15
|
+
// instant ones flashed across a row of icon buttons); inside a TipProvider the next one then opens at once.
|
|
16
|
+
// The ⓘ is --text-muted (4.8:1), not Bridge OS's --text-disabled (2:1, under WCAG's 3:1 for a control), as
|
|
17
|
+
// the other apps already showed it (Aman, 2026-11-05).
|
|
18
|
+
const TIP_DELAY = 300;
|
|
19
|
+
/** Focus: a 2px outline with a 2px gap, so it clears the content on any surface. */
|
|
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 " +
|
|
16
22
|
"transition-opacity duration-200 ease-out data-[ending-style]:duration-150 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0";
|
|
17
23
|
/** An ⓘ that explains the thing next to it. Opens on hover, focus or tap. */
|
|
18
24
|
function InfoHint({ text, className, ...rest }) {
|
|
19
|
-
return (_jsxs(Popover.Root, { children: [_jsx(Popover.Trigger, { ...rest, openOnHover: true, delay: 0, "data-slot": "info-hint", "aria-label": text, className: cn("inline-flex shrink-0 rounded-full text-[var(--text-
|
|
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
|
+
// 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 }) }) })] }));
|
|
20
28
|
}
|
|
21
29
|
function TipBubble({ text }) {
|
|
22
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 }) }) }));
|
|
@@ -26,7 +34,7 @@ function TipBubble({ text }) {
|
|
|
26
34
|
* The content itself must say what it is; the tooltip only adds detail.
|
|
27
35
|
*/
|
|
28
36
|
function HoverTip({ text, children, className, ...rest }) {
|
|
29
|
-
return (_jsxs(Tooltip.Root, { children: [_jsx(Tooltip.Trigger, { ...rest, delay:
|
|
37
|
+
return (_jsxs(Tooltip.Root, { children: [_jsx(Tooltip.Trigger, { ...rest, delay: TIP_DELAY, "data-slot": "hover-tip", className: cn("rounded-full", FOCUS, className), children: children }), _jsx(TipBubble, { text: text })] }));
|
|
30
38
|
}
|
|
31
39
|
/**
|
|
32
40
|
* A tooltip for something that is already a control (a sort button) or a plain label. The child
|
|
@@ -36,7 +44,14 @@ function HoverTip({ text, children, className, ...rest }) {
|
|
|
36
44
|
function Tip({ text, children, disabled, focusable, className, }) {
|
|
37
45
|
if (!text)
|
|
38
46
|
return _jsx(_Fragment, { children: children });
|
|
39
|
-
const trigger = !focusable && isValidElement(children) ? children : (_jsx("span", { tabIndex: focusable ? 0 : undefined, className: cn("inline-flex", focusable && "rounded
|
|
40
|
-
return (_jsxs(Tooltip.Root, { disabled: disabled, children: [_jsx(Tooltip.Trigger, { delay:
|
|
47
|
+
const trigger = !focusable && isValidElement(children) ? children : (_jsx("span", { tabIndex: focusable ? 0 : undefined, className: cn("inline-flex", focusable && cn("rounded-sm", FOCUS), className), children: children }));
|
|
48
|
+
return (_jsxs(Tooltip.Root, { disabled: disabled, children: [_jsx(Tooltip.Trigger, { delay: TIP_DELAY, render: trigger, "data-slot": "tip" }), _jsx(TipBubble, { text: text })] }));
|
|
41
49
|
}
|
|
42
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Mount once around the app (or a toolbar): after one tooltip opens, the next one opens at once
|
|
52
|
+
* instead of waiting again. Without it every tooltip waits 300ms.
|
|
53
|
+
*/
|
|
54
|
+
function TipProvider({ children }) {
|
|
55
|
+
return _jsx(Tooltip.Provider, { delay: TIP_DELAY, children: children });
|
|
56
|
+
}
|
|
57
|
+
export { InfoHint, HoverTip, Tip, TipProvider };
|
package/components/input.js
CHANGED
|
@@ -8,7 +8,7 @@ import { cn } from "@brdgapp/ui/lib/utils";
|
|
|
8
8
|
// 2026-11-03 over Edit contact's 36px grey box). Same height as SearchInput, so they line up.
|
|
9
9
|
// Inside a Field, the label, help text and error are tied to it automatically.
|
|
10
10
|
// The placeholder uses --text-muted, not --text-disabled as in Bridge OS: disabled grey is 2:1 on white.
|
|
11
|
-
const inputClasses = cn("h-11 md:h-10 w-full min-w-0 rounded-lg border border-[var(--border-
|
|
11
|
+
const inputClasses = cn("h-11 md:h-10 w-full min-w-0 rounded-lg border border-[var(--border-field)] bg-[var(--surface-primary)] px-3.5", "text-16 md:text-14 text-[var(--text-primary)] placeholder:text-[var(--text-muted)]", "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", "aria-invalid:border-[var(--error)] aria-invalid:hover:border-[var(--error)] aria-invalid:focus-visible: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:border-[var(--error)] data-[invalid]:focus-visible:ring-[var(--error)]/20", "disabled:cursor-not-allowed disabled:opacity-50");
|
|
12
12
|
function Input({ className, type = "text", ...props }) {
|
|
13
13
|
return _jsx(InputPrimitive, { "data-slot": "input", type: type, className: cn(inputClasses, className), ...props });
|
|
14
14
|
}
|
|
@@ -32,6 +32,6 @@ function NetworkGraph({ people, center, highlight = [], size = "md", animate = t
|
|
|
32
32
|
return (_jsxs("div", { "data-slot": "network-graph", role: label ? "img" : undefined, "aria-label": label, "aria-hidden": label ? undefined : true,
|
|
33
33
|
// A set width (not w-full), so it keeps its size inside a parent that shrinks to fit; max-w-full lets it
|
|
34
34
|
// shrink on a narrow screen.
|
|
35
|
-
className: cn("relative aspect-square max-w-full shrink-0", s.width, className), children: [_jsx("svg", { viewBox: "0 0 100 100", className: "absolute inset-0 size-full", "aria-hidden": "true", children: lines.map((l, i) => (_jsx("line", { x1: l.from.x, y1: l.from.y, x2: l.to.x, y2: l.to.y, vectorEffect: "non-scaling-stroke", strokeWidth: l.on ? 1.5 : 1, strokeDasharray: l.on ? undefined : "3 3", className: cn(l.on ? "stroke-[var(--primary)]" : "stroke-[var(--text-disabled)]", fade), style: step(l.n) }, i))) }), _jsxs("div", { "aria-hidden": "true", className: "contents", children: [[...inner.map((p, i) => ({ p, at: innerAt[i], ring: "inner", n: i })), ...outer.map((p, i) => ({ p, at: outerAt[i], ring: "outer", n: inner.length + i }))].map(({ p, at, ring, n }) => (_jsx("span", { className: cn("absolute -translate-x-1/2 -translate-y-1/2", enter), style: { left: `${at.x}%`, top: `${at.y}%`, ...step(n + 1) }, children: _jsx(Avatar, { name: p.name, src: p.src, size: ring === "inner" ? s.inner : s.outer, className: cn(lit.has(p.name) && "
|
|
35
|
+
className: cn("relative aspect-square max-w-full shrink-0", s.width, className), children: [_jsx("svg", { viewBox: "0 0 100 100", className: "absolute inset-0 size-full", "aria-hidden": "true", children: lines.map((l, i) => (_jsx("line", { x1: l.from.x, y1: l.from.y, x2: l.to.x, y2: l.to.y, vectorEffect: "non-scaling-stroke", strokeWidth: l.on ? 1.5 : 1, strokeDasharray: l.on ? undefined : "3 3", className: cn(l.on ? "stroke-[var(--primary)]" : "stroke-[var(--text-disabled)]", fade), style: step(l.n) }, i))) }), _jsxs("div", { "aria-hidden": "true", className: "contents", children: [[...inner.map((p, i) => ({ p, at: innerAt[i], ring: "inner", n: i })), ...outer.map((p, i) => ({ p, at: outerAt[i], ring: "outer", n: inner.length + i }))].map(({ p, at, ring, n }) => (_jsx("span", { className: cn("absolute -translate-x-1/2 -translate-y-1/2", enter), style: { left: `${at.x}%`, top: `${at.y}%`, ...step(n + 1) }, children: _jsx(Avatar, { name: p.name, src: p.src, size: ring === "inner" ? s.inner : s.outer, className: cn(lit.has(p.name) && "outline-2 outline-offset-2 outline-[var(--primary)] outline-solid") }) }, `${p.name}-${n}`))), _jsx("span", { className: cn("absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2", enter), children: center ? (_jsx(Avatar, { name: center.name, src: center.src, size: s.center })) : (_jsx("span", { className: cn("flex items-center justify-center rounded-full bg-[var(--primary-solid)] font-bold text-white", s.you), children: "You" })) })] })] }));
|
|
36
36
|
}
|
|
37
37
|
export { NetworkGraph };
|
|
@@ -3,7 +3,12 @@ import { cva } from "class-variance-authority";
|
|
|
3
3
|
import { cn } from "@brdgapp/ui/lib/utils";
|
|
4
4
|
// The full-width alert strip under the top navigation. Ported from Bridge OS
|
|
5
5
|
// src/components/ui/page-banner.tsx with the same API. New: `placement="inline"` for a banner inside a
|
|
6
|
-
// card or
|
|
6
|
+
// card or form (where apps use shadcn's Alert today).
|
|
7
|
+
//
|
|
8
|
+
// 2026-11-05: "page" no longer breaks out of the page column with `mx-[calc(50%-50vw)] w-screen -mt-8`.
|
|
9
|
+
// That gave Windows a sideways scrollbar (100vw counts the scrollbar), ran under sidebars, and needed
|
|
10
|
+
// Bridge OS's exact page padding. Now it fills its container: put it in the layout, straight under the
|
|
11
|
+
// top bar and outside the centred column. It pins under the bar at --page-banner-top (default 56px).
|
|
7
12
|
const pageBannerVariants = cva("border-b", {
|
|
8
13
|
variants: {
|
|
9
14
|
variant: {
|
|
@@ -14,16 +19,17 @@ const pageBannerVariants = cva("border-b", {
|
|
|
14
19
|
error: "border-[var(--error-border)] bg-[var(--error-bg)] text-[var(--error-text)]",
|
|
15
20
|
},
|
|
16
21
|
placement: {
|
|
17
|
-
|
|
18
|
-
// it sits flush under the 56px nav, and stays pinned there while scrolling.
|
|
19
|
-
page: "sticky top-14 z-30 -mt-8 mb-6 mx-[calc(50%-50vw)] w-screen py-3",
|
|
22
|
+
page: "sticky top-[var(--page-banner-top,3.5rem)] z-30 w-full py-3",
|
|
20
23
|
inline: "rounded-xl border py-3",
|
|
21
24
|
},
|
|
22
25
|
},
|
|
23
26
|
defaultVariants: { variant: "info", placement: "page" },
|
|
24
27
|
});
|
|
28
|
+
// Icon and action sit in a box one text line tall, so they stay level with the first line when the
|
|
29
|
+
// message wraps on a phone.
|
|
30
|
+
const LINE = "flex h-[1.3125rem] shrink-0 items-center";
|
|
25
31
|
function PageBanner({ variant, placement, icon, children, action, contentWidthClass, className }) {
|
|
26
32
|
const isPage = (placement ?? "page") === "page";
|
|
27
|
-
return (_jsx("div", { "data-slot": "page-banner", className: cn(pageBannerVariants({ variant, placement }), className), children: _jsxs("div", { className: cn("flex items-
|
|
33
|
+
return (_jsx("div", { "data-slot": "page-banner", className: cn(pageBannerVariants({ variant, placement }), className), children: _jsxs("div", { className: cn("flex items-start gap-2 [&_svg]:size-4 [&_svg]:shrink-0", isPage ? cn(contentWidthClass, "mx-auto px-4 sm:px-6 lg:px-8") : "px-4"), children: [icon ? (_jsx("span", { "data-slot": "page-banner-icon", "aria-hidden": "true", className: LINE, children: icon })) : null, _jsx("div", { className: "min-w-0 flex-1 text-13 leading-[1.625] font-semibold", children: children }), action ? _jsx("span", { className: LINE, children: action }) : null] }) }));
|
|
28
34
|
}
|
|
29
35
|
export { PageBanner, pageBannerVariants };
|
package/components/scene.d.ts
CHANGED
|
@@ -4,9 +4,11 @@ type SceneProps = {
|
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
/** `grid`: the dot grid. `blue`: a blue wash, for the one hero picture of a promo. */
|
|
6
6
|
tone?: "grid" | "blue";
|
|
7
|
+
/** No corners: the picture across the top of a `flush` Card, which rounds it. */
|
|
8
|
+
flush?: boolean;
|
|
7
9
|
/** Size and layout only: `h-56`, `aspect-[4/3]`. */
|
|
8
10
|
className?: string;
|
|
9
11
|
};
|
|
10
12
|
/** A picture made of Bridge's own components. Decorative: hidden from screen readers and can't be clicked. */
|
|
11
|
-
declare function Scene({ children, tone, className }: SceneProps): import("react").JSX.Element;
|
|
13
|
+
declare function Scene({ children, tone, flush, className }: SceneProps): import("react").JSX.Element;
|
|
12
14
|
export { Scene };
|
package/components/scene.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "@brdgapp/ui/lib/utils";
|
|
3
3
|
/** A picture made of Bridge's own components. Decorative: hidden from screen readers and can't be clicked. */
|
|
4
|
-
function Scene({ children, tone = "grid", className }) {
|
|
5
|
-
return (_jsxs("div", { "data-slot": "scene", "aria-hidden": "true", inert: true, className: cn("relative flex items-center justify-center overflow-hidden
|
|
4
|
+
function Scene({ children, tone = "grid", flush = false, className }) {
|
|
5
|
+
return (_jsxs("div", { "data-slot": "scene", "aria-hidden": "true", inert: true, className: cn("relative flex items-center justify-center overflow-hidden select-none [&_*]:pointer-events-none", flush ? "rounded-none" : "rounded-xl", tone === "grid" ? "bg-[var(--info-bg)] bg-dot-grid" : "bg-[var(--primary-solid)]", className), children: [tone === "blue" ? _jsx("span", { className: "absolute -top-1/3 -right-1/4 size-2/3 rounded-full bg-white/15 blur-3xl" }) : null, _jsx("div", { className: "relative", children: children })] }));
|
|
6
6
|
}
|
|
7
7
|
export { Scene };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
type SearchInputProps = Omit<React.ComponentProps<"input">, "type"> & {
|
|
3
3
|
/** Clears the field. The clear button shows only when there is a value. */
|
|
4
4
|
onClear?: () => void;
|
|
5
5
|
};
|
|
6
|
-
declare function SearchInput({ className, value, onClear, ...props }: SearchInputProps): React.JSX.Element;
|
|
6
|
+
declare function SearchInput({ className, value, onClear, onKeyDown, disabled, ref, ...props }: SearchInputProps): React.JSX.Element;
|
|
7
7
|
export { SearchInput };
|
|
8
8
|
export type { SearchInputProps };
|
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
3
4
|
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
4
5
|
import { Search, X } from "lucide-react";
|
|
5
6
|
import { IconButton } from "@brdgapp/ui/components/icon-button";
|
|
6
7
|
import { cn } from "@brdgapp/ui/lib/utils";
|
|
7
8
|
// `className` goes on the wrapper, not the input, so a width limit keeps the clear button inside the pill.
|
|
8
|
-
function SearchInput({ className, value, onClear, ...props }) {
|
|
9
|
+
function SearchInput({ className, value, onClear, onKeyDown, disabled, ref, ...props }) {
|
|
10
|
+
const inner = React.useRef(null);
|
|
9
11
|
const hasValue = value !== undefined && String(value).length > 0;
|
|
10
|
-
|
|
12
|
+
const canClear = hasValue && !!onClear && !disabled;
|
|
13
|
+
const setRefs = (el) => {
|
|
14
|
+
inner.current = el;
|
|
15
|
+
if (typeof ref === "function")
|
|
16
|
+
ref(el);
|
|
17
|
+
else if (ref)
|
|
18
|
+
ref.current = el;
|
|
19
|
+
};
|
|
20
|
+
return (_jsxs("div", { "data-slot": "search-input", className: cn("group relative", className), children: [_jsx(Search, { "aria-hidden": "true", className: "pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-[var(--text-disabled)] transition-colors group-focus-within:text-[var(--primary)] group-has-[input:disabled]:opacity-50" }), _jsx(InputPrimitive, { "data-slot": "search-input-field", type: "search", ref: setRefs, value: value, disabled: disabled, onKeyDown: (e) => {
|
|
21
|
+
onKeyDown?.(e);
|
|
22
|
+
if (e.key === "Escape" && canClear && !e.defaultPrevented) {
|
|
23
|
+
// Keep the Esc for the field: a dialog around it shouldn't close too.
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
onClear?.();
|
|
27
|
+
}
|
|
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)]",
|
|
11
29
|
// Hide the browser's own clear button; this component draws its own.
|
|
12
|
-
"[&::-webkit-search-cancel-button]:appearance-none"), ...props }),
|
|
30
|
+
"[&::-webkit-search-cancel-button]:appearance-none"), ...props }), canClear ? (_jsx(IconButton, { "aria-label": "Clear search", size: "sm", onClick: () => {
|
|
31
|
+
onClear?.();
|
|
32
|
+
inner.current?.focus();
|
|
33
|
+
}, className: "absolute top-1/2 right-1.5 -translate-y-1/2", children: _jsx(X, {}) })) : null] }));
|
|
13
34
|
}
|
|
14
35
|
export { SearchInput };
|
|
@@ -9,6 +9,10 @@ function SegmentedControl({ options, value, onChange, className, ...props }) {
|
|
|
9
9
|
const picked = next[0];
|
|
10
10
|
if (picked !== undefined && picked !== value)
|
|
11
11
|
onChange(picked);
|
|
12
|
-
}, className: cn("inline-flex gap-[2px] rounded-full border border-[var(--border-default)] bg-[var(--surface-secondary)] p-[3px]", className), children: options.map((option) => (_jsx(Toggle, { value: option.value, "aria-label": option.ariaLabel, "data-slot": "segmented-control-option", className: cn(
|
|
12
|
+
}, className: cn("inline-flex gap-[2px] rounded-full border border-[var(--border-default)] bg-[var(--surface-secondary)] p-[3px]", className), children: options.map((option) => (_jsx(Toggle, { value: option.value, "aria-label": option.ariaLabel, "data-slot": "segmented-control-option", className: cn(
|
|
13
|
+
// Named size at the line height it has always had (1.625), so the control keeps its height.
|
|
14
|
+
"rounded-full px-3 py-[5px] text-12 leading-[1.625] font-semibold text-[var(--text-muted)] transition-colors duration-150 outline-none",
|
|
15
|
+
// Hover darkens an unselected option a clear step; the selected one stays as it is.
|
|
16
|
+
"not-data-[pressed]:hover:text-[var(--text-secondary)] focus-visible:ring-2 focus-visible:ring-[var(--primary)] [&_svg]:size-3.5", "data-[pressed]:bg-[var(--surface-elevated)] data-[pressed]:text-[var(--text-primary)] data-[pressed]:shadow-[0_1px_2px_rgba(13,21,49,0.10)]"), children: option.label }, option.value))) }));
|
|
13
17
|
}
|
|
14
18
|
export { SegmentedControl };
|
package/components/skeleton.js
CHANGED
|
@@ -4,8 +4,10 @@ import { cn } from "@brdgapp/ui/lib/utils";
|
|
|
4
4
|
// A grey placeholder shaped like content that hasn't loaded yet. Started from shadcn's skeleton, then put
|
|
5
5
|
// on Bridge's token: Bridge OS draws about 170 of these by hand (`bg-[var(--surface-tertiary)]
|
|
6
6
|
// animate-pulse`), in three shapes: text lines (4px corners), avatars (circles) and whole blocks.
|
|
7
|
+
// One grey for every placeholder, Skeleton, ButtonSkeleton, StatBoxSkeleton and DataTableSkeleton
|
|
8
|
+
// alike: `--skeleton` (Bridge OS's #F2F3F5; lighter than the surfaces in dark mode). Picked by Aman 2026-11-04.
|
|
7
9
|
// Hidden from screen readers: the region that's loading says so (DataState sets that up).
|
|
8
|
-
const skeletonVariants = cva("block animate-pulse bg-[var(--
|
|
10
|
+
const skeletonVariants = cva("block animate-pulse bg-[var(--skeleton)]", {
|
|
9
11
|
variants: {
|
|
10
12
|
shape: {
|
|
11
13
|
line: "h-3 rounded-[4px]",
|
package/components/skip-link.js
CHANGED
|
@@ -2,6 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { cn } from "@brdgapp/ui/lib/utils";
|
|
3
3
|
/** "Skip to content". Put it first inside <body>, before the top bar. */
|
|
4
4
|
function SkipLink({ href = "#main", className }) {
|
|
5
|
-
return (_jsx("a", { "data-slot": "skip-link", href: href, className: cn("fixed top-3 left-3 z-[100] rounded-full bg-[var(--primary-solid)] px-4 py-2 text-14 font-semibold text-white shadow-[var(--shadow-menu)]",
|
|
5
|
+
return (_jsx("a", { "data-slot": "skip-link", href: href, className: cn("fixed top-3 left-3 z-[100] rounded-full bg-[var(--primary-solid)] px-4 py-2 text-14 font-semibold text-white shadow-[var(--shadow-menu)]",
|
|
6
|
+
// An outline with a see-through gap, so it reads over glass, grey and dark top bars alike.
|
|
7
|
+
"outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-[var(--primary)]", className), children: "Skip to content" }));
|
|
6
8
|
}
|
|
7
9
|
export { SkipLink };
|
package/components/stat-box.d.ts
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type LucideIcon } from "lucide-react";
|
|
3
|
+
type StatBoxChange = {
|
|
4
|
+
/** The change as a share: 0.12 is up 12%, -0.05 is down 5%. */
|
|
5
|
+
value: number;
|
|
6
|
+
/** The period it's compared with, in words: "last month", "last week". */
|
|
7
|
+
since: string;
|
|
8
|
+
/** For numbers where less is better, like days to reply: down shows green. */
|
|
9
|
+
downIsGood?: boolean;
|
|
10
|
+
};
|
|
2
11
|
type StatBoxProps = {
|
|
3
12
|
label: string;
|
|
4
13
|
value: number;
|
|
5
14
|
/** A muted third line: "72%", "rated great". */
|
|
6
15
|
sub?: string;
|
|
16
|
+
/** How the number moved: an arrow and the change, green or red, then "vs last month". */
|
|
17
|
+
change?: StatBoxChange;
|
|
18
|
+
/** A small icon beside the label, from Lucide. */
|
|
19
|
+
icon?: LucideIcon;
|
|
7
20
|
/** A ready-made value ("$12.5K", from `formatMoney`) instead of the formatted count. */
|
|
8
21
|
display?: string;
|
|
9
22
|
/** Explains what the number counts. */
|
|
@@ -14,10 +27,15 @@ type StatBoxProps = {
|
|
|
14
27
|
render?: React.ReactElement;
|
|
15
28
|
className?: string;
|
|
16
29
|
};
|
|
17
|
-
declare function StatBox({ label, value, sub, display, info, href, render, className }: StatBoxProps): React.JSX.Element;
|
|
18
|
-
/**
|
|
19
|
-
|
|
30
|
+
declare function StatBox({ label, value, sub, change, icon: Icon, display, info, href, render, className }: StatBoxProps): React.JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* Same size and shape as StatBox, for loading. Pass `sub` and `change` when the real box has those lines,
|
|
33
|
+
* so the row doesn't jump when the numbers arrive.
|
|
34
|
+
*/
|
|
35
|
+
declare function StatBoxSkeleton({ sub, change, className }: {
|
|
36
|
+
sub?: boolean;
|
|
37
|
+
change?: boolean;
|
|
20
38
|
className?: string;
|
|
21
39
|
}): React.JSX.Element;
|
|
22
40
|
export { StatBox, StatBoxSkeleton };
|
|
23
|
-
export type { StatBoxProps };
|
|
41
|
+
export type { StatBoxChange, StatBoxProps };
|