UNPKG

@spaced-out/ui-design-system

Version:
21 lines 1.34 kB
import * as React from 'react'; import type { Flow } from 'flow-to-typescript-codemod'; /** Extract the actual ref instance type from a JSX element/component type */ type RefOf<E extends React.ElementType> = React.ComponentPropsWithRef<E> extends { ref?: React.Ref<infer R>; } ? R : never; /** Public props for generated components: original props (no ref) + optional className */ export type ComponentProps<E extends React.ElementType> = React.ComponentPropsWithoutRef<E> & { className?: string; }; /** HOC display name helper: sets Wrapper.displayName = `${hocName}(WrappedName)` */ export declare function nameHoc<C, T extends React.ComponentType<C>, C2>(WrapperComponent: T, WrappedComponent: React.ComponentType<C2>, hocName: string): T; /** Public alias for “className-merging” components */ export type ClassNameComponent<T extends React.ElementType = 'div'> = Flow.AbstractComponent<ComponentProps<T>, RefOf<T>>; /** * Factory: builds a component for a given intrinsic tag or component type * that merges `className` with a base class and forwards its ref. */ export declare function makeClassNameComponent<C extends React.ElementType = 'div'>(baseClassName: string, ComponentType?: C, name?: string): Flow.AbstractComponent<ComponentProps<C>, RefOf<C>>; export {}; //# sourceMappingURL=makeClassNameComponent.d.ts.map