TypeScript
refactor(web): add font="mono" to Input (#13027)
Julius Marminge7b54af90f79a
diff --git a/apps/web/src/components/device/DeviceToolsPanel.tsx b/apps/web/src/components/device/DeviceToolsPanel.tsxindex 79f84529aeb..39b8123cd03 100644--- a/apps/web/src/components/device/DeviceToolsPanel.tsx+++ b/apps/web/src/components/device/DeviceToolsPanel.tsx@@ -493,7 +493,8 @@ function SubmitRow(props: {><Inputsize="compact"- className="min-w-0 flex-1 font-mono"+ font="mono"+ className="min-w-0 flex-1"placeholder={props.placeholder}value={value}disabled={props.disabled}@@ -530,7 +531,8 @@ function LocationSection(props: {<div className="flex gap-1.5"><Inputsize="compact"- className="min-w-0 flex-1 font-mono"+ font="mono"+ className="min-w-0 flex-1"placeholder="Latitude"inputMode="decimal"value={latitude}@@ -539,7 +541,8 @@ function LocationSection(props: {/><Inputsize="compact"- className="min-w-0 flex-1 font-mono"+ font="mono"+ className="min-w-0 flex-1"placeholder="Longitude"inputMode="decimal"value={longitude}@@ -619,7 +622,7 @@ function PermissionsSection(props: {<Section title="Permissions"><Inputsize="compact"- className="font-mono"+ font="mono"placeholder={props.defaultAppId || "App ID"}value={appId}disabled={props.disabled}diff --git a/apps/web/src/components/settings/CustomModelEditor.tsx b/apps/web/src/components/settings/CustomModelEditor.tsxindex 9fa65e0bf23..d1a32c3fd7b 100644--- a/apps/web/src/components/settings/CustomModelEditor.tsx+++ b/apps/web/src/components/settings/CustomModelEditor.tsx@@ -154,7 +154,8 @@ export function CustomModelEditor({value={choice.id}onChange={(event) => updateChoice(descriptor.key, choice.key, { id: event.target.value })}placeholder="value"- className="w-28 font-mono"+ font="mono"+ className="w-28"spellCheck={false}aria-label="Choice value"/>@@ -230,7 +231,8 @@ export function CustomModelEditor({value={descriptor.id}onChange={(event) => updateDescriptor(descriptor.key, { id: event.target.value })}placeholder="optionId"- className="w-36 font-mono"+ font="mono"+ className="w-36"spellCheck={false}aria-label="Option id"/>diff --git a/apps/web/src/components/settings/KeybindingsSettings.tsx b/apps/web/src/components/settings/KeybindingsSettings.tsxindex 4a22680b63f..8371d0d9cdf 100644--- a/apps/web/src/components/settings/KeybindingsSettings.tsx+++ b/apps/web/src/components/settings/KeybindingsSettings.tsx@@ -320,7 +320,7 @@ function WhenVariableSelect({return (<Select value={value} onValueChange={(nextValue) => nextValue && onChange(nextValue)}>- <SelectTrigger size="compact" className="min-w-0 flex-1 font-mono">+ <SelectTrigger size="compact" className="min-w-0 flex-1"><SelectValue placeholder="Condition" className="leading-7" />{unknownIdentifiers && unknownIdentifiers.length > 0 ? (<UnknownWhenVariableWarning identifiers={unknownIdentifiers} focusable={false} />@@ -333,11 +333,7 @@ function WhenVariableSelect({className="max-h-72 w-fit min-w-44">{options.map((option) => (- <SelectItem- key={option}- value={option}- className="min-h-7 w-full py-1 font-mono text-[12px]"- >+ <SelectItem key={option} value={option} className="min-h-7 w-full py-1 text-[12px]"><span className="truncate">{option}</span></SelectItem>))}@@ -546,10 +542,10 @@ function WhenExpressionNodeEditor({popupClassName="w-fit"className="w-fit min-w-24">- <SelectItem value="and" className="min-h-7 py-1 font-mono text-[12px]">+ <SelectItem value="and" className="min-h-7 py-1 text-[12px]">and</SelectItem>- <SelectItem value="or" className="min-h-7 py-1 font-mono text-[12px]">+ <SelectItem value="or" className="min-h-7 py-1 text-[12px]">or</SelectItem></SelectContent>@@ -877,7 +873,8 @@ function KeybindingKeyControl({value={isRecording ? "" : keyDraft}placeholder={isRecording ? "Press shortcut" : "Unassigned"}size="sm"- className={cn("w-44 font-mono", isRecording && "border-primary/70 bg-primary/5")}+ font="mono"+ className={cn("w-44", isRecording && "border-primary/70 bg-primary/5")}onFocus={() => setDraft({ isRecording: true })}onBlur={() => setDraft({ isRecording: false })}onChange={(event) => setDraft({ keyDraft: event.currentTarget.value })}@@ -1190,7 +1187,8 @@ function NewKeybindingKeyInput({value={draft.isRecording ? "" : draft.keyDraft}placeholder={draft.isRecording ? "Press shortcut" : "Unassigned"}size="sm"- className={cn("font-mono", draft.isRecording && "border-primary/70 bg-primary/5", className)}+ font="mono"+ className={cn(draft.isRecording && "border-primary/70 bg-primary/5", className)}onFocus={() => draft.setDraft({ isRecording: true })}onBlur={() => draft.setDraft({ isRecording: false })}onChange={(event) => draft.setDraft({ keyDraft: event.currentTarget.value })}diff --git a/apps/web/src/components/settings/ProviderAccentColorPicker.tsx b/apps/web/src/components/settings/ProviderAccentColorPicker.tsxindex 500f3c0a7cb..82e3d76f722 100644--- a/apps/web/src/components/settings/ProviderAccentColorPicker.tsx+++ b/apps/web/src/components/settings/ProviderAccentColorPicker.tsx@@ -56,7 +56,8 @@ function ProviderCustomColorPanel(props: {props.onCommit(nextColor);}}onBlur={() => setHexDraft(null)}- className="font-mono text-xs"+ font="mono"+ className="text-xs"aria-label="Custom hex accent color"spellCheck={false}/>diff --git a/apps/web/src/components/settings/ProviderInstanceCard.tsx b/apps/web/src/components/settings/ProviderInstanceCard.tsxindex ed8f5893f50..eebd871735d 100644--- a/apps/web/src/components/settings/ProviderInstanceCard.tsx+++ b/apps/web/src/components/settings/ProviderInstanceCard.tsx@@ -268,7 +268,8 @@ function ProviderEnvironmentSection(props: {<div key={variable.id} className="flex min-w-0 flex-wrap items-center gap-1.5"><DraftInputsize="sm"- className="w-full min-w-0 font-mono sm:w-44 sm:shrink-0"+ font="mono"+ className="w-full min-w-0 sm:w-44 sm:shrink-0"value={variable.name}onCommit={(name) => updateVariable(variable.id, { name: name.trim() })}placeholder="VARIABLE_NAME"@@ -280,7 +281,8 @@ function ProviderEnvironmentSection(props: {</span><DraftInputsize="sm"- className="min-w-0 flex-1 font-mono"+ font="mono"+ className="min-w-0 flex-1"value={variable.valueRedacted ? "" : variable.value}onCommit={(value) => updateVariable(variable.id, { value })}type={variable.sensitive ? "password" : undefined}diff --git a/apps/web/src/components/settings/ThemeColorPicker.tsx b/apps/web/src/components/settings/ThemeColorPicker.tsxindex 7ddb89fa89a..a1d2cde90b0 100644--- a/apps/web/src/components/settings/ThemeColorPicker.tsx+++ b/apps/web/src/components/settings/ThemeColorPicker.tsx@@ -353,7 +353,8 @@ export const ThemeColorField = memo(function ThemeColorField({<Inputaria-invalid={!isColorValue}aria-label={`${label} hex value`}- className="w-28 shrink-0 rounded-md border-0 bg-black/10 font-mono 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 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"+ font="mono"id={`${role}-hex`}nativeInputonChange={(event) => onChange(role, event.currentTarget.value)}diff --git a/apps/web/src/components/ui/input.tsx b/apps/web/src/components/ui/input.tsxindex cae3dfe6285..a5810308b6e 100644--- a/apps/web/src/components/ui/input.tsx+++ b/apps/web/src/components/ui/input.tsx@@ -7,6 +7,8 @@ import { cn } from "~/lib/utils";type InputProps = Omit<InputPrimitive.Props & React.RefAttributes<HTMLInputElement>, "size"> & {size?: "sm" | "compact" | "default" | "lg" | number;+ /** Monospace with tabular digits, for paths, commands, colors and numbers. */+ font?: "default" | "mono";unstyled?: boolean;nativeInput?: boolean;};@@ -14,6 +16,7 @@ type InputProps = Omit<InputPrimitive.Props & React.RefAttributes<HTMLInputElemefunction Input({className,size = "default",+ font = "default",unstyled = false,nativeInput = false,...props@@ -63,6 +66,7 @@ function Input({!unstyled &&size === "compact" &&"rounded-md before:rounded-[calc(var(--radius-md)-1px)]",+ font === "mono" && "font-mono tabular-nums",className,) || undefined}diff --git a/apps/web/src/components/usage/UsagePriceOverrides.tsx b/apps/web/src/components/usage/UsagePriceOverrides.tsxindex 9f3e5697b5e..6007de4c2fe 100644--- a/apps/web/src/components/usage/UsagePriceOverrides.tsx+++ b/apps/web/src/components/usage/UsagePriceOverrides.tsx@@ -429,7 +429,7 @@ export function UsagePriceOverrides({}autoComplete="off"disabled={locked}- className="tabular-nums"+ font="mono"onChange={(event) =>editCell(row, field.key, event.target.value)}diff --git a/scripts/lint-restyle-ceiling.ts b/scripts/lint-restyle-ceiling.tsindex 53e91c63073..349949848cb 100644--- a/scripts/lint-restyle-ceiling.ts+++ b/scripts/lint-restyle-ceiling.ts@@ -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 = 1060;+export const RESTYLE_CEILING = 1043;const RULE = "shadcn(no-restyle)";