/* * SPDX-FileCopyrightText: 2020 Stalwart Labs LLC * * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL */ import * as React from 'react'; import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area'; import { cn } from '@/lib/utils'; const ScrollArea = React.forwardRef< React.ComponentRef, React.ComponentPropsWithoutRef & { // Height caps (max-h-*) must be applied to the Viewport — the actual // scroller — because a percentage height resolves to auto when the // Root's height is content-driven, which would break scrolling. viewportClassName?: string; } >(({ className, viewportClassName, children, ...props }, ref) => ( {/* Radix wraps children in a `display: table` div with an intrinsic min-width. That lets wide tables expand the whole shell and clip under overflow-x:hidden, so horizontal scroll never reaches the table's own overflow-x-auto wrapper. Force the inner wrapper to shrink to the viewport width instead. */} div]:!block [&>div]:!min-w-0', viewportClassName)} > {children} )); ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName; const ScrollBar = React.forwardRef< React.ComponentRef, React.ComponentPropsWithoutRef >(({ className, orientation = 'vertical', ...props }, ref) => ( )); ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName; export { ScrollArea, ScrollBar };