import { ComponentProps, ComponentRef, ElementType, JSX, NamedExoticComponent, PropsWithoutRef, RefAttributes } from "react";

//#region src/types.d.ts
interface TiwiProps {
  className?: string;
}
type TiwiVariants<T extends string> = { [K in T]?: string };
type TiwiVariantsMap<T extends string> = { [K in T]?: boolean };
type TiwiVariantsProp<T extends string> = TiwiVariantsMap<T> | ReadonlyArray<T | undefined> | T | false | null | undefined;
type TiwiComponentProps<T extends string> = [T] extends [never] ? {} : {
  variants: TiwiVariantsProp<T>;
};
type PropsWithoutVariants<P> = P extends any ? "variants" extends keyof P ? Omit<P, "variants"> : P : P;
declare const tiwiComponentSymbol: unique symbol;
interface TiwiExoticComponent<TProps extends object, TRef, TVariant extends string> extends NamedExoticComponent<PropsWithoutRef<PropsWithoutVariants<TProps> & TiwiComponentProps<TVariant>> & RefAttributes<TRef>> {
  [tiwiComponentSymbol]: true;
}
type VariantsOf<T extends TiwiExoticComponent<any, any, any>> = T extends TiwiExoticComponent<any, any, infer TVariants> ? TVariants : never;
interface TiwiBuilder<TProps extends object, TRef, TVariant extends string = never> {
  <T extends string = never>(classNames: TemplateStringsArray, ...variantDefinitions: TiwiVariants<T>[]): TiwiExoticComponent<TProps, TRef, T | TVariant>;
}
type ElementWithTiwiProps<E> = E extends ElementType<infer Props> ? "className" extends keyof Props ? string extends Props["className"] ? E : never : never : never;
interface TiwiFunction {
  <E extends ElementType>(Element: ElementWithTiwiProps<E>): TiwiBuilder<ComponentProps<E>, ComponentRef<E>, E extends TiwiExoticComponent<any, any, infer T> ? T : never>;
}
type IntrinsicElementsBuilderMap = { [K in keyof JSX.IntrinsicElements]: TiwiBuilder<JSX.IntrinsicElements[K], ComponentRef<K>> };
interface Tiwi extends TiwiFunction, IntrinsicElementsBuilderMap {}
//#endregion
export { TiwiBuilder as a, TiwiFunction as c, TiwiVariantsProp as d, VariantsOf as f, Tiwi as i, TiwiProps as l, IntrinsicElementsBuilderMap as n, TiwiComponentProps as o, tiwiComponentSymbol as p, PropsWithoutVariants as r, TiwiExoticComponent as s, ElementWithTiwiProps as t, TiwiVariants as u };