UNPKG

fumadocs-ui

Version:

The Radix UI version of Fumadocs UI

37 lines (35 loc) 1.52 kB
import { cn } from "@fumadocs/ui/cn"; import { jsx, jsxs } from "react/jsx-runtime"; import * as React from "react"; import * as Primitive from "@radix-ui/react-scroll-area"; //#region src/components/ui/scroll-area.tsx const ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(Primitive.Root, { ref, type: "scroll", className: cn("overflow-hidden", className), ...props, children: [ children, /* @__PURE__ */ jsx(Primitive.Corner, {}), /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" }) ] })); ScrollArea.displayName = Primitive.Root.displayName; const ScrollViewport = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(Primitive.Viewport, { ref, className: cn("size-full rounded-[inherit]", className), ...props, children })); ScrollViewport.displayName = Primitive.Viewport.displayName; const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(Primitive.Scrollbar, { ref, orientation, className: cn("flex select-none data-[state=hidden]:animate-fd-fade-out", orientation === "vertical" && "h-full w-1.5", orientation === "horizontal" && "h-1.5 flex-col", className), ...props, children: /* @__PURE__ */ jsx(Primitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-fd-border" }) })); ScrollBar.displayName = Primitive.Scrollbar.displayName; //#endregion export { ScrollArea, ScrollBar, ScrollViewport }; //# sourceMappingURL=scroll-area.js.map