refactor(web): reuse searchable picker inputs (#12353)

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-09-17 20:17:51 -07:00
1 parent 53510d44ea
commit 8583eac643
5 files changed
+28 -82

No files matched your search

@@ -9,7 +9,7 @@ import {
} from "@t3tools/client-runtime/state/runtime";
import type { ContextMenuItem, EnvironmentId, VcsRef, ThreadId } from "@t3tools/contracts";
import { LegendList, type LegendListRef } from "@legendapp/list/react";
import { ChevronDownIcon, GitBranchIcon, SearchIcon } from "lucide-react";
import { ChevronDownIcon, GitBranchIcon } from "lucide-react";
import {
useCallback,
useDeferredValue,
@@ -64,7 +64,7 @@ import { getVirtualizedScrollFadeClassName } from "./ui/scroll-area";
import {
Combobox,
ComboboxEmpty,
ComboboxInput,
ComboboxSearchInput,
ComboboxItem,
ComboboxListVirtualized,
ComboboxPopup,
@@ -824,24 +824,11 @@ export function BranchToolbarBranchSelector({
className="flex w-80 flex-col"
{...composerFloatingLayerProps}
>
<div className="shrink-0 px-3 pt-2.5">
<div className="relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring">
<SearchIcon
aria-hidden="true"
className="pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55"
/>
<ComboboxInput
className="[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5"
inputClassName="rounded-none bg-transparent text-sm"
placeholder="Search refs..."
showTrigger={false}
size="sm"
unstyled
value={branchQuery}
onChange={(event) => setBranchQuery(event.target.value)}
/>
</div>
</div>
<ComboboxSearchInput
placeholder="Search refs..."
value={branchQuery}
onChange={(event) => setBranchQuery(event.target.value)}
/>
<div className="flex min-h-0 flex-1 flex-col overflow-hidden">
<ComboboxEmpty>No refs found.</ComboboxEmpty>
<div className="relative min-h-0 w-full max-h-56 flex-1 overflow-hidden">
+6 -20
View File
@@ -19,7 +19,6 @@ import {
FolderTreeIcon,
PilcrowIcon,
Rows3Icon,
SearchIcon,
TextWrapIcon,
} from "lucide-react";
import * as Schema from "effect/Schema";
@@ -64,7 +63,7 @@ import { Switch } from "./ui/switch";
import {
Combobox,
ComboboxEmpty,
ComboboxInput,
ComboboxSearchInput,
ComboboxItem,
ComboboxList,
ComboboxPopup,
@@ -757,24 +756,11 @@ export default function DiffPanel({
align="start"
className="w-72 min-w-0 max-w-[calc(100vw-1rem)] overflow-hidden"
>
<div className="min-w-0 shrink-0 px-3 pt-2.5">
<div className="relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring">
<SearchIcon
aria-hidden="true"
className="pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55"
/>
<ComboboxInput
className="[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5"
inputClassName="rounded-none bg-transparent text-sm"
placeholder="Search refs..."
showTrigger={false}
size="sm"
unstyled
value={baseRefQuery}
onChange={(event) => setBaseRefQuery(event.target.value)}
/>
</div>
</div>
<ComboboxSearchInput
placeholder="Search refs..."
value={baseRefQuery}
onChange={(event) => setBaseRefQuery(event.target.value)}
/>
<div className="grid shrink-0 grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 border-b border-border/70 ps-3 pe-6.5 pt-2 pb-1.5 font-medium text-[10px] text-muted-foreground uppercase tracking-wide">
<span aria-hidden="true" />
<div className="grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center">
@@ -6,13 +6,12 @@
* The same combobox as the project and branch pickers, and dressed the same, rather than a menu:
* a menu's typeahead claims every keypress to jump between rows, which a search box cannot share.
*/
import { SearchIcon } from "lucide-react";
import type { ReactNode } from "react";
import { Button } from "../ui/button";
import {
Combobox,
ComboboxInput,
ComboboxSearchInput,
ComboboxItem,
ComboboxList,
ComboboxPopup,
@@ -123,25 +122,12 @@ export function PullRequestCandidatePicker<T>({
}
/>
<ComboboxPopup align="start" side="bottom" className="w-72">
<div className="shrink-0 px-3 pt-2.5">
<div className="relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring">
<SearchIcon
aria-hidden="true"
className="pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55"
/>
<ComboboxInput
aria-label={searchLabel}
className="[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5"
inputClassName="rounded-none bg-transparent text-sm"
placeholder={searchLabel}
showTrigger={false}
size="sm"
unstyled
value={query}
onChange={(event) => onQueryChange(event.target.value)}
/>
</div>
</div>
<ComboboxSearchInput
aria-label={searchLabel}
placeholder={searchLabel}
value={query}
onChange={(event) => onQueryChange(event.target.value)}
/>
<ComboboxList className="max-h-72">
{isPending ? (
<PullRequestPeopleGhost rows={4} />
@@ -1,11 +1,11 @@
import { LegendList, type LegendListRef } from "@legendapp/list/react";
import { CheckIcon, ChevronDownIcon, SearchIcon } from "lucide-react";
import { CheckIcon, ChevronDownIcon } from "lucide-react";
import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
import { isMonospaceFamily, queryInstalledFontFamilies } from "../../appearanceFonts";
import {
Combobox,
ComboboxEmpty,
ComboboxInput,
ComboboxSearchInput,
ComboboxItem,
ComboboxListVirtualized,
ComboboxPopup,
@@ -211,24 +211,11 @@ export function FontFamilyPicker({
<ChevronDownIcon className="-me-1 size-3 opacity-50" />
</ComboboxTrigger>
<ComboboxPopup align="end" className="flex w-72 flex-col">
<div className="shrink-0 px-3 pt-2.5">
<div className="relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring">
<SearchIcon
aria-hidden="true"
className="pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55"
/>
<ComboboxInput
className="[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5"
inputClassName="rounded-none bg-transparent text-sm"
placeholder="Search fonts…"
showTrigger={false}
size="sm"
unstyled
value={query}
onChange={(event) => setQuery(event.target.value)}
/>
</div>
</div>
<ComboboxSearchInput
placeholder="Search fonts…"
value={query}
onChange={(event) => setQuery(event.target.value)}
/>
<div className="flex min-h-0 flex-1 flex-col overflow-hidden">
<ComboboxEmpty>No fonts found.</ComboboxEmpty>
<div className="relative min-h-0 max-h-72 w-full flex-1 overflow-hidden">
+1 -1
View File
@@ -132,7 +132,7 @@ function ComboboxInput({
function ComboboxSearchInput(props: React.ComponentProps<typeof ComboboxInput>) {
return (
<div className="shrink-0 px-3 pt-2.5">
<div className="min-w-0 shrink-0 px-3 pt-2.5">
<div className="relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring">
<SearchIcon
aria-hidden="true"