@tw-classed/core
Advanced tools
Comparing version 1.5.2 to 1.6.0
@@ -29,2 +29,3 @@ /** Narrowed function. */ | ||
dataAttributes?: string[]; | ||
defaultProps?: Record<string, unknown>; | ||
}; | ||
@@ -110,2 +111,3 @@ type ClassNamesAndVariant<V extends Variants> = string | VariantConfig<V>; | ||
dataAttributes: string[]; | ||
defaultProps: Record<string, unknown>; | ||
}; | ||
@@ -112,0 +114,0 @@ declare const getVariantSelector: <TVariants extends Variants>(variantKey: string, props: Partial<InferVariantProps<TVariants>>, { defaultVariants }: Pick<VariantConfig<TVariants>, "defaultVariants">) => string | undefined; |
@@ -24,2 +24,3 @@ /** | ||
let dataAttributes = new Set(); | ||
let defaultProps = {}; | ||
for (const className of classNames){ | ||
@@ -33,10 +34,11 @@ if (!className) continue; | ||
const record = Reflect.has(className, TW_VARS) ? Reflect.get(className, TW_VARS) : className; | ||
record.variants && Object.assign(variantObj, record.variants); | ||
record.defaultVariants && Object.assign(defaultVariants, record.defaultVariants); | ||
record.compoundVariants && record.compoundVariants.forEach((cv)=>compoundVariants.push(cv)); | ||
record.className && stringClassNames.push(record.className); | ||
record.base && stringClassNames.push(record.base); | ||
record.dataAttributes && record.dataAttributes.forEach((name)=>{ | ||
if (record.variants) Object.assign(variantObj, record.variants); | ||
if (record.defaultVariants) Object.assign(defaultVariants, record.defaultVariants); | ||
if (record.compoundVariants) record.compoundVariants.forEach((cv)=>compoundVariants.push(cv)); | ||
if (record.className) stringClassNames.push(record.className); | ||
if (record.base) stringClassNames.push(record.base); | ||
if (record.dataAttributes) record.dataAttributes.forEach((name)=>{ | ||
dataAttributes.add(name); | ||
}); | ||
if (record.defaultProps) Object.assign(defaultProps, record.defaultProps); | ||
} | ||
@@ -49,3 +51,4 @@ } | ||
compoundVariants, | ||
dataAttributes: Array.from(dataAttributes) | ||
dataAttributes: Array.from(dataAttributes), | ||
defaultProps | ||
}; | ||
@@ -52,0 +55,0 @@ }; |
{ | ||
"name": "@tw-classed/core", | ||
"version": "1.5.2", | ||
"version": "1.6.0", | ||
"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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40318
547