// Shared pane-header controls. Two primitives: // // - — segmented control for VIEW MODES that are mutually // exclusive (Tree | A–Z, Diagram | Summary). Always exactly one active. // // - — toggleable filter chip with an optional count pip. // Use for filters like "Pending" that overlay the current view mode // rather than replacing it. Disabled when count=0. // // The intent is to stop mixing "view mode" and "filter" in the same // pane-tabs cluster, which currently makes "Pending" feel like a third // view mode instead of a filter you can stack on Tree or A–Z. "use client"; import type { ReactNode } from "react"; // ─── PaneViewTabs ──────────────────────────────────────────────────────── export interface PaneViewTab { value: V; label: ReactNode; /** Optional tooltip. */ title?: string; } interface PaneViewTabsProps { value: V; onChange: (v: V) => void; tabs: PaneViewTab[]; /** ARIA label for the segmented group. */ ariaLabel?: string; } export function PaneViewTabs({ value, onChange, tabs, ariaLabel = "View mode", }: PaneViewTabsProps) { return (
{tabs.map(t => ( ))}
); } // ─── PaneFilterChip ────────────────────────────────────────────────────── interface PaneFilterChipProps { /** Whether the filter is currently applied. */ active: boolean; onToggle: () => void; label: string; /** Optional count to render as a pip (e.g. number of pending items). * When 0 (or undefined), the chip is disabled. */ count?: number; title?: string; } export function PaneFilterChip({ active, onToggle, label, count, title, }: PaneFilterChipProps) { const hasCount = typeof count === "number" && count > 0; const disabled = typeof count === "number" && count === 0; return ( ); }