Skip to content

Commit

Permalink
Merge branch 'master' into fix-variant-mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeshanTamboli committed Sep 8, 2022
2 parents 37950b7 + 71a18fb commit 69e7498
Show file tree
Hide file tree
Showing 68 changed files with 3,281 additions and 498 deletions.
8 changes: 4 additions & 4 deletions docs/data/joy/components/list/ExampleCollapsibleList.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default function ExampleCollapsibleList() {
</IconButton>
}
>
<ListItemButton>
<ListItem>
<Typography
level="inherit"
sx={{
Expand All @@ -98,7 +98,7 @@ export default function ExampleCollapsibleList() {
<Typography component="span" level="body3" sx={{ ml: 1 }}>
9
</Typography>
</ListItemButton>
</ListItem>
{open && (
<List sx={{ '--List-item-paddingY': '8px' }}>
<ListItem>
Expand Down Expand Up @@ -136,7 +136,7 @@ export default function ExampleCollapsibleList() {
</IconButton>
}
>
<ListItemButton>
<ListItem>
<Typography
level="inherit"
sx={{
Expand All @@ -149,7 +149,7 @@ export default function ExampleCollapsibleList() {
<Typography component="span" level="body3" sx={{ ml: 1 }}>
39
</Typography>
</ListItemButton>
</ListItem>
{open2 && (
<List sx={{ '--List-item-paddingY': '8px' }}>
<ListItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Home from '@mui/icons-material/Home';
import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRight';
import JoyUsageDemo from 'docs/src/modules/components/JoyUsageDemo';

export default function VariantsColorsList() {
export default function ListUsage() {
return (
<JoyUsageDemo
componentName="ListItemButton"
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/list/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Joy UI provides four list-related components:
- [`ListItemContent`](#ellipsis-content): A container inside a list item, used to display text content.
- [`ListDivider`](#divider): A separator between list items.

{{"demo": "VariantsColorsList.js", "hideToolbar": true}}
{{"demo": "ListUsage.js", "hideToolbar": true}}

## Component

Expand Down
3 changes: 2 additions & 1 deletion docs/data/joy/components/menu/MenuListGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Typography from '@mui/joy/Typography';
export default function MenuListGroup() {
return (
<MenuList
component="div"
variant="outlined"
size="sm"
sx={{
Expand All @@ -19,7 +20,7 @@ export default function MenuListGroup() {
}}
>
{[...Array(5)].map((_, categoryIndex) => (
<List role="group" key={categoryIndex}>
<List key={categoryIndex}>
<ListItem sticky>
<Typography
id={`sticky-list-demo-${categoryIndex}`}
Expand Down
58 changes: 58 additions & 0 deletions docs/data/joy/components/modal/AlertDialogModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import * as React from 'react';
import Box from '@mui/joy/Box';
import Button from '@mui/joy/Button';
import Modal from '@mui/joy/Modal';
import ModalDialog from '@mui/joy/ModalDialog';
import DeleteForever from '@mui/icons-material/DeleteForever';
import WarningRoundedIcon from '@mui/icons-material/WarningRounded';
import Typography from '@mui/joy/Typography';

export default function AlertDialogModal() {
const [open, setOpen] = React.useState(false);
return (
<React.Fragment>
<Button
variant="outlined"
color="danger"
endIcon={<DeleteForever />}
onClick={() => setOpen(true)}
>
Discard
</Button>
<Modal
aria-labelledby="alert-dialog-modal-title"
aria-describedby="alert-dialog-modal-description"
open={open}
onClose={() => setOpen(false)}
>
<ModalDialog variant="outlined" role="alertdialog">
<Typography
id="alert-dialog-modal-title"
component="h2"
level="inherit"
fontSize="1.25em"
mb="0.25em"
startDecorator={<WarningRoundedIcon />}
>
Confirmation
</Typography>
<Typography
id="alert-dialog-modal-description"
textColor="text.tertiary"
mb={3}
>
Are you sure you want to discard all of your notes?
</Typography>
<Box sx={{ display: 'flex', gap: 1, justifyContent: 'flex-end' }}>
<Button variant="plain" color="neutral" onClick={() => setOpen(false)}>
Cancel
</Button>
<Button variant="solid" color="danger" onClick={() => setOpen(false)}>
Discard notes
</Button>
</Box>
</ModalDialog>
</Modal>
</React.Fragment>
);
}
59 changes: 59 additions & 0 deletions docs/data/joy/components/modal/BasicModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import * as React from 'react';
import Button from '@mui/joy/Button';
import Modal from '@mui/joy/Modal';
import ModalClose from '@mui/joy/ModalClose';
import Typography from '@mui/joy/Typography';
import Sheet from '@mui/joy/Sheet';

export default function BasicModal() {
const [open, setOpen] = React.useState(false);
return (
<React.Fragment>
<Button variant="outlined" color="neutral" onClick={() => setOpen(true)}>
Open modal
</Button>
<Modal
aria-labelledby="modal-title"
aria-describedby="modal-desc"
open={open}
onClose={() => setOpen(false)}
sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}
>
<Sheet
variant="outlined"
sx={{
maxWidth: 500,
borderRadius: 'md',
p: 3,
boxShadow: 'lg',
}}
>
<ModalClose
variant="outlined"
sx={{
top: 'calc(-1/4 * var(--IconButton-size))',
right: 'calc(-1/4 * var(--IconButton-size))',
boxShadow: '0 2px 12px 0 rgba(0 0 0 / 0.2)',
borderRadius: '50%',
bgcolor: 'background.body',
}}
/>
<Typography
component="h2"
id="modal-title"
level="h4"
textColor="inherit"
fontWeight="lg"
mb={1}
>
This is the modal title
</Typography>
<Typography id="modal-desc" textColor="text.tertiary">
Make sure to use <code>aria-labelledby</code> on the modal dialog with an
optional <code>aria-describedby</code> attribute.
</Typography>
</Sheet>
</Modal>
</React.Fragment>
);
}
66 changes: 66 additions & 0 deletions docs/data/joy/components/modal/BasicModalDialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import * as React from 'react';
import Button from '@mui/joy/Button';
import TextField from '@mui/joy/TextField';
import Modal from '@mui/joy/Modal';
import ModalDialog from '@mui/joy/ModalDialog';
import Stack from '@mui/joy/Stack';
import Add from '@mui/icons-material/Add';
import Typography from '@mui/joy/Typography';

export default function BasicModalDialog() {
const [open, setOpen] = React.useState(false);
return (
<React.Fragment>
<Button
variant="outlined"
color="neutral"
startIcon={<Add />}
onClick={() => setOpen(true)}
>
New project
</Button>
<Modal open={open} onClose={() => setOpen(false)}>
<ModalDialog
aria-labelledby="basic-modal-dialog-title"
aria-describedby="basic-modal-dialog-description"
sx={{
maxWidth: 500,
borderRadius: 'md',
p: 3,
boxShadow: 'lg',
}}
>
<Typography
id="basic-modal-dialog-title"
component="h2"
level="inherit"
fontSize="1.25em"
mb="0.25em"
>
Create new project
</Typography>
<Typography
id="basic-modal-dialog-description"
mt={0.5}
mb={2}
textColor="text.tertiary"
>
Fill in the information of the project.
</Typography>
<form
onSubmit={(event) => {
event.preventDefault();
setOpen(false);
}}
>
<Stack spacing={2}>
<TextField label="Name" autoFocus required />
<TextField label="Description" required />
<Button type="submit">Submit</Button>
</Stack>
</form>
</ModalDialog>
</Modal>
</React.Fragment>
);
}
50 changes: 50 additions & 0 deletions docs/data/joy/components/modal/CloseModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import * as React from 'react';
import Button from '@mui/joy/Button';
import Modal from '@mui/joy/Modal';
import ModalClose from '@mui/joy/ModalClose';
import Typography from '@mui/joy/Typography';
import Sheet from '@mui/joy/Sheet';

export default function CloseModal() {
const [open, setOpen] = React.useState(false);
return (
<React.Fragment>
<Button variant="outlined" color="neutral" onClick={() => setOpen(true)}>
Open modal
</Button>
<Modal
aria-labelledby="close-modal-title"
open={open}
onClose={(event, reason) => {
alert(`Reason: ${reason}`);
setOpen(false);
}}
sx={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<Sheet
variant="outlined"
sx={{
minWidth: 300,
borderRadius: 'md',
p: 3,
}}
>
<ModalClose variant="outlined" />
<Typography
component="h2"
id="close-modal-title"
level="h4"
textColor="inherit"
fontWeight="lg"
>
Modal title
</Typography>
</Sheet>
</Modal>
</React.Fragment>
);
}
71 changes: 71 additions & 0 deletions docs/data/joy/components/modal/FadeModalDialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import * as React from 'react';
import { Transition } from 'react-transition-group';
import Button from '@mui/joy/Button';
import Modal from '@mui/joy/Modal';
import ModalDialog from '@mui/joy/ModalDialog';
import Typography from '@mui/joy/Typography';

export default function FadeModalDialog() {
const [open, setOpen] = React.useState(false);
return (
<React.Fragment>
<Button variant="outlined" color="neutral" onClick={() => setOpen(true)}>
Open modal
</Button>
<Transition in={open} timeout={400}>
{(state) => (
<Modal
keepMounted
open={!['exited', 'exiting'].includes(state)}
onClose={() => setOpen(false)}
componentsProps={{
backdrop: {
sx: {
opacity: 0,
backdropFilter: 'none',
transition: `opacity 400ms, backdrop-filter 400ms`,
...{
entering: { opacity: 1, backdropFilter: 'blur(8px)' },
entered: { opacity: 1, backdropFilter: 'blur(8px)' },
}[state],
},
},
}}
sx={{
visibility: state === 'exited' ? 'hidden' : 'visible',
}}
>
<ModalDialog
aria-labelledby="fade-modal-dialog-title"
aria-describedby="fade-modal-dialog-description"
sx={{
opacity: 0,
transition: `opacity 300ms`,
...{
entering: { opacity: 1 },
entered: { opacity: 1 },
}[state],
}}
>
<Typography
id="fade-modal-dialog-title"
component="h2"
level="inherit"
fontSize="1.25em"
mb="0.25em"
>
Transition modal
</Typography>
<Typography
id="fade-modal-dialog-description"
textColor="text.tertiary"
>
Using `react-transition-group` to create a fade animation.
</Typography>
</ModalDialog>
</Modal>
)}
</Transition>
</React.Fragment>
);
}
Loading

0 comments on commit 69e7498

Please sign in to comment.