Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Button] Custom variant #21648

Merged
merged 86 commits into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
97aac4e
wip
mnajdova Jun 29, 2020
dd57f8e
wip
mnajdova Jun 29, 2020
5c3d592
wip
mnajdova Jun 30, 2020
8ba964e
relaxed overrides
mnajdova Jul 1, 2020
6e0ab4d
added additions
mnajdova Jul 2, 2020
5c8364c
cleanup
mnajdova Jul 2, 2020
653c1e7
cleanup
mnajdova Jul 2, 2020
1755be6
prettier
mnajdova Jul 2, 2020
8c0ae69
wip
mnajdova Jul 4, 2020
036a172
another alternative
mnajdova Jul 5, 2020
1b94f50
Update packages/material-ui-styles/src/getStylesCreator/getStylesCrea…
mnajdova Jul 5, 2020
9370c1c
comb of props
mnajdova Jul 5, 2020
df60098
Update packages/material-ui-styles/src/getStylesCreator/getStylesCrea…
mnajdova Jul 5, 2020
f430770
cleanup
mnajdova Jul 6, 2020
2375c98
ts example updated
mnajdova Jul 6, 2020
7db6a98
Merge branch 'next' into feat/custom-variants
mnajdova Jul 6, 2020
c032672
Update packages/material-ui-styles/src/withStyles/withStyles.js
mnajdova Jul 6, 2020
22d5f4a
Update packages/material-ui-styles/src/withStyles/withStyles.js
mnajdova Jul 6, 2020
3fcb966
reverted changes
mnajdova Jul 6, 2020
212db32
Update packages/material-ui/src/styles/createMuiTheme.js
mnajdova Jul 6, 2020
f92dbaa
tests fixes
mnajdova Jul 6, 2020
ce2369f
prettier
mnajdova Jul 6, 2020
0e67339
addressing comments
mnajdova Jul 7, 2020
ccaf13f
prettier
mnajdova Jul 7, 2020
070ffe0
replace relaxed typings with ts declare module
mnajdova Jul 7, 2020
a86137e
improved description
mnajdova Jul 7, 2020
628e8fd
themeMerge
mnajdova Jul 8, 2020
132c930
prettier
mnajdova Jul 8, 2020
5036d2d
extract capitalize in utils
mnajdova Jul 10, 2020
5e79126
removed mergeThemes
mnajdova Jul 10, 2020
fa883ea
fix
mnajdova Jul 10, 2020
0ab15a6
fixes
mnajdova Jul 10, 2020
fed904b
break circular dependency
mnajdova Jul 10, 2020
9fcc431
restricted to variables
mnajdova Jul 10, 2020
313f8bf
reverted some changes
mnajdova Jul 10, 2020
60787ab
docs:api
mnajdova Jul 10, 2020
f04ccb4
removed new capitalize method
mnajdova Jul 10, 2020
1b81481
removed default exprot
mnajdova Jul 11, 2020
7f12e68
revert some changes, improved example
mnajdova Jul 11, 2020
e1c2d6d
prettier
mnajdova Jul 11, 2020
4f34120
example updated
mnajdova Jul 12, 2020
4f0a648
Update packages/material-ui-styles/src/getStylesCreator/getStylesCrea…
mnajdova Jul 18, 2020
beab317
updated demo
mnajdova Jul 18, 2020
0c00ea9
Merge branch 'feat/custom-variants' of https://github.com/mnajdova/ma…
mnajdova Jul 18, 2020
70b713d
Merge branch 'next' into feat/custom-variants
mnajdova Jul 18, 2020
bb687a4
prettier
mnajdova Jul 18, 2020
4efaf62
lint
mnajdova Jul 18, 2020
18de558
Update packages/material-ui-styles/src/getStylesCreator/getStylesCrea…
mnajdova Jul 19, 2020
4cb0b03
Update packages/material-ui-styles/src/getStylesCreator/getStylesCrea…
mnajdova Jul 19, 2020
e780712
Update docs/src/pages/customization/components/components.md
mnajdova Jul 19, 2020
eb02491
added test
mnajdova Jul 19, 2020
bb5baa1
prettier
mnajdova Jul 19, 2020
3e1ea72
Update docs/src/pages/customization/components/components.md
mnajdova Jul 19, 2020
90609ff
Update docs/src/pages/customization/components/components.md
mnajdova Jul 19, 2020
c4df879
added warning, renamed matcher to props
mnajdova Jul 20, 2020
7d4fa1d
tests
mnajdova Jul 21, 2020
7ae76f7
tests fixes
mnajdova Jul 21, 2020
c0a9d55
prettier
mnajdova Jul 21, 2020
f888036
prettier
mnajdova Jul 21, 2020
b26d20d
added logic for dynamic classkeys generation
mnajdova Jul 23, 2020
75cd3b6
Merge branch 'next' into feat/custom-variants
mnajdova Jul 23, 2020
5365b71
merge conflicts
mnajdova Jul 23, 2020
2916cd6
added tests for warnings, refactored tests
mnajdova Jul 23, 2020
e185968
prettier
mnajdova Jul 23, 2020
2b32fe8
improved test
mnajdova Jul 23, 2020
efe2e7d
Update packages/material-ui-styles/src/makeStyles/makeStyles.js
mnajdova Jul 23, 2020
4ce2381
Update packages/material-ui-styles/src/makeStyles/makeStyles.js
mnajdova Jul 23, 2020
048cd39
Update packages/material-ui/src/Button/Button.test.js
mnajdova Jul 23, 2020
57e4700
addressing comments
mnajdova Jul 23, 2020
4196182
added more description to the docs section
mnajdova Jul 23, 2020
515933e
prettier
mnajdova Jul 23, 2020
1d240c0
added test
mnajdova Jul 23, 2020
b9ac3ca
fixed name
mnajdova Jul 23, 2020
af088c9
polish
oliviertassinari Jul 23, 2020
4e8de25
added hook for variants
mnajdova Jul 24, 2020
20477c6
prettier
mnajdova Jul 24, 2020
0aa43ad
added test
mnajdova Jul 24, 2020
c71e4ba
prettier
mnajdova Jul 24, 2020
2bb3a29
Update packages/material-ui-styles/src/useThemeVariants/useThemeVaria…
mnajdova Jul 27, 2020
52d11c8
Update packages/material-ui/src/Button/Button.js
mnajdova Jul 27, 2020
55f0507
Update packages/material-ui-styles/src/useThemeVariants/useThemeVaria…
mnajdova Jul 27, 2020
44e2f1d
Update packages/material-ui/src/styles/createMuiTheme.js
mnajdova Jul 27, 2020
a55dfe4
Update packages/material-ui-styles/src/useThemeVariants/useThemeVaria…
mnajdova Jul 27, 2020
6b1742a
Update packages/material-ui/src/styles/createMuiTheme.js
mnajdova Jul 27, 2020
bcae6ef
fixed props destructuring order
mnajdova Jul 27, 2020
704e2f2
Merge branch 'next' into feat/custom-variants
mnajdova Jul 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/pages/api-docs/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The `MuiButton` name can be used for providing [default props](/customization/gl
| <span class="prop-name">href</span> | <span class="prop-type">string</span> | | The URL to link to when the button is clicked. If defined, an `a` element will be used as the root node. |
| <span class="prop-name">size</span> | <span class="prop-type">'large'<br>&#124;&nbsp;'medium'<br>&#124;&nbsp;'small'</span> | <span class="prop-default">'medium'</span> | The size of the button. `small` is equivalent to the dense button styling. |
| <span class="prop-name">startIcon</span> | <span class="prop-type">node</span> | | Element placed before the children. |
| <span class="prop-name">variant</span> | <span class="prop-type">'contained'<br>&#124;&nbsp;'outlined'<br>&#124;&nbsp;'text'</span> | <span class="prop-default">'text'</span> | The variant to use. |
| <span class="prop-name">variant</span> | <span class="prop-type">'contained'<br>&#124;&nbsp;'outlined'<br>&#124;&nbsp;'text'<br>&#124;&nbsp;string</span> | <span class="prop-default">'text'</span> | The variant to use. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string shouldn't be allowed by default. Will take a look later. Nothing that holds back this PR since it would also affect breakpoints.


The `ref` is forwarded to the root element.

Expand Down
52 changes: 52 additions & 0 deletions docs/src/pages/customization/components/GlobalThemeVariants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from 'react';
import {
createMuiTheme,
makeStyles,
ThemeProvider,
} from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';

const useStyles = makeStyles((theme) => ({
root: {
'& > *': {
margin: theme.spacing(1),
},
},
}));

const defaultTheme = createMuiTheme();

const inputTheme = createMuiTheme({
variants: {
MuiButton: [
{
matcher: { variant: 'dashed' },
styles: {
padding: '5px 15px',
border: `5px dashed ${defaultTheme.palette.primary.main}`,
},
},
{
matcher: { variant: 'dashed', color: 'secondary' },
styles: {
border: `5px dashed ${defaultTheme.palette.secondary.main}`,
},
},
],
},
});

export default function GlobalThemeVariants() {
const classes = useStyles();

return (
<div className={classes.root}>
<ThemeProvider theme={inputTheme}>
<Button variant="dashed">Dashed</Button>
<Button variant="dashed" color="secondary">
Dashed secondary
</Button>
</ThemeProvider>
</div>
);
}
59 changes: 59 additions & 0 deletions docs/src/pages/customization/components/GlobalThemeVariants.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react';
import {
createMuiTheme,
makeStyles,
Theme,
ThemeProvider,
} from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';

declare module '@material-ui/core/Button/Button' {
interface ButtonPropsVariantOverrides {
dashed: true;
}
}

const useStyles = makeStyles((theme: Theme) => ({
root: {
'& > *': {
Copy link
Member

@oliviertassinari oliviertassinari Jul 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioning this for later, I have seen a growing trend toward the Stack component approach in the community. I have been benchmarking on https://trello.com/c/vlLBgJca/2404-stack-component. I think that it would be great to introduce such a component in the future. It will allow us to simplify our demos.

margin: theme.spacing(1),
},
},
}));

const defaultTheme = createMuiTheme();

const inputTheme = createMuiTheme({
variants: {
MuiButton: [
{
matcher: { variant: 'dashed' },
styles: {
padding: '5px 15px',
border: `5px dashed ${defaultTheme.palette.primary.main}`,
},
},
{
matcher: { variant: 'dashed', color: 'secondary' },
styles: {
border: `5px dashed ${defaultTheme.palette.secondary.main}`,
},
},
],
},
});

export default function GlobalThemeVariants() {
const classes = useStyles();

return (
<div className={classes.root}>
<ThemeProvider theme={inputTheme}>
<Button variant="dashed">Dashed</Button>
<Button variant="dashed" color="secondary">
Dashed secondary
</Button>
</ThemeProvider>
</div>
);
}
38 changes: 38 additions & 0 deletions docs/src/pages/customization/components/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,41 @@ const theme = createMuiTheme({
```

{{"demo": "pages/customization/components/GlobalThemeOverride.js"}}

### Adding new theme variants
mnajdova marked this conversation as resolved.
Show resolved Hide resolved

You can take advantage of the `variants` key of the `theme` to potentially add new variants for the Material-UI components.
mnajdova marked this conversation as resolved.
Show resolved Hide resolved

```jsx
const theme = createMuiTheme({
variants: {
MuiButton: [
{
matcher: { variant: 'dashed' },
styles: {
padding: '5px 15px',
border: `5px dashed grey${blue[500]}`,
},
},
{
matcher: { variant: 'dashed', color: 'secondary' },
styles: {
border: `5px dashed ${red[500]}`,
},
},
],
},
});
```

If you are using TypeScript, you will need to specify your new variants/colors, using module augmentation.

```tsx
declare module '@material-ui/core/Button/Button' {
interface ButtonPropsVariantOverrides {
dashed: true;
}
}
```

{{"demo": "pages/customization/components/GlobalThemeVariants.js"}}
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
import { deepmerge } from '@material-ui/utils';
import MuiError from '@material-ui/utils/macros/MuiError.macro';
import noopTheme from './noopTheme';

// TODO: remove this once the capitalize method is moved to the @material-ui/utils package
export function capitalize(string) {
if (typeof string !== 'string') {
throw new MuiError('Material-UI: capitalize(string) expects a string argument.');
}

return string.charAt(0).toUpperCase() + string.slice(1);
}

function isEmpty(string) {
return string.length === 0;
}

const propsToClassKey = (matcher) => {
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved
const { variant, ...rest } = matcher;

let classKey = matcher.variant ? matcher.variant : '';

Object.keys(rest)
.sort()
.forEach((key) => {
if (key === 'color') {
classKey += isEmpty(classKey) ? matcher[key] : capitalize(matcher[key]);
} else {
classKey += `${isEmpty(classKey) ? key : capitalize(key)}${capitalize(matcher[key])}`;
}
});

return classKey;
};

export default function getStylesCreator(stylesOrCreator) {
const themingEnabled = typeof stylesOrCreator === 'function';

Expand Down Expand Up @@ -36,11 +68,15 @@ export default function getStylesCreator(stylesOrCreator) {
throw err;
}

if (!name || !theme.overrides || !theme.overrides[name]) {
if (
!name ||
((!theme.overrides || !theme.overrides[name]) && (!theme.variants || !theme.variants[name]))
) {
return styles;
}

const overrides = theme.overrides[name];
const overrides = (theme.overrides && theme.overrides[name]) || {};
const variants = (theme.variants && theme.variants[name]) || [];
const stylesWithOverrides = { ...styles };

Object.keys(overrides).forEach((key) => {
Expand All @@ -50,12 +86,22 @@ export default function getStylesCreator(stylesOrCreator) {
[
'Material-UI: You are trying to override a style that does not exist.',
`Fix the \`${key}\` key of \`theme.overrides.${name}\`.`,
'',
'If you intentionally wanted to add a new key, please use the theme.variants option.',
].join('\n'),
);
}
}

