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 37 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
13 changes: 4 additions & 9 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 Expand Up @@ -332,7 +327,7 @@ const components: {
},
},
{ id: '--Input-focusedThickness', type: 'number', unit: 'px' },
{ id: '--Input-adornment-offset', type: 'number', unit: 'px' },
{ id: '--Input-decorator-offset', type: 'number', unit: 'px' },
],
},
{
Expand Down
20 changes: 10 additions & 10 deletions docs/pages/experiments/joy/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ export default function JoyTypography() {
}}
>
<Input placeholder="Placeholder" />
<Input placeholder="Placeholder" startAdornment={<Mail />} size="sm" />
<Input placeholder="Placeholder" startAdornment={<Mail />} />
<Input placeholder="Placeholder" startAdornment={<Mail />} size="lg" />
<Input placeholder="Placeholder" startDecorator={<Mail />} size="sm" />
<Input placeholder="Placeholder" startDecorator={<Mail />} />
<Input placeholder="Placeholder" startDecorator={<Mail />} size="lg" />
<Input
placeholder="Placeholder"
color="primary"
type="password"
startAdornment={<Key />}
endAdornment={
startDecorator={<Key />}
endDecorator={
<IconButton size="sm" sx={{ mr: '-6px' }}>
<Visibility />
</IconButton>
Expand All @@ -76,17 +76,17 @@ export default function JoyTypography() {
<Input
placeholder="Placeholder"
color="danger"
endAdornment={
endDecorator={
<Button color="danger" size="sm" sx={{ mr: '-6px' }}>
Delete
</Button>
}
/>
<Input placeholder="Placeholder" color="danger" endAdornment={<Info />} />
<Input placeholder="Placeholder" color="danger" endDecorator={<Info />} />
<Input
placeholder="Placeholder"
color="info"
endAdornment={
endDecorator={
<Button variant="light" size="sm" sx={{ mr: '-6px' }}>
Search
</Button>
Expand All @@ -96,7 +96,7 @@ export default function JoyTypography() {
<Input
placeholder="Placeholder"
color="success"
endAdornment={<Check />}
endDecorator={<Check />}
sx={{
minWidth: 0,
flex: 1,
Expand All @@ -114,7 +114,7 @@ export default function JoyTypography() {
<Input
placeholder="Placeholder"
color="warning"
startAdornment={<Typography sx={{ color: 'inherit' }}>$</Typography>}
startDecorator={<Typography sx={{ color: 'inherit' }}>$</Typography>}
/>
<Input placeholder="Placeholder" disabled />
<Input placeholder="Placeholder" disabled defaultValue="I am in disabled state" />
Expand Down
134 changes: 118 additions & 16 deletions docs/pages/experiments/joy/link.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,57 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import * as React from 'react';
import { keyframes } from '@mui/system';
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 circulate = keyframes({
'0%': {
transform: 'rotate(0deg)',
},
'100%': {
transform: 'rotate(360deg)',
},
});

const Loader = () => (
<Box
sx={{
borderRadius: '50%',
border: 4,
borderColor: 'primary.lightBg',
width: '1.25em',
height: '1.25em',
boxSizing: 'border-box',
position: 'relative',
}}
>
<Box
sx={{
position: 'absolute',
top: -4,
left: -4,
width: '1.25em',
height: '1.25em',
borderRadius: '50%',
border: '4px solid',
borderColor: (theme) => `${theme.vars.palette.primary.lightColor} transparent transparent`,
animation: `${circulate} 1s ease infinite`,
boxSizing: 'inherit',
}}
/>
</Box>
);

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

return (
<Button
<IconButton
variant="outlined"
onClick={() => {
if (mode === 'light') {
Expand All @@ -30,10 +73,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,27 +105,87 @@ export default function JoyButton() {
}}
>
<Box>
<Link component="button" level="body2">
<LocationOn sx={{ mr: '0.25em' }} /> Miami, Florida
<Link component="button" level="body2" startDecorator={<LocationOn />}>
Miami, Florida
</Link>
<Link component="button" level="body2" startDecorator={<Groups fontSize="lg" />}>
5 - 10 people
</Link>
</Box>
<Box>
<Link component="button" startDecorator={<LocationOn />}>
Miami, Florida
</Link>
<Link component="button" level="body2">
<Groups fontSize="lg" sx={{ mr: '0.25em' }} /> 5 - 10 people
<Link component="button" startDecorator={<Groups fontSize="xl" />}>
5 - 10 people
</Link>
</Box>
<Box>
<Link component="button">
<LocationOn sx={{ mr: '0.25em' }} /> Miami, Florida
<Link component="button" level="h5" startDecorator={<LocationOn />}>
Miami, Florida
</Link>
<Link component="button">
<Groups fontSize="xl" sx={{ mr: '0.25em' }} /> 5 - 10 people
<Link component="button" level="h5" startDecorator={<Groups fontSize="xl2" />}>
5 - 10 people
</Link>
</Box>
<Box>
<Link component="button" level="h5">
<LocationOn sx={{ mr: '0.25em' }} /> Miami, Florida
<Typography level="body2">
Keep me updated about the new features and upcoming improvements (by doing this you
accept the <Link endDecorator={<OpenInNew />}>terms</Link> and the{' '}
<Link disabled startDecorator={<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" endDecorator={<OpenInNew />}>
terms
</Link>{' '}
and the{' '}
<Link level="inherit" startDecorator={<OpenInNew />}>
privacy policy
</Link>
).
</span>
</Box>
<ul>
<li>
<Link startDecorator={<Person />}>Profile</Link>
</li>
<li>
<Link startDecorator={<Settings />}>Settings</Link>
</li>
<li>
<Link startDecorator={<Logout />}>Logout</Link>
</li>
</ul>
<Box sx={{ my: 2 }}>
<Link startDecorator={<Loader />} disabled sx={{ my: 2 }}>
Processing...
</Link>
<Link component="button" level="h5">
<Groups fontSize="xl2" sx={{ mr: '0.25em' }} /> 5 - 10 people
<Link
color="neutral"
endDecorator={
<Box
sx={{
px: 0.5,
py: 0.25,
fontSize: 'xs',
fontWeight: 'md',
bgcolor: 'danger.500',
color: '#fff',
borderRadius: 'xs',
}}
>
HIRING!
</Box>
}
>
Careers
</Link>
</Box>
</Box>
Expand Down
Loading