import type { ComponentType } from "react" import { useRegional } from "./context" import type { RegionalRegistry } from "./types" /** * HOC pattern — injects the full registry as a `registry` prop. * Use when the hook pattern is not available (class components, third-party wrappers). * * @example * const MyWidget = withRegionalConfig(BaseWidget) * // BaseWidget receives { registry: RegionalRegistry, ...ownProps } */ export function withRegionalConfig

( Component: ComponentType

, ): ComponentType> { const displayName = Component.displayName ?? Component.name ?? "Component" function WrappedWithRegional(props: Omit) { const registry = useRegional() return } WrappedWithRegional.displayName = `withRegionalConfig(${displayName})` return WrappedWithRegional }