stylesWithOverrides[key] = deepmerge(stylesWithOverrides[key], overrides[key]);
stylesWithOverrides[key] = deepmerge(stylesWithOverrides[key] || {}, overrides[key]);
});

variants.forEach((definition) => {
const classKey = propsToClassKey(definition.matcher);
stylesWithOverrides[classKey] = deepmerge(
stylesWithOverrides[classKey] || {},
definition.styles,
);
});

return stylesWithOverrides;
Expand Down
36 changes: 36 additions & 0 deletions packages/material-ui-styles/src/withStyles/withStyles.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,42 @@ describe('withStyles', () => {
expect(sheetsRegistry.registry[0].rules.raw).to.deep.equal({ root: { padding: 9 } });
});

it('should support the variants key', () => {
eps1lon marked this conversation as resolved.
Show resolved Hide resolved
const styles = {};
const StyledComponent = withStyles(styles, { name: 'MuiButton' })(() => <div />);
const generateClassName = createGenerateClassName();
const sheetsRegistry = new SheetsRegistry();

render(
<ThemeProvider
theme={createMuiTheme({
variants: {
MuiButton: [
{
matcher: { variant: 'test' },
styles: { padding: 9 },
},
{
matcher: { variant: 'test', size: 'large' },
styles: { fontSize: 20 },
},
],
},
})}
>
<StylesProvider sheetsRegistry={sheetsRegistry} generateClassName={generateClassName}>
<StyledComponent />
</StylesProvider>
</ThemeProvider>,
);

expect(sheetsRegistry.registry.length).to.equal(1);
expect(sheetsRegistry.registry[0].rules.raw).to.deep.equal({
test: { padding: 9 },
testSizeLarge: { fontSize: 20 },
});
});

