Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(web): facet sidebar visual cleanup (#18353)

Trang Nguyen9f9965ea51d6
diff --git a/web/src/components/table/FacetHeader.stories.tsx b/web/src/components/table/FacetHeader.stories.tsx
new file mode 100644
index 0000000000..f60d7eeb5e
--- /dev/null
+++ b/web/src/components/table/FacetHeader.stories.tsx
@@ -0,0 +1,85 @@
+import { useState } from "react";
+import { expect, fn, userEvent } from "storybook/test";
+import preview from "../../../.storybook/preview";
+import { Checkbox } from "@/src/components/design-system/Checkbox/Checkbox";
+import { FacetHeader } from "./FacetHeader";
+
+const meta = preview.meta({ component: FacetHeader });
+
+export const Default = meta.story({
+ args: {
+ label: "Environment",
+ children: <span className="min-w-0 truncate">Environment</span>,
+ summary: "All",
+ summaryIcon: null,
+ isActive: false,
+ isDisabled: false,
+ onReset: fn(),
+ "aria-expanded": false,
+ },
+});
+
+export const WithSelection = meta.story({
+ args: {
+ label: "Environment",
+ children: <span className="min-w-0 truncate">Environment</span>,
+ summary: "production",
+ summaryIcon: null,
+ isActive: true,
+ isDisabled: false,
+ onReset: fn(),
+ "aria-expanded": false,
+ },
+});
+
+export const TestHeaderHeight = meta.story({
+ name: "(Test) Selection Keeps Header Height",
+ args: {
+ label: "Environment",
+ children: <span className="min-w-0 truncate">Environment</span>,
+ summary: "All",
+ summaryIcon: null,
+ isActive: false,
+ isDisabled: false,
+ onReset: fn(),
+ "aria-expanded": true,
+ },
+ render: (args) => {
+ const [selected, setSelected] = useState(false);
+ return (
+ <div className="w-72">
+ <div className="flex">
+ <FacetHeader
+ {...args}
+ isActive={selected}
+ summary={selected ? "production" : "All"}
+ onReset={() => setSelected(false)}
+ />
+ </div>
+ <label className="flex items-center gap-2 p-2">
+ <Checkbox
+ checked={selected}
+ onCheckedChange={(checked) => setSelected(checked === true)}
+ />
+ production
+ </label>
+ </div>
+ );
+ },
+ play: async ({ canvas }) => {
+ const header = canvas.getByRole("button", { name: /^Environment$/ });
+ const initialHeight = header.getBoundingClientRect().height;
+ await userEvent.click(canvas.getByRole("checkbox", { name: "production" }));
+ await expect(
+ canvas.getByRole("button", { name: "Clear Environment filter" }),
+ ).toBeVisible();
+ await expect(header.getBoundingClientRect().height).toBe(initialHeight);
+ await userEvent.click(
+ canvas.getByRole("button", { name: "Clear Environment filter" }),
+ );
+ await expect(header.getBoundingClientRect().height).toBe(initialHeight);
+ await expect(
+ canvas.getByRole("checkbox", { name: "production" }),
+ ).not.toBeChecked();
+ },
+});
diff --git a/web/src/components/table/FacetHeader.tsx b/web/src/components/table/FacetHeader.tsx
new file mode 100644
index 0000000000..1aa292e426
--- /dev/null
+++ b/web/src/components/table/FacetHeader.tsx
@@ -0,0 +1,116 @@
+import {
+ forwardRef,
+ type ComponentPropsWithoutRef,
+ type ReactNode,
+} from "react";
+import { X } from "lucide-react";
+import { DropdownIndicator } from "@/src/components/design-system/DropdownIndicator/DropdownIndicator";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/src/components/ui/tooltip";
+import { cn } from "@/src/utils/tailwind";
+
+type FacetHeaderProps = Pick<
+ ComponentPropsWithoutRef<"button">,
+ | "id"
+ | "type"
+ | "onClick"
+ | "onKeyDown"
+ | "onPointerDown"
+ | "tabIndex"
+ | "disabled"
+ | "aria-expanded"
+ | "aria-controls"
+> & {
+ label: string;
+ children: ReactNode;
+ summary: string | null | undefined;
+ summaryIcon: ReactNode;
+ isActive: boolean;
+ isDisabled: boolean;
+ onReset: (() => void) | undefined;
+};
+
+export const FacetHeader = forwardRef<HTMLButtonElement, FacetHeaderProps>(
+ function FacetHeader(
+ {
+ label,
+ children,
+ summary,
+ summaryIcon,
+ isActive,
+ isDisabled,
+ onReset,
+ ...buttonProps
+ },
+ ref,
+ ) {
+ return (
+ <button
+ {...buttonProps}
+ ref={ref}
+ className={cn(
+ // Reserve the Clear control's height before a selection is active.
+ "group/facet text-foreground-secondary hover:bg-accent aria-expanded:bg-muted relative flex min-h-7 min-w-0 flex-1 items-center gap-1.5 rounded-md px-2 py-1 text-left text-xs font-bold transition-colors [&[aria-expanded=true]>svg:first-child]:rotate-90",
+ isDisabled &&
+ "text-muted-foreground/60 hover:text-muted-foreground/60 cursor-not-allowed hover:bg-transparent aria-expanded:bg-transparent",
+ )}
+ >
+ <DropdownIndicator direction="right" nudge />
+ <div className="flex min-w-0 grow items-center gap-1.5">
+ {children}
+ {summary && (
+ <span
+ className={cn(
+ "ml-auto h-4 max-w-1/2 min-w-0 shrink-0 truncate text-[11px] leading-4 group-aria-expanded/facet:hidden",
+ isActive
+ ? "bg-background text-foreground rounded px-1 font-bold"
+ : "text-muted-foreground/60 font-normal",
+ )}
+ title={summary}
+ >
+ {summaryIcon && (
+ <span className="mr-1 inline-flex align-text-bottom">
+ {summaryIcon}
+ </span>
+ )}
+ {summary}
+ </span>
+ )}
+ </div>
+ {isActive && onReset && (
+ <Tooltip delayDuration={80}>
+ <TooltipTrigger asChild>
+ {/* The accordion trigger is already a button. */}
+ <div
+ role="button"
+ tabIndex={0}
+ onClick={(event) => {
+ event.stopPropagation();
+ onReset();
+ }}
+ onKeyDown={(event) => {
+ if (event.key === "Enter" || event.key === " ") {
+ event.stopPropagation();
+ event.preventDefault();
+ onReset();
+ }
+ }}
+ className="text-muted-foreground hover:text-foreground flex shrink-0 cursor-pointer items-center gap-0.5 rounded-sm px-1 py-0.5 text-[11px] leading-4 font-normal transition-colors hover:underline focus-visible:underline focus-visible:outline-none"
+ aria-label={`Clear ${label} filter`}
+ >
+ <X className="icon-sm shrink-0" />
+ Clear
+ </div>
+ </TooltipTrigger>
+ <TooltipContent side="right" className="text-xs">
+ Clear {label.toLowerCase()} filter
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </button>
+ );
+ },
+);
diff --git a/web/src/components/table/KeyValueFilterBuilder.stories.tsx b/web/src/components/table/KeyValueFilterBuilder.stories.tsx
index 003cc10a11..cac874285f 100644
--- a/web/src/components/table/KeyValueFilterBuilder.stories.tsx
+++ b/web/src/components/table/KeyValueFilterBuilder.stories.tsx
@@ -158,6 +158,16 @@ export const FreeFormKey = meta.story({
},
});
+export const Empty = meta.story({
+ args: {
+ mode: "string",
+ keyOptions: ["region"],
+ valueOptions: { region: ["eu", "us"] },
+ activeFilters: [],
+ onChange: fn(),
+ },
+});
+
export const TestObservedKeySuggestionPreservesValue = meta.story({
name: "(Test) Observed Key Suggestion Preserves Value",
args: {
diff --git a/web/src/components/table/KeyValueFilterBuilder.tsx b/web/src/components/table/KeyValueFilterBuilder.tsx
index 5073e6affa..397271c8d8 100644
--- a/web/src/components/table/KeyValueFilterBuilder.tsx
+++ b/web/src/components/table/KeyValueFilterBuilder.tsx
@@ -556,7 +556,7 @@ export function KeyValueFilterBuilder(props: KeyValueFilterBuilderProps) {
);
})}
- {/* Add filter button */}
+ {/* Add another condition within this facet. */}
<Button
onClick={handleAddFilter}
size="sm"
@@ -564,7 +564,7 @@ export function KeyValueFilterBuilder(props: KeyValueFilterBuilderProps) {
className="w-full"
>
<Plus className="icon-base text-icon-foreground mr-2" />
- Add filter
+ Add condition
</Button>
</div>
);
diff --git a/web/src/components/table/data-table-controls.clienttest.tsx b/web/src/components/table/data-table-controls.clienttest.tsx
index 873dab18f6..980c4f956c 100644
--- a/web/src/components/table/data-table-controls.clienttest.tsx
+++ b/web/src/components/table/data-table-controls.clienttest.tsx
@@ -1085,6 +1085,54 @@ describe("DataTableControls facet ordering", () => {
}
});
+ it.each([false, true])(
+ "distinguishes metadata conditions from the catalog picker with active-only mode %s",
+ (activeOnly) => {
+ localStorage.setItem(
+ "data-table-controls-active-only",
+ String(activeOnly),
+ );
+ try {
+ const metadata: UIFilter = {
+ type: "stringKeyValue",
+ column: "metadata",
+ label: "Metadata",
+ loading: false,
+ expanded: true,
+ isActive: true,
+ isDisabled: false,
+ value: [{ key: "region", operator: "=", value: "eu" }],
+ keyOptions: ["region"],
+ onChange: () => {},
+ onReset: () => {},
+ };
+ render(
+ <TooltipProvider>
+ <DataTableControls
+ queryFilter={{
+ ...queryFilter([
+ metadata,
+ categoricalFilter("alpha", "Alpha", false),
+ ]),
+ expanded: ["metadata"],
+ }}
+ />
+ </TooltipProvider>,
+ );
+ expect(
+ screen.getByRole("button", { name: "Add condition" }),
+ ).toBeInTheDocument();
+ expect(
+ screen.queryAllByRole("button", { name: "Add filter" }),
+ ).toHaveLength(activeOnly ? 1 : 0);
+ fireEvent.click(screen.getByRole("button", { name: "Add condition" }));
+ expect(screen.getAllByPlaceholderText("Key")).toHaveLength(2);
+ } finally {
+ localStorage.removeItem("data-table-controls-active-only");
+ }
+ },
+ );
+
it("tracks late-arriving URL filters (Pages Router populates params after mount)", () => {
const { rerender } = render(
<TooltipProvider>
diff --git a/web/src/components/table/data-table-controls.tsx b/web/src/components/table/data-table-controls.tsx
index 3bf6212b19..39532e55d0 100644
--- a/web/src/components/table/data-table-controls.tsx
+++ b/web/src/components/table/data-table-controls.tsx
@@ -51,7 +51,6 @@ import {
WandSparkles,
InfoIcon,
} from "lucide-react";
-import { DropdownIndicator } from "@/src/components/design-system/DropdownIndicator/DropdownIndicator";
import {
DropdownMenu,
DropdownMenuContent,
@@ -91,6 +90,7 @@ import type {
TextFilterEntry,
} from "@/src/features/filters/hooks/useSidebarFilterState";
import { KeyValueFilterBuilder } from "@/src/components/table/KeyValueFilterBuilder";
+import { FacetHeader } from "@/src/components/table/FacetHeader";
import {
Popover,
PopoverContent,
@@ -822,7 +822,7 @@ export function DataTableControls({
<Button
variant="outline"
size="sm"
- className="text-xs"
+ className="w-full text-xs"
disabled={addableFilters.length === 0}
>
<Plus className="icon-base text-icon-foreground mr-1.5" />
@@ -962,8 +962,8 @@ export function DataTableControls({
"group-data-[expanded=false]/controls:hidden",
)}
>
- <div className="bg-surface flex h-10 shrink-0 items-center justify-between border-b px-3">
- <div className="flex items-center gap-1.5">
+ <div className="bg-surface flex h-10 shrink-0 items-center justify-between px-3">
+ <div className="flex items-center">
{/* Three contexts for the header's close affordance:
- inline (events MobileFiltersSheet): the sheet owns its own X +
"Filters" title, so render neither here — a second X would
@@ -1011,7 +1011,7 @@ export function DataTableControls({
{/* Inline: the count already shows on the sheet's Filters trigger
and footer, so a bare number here (title hidden) is just noise. */}
{layout !== "inline" && activeFilterCount > 0 && (
- <Badge variant="secondary" className="h-5 px-1.5 text-xs">
+ <Badge variant="secondary" className="ml-1.5 h-5 px-1.5 text-xs">
{activeFilterCount}
</Badge>
)}
@@ -1183,9 +1183,9 @@ export function DataTableControls({
// The space below the field lives HERE rather than in the list,
// because anything inside the list scrolls away: a facet header
// pinning to the top of the scroll area would otherwise sit tight
- // against the field. pb-0.5 + the header's own 6px = the 8px above
+ // against the field. pb-2.5 + the header's own 6px = 16px below
// the field, at rest and scrolled alike.
- <div className="bg-surface shrink-0 px-2 pt-2 pb-0.5">
+ <div className="bg-surface shrink-0 px-3 pt-0.5 pb-2.5">
<div className="relative">
<Search className="text-muted-foreground icon-base absolute top-1/2 left-2 -translate-y-1/2" />
<Input
@@ -1210,7 +1210,7 @@ export function DataTableControls({
noteFacetSearch("facet_list", "");
}
}}
- className="h-6 pr-6 pl-7 text-xs"
+ className="h-8 pr-6 pl-7 font-mono text-xs"
/>
{facetSearch !== "" && (
<Button
@@ -1361,35 +1361,6 @@ interface StringKeyValueFacetProps extends BaseFacetProps {
// Non-animated accordion components for filters
const FilterAccordionItemPrimitive = AccordionPrimitive.Item;
-const FilterAccordionTrigger = ({
- className,
- children,
- ...props
-}: React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>) => (
- // top-0: the panel header row sits outside the scroll container
- // (ScrollArea wraps only the facet list), so triggers stick to its top.
- // The expand chevron leads the row (> closed, v open); the clear button
- // sits at the row's right edge and stays visible whenever a value is set.
- // pt-1.5/pb-0.5 rather than an even py: the 8px between two rows is split so
- // that 6px of it sits INSIDE this sticky box, which is what keeps a pinned
- // header the same distance from whatever is above it as it was at rest.
- <AccordionPrimitive.Header className="bg-surface sticky top-0 z-[1] flex px-2 pt-1.5 pb-0.5">
- <AccordionPrimitive.Trigger
- className={cn(
- // min-w-0: without it the trigger's automatic min width equals the
- // nowrap chip's full text width, so long chips push the row past the
- // panel edge (clipped) instead of ellipsing.
- "group/facet relative flex min-w-0 flex-1 items-center gap-1.5 text-left font-bold hover:underline [&[data-state=open]>svg:first-child]:rotate-90",
- className,
- )}
- {...props}
- >
- <DropdownIndicator direction="right" nudge />
- {children}
- </AccordionPrimitive.Trigger>
- </AccordionPrimitive.Header>
-);
-
const FilterAccordionContent = ({
className,
children,
@@ -1440,132 +1411,64 @@ function FilterAccordionItem({
// on this wrapper scrolls away with it and the gap would shift.
data-facet-column={filterKey}
>
- <FilterAccordionTrigger
- className={cn(
- "text-muted-foreground hover:text-foreground bg-muted hover:bg-accent min-h-6 rounded-md px-2 py-1 text-xs font-normal transition-colors hover:no-underline",
- isActive && "text-foreground font-bold",
- isDisabled &&
- "text-muted-foreground/60 hover:text-muted-foreground/60 cursor-not-allowed hover:bg-transparent",
- )}
- >
- {/* Two-line-max header: line 1 is the label, which NEVER wraps —
- it ellipses so the clear button keeps its place — and the chip
- drops to its own second line when it doesn't fit inline.
- flex-wrap breaks lines by content sizes, so the chip wraps
- before anything shrinks; only an item alone on its line
- shrink-truncates. The clear button and chevron sit outside the
- wrap container and never move. */}
- <div className="flex min-w-0 grow flex-wrap items-center gap-x-1.5 gap-y-0.5">
- {isDisabled && disabledReason ? (
- <Tooltip delayDuration={80}>
- <TooltipTrigger asChild>
- <span className="flex min-w-0 items-center gap-1">
- <span className="min-w-0 truncate" title={label}>
- {label}
- </span>
- </span>
- </TooltipTrigger>
- <TooltipContent className="max-w-80 text-xs">
- {disabledReason}
- </TooltipContent>
- </Tooltip>
- ) : help ? (
- <div className="flex min-w-0 items-center gap-1">
- <span className="min-w-0 truncate" title={label}>
- {label}
- </span>
- <DocPopup description={help.description} href={help.href} />
- </div>
- ) : tooltip ? (
- // The tooltip triggers on the ⓘ icon only — hovering the label
- // itself must not pop explanatory text.
- <span className="flex min-w-0 items-center gap-1">
- <span className="min-w-0 truncate" title={label}>
- {label}
- </span>
+ {/* The sticky header owns the spacing above each facet, so scrolling
+ does not change the gap around a pinned header. */}
+ <AccordionPrimitive.Header className="bg-surface sticky top-0 z-[1] flex px-3 pt-1.5 pb-0.5">
+ <AccordionPrimitive.Trigger asChild>
+ <FacetHeader
+ label={label}
+ summary={summary}
+ summaryIcon={summaryIcon}
+ isActive={Boolean(isActive)}
+ isDisabled={Boolean(isDisabled)}
+ onReset={onReset}
+ >
+ {isDisabled && disabledReason ? (
<Tooltip delayDuration={80}>
<TooltipTrigger asChild>
- <InfoIcon className="text-muted-foreground icon-sm shrink-0" />
+ <span className="flex min-w-0 items-center gap-1">
+ <span className="min-w-0 truncate" title={label}>
+ {label}
+ </span>
+ </span>
</TooltipTrigger>
<TooltipContent className="max-w-80 text-xs">
- {tooltip}
+ {disabledReason}
</TooltipContent>
</Tooltip>
- </span>
- ) : (
- <span className="flex min-w-0 items-center gap-1">
- <span className="min-w-0 truncate" title={label}>
- {label}
- </span>
- </span>
- )}
- {summary && (
- // Only useful while collapsed: the expanded facet shows the
- // selection itself, so the chip hides (data-state on the
- // trigger = the group/facet element).
- <span
- className={cn(
- // explicit h-4: the chip box must exactly equal the label line so the
- // header height cannot jitter between open (chip hidden) and
- // closed states.
- "h-4 max-w-full min-w-0 truncate text-[11px] leading-4",
- "group-data-[state=open]/facet:hidden",
- // bg-background pops the chip out of the tinted header band
- // in both themes. No border/vertical padding: the chip's box
- // must equal the label's line height so headers with and
- // without a value render at the same height.
- isActive
- ? "bg-background text-foreground rounded px-1 font-bold"
- : "text-muted-foreground/60 font-normal",
- )}
- title={summary}
- >
- {summaryIcon && (
- <span className="mr-1 inline-flex align-text-bottom">
- {summaryIcon}
+ ) : help ? (
+ <div className="flex min-w-0 items-center gap-1">
+ <span className="min-w-0 truncate" title={label}>
+ {label}
</span>
- )}
- {summary}
- </span>
- )}
- </div>
- {isActive && onReset && (
- <Tooltip delayDuration={80}>
- <TooltipTrigger asChild>
- {/* div[role=button], not <Button>: the accordion trigger is
- already a <button> and buttons cannot nest. Always visible
- while the facet has a selection (no hover gating) — the clear
- affordance used to reveal only on header hover, which hid the
- one obvious way to drop a filter. shrink-0 keeps it in flow at
- the row's right edge so the label/chip truncate before reaching
- it; self-start pins it to the top line on two-line headers. */}
- <div
- role="button"
- tabIndex={0}
- onClick={(e) => {
- e.stopPropagation();
- onReset();
- }}
- onKeyDown={(e) => {
- if (e.key === "Enter" || e.key === " ") {
- e.stopPropagation();
- e.preventDefault();
- onReset();
- }
- }}
- className="text-muted-foreground hover:text-foreground flex shrink-0 cursor-pointer items-center gap-0.5 self-start rounded-sm px-1 py-0.5 text-[11px] leading-4 font-normal transition-colors hover:underline focus-visible:underline focus-visible:outline-none"
- aria-label={`Clear ${label} filter`}
- >
- <IconX className="icon-sm shrink-0" />
- Clear
+ <DocPopup description={help.description} href={help.href} />
</div>
- </TooltipTrigger>
- <TooltipContent side="right" className="text-xs">
- Clear {label.toLowerCase()} filter
- </TooltipContent>
- </Tooltip>
- )}
- </FilterAccordionTrigger>
+ ) : tooltip ? (
+ // The tooltip triggers on the ⓘ icon only — hovering the label
+ // itself must not pop explanatory text.
+ <span className="flex min-w-0 items-center gap-1">
+ <span className="min-w-0 truncate" title={label}>
+ {label}
+ </span>
+ <Tooltip delayDuration={80}>
+ <TooltipTrigger asChild>
+ <InfoIcon className="text-muted-foreground icon-sm shrink-0" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-80 text-xs">
+ {tooltip}
+ </TooltipContent>
+ </Tooltip>
+ </span>
+ ) : (
+ <span className="flex min-w-0 items-center gap-1">
+ <span className="min-w-0 truncate" title={label}>
+ {label}
+ </span>
+ </span>
+ )}
+ </FacetHeader>
+ </AccordionPrimitive.Trigger>
+ </AccordionPrimitive.Header>
<FilterAccordionContent className="pb-2">
<fieldset
disabled={isDisabled}
@@ -1688,7 +1591,7 @@ export function CategoricalFacet({
{/* TEXT MODE: Contains/Does Not Contain filters */}
{filterMode === "text" && onTextFilterAdd && (
- <div className="px-2 py-1">
+ <div className="py-1">
<TextFilterSection
allFilters={textFilters ?? []}
onAdd={onTextFilterAdd}
@@ -1838,7 +1741,7 @@ function CategoricalSelectContent({
};
return (
- <div className="px-2">
+ <div className="px-3">
{/* Any of / All of / None of operator toggle for arrayOptions filters
This toggle appears for multi-valued array columns (arrayOptions)
@@ -1868,7 +1771,7 @@ function CategoricalSelectContent({
- Monitors: tags
*/}
{onOperatorChange && (
- <div className="mb-2 px-2">
+ <div className="mb-2">
<Tabs
value={operator ?? "any of"}
onValueChange={(newOperator) =>
@@ -1910,20 +1813,20 @@ function CategoricalSelectContent({
{loading ? (
<>
{[1, 2].map((i) => (
- <div key={i} className="relative flex items-center px-2">
- <div className="group/checkbox flex items-center rounded-sm p-0.5">
+ <div key={i} className="relative flex items-center">
+ <div className="flex min-w-0 flex-1 items-center rounded-md px-2 py-0.5">
<Skeleton className="h-3.5 w-3.5 rounded-sm" />
- </div>
- <div className="group/label flex min-w-0 flex-1 items-center rounded-sm px-1 py-0.5">
- <Skeleton className="h-3 w-24" />
- <Skeleton className="ml-auto h-3 w-8" />
+ <div className="flex min-w-0 flex-1 items-center pr-1 pl-2">
+ <Skeleton className="h-3 w-24" />
+ <Skeleton className="ml-auto h-3 w-8" />
+ </div>
</div>
</div>
))}
</>
) : visibleOptionValues.length === 0 ? (
- // px-2 on top of the outer px-2 = the same 16px inset as the mode
- // tabs and inputs, so empty states don't stick to the panel edge.
+ // px-2 on top of the outer px-3 = the checkbox rows' inset, so empty
+ // states don't stick to the panel edge.
<div className="text-muted-foreground px-2 py-1 text-xs">
{filterKey === "sessionId" ? (
<span>
@@ -1963,14 +1866,14 @@ function CategoricalSelectContent({
<>
{/* Search box for many options */}
{hasMoreOptions && (
- <div className="mb-2 px-2">
+ <div className="mb-2">
<div className="relative">
<Search className="text-muted-foreground icon-base absolute top-1/2 left-2 -translate-y-1/2" />
<Input
placeholder="Filter values"
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
- className="h-8 pl-7 text-xs"
+ className="h-8 pl-7 font-mono text-xs"
/>
</div>
</div>
@@ -1999,15 +1902,14 @@ function CategoricalSelectContent({
{/* Remaining options, capped */}
{visibleRemainingOptions.map(renderOption)}
{(canShowMore || canShowFewer) && (
- <div className="flex flex-col px-2">
+ <div className="flex flex-col">
{canShowFewer && (
<Button
variant="ghost"
size="sm"
onClick={() => setVisibleCount(MAX_VISIBLE_OPTIONS)}
- className="mt-1 h-auto w-full justify-start gap-1 py-1 pl-7 text-xs"
+ className="mt-1 h-auto w-full justify-start gap-1 py-1 pl-2 text-xs"
>
- <DropdownIndicator direction="up" size="sm" nudge />
Show fewer values
</Button>
)}
@@ -2020,9 +1922,8 @@ function CategoricalSelectContent({
(current) => current + SHOW_MORE_INCREMENT,
)
}
- className="mt-0.5 h-auto w-full justify-start gap-1 py-1 pl-7 text-xs"
+ className="mt-0.5 h-auto w-full justify-start gap-1 py-1 pl-2 text-xs"
>
- <DropdownIndicator size="sm" nudge />
Show more values
</Button>
)}
@@ -2540,9 +2441,8 @@ interface FilterModeTabsProps {
function FilterModeTabs({ mode, onModeChange }: FilterModeTabsProps) {
return (
- // mt-1 evens the rhythm: content opens with pt-1, so the tabs sit 8px
- // from the header band and 8px (mb-2) from the list below.
- <div className="mt-1 mb-2 px-4">
+ // px-3 = the header box's inset, so the toggle lines up with the facet rows.
+ <div className="mt-1 mb-2 px-3">
<Tabs
value={mode}
onValueChange={(newMode) => onModeChange(newMode as "select" | "text")}
@@ -2583,7 +2483,7 @@ function TextFilterSection({
return (
<div className="space-y-2">
{/* Operator picker */}
- <div className="px-2">
+ <div className="px-3">
<Select
value={selectedOperator}
onValueChange={(operator) =>
@@ -2605,7 +2505,7 @@ function TextFilterSection({
</div>
{/* Input + Add button */}
- <div className="flex items-center gap-2 px-2">
+ <div className="flex items-center gap-2 px-3">
<Input
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
@@ -2631,7 +2531,7 @@ function TextFilterSection({
{/* Active filters list */}
{allFilters.length > 0 && (
- <div className="space-y-1 px-2">
+ <div className="space-y-1 px-3">
{allFilters.map((f, idx) => (
<div
key={idx}
@@ -2699,58 +2599,56 @@ function FilterValueCheckbox({
return (
<div
className={cn(
- "relative flex items-center px-2",
+ "relative flex items-center",
disabled && "cursor-not-allowed opacity-50",
)}
>
- {/* Checkbox hover area */}
- <div className="group/checkbox hover:bg-accent flex items-center rounded-sm p-0.5 transition-colors">
- <span className="pointer-events-auto">
- <Checkbox
- id={id}
- checked={checked}
- onCheckedChange={onCheckedChange}
- disabled={disabled}
- size="sm"
- />
- </span>
- </div>
+ {/* One hover tint for the whole row, same inset as the header box above. */}
+ <div className="hover:bg-accent flex min-w-0 flex-1 items-center rounded-md px-2 py-0.5 transition-colors">
+ <Checkbox
+ id={id}
+ checked={checked}
+ onCheckedChange={onCheckedChange}
+ disabled={disabled}
+ size="sm"
+ />
- {/* Label hover area */}
- <div
- className={cn(
- "group/label hover:bg-accent flex min-w-0 flex-1 cursor-pointer items-center rounded-sm px-1 py-0.5 transition-colors",
- disabled && "pointer-events-none",
- )}
- onClick={onLabelClick}
- >
- {icon ? <span className="mr-2">{icon}</span> : null}
- <span
+ {/* Label area: clicking selects only this value */}
+ <div
className={cn(
- "min-w-0 truncate text-xs",
- !suffix && "flex-1",
- label === "" && "text-muted-foreground italic",
+ "group/label flex min-w-0 flex-1 cursor-pointer items-center self-stretch pr-1 pl-2",
+ disabled && "pointer-events-none",
)}
- title={displayTitle}
+ onClick={onLabelClick}
>
- {displayLabel}
- </span>
- {suffix ? <span className="shrink-0 pl-1">{suffix}</span> : null}
-
- {/* "Only" or "All" indicator when hovering label. shrink-0 +
- whitespace-nowrap: appearing may only re-truncate the label —
- never widen the row. */}
- {onLabelClick && !disabled && (
- <span className="text-muted-foreground hidden shrink-0 pl-1 text-xs whitespace-nowrap group-hover/label:block">
- {labelText}
+ {icon ? <span className="mr-2">{icon}</span> : null}
+ <span
+ className={cn(
+ "text-foreground-secondary min-w-0 truncate text-xs",
+ !suffix && "flex-1",
+ label === "" && "text-muted-foreground italic",
+ )}
+ title={displayTitle}
+ >
+ {displayLabel}
</span>
- )}
+ {suffix ? <span className="shrink-0 pl-1">{suffix}</span> : null}
+
+ {/* "Only" or "All" indicator when hovering label. shrink-0 +
+ whitespace-nowrap: appearing may only re-truncate the label —
+ never widen the row. */}
+ {onLabelClick && !disabled && (
+ <span className="text-muted-foreground hidden shrink-0 pl-1 text-xs whitespace-nowrap group-hover/label:block">
+ {labelText}
+ </span>
+ )}
- {count > 0 ? (
- <span className="text-muted-foreground ml-auto w-7 shrink-0 pl-1 text-right text-xs">
- {compactNumberFormatter(count, 0)}
- </span>
- ) : null}
+ {count > 0 ? (
+ <span className="text-muted-foreground ml-auto w-7 shrink-0 pl-1 text-right text-xs">
+ {compactNumberFormatter(count, 0)}
+ </span>
+ ) : null}
+ </div>
</div>
</div>
);
diff --git a/web/src/components/table/key-value-filter-builder.clienttest.tsx b/web/src/components/table/key-value-filter-builder.clienttest.tsx
index bd120b7dd3..01e4c24a40 100644
--- a/web/src/components/table/key-value-filter-builder.clienttest.tsx
+++ b/web/src/components/table/key-value-filter-builder.clienttest.tsx
@@ -109,7 +109,7 @@ describe("KeyValueFilterBuilder", () => {
/>,
);
- fireEvent.click(screen.getByText("Add filter"));
+ fireEvent.click(screen.getByRole("button", { name: "Add condition" }));
const key = screen.getByPlaceholderText("Key");
fireEvent.change(key, { target: { value: "a" } });
fireEvent.change(key, { target: { value: "accuracy" } });
@@ -126,7 +126,7 @@ describe("KeyValueFilterBuilder", () => {
/>,
);
- fireEvent.click(screen.getByText("Add filter"));
+ fireEvent.click(screen.getByRole("button", { name: "Add condition" }));
fireEvent.change(screen.getByPlaceholderText("Key"), {
target: { value: "draft-key" },
});
@@ -144,7 +144,7 @@ describe("KeyValueFilterBuilder", () => {
it("adopts external removals without reviving removed rows or losing incomplete edits", () => {
render(<MetadataBuilderHarness />);
- fireEvent.click(screen.getByText("Add filter"));
+ fireEvent.click(screen.getByRole("button", { name: "Add condition" }));
fireEvent.change(screen.getAllByPlaceholderText("Key")[2], {
target: { value: "draft-key" },
});
diff --git a/web/src/features/events/presetDemotionOnUserEdit.clienttest.tsx b/web/src/features/events/presetDemotionOnUserEdit.clienttest.tsx
index f9efc5787b..9b9bc798b9 100644
--- a/web/src/features/events/presetDemotionOnUserEdit.clienttest.tsx
+++ b/web/src/features/events/presetDemotionOnUserEdit.clienttest.tsx
@@ -733,7 +733,7 @@ describe("saved-view demotion on user filter edits", () => {
expect(screen.queryByDisplayValue("draft-region")).not.toBeInTheDocument();
expect(screen.getByDisplayValue("eu")).toBeInTheDocument();
- fireEvent.click(screen.getByText("Add filter"));
+ fireEvent.click(screen.getByText("Add condition"));
fireEvent.change(screen.getAllByPlaceholderText("Key")[1], {
target: { value: "pending-key" },
});
diff --git a/web/src/features/filters/metadataSuggestionParity.clienttest.tsx b/web/src/features/filters/metadataSuggestionParity.clienttest.tsx
index 9c53986cd8..c6ed00dfc4 100644
--- a/web/src/features/filters/metadataSuggestionParity.clienttest.tsx
+++ b/web/src/features/filters/metadataSuggestionParity.clienttest.tsx
@@ -84,7 +84,7 @@ describe("metadata suggestions in the filter sidebar", () => {
it("offers observed keys with their type hint, then the key's values", () => {
render(<MetadataFacetHarness />);
- fireEvent.click(screen.getByText("Add filter"));
+ fireEvent.click(screen.getByText("Add condition"));
const key = screen.getByPlaceholderText("Key");
fireEvent.focus(key);
@@ -109,7 +109,7 @@ describe("metadata suggestions in the filter sidebar", () => {
onChange={() => {}}
/>,
);
- fireEvent.click(screen.getByText("Add filter"));
+ fireEvent.click(screen.getByText("Add condition"));
const key = screen.getByPlaceholderText("Key");
fireEvent.focus(key);
fireEvent.change(key, { target: { value: "reg" } });
@@ -123,7 +123,7 @@ describe("metadata suggestions in the filter sidebar", () => {
it("never offers what is already typed, and picks with the keyboard", () => {
render(<MetadataFacetHarness />);
- fireEvent.click(screen.getByText("Add filter"));
+ fireEvent.click(screen.getByText("Add condition"));
const key = screen.getByPlaceholderText("Key");
fireEvent.focus(key);
@@ -163,7 +163,7 @@ describe("metadata suggestions in the filter sidebar", () => {
it("still accepts a key and value the observed map has never seen", () => {
render(<MetadataFacetHarness />);
- fireEvent.click(screen.getByText("Add filter"));
+ fireEvent.click(screen.getByText("Add condition"));
const key = screen.getByPlaceholderText("Key");
fireEvent.change(key, { target: { value: "never-observed" } });