import * as React from "react" import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area" import { cn } from "@/lib/utils" const ScrollArea = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { viewportRef?: React.Ref; // Opt in when the viewport wraps content that manages its own horizontal // overflow (e.g., a child `overflow-x-auto` table). Overrides Radix's // default `display: table` wrapper so the child can be constrained to the // viewport width and trigger its own scroll. Also renders a horizontal // ScrollBar for viewports that overflow directly. block?: boolean; // Opt in to a horizontal ScrollBar while keeping Radix's default // content-sizing wrapper, so content wider than the viewport (e.g. a file // tree with long names) scrolls horizontally with the styled thumb. Unlike // `block`, this does not clamp the content to the viewport width. horizontal?: boolean; } >(({ className, children, viewportRef, block, horizontal, ...props }, ref) => ( div]:!block [&>div]:!min-w-0" )} > {children} {(block || horizontal) && } )) ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName // Thumb uses a translucent foreground alpha so it harmonizes with glass // overlays (dropdowns, popovers, dialogs) instead of competing with content. const ScrollBar = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, orientation = "vertical", ...props }, ref) => ( )) ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName export { ScrollArea, ScrollBar }