{
  "name": "direction",
  "type": "registry:ui",
  "framework": "react",
  "title": "Direction",
  "description": "Sets the writing direction for a subtree and exposes it to the components that need to know which way is forward.",
  "files": [
    {
      "path": "ui/direction.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\n/*\n * Every component is written with logical properties, so a right-to-left tree\n * needs no per-component override — only a `dir` attribute somewhere above it.\n * This is that attribute, plus the context a component reads when it has to\n * make a decision the CSS cannot: which side a popover flips to, which arrow\n * key advances a list.\n */\nexport type Direction = \"ltr\" | \"rtl\"\n\nconst DirectionContext = React.createContext<Direction>(\"ltr\")\n\nexport interface DirectionProviderProps extends React.ComponentProps<\"div\"> {\n  dir: Direction\n}\n\nconst DirectionProvider = React.forwardRef<\n  HTMLDivElement,\n  DirectionProviderProps\n>(({ dir, children, ...props }, ref) => (\n  <DirectionContext.Provider value={dir}>\n    <div ref={ref} dir={dir} {...props}>\n      {children}\n    </div>\n  </DirectionContext.Provider>\n))\nDirectionProvider.displayName = \"DirectionProvider\"\n\n/**\n * The direction the nearest provider set, or `\"ltr\"` when there is none — the\n * same default the document has.\n */\nfunction useDirection(): Direction {\n  return React.useContext(DirectionContext)\n}\n\nexport { DirectionProvider, useDirection }\n",
      "type": "registry:ui"
    }
  ]
}