refactor(web): add SidebarInput (#13028)

Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
Julius MarmingeandClaude Fable 5 authored and GitHub committed 2026-09-22 12:22:13 -07:00
1 parent 7b54af90f7
commit be80e36939
4 files changed
+23 -10

No files matched your search

@@ -27,7 +27,6 @@ import {
import { useLocation, useNavigate } from "@tanstack/react-router";
import { Button } from "../ui/button";
import { Input } from "../ui/input";
import { Kbd } from "../ui/kbd";
import {
SidebarContent,
@@ -37,6 +36,7 @@ import {
SidebarMenuButton,
SidebarMenuItem,
useSidebar,
SidebarInput,
} from "../ui/sidebar";
import { SidebarUtilityMenu } from "../sidebar/SidebarChrome";
import { scrollToSettingsTarget } from "./settingsLayout";
@@ -237,10 +237,9 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
<SidebarGroup className="gap-2 p-[var(--sidebar-content-inset)]">
<div className="flex h-8 items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground hover:bg-sidebar-row-hover hover:text-sidebar-foreground">
<SearchIcon className="size-4 shrink-0 text-sidebar-muted-foreground/80" />
<Input
<SidebarInput
ref={searchInputRef}
nativeInput
unstyled
type="search"
value={query}
onChange={(event) => {
@@ -259,7 +258,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
? `settings-search-result-${results[activeResultIndex].id}`
: undefined
}
className="min-w-0 flex-1 [&_[data-slot=input]]:h-auto [&_[data-slot=input]]:p-0 [&_[data-slot=input]]:leading-normal [&_[data-slot=input]]:text-sm [&_[data-slot=input]]:font-medium [&_[data-slot=input]]:text-sidebar-foreground [&_[data-slot=input]]:placeholder:text-sidebar-muted-foreground"
className="min-w-0 flex-1"
/>
{isSearching ? (
<Button
@@ -21,8 +21,7 @@ import {
import { cn } from "~/lib/utils";
import { Button } from "../ui/button";
import { Input } from "../ui/input";
import { SidebarMenuButton } from "../ui/sidebar";
import { SidebarInput, SidebarMenuButton } from "../ui/sidebar";
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
export interface SidebarThreadHeaderProps {
@@ -85,10 +84,9 @@ export function SidebarThreadHeader({
className="flex h-8 min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
>
<SearchIcon className="size-4 shrink-0 text-[var(--sidebar-icon-color)]" />
<Input
<SidebarInput
ref={searchInputRef}
nativeInput
unstyled
type="search"
value={searchQuery}
onChange={(event) => onSearchQueryChange(event.currentTarget.value)}
@@ -104,7 +102,7 @@ export function SidebarThreadHeader({
? `sidebar-thread-search-result-${activeSearchResultIndex}`
: undefined
}
className="min-w-0 flex-1 [&_[data-slot=input]]:h-auto [&_[data-slot=input]]:p-0 [&_[data-slot=input]]:leading-normal [&_[data-slot=input]]:text-sm [&_[data-slot=input]]:font-medium [&_[data-slot=input]]:text-sidebar-foreground [&_[data-slot=input]]:placeholder:text-[var(--sidebar-icon-color)]"
className="min-w-0 flex-1"
/>
{isSearching ? (
<Button
+16
View File
@@ -5,6 +5,7 @@ import { PanelLeftCloseIcon, PanelLeftIcon } from "lucide-react";
import * as React from "react";
import { cn } from "~/lib/utils";
import { Button } from "~/components/ui/button";
import { Input, type InputProps } from "~/components/ui/input";
import { ScrollArea } from "~/components/ui/scroll-area";
import {
Sheet,
@@ -530,6 +531,20 @@ function SidebarRail({
);
}
/** A bare search or rename field that sits in a row of sidebar chrome. */
function SidebarInput({ className, ...props }: Omit<InputProps, "unstyled" | "variant">) {
return (
<Input
className={cn(
"[&_[data-slot=input]]:h-auto [&_[data-slot=input]]:p-0 [&_[data-slot=input]]:font-medium [&_[data-slot=input]]:text-sidebar-foreground [&_[data-slot=input]]:text-sm [&_[data-slot=input]]:leading-normal [&_[data-slot=input]]:placeholder:text-sidebar-muted-foreground",
className,
)}
unstyled
{...props}
/>
);
}
function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
return (
<main
@@ -770,6 +785,7 @@ function SidebarMenuSubButton({
}
export {
SidebarInput,
Sidebar,
SidebarContent,
SidebarFooter,
+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 = 1043;
export const RESTYLE_CEILING = 1031;
const RULE = "shadcn(no-restyle)";