chore(ui,icons,ui-preset,toolbox): Move design system packages to monorepo (#5470)

This commit is contained in:
Kasper Fabricius Kristensen
2023-11-07 22:17:44 +01:00
committed by GitHub
parent 71853eafdd
commit e4ce2f4e07
722 changed files with 30300 additions and 186 deletions

View File

@@ -0,0 +1,71 @@
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<Component extends (...args: any) => any> = Omit<OmitUndefined<Parameters<Component>[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> = T extends undefined ? never : T;
+type StringToBoolean<T> = T extends "true" | "false" ? boolean : T;
+
+export type VariantProps<Component extends (...args: any) => any> = Omit<
+ OmitUndefined<Parameters<Component>[0]>,
+ "class" | "className"
+>;
export type CxOptions = Parameters<typeof clsx>;
export type CxReturn = ReturnType<typeof clsx>;
export declare const cx: typeof clsx;
type ConfigSchema = Record<string, Record<string, ClassValue>>;
type ConfigVariants<T extends ConfigSchema> = {
- [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | null | undefined;
+ [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | null | undefined;
};
type ConfigVariantsMulti<T extends ConfigSchema> = {
- [Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | StringToBoolean<keyof T[Variant]>[] | undefined;
+ [Variant in keyof T]?:
+ | StringToBoolean<keyof T[Variant]>
+ | StringToBoolean<keyof T[Variant]>[]
+ | undefined;
};
-type Config<T> = T extends ConfigSchema ? {
- variants?: T;
- defaultVariants?: ConfigVariants<T>;
- compoundVariants?: (T extends ConfigSchema ? (ConfigVariants<T> | ConfigVariantsMulti<T>) & ClassProp : ClassProp)[];
-} : never;
-type Props<T> = T extends ConfigSchema ? ConfigVariants<T> & ClassProp : ClassProp;
-export declare const cva: <T>(base?: ClassValue, config?: Config<T> | undefined) => (props?: Props<T> | undefined) => string;
+type Config<T> = T extends ConfigSchema
+ ? {
+ variants?: T;
+ defaultVariants?: ConfigVariants<T>;
+ compoundVariants?: (T extends ConfigSchema
+ ? (ConfigVariants<T> | ConfigVariantsMulti<T>) & ClassProp
+ : ClassProp)[];
+ }
+ : never;
+type Props<T> = T extends ConfigSchema
+ ? ConfigVariants<T> & ClassProp
+ : ClassProp;
+export declare const cva: <T>(
+ base?: ClassValue,
+ config?: Config<T> | undefined
+) => (props?: Props<T> | undefined) => string;
export {};