@tw-classed/core
Advanced tools
Comparing version 1.3.0 to 1.3.2-canary.1
@@ -41,4 +41,8 @@ /** Narrowed function. */ | ||
}> : {}; | ||
interface PropsWithClass { | ||
className?: string; | ||
class?: string; | ||
} | ||
interface ClassedCreator<Props extends {} = {}> { | ||
(variantProps?: Props): string; | ||
(variantProps?: Props & PropsWithClass): string; | ||
} | ||
@@ -45,0 +49,0 @@ interface ClassedType<Props extends {} = {}, TComposedVariants extends {} = {}> extends ClassedCreator<Props> { |
@@ -6,2 +6,3 @@ /** | ||
const cx = (classNames)=>classNames.filter(Boolean).join(" "); | ||
const cn = (...classes)=>cx(classes); | ||
const mergeClass = (c1, c2)=>{ | ||
@@ -84,3 +85,3 @@ if (typeof c2 === "boolean") return c1; | ||
const internalClassed = (classes, { merger =mergeClass } = {})=>{ | ||
const internalClassed = (classes, { merger =cn } = {})=>{ | ||
// Parse classNames and variants | ||
@@ -95,3 +96,7 @@ const { className , variants , defaultVariants , compoundVariants } = parseClassNames(classes); | ||
}, variantProps); | ||
return merger(className, variantClassName); | ||
const extra = [ | ||
variantProps == null ? void 0 : variantProps.className, | ||
variantProps == null ? void 0 : variantProps.class | ||
].filter(Boolean); | ||
return merger(className, variantClassName, ...extra); | ||
}; | ||
@@ -98,0 +103,0 @@ // Add variants to the classed producer |
{ | ||
"name": "@tw-classed/core", | ||
"version": "1.3.0", | ||
"version": "1.3.2-canary.1", | ||
"description": "A Stitches & Styled-Components inspired library to create reusable Tailwind react components", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
24072
460
1