describe('options: disableGeneration', () => {
it('should not generate the styles', () => {
const styles = { root: { display: 'flex' } };
Expand Down
6 changes: 5 additions & 1 deletion packages/material-ui/src/Button/Button.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { OverridableStringUnion } from '@material-ui/types';
import { ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
import { OverrideProps, OverridableComponent, OverridableTypeMap } from '../OverridableComponent';

export interface ButtonPropsVariantOverrides {}
export type VariantDefaults = Record<'text' | 'outlined' | 'contained', true>;

export type ButtonTypeMap<
P = {},
D extends React.ElementType = 'button'
Expand Down Expand Up @@ -51,7 +55,7 @@ export type ButtonTypeMap<
/**
* The variant to use.
*/
variant?: 'text' | 'outlined' | 'contained';
variant?: OverridableStringUnion<VariantDefaults, ButtonPropsVariantOverrides>;
};
defaultComponent: D;
classKey: ButtonClassKey;
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,10 @@ Button.propTypes = {
/**
* The variant to use.
*/
variant: PropTypes.oneOf(['contained', 'outlined', 'text']),
variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['contained', 'outlined', 'text']),
PropTypes.string,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have to solve this right now but we should probably narrow this down before release by checking if any matcher matched. Right now vanilla users don't get runtime validation if the added the wrong variant.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this, we can actually use the chainPropTypes and check if the props.variant can be found in the props.classes. That way I think we can even get rid of the warnings we have currently in place. What do you think about this?

Copy link
Member

@oliviertassinari oliviertassinari Jul 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would looking at props.classes still work if we support arbitrary props combination (variant + size + orientation) or if the style engine is styled-components?

Right now vanilla users don't get runtime validation if the added the wrong variant.

There is a new warning added by Marija that aim to mitigate with the problem (we get a warning but we don't have the full component stack trace)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking as these validations are per prop, we can check for only that prop in the classes? But if I understand your point correctly, it can exists in combination with other props, not just itself, right? In that case I will need to update the warning I added, because currently it is checking only for the variant itself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My assumptions were:

  • with styled-components, we won't be able to use chainPropTypes to have a warning with the full component trace. We would need a new primitive from React. So if we can't get it with sc, maybe we shouldn't try with JSS in the first place.
  • if we want to support <Typography variant="headline1" size="small" color="brand" /> or any dynamic matching props, we would need to construct the class names dynamically, in this case, maybe .MuiTypogaphy-headline1SizeSmallColorBrand.
  • for the warning, I think that we should include as much information as possible for the developer to find where it warns. For instance, if we can plot MuiTypography + variant="headline1" /> when the headline1 variant doesn't exist, this help a lot
  • I haven't given any thoughts to what should happen with the warning and combination of props. I guess we can start with what's simple (your current warning), add tests for it, and grow from there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we want to support or any dynamic matching props, we would need to construct the class names dynamically, in this case, maybe .MuiTypogaphy-headline1SizeSmallColorBrand.

We can add this even now, with a simple hook like:

const useThemeVariants = (props, name) => {
  const theme = useTheme();
  const variantsClasses = [];
  if(theme && theme.variants && theme.variants[name]) {
    const themeVariants = theme.variants[name];
    themeVariants.forEach(themeVariant => {
      let isMatch = true;
      Object.keys(themeVariant.props).forEach(key => {
        if(props[key] !== themeVariant.props[key]) {
          isMatch = false;
        }
      });
      if(isMatch) {
        variantsClasses.push(classes[propsToClassKey(themeVariant.props)]);
      }
    })
  }
  return variantsClasses;
}

Some of the things are recalcuated two times but I will refactor it if we want to go with something like this.

This will allow us to even support new props 👍 I can clean this up and add it in the PR even now.


For the warnings, we can extend it further, but I would like to see what would be the feedback, as I don't want to add a lot of overload for just warning, the one that is in place now it's pretty simple and I am not sure if we will need more complicated one..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing more this hook, I definitely think we should add it, as it will guarantee that whatever combination of props the clients will use, will be supported inside the component. @oliviertassinari @eps1lon thoughts?

Copy link
Member

@oliviertassinari oliviertassinari Jul 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it makes sense. As far as I can think about it, for JSS, we will need to both generate the class names from the theme, and to apply them from the props, I don't see any other way. For styled-components, we will be able to bundle the logic at the same place, under the styled call.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this in the withStyles utility, it matches which classes should we added and appends them in the classes.root string. Please take a look and let me know if this makes sense.

]),
};

export default withStyles(styles, { name: 'MuiButton' })(Button);
3 changes: 3 additions & 0 deletions packages/material-ui/src/styles/createMuiTheme.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Spacing, SpacingOptions } from './createSpacing';
import { Transitions, TransitionsOptions } from './transitions';
import { ZIndex, ZIndexOptions } from './zIndex';
import { Overrides } from './overrides';
import { Variants } from './variants';
import { ComponentsProps } from './props';

export type Direction = 'ltr' | 'rtl';
Expand All @@ -24,6 +25,7 @@ export interface ThemeOptions {
spacing?: SpacingOptions;
transitions?: TransitionsOptions;
typography?: TypographyOptions | ((palette: Palette) => TypographyOptions);
variants?: Variants;
zIndex?: ZIndexOptions;
unstable_strictMode?: boolean;
}
Expand All @@ -40,6 +42,7 @@ export interface Theme {
spacing: Spacing;
transitions: Transitions;
typography: Typography;
variants?: Variants;
zIndex: ZIndex;
unstable_strictMode?: boolean;
}
Expand Down
1 change: 1 addition & 0 deletions packages/material-ui/src/styles/createMuiTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function createMuiTheme(options = {}, ...args) {
spacing,
shape,
transitions,
variants: {},
eps1lon marked this conversation as resolved.
Show resolved Hide resolved
zIndex,
},
other,
Expand Down
17 changes: 17 additions & 0 deletions packages/material-ui/src/styles/variants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { CSSProperties, CreateCSSProperties, PropsFunc } from '@material-ui/styles/withStyles';
import { ComponentsPropsList } from './props';

export type Variants = {
[Name in keyof ComponentsPropsList]?: Array<{
matcher: Partial<ComponentsPropsList[Name]>;
styles: // JSS property bag
| CSSProperties
// JSS property bag where values are based on props
| CreateCSSProperties<Partial<ComponentsPropsList[Name]>>
// JSS property bag based on props
| PropsFunc<
Partial<ComponentsPropsList[Name]>,
CreateCSSProperties<Partial<ComponentsPropsList[Name]>>
>;
}>;
};