forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Joy] Miscellaneous fixes and docs improvement (mui#37026)
- Loading branch information
1 parent
7f34732
commit 16e4475
Showing
22 changed files
with
330 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as React from 'react'; | ||
import AspectRatio from '@mui/joy/AspectRatio'; | ||
import Stack from '@mui/joy/Stack'; | ||
import Favorite from '@mui/icons-material/Favorite'; | ||
|
||
export default function IconWrapper() { | ||
return ( | ||
<Stack direction="row" spacing={2}> | ||
<AspectRatio ratio="1" variant="solid" color="primary" sx={{ minWidth: 40 }}> | ||
{/* an extra div is required to make the icon center */} | ||
<div> | ||
<Favorite /> | ||
</div> | ||
</AspectRatio> | ||
<AspectRatio | ||
ratio="1" | ||
variant="outlined" | ||
color="success" | ||
sx={{ minWidth: 40, borderRadius: 'sm' }} | ||
> | ||
<div> | ||
<Favorite /> | ||
</div> | ||
</AspectRatio> | ||
<AspectRatio | ||
ratio="1" | ||
variant="soft" | ||
color="danger" | ||
sx={{ minWidth: 40, borderRadius: '50%' }} | ||
> | ||
<div> | ||
<Favorite /> | ||
</div> | ||
</AspectRatio> | ||
</Stack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as React from 'react'; | ||
import AspectRatio from '@mui/joy/AspectRatio'; | ||
import Stack from '@mui/joy/Stack'; | ||
import Favorite from '@mui/icons-material/Favorite'; | ||
|
||
export default function IconWrapper() { | ||
return ( | ||
<Stack direction="row" spacing={2}> | ||
<AspectRatio ratio="1" variant="solid" color="primary" sx={{ minWidth: 40 }}> | ||
{/* an extra div is required to make the icon center */} | ||
<div> | ||
<Favorite /> | ||
</div> | ||
</AspectRatio> | ||
<AspectRatio | ||
ratio="1" | ||
variant="outlined" | ||
color="success" | ||
sx={{ minWidth: 40, borderRadius: 'sm' }} | ||
> | ||
<div> | ||
<Favorite /> | ||
</div> | ||
</AspectRatio> | ||
<AspectRatio | ||
ratio="1" | ||
variant="soft" | ||
color="danger" | ||
sx={{ minWidth: 40, borderRadius: '50%' }} | ||
> | ||
<div> | ||
<Favorite /> | ||
</div> | ||
</AspectRatio> | ||
</Stack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import * as React from 'react'; | ||
import Stack from '@mui/joy/Stack'; | ||
import Select from '@mui/joy/Select'; | ||
import Option from '@mui/joy/Option'; | ||
import Button from '@mui/joy/Button'; | ||
|
||
export default function ControlledOpenSelect() { | ||
const [age, setAge] = React.useState(''); | ||
const [open, setOpen] = React.useState(false); | ||
const skipRef = React.useRef(false); | ||
|
||
const handleChange = (event, newValue) => { | ||
setAge(newValue); | ||
}; | ||
|
||
return ( | ||
<Stack spacing={2} useFlexGap> | ||
<Button | ||
variant="soft" | ||
onMouseDown={() => { | ||
skipRef.current = true; | ||
}} | ||
onClick={() => { | ||
skipRef.current = false; | ||
setOpen((bool) => !bool); | ||
}} | ||
> | ||
Open the select | ||
</Button> | ||
<div> | ||
<Select | ||
listboxOpen={open} | ||
onListboxOpenChange={(isOpen) => { | ||
if (!skipRef.current) { | ||
setOpen(isOpen); | ||
} | ||
}} | ||
value={age} | ||
onChange={handleChange} | ||
> | ||
<Option value=""> | ||
<em>None</em> | ||
</Option> | ||
<Option value={10}>Ten</Option> | ||
<Option value={20}>Twenty</Option> | ||
<Option value={30}>Thirty</Option> | ||
</Select> | ||
</div> | ||
</Stack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import * as React from 'react'; | ||
import Stack from '@mui/joy/Stack'; | ||
import Select from '@mui/joy/Select'; | ||
import Option from '@mui/joy/Option'; | ||
import Button from '@mui/joy/Button'; | ||
|
||
export default function ControlledOpenSelect() { | ||
const [age, setAge] = React.useState(''); | ||
const [open, setOpen] = React.useState(false); | ||
const skipRef = React.useRef(false); | ||
|
||
const handleChange = ( | ||
event: React.SyntheticEvent | null, | ||
newValue: string | null, | ||
) => { | ||
setAge(newValue!); | ||
}; | ||
|
||
return ( | ||
<Stack spacing={2} useFlexGap> | ||
<Button | ||
variant="soft" | ||
onMouseDown={() => { | ||
skipRef.current = true; | ||
}} | ||
onClick={() => { | ||
skipRef.current = false; | ||
setOpen((bool) => !bool); | ||
}} | ||
> | ||
Open the select | ||
</Button> | ||
<div> | ||
<Select | ||
listboxOpen={open} | ||
onListboxOpenChange={(isOpen) => { | ||
if (!skipRef.current) { | ||
setOpen(isOpen); | ||
} | ||
}} | ||
value={age} | ||
onChange={handleChange} | ||
> | ||
<Option value=""> | ||
<em>None</em> | ||
</Option> | ||
<Option value={10}>Ten</Option> | ||
<Option value={20}>Twenty</Option> | ||
<Option value={30}>Thirty</Option> | ||
</Select> | ||
</div> | ||
</Stack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.