{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "direction",
  "title": "Direction",
  "author": "@fma-ui/ui",
  "description": "Sets LTR/RTL text-direction context for descendant react-aria-components — a compatibility shim so a Radix/Base UI-style `direction` prop keeps working via react-aria's locale system.",
  "dependencies": [
    "react-aria-components@^1.21.1"
  ],
  "files": [
    {
      "path": "src/core/direction/direction.tsx",
      "content": "import type * as React from \"react\";\nimport { I18nProvider, useLocale } from \"react-aria-components\";\n\nfunction DirectionProvider(\n  props: React.ComponentProps<typeof I18nProvider> & {\n    direction?: \"ltr\" | \"rtl\";\n  },\n) {\n  // For compatibility with Radix / Base UI, if only a `direction` is provided and not a `locale`,\n  // create a locale string that forces the direction by setting the script to arabic or latin.\n  const { locale: currentLocale } = useLocale();\n  let locale = props.locale;\n  if (!locale && props.direction) {\n    locale = new Intl.Locale(currentLocale, {\n      script: props.direction === \"rtl\" ? \"Arab\" : \"Latn\",\n    }).toString();\n  }\n\n  return <I18nProvider {...props} locale={locale} />;\n}\n\nfunction useDirection() {\n  const { direction } = useLocale();\n  return direction;\n}\n\nexport { DirectionProvider, I18nProvider, useDirection, useLocale };\n",
      "type": "registry:component",
      "target": "components/fma-ui/direction.tsx"
    }
  ],
  "meta": {
    "status": "stable",
    "source": "shadcn",
    "tags": [
      "layout",
      "i18n",
      "react-aria"
    ]
  },
  "categories": [
    "layout"
  ],
  "type": "registry:ui"
}