nextui-org/tailwind-variants

`defaultVariants` that are `true` can't be set by the consumer (boolean variants)

tronikelis opened this issue · 1 comments

Describe the bug
If you have variants like this {foo: {true: "bar"}} and have defaultVariants: { foo: true }, then if the consumer sets foo as false, it does not remove the styles

To Reproduce
Steps to reproduce the behavior:

const card = tv({
  base: "",
  variants: {
    foo: {
      true: "bar",
    },
  },

  defaultVariants: {
    foo: true,
  },
});

console.log([card({ foo: false })]); // ["bar"]
console.log([card({ foo: undefined })]); // ["bar"]

Expected behavior
If foo is false, then it should have the relevant styles removed

Desktop (please complete the following information):

  • OS Windows
  • Browser FF
  • Version 121

Additional notes
This might be related to: #141

@Tronikelis I updated my open PR to also fix this