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] Miscellaneous fixes #31873

Merged
merged 39 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1fefa61
fix `name` & `type` props for TextField
siriwatknp Mar 18, 2022
fd07c2b
add components, componentsProps to Checkbox
siriwatknp Mar 18, 2022
5d3c338
add flexshrink 0 to Checkbox
siriwatknp Mar 18, 2022
1e175bc
fix list item decorator color
siriwatknp Mar 18, 2022
942fe24
remove unnecessary minheight variable from Button
siriwatknp Mar 18, 2022
cd229e0
fix list background
siriwatknp Mar 18, 2022
5de104b
mark nestedInsetStart as 0p
siriwatknp Mar 18, 2022
2662b3e
fix list experiment page
siriwatknp Mar 18, 2022
de9dbea
add font to Avatar
siriwatknp Mar 18, 2022
94b94bb
adjust fallback size Avatar
siriwatknp Mar 18, 2022
b5902ba
export JoyThemeInput
siriwatknp Mar 18, 2022
588fb9c
add missing IconButton components type
siriwatknp Mar 18, 2022
90185f5
fix font to not use typography by default
siriwatknp Mar 18, 2022
1751e69
fix Link to not inherit from Typography
siriwatknp Mar 18, 2022
ed12072
make Typography & Link works well together
siriwatknp Mar 18, 2022
f849c13
fix disabled link
siriwatknp Mar 18, 2022
0192054
add border radius xs
siriwatknp Mar 18, 2022
05a3883
fix link experiment page
siriwatknp Mar 18, 2022
6504a35
move cursor into condition
siriwatknp Mar 18, 2022
03613b0
accept button iconColor variable
siriwatknp Mar 18, 2022
bf53cf3
fix styleOverrides slot
siriwatknp Mar 18, 2022
3b19b91
ignore level proptypes on link
siriwatknp Mar 18, 2022
ebeede2
run proptypes
siriwatknp Mar 18, 2022
70b094d
add --Icon-color to SvgIcon
siriwatknp Mar 19, 2022
2affd92
fix Typography tests
siriwatknp Mar 19, 2022
754e02a
fix icon inside Link and Typography
siriwatknp Mar 19, 2022
54d7725
improve margin for link and typography
siriwatknp Mar 19, 2022
9e5a0d7
run proptypes
siriwatknp Mar 19, 2022
9a50cce
fix font
siriwatknp Mar 21, 2022
b754366
make ListItemButton accpept custom role
siriwatknp Mar 21, 2022
536c83c
change List-background to List-item-stickyBackground
siriwatknp Mar 21, 2022
2bb6a68
ignore role proptype
siriwatknp Mar 21, 2022
6e19f04
rename to start,endDecorator
siriwatknp Mar 21, 2022
4659ad5
use start/endDecorator in Input & TextField
siriwatknp Mar 21, 2022
fe47257
fix demos and variable name
siriwatknp Mar 21, 2022
b626294
add link & typography examples
siriwatknp Mar 22, 2022
d638c17
change to object style
siriwatknp Mar 22, 2022
fc67b4a
Merge branch 'master' into joy/misc-fixes
siriwatknp Mar 23, 2022
a4d5684
fix typo
siriwatknp Mar 23, 2022
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
10 changes: 10 additions & 0 deletions docs/pages/experiments/joy/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import DeleteForever from '@mui/icons-material/DeleteForeverOutlined';
import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRight';
import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown';
import ThumbUp from '@mui/icons-material/ThumbUp';
import ArrowDropDown from '@mui/icons-material/ArrowDropDown';

