{"version":3,"file":"ViewportScrollbar.mjs","names":[],"sources":["../../../src/components/scrollbars/ViewportScrollbar.tsx"],"sourcesContent":["import React from 'react';\nimport {\n  RangeScrollbar,\n  type RangeScrollbarHandleProps,\n  type RangeScrollbarRootProps,\n  type RangeScrollbarThumbProps,\n} from '#react/rangeScrollbar';\nimport { useTimelineViewportRangeControl } from '#react/hooks';\nimport type { TimelineViewportRangeControlOptions } from '#react/hooks';\n\n/**\n * Props for the timeline viewport scrollbar root.\n */\nexport interface ViewportScrollbarRootProps\n  extends\n    Omit<RangeScrollbarRootProps, 'max' | 'min' | 'minSpan' | 'onValueChange' | 'value'>,\n    TimelineViewportRangeControlOptions {}\n\n/**\n * Props for the timeline viewport scrollbar thumb.\n */\nexport type ViewportScrollbarThumbProps = RangeScrollbarThumbProps;\n\n/**\n * Props for a timeline viewport scrollbar resize handle.\n */\nexport type ViewportScrollbarHandleProps = RangeScrollbarHandleProps;\n\n/**\n * Timeline-aware scrollbar root for panning and zooming the visible viewport.\n *\n * @param props - Timeline viewport scrollbar options and DOM props.\n * @returns A range scrollbar root wired to the current `TimelineEngine`.\n *\n * @example\n * ```tsx\n * <Timeline.ViewportScrollbar>\n *   <Timeline.ViewportScrollbarThumb>\n *     <Timeline.ViewportScrollbarHandle side=\"start\" />\n *     <Timeline.ViewportScrollbarHandle side=\"end\" />\n *   </Timeline.ViewportScrollbarThumb>\n * </Timeline.ViewportScrollbar>\n * ```\n */\nexport const ViewportScrollbarRoot = React.forwardRef<HTMLDivElement, ViewportScrollbarRootProps>(\n  ({ children, className = '', minSpan, precision, ...props }, ref) => {\n    const viewportScrollbar = useTimelineViewportRangeControl({ minSpan, precision });\n\n    return (\n      <RangeScrollbar.Root\n        ref={ref}\n        className={['timeline-viewport-scrollbar', className].filter(Boolean).join(' ')}\n        {...viewportScrollbar.rootProps}\n        {...props}\n      >\n        {children}\n      </RangeScrollbar.Root>\n    );\n  }\n);\n\nViewportScrollbarRoot.displayName = 'Timeline.ViewportScrollbar';\n\n/**\n * Draggable timeline viewport thumb.\n *\n * @param props - DOM props and optional custom content for the viewport thumb.\n * @returns A range scrollbar thumb that pans the timeline viewport.\n */\nexport const ViewportScrollbarThumb = React.forwardRef<HTMLDivElement, ViewportScrollbarThumbProps>(\n  ({ className = '', ...props }, ref) => {\n    return (\n      <RangeScrollbar.Thumb\n        ref={ref}\n        className={['timeline-viewport-scrollbar-thumb', className].filter(Boolean).join(' ')}\n        {...props}\n        aria-label={props['aria-label'] ?? 'Timeline viewport'}\n      />\n    );\n  }\n);\n\nViewportScrollbarThumb.displayName = 'Timeline.ViewportScrollbarThumb';\n\n/**\n * Timeline viewport resize handle.\n *\n * @param props - Handle side, DOM props, and optional custom content.\n * @returns A range scrollbar handle that zooms the timeline viewport.\n */\nexport const ViewportScrollbarHandle = React.forwardRef<\n  HTMLDivElement,\n  ViewportScrollbarHandleProps\n>(({ className = '', ...props }, ref) => {\n  return (\n    <RangeScrollbar.Handle\n      ref={ref}\n      className={['timeline-viewport-scrollbar-handle', className].filter(Boolean).join(' ')}\n      {...props}\n      aria-label={\n        props['aria-label'] ??\n        (props.side === 'start' ? 'Timeline viewport start' : 'Timeline viewport end')\n      }\n    />\n  );\n});\n\nViewportScrollbarHandle.displayName = 'Timeline.ViewportScrollbarHandle';\n\n/**\n * Namespace of timeline-aware viewport scrollbar components.\n */\n// oxlint-disable-next-line react-refresh/only-export-components\nexport const ViewportScrollbar = {\n  /** Root element wired to timeline scroll and zoom state. */\n  Root: ViewportScrollbarRoot,\n  /** Draggable thumb that pans the timeline viewport. */\n  Thumb: ViewportScrollbarThumb,\n  /** Resize handle that changes timeline zoom. */\n  Handle: ViewportScrollbarHandle,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4CA,MAAa,wBAAwB,MAAM,YACxC,EAAE,UAAU,YAAY,IAAI,SAAS,WAAW,GAAG,SAAS,QAAQ;CACnE,MAAM,oBAAoB,gCAAgC;EAAE;EAAS;CAAU,CAAC;CAEhF,OACE,oBAAC,eAAe,MAAhB;EACO;EACL,WAAW,CAAC,+BAA+B,SAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAC9E,GAAI,kBAAkB;EACtB,GAAI;EAEH;CACkB,CAAA;AAEzB,CACF;AAEA,sBAAsB,cAAc;;;;;;;AAQpC,MAAa,yBAAyB,MAAM,YACzC,EAAE,YAAY,IAAI,GAAG,SAAS,QAAQ;CACrC,OACE,oBAAC,eAAe,OAAhB;EACO;EACL,WAAW,CAAC,qCAAqC,SAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EACpF,GAAI;EACJ,cAAY,MAAM,iBAAiB;CACpC,CAAA;AAEL,CACF;AAEA,uBAAuB,cAAc;;;;;;;AAQrC,MAAa,0BAA0B,MAAM,YAG1C,EAAE,YAAY,IAAI,GAAG,SAAS,QAAQ;CACvC,OACE,oBAAC,eAAe,QAAhB;EACO;EACL,WAAW,CAAC,sCAAsC,SAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EACrF,GAAI;EACJ,cACE,MAAM,kBACL,MAAM,SAAS,UAAU,4BAA4B;CAEzD,CAAA;AAEL,CAAC;AAED,wBAAwB,cAAc;;;;AAMtC,MAAa,oBAAoB;;CAE/B,MAAM;;CAEN,OAAO;;CAEP,QAAQ;AACV"}