refactor(web): field controls stop restyling Input, Select, Combobox and Command (#13206)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Julius MarmingeandClaude Opus 5.5 authored and GitHub committed 2026-09-22 21:33:02 -07:00
1 parent 866fc90759
commit 21079391c7
24 files changed
+72 -90

No files matched your search

+9 -10
View File
@@ -189,10 +189,7 @@ export function BrowserDeviceToolbar({
<SelectTrigger
variant="ghost"
size="xs"
className={cn(
"shrink-0 justify-between px-1.5 font-medium",
width >= 440 ? "w-36" : "w-24",
)}
className={cn("shrink-0 justify-between", width >= 440 ? "w-36" : "w-24")}
aria-label="Browser device preset"
>
<SelectValue />
@@ -227,7 +224,8 @@ export function BrowserDeviceToolbar({
nativeInput
type="number"
inputMode="numeric"
size="sm"
size="compact"
font="mono"
min={PREVIEW_VIEWPORT_MIN_DIMENSION}
max={PREVIEW_VIEWPORT_MAX_DIMENSION}
value={presentedSize.width}
@@ -245,8 +243,8 @@ export function BrowserDeviceToolbar({
aria-label="Viewport width"
aria-invalid={!customValid}
className={cn(
"h-6 rounded-md text-center tabular-nums [&_[data-slot=input]]:h-full [&_[data-slot=input]]:px-1 [&_[data-slot=input]]:text-xs [&_[data-slot=input]]:leading-none [&_[data-slot=input]::-webkit-inner-spin-button]:appearance-none [&_[data-slot=input]]:[appearance:textfield]",
width >= 360 ? "w-14" : "w-11",
"text-center [&_[data-slot=input]::-webkit-inner-spin-button]:appearance-none [&_[data-slot=input]]:[appearance:textfield]",
width >= 360 ? "w-14" : "w-13",
)}
/>
<span className="text-xs text-muted-foreground">×</span>
@@ -254,7 +252,8 @@ export function BrowserDeviceToolbar({
nativeInput
type="number"
inputMode="numeric"
size="sm"
size="compact"
font="mono"
min={PREVIEW_VIEWPORT_MIN_DIMENSION}
max={PREVIEW_VIEWPORT_MAX_DIMENSION}
value={presentedSize.height}
@@ -272,8 +271,8 @@ export function BrowserDeviceToolbar({
aria-label="Viewport height"
aria-invalid={!customValid}
className={cn(
"h-6 rounded-md text-center tabular-nums [&_[data-slot=input]]:h-full [&_[data-slot=input]]:px-1 [&_[data-slot=input]]:text-xs [&_[data-slot=input]]:leading-none [&_[data-slot=input]::-webkit-inner-spin-button]:appearance-none [&_[data-slot=input]]:[appearance:textfield]",
width >= 360 ? "w-14" : "w-11",
"text-center [&_[data-slot=input]::-webkit-inner-spin-button]:appearance-none [&_[data-slot=input]]:[appearance:textfield]",
width >= 360 ? "w-14" : "w-13",
)}
/>
</form>
@@ -704,7 +704,6 @@ export function BranchToolbarBranchSelector({
key={itemValue}
index={index}
value={itemValue}
className="pe-2"
onClick={() => selectPickerItem(itemValue)}
>
<div className="flex min-w-0 items-center gap-2 py-1">
@@ -726,7 +725,6 @@ export function BranchToolbarBranchSelector({
key={itemValue}
index={index}
value={itemValue}
className="pe-1.5"
onClick={() => selectPickerItem(itemValue)}
>
<span className="truncate">Create new ref &quot;{newRefName}&quot;</span>
@@ -754,7 +752,6 @@ export function BranchToolbarBranchSelector({
key={itemValue}
index={index}
value={itemValue}
className="pe-1.5"
onClick={() => selectPickerItem(itemValue)}
onContextMenu={(event) => handleBranchContextMenu(event, itemValue)}
>
@@ -809,10 +806,10 @@ export function BranchToolbarBranchSelector({
onContextMenu={(event) => handleBranchContextMenu(event, resolvedActiveBranch)}
>
<ComboboxTrigger
render={<Button variant="ghost" size="xs" />}
render={<ComposerControl size="xs" />}
// No press-scale: the popup aligns live to this trigger, so a
// momentary 0.97 shrink would drag the open popup ~3px sideways.
className="min-w-0 max-w-full font-normal text-muted-foreground/70 text-xs! hover:text-foreground/80 active:scale-100"
className="min-w-0 max-w-full active:scale-100"
disabled={isInitialBranchesLoadPending || isBranchActionPending}
>
<GitBranchIcon className="size-3 shrink-0 opacity-70" />
@@ -110,7 +110,7 @@ export const BranchToolbarEnvModeSelector = memo(function BranchToolbarEnvModeSe
<SelectTrigger
variant="ghost"
size="xs"
className="min-w-0 shrink font-normal text-xs!"
className="min-w-0 shrink"
aria-label="Workspace"
data-composer-shortcut="composer.workspace"
data-composer-context-control
@@ -102,7 +102,7 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir
<SelectTrigger
variant="ghost"
size="xs"
className="min-w-0 max-w-full font-normal text-xs!"
className="min-w-0 max-w-full"
aria-label="Run on"
data-composer-shortcut="composer.host"
data-composer-context-control
+1 -1
View File
@@ -650,7 +650,7 @@ function CommandPaletteDialog(props: {
? "Search project contents"
: "Command palette"
}
className={cn("overflow-hidden p-0", props.mode === "content" && "h-105")}
className={cn("overflow-hidden", props.mode === "content" && "h-105")}
data-command-palette="true"
data-palette-mode={props.mode}
data-testid="command-palette"
@@ -50,7 +50,7 @@ export function CommandPaletteContent({
{inputAccessory}
</div>
<CommandPanel className={panelClassName}>{children}</CommandPanel>
<CommandFooter className="gap-3 max-sm:flex-col max-sm:items-start">
<CommandFooter className="max-sm:flex-col max-sm:items-start">
<div className="flex items-center gap-3">
<KbdGroup>
<Kbd>
@@ -41,7 +41,7 @@ export function CommandPaletteResults(props: CommandPaletteResultsProps) {
<CommandList>
{props.groups.map((group) => (
<CommandGroup items={group.items} key={group.value}>
<CommandGroupLabel className="ps-[9px]">{group.label}</CommandGroupLabel>
<CommandGroupLabel>{group.label}</CommandGroupLabel>
<CommandCollection>
{(item) =>
item.disabled ? (
@@ -109,7 +109,6 @@ function CommandPaletteResultRow(props: {
<CommandItem
value={props.item.value}
active={props.isActive}
className="gap-2"
onMouseDown={(event) => {
event.preventDefault();
}}
@@ -169,7 +169,6 @@ function CustomSnoozeDialog() {
) : (
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
<NumberField
className="gap-1.5"
id={`${id}-amount`}
min={0}
step="any"
+2 -1
View File
@@ -749,7 +749,8 @@ export default function DiffPanel({
}}
>
<ComboboxTrigger
className="inline-flex min-w-0 max-w-48 items-center gap-1 overflow-hidden rounded-md px-1.5 py-1 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
render={<Button variant="ghost-muted" size="xs" />}
className="min-w-0 max-w-48"
aria-label={`Change comparison target. Currently ${selectedGitSource.baseRef}`}
>
<span className="min-w-0 truncate">{selectedGitSource.baseRef}</span>
+4 -5
View File
@@ -2784,7 +2784,7 @@ function ProjectSortMenu({
<div className="px-2 py-1">
<NumberField
aria-label="Visible thread count"
className="w-28 gap-0"
className="w-28"
max={MAX_SIDEBAR_THREAD_PREVIEW_COUNT}
min={MIN_SIDEBAR_THREAD_PREVIEW_COUNT}
onValueChange={handleThreadPreviewCountChange}
@@ -2792,14 +2792,13 @@ function ProjectSortMenu({
step={1}
value={threadPreviewCount}
>
<NumberFieldGroup className="h-7 rounded-md sm:h-6.5">
<NumberFieldGroup>
<NumberFieldDecrement
aria-label="Decrease visible thread count"
className="px-2 sm:px-2 [&_svg]:size-3.5"
className="[&_svg]:size-3.5"
/>
<NumberFieldInput
aria-label="Visible thread count"
className="h-7 w-9 grow-0 px-0 text-xs leading-7 sm:h-6.5 sm:leading-6.5"
inputMode="numeric"
onKeyDownCapture={(event) => {
event.stopPropagation();
@@ -2807,7 +2806,7 @@ function ProjectSortMenu({
/>
<NumberFieldIncrement
aria-label="Increase visible thread count"
className="px-2 sm:px-2 [&_svg]:size-3.5"
className="[&_svg]:size-3.5"
/>
</NumberFieldGroup>
</NumberField>
-1
View File
@@ -4483,7 +4483,6 @@ export default function Sidebar() {
key={item.value}
hideIndicator
value={item}
className="font-medium"
onContextMenu={(event) => {
if (project) handleProjectSettings(event, project);
}}
@@ -162,7 +162,6 @@ const ComposerCommandMenuItem = memo(function ComposerCommandMenuItem(props: {
value={props.item.id}
data-composer-item-id={props.item.id}
active={props.isActive}
className="gap-3 rounded-lg px-3 py-2!"
onMouseMove={() => {
if (!props.isActive) props.onHighlight(props.item.id);
}}
@@ -181,11 +181,6 @@ export function PreviewChromeRow({
<InputGroupInput
ref={inputRef}
value={inputFocused ? draft : url}
className={cn(
onOpenInBrowser &&
!inputFocused &&
"group-hover/address:pe-7 transition-[padding]",
)}
onChange={(event) => setDraft(event.target.value)}
onFocus={() => {
setDraft(url);
@@ -213,26 +208,26 @@ export function PreviewChromeRow({
/>
</Tooltip>
{onOpenInBrowser && !inputFocused ? (
<InputGroupAddon
align="inline-end"
className="pointer-events-none absolute inset-y-0 right-0 opacity-0 transition-opacity group-hover/address:pointer-events-auto group-hover/address:opacity-100"
>
<Tooltip>
<TooltipTrigger
render={
<Button
variant="ghost"
size="icon-xs"
onClick={onOpenInBrowser}
aria-label="Open in system browser"
type="button"
/>
}
>
<ExternalLink />
</TooltipTrigger>
<TooltipPopup>Open in system browser</TooltipPopup>
</Tooltip>
<InputGroupAddon align="inline-end">
{/* Revealed on hover so a resting address bar reads as plain text. */}
<span className="pointer-events-none flex opacity-0 transition-opacity focus-within:pointer-events-auto focus-within:opacity-100 group-hover/address:pointer-events-auto group-hover/address:opacity-100">
<Tooltip>
<TooltipTrigger
render={
<Button
variant="ghost"
size="icon-xs"
onClick={onOpenInBrowser}
aria-label="Open in system browser"
type="button"
/>
}
>
<ExternalLink />
</TooltipTrigger>
<TooltipPopup>Open in system browser</TooltipPopup>
</Tooltip>
</span>
</InputGroupAddon>
) : null}
</InputGroup>
@@ -89,11 +89,13 @@ function EmptyContentSearchDialog() {
footerActionLabel="Open file"
inputProps={{ disabled: true, placeholder: "Search project contents…" }}
mode="none"
panelClassName="flex min-h-0 flex-1 items-center justify-center px-6 text-center text-sm text-muted-foreground"
panelClassName="flex min-h-0 flex-1 items-center justify-center"
testId="project-content-search"
value=""
>
Open a project to search its files.
<p className="px-6 text-center text-muted-foreground text-sm">
Open a project to search its files.
</p>
</CommandPaletteContent>
);
}
@@ -306,7 +306,6 @@ export function AddProviderInstanceDialog({
<label className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>
<span className="text-xs font-medium text-foreground">Label</span>
<Input
className="bg-background"
placeholder="e.g. Work"
value={label}
onChange={(event) => setLabel(event.target.value)}
@@ -319,7 +318,6 @@ export function AddProviderInstanceDialog({
<label className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>
<span className="text-xs font-medium text-foreground">Instance ID</span>
<Input
className="bg-background"
placeholder={`${driver}_work`}
value={instanceId}
onChange={(event) => {
@@ -833,7 +833,6 @@ const PairingLinkListRow = memo(function PairingLinkListRow({
readOnly
value={revealValue}
rows={isRevealValueUrl ? 4 : 3}
className="text-xs leading-relaxed"
onFocus={(event) => event.currentTarget.select()}
onClick={(event) => event.currentTarget.select()}
/>
@@ -2734,7 +2733,7 @@ export function ConnectionsSettings() {
<AutocompleteItem
key={`${target.alias}:${target.hostname}:${target.port ?? ""}`}
value={target}
className="h-8 min-h-8 gap-2 whitespace-nowrap"
className="h-8 min-h-8 whitespace-nowrap"
>
<span className="min-w-0 truncate text-sm font-medium">
{target.alias}
@@ -2754,7 +2753,7 @@ export function ConnectionsSettings() {
})}
</AutocompleteList>
) : (
<AutocompleteEmpty className="break-all px-3 py-2 text-xs">
<AutocompleteEmpty className="break-all">
No hosts match "{savedBackendSshHost.trim()}".
</AutocompleteEmpty>
)}
@@ -42,6 +42,7 @@ import { useSettingsScope } from "./SettingsScopeContext";
import { Badge } from "../ui/badge";
import { Button } from "../ui/button";
import { Input } from "../ui/input";
import { InputGroup, InputGroupAddon, InputGroupInput } from "../ui/input-group";
import { Kbd, KbdGroup } from "../ui/kbd";
import { Menu, MenuItem, MenuPopup, MenuTrigger } from "../ui/menu";
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
@@ -143,9 +144,11 @@ function ExpandableHeaderSearch({
}
return (
<div className="relative">
<SearchIcon className="pointer-events-none absolute top-1/2 left-2 size-3 -translate-y-1/2 text-muted-foreground" />
<Input
<InputGroup className="w-44">
<InputGroupAddon>
<SearchIcon aria-hidden className="size-3" />
</InputGroupAddon>
<InputGroupInput
ref={inputRef}
autoFocus
type="search"
@@ -163,10 +166,9 @@ function ExpandableHeaderSearch({
}}
placeholder="Search keybindings"
aria-label="Search keybindings"
className="w-44 [&_[data-slot=input]]:pl-7"
size="sm"
/>
</div>
</InputGroup>
);
}
@@ -319,7 +321,7 @@ function WhenVariableSelect({
return (
<Select value={value} onValueChange={(nextValue) => nextValue && onChange(nextValue)}>
<SelectTrigger size="compact" className="min-w-0 flex-1">
<SelectValue placeholder="Condition" className="leading-7" />
<SelectValue placeholder="Condition" />
{unknownIdentifiers && unknownIdentifiers.length > 0 ? (
<UnknownWhenVariableWarning identifiers={unknownIdentifiers} focusable={false} />
) : null}
@@ -649,25 +651,22 @@ function WhenExpressionBuilder({
</div>
<div className="space-y-1.5">
<div className="relative">
<Input
<InputGroup>
<InputGroupInput
value={expressionDraft}
onChange={(event) => updateExpressionDraft(event.currentTarget.value)}
placeholder="Always"
aria-invalid={Boolean(parseError)}
aria-label="When expression"
className={cn(
"h-7 rounded-md font-mono text-[12px] leading-7 sm:h-7 sm:leading-7",
unknownIdentifiers.length > 0 && "pr-9",
parseError && "border-destructive/70 focus-visible:border-destructive",
)}
size="compact"
font="mono"
/>
{unknownIdentifiers.length > 0 ? (
<span className="absolute inset-y-0 right-2 flex items-center">
<InputGroupAddon align="inline-end">
<UnknownWhenVariableWarning identifiers={unknownIdentifiers} />
</span>
</InputGroupAddon>
) : null}
</div>
</InputGroup>
{parseError ? (
<div className="flex items-center gap-1.5 text-[11px] text-destructive">
<CircleXIcon className="size-3.5" />
@@ -858,7 +857,7 @@ function KeybindingKeyControl({
placeholder={isRecording ? "Press shortcut" : "Unassigned"}
size="sm"
font="mono"
className={cn("w-44", isRecording && "border-primary/70 bg-primary/5")}
className="w-44"
onFocus={() => setDraft({ isRecording: true })}
onBlur={() => setDraft({ isRecording: false })}
onChange={(event) => setDraft({ keyDraft: event.currentTarget.value })}
@@ -1168,7 +1167,7 @@ function NewKeybindingKeyInput({
placeholder={draft.isRecording ? "Press shortcut" : "Unassigned"}
size="sm"
font="mono"
className={cn(draft.isRecording && "border-primary/70 bg-primary/5", className)}
className={className}
onFocus={() => draft.setDraft({ isRecording: true })}
onBlur={() => draft.setDraft({ isRecording: false })}
onChange={(event) => draft.setDraft({ keyDraft: event.currentTarget.value })}
@@ -71,7 +71,7 @@ export function ProjectFaviconPickerDialog(props: {
{props.open ? (
<CommandDialogPopup
aria-label="Choose project icon"
className="overflow-hidden p-0"
className="overflow-hidden"
onBackdropPointerDown={() => props.onOpenChange(false)}
>
<CommandPaletteContent
@@ -46,7 +46,7 @@ function ProviderCustomColorPanel(props: {
/>
<Input
nativeInput
size="sm"
size="compact"
value={hexDraft ?? currentColor}
onChange={(event) => {
const nextColor = event.currentTarget.value;
@@ -57,7 +57,6 @@ function ProviderCustomColorPanel(props: {
}}
onBlur={() => setHexDraft(null)}
font="mono"
className="text-xs"
aria-label="Custom hex accent color"
spellCheck={false}
/>
@@ -388,7 +388,6 @@ function ProviderSettingsFieldRow({
) : (
<Input
id={inputId}
className="bg-background"
type={type}
autoComplete={field.control === "password" ? "off" : undefined}
value={readProviderConfigString(value, field.key)}
@@ -62,7 +62,7 @@ function RetentionControl({
<NumberFieldInput
aria-label={`${label} in days`}
size={new Intl.NumberFormat().format(draft ?? value).length}
className="field-sizing-content w-auto min-w-[1ch] grow-0 text-right in-data-[size=sm]:px-1"
className="field-sizing-content w-auto min-w-[1ch] grow-0 text-right"
/>
<span aria-hidden="true" className="self-center pr-2 text-xs">
days
@@ -353,15 +353,14 @@ export const ThemeColorField = memo(function ThemeColorField({
<Input
aria-invalid={!isColorValue}
aria-label={`${label} hex value`}
className="w-28 shrink-0 rounded-md border-0 bg-black/10 text-xs text-foreground shadow-none focus-within:bg-black/15 focus-within:ring-0 dark:bg-black/20 dark:focus-within:bg-black/25 [&_[data-slot=input]]:text-right"
className="w-28 shrink-0 [&_[data-slot=input]]:text-right"
font="mono"
id={`${role}-hex`}
nativeInput
onChange={(event) => onChange(role, event.currentTarget.value)}
onFocus={() => onSelect?.(role)}
onPointerDown={() => onSelect?.(role)}
size="sm"
unstyled
size="compact"
value={editorValue}
/>
</div>
+1 -1
View File
@@ -125,7 +125,7 @@ function AutocompleteItem({ className, children, ...props }: AutocompletePrimiti
return (
<AutocompletePrimitive.Item
className={cn(
"flex min-h-8 cursor-default select-none items-center rounded-sm px-2 py-1 text-base outline-none hover:bg-accent data-disabled:pointer-events-none data-selected:bg-accent/50 data-selected:text-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground [&[data-highlighted][data-selected]]:bg-accent [&[data-highlighted][data-selected]]:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='text-'])]:text-muted-foreground",
"flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base outline-none hover:bg-accent data-disabled:pointer-events-none data-selected:bg-accent/50 data-selected:text-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground [&[data-highlighted][data-selected]]:bg-accent [&[data-highlighted][data-selected]]:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='text-'])]:text-muted-foreground",
className,
)}
data-slot="autocomplete-item"
+1 -1
View File
@@ -8,7 +8,7 @@ import * as NodeURL from "node:url";
// components/ui exports are migrated to variants (see vite.config.ts). This gate keeps the
// count from growing: CI fails when findings exceed the ceiling. Lower the ceiling when you
// migrate a file, and delete this script when the rule becomes an error.
export const RESTYLE_CEILING = 499;
export const RESTYLE_CEILING = 402;
const RULE = "shadcn(no-restyle)";