From 250736169fcc7e3689b0546cf1a598df0287f0ed Mon Sep 17 00:00:00 2001 From: derekrsargent Date: Wed, 1 Mar 2023 15:10:07 -0500 Subject: [PATCH 1/3] fix: extendedbaseconfig typos --- .../getting-started/Styled/index.stories.mdx | 10 +++++----- .../src/overview/API/index.stories.mdx | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/example/storybook/src/getting-started/Styled/index.stories.mdx b/example/storybook/src/getting-started/Styled/index.stories.mdx index 0cbaa1c26..dd4cd3d2c 100644 --- a/example/storybook/src/getting-started/Styled/index.stories.mdx +++ b/example/storybook/src/getting-started/Styled/index.stories.mdx @@ -32,7 +32,7 @@ const StyledCard = styled( }, }, componentConfig, - extenedBaseConfig + extendedBaseConfig ); ``` @@ -47,7 +47,7 @@ To configure styled, create a dank.styled.ts file (`.js`works too) - Component - componentStyleConfig - componentConfig -- extenedBaseConfig +- extendedBaseConfig ### componentConfig @@ -85,11 +85,11 @@ componentConfig is a object that let’s you define the following: } ``` - Note: For this to work you also need to add the prop in `propertyTokenMap`, that can be defined in the next parameter of styled function i.e. **extenedBaseConfig**. + Note: For this to work you also need to add the prop in `propertyTokenMap`, that can be defined in the next parameter of styled function i.e. **extendedBaseConfig**. -### extenedBaseConfig +### extendedBaseConfig -extenedBaseConfig is a object that let’s you extend the base config for the component. This is useful when you want to define some aliases, tokens, propertyTokenMap, +extendedBaseConfig is a object that let’s you extend the base config for the component. This is useful when you want to define some aliases, tokens, propertyTokenMap, and propertyResolver that is specific to the component. ```tsx diff --git a/example/storybook/src/overview/API/index.stories.mdx b/example/storybook/src/overview/API/index.stories.mdx index 499fbab95..d21390ec7 100644 --- a/example/storybook/src/overview/API/index.stories.mdx +++ b/example/storybook/src/overview/API/index.stories.mdx @@ -25,7 +25,7 @@ const StyledCard = styled( }, }, componentConfig, - extenedBaseConfig + extendedBaseConfig ); ``` @@ -63,11 +63,11 @@ const StyledCard = styled( } ``` - Note: For this to work you also need to add the prop in `propertyTokenMap`, that can be defined in the next parameter of styled function i.e. **extenedBaseConfig**. + Note: For this to work you also need to add the prop in `propertyTokenMap`, that can be defined in the next parameter of styled function i.e. **extendedBaseConfig**. -## extenedBaseConfig +## extendedBaseConfig -extenedBaseConfig is an object that let’s you extend the base config for the component. This is useful when you want to define some aliases, tokens, propertyTokenMap, +extendedBaseConfig is an object that let’s you extend the base config for the component. This is useful when you want to define some aliases, tokens, propertyTokenMap, and propertyResolver that is specific to the component. ```tsx @@ -274,7 +274,7 @@ const StyledInput = styled( }, }, componentConfig, - extenedBaseConfig + extendedBaseConfig ); ``` @@ -297,7 +297,7 @@ const StyledInput = styled( }, }, componentConfig, - extenedBaseConfig + extendedBaseConfig ); ``` @@ -326,7 +326,7 @@ const StyledInput = styled( }, }, componentConfig, - extenedBaseConfig + extendedBaseConfig ); ``` @@ -351,7 +351,7 @@ const StyledInput = styled( borderRadius: '$2', }, componentConfig, - extenedBaseConfig + extendedBaseConfig ); ; @@ -372,7 +372,7 @@ const StyledInput = styled( borderRadius: '$2', }, componentConfig, - extenedBaseConfig + extendedBaseConfig ); ; From e66e27860ee78c4c0fd97a5377d21b957645fea9 Mon Sep 17 00:00:00 2001 From: ankit-tailor Date: Mon, 4 Sep 2023 12:42:55 +0530 Subject: [PATCH 2/3] fix: remove variant props --- packages/react/src/styled.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/react/src/styled.tsx b/packages/react/src/styled.tsx index 204fe9207..402536b04 100644 --- a/packages/react/src/styled.tsx +++ b/packages/react/src/styled.tsx @@ -707,9 +707,15 @@ export function getVariantProps( if (restProps) { variantTypes?.forEach((variant) => { - if (props.hasOwnProperty(variant)) { + if ( + props.hasOwnProperty(variant) && + theme.variants[variant]?.[props[variant]] + ) { variantProps[variant] = props[variant]; - if (shouldDeleteVariants) delete restProps[variant]; + + if (shouldDeleteVariants) { + delete restProps[variant]; + } } }); } @@ -1119,7 +1125,8 @@ export function verboseStyled( Object.assign(themeDefaultProps, incomingComponentProps); - const { variantProps } = getVariantProps(themeDefaultProps, theme); + const { variantProps, restProps: componentPropsWithoutVariants } = + getVariantProps(themeDefaultProps, theme); const { baseStyleCSSIds: applyBaseStyleCSSIds, @@ -1143,7 +1150,7 @@ export function verboseStyled( const { sx: filteredComponentSx, rest: filteredComponentRemainingProps } = convertUtiltiyToSXFromProps( - componentProps, + componentPropsWithoutVariants, styledSystemProps, componentStyleConfig ); From 0b685134847a9fc24bb70108cdbf344887a21dca Mon Sep 17 00:00:00 2001 From: ankit-tailor Date: Mon, 4 Sep 2023 12:44:57 +0530 Subject: [PATCH 3/3] v0.2.22 --- packages/react/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/package.json b/packages/react/package.json index 107856457..a6d318d7b 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,7 +1,7 @@ { "name": "@gluestack-style/react", "description": "A universal & performant styling library for React Native, Next.js & React", - "version": "0.2.21", + "version": "0.2.22", "keywords": [ "React Native", "Next.js",