From 44688e3f48d437d6a0e13b4059e084954ffc3125 Mon Sep 17 00:00:00 2001 From: Mark Skelton Date: Mon, 17 Jul 2023 19:33:20 -0500 Subject: [PATCH] fix: support `false` variants when using `compoundSlots` --- src/__tests__/tv.test.ts | 4 ++-- src/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/__tests__/tv.test.ts b/src/__tests__/tv.test.ts index a4ef458..7138845 100644 --- a/src/__tests__/tv.test.ts +++ b/src/__tests__/tv.test.ts @@ -842,14 +842,14 @@ describe("Tailwind Variants (TV) - Compound Slots", () => { slots: ["item", "prev", "next"], size: "xs", color: "primary", - isBig: true, + isBig: false, class: "w-7 h-7 text-xs", }, ], defaultVariants: { size: "xs", color: "primary", - isBig: true, + isBig: false, }, }); // with default values diff --git a/src/index.js b/src/index.js index 859745b..1d9d65c 100644 --- a/src/index.js +++ b/src/index.js @@ -304,7 +304,7 @@ export const tv = (options, configProp) => { // if none of the slot variant keys are included in props or default variants then skip the slot // if the included slot variant key is not equal to the slot variant value then skip the slot - if (!completePropsValue || completePropsValue !== slotVariants[key]) { + if (completePropsValue === undefined || completePropsValue !== slotVariants[key]) { return acc; } }