From 0e153845a25aa5bd9c8091ee2d4170c2c9b27b49 Mon Sep 17 00:00:00 2001 From: p-sw Date: Fri, 24 May 2024 22:25:45 +0900 Subject: [PATCH] fix: make variantProps resolver include className and preset as variantProps --- packages/react/shared.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/react/shared.tsx b/packages/react/shared.tsx index 05f154b..494c302 100644 --- a/packages/react/shared.tsx +++ b/packages/react/shared.tsx @@ -112,7 +112,10 @@ export function vcn< >( anyProps: AnyPropBeforeResolve ) => [ - Partial>, + Partial> & { + className?: string; + preset?: N; + }, Omit< AnyPropBeforeResolve, keyof Partial> | "preset" | "className" @@ -162,14 +165,21 @@ export function vcn< return Object.entries(anyProps).reduce( ([variantProps, otherProps], [key, value]) => { - if (variantKeys.includes(key)) { + if ( + variantKeys.includes(key) || + key === "className" || + key === "preset" + ) { return [{ ...variantProps, [key]: value }, otherProps]; } return [variantProps, { ...otherProps, [key]: value }]; }, [{}, {}] ) as [ - Partial>, + Partial> & { + className?: string; + preset?: N; + }, Omit< typeof anyProps, keyof Partial> | "preset" | "className"