diff --git a/dist/index.d.ts b/dist/index.d.ts index 676e466a43ad8932cbb3131bb2c3dea687d47041..cbffdc5191bd8535468fdeaf68365845d15804ea 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,21 +1,55 @@ +import type * as CLSX from "clsx"; import clsx from "clsx"; -import type { ClassProp, ClassValue, OmitUndefined, StringToBoolean } from "./types"; -export type VariantProps any> = Omit[0]>, "class" | "className">; + +type ClassPropKey = "class" | "className"; +type ClassValue = CLSX.ClassValue; +type ClassProp = + | { + class: ClassValue; + className?: never; + } + | { + class?: never; + className: ClassValue; + } + | { + class?: never; + className?: never; + }; +type OmitUndefined = T extends undefined ? never : T; +type StringToBoolean = T extends "true" | "false" ? boolean : T; + +export type VariantProps any> = Omit< + OmitUndefined[0]>, + "class" | "className" +>; export type CxOptions = Parameters; export type CxReturn = ReturnType; export declare const cx: typeof clsx; type ConfigSchema = Record>; type ConfigVariants = { - [Variant in keyof T]?: StringToBoolean | null | undefined; + [Variant in keyof T]?: StringToBoolean | null | undefined; }; type ConfigVariantsMulti = { - [Variant in keyof T]?: StringToBoolean | StringToBoolean[] | undefined; + [Variant in keyof T]?: + | StringToBoolean + | StringToBoolean[] + | undefined; }; -type Config = T extends ConfigSchema ? { - variants?: T; - defaultVariants?: ConfigVariants; - compoundVariants?: (T extends ConfigSchema ? (ConfigVariants | ConfigVariantsMulti) & ClassProp : ClassProp)[]; -} : never; -type Props = T extends ConfigSchema ? ConfigVariants & ClassProp : ClassProp; -export declare const cva: (base?: ClassValue, config?: Config | undefined) => (props?: Props | undefined) => string; +type Config = T extends ConfigSchema + ? { + variants?: T; + defaultVariants?: ConfigVariants; + compoundVariants?: (T extends ConfigSchema + ? (ConfigVariants | ConfigVariantsMulti) & ClassProp + : ClassProp)[]; + } + : never; +type Props = T extends ConfigSchema + ? ConfigVariants & ClassProp + : ClassProp; +export declare const cva: ( + base?: ClassValue, + config?: Config | undefined +) => (props?: Props | undefined) => string; export {};