const ColorSchemePicker = () => {
const { mode, setMode } = useColorScheme();
Expand Down Expand Up @@ -137,6 +138,15 @@ export default function JoyButton() {
<Button variant="outlined" endIcon={<KeyboardArrowRight />} color="success">
Checkout
</Button>
<Button
size="sm"
variant="outlined"
color="neutral"
endIcon={<ArrowDropDown />}
sx={{ '--Icon-color': (theme) => theme.vars.palette.primary[500] }}
>
10
</Button>
</Box>
</Box>
{/* Danilo's not smart iteration below 😅 - wanted to see each color with every variant. */}
Expand Down
11 changes: 3 additions & 8 deletions docs/pages/experiments/joy/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const ColorSchemePicker = () => {
}

return (
<Button
<IconButton
variant="outlined"
onClick={() => {
if (mode === 'light') {
Expand All @@ -53,13 +53,9 @@ const ColorSchemePicker = () => {
setMode('light');
}
}}
sx={{
p: '0.25rem',
width: 'var(--Button-minHeight)',
}}
>
{mode === 'light' ? <Moon /> : <Sun />}
</Button>
</IconButton>
);
};

Expand Down Expand Up @@ -124,7 +120,6 @@ const components: {
</React.Fragment>
),
cssVars: [
{ id: '--Button-minHeight', type: 'number', unit: 'px', defaultValue: 40 },
{ id: '--Button-gutter', type: 'number', unit: 'px', defaultValue: 24 },
{ id: '--Button-iconOffsetStep', type: 'number', defaultValue: 2 },
{ id: '--Button-gap', type: 'number', unit: 'px' },
Expand Down Expand Up @@ -274,7 +269,7 @@ const components: {
{ id: '--List-item-fontSize', type: 'number', unit: 'px', defaultValue: 16 },
{ id: '--List-decorator-width', type: 'number', unit: 'px', defaultValue: 40 },
{ id: '--List-divider-gap', type: 'number', unit: 'px', defaultValue: 0 },
{ id: '--List-nestedInsetStart', type: 'number', unit: 'px', defaultValue: 12 },
{ id: '--List-nestedInsetStart', type: 'number', unit: 'px', defaultValue: 0 },
{ id: '--List-item-radius', type: 'number', unit: 'px' },
],
},
Expand Down
70 changes: 54 additions & 16 deletions docs/pages/experiments/joy/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ import * as React from 'react';
import Moon from '@mui/icons-material/DarkMode';
import Sun from '@mui/icons-material/LightMode';
import Box from '@mui/joy/Box';
import Button from '@mui/joy/Button';
import IconButton from '@mui/joy/IconButton';
import Link from '@mui/joy/Link';
import { CssVarsProvider, useColorScheme } from '@mui/joy/styles';
import Typography from '@mui/joy/Typography';
import LocationOn from '@mui/icons-material/LocationOn';
import Groups from '@mui/icons-material/Groups';
import OpenInNew from '@mui/icons-material/OpenInNew';
import Person from '@mui/icons-material/Person';
import Settings from '@mui/icons-material/Settings';
import Logout from '@mui/icons-material/Logout';

const ColorSchemePicker = () => {
const { mode, setMode } = useColorScheme();
Expand All @@ -21,7 +25,7 @@ const ColorSchemePicker = () => {
}

return (
<Button
<IconButton
variant="outlined"
onClick={() => {
if (mode === 'light') {
Expand All @@ -30,10 +34,9 @@ const ColorSchemePicker = () => {
setMode('light');
}
}}
sx={{ '--Button-gutter': '0.25rem', minWidth: 'var(--Button-minHeight)' }}
>
{mode === 'light' ? <Moon /> : <Sun />}
</Button>
</IconButton>
);
};

Expand Down Expand Up @@ -63,29 +66,64 @@ export default function JoyButton() {
}}
>
<Box>
<Link component="button" level="body2">
<LocationOn sx={{ mr: '0.25em' }} /> Miami, Florida
<Link component="button" level="body2" startIcon={<LocationOn />}>
Miami, Florida
</Link>
<Link component="button" level="body2">
<Groups fontSize="lg" sx={{ mr: '0.25em' }} /> 5 - 10 people
<Link component="button" level="body2" startIcon={<Groups fontSize="lg" />}>
5 - 10 people
</Link>
</Box>
<Box>
<Link component="button">
<LocationOn sx={{ mr: '0.25em' }} /> Miami, Florida
<Link component="button" startIcon={<LocationOn />}>
Miami, Florida
</Link>
<Link component="button">
<Groups fontSize="xl" sx={{ mr: '0.25em' }} /> 5 - 10 people
<Link component="button" startIcon={<Groups fontSize="xl" />}>
5 - 10 people
</Link>
</Box>
<Box>
<Link component="button" level="h5">
<LocationOn sx={{ mr: '0.25em' }} /> Miami, Florida
<Link component="button" level="h5" startIcon={<LocationOn />}>
Miami, Florida
</Link>
<Link component="button" level="h5">
<Groups fontSize="xl2" sx={{ mr: '0.25em' }} /> 5 - 10 people
<Link component="button" level="h5" startIcon={<Groups fontSize="xl2" />}>
5 - 10 people
</Link>
</Box>
<Box>
<Typography level="body2">
Keep me updated about the new features and upcoming improvements (by doing this you
accept the <Link endIcon={<OpenInNew />}>terms</Link> and the{' '}
<Link disabled startIcon={<OpenInNew />}>
privacy policy
</Link>
).
</Typography>
</Box>
<Box>
<span>
Keep me updated about the new features and upcoming improvements (by doing this you
accept the{' '}
<Link level="inherit" endIcon={<OpenInNew />}>
terms
</Link>{' '}
and the{' '}
<Link level="inherit" startIcon={<OpenInNew />}>
privacy policy
</Link>
).
</span>
</Box>
<ul>
<li>
<Link startIcon={<Person />}>Profile</Link>
</li>
<li>
<Link startIcon={<Settings />}>Settings</Link>
</li>
<li>
<Link startIcon={<Logout />}>Logout</Link>
</li>
</ul>
</Box>
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 5 }}>
{Object.entries(buttonProps).map(([propName, propValue]) => (
Expand Down
72 changes: 33 additions & 39 deletions docs/pages/experiments/joy/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import ListItemButton from '@mui/joy/ListItemButton';
import ListItemDecorator from '@mui/joy/ListItemDecorator';
import ListItemContent from '@mui/joy/ListItemContent';
import ListDivider from '@mui/joy/ListDivider';
import Sheet from '@mui/joy/Sheet';
import Typography from '@mui/joy/Typography';
import Moon from '@mui/icons-material/DarkMode';
import Sun from '@mui/icons-material/LightMode';
Expand Down Expand Up @@ -141,6 +142,7 @@ function CheckboxList() {
}
>
<ListItemButton
selected={selected}
color={selected ? 'success' : undefined}
role={undefined}
onClick={handleToggle(value)}
Expand Down Expand Up @@ -300,6 +302,7 @@ function MuiNav() {
}
return (
<List
size="sm"
sx={(theme) => ({
// Actually, this part should be inside the theme but put it here for specific instance.
...createCssVars(grey, 'palette-neutral'),
Expand Down Expand Up @@ -343,7 +346,6 @@ function MuiNav() {
'--List-item-paddingLeft': '2px',
'--List-item-paddingRight': '2px',
'--List-item-paddingY': '0px',
'--List-item-fontSize': theme.vars.fontSize.sm,
'--List-nestedInsetStart': '28px',
'--List-decorator-color': theme.vars.palette.primary.textColor,
})}
Expand All @@ -365,7 +367,7 @@ function MuiNav() {
})
}
>
<ListItemDecorator sx={{ color: 'primary.textColor' }}>
<ListItemDecorator>
<IconComponent fontSize="md" />
</ListItemDecorator>
<ListItemContent sx={{ color: 'text.primary' }}>
Expand Down Expand Up @@ -453,7 +455,6 @@ const Firebash = () => {
'--List-item-paddingRight': '24px',
'--List-item-radius': '0px',
'--List-item-fontSize': '14px',
'--List-nestedInsetStart': '0px',
'--List-divider-gap': '0px',
'--List-background': 'rgb(5, 30, 52)',
'--List-decorator-width': '36px',
Expand Down Expand Up @@ -598,7 +599,6 @@ const Gatsby = () => {
'--joy-palette-primary-textColor': '#d48cff',
},

'--List-nestedInsetStart': '0px',
'--List-radius': '0px',
'--List-padding': '0px',
'--List-insetStart': '32px',
Expand Down Expand Up @@ -854,13 +854,9 @@ export default function JoyList() {
</ListItemDecorator>
<div>
<Typography>Brunch this weekend?</Typography>
<Typography level="body2" sx={{ color: 'var(--joy-palette-text-primary)' }}>
<Typography level="body2" color="text.primary">
Ali Connors{' '}
<Typography
component="span"
level="inherit"
sx={{ color: 'var(--joy-palette-text-secondary)' }}
>
<Typography color="text.secondary">
{' '}
— I&apos;ll be in your neighborhood doing errands this…
</Typography>
Expand All @@ -882,13 +878,9 @@ export default function JoyList() {
</ListItemDecorator>
<div>
<Typography>Summer BBQ</Typography>
<Typography level="body2" sx={{ color: 'var(--joy-palette-text-primary)' }}>
<Typography level="body2" color="text.primary">
to Scott, Alex, Jennifer{' '}
<Typography
component="span"
level="inherit"
sx={{ color: 'var(--joy-palette-text-secondary)' }}
>
<Typography color="text.secondary">
{' '}
— Wish I could come, but I&apos;m out of town this…
</Typography>
Expand Down Expand Up @@ -1048,29 +1040,31 @@ export default function JoyList() {
</ListItem>
</List>

<List
sx={{
maxWidth: 360,
maxHeight: 300,
overflow: 'auto',
'& ul': { p: 0 },
'--List-padding': 0,
'--List-item-paddingX': '1rem',
}}
>
{[0, 1, 2, 3, 4].map((sectionId) => (
<li key={`section-${sectionId}`}>
<ul>
<ListItem sticky sx={{ pt: '1.5rem' }}>
<Typography level="body2">{`I'm sticky ${sectionId}`}</Typography>
</ListItem>
{[0, 1, 2].map((item) => (
<ListItem key={`item-${sectionId}-${item}`}>Item {item}</ListItem>
))}
</ul>
</li>
))}
</List>
<Sheet>
<List
sx={{
maxWidth: 360,
maxHeight: 300,
overflow: 'auto',
'& ul': { p: 0 },
'--List-padding': 0,
'--List-item-paddingX': '1rem',
}}
>
{[0, 1, 2, 3, 4].map((sectionId) => (
<li key={`section-${sectionId}`}>
<ul>
<ListItem sticky sx={{ pt: '1.5rem' }}>
<Typography level="body2">{`I'm sticky ${sectionId}`}</Typography>
</ListItem>
{[0, 1, 2].map((item) => (
<ListItem key={`item-${sectionId}-${item}`}>Item {item}</ListItem>
))}
</ul>
</li>
))}
</List>
</Sheet>

<Box>
<List size="sm">
Expand Down
Loading