Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nextui-org/system-rsc

Package Overview
Dependencies
Maintainers
1
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextui-org/system-rsc - npm Package Compare versions

Comparing version 2.0.9 to 2.0.10

dist/chunk-4RIR2EK7.mjs

75

dist/extend-variants.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc