950f9555ee
* fix(ui): update coss ui components * fix(sidebar): remove redundant overflow-auto from SidebarContent ScrollArea already provides the scroll container, so keeping overflow-auto on the child creates a nested scroll area and prevents scrollFade from reflecting actual overflow. Addresses Cubic AI review feedback with confidence 9/10. Co-Authored-By: unknown <> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
88 lines
2.9 KiB
TypeScript
88 lines
2.9 KiB
TypeScript
"use client";
|
|
|
|
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
|
|
|
|
import { cn } from "@coss/ui/lib/utils";
|
|
|
|
type TabsVariant = "default" | "underline";
|
|
|
|
function Tabs({ className, ...props }: TabsPrimitive.Root.Props) {
|
|
return (
|
|
<TabsPrimitive.Root
|
|
className={cn(
|
|
"flex flex-col gap-2 data-[orientation=vertical]:flex-row",
|
|
className,
|
|
)}
|
|
data-slot="tabs"
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function TabsList({
|
|
variant = "default",
|
|
className,
|
|
children,
|
|
...props
|
|
}: TabsPrimitive.List.Props & {
|
|
variant?: TabsVariant;
|
|
}) {
|
|
return (
|
|
<TabsPrimitive.List
|
|
className={cn(
|
|
"relative z-0 flex w-fit items-center justify-center gap-x-0.5 text-muted-foreground",
|
|
"data-[orientation=vertical]:flex-col",
|
|
variant === "default"
|
|
? "rounded-lg bg-muted p-0.5 text-muted-foreground/72"
|
|
: "data-[orientation=vertical]:px-1 data-[orientation=horizontal]:py-1 *:data-[slot=tabs-tab]:hover:bg-accent",
|
|
className,
|
|
)}
|
|
data-slot="tabs-list"
|
|
{...props}
|
|
>
|
|
{children}
|
|
<TabsPrimitive.Indicator
|
|
className={cn(
|
|
"-translate-y-(--active-tab-bottom) absolute bottom-0 left-0 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) transition-[width,translate] duration-200 ease-in-out",
|
|
variant === "underline"
|
|
? "data-[orientation=vertical]:-translate-x-px z-10 bg-primary data-[orientation=horizontal]:h-0.5 data-[orientation=vertical]:w-0.5 data-[orientation=horizontal]:translate-y-px"
|
|
: "-z-1 rounded-md bg-background shadow-sm/5 dark:bg-input",
|
|
)}
|
|
data-slot="tab-indicator"
|
|
/>
|
|
</TabsPrimitive.List>
|
|
);
|
|
}
|
|
|
|
function TabsTab({ className, ...props }: TabsPrimitive.Tab.Props) {
|
|
return (
|
|
<TabsPrimitive.Tab
|
|
className={cn(
|
|
"[&_svg]:-mx-0.5 flex h-9 shrink-0 grow cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-[calc(--spacing(2.5)-1px)] font-medium text-base outline-none transition-[color,background-color,box-shadow] hover:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring data-disabled:pointer-events-none data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start data-active:text-foreground data-disabled:opacity-64 sm:h-8 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
className,
|
|
)}
|
|
data-slot="tabs-tab"
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function TabsPanel({ className, ...props }: TabsPrimitive.Panel.Props) {
|
|
return (
|
|
<TabsPrimitive.Panel
|
|
className={cn("flex-1 outline-none", className)}
|
|
data-slot="tabs-content"
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export {
|
|
Tabs,
|
|
TabsList,
|
|
TabsTab,
|
|
TabsTab as TabsTrigger,
|
|
TabsPanel,
|
|
TabsPanel as TabsContent,
|
|
};
|