{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "scroll-area",
  "title": "Scroll area",
  "description": "A box that scrolls with thin scrollbars of its own over its edge, which fade in while the pointer is over it or it scrolls and fade out once it rests. Each edge fades while there is more past it, as the Tabs and Table do, and a Jump to end button can show while the view is away from its end.",
  "dependencies": [
    "@ui-sdk/react",
    "@ui-sdk/core"
  ],
  "registryDependencies": [
    "https://kinoui.com/r/button.json",
    "https://kinoui.com/r/scroll.json",
    "https://kinoui.com/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/scroll-area.tsx",
      "content": "'use client'\n\nimport { Button } from '@/registry/components/kino/button'\nimport {\n  edgeFadeClassName,\n  followEdges,\n  scrollRegionRingClassName,\n} from '@/registry/lib/scroll'\nimport {\n  ScrollAreaContent as ScrollAreaContentPrimitive,\n  ScrollAreaCorner as ScrollAreaCornerPrimitive,\n  ScrollArea as ScrollAreaPrimitive,\n  ScrollAreaScrollbar as ScrollAreaScrollbarPrimitive,\n  ScrollAreaScrollToEnd as ScrollAreaScrollToEndPrimitive,\n  ScrollAreaThumb as ScrollAreaThumbPrimitive,\n  ScrollAreaViewport as ScrollAreaViewportPrimitive,\n} from '@ui-sdk/react/scroll-area'\nimport { type ComponentProps, type ReactNode, useEffect, useRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * A box that scrolls with thin scrollbars of its own, drawn over its content's\n * edge: they fade in while the pointer is over the box or it scrolls, and out\n * once it rests. Each edge fades while there is more past it, as the Tabs'\n * list and a wide Table do.\n */\n\nfunction ScrollArea({\n  className,\n  children,\n  end,\n  'aria-label': label,\n  'aria-labelledby': labelledBy,\n  ...props\n}: Omit<ComponentProps<typeof ScrollAreaPrimitive>, 'className' | 'children'> & {\n  className?: string\n  children?: ReactNode\n  /** A `ScrollAreaScrollToEnd`, over the foot of the box while the view is away from the end. */\n  end?: ReactNode\n}) {\n  const viewportRef = useRef<HTMLDivElement>(null)\n\n  useEffect(() => {\n    const viewport = viewportRef.current\n    if (!viewport) return\n    return followEdges(viewport, '--scroll-fade')\n  }, [])\n\n  return (\n    <ScrollAreaPrimitive\n      className={cn(\n        'relative flex min-h-0 flex-col',\n        scrollRegionRingClassName,\n        className,\n      )}\n      {...props}\n    >\n      <ScrollAreaViewportPrimitive\n        ref={viewportRef}\n        // While it scrolls it is a region, named by the label given, which the\n        // keyboard can reach. Content that fits leaves it a plain box, which\n        // can't carry a name.\n        render={(viewportProps, state) =>\n          state.overflowX || state.overflowY ? (\n            <div\n              {...viewportProps}\n              role='region'\n              aria-label={label}\n              aria-labelledby={labelledBy}\n            />\n          ) : (\n            <div {...viewportProps} />\n          )\n        }\n        className={cn(\n          'scrollbar-none min-h-0 flex-auto rounded-[inherit] focus-visible:outline-hidden',\n          edgeFadeClassName,\n        )}\n      >\n        <ScrollAreaContentPrimitive>{children}</ScrollAreaContentPrimitive>\n      </ScrollAreaViewportPrimitive>\n      <ScrollBar orientation='vertical' />\n      <ScrollBar orientation='horizontal' />\n      <ScrollAreaCornerPrimitive />\n      {end}\n    </ScrollAreaPrimitive>\n  )\n}\n\n/**\n * A button over the box's foot that scrolls to the end, such as \"Jump to\n * end\": it fades in on `enter` while the view is away from the end and isn't\n * heading there, and out on `exit`. ui-sdk keeps it out of reach while hidden,\n * and moves focus to the box when it is pressed, so focus never drops to the page.\n */\nfunction ScrollAreaScrollToEnd({\n  className,\n  ...props\n}: Omit<ComponentProps<typeof ScrollAreaScrollToEndPrimitive>, 'className' | 'render'> & {\n  className?: string\n}) {\n  return (\n    <ScrollAreaScrollToEndPrimitive\n      render={<Button variant='outline' size='xs' />}\n      className={cn(\n        'absolute start-1/2 bottom-2 z-20 -translate-x-1/2 opacity-0 shadow-xs transition-opacity duration-(--motion-exit-duration) ease-(--motion-exit-easing) data-visible:opacity-100 data-visible:duration-(--motion-enter-duration) data-visible:ease-(--motion-enter-easing) rtl:translate-x-1/2',\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\n/*\n * ui-sdk shows a bar only while its axis overflows. Hidden, it lets the\n * pointer through to the content under it; it shows on `enter` while the\n * pointer is over the box or it scrolls, and leaves on `exit`. The bar is 10px across, wider than its thumb, so it is easier to\n * catch.\n */\nfunction ScrollBar({\n  className,\n  orientation = 'vertical',\n  ...props\n}: Omit<ComponentProps<typeof ScrollAreaScrollbarPrimitive>, 'className'> & {\n  className?: string\n}) {\n  return (\n    <ScrollAreaScrollbarPrimitive\n      orientation={orientation}\n      className={cn(\n        'pointer-events-none z-10 flex touch-none p-0.5 opacity-0 transition-opacity duration-(--motion-exit-duration) ease-(--motion-exit-easing) select-none data-hovering:pointer-events-auto data-hovering:opacity-100 data-hovering:duration-(--motion-enter-duration) data-hovering:ease-(--motion-enter-easing) data-scrolling:pointer-events-auto data-scrolling:opacity-100 data-scrolling:duration-(--motion-enter-duration) data-scrolling:ease-(--motion-enter-easing) data-[orientation=horizontal]:h-2.5 data-[orientation=horizontal]:flex-col data-[orientation=vertical]:w-2.5',\n        className,\n      )}\n      {...props}\n    >\n      <ScrollAreaThumbPrimitive className='bg-foreground/25 hover:bg-foreground/40 active:bg-foreground/50 flex-1 rounded-full transition-colors duration-(--motion-press-duration) ease-(--motion-press-fade-easing) forced-colors:bg-[CanvasText]' />\n    </ScrollAreaScrollbarPrimitive>\n  )\n}\n\nexport { ScrollArea, ScrollAreaScrollToEnd }\n",
      "type": "registry:component",
      "target": "@components/kino/scroll-area.tsx"
    }
  ],
  "type": "registry:component"
}