{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "splitter-responsive-orientation",
  "title": "Splitter Responsive Orientation",
  "description": "A splitter that lays its panes side by side on wide screens and stacks them top over bottom on narrow ones, keeping the same panels and sizes.",
  "registryDependencies": [
    "@tealmac/splitter"
  ],
  "files": [
    {
      "path": "registry/patterns/splitter-responsive-orientation/splitter-responsive-orientation.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { Splitter, type SplitterPanelConfig } from \"@/components/ui/splitter\"\n\nexport interface SplitterResponsiveOrientationProps {\n  panels: SplitterPanelConfig[]\n  /** Minimum viewport width in px for the side by side layout. Default 768. */\n  breakpoint?: number\n}\n\nfunction useWide(breakpoint: number) {\n  return React.useSyncExternalStore(\n    (notify) => {\n      const mq = window.matchMedia(`(min-width: ${breakpoint}px)`)\n      mq.addEventListener(\"change\", notify)\n      return () => mq.removeEventListener(\"change\", notify)\n    },\n    () => window.matchMedia(`(min-width: ${breakpoint}px)`).matches,\n    () => true\n  )\n}\n\n/**\n * Two panes side by side need room. Below the breakpoint the same panels stack\n * and the handle becomes a horizontal one that resizes with Up and Down. Sizes\n * are kept across the switch, so rotating a tablet does not reset the work.\n * The server renders the wide layout, so nothing shifts on desktop.\n */\nexport function SplitterResponsiveOrientation({\n  panels,\n  breakpoint = 768,\n}: SplitterResponsiveOrientationProps) {\n  const wide = useWide(breakpoint)\n  const [sizes, setSizes] = React.useState<number[] | undefined>(undefined)\n\n  return (\n    <div className=\"h-72 w-full\">\n      <Splitter\n        orientation={wide ? \"horizontal\" : \"vertical\"}\n        panels={panels}\n        sizes={sizes}\n        onSizesChange={setSizes}\n      />\n    </div>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "type": "registry:block"
}