Skip to content

Commit

Permalink
[joy-ui][design] Stray design tweaks to components (mui#38476)
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Zanivan Monteiro <[email protected]>
Co-authored-by: Siriwat K <[email protected]>
  • Loading branch information
2 people authored and mnajdova committed Sep 8, 2023
1 parent 581294f commit 8ea20fa
Show file tree
Hide file tree
Showing 20 changed files with 36 additions and 29 deletions.
2 changes: 1 addition & 1 deletion docs/data/joy/components/alert/AlertUsage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function AlertUsage() {
{
propName: 'variant',
knob: 'radio',
defaultValue: 'outlined',
defaultValue: 'soft',
options: ['plain', 'outlined', 'soft', 'solid'],
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/card/BasicCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import BookmarkAdd from '@mui/icons-material/BookmarkAddOutlined';

export default function BasicCard() {
return (
<Card variant="outlined" sx={{ width: 320 }}>
<Card sx={{ width: 320 }}>
<div>
<Typography level="title-lg">Yosemite National Park</Typography>
<Typography level="body-sm">April 24 to May 02, 2021</Typography>
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/card/BasicCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import BookmarkAdd from '@mui/icons-material/BookmarkAddOutlined';

export default function BasicCard() {
return (
<Card variant="outlined" sx={{ width: 320 }}>
<Card sx={{ width: 320 }}>
<div>
<Typography level="title-lg">Yosemite National Park</Typography>
<Typography level="body-sm">April 24 to May 02, 2021</Typography>
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/card/CardUsage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function CardUsage() {
{
propName: 'variant',
knob: 'radio',
defaultValue: 'plain',
defaultValue: 'outlined',
options: ['plain', 'outlined', 'soft', 'solid'],
},
{
Expand Down
6 changes: 3 additions & 3 deletions docs/data/joy/components/card/CardVariants.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ export default function CardVariants() {
gap: 2,
}}
>
<Card>
<Card variant="plain">
<CardContent>
<Typography level="title-md">Plain card (default)</Typography>
<Typography level="title-md">Plain card</Typography>
<Typography>Description of the card.</Typography>
</CardContent>
</Card>

<Card variant="outlined">
<CardContent>
<Typography level="title-md">Outlined card</Typography>
<Typography level="title-md">Outlined card (default)</Typography>
<Typography>Description of the card.</Typography>
</CardContent>
</Card>
Expand Down
6 changes: 3 additions & 3 deletions docs/data/joy/components/card/CardVariants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ export default function CardVariants() {
gap: 2,
}}
>
<Card>
<Card variant="plain">
<CardContent>
<Typography level="title-md">Plain card (default)</Typography>
<Typography level="title-md">Plain card</Typography>
<Typography>Description of the card.</Typography>
</CardContent>
</Card>

<Card variant="outlined">
<CardContent>
<Typography level="title-md">Outlined card</Typography>
<Typography level="title-md">Outlined card (default)</Typography>
<Typography>Description of the card.</Typography>
</CardContent>
</Card>
Expand Down
4 changes: 2 additions & 2 deletions docs/data/joy/components/card/DribbbleShot.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import CreateNewFolder from '@mui/icons-material/CreateNewFolder';
export default function DribbbleShot() {
return (
<Card
variant="plain"
sx={{
width: 300,
bgcolor: 'initial',
boxShadow: 'none',
'--Card-padding': '0px',
p: 0,
}}
>
<Box sx={{ position: 'relative' }}>
Expand Down
4 changes: 2 additions & 2 deletions docs/data/joy/components/card/DribbbleShot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import CreateNewFolder from '@mui/icons-material/CreateNewFolder';
export default function DribbbleShot() {
return (
<Card
variant="plain"
sx={{
width: 300,
bgcolor: 'initial',
boxShadow: 'none',
'--Card-padding': '0px',
p: 0,
}}
>
<Box sx={{ position: 'relative' }}>
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/card/card.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The demo below shows a typical Card that groups together Typography, Aspect Rati

### Variants

The Card component supports Joy UI's four [global variants](/joy-ui/main-features/global-variants/): `plain` (default), `outlined`, `soft`, and `solid`.
The Card component supports Joy UI's four [global variants](/joy-ui/main-features/global-variants/): `plain`, `outlined` (default), `soft`, and `solid`.

{{"demo": "CardVariants.js"}}

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/joy-ui/api/alert.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"name": "union",
"description": "'outlined'<br>&#124;&nbsp;'plain'<br>&#124;&nbsp;'soft'<br>&#124;&nbsp;'solid'<br>&#124;&nbsp;string"
},
"default": "'outlined'",
"default": "'soft'",
"additionalInfo": { "joy-variant": true }
}
},
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/joy-ui/api/card.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"name": "union",
"description": "'outlined'<br>&#124;&nbsp;'plain'<br>&#124;&nbsp;'soft'<br>&#124;&nbsp;'solid'<br>&#124;&nbsp;string"
},
"default": "'plain'",
"default": "'outlined'",
"additionalInfo": { "joy-variant": true }
}
},
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-joy/src/Alert/Alert.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ describe('<Alert />', () => {
it('soft by default', () => {
const { getByRole } = render(<Alert />);

expect(getByRole('alert')).to.have.class(classes.variantOutlined);
expect(getByRole('alert')).to.have.class(classes.variantSoft);
});

(['plain', 'soft', 'solid'] as const).forEach((variant) => {
(['plain', 'outlined', 'solid'] as const).forEach((variant) => {
it(`should render ${variant}`, () => {
const { getByRole } = render(<Alert variant={variant} />);

Expand Down
5 changes: 2 additions & 3 deletions packages/mui-joy/src/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ const AlertRoot = styled('div', {
alignItems: 'center',
padding: `var(--Alert-padding)`,
borderRadius: 'var(--Alert-radius)',
boxShadow: theme.vars.shadow.xs,
...theme.typography[`body-${({ sm: 'xs', md: 'sm', lg: 'md' } as const)[ownerState.size!]}`],
fontWeight: theme.vars.fontWeight.md,
...theme.variants[ownerState.variant!]?.[ownerState.color!],
Expand Down Expand Up @@ -128,7 +127,7 @@ const Alert = React.forwardRef(function Alert(inProps, ref) {
color: colorProp = 'neutral',
invertedColors = false,
role = 'alert',
variant = 'outlined',
variant = 'soft',
size = 'md',
startDecorator,
endDecorator,
Expand Down Expand Up @@ -277,7 +276,7 @@ Alert.propTypes /* remove-proptypes */ = {
]),
/**
* The [global variant](https://mui.com/joy-ui/main-features/global-variants/) to use.
* @default 'outlined'
* @default 'soft'
*/
variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['outlined', 'plain', 'soft', 'solid']),
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-joy/src/Alert/AlertProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export interface AlertTypeMap<P = {}, D extends React.ElementType = 'div'> {
sx?: SxProps;
/**
* The [global variant](https://mui.com/joy-ui/main-features/global-variants/) to use.
* @default 'outlined'
* @default 'soft'
*/
variant?: OverridableStringUnion<VariantProp, AlertPropsVariantOverrides>;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-joy/src/Card/Card.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ describe('<Card />', () => {
describeJoyColorInversion(<Card />, { muiName: 'JoyCard', classes });

describe('prop: variant', () => {
it('plain by default', () => {
it('outlined by default', () => {
const { getByTestId } = render(<Card data-testid="root">Hello World</Card>);

expect(getByTestId('root')).to.have.class(classes.variantPlain);
expect(getByTestId('root')).to.have.class(classes.variantOutlined);
});

(['plain', 'outlined', 'soft', 'solid'] as const).forEach((variant) => {
Expand Down
5 changes: 2 additions & 3 deletions packages/mui-joy/src/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ const CardRoot = styled('div', {
}),
padding: 'var(--Card-padding)',
borderRadius: 'var(--Card-radius)',
boxShadow: theme.shadow.sm,
backgroundColor: theme.vars.palette.background.surface,
position: 'relative',
display: 'flex',
Expand Down Expand Up @@ -120,7 +119,7 @@ const Card = React.forwardRef(function Card(inProps, ref) {
component = 'div',
invertedColors = false,
size = 'md',
variant = 'plain',
variant = 'outlined',
children,
orientation = 'vertical',
slots = {},
Expand Down Expand Up @@ -259,7 +258,7 @@ Card.propTypes /* remove-proptypes */ = {
]),
/**
* The [global variant](https://mui.com/joy-ui/main-features/global-variants/) to use.
* @default 'plain'
* @default 'outlined'
*/
variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['outlined', 'plain', 'soft', 'solid']),
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-joy/src/Card/CardProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface CardTypeMap<P = {}, D extends React.ElementType = 'div'> {
sx?: SxProps;
/**
* The [global variant](https://mui.com/joy-ui/main-features/global-variants/) to use.
* @default 'plain'
* @default 'outlined'
*/
variant?: OverridableStringUnion<VariantProp, CardPropsVariantOverrides>;
} & CardSlotsAndSlotProps;
Expand Down
3 changes: 3 additions & 0 deletions packages/mui-joy/src/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ export const StyledInputRoot = styled('div')<{ ownerState: InputOwnerState }>(
'--Button-radius': 'var(--Input-decoratorChildRadius)',
'--IconButton-radius': 'var(--Input-decoratorChildRadius)',
boxSizing: 'border-box',
...(ownerState.variant !== 'plain' && {
boxShadow: theme.shadow.xs,
}),
minWidth: 0,
minHeight: 'var(--Input-minHeight)',
...(ownerState.fullWidth && {
Expand Down
3 changes: 3 additions & 0 deletions packages/mui-joy/src/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ const SelectRoot = styled('div', {
'--Button-radius': 'var(--Select-decoratorChildRadius)',
'--IconButton-radius': 'var(--Select-decoratorChildRadius)',
boxSizing: 'border-box',
...(ownerState.variant !== 'plain' && {
boxShadow: theme.shadow.xs,
}),
minWidth: 0,
minHeight: 'var(--Select-minHeight)',
position: 'relative',
Expand Down
3 changes: 3 additions & 0 deletions packages/mui-joy/src/Textarea/Textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ const TextareaRoot = styled('div', {
'--Button-radius': 'var(--Textarea-decoratorChildRadius)',
'--IconButton-radius': 'var(--Textarea-decoratorChildRadius)',
boxSizing: 'border-box',
...(ownerState.variant !== 'plain' && {
boxShadow: theme.shadow.xs,
}),
minWidth: 0,
minHeight: 'var(--Textarea-minHeight)',
cursor: 'text',
Expand Down

0 comments on commit 8ea20fa

Please sign in to comment.