@nextui-org/system-rsc
Advanced tools
Comparing version 2.0.9 to 2.0.10
@@ -71,4 +71,33 @@ "use strict"; | ||
} | ||
function getClassNamesWithProps({ props, defaultVariants, customTv, hasSlots }) { | ||
var _a; | ||
function getClassNamesWithProps({ | ||
props = {}, | ||
variants, | ||
slots, | ||
defaultVariants, | ||
compoundVariants, | ||
hasSlots, | ||
opts | ||
}) { | ||
var _a, _b, _c; | ||
if (defaultVariants && typeof defaultVariants === "object") { | ||
for (const key in defaultVariants) { | ||
const value = defaultVariants[key]; | ||
const propValue = props == null ? void 0 : props[key]; | ||
if (propValue && propValue !== value) { | ||
delete defaultVariants[key]; | ||
} | ||
} | ||
} | ||
const customTv = (0, import_theme.tv)( | ||
{ | ||
variants, | ||
defaultVariants, | ||
compoundVariants, | ||
...hasSlots && { slots } | ||
}, | ||
{ | ||
twMerge: (_a = opts.twMerge) != null ? _a : true, | ||
twMergeConfig: (_b = opts.twMergeConfig) != null ? _b : {} | ||
} | ||
); | ||
const [baseProps, variantProps] = mapPropsVariants(props, customTv.variantKeys, false); | ||
@@ -87,3 +116,3 @@ const newProps = { ...defaultVariants, ...baseProps }; | ||
}); | ||
Object.entries((_a = props.classNames) != null ? _a : {}).forEach(([key, value]) => { | ||
Object.entries((_c = props.classNames) != null ? _c : {}).forEach(([key, value]) => { | ||
classNames[key] = cn(classNames[key], value); | ||
@@ -98,25 +127,20 @@ }); | ||
function extendVariants(BaseComponent, styles = {}, opts = {}) { | ||
var _a, _b; | ||
const { variants, defaultVariants, compoundVariants } = styles || {}; | ||
const slots = getSlots(variants); | ||
const hasSlots = typeof slots === "object" && Object.keys(slots).length !== 0; | ||
const customTv = (0, import_theme.tv)( | ||
{ | ||
variants, | ||
defaultVariants, | ||
compoundVariants, | ||
...hasSlots && { slots } | ||
}, | ||
{ | ||
twMerge: (_a = opts.twMerge) != null ? _a : true, | ||
twMergeConfig: (_b = opts.twMergeConfig) != null ? _b : {} | ||
} | ||
); | ||
const ForwardedComponent = React.forwardRef((originalProps = {}, ref) => { | ||
const newProps = getClassNamesWithProps({ | ||
props: originalProps, | ||
defaultVariants, | ||
customTv, | ||
hasSlots | ||
}); | ||
const newProps = React.useMemo( | ||
() => getClassNamesWithProps( | ||
{ | ||
slots, | ||
variants, | ||
compoundVariants, | ||
props: originalProps, | ||
defaultVariants, | ||
hasSlots, | ||
opts | ||
}, | ||
[originalProps] | ||
) | ||
); | ||
return React.createElement(BaseComponent, { ...originalProps, ...newProps, ref }); | ||
@@ -127,6 +151,9 @@ }); | ||
const newProps = getClassNamesWithProps({ | ||
slots, | ||
variants, | ||
compoundVariants, | ||
props: itemProps, | ||
defaultVariants, | ||
customTv, | ||
hasSlots | ||
hasSlots, | ||
opts | ||
}); | ||
@@ -133,0 +160,0 @@ return BaseComponent.getCollectionNode({ ...itemProps, ...newProps }); |
@@ -107,4 +107,33 @@ "use strict"; | ||
} | ||
function getClassNamesWithProps({ props, defaultVariants, customTv, hasSlots }) { | ||
var _a; | ||
function getClassNamesWithProps({ | ||
props = {}, | ||
variants, | ||
slots, | ||
defaultVariants, | ||
compoundVariants, | ||
hasSlots, | ||
opts | ||
}) { | ||
var _a, _b, _c; | ||
if (defaultVariants && typeof defaultVariants === "object") { | ||
for (const key in defaultVariants) { | ||
const value = defaultVariants[key]; | ||
const propValue = props == null ? void 0 : props[key]; | ||
if (propValue && propValue !== value) { | ||
delete defaultVariants[key]; | ||
} | ||
} | ||
} | ||
const customTv = (0, import_theme.tv)( | ||
{ | ||
variants, | ||
defaultVariants, | ||
compoundVariants, | ||
...hasSlots && { slots } | ||
}, | ||
{ | ||
twMerge: (_a = opts.twMerge) != null ? _a : true, | ||
twMergeConfig: (_b = opts.twMergeConfig) != null ? _b : {} | ||
} | ||
); | ||
const [baseProps, variantProps] = mapPropsVariants(props, customTv.variantKeys, false); | ||
@@ -123,3 +152,3 @@ const newProps = { ...defaultVariants, ...baseProps }; | ||
}); | ||
Object.entries((_a = props.classNames) != null ? _a : {}).forEach(([key, value]) => { | ||
Object.entries((_c = props.classNames) != null ? _c : {}).forEach(([key, value]) => { | ||
classNames[key] = cn(classNames[key], value); | ||
@@ -134,25 +163,20 @@ }); | ||
function extendVariants(BaseComponent, styles = {}, opts = {}) { | ||
var _a, _b; | ||
const { variants, defaultVariants, compoundVariants } = styles || {}; | ||
const slots = getSlots(variants); | ||
const hasSlots = typeof slots === "object" && Object.keys(slots).length !== 0; | ||
const customTv = (0, import_theme.tv)( | ||
{ | ||
variants, | ||
defaultVariants, | ||
compoundVariants, | ||
...hasSlots && { slots } | ||
}, | ||
{ | ||
twMerge: (_a = opts.twMerge) != null ? _a : true, | ||
twMergeConfig: (_b = opts.twMergeConfig) != null ? _b : {} | ||
} | ||
); | ||
const ForwardedComponent = React.forwardRef((originalProps = {}, ref) => { | ||
const newProps = getClassNamesWithProps({ | ||
props: originalProps, | ||
defaultVariants, | ||
customTv, | ||
hasSlots | ||
}); | ||
const newProps = React.useMemo( | ||
() => getClassNamesWithProps( | ||
{ | ||
slots, | ||
variants, | ||
compoundVariants, | ||
props: originalProps, | ||
defaultVariants, | ||
hasSlots, | ||
opts | ||
}, | ||
[originalProps] | ||
) | ||
); | ||
return React.createElement(BaseComponent, { ...originalProps, ...newProps, ref }); | ||
@@ -163,6 +187,9 @@ }); | ||
const newProps = getClassNamesWithProps({ | ||
slots, | ||
variants, | ||
compoundVariants, | ||
props: itemProps, | ||
defaultVariants, | ||
customTv, | ||
hasSlots | ||
hasSlots, | ||
opts | ||
}); | ||
@@ -169,0 +196,0 @@ return BaseComponent.getCollectionNode({ ...itemProps, ...newProps }); |
{ | ||
"name": "@nextui-org/system-rsc", | ||
"version": "2.0.9", | ||
"version": "2.0.10", | ||
"description": "NextUI system primitives compatibles with RSC imports", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
35585
944