{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "overflow-tabs", "dependencies": [ "react-aria-components", "lucide-react" ], "registryDependencies": [ "@seamless/utils", "@seamless/dropdown-menu" ], "files": [ { "path": "src/components/ui/overflow-tabs.tsx", "content": "import { ChevronDownIcon } from \"lucide-react\"\nimport { Button as ButtonPrimitive } from \"react-aria-components\"\n\nimport { cn, type Styled } from \"@/lib/utils\"\nimport {\n DropdownMenu,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\"\n\ntype OverflowTabItem = {\n id: string\n label: string\n}\n\ntype OverflowTabsProps = {\n items: OverflowTabItem[]\n selectedId: string\n onSelect: (id: string) => void\n /** CONSTRAINT: the strip never wraps; growth goes to the overflow menu. */\n maxVisible?: number\n \"aria-label\": string\n className?: string\n /** Trailing slot after the overflow menu — compose with OverflowTabsAction. */\n children?: React.ReactNode\n}\n\nconst pillClass =\n \"inline-flex max-w-33 shrink-0 items-center gap-1 rounded-full border border-border bg-card px-2.5 py-1 text-[11px] font-[550] whitespace-nowrap text-ink-2 outline-none hover:bg-accent focus-visible:ring-3 focus-visible:ring-ring/50 [&>span]:overflow-hidden [&>span]:text-ellipsis\"\n\nfunction OverflowTabs({\n items,\n selectedId,\n onSelect,\n maxVisible = 3,\n \"aria-label\": ariaLabel,\n className,\n children,\n}: OverflowTabsProps) {\n const selectedIndex = items.findIndex((d) => d.id === selectedId)\n const visible = items.slice(0, maxVisible)\n if (selectedIndex >= maxVisible) {\n visible[maxVisible - 1] = items[selectedIndex]\n }\n const hidden = items.filter((d) => !visible.some((v) => v.id === d.id))\n\n return (\n \n {visible.map((item) => (\n onSelect(item.id)}\n className={cn(\n pillClass,\n item.id === selectedId &&\n \"border-primary font-semibold text-primary-hover hover:bg-card\"\n )}\n >\n {item.label}\n \n ))}\n {hidden.length > 0 && (\n \n \n +{hidden.length} more\n \n \n onSelect(String(key))}\n >\n {hidden.map((item) => (\n \n {item.label}\n \n ))}\n \n \n )}\n {children}\n \n )\n}\n\ntype OverflowTabsActionProps = Styled<\n React.ComponentProps\n>\n\nfunction OverflowTabsAction({ className, ...props }: OverflowTabsActionProps) {\n return (\n \n )\n}\n\nexport {\n OverflowTabs,\n OverflowTabsAction,\n type OverflowTabItem,\n type OverflowTabsActionProps,\n type OverflowTabsProps,\n}\n", "type": "registry:ui" } ], "type": "registry:ui" }