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

[Joy] Add default color to Input and ListItemButton #31826

Merged
merged 13 commits into from
Mar 16, 2022

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Mar 16, 2022

Why?

The current implementation allows some components to have a variant without a color. However, for Input & ListItemButton, they are interactive which need colors on hover, active, disabled. At initial state, they use text.primary color and use the neutral color for other states if the color prop is undefined. I think it creates confusion for customization and developers will have to remember about these specific components.

I think it would be better to just use neutral color directly and does not allow any components to have a variant without a color (for the default case).

Changes

  • Adjust neutral variant tokens to have higher contrast
  • Fix Input & ListItemButton to have neutral color by default
  • (misc) add system props to Typography so that this works: <Typography color="primary.textColor" fontWeight="sm">

@siriwatknp siriwatknp added the package: joy-ui Specific to @mui/joy label Mar 16, 2022
@siriwatknp siriwatknp requested a review from hbjORbj March 16, 2022 03:01
@mui-bot
Copy link

mui-bot commented Mar 16, 2022

Details of bundle changes

@mui/joy: parsed: +2.20% , gzip: +0.79%

Generated by 🚫 dangerJS against d280935

outlinedHoverBg: 'var(--joy-palette-neutral-outlinedHoverBg)',
outlinedHoverBorder: 'var(--joy-palette-neutral-outlinedHoverBorder)',
outlinedActiveBg: 'var(--joy-palette-neutral-outlinedActiveBg)',
outlinedDisabledColor: 'var(--joy-palette-neutral-outlinedDisabledColor)',
outlinedDisabledBorder: 'var(--joy-palette-neutral-outlinedDisabledBorder)',
lightColor: 'var(--joy-palette-neutral-lightColor)',
lightBg: 'var(--joy-palette-neutral-lightBg)',
lightHoverColor: 'var(--joy-palette-neutral-lightHoverColor)',
Copy link
Member

Choose a reason for hiding this comment

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

Are we intentionally not having containedHoverColor?

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 think @danilo-leal will tweak the colors again.

Copy link
Contributor

Choose a reason for hiding this comment

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

I will!

@@ -143,7 +143,7 @@ const Avatar = React.forwardRef(function Avatar(inProps, ref) {
color = 'neutral',
component = 'div',
size = 'md',
variant = 'contained',
variant = 'light',
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

One intention of the global variant is to bring attention. Currently contained brings the most attention and text be the last. My feeling is that Avatar is a complimentary UI, so it should not be contained by default.

Copy link
Member

Choose a reason for hiding this comment

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

Gottcha gottcha!

sx?: SxProps;
};
props: P &
SystemProps & {
Copy link
Member

Choose a reason for hiding this comment

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

I like this!

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 missed this type in the Typography PR.

Copy link
Member

@hbjORbj hbjORbj left a comment

Choose a reason for hiding this comment

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

Looks good! Yep, I agree with the motivation behind the PR.

@siriwatknp siriwatknp merged commit c88abfd into mui:master Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: joy-ui Specific to @mui/joy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants