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 registry = useRegional()
return