From 9840870e42dde9ba43c4dbf8a7e2d0367d0c5e37 Mon Sep 17 00:00:00 2001 From: morgmart <98432065+morgmart@users.noreply.github.com> Date: Mon, 16 Nov 2026 00:13:04 -0800 Subject: [PATCH 01/18] feat(design-system): compact Combobox trigger and menu minimum width Add `Combobox.Trigger variant="compact"`, matching Select's compact variant: an outlined capsule whose label is announced rather than shown, for rows of compact controls such as a task's status and assignees. Give every Combobox menu the compact Select's minimum width, so a narrow trigger such as an avatar stack no longer squeezes names mid-word. Co-authored-by: Vogue <86a9516b8bdd0bbb22ab9340ed157fccdf422ae31bbb2fe2d59aba37c886f5d3@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com> --- src/shared/design-system/DESIGN.md | 5 ++ src/shared/design-system/styles/forms.css | 9 ++++ .../design-system/ui/ChoiceControls.test.tsx | 24 +++++++++ src/shared/design-system/ui/Combobox.tsx | 51 ++++++++++++++++-- .../design-system/ui/FormSpecimens.tsx | 54 +++++++++++++++++++ 5 files changed, 138 insertions(+), 5 deletions(-) diff --git a/src/shared/design-system/DESIGN.md b/src/shared/design-system/DESIGN.md index 48c6f68b85..65d50bb890 100644 --- a/src/shared/design-system/DESIGN.md +++ b/src/shared/design-system/DESIGN.md @@ -1131,6 +1131,11 @@ filtering, custom-value commits, and async requests with the feature. Its Contro owns the label, input and integrated browse caret; Popup and Item own the shared menu presentation. For a closed dropdown with search inside, use Combobox.Trigger and Combobox.Popup with search; opening focuses the popup search input. +In a row of compact controls, such as beside a compact Select, use +`Combobox.Trigger variant="compact"`: the same outlined capsule as a compact +Select, with its label announced rather than shown. Combobox menus keep the +compact Select's minimum width, so a narrow trigger such as an avatar stack never +squeezes its choices. Use its loading state while discovering options, and keep retry/cancel actions with the feature. Do not style a native select as an Input or attach a separate round button to mimic a combobox. diff --git a/src/shared/design-system/styles/forms.css b/src/shared/design-system/styles/forms.css index c7b8b04175..66416bfd47 100644 --- a/src/shared/design-system/styles/forms.css +++ b/src/shared/design-system/styles/forms.css @@ -433,6 +433,15 @@ width: var(--anchor-width); overflow-wrap: anywhere; } + /* A combobox menu can open from a trigger narrower than its choices, such as + a compact avatar trigger. Keep the compact Select's minimum so names never + break mid-word. */ + .buzz-select-popup[data-combobox-size] { + min-width: min( + max(var(--anchor-width), 11.25rem), + calc(100vw - var(--space-6)) + ); + } /* Roughly four avatar-and-detail rows plus search. The viewport may make the list shorter; keep search fixed and every result scrollable. */ .buzz-select-popup[data-combobox-size="compact"] { diff --git a/src/shared/design-system/ui/ChoiceControls.test.tsx b/src/shared/design-system/ui/ChoiceControls.test.tsx index 70d54c8201..de3b7cf71e 100644 --- a/src/shared/design-system/ui/ChoiceControls.test.tsx +++ b/src/shared/design-system/ui/ChoiceControls.test.tsx @@ -395,3 +395,27 @@ it("defaults combobox queries to exact text while permitting explicit correction expect(input).toHaveAttribute("autocapitalize", "sentences"); expect(input).toHaveAttribute("spellcheck", "true"); }); + +it("names a compact Combobox trigger without showing its label", async () => { + const user = userEvent.setup(); + render( + + + Nobody + + + + {(item: (typeof options)[number]) => ( + + {item.label} + + )} + + + , + ); + const trigger = screen.getByRole("combobox", { name: "Assignees" }); + expect(screen.queryByText("Assignees")).not.toBeInTheDocument(); + await user.click(trigger); + expect(await screen.findByRole("option", { name: "One" })).toBeVisible(); +}); diff --git a/src/shared/design-system/ui/Combobox.tsx b/src/shared/design-system/ui/Combobox.tsx index 5607a5d3e7..250d0217cd 100644 --- a/src/shared/design-system/ui/Combobox.tsx +++ b/src/shared/design-system/ui/Combobox.tsx @@ -4,6 +4,7 @@ import { CaretDownIcon, CircleNotchIcon, CheckIcon } from "../icons"; import { Field } from "./Field"; import { InputGroup } from "./InputGroup"; import { IconButton } from "./IconButton"; +import { Button } from "./Button"; /** Shared presentation; callers retain filtering, custom values and async work. */ function Control({ @@ -94,20 +95,60 @@ function Control({ ); } -/** A button-style field for comboboxes whose search input lives in the popup. */ +/** A button-style trigger for comboboxes whose search input lives in the popup. + * `field` is a labelled form field. `compact` matches Select's compact + * variant: a small outlined capsule whose label is announced, not shown, for + * rows of adjacent controls. */ function Trigger({ label, children, - error, disabled, + ...props }: { label: string; children: ReactNode; - error?: ReactNode; disabled?: boolean | undefined; -}) { +} & ( + | { variant?: "field"; error?: ReactNode } + | { variant: "compact"; error?: never } +)) { + if (props.variant === "compact") + return ( +
+ ( + + )} + /> +
+ ); return ( - + (["Riley"]); + return ( +
+ } + disabled={saving} + groups={[ + { + label: "Status", + options: statuses.map((status) => ({ + value: status, + label: statusLabels[status], + leading: , + })), + }, + ]} + onValueChange={(value) => + void change({ status: value as TaskStatus }) + } + /> + +
+ {task.description.trim() ? ( + + ) : ( +

No description.

+ )} + {task.images.length > 0 && ( + + )} +
+ + {task.links.length ? ( +
    + {task.links.map((channelId) => ( +
  • + props.openConversation(channelId)} + /> +
  • + ))} +
+ ) : ( +

+ No conversations are linked yet. +

+ )} + {props.currentChat && !linkedHere ? ( +
+ +
+ ) : null} +
+ + ); +} + +function TaskByline({ session, task }: { session: RelaySession; task: Task }) { + const name = useIdentityNames(session.names); + const label = (pubkey: string) => + pubkey === session.viewer + ? "you" + : name( + pubkey, + session.profiles.snapshot().get(pubkey)?.name ?? + formatPublicKey(pubkey) ?? + "someone", + ); + return ( +

+ Created by {label(task.author)} · Updated{" "} + {relativeTimestamp(task.updatedAt * 1000)} by {label(task.editor)} +

+ ); +} + +function TaskImages({ + session, + images, + remove, +}: { + session: RelaySession; + images: readonly TaskImage[]; + remove?: ((image: TaskImage) => void) | undefined; +}) { + return ( +
    + {images.map((image) => { + const [width, height] = image.dim?.split("x").map(Number) ?? []; + return ( +
  • + + {remove ? ( +
  • + ); + })} +
+ ); +} + +/** A linked conversation as the viewer may see it: its name when readable, + * "Private channel" with no name when not. */ +function LinkedConversation({ + session, + channelId, + open, +}: { + session: RelaySession; + channelId: string; + open(): void; +}) { + const reference = useChannelReference(session.channels, channelId); + let icon: ReactNode =