UNPKG

@nex-ui/styled

Version:

Styled API for creating atomic, theme-aware component styling.

24 lines (21 loc) 771 B
import { ElementType, FC, ComponentProps, JSX } from 'react'; import { Interpolation } from '@nex-ui/system'; type Overwrite<K, T> = Omit<K, keyof T> & T; interface NexComponent<T extends ElementType> extends FC<Overwrite<ComponentProps<T>, { as?: ElementType; sx?: Interpolation; }>> { <E extends ElementType = T>(props: Overwrite<ComponentProps<E>, { as?: E; sx?: Interpolation; }>): JSX.Element; } type HTMLNexComponents = { [Tag in keyof JSX.IntrinsicElements]: NexComponent<Tag>; }; interface CreateNexComponent { <C extends ElementType>(component: C): NexComponent<C>; } interface NexFactory extends HTMLNexComponents, CreateNexComponent { } export type { CreateNexComponent, HTMLNexComponents, NexComponent, NexFactory };