Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #386 from gluestack/release/@gluestack-style/react…
Browse files Browse the repository at this point in the history
…@0.2.22

Release/@gluestack style/[email protected]
  • Loading branch information
ankit-tailor authored Sep 4, 2023
2 parents 5272a1e + 0b68513 commit 4d7277f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
10 changes: 5 additions & 5 deletions example/storybook/src/getting-started/Styled/index.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const StyledButton = styled(
},
},
componentConfig,
extenedBaseConfig
extendedBaseConfig
);
```

Expand All @@ -47,7 +47,7 @@ To configure **`styled`**, create a **`gluestack-style.config.ts`** file (**`.j
- Component
- componentStyleConfig
- componentConfig
- extenedBaseConfig
- extendedBaseConfig

### componentConfig

Expand Down Expand Up @@ -79,11 +79,11 @@ To configure **`styled`**, create a **`gluestack-style.config.ts`** file (**`.j
}
```

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 lets 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 lets 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
Expand Down
16 changes: 8 additions & 8 deletions example/storybook/src/overview/API/index.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const StyledButton = styled(
},
},
{}, // componentConfig,
{} // extenedBaseConfig,
{} // extendedBaseConfig,
);
```

Expand Down Expand Up @@ -63,9 +63,9 @@ const StyledButton = 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

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.
Expand Down Expand Up @@ -244,7 +244,7 @@ const StyledInput = styled(
},
},
componentConfig,
extenedBaseConfig
extendedBaseConfig
);
```
Expand All @@ -267,7 +267,7 @@ const StyledInput = styled(
},
},
componentConfig,
extenedBaseConfig
extendedBaseConfig
);
```
Expand Down Expand Up @@ -296,7 +296,7 @@ const StyledInput = styled(
},
},
componentConfig,
extenedBaseConfig
extendedBaseConfig
);
```
Expand All @@ -321,7 +321,7 @@ const StyledInput = styled(
borderRadius: '$2',
},
componentConfig,
extenedBaseConfig
extendedBaseConfig
);

<StyledInput sx={{ py: '$4' }} />;
Expand All @@ -342,7 +342,7 @@ const StyledInput = styled(
borderRadius: '$2',
},
componentConfig,
extenedBaseConfig
extendedBaseConfig
);

<StyledInput py="$4" bg="$gray800" />;
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
15 changes: 11 additions & 4 deletions packages/react/src/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
});
}
Expand Down Expand Up @@ -1119,7 +1125,8 @@ export function verboseStyled<P, Variants, ComCon>(

Object.assign(themeDefaultProps, incomingComponentProps);

const { variantProps } = getVariantProps(themeDefaultProps, theme);
const { variantProps, restProps: componentPropsWithoutVariants } =
getVariantProps(themeDefaultProps, theme);

const {
baseStyleCSSIds: applyBaseStyleCSSIds,
Expand All @@ -1143,7 +1150,7 @@ export function verboseStyled<P, Variants, ComCon>(

const { sx: filteredComponentSx, rest: filteredComponentRemainingProps } =
convertUtiltiyToSXFromProps(
componentProps,
componentPropsWithoutVariants,
styledSystemProps,
componentStyleConfig
);
Expand Down

0 comments on commit 4d7277f

Please sign in to comment.