index
int64
0
0
repo_id
stringlengths
16
181
file_path
stringlengths
28
270
content
stringlengths
1
11.6M
__index_level_0__
int64
0
10k
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/order-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/order-dashboard/components/OrderList.tsx
/* eslint-disable jsx-a11y/anchor-is-valid */ import * as React from 'react'; import { ColorPaletteProp } from '@mui/joy/styles'; import Box from '@mui/joy/Box'; import Avatar from '@mui/joy/Avatar'; import Chip from '@mui/joy/Chip'; import Link from '@mui/joy/Link'; import Divider from '@mui/joy/Divider'; import IconButton from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemContent from '@mui/joy/ListItemContent'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListDivider from '@mui/joy/ListDivider'; import Menu from '@mui/joy/Menu'; import MenuButton from '@mui/joy/MenuButton'; import MenuItem from '@mui/joy/MenuItem'; import Dropdown from '@mui/joy/Dropdown'; // icons import MoreHorizRoundedIcon from '@mui/icons-material/MoreHorizRounded'; import CheckRoundedIcon from '@mui/icons-material/CheckRounded'; import BlockIcon from '@mui/icons-material/Block'; import AutorenewRoundedIcon from '@mui/icons-material/AutorenewRounded'; import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; import KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft'; const listItems = [ { id: 'INV-1234', date: 'Feb 3, 2023', status: 'Refunded', customer: { initial: 'O', name: 'Olivia Ryhe', email: '[email protected]', }, }, { id: 'INV-1233', date: 'Feb 3, 2023', status: 'Paid', customer: { initial: 'S', name: 'Steve Hampton', email: '[email protected]', }, }, { id: 'INV-1232', date: 'Feb 3, 2023', status: 'Refunded', customer: { initial: 'C', name: 'Ciaran Murray', email: '[email protected]', }, }, { id: 'INV-1231', date: 'Feb 3, 2023', status: 'Refunded', customer: { initial: 'M', name: 'Maria Macdonald', email: '[email protected]', }, }, { id: 'INV-1230', date: 'Feb 3, 2023', status: 'Cancelled', customer: { initial: 'C', name: 'Charles Fulton', email: '[email protected]', }, }, { id: 'INV-1229', date: 'Feb 3, 2023', status: 'Cancelled', customer: { initial: 'J', name: 'Jay Hooper', email: '[email protected]', }, }, ]; function RowMenu() { return ( <Dropdown> <MenuButton slots={{ root: IconButton }} slotProps={{ root: { variant: 'plain', color: 'neutral', size: 'sm' } }} > <MoreHorizRoundedIcon /> </MenuButton> <Menu size="sm" sx={{ minWidth: 140 }}> <MenuItem>Edit</MenuItem> <MenuItem>Rename</MenuItem> <MenuItem>Move</MenuItem> <Divider /> <MenuItem color="danger">Delete</MenuItem> </Menu> </Dropdown> ); } export default function OrderList() { return ( <Box sx={{ display: { xs: 'block', sm: 'none' } }}> {listItems.map((listItem) => ( <List key={listItem.id} size="sm" sx={{ '--ListItem-paddingX': 0, }} > <ListItem sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'start', }} > <ListItemContent sx={{ display: 'flex', gap: 2, alignItems: 'start' }}> <ListItemDecorator> <Avatar size="sm">{listItem.customer.initial}</Avatar> </ListItemDecorator> <div> <Typography fontWeight={600} gutterBottom> {listItem.customer.name} </Typography> <Typography level="body-xs" gutterBottom> {listItem.customer.email} </Typography> <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 0.5, mb: 1, }} > <Typography level="body-xs">{listItem.date}</Typography> <Typography level="body-xs">&bull;</Typography> <Typography level="body-xs">{listItem.id}</Typography> </Box> <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 1 }}> <Link level="body-sm" component="button"> Download </Link> <RowMenu /> </Box> </div> </ListItemContent> <Chip variant="soft" size="sm" startDecorator={ { Paid: <CheckRoundedIcon />, Refunded: <AutorenewRoundedIcon />, Cancelled: <BlockIcon />, }[listItem.status] } color={ { Paid: 'success', Refunded: 'neutral', Cancelled: 'danger', }[listItem.status] as ColorPaletteProp } > {listItem.status} </Chip> </ListItem> <ListDivider /> </List> ))} <Box className="Pagination-mobile" sx={{ display: { xs: 'flex', md: 'none' }, alignItems: 'center', py: 2 }} > <IconButton aria-label="previous page" variant="outlined" color="neutral" size="sm" > <KeyboardArrowLeftIcon /> </IconButton> <Typography level="body-sm" mx="auto"> Page 1 of 10 </Typography> <IconButton aria-label="next page" variant="outlined" color="neutral" size="sm" > <KeyboardArrowRightIcon /> </IconButton> </Box> </Box> ); }
1,900
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/order-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/order-dashboard/components/OrderTable.tsx
/* eslint-disable jsx-a11y/anchor-is-valid */ import * as React from 'react'; import { ColorPaletteProp } from '@mui/joy/styles'; import Avatar from '@mui/joy/Avatar'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Chip from '@mui/joy/Chip'; import Divider from '@mui/joy/Divider'; import FormControl from '@mui/joy/FormControl'; import FormLabel from '@mui/joy/FormLabel'; import Link from '@mui/joy/Link'; import Input from '@mui/joy/Input'; import Modal from '@mui/joy/Modal'; import ModalDialog from '@mui/joy/ModalDialog'; import ModalClose from '@mui/joy/ModalClose'; import Select from '@mui/joy/Select'; import Option from '@mui/joy/Option'; import Table from '@mui/joy/Table'; import Sheet from '@mui/joy/Sheet'; import Checkbox from '@mui/joy/Checkbox'; import IconButton, { iconButtonClasses } from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; import Menu from '@mui/joy/Menu'; import MenuButton from '@mui/joy/MenuButton'; import MenuItem from '@mui/joy/MenuItem'; import Dropdown from '@mui/joy/Dropdown'; // icons import FilterAltIcon from '@mui/icons-material/FilterAlt'; import SearchIcon from '@mui/icons-material/Search'; import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'; import CheckRoundedIcon from '@mui/icons-material/CheckRounded'; import BlockIcon from '@mui/icons-material/Block'; import AutorenewRoundedIcon from '@mui/icons-material/AutorenewRounded'; import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; import KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft'; import MoreHorizRoundedIcon from '@mui/icons-material/MoreHorizRounded'; const rows = [ { id: 'INV-1234', date: 'Feb 3, 2023', status: 'Refunded', customer: { initial: 'O', name: 'Olivia Ryhe', email: '[email protected]', }, }, { id: 'INV-1233', date: 'Feb 3, 2023', status: 'Paid', customer: { initial: 'S', name: 'Steve Hampton', email: '[email protected]', }, }, { id: 'INV-1232', date: 'Feb 3, 2023', status: 'Refunded', customer: { initial: 'C', name: 'Ciaran Murray', email: '[email protected]', }, }, { id: 'INV-1231', date: 'Feb 3, 2023', status: 'Refunded', customer: { initial: 'M', name: 'Maria Macdonald', email: '[email protected]', }, }, { id: 'INV-1230', date: 'Feb 3, 2023', status: 'Cancelled', customer: { initial: 'C', name: 'Charles Fulton', email: '[email protected]', }, }, { id: 'INV-1229', date: 'Feb 3, 2023', status: 'Cancelled', customer: { initial: 'J', name: 'Jay Hooper', email: '[email protected]', }, }, { id: 'INV-1228', date: 'Feb 3, 2023', status: 'Refunded', customer: { initial: 'K', name: 'Krystal Stevens', email: '[email protected]', }, }, { id: 'INV-1227', date: 'Feb 3, 2023', status: 'Paid', customer: { initial: 'S', name: 'Sachin Flynn', email: '[email protected]', }, }, { id: 'INV-1226', date: 'Feb 3, 2023', status: 'Cancelled', customer: { initial: 'B', name: 'Bradley Rosales', email: '[email protected]', }, }, { id: 'INV-1234', date: 'Feb 3, 2023', status: 'Paid', customer: { initial: 'O', name: 'Olivia Ryhe', email: '[email protected]', }, }, { id: 'INV-1233', date: 'Feb 3, 2023', status: 'Cancelled', customer: { initial: 'S', name: 'Steve Hampton', email: '[email protected]', }, }, { id: 'INV-1232', date: 'Feb 3, 2023', status: 'Paid', customer: { initial: 'C', name: 'Ciaran Murray', email: '[email protected]', }, }, { id: 'INV-1231', date: 'Feb 3, 2023', status: 'Refunded', customer: { initial: 'M', name: 'Maria Macdonald', email: '[email protected]', }, }, { id: 'INV-1230', date: 'Feb 3, 2023', status: 'Paid', customer: { initial: 'C', name: 'Charles Fulton', email: '[email protected]', }, }, { id: 'INV-1229', date: 'Feb 3, 2023', status: 'Cancelled', customer: { initial: 'J', name: 'Jay Hooper', email: '[email protected]', }, }, { id: 'INV-1228', date: 'Feb 3, 2023', status: 'Cancelled', customer: { initial: 'K', name: 'Krystal Stevens', email: '[email protected]', }, }, { id: 'INV-1227', date: 'Feb 3, 2023', status: 'Paid', customer: { initial: 'S', name: 'Sachin Flynn', email: '[email protected]', }, }, { id: 'INV-1226', date: 'Feb 3, 2023', status: 'Cancelled', customer: { initial: 'B', name: 'Bradley Rosales', email: '[email protected]', }, }, ]; function descendingComparator<T>(a: T, b: T, orderBy: keyof T) { if (b[orderBy] < a[orderBy]) { return -1; } if (b[orderBy] > a[orderBy]) { return 1; } return 0; } type Order = 'asc' | 'desc'; function getComparator<Key extends keyof any>( order: Order, orderBy: Key, ): ( a: { [key in Key]: number | string }, b: { [key in Key]: number | string }, ) => number { return order === 'desc' ? (a, b) => descendingComparator(a, b, orderBy) : (a, b) => -descendingComparator(a, b, orderBy); } // Since 2020 all major browsers ensure sort stability with Array.prototype.sort(). // stableSort() brings sort stability to non-modern browsers (notably IE11). If you // only support modern browsers you can replace stableSort(exampleArray, exampleComparator) // with exampleArray.slice().sort(exampleComparator) function stableSort<T>(array: readonly T[], comparator: (a: T, b: T) => number) { const stabilizedThis = array.map((el, index) => [el, index] as [T, number]); stabilizedThis.sort((a, b) => { const order = comparator(a[0], b[0]); if (order !== 0) { return order; } return a[1] - b[1]; }); return stabilizedThis.map((el) => el[0]); } function RowMenu() { return ( <Dropdown> <MenuButton slots={{ root: IconButton }} slotProps={{ root: { variant: 'plain', color: 'neutral', size: 'sm' } }} > <MoreHorizRoundedIcon /> </MenuButton> <Menu size="sm" sx={{ minWidth: 140 }}> <MenuItem>Edit</MenuItem> <MenuItem>Rename</MenuItem> <MenuItem>Move</MenuItem> <Divider /> <MenuItem color="danger">Delete</MenuItem> </Menu> </Dropdown> ); } export default function OrderTable() { const [order, setOrder] = React.useState<Order>('desc'); const [selected, setSelected] = React.useState<readonly string[]>([]); const [open, setOpen] = React.useState(false); const renderFilters = () => ( <React.Fragment> <FormControl size="sm"> <FormLabel>Status</FormLabel> <Select size="sm" placeholder="Filter by status" slotProps={{ button: { sx: { whiteSpace: 'nowrap' } } }} > <Option value="paid">Paid</Option> <Option value="pending">Pending</Option> <Option value="refunded">Refunded</Option> <Option value="cancelled">Cancelled</Option> </Select> </FormControl> <FormControl size="sm"> <FormLabel>Category</FormLabel> <Select size="sm" placeholder="All"> <Option value="all">All</Option> <Option value="refund">Refund</Option> <Option value="purchase">Purchase</Option> <Option value="debit">Debit</Option> </Select> </FormControl> <FormControl size="sm"> <FormLabel>Customer</FormLabel> <Select size="sm" placeholder="All"> <Option value="all">All</Option> <Option value="olivia">Olivia Rhye</Option> <Option value="steve">Steve Hampton</Option> <Option value="ciaran">Ciaran Murray</Option> <Option value="marina">Marina Macdonald</Option> <Option value="charles">Charles Fulton</Option> <Option value="jay">Jay Hoper</Option> </Select> </FormControl> </React.Fragment> ); return ( <React.Fragment> <Sheet className="SearchAndFilters-mobile" sx={{ display: { xs: 'flex', sm: 'none', }, my: 1, gap: 1, }} > <Input size="sm" placeholder="Search" startDecorator={<SearchIcon />} sx={{ flexGrow: 1 }} /> <IconButton size="sm" variant="outlined" color="neutral" onClick={() => setOpen(true)} > <FilterAltIcon /> </IconButton> <Modal open={open} onClose={() => setOpen(false)}> <ModalDialog aria-labelledby="filter-modal" layout="fullscreen"> <ModalClose /> <Typography id="filter-modal" level="h2"> Filters </Typography> <Divider sx={{ my: 2 }} /> <Sheet sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}> {renderFilters()} <Button color="primary" onClick={() => setOpen(false)}> Submit </Button> </Sheet> </ModalDialog> </Modal> </Sheet> <Box className="SearchAndFilters-tabletUp" sx={{ borderRadius: 'sm', py: 2, display: { xs: 'none', sm: 'flex', }, flexWrap: 'wrap', gap: 1.5, '& > *': { minWidth: { xs: '120px', md: '160px', }, }, }} > <FormControl sx={{ flex: 1 }} size="sm"> <FormLabel>Search for order</FormLabel> <Input size="sm" placeholder="Search" startDecorator={<SearchIcon />} /> </FormControl> {renderFilters()} </Box> <Sheet className="OrderTableContainer" variant="outlined" sx={{ display: { xs: 'none', sm: 'initial' }, width: '100%', borderRadius: 'sm', flexShrink: 1, overflow: 'auto', minHeight: 0, }} > <Table aria-labelledby="tableTitle" stickyHeader hoverRow sx={{ '--TableCell-headBackground': 'var(--joy-palette-background-level1)', '--Table-headerUnderlineThickness': '1px', '--TableRow-hoverBackground': 'var(--joy-palette-background-level1)', '--TableCell-paddingY': '4px', '--TableCell-paddingX': '8px', }} > <thead> <tr> <th style={{ width: 48, textAlign: 'center', padding: '12px 6px' }}> <Checkbox size="sm" indeterminate={ selected.length > 0 && selected.length !== rows.length } checked={selected.length === rows.length} onChange={(event) => { setSelected( event.target.checked ? rows.map((row) => row.id) : [], ); }} color={ selected.length > 0 || selected.length === rows.length ? 'primary' : undefined } sx={{ verticalAlign: 'text-bottom' }} /> </th> <th style={{ width: 120, padding: '12px 6px' }}> <Link underline="none" color="primary" component="button" onClick={() => setOrder(order === 'asc' ? 'desc' : 'asc')} fontWeight="lg" endDecorator={<ArrowDropDownIcon />} sx={{ '& svg': { transition: '0.2s', transform: order === 'desc' ? 'rotate(0deg)' : 'rotate(180deg)', }, }} > Invoice </Link> </th> <th style={{ width: 140, padding: '12px 6px' }}>Date</th> <th style={{ width: 140, padding: '12px 6px' }}>Status</th> <th style={{ width: 240, padding: '12px 6px' }}>Customer</th> <th style={{ width: 140, padding: '12px 6px' }}> </th> </tr> </thead> <tbody> {stableSort(rows, getComparator(order, 'id')).map((row) => ( <tr key={row.id}> <td style={{ textAlign: 'center', width: 120 }}> <Checkbox size="sm" checked={selected.includes(row.id)} color={selected.includes(row.id) ? 'primary' : undefined} onChange={(event) => { setSelected((ids) => event.target.checked ? ids.concat(row.id) : ids.filter((itemId) => itemId !== row.id), ); }} slotProps={{ checkbox: { sx: { textAlign: 'left' } } }} sx={{ verticalAlign: 'text-bottom' }} /> </td> <td> <Typography level="body-xs">{row.id}</Typography> </td> <td> <Typography level="body-xs">{row.date}</Typography> </td> <td> <Chip variant="soft" size="sm" startDecorator={ { Paid: <CheckRoundedIcon />, Refunded: <AutorenewRoundedIcon />, Cancelled: <BlockIcon />, }[row.status] } color={ { Paid: 'success', Refunded: 'neutral', Cancelled: 'danger', }[row.status] as ColorPaletteProp } > {row.status} </Chip> </td> <td> <Box sx={{ display: 'flex', gap: 2, alignItems: 'center' }}> <Avatar size="sm">{row.customer.initial}</Avatar> <div> <Typography level="body-xs">{row.customer.name}</Typography> <Typography level="body-xs">{row.customer.email}</Typography> </div> </Box> </td> <td> <Box sx={{ display: 'flex', gap: 2, alignItems: 'center' }}> <Link level="body-xs" component="button"> Download </Link> <RowMenu /> </Box> </td> </tr> ))} </tbody> </Table> </Sheet> <Box className="Pagination-laptopUp" sx={{ pt: 2, gap: 1, [`& .${iconButtonClasses.root}`]: { borderRadius: '50%' }, display: { xs: 'none', md: 'flex', }, }} > <Button size="sm" variant="outlined" color="neutral" startDecorator={<KeyboardArrowLeftIcon />} > Previous </Button> <Box sx={{ flex: 1 }} /> {['1', '2', '3', '…', '8', '9', '10'].map((page) => ( <IconButton key={page} size="sm" variant={Number(page) ? 'outlined' : 'plain'} color="neutral" > {page} </IconButton> ))} <Box sx={{ flex: 1 }} /> <Button size="sm" variant="outlined" color="neutral" endDecorator={<KeyboardArrowRightIcon />} > Next </Button> </Box> </React.Fragment> ); }
1,901
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/order-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/order-dashboard/components/Sidebar.tsx
import * as React from 'react'; import GlobalStyles from '@mui/joy/GlobalStyles'; import Avatar from '@mui/joy/Avatar'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Card from '@mui/joy/Card'; import Chip from '@mui/joy/Chip'; import Divider from '@mui/joy/Divider'; import IconButton from '@mui/joy/IconButton'; import Input from '@mui/joy/Input'; import LinearProgress from '@mui/joy/LinearProgress'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemButton, { listItemButtonClasses } from '@mui/joy/ListItemButton'; import ListItemContent from '@mui/joy/ListItemContent'; import Typography from '@mui/joy/Typography'; import Sheet from '@mui/joy/Sheet'; import Stack from '@mui/joy/Stack'; import SearchRoundedIcon from '@mui/icons-material/SearchRounded'; import HomeRoundedIcon from '@mui/icons-material/HomeRounded'; import DashboardRoundedIcon from '@mui/icons-material/DashboardRounded'; import ShoppingCartRoundedIcon from '@mui/icons-material/ShoppingCartRounded'; import AssignmentRoundedIcon from '@mui/icons-material/AssignmentRounded'; import QuestionAnswerRoundedIcon from '@mui/icons-material/QuestionAnswerRounded'; import GroupRoundedIcon from '@mui/icons-material/GroupRounded'; import SupportRoundedIcon from '@mui/icons-material/SupportRounded'; import SettingsRoundedIcon from '@mui/icons-material/SettingsRounded'; import CloseRoundedIcon from '@mui/icons-material/CloseRounded'; import LogoutRoundedIcon from '@mui/icons-material/LogoutRounded'; import BrightnessAutoRoundedIcon from '@mui/icons-material/BrightnessAutoRounded'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; import ColorSchemeToggle from './ColorSchemeToggle'; import { closeSidebar } from '../utils'; function Toggler({ defaultExpanded = false, renderToggle, children, }: { defaultExpanded?: boolean; children: React.ReactNode; renderToggle: (params: { open: boolean; setOpen: React.Dispatch<React.SetStateAction<boolean>>; }) => React.ReactNode; }) { const [open, setOpen] = React.useState(defaultExpanded); return ( <React.Fragment> {renderToggle({ open, setOpen })} <Box sx={{ display: 'grid', gridTemplateRows: open ? '1fr' : '0fr', transition: '0.2s ease', '& > *': { overflow: 'hidden', }, }} > {children} </Box> </React.Fragment> ); } export default function Sidebar() { return ( <Sheet className="Sidebar" sx={{ position: { xs: 'fixed', md: 'sticky', }, transform: { xs: 'translateX(calc(100% * (var(--SideNavigation-slideIn, 0) - 1)))', md: 'none', }, transition: 'transform 0.4s, width 0.4s', zIndex: 10000, height: '100dvh', width: 'var(--Sidebar-width)', top: 0, p: 2, flexShrink: 0, display: 'flex', flexDirection: 'column', gap: 2, borderRight: '1px solid', borderColor: 'divider', }} > <GlobalStyles styles={(theme) => ({ ':root': { '--Sidebar-width': '220px', [theme.breakpoints.up('lg')]: { '--Sidebar-width': '240px', }, }, })} /> <Box className="Sidebar-overlay" sx={{ position: 'fixed', zIndex: 9998, top: 0, left: 0, width: '100vw', height: '100vh', opacity: 'var(--SideNavigation-slideIn)', backgroundColor: 'var(--joy-palette-background-backdrop)', transition: 'opacity 0.4s', transform: { xs: 'translateX(calc(100% * (var(--SideNavigation-slideIn, 0) - 1) + var(--SideNavigation-slideIn, 0) * var(--Sidebar-width, 0px)))', lg: 'translateX(-100%)', }, }} onClick={() => closeSidebar()} /> <Box sx={{ display: 'flex', gap: 1, alignItems: 'center' }}> <IconButton variant="soft" color="primary" size="sm"> <BrightnessAutoRoundedIcon /> </IconButton> <Typography level="title-lg">Acme Co.</Typography> <ColorSchemeToggle sx={{ ml: 'auto' }} /> </Box> <Input size="sm" startDecorator={<SearchRoundedIcon />} placeholder="Search" /> <Box sx={{ minHeight: 0, overflow: 'hidden auto', flexGrow: 1, display: 'flex', flexDirection: 'column', [`& .${listItemButtonClasses.root}`]: { gap: 1.5, }, }} > <List size="sm" sx={{ gap: 1, '--List-nestedInsetStart': '30px', '--ListItem-radius': (theme) => theme.vars.radius.sm, }} > <ListItem> <ListItemButton> <HomeRoundedIcon /> <ListItemContent> <Typography level="title-sm">Home</Typography> </ListItemContent> </ListItemButton> </ListItem> <ListItem> <ListItemButton> <DashboardRoundedIcon /> <ListItemContent> <Typography level="title-sm">Dashboard</Typography> </ListItemContent> </ListItemButton> </ListItem> <ListItem> <ListItemButton selected> <ShoppingCartRoundedIcon /> <ListItemContent> <Typography level="title-sm">Orders</Typography> </ListItemContent> </ListItemButton> </ListItem> <ListItem nested> <Toggler renderToggle={({ open, setOpen }) => ( <ListItemButton onClick={() => setOpen(!open)}> <AssignmentRoundedIcon /> <ListItemContent> <Typography level="title-sm">Tasks</Typography> </ListItemContent> <KeyboardArrowDownIcon sx={{ transform: open ? 'rotate(180deg)' : 'none' }} /> </ListItemButton> )} > <List sx={{ gap: 0.5 }}> <ListItem sx={{ mt: 0.5 }}> <ListItemButton>All tasks</ListItemButton> </ListItem> <ListItem> <ListItemButton>Backlog</ListItemButton> </ListItem> <ListItem> <ListItemButton>In progress</ListItemButton> </ListItem> <ListItem> <ListItemButton>Done</ListItemButton> </ListItem> </List> </Toggler> </ListItem> <ListItem> <ListItemButton role="menuitem" component="a" href="/joy-ui/getting-started/templates/messages/" > <QuestionAnswerRoundedIcon /> <ListItemContent> <Typography level="title-sm">Messages</Typography> </ListItemContent> <Chip size="sm" color="primary" variant="solid"> 4 </Chip> </ListItemButton> </ListItem> <ListItem nested> <Toggler renderToggle={({ open, setOpen }) => ( <ListItemButton onClick={() => setOpen(!open)}> <GroupRoundedIcon /> <ListItemContent> <Typography level="title-sm">Users</Typography> </ListItemContent> <KeyboardArrowDownIcon sx={{ transform: open ? 'rotate(180deg)' : 'none' }} /> </ListItemButton> )} > <List sx={{ gap: 0.5 }}> <ListItem sx={{ mt: 0.5 }}> <ListItemButton role="menuitem" component="a" href="/joy-ui/getting-started/templates/profile-dashboard/" > My profile </ListItemButton> </ListItem> <ListItem> <ListItemButton>Create a new user</ListItemButton> </ListItem> <ListItem> <ListItemButton>Roles & permission</ListItemButton> </ListItem> </List> </Toggler> </ListItem> </List> <List size="sm" sx={{ mt: 'auto', flexGrow: 0, '--ListItem-radius': (theme) => theme.vars.radius.sm, '--List-gap': '8px', mb: 2, }} > <ListItem> <ListItemButton> <SupportRoundedIcon /> Support </ListItemButton> </ListItem> <ListItem> <ListItemButton> <SettingsRoundedIcon /> Settings </ListItemButton> </ListItem> </List> <Card invertedColors variant="soft" color="warning" size="sm" sx={{ boxShadow: 'none' }} > <Stack direction="row" justifyContent="space-between" alignItems="center"> <Typography level="title-sm">Used space</Typography> <IconButton size="sm"> <CloseRoundedIcon /> </IconButton> </Stack> <Typography level="body-xs"> Your team has used 80% of your available space. Need more? </Typography> <LinearProgress variant="outlined" value={80} determinate sx={{ my: 1 }} /> <Button size="sm" variant="solid"> Upgrade plan </Button> </Card> </Box> <Divider /> <Box sx={{ display: 'flex', gap: 1, alignItems: 'center' }}> <Avatar variant="outlined" size="sm" src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=286" /> <Box sx={{ minWidth: 0, flex: 1 }}> <Typography level="title-sm">Siriwat K.</Typography> <Typography level="body-xs">[email protected]</Typography> </Box> <IconButton size="sm" variant="plain" color="neutral"> <LogoutRoundedIcon /> </IconButton> </Box> </Sheet> ); }
1,902
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard/App.tsx
import * as React from 'react'; import { CssVarsProvider } from '@mui/joy/styles'; import CssBaseline from '@mui/joy/CssBaseline'; import Box from '@mui/joy/Box'; import Sidebar from './components/Sidebar'; import Header from './components/Header'; import MyProfile from './components/MyProfile'; export default function JoyOrderDashboardTemplate() { return ( <CssVarsProvider disableTransitionOnChange> <CssBaseline /> <Box sx={{ display: 'flex', minHeight: '100dvh' }}> <Sidebar /> <Header /> <Box component="main" className="MainContent" sx={{ pt: { xs: 'calc(12px + var(--Header-height))', md: 3, }, pb: { xs: 2, sm: 2, md: 3, }, flex: 1, display: 'flex', flexDirection: 'column', minWidth: 0, height: '100dvh', gap: 1, overflow: 'auto', }} > <MyProfile /> </Box> </Box> </CssVarsProvider> ); }
1,903
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard/useScript.ts
import * as React from 'react'; export type UseScriptStatus = 'idle' | 'loading' | 'ready' | 'error'; // Cached script statuses const cachedScriptStatuses: Record<string, UseScriptStatus | undefined> = {}; /** * Simplified version of https://usehooks-ts.com/react-hook/use-script */ function getScriptNode(src: string) { const node: HTMLScriptElement | null = document.querySelector(`script[src="${src}"]`); const status = node?.getAttribute('data-status') as UseScriptStatus | undefined; return { node, status, }; } function useScript(src: string): UseScriptStatus { const [status, setStatus] = React.useState<UseScriptStatus>(() => { if (typeof window === 'undefined') { // SSR Handling - always return 'loading' return 'loading'; } return cachedScriptStatuses[src] ?? 'loading'; }); React.useEffect(() => { const cachedScriptStatus = cachedScriptStatuses[src]; if (cachedScriptStatus === 'ready' || cachedScriptStatus === 'error') { // If the script is already cached, set its status immediately setStatus(cachedScriptStatus); return; } // Fetch existing script element by src // It may have been added by another instance of this hook const script = getScriptNode(src); let scriptNode = script.node; if (!scriptNode) { // Create script element and add it to document body scriptNode = document.createElement('script'); scriptNode.src = src; scriptNode.async = true; scriptNode.setAttribute('data-status', 'loading'); document.body.appendChild(scriptNode); // Store status in attribute on script // This can be read by other instances of this hook const setAttributeFromEvent = (event: Event) => { const scriptStatus: UseScriptStatus = event.type === 'load' ? 'ready' : 'error'; scriptNode?.setAttribute('data-status', scriptStatus); }; scriptNode.addEventListener('load', setAttributeFromEvent); scriptNode.addEventListener('error', setAttributeFromEvent); } else { // Grab existing script status from attribute and set to state. setStatus(script.status ?? cachedScriptStatus ?? 'loading'); } // Script event handler to update status in state // Note: Even if the script already exists we still need to add // event handlers to update the state for *this* hook instance. const setStateFromEvent = (event: Event) => { const newStatus = event.type === 'load' ? 'ready' : 'error'; setStatus(newStatus); cachedScriptStatuses[src] = newStatus; }; // Add event listeners scriptNode.addEventListener('load', setStateFromEvent); scriptNode.addEventListener('error', setStateFromEvent); // Remove event listeners on cleanup // eslint-disable-next-line consistent-return return () => { if (scriptNode) { scriptNode.removeEventListener('load', setStateFromEvent); scriptNode.removeEventListener('error', setStateFromEvent); } if (scriptNode) { try { scriptNode.remove(); } catch (error) { // ignore error } } }; }, [src]); return status; } export default useScript;
1,904
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard/utils.ts
export const openSidebar = () => { if (typeof document !== 'undefined') { document.body.style.overflow = 'hidden'; document.documentElement.style.setProperty('--SideNavigation-slideIn', '1'); } }; export const closeSidebar = () => { if (typeof document !== 'undefined') { document.documentElement.style.removeProperty('--SideNavigation-slideIn'); document.body.style.removeProperty('overflow'); } }; export const toggleSidebar = () => { if (typeof window !== 'undefined' && typeof document !== 'undefined') { const slideIn = window .getComputedStyle(document.documentElement) .getPropertyValue('--SideNavigation-slideIn'); if (slideIn) { closeSidebar(); } else { openSidebar(); } } };
1,905
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard/components/ColorSchemeToggle.tsx
import * as React from 'react'; import { useColorScheme } from '@mui/joy/styles'; import IconButton, { IconButtonProps } from '@mui/joy/IconButton'; import DarkModeRoundedIcon from '@mui/icons-material/DarkModeRounded'; import LightModeIcon from '@mui/icons-material/LightMode'; export default function ColorSchemeToggle({ onClick, sx, ...props }: IconButtonProps) { const { mode, setMode } = useColorScheme(); const [mounted, setMounted] = React.useState(false); React.useEffect(() => { setMounted(true); }, []); if (!mounted) { return ( <IconButton size="sm" variant="outlined" color="neutral" {...props} sx={sx} disabled /> ); } return ( <IconButton id="toggle-mode" size="sm" variant="outlined" color="neutral" {...props} onClick={(event) => { if (mode === 'light') { setMode('dark'); } else { setMode('light'); } onClick?.(event); }} sx={[ { '& > *:first-of-type': { display: mode === 'dark' ? 'none' : 'initial', }, '& > *:last-of-type': { display: mode === 'light' ? 'none' : 'initial', }, }, ...(Array.isArray(sx) ? sx : [sx]), ]} > <DarkModeRoundedIcon /> <LightModeIcon /> </IconButton> ); }
1,906
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard/components/CountrySelector.tsx
import * as React from 'react'; import Autocomplete from '@mui/joy/Autocomplete'; import AutocompleteOption from '@mui/joy/AutocompleteOption'; import AspectRatio from '@mui/joy/AspectRatio'; import FormControl, { FormControlProps } from '@mui/joy/FormControl'; import FormLabel from '@mui/joy/FormLabel'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import Typography from '@mui/joy/Typography'; export default function ContrySelector({ sx, ...props }: FormControlProps) { return ( <FormControl {...props} sx={[{ display: { sm: 'contents' } }, ...(Array.isArray(sx) ? sx : [sx])]} > <FormLabel>Country</FormLabel> <Autocomplete size="sm" autoHighlight isOptionEqualToValue={(option, value) => option.code === value.code} defaultValue={{ code: 'TH', label: 'Thailand', phone: '66' }} options={countries} renderOption={(optionProps, option) => ( <AutocompleteOption {...optionProps}> <ListItemDecorator> <AspectRatio ratio="1" sx={{ minWidth: 20, borderRadius: '50%' }}> <img loading="lazy" width="20" srcSet={`https://flagcdn.com/w40/${option.code.toLowerCase()}.png 2x`} src={`https://flagcdn.com/w20/${option.code.toLowerCase()}.png`} alt="" /> </AspectRatio> </ListItemDecorator> {option.label} <Typography component="span" textColor="text.tertiary" ml={0.5}> (+{option.phone}) </Typography> </AutocompleteOption> )} slotProps={{ input: { autoComplete: 'new-password', // disable autocomplete and autofill }, }} /> </FormControl> ); } interface CountryType { code: string; label: string; phone: string; suggested?: boolean; } // From https://bitbucket.org/atlassian/atlaskit-mk-2/raw/4ad0e56649c3e6c973e226b7efaeb28cb240ccb0/packages/core/select/src/data/countries.js const countries: readonly CountryType[] = [ { code: 'AD', label: 'Andorra', phone: '376' }, { code: 'AE', label: 'United Arab Emirates', phone: '971', }, { code: 'AF', label: 'Afghanistan', phone: '93' }, { code: 'AG', label: 'Antigua and Barbuda', phone: '1-268', }, { code: 'AI', label: 'Anguilla', phone: '1-264' }, { code: 'AL', label: 'Albania', phone: '355' }, { code: 'AM', label: 'Armenia', phone: '374' }, { code: 'AO', label: 'Angola', phone: '244' }, { code: 'AQ', label: 'Antarctica', phone: '672' }, { code: 'AR', label: 'Argentina', phone: '54' }, { code: 'AS', label: 'American Samoa', phone: '1-684' }, { code: 'AT', label: 'Austria', phone: '43' }, { code: 'AU', label: 'Australia', phone: '61', suggested: true, }, { code: 'AW', label: 'Aruba', phone: '297' }, { code: 'AX', label: 'Alland Islands', phone: '358' }, { code: 'AZ', label: 'Azerbaijan', phone: '994' }, { code: 'BA', label: 'Bosnia and Herzegovina', phone: '387', }, { code: 'BB', label: 'Barbados', phone: '1-246' }, { code: 'BD', label: 'Bangladesh', phone: '880' }, { code: 'BE', label: 'Belgium', phone: '32' }, { code: 'BF', label: 'Burkina Faso', phone: '226' }, { code: 'BG', label: 'Bulgaria', phone: '359' }, { code: 'BH', label: 'Bahrain', phone: '973' }, { code: 'BI', label: 'Burundi', phone: '257' }, { code: 'BJ', label: 'Benin', phone: '229' }, { code: 'BL', label: 'Saint Barthelemy', phone: '590' }, { code: 'BM', label: 'Bermuda', phone: '1-441' }, { code: 'BN', label: 'Brunei Darussalam', phone: '673' }, { code: 'BO', label: 'Bolivia', phone: '591' }, { code: 'BR', label: 'Brazil', phone: '55' }, { code: 'BS', label: 'Bahamas', phone: '1-242' }, { code: 'BT', label: 'Bhutan', phone: '975' }, { code: 'BV', label: 'Bouvet Island', phone: '47' }, { code: 'BW', label: 'Botswana', phone: '267' }, { code: 'BY', label: 'Belarus', phone: '375' }, { code: 'BZ', label: 'Belize', phone: '501' }, { code: 'CA', label: 'Canada', phone: '1', suggested: true, }, { code: 'CC', label: 'Cocos (Keeling) Islands', phone: '61', }, { code: 'CD', label: 'Congo, Democratic Republic of the', phone: '243', }, { code: 'CF', label: 'Central African Republic', phone: '236', }, { code: 'CG', label: 'Congo, Republic of the', phone: '242', }, { code: 'CH', label: 'Switzerland', phone: '41' }, { code: 'CI', label: "Cote d'Ivoire", phone: '225' }, { code: 'CK', label: 'Cook Islands', phone: '682' }, { code: 'CL', label: 'Chile', phone: '56' }, { code: 'CM', label: 'Cameroon', phone: '237' }, { code: 'CN', label: 'China', phone: '86' }, { code: 'CO', label: 'Colombia', phone: '57' }, { code: 'CR', label: 'Costa Rica', phone: '506' }, { code: 'CU', label: 'Cuba', phone: '53' }, { code: 'CV', label: 'Cape Verde', phone: '238' }, { code: 'CW', label: 'Curacao', phone: '599' }, { code: 'CX', label: 'Christmas Island', phone: '61' }, { code: 'CY', label: 'Cyprus', phone: '357' }, { code: 'CZ', label: 'Czech Republic', phone: '420' }, { code: 'DE', label: 'Germany', phone: '49', suggested: true, }, { code: 'DJ', label: 'Djibouti', phone: '253' }, { code: 'DK', label: 'Denmark', phone: '45' }, { code: 'DM', label: 'Dominica', phone: '1-767' }, { code: 'DO', label: 'Dominican Republic', phone: '1-809', }, { code: 'DZ', label: 'Algeria', phone: '213' }, { code: 'EC', label: 'Ecuador', phone: '593' }, { code: 'EE', label: 'Estonia', phone: '372' }, { code: 'EG', label: 'Egypt', phone: '20' }, { code: 'EH', label: 'Western Sahara', phone: '212' }, { code: 'ER', label: 'Eritrea', phone: '291' }, { code: 'ES', label: 'Spain', phone: '34' }, { code: 'ET', label: 'Ethiopia', phone: '251' }, { code: 'FI', label: 'Finland', phone: '358' }, { code: 'FJ', label: 'Fiji', phone: '679' }, { code: 'FK', label: 'Falkland Islands (Malvinas)', phone: '500', }, { code: 'FM', label: 'Micronesia, Federated States of', phone: '691', }, { code: 'FO', label: 'Faroe Islands', phone: '298' }, { code: 'FR', label: 'France', phone: '33', suggested: true, }, { code: 'GA', label: 'Gabon', phone: '241' }, { code: 'GB', label: 'United Kingdom', phone: '44' }, { code: 'GD', label: 'Grenada', phone: '1-473' }, { code: 'GE', label: 'Georgia', phone: '995' }, { code: 'GF', label: 'French Guiana', phone: '594' }, { code: 'GG', label: 'Guernsey', phone: '44' }, { code: 'GH', label: 'Ghana', phone: '233' }, { code: 'GI', label: 'Gibraltar', phone: '350' }, { code: 'GL', label: 'Greenland', phone: '299' }, { code: 'GM', label: 'Gambia', phone: '220' }, { code: 'GN', label: 'Guinea', phone: '224' }, { code: 'GP', label: 'Guadeloupe', phone: '590' }, { code: 'GQ', label: 'Equatorial Guinea', phone: '240' }, { code: 'GR', label: 'Greece', phone: '30' }, { code: 'GS', label: 'South Georgia and the South Sandwich Islands', phone: '500', }, { code: 'GT', label: 'Guatemala', phone: '502' }, { code: 'GU', label: 'Guam', phone: '1-671' }, { code: 'GW', label: 'Guinea-Bissau', phone: '245' }, { code: 'GY', label: 'Guyana', phone: '592' }, { code: 'HK', label: 'Hong Kong', phone: '852' }, { code: 'HM', label: 'Heard Island and McDonald Islands', phone: '672', }, { code: 'HN', label: 'Honduras', phone: '504' }, { code: 'HR', label: 'Croatia', phone: '385' }, { code: 'HT', label: 'Haiti', phone: '509' }, { code: 'HU', label: 'Hungary', phone: '36' }, { code: 'ID', label: 'Indonesia', phone: '62' }, { code: 'IE', label: 'Ireland', phone: '353' }, { code: 'IL', label: 'Israel', phone: '972' }, { code: 'IM', label: 'Isle of Man', phone: '44' }, { code: 'IN', label: 'India', phone: '91' }, { code: 'IO', label: 'British Indian Ocean Territory', phone: '246', }, { code: 'IQ', label: 'Iraq', phone: '964' }, { code: 'IR', label: 'Iran, Islamic Republic of', phone: '98', }, { code: 'IS', label: 'Iceland', phone: '354' }, { code: 'IT', label: 'Italy', phone: '39' }, { code: 'JE', label: 'Jersey', phone: '44' }, { code: 'JM', label: 'Jamaica', phone: '1-876' }, { code: 'JO', label: 'Jordan', phone: '962' }, { code: 'JP', label: 'Japan', phone: '81', suggested: true, }, { code: 'KE', label: 'Kenya', phone: '254' }, { code: 'KG', label: 'Kyrgyzstan', phone: '996' }, { code: 'KH', label: 'Cambodia', phone: '855' }, { code: 'KI', label: 'Kiribati', phone: '686' }, { code: 'KM', label: 'Comoros', phone: '269' }, { code: 'KN', label: 'Saint Kitts and Nevis', phone: '1-869', }, { code: 'KP', label: "Korea, Democratic People's Republic of", phone: '850', }, { code: 'KR', label: 'Korea, Republic of', phone: '82' }, { code: 'KW', label: 'Kuwait', phone: '965' }, { code: 'KY', label: 'Cayman Islands', phone: '1-345' }, { code: 'KZ', label: 'Kazakhstan', phone: '7' }, { code: 'LA', label: "Lao People's Democratic Republic", phone: '856', }, { code: 'LB', label: 'Lebanon', phone: '961' }, { code: 'LC', label: 'Saint Lucia', phone: '1-758' }, { code: 'LI', label: 'Liechtenstein', phone: '423' }, { code: 'LK', label: 'Sri Lanka', phone: '94' }, { code: 'LR', label: 'Liberia', phone: '231' }, { code: 'LS', label: 'Lesotho', phone: '266' }, { code: 'LT', label: 'Lithuania', phone: '370' }, { code: 'LU', label: 'Luxembourg', phone: '352' }, { code: 'LV', label: 'Latvia', phone: '371' }, { code: 'LY', label: 'Libya', phone: '218' }, { code: 'MA', label: 'Morocco', phone: '212' }, { code: 'MC', label: 'Monaco', phone: '377' }, { code: 'MD', label: 'Moldova, Republic of', phone: '373', }, { code: 'ME', label: 'Montenegro', phone: '382' }, { code: 'MF', label: 'Saint Martin (French part)', phone: '590', }, { code: 'MG', label: 'Madagascar', phone: '261' }, { code: 'MH', label: 'Marshall Islands', phone: '692' }, { code: 'MK', label: 'Macedonia, the Former Yugoslav Republic of', phone: '389', }, { code: 'ML', label: 'Mali', phone: '223' }, { code: 'MM', label: 'Myanmar', phone: '95' }, { code: 'MN', label: 'Mongolia', phone: '976' }, { code: 'MO', label: 'Macao', phone: '853' }, { code: 'MP', label: 'Northern Mariana Islands', phone: '1-670', }, { code: 'MQ', label: 'Martinique', phone: '596' }, { code: 'MR', label: 'Mauritania', phone: '222' }, { code: 'MS', label: 'Montserrat', phone: '1-664' }, { code: 'MT', label: 'Malta', phone: '356' }, { code: 'MU', label: 'Mauritius', phone: '230' }, { code: 'MV', label: 'Maldives', phone: '960' }, { code: 'MW', label: 'Malawi', phone: '265' }, { code: 'MX', label: 'Mexico', phone: '52' }, { code: 'MY', label: 'Malaysia', phone: '60' }, { code: 'MZ', label: 'Mozambique', phone: '258' }, { code: 'NA', label: 'Namibia', phone: '264' }, { code: 'NC', label: 'New Caledonia', phone: '687' }, { code: 'NE', label: 'Niger', phone: '227' }, { code: 'NF', label: 'Norfolk Island', phone: '672' }, { code: 'NG', label: 'Nigeria', phone: '234' }, { code: 'NI', label: 'Nicaragua', phone: '505' }, { code: 'NL', label: 'Netherlands', phone: '31' }, { code: 'NO', label: 'Norway', phone: '47' }, { code: 'NP', label: 'Nepal', phone: '977' }, { code: 'NR', label: 'Nauru', phone: '674' }, { code: 'NU', label: 'Niue', phone: '683' }, { code: 'NZ', label: 'New Zealand', phone: '64' }, { code: 'OM', label: 'Oman', phone: '968' }, { code: 'PA', label: 'Panama', phone: '507' }, { code: 'PE', label: 'Peru', phone: '51' }, { code: 'PF', label: 'French Polynesia', phone: '689' }, { code: 'PG', label: 'Papua New Guinea', phone: '675' }, { code: 'PH', label: 'Philippines', phone: '63' }, { code: 'PK', label: 'Pakistan', phone: '92' }, { code: 'PL', label: 'Poland', phone: '48' }, { code: 'PM', label: 'Saint Pierre and Miquelon', phone: '508', }, { code: 'PN', label: 'Pitcairn', phone: '870' }, { code: 'PR', label: 'Puerto Rico', phone: '1' }, { code: 'PS', label: 'Palestine, State of', phone: '970', }, { code: 'PT', label: 'Portugal', phone: '351' }, { code: 'PW', label: 'Palau', phone: '680' }, { code: 'PY', label: 'Paraguay', phone: '595' }, { code: 'QA', label: 'Qatar', phone: '974' }, { code: 'RE', label: 'Reunion', phone: '262' }, { code: 'RO', label: 'Romania', phone: '40' }, { code: 'RS', label: 'Serbia', phone: '381' }, { code: 'RU', label: 'Russian Federation', phone: '7' }, { code: 'RW', label: 'Rwanda', phone: '250' }, { code: 'SA', label: 'Saudi Arabia', phone: '966' }, { code: 'SB', label: 'Solomon Islands', phone: '677' }, { code: 'SC', label: 'Seychelles', phone: '248' }, { code: 'SD', label: 'Sudan', phone: '249' }, { code: 'SE', label: 'Sweden', phone: '46' }, { code: 'SG', label: 'Singapore', phone: '65' }, { code: 'SH', label: 'Saint Helena', phone: '290' }, { code: 'SI', label: 'Slovenia', phone: '386' }, { code: 'SJ', label: 'Svalbard and Jan Mayen', phone: '47', }, { code: 'SK', label: 'Slovakia', phone: '421' }, { code: 'SL', label: 'Sierra Leone', phone: '232' }, { code: 'SM', label: 'San Marino', phone: '378' }, { code: 'SN', label: 'Senegal', phone: '221' }, { code: 'SO', label: 'Somalia', phone: '252' }, { code: 'SR', label: 'Suriname', phone: '597' }, { code: 'SS', label: 'South Sudan', phone: '211' }, { code: 'ST', label: 'Sao Tome and Principe', phone: '239', }, { code: 'SV', label: 'El Salvador', phone: '503' }, { code: 'SX', label: 'Sint Maarten (Dutch part)', phone: '1-721', }, { code: 'SY', label: 'Syrian Arab Republic', phone: '963', }, { code: 'SZ', label: 'Swaziland', phone: '268' }, { code: 'TC', label: 'Turks and Caicos Islands', phone: '1-649', }, { code: 'TD', label: 'Chad', phone: '235' }, { code: 'TF', label: 'French Southern Territories', phone: '262', }, { code: 'TG', label: 'Togo', phone: '228' }, { code: 'TH', label: 'Thailand', phone: '66' }, { code: 'TJ', label: 'Tajikistan', phone: '992' }, { code: 'TK', label: 'Tokelau', phone: '690' }, { code: 'TL', label: 'Timor-Leste', phone: '670' }, { code: 'TM', label: 'Turkmenistan', phone: '993' }, { code: 'TN', label: 'Tunisia', phone: '216' }, { code: 'TO', label: 'Tonga', phone: '676' }, { code: 'TR', label: 'Turkey', phone: '90' }, { code: 'TT', label: 'Trinidad and Tobago', phone: '1-868', }, { code: 'TV', label: 'Tuvalu', phone: '688' }, { code: 'TW', label: 'Taiwan', phone: '886', }, { code: 'TZ', label: 'United Republic of Tanzania', phone: '255', }, { code: 'UA', label: 'Ukraine', phone: '380' }, { code: 'UG', label: 'Uganda', phone: '256' }, { code: 'US', label: 'United States', phone: '1', suggested: true, }, { code: 'UY', label: 'Uruguay', phone: '598' }, { code: 'UZ', label: 'Uzbekistan', phone: '998' }, { code: 'VA', label: 'Holy See (Vatican City State)', phone: '379', }, { code: 'VC', label: 'Saint Vincent and the Grenadines', phone: '1-784', }, { code: 'VE', label: 'Venezuela', phone: '58' }, { code: 'VG', label: 'British Virgin Islands', phone: '1-284', }, { code: 'VI', label: 'US Virgin Islands', phone: '1-340', }, { code: 'VN', label: 'Vietnam', phone: '84' }, { code: 'VU', label: 'Vanuatu', phone: '678' }, { code: 'WF', label: 'Wallis and Futuna', phone: '681' }, { code: 'WS', label: 'Samoa', phone: '685' }, { code: 'XK', label: 'Kosovo', phone: '383' }, { code: 'YE', label: 'Yemen', phone: '967' }, { code: 'YT', label: 'Mayotte', phone: '262' }, { code: 'ZA', label: 'South Africa', phone: '27' }, { code: 'ZM', label: 'Zambia', phone: '260' }, { code: 'ZW', label: 'Zimbabwe', phone: '263' }, ];
1,907
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard/components/DropZone.tsx
/* eslint-disable jsx-a11y/anchor-is-valid */ import * as React from 'react'; import Card, { CardProps } from '@mui/joy/Card'; import Link from '@mui/joy/Link'; import Typography from '@mui/joy/Typography'; import AspectRatio from '@mui/joy/AspectRatio'; import FileUploadRoundedIcon from '@mui/icons-material/FileUploadRounded'; export default function DropZone({ icon, sx, ...props }: CardProps & { icon?: React.ReactElement; }) { return ( <Card variant="soft" {...props} sx={[ { borderRadius: 'sm', display: 'flex', flexDirection: 'column', gap: 1, alignItems: 'center', px: 3, flexGrow: 1, boxShadow: 'none', }, ...(Array.isArray(sx) ? sx : [sx]), ]} > <AspectRatio ratio="1" variant="solid" color="primary" sx={{ minWidth: 32, borderRadius: '50%', '--Icon-fontSize': '16px', }} > <div>{icon ?? <FileUploadRoundedIcon />}</div> </AspectRatio> <Typography level="body-sm" textAlign="center"> <Link component="button" overlay> Click to upload </Link>{' '} or drag and drop <br /> SVG, PNG, JPG or GIF (max. 800x400px) </Typography> </Card> ); }
1,908
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard/components/EditorToolbar.tsx
import * as React from 'react'; import Box, { BoxProps } from '@mui/joy/Box'; import Select from '@mui/joy/Select'; import Option from '@mui/joy/Option'; import IconButton from '@mui/joy/IconButton'; import FormatBoldRoundedIcon from '@mui/icons-material/FormatBoldRounded'; import FormatItalicRoundedIcon from '@mui/icons-material/FormatItalicRounded'; import StrikethroughSRoundedIcon from '@mui/icons-material/StrikethroughSRounded'; import FormatListBulletedRoundedIcon from '@mui/icons-material/FormatListBulletedRounded'; export default function EditorToolbar({ sx, ...props }: BoxProps) { return ( <Box {...props} sx={[ { display: 'flex', gap: 0.5, '& > button': { '--Icon-fontSize': '16px' } }, ...(Array.isArray(sx) ? sx : [sx]), ]} > <Select size="sm" defaultValue="1" sx={{ minWidth: 160 }}> <Option value="1">Normal text</Option> <Option value="2" sx={{ fontFamily: 'code' }}> Code text </Option> </Select> <IconButton size="sm" variant="plain" color="neutral"> <FormatBoldRoundedIcon /> </IconButton> <IconButton size="sm" variant="plain" color="neutral"> <FormatItalicRoundedIcon /> </IconButton> <IconButton size="sm" variant="plain" color="neutral"> <StrikethroughSRoundedIcon /> </IconButton> <IconButton size="sm" variant="plain" color="neutral"> <FormatListBulletedRoundedIcon /> </IconButton> </Box> ); }
1,909
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard/components/FileUpload.tsx
import * as React from 'react'; import AspectRatio from '@mui/joy/AspectRatio'; import Box from '@mui/joy/Box'; import Card, { CardProps } from '@mui/joy/Card'; import CardContent from '@mui/joy/CardContent'; import IconButton from '@mui/joy/IconButton'; import LinearProgress from '@mui/joy/LinearProgress'; import Typography from '@mui/joy/Typography'; import InsertDriveFileRoundedIcon from '@mui/icons-material/InsertDriveFileRounded'; import CheckRoundedIcon from '@mui/icons-material/CheckRounded'; import RemoveCircleOutlineRoundedIcon from '@mui/icons-material/RemoveCircleOutlineRounded'; export default function FileUpload({ icon, fileName, fileSize, progress, sx, ...props }: CardProps & { icon?: React.ReactElement; fileName: string; fileSize: string; progress: number; }) { return ( <Card variant="outlined" orientation="horizontal" {...props} sx={[ { gap: 1.5, alignItems: 'flex-start', }, ...(Array.isArray(sx) ? sx : [sx]), ]} > <AspectRatio ratio="1" variant="soft" color="neutral" sx={{ minWidth: 32, borderRadius: '50%', '--Icon-fontSize': '16px', }} > <div>{icon ?? <InsertDriveFileRoundedIcon />}</div> </AspectRatio> <CardContent> <Typography fontSize="sm">{fileName}</Typography> <Typography level="body-xs">{fileSize}</Typography> <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}> <LinearProgress color="neutral" value={progress} determinate sx={[ { ...(progress >= 100 && { color: 'var(--joy-palette-success-solidBg)', }), }, ]} /> <Typography fontSize="xs">{progress}%</Typography> </Box> </CardContent> {progress >= 100 ? ( <AspectRatio ratio="1" variant="solid" color="success" sx={{ minWidth: 20, borderRadius: '50%', '--Icon-fontSize': '14px', }} > <div> <CheckRoundedIcon /> </div> </AspectRatio> ) : ( <IconButton variant="plain" color="danger" size="sm" sx={{ mt: -1, mr: -1 }}> <RemoveCircleOutlineRoundedIcon /> </IconButton> )} </Card> ); }
1,910
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard/components/Header.tsx
import * as React from 'react'; import GlobalStyles from '@mui/joy/GlobalStyles'; import IconButton from '@mui/joy/IconButton'; import Sheet from '@mui/joy/Sheet'; import MenuRoundedIcon from '@mui/icons-material/MenuRounded'; import { toggleSidebar } from '../utils'; export default function Header() { return ( <Sheet sx={{ display: { xs: 'flex', md: 'none' }, alignItems: 'center', justifyContent: 'space-between', position: 'fixed', top: 0, width: '100vw', height: 'var(--Header-height)', zIndex: 9998, p: 2, gap: 1, borderBottom: '1px solid', borderColor: 'background.level1', boxShadow: 'sm', }} > <GlobalStyles styles={(theme) => ({ ':root': { '--Header-height': '52px', [theme.breakpoints.up('md')]: { '--Header-height': '0px', }, }, })} /> <IconButton onClick={() => toggleSidebar()} variant="outlined" color="neutral" size="sm" > <MenuRoundedIcon /> </IconButton> </Sheet> ); }
1,911
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard/components/MuiLogo.tsx
import * as React from 'react'; import AspectRatio, { AspectRatioProps } from '@mui/joy/AspectRatio'; export default function MuiLogo({ sx, ...props }: AspectRatioProps) { return ( <AspectRatio ratio="1" variant="plain" {...props} sx={[ { width: 36, borderRadius: 'sm', }, ...(Array.isArray(sx) ? sx : [sx]), ]} > <div> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="20" viewBox="0 0 36 32" fill="none" > <path d="M30.343 21.976a1 1 0 00.502-.864l.018-5.787a1 1 0 01.502-.864l3.137-1.802a1 1 0 011.498.867v10.521a1 1 0 01-.502.867l-11.839 6.8a1 1 0 01-.994.001l-9.291-5.314a1 1 0 01-.504-.868v-5.305c0-.006.007-.01.013-.007.005.003.012 0 .012-.007v-.006c0-.004.002-.008.006-.01l7.652-4.396c.007-.004.004-.015-.004-.015a.008.008 0 01-.008-.008l.015-5.201a1 1 0 00-1.5-.87l-5.687 3.277a1 1 0 01-.998 0L6.666 9.7a1 1 0 00-1.499.866v9.4a1 1 0 01-1.496.869l-3.166-1.81a1 1 0 01-.504-.87l.028-16.43A1 1 0 011.527.86l10.845 6.229a1 1 0 00.996 0L24.21.86a1 1 0 011.498.868v16.434a1 1 0 01-.501.867l-5.678 3.27a1 1 0 00.004 1.735l3.132 1.783a1 1 0 00.993-.002l6.685-3.839zM31 7.234a1 1 0 001.514.857l3-1.8A1 1 0 0036 5.434V1.766A1 1 0 0034.486.91l-3 1.8a1 1 0 00-.486.857v3.668z" fill="#007FFF" /> </svg> </div> </AspectRatio> ); }
1,912
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard/components/MyProfile.tsx
import * as React from 'react'; import AspectRatio from '@mui/joy/AspectRatio'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Divider from '@mui/joy/Divider'; import FormControl from '@mui/joy/FormControl'; import FormLabel from '@mui/joy/FormLabel'; import FormHelperText from '@mui/joy/FormHelperText'; import Input from '@mui/joy/Input'; import IconButton from '@mui/joy/IconButton'; import Textarea from '@mui/joy/Textarea'; import Stack from '@mui/joy/Stack'; import Select from '@mui/joy/Select'; import Option from '@mui/joy/Option'; import Typography from '@mui/joy/Typography'; import Tabs from '@mui/joy/Tabs'; import TabList from '@mui/joy/TabList'; import Tab, { tabClasses } from '@mui/joy/Tab'; import Breadcrumbs from '@mui/joy/Breadcrumbs'; import Link from '@mui/joy/Link'; import Card from '@mui/joy/Card'; import CardActions from '@mui/joy/CardActions'; import CardOverflow from '@mui/joy/CardOverflow'; import HomeRoundedIcon from '@mui/icons-material/HomeRounded'; import ChevronRightRoundedIcon from '@mui/icons-material/ChevronRightRounded'; import EmailRoundedIcon from '@mui/icons-material/EmailRounded'; import AccessTimeFilledRoundedIcon from '@mui/icons-material/AccessTimeFilledRounded'; import VideocamRoundedIcon from '@mui/icons-material/VideocamRounded'; import InsertDriveFileRoundedIcon from '@mui/icons-material/InsertDriveFileRounded'; import EditRoundedIcon from '@mui/icons-material/EditRounded'; import DropZone from './DropZone'; import FileUpload from './FileUpload'; import CountrySelector from './CountrySelector'; import EditorToolbar from './EditorToolbar'; export default function MyProfile() { return ( <Box sx={{ flex: 1, width: '100%', }} > <Box sx={{ position: 'sticky', top: { sm: -100, md: -110, }, bgcolor: 'background.body', zIndex: 9995, }} > <Box sx={{ px: { xs: 2, md: 6, }, }} > <Breadcrumbs size="sm" aria-label="breadcrumbs" separator={<ChevronRightRoundedIcon fontSize="sm" />} sx={{ pl: 0 }} > <Link underline="none" color="neutral" href="#some-link" aria-label="Home" > <HomeRoundedIcon /> </Link> <Link underline="hover" color="neutral" href="#some-link" fontSize={12} fontWeight={500} > Users </Link> <Typography color="primary" fontWeight={500} fontSize={12}> My profile </Typography> </Breadcrumbs> <Typography level="h2" sx={{ mt: 1, mb: 2, }} > My profile </Typography> </Box> <Tabs defaultValue={0} sx={{ bgcolor: 'transparent', }} > <TabList tabFlex={1} size="sm" sx={{ pl: { xs: 0, md: 4, }, justifyContent: 'left', [`&& .${tabClasses.root}`]: { flex: 'initial', bgcolor: 'transparent', [`&.${tabClasses.selected}`]: { fontWeight: '600', '&::after': { height: '2px', bgcolor: 'primary.500', }, }, }, }} > <Tab sx={{ borderRadius: '6px 6px 0 0' }} indicatorInset value={0}> Settings </Tab> <Tab sx={{ borderRadius: '6px 6px 0 0' }} indicatorInset value={1}> Team </Tab> <Tab sx={{ borderRadius: '6px 6px 0 0' }} indicatorInset value={2}> Plan </Tab> <Tab sx={{ borderRadius: '6px 6px 0 0' }} indicatorInset value={3}> Billing </Tab> </TabList> </Tabs> </Box> <Stack spacing={4} sx={{ display: 'flex', maxWidth: '800px', mx: 'auto', px: { xs: 2, md: 6, }, py: { xs: 2, md: 3, }, }} > <Card> <Box sx={{ mb: 1 }}> <Typography level="title-md">Personal info</Typography> <Typography level="body-sm"> Customize how your profile information will apper to the networks. </Typography> </Box> <Divider /> <Stack direction="row" spacing={3} sx={{ display: { xs: 'none', md: 'flex' }, my: 1 }} > <Stack direction="column" spacing={1}> <AspectRatio ratio="1" maxHeight={200} sx={{ flex: 1, minWidth: 120, borderRadius: '100%' }} > <img src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=286" srcSet="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=286&dpr=2 2x" loading="lazy" alt="" /> </AspectRatio> <IconButton aria-label="upload new picture" size="sm" variant="outlined" color="neutral" sx={{ bgcolor: 'background.body', position: 'absolute', zIndex: 2, borderRadius: '50%', left: 100, top: 170, boxShadow: 'sm', }} > <EditRoundedIcon /> </IconButton> </Stack> <Stack spacing={2} sx={{ flexGrow: 1 }}> <Stack spacing={1}> <FormLabel>Name</FormLabel> <FormControl sx={{ display: { sm: 'flex-column', md: 'flex-row', }, gap: 2, }} > <Input size="sm" placeholder="First name" /> <Input size="sm" placeholder="Last name" sx={{ flexGrow: 1 }} /> </FormControl> </Stack> <Stack direction="row" spacing={2}> <FormControl> <FormLabel>Role</FormLabel> <Input size="sm" defaultValue="UI Developer" /> </FormControl> <FormControl sx={{ flexGrow: 1 }}> <FormLabel>Email</FormLabel> <Input size="sm" type="email" startDecorator={<EmailRoundedIcon />} placeholder="email" defaultValue="[email protected]" sx={{ flexGrow: 1 }} /> </FormControl> </Stack> <div> <CountrySelector /> </div> <div> <FormControl sx={{ display: { sm: 'contents' } }}> <FormLabel>Timezone</FormLabel> <Select size="sm" startDecorator={<AccessTimeFilledRoundedIcon />} defaultValue="1" > <Option value="1"> Indochina Time (Bangkok){' '} <Typography textColor="text.tertiary" ml={0.5}> β€” GMT+07:00 </Typography> </Option> <Option value="2"> Indochina Time (Ho Chi Minh City){' '} <Typography textColor="text.tertiary" ml={0.5}> β€” GMT+07:00 </Typography> </Option> </Select> </FormControl> </div> </Stack> </Stack> <Stack direction="column" spacing={2} sx={{ display: { xs: 'flex', md: 'none' }, my: 1 }} > <Stack direction="row" spacing={2}> <Stack direction="column" spacing={1}> <AspectRatio ratio="1" maxHeight={108} sx={{ flex: 1, minWidth: 108, borderRadius: '100%' }} > <img src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=286" srcSet="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=286&dpr=2 2x" loading="lazy" alt="" /> </AspectRatio> <IconButton aria-label="upload new picture" size="sm" variant="outlined" color="neutral" sx={{ bgcolor: 'background.body', position: 'absolute', zIndex: 2, borderRadius: '50%', left: 85, top: 180, boxShadow: 'sm', }} > <EditRoundedIcon /> </IconButton> </Stack> <Stack spacing={1} sx={{ flexGrow: 1 }}> <FormLabel>Name</FormLabel> <FormControl sx={{ display: { sm: 'flex-column', md: 'flex-row', }, gap: 2, }} > <Input size="sm" placeholder="First name" /> <Input size="sm" placeholder="Last name" /> </FormControl> </Stack> </Stack> <FormControl> <FormLabel>Role</FormLabel> <Input size="sm" defaultValue="UI Developer" /> </FormControl> <FormControl sx={{ flexGrow: 1 }}> <FormLabel>Email</FormLabel> <Input size="sm" type="email" startDecorator={<EmailRoundedIcon />} placeholder="email" defaultValue="[email protected]" sx={{ flexGrow: 1 }} /> </FormControl> <div> <CountrySelector /> </div> <div> <FormControl sx={{ display: { sm: 'contents' } }}> <FormLabel>Timezone</FormLabel> <Select size="sm" startDecorator={<AccessTimeFilledRoundedIcon />} defaultValue="1" > <Option value="1"> Indochina Time (Bangkok){' '} <Typography textColor="text.tertiary" ml={0.5}> β€” GMT+07:00 </Typography> </Option> <Option value="2"> Indochina Time (Ho Chi Minh City){' '} <Typography textColor="text.tertiary" ml={0.5}> β€” GMT+07:00 </Typography> </Option> </Select> </FormControl> </div> </Stack> <CardOverflow sx={{ borderTop: '1px solid', borderColor: 'divider' }}> <CardActions sx={{ alignSelf: 'flex-end', pt: 2 }}> <Button size="sm" variant="outlined" color="neutral"> Cancel </Button> <Button size="sm" variant="solid"> Save </Button> </CardActions> </CardOverflow> </Card> <Card> <Box sx={{ mb: 1 }}> <Typography level="title-md">Bio</Typography> <Typography level="body-sm"> Write a short introduction to be displayed on your profile </Typography> </Box> <Divider /> <Stack spacing={2} sx={{ my: 1 }}> <EditorToolbar /> <Textarea size="sm" minRows={4} sx={{ mt: 1.5 }} defaultValue="I'm a software developer based in Bangkok, Thailand. My goal is to solve UI problems with neat CSS without using too much JavaScript." /> <FormHelperText sx={{ mt: 0.75, fontSize: 'xs' }}> 275 characters left </FormHelperText> </Stack> <CardOverflow sx={{ borderTop: '1px solid', borderColor: 'divider' }}> <CardActions sx={{ alignSelf: 'flex-end', pt: 2 }}> <Button size="sm" variant="outlined" color="neutral"> Cancel </Button> <Button size="sm" variant="solid"> Save </Button> </CardActions> </CardOverflow> </Card> <Card> <Box sx={{ mb: 1 }}> <Typography level="title-md">Portfolio projects</Typography> <Typography level="body-sm"> Share a few snippets of your work. </Typography> </Box> <Divider /> <Stack spacing={2} sx={{ my: 1 }}> <DropZone /> <FileUpload icon={<InsertDriveFileRoundedIcon />} fileName="Tech design requirements.pdf" fileSize="200 kB" progress={100} /> <FileUpload icon={<VideocamRoundedIcon />} fileName="Dashboard prototype recording.mp4" fileSize="16 MB" progress={40} /> </Stack> <CardOverflow sx={{ borderTop: '1px solid', borderColor: 'divider' }}> <CardActions sx={{ alignSelf: 'flex-end', pt: 2 }}> <Button size="sm" variant="outlined" color="neutral"> Cancel </Button> <Button size="sm" variant="solid"> Save </Button> </CardActions> </CardOverflow> </Card> </Stack> </Box> ); }
1,913
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/profile-dashboard/components/Sidebar.tsx
import * as React from 'react'; import GlobalStyles from '@mui/joy/GlobalStyles'; import Avatar from '@mui/joy/Avatar'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Card from '@mui/joy/Card'; import Chip from '@mui/joy/Chip'; import Divider from '@mui/joy/Divider'; import IconButton from '@mui/joy/IconButton'; import Input from '@mui/joy/Input'; import LinearProgress from '@mui/joy/LinearProgress'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemButton, { listItemButtonClasses } from '@mui/joy/ListItemButton'; import ListItemContent from '@mui/joy/ListItemContent'; import Typography from '@mui/joy/Typography'; import Sheet from '@mui/joy/Sheet'; import Stack from '@mui/joy/Stack'; import SearchRoundedIcon from '@mui/icons-material/SearchRounded'; import HomeRoundedIcon from '@mui/icons-material/HomeRounded'; import DashboardRoundedIcon from '@mui/icons-material/DashboardRounded'; import ShoppingCartRoundedIcon from '@mui/icons-material/ShoppingCartRounded'; import AssignmentRoundedIcon from '@mui/icons-material/AssignmentRounded'; import QuestionAnswerRoundedIcon from '@mui/icons-material/QuestionAnswerRounded'; import GroupRoundedIcon from '@mui/icons-material/GroupRounded'; import SupportRoundedIcon from '@mui/icons-material/SupportRounded'; import SettingsRoundedIcon from '@mui/icons-material/SettingsRounded'; import CloseRoundedIcon from '@mui/icons-material/CloseRounded'; import LogoutRoundedIcon from '@mui/icons-material/LogoutRounded'; import BrightnessAutoRoundedIcon from '@mui/icons-material/BrightnessAutoRounded'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; import ColorSchemeToggle from './ColorSchemeToggle'; import { closeSidebar } from '../utils'; function Toggler({ defaultExpanded = false, renderToggle, children, }: { defaultExpanded?: boolean; children: React.ReactNode; renderToggle: (params: { open: boolean; setOpen: React.Dispatch<React.SetStateAction<boolean>>; }) => React.ReactNode; }) { const [open, setOpen] = React.useState(defaultExpanded); return ( <React.Fragment> {renderToggle({ open, setOpen })} <Box sx={{ display: 'grid', gridTemplateRows: open ? '1fr' : '0fr', transition: '0.2s ease', '& > *': { overflow: 'hidden', }, }} > {children} </Box> </React.Fragment> ); } export default function Sidebar() { return ( <Sheet className="Sidebar" sx={{ position: { xs: 'fixed', md: 'sticky', }, transform: { xs: 'translateX(calc(100% * (var(--SideNavigation-slideIn, 0) - 1)))', md: 'none', }, transition: 'transform 0.4s, width 0.4s', zIndex: 10000, height: '100dvh', width: 'var(--Sidebar-width)', top: 0, p: 2, flexShrink: 0, display: 'flex', flexDirection: 'column', gap: 2, borderRight: '1px solid', borderColor: 'divider', }} > <GlobalStyles styles={(theme) => ({ ':root': { '--Sidebar-width': '220px', [theme.breakpoints.up('lg')]: { '--Sidebar-width': '240px', }, }, })} /> <Box className="Sidebar-overlay" sx={{ position: 'fixed', zIndex: 9998, top: 0, left: 0, width: '100vw', height: '100vh', opacity: 'var(--SideNavigation-slideIn)', backgroundColor: 'var(--joy-palette-background-backdrop)', transition: 'opacity 0.4s', transform: { xs: 'translateX(calc(100% * (var(--SideNavigation-slideIn, 0) - 1) + var(--SideNavigation-slideIn, 0) * var(--Sidebar-width, 0px)))', lg: 'translateX(-100%)', }, }} onClick={() => closeSidebar()} /> <Box sx={{ display: 'flex', gap: 1, alignItems: 'center' }}> <IconButton variant="soft" color="primary" size="sm"> <BrightnessAutoRoundedIcon /> </IconButton> <Typography level="title-lg">Acme Co.</Typography> <ColorSchemeToggle sx={{ ml: 'auto' }} /> </Box> <Input size="sm" startDecorator={<SearchRoundedIcon />} placeholder="Search" /> <Box sx={{ minHeight: 0, overflow: 'hidden auto', flexGrow: 1, display: 'flex', flexDirection: 'column', [`& .${listItemButtonClasses.root}`]: { gap: 1.5, }, }} > <List size="sm" sx={{ gap: 1, '--List-nestedInsetStart': '30px', '--ListItem-radius': (theme) => theme.vars.radius.sm, }} > <ListItem> <ListItemButton> <HomeRoundedIcon /> <ListItemContent> <Typography level="title-sm">Home</Typography> </ListItemContent> </ListItemButton> </ListItem> <ListItem> <ListItemButton> <DashboardRoundedIcon /> <ListItemContent> <Typography level="title-sm">Dashboard</Typography> </ListItemContent> </ListItemButton> </ListItem> <ListItem> <ListItemButton role="menuitem" component="a" href="/joy-ui/getting-started/templates/order-dashboard/" > <ShoppingCartRoundedIcon /> <ListItemContent> <Typography level="title-sm">Orders</Typography> </ListItemContent> </ListItemButton> </ListItem> <ListItem nested> <Toggler renderToggle={({ open, setOpen }) => ( <ListItemButton onClick={() => setOpen(!open)}> <AssignmentRoundedIcon /> <ListItemContent> <Typography level="title-sm">Tasks</Typography> </ListItemContent> <KeyboardArrowDownIcon sx={{ transform: open ? 'rotate(180deg)' : 'none' }} /> </ListItemButton> )} > <List sx={{ gap: 0.5 }}> <ListItem sx={{ mt: 0.5 }}> <ListItemButton>All tasks</ListItemButton> </ListItem> <ListItem> <ListItemButton>Backlog</ListItemButton> </ListItem> <ListItem> <ListItemButton>In progress</ListItemButton> </ListItem> <ListItem> <ListItemButton>Done</ListItemButton> </ListItem> </List> </Toggler> </ListItem> <ListItem> <ListItemButton role="menuitem" component="a" href="/joy-ui/getting-started/templates/messages/" > <QuestionAnswerRoundedIcon /> <ListItemContent> <Typography level="title-sm">Messages</Typography> </ListItemContent> <Chip size="sm" color="primary" variant="solid"> 4 </Chip> </ListItemButton> </ListItem> <ListItem nested> <Toggler defaultExpanded renderToggle={({ open, setOpen }) => ( <ListItemButton onClick={() => setOpen(!open)}> <GroupRoundedIcon /> <ListItemContent> <Typography level="title-sm">Users</Typography> </ListItemContent> <KeyboardArrowDownIcon sx={{ transform: open ? 'rotate(180deg)' : 'none' }} /> </ListItemButton> )} > <List sx={{ gap: 0.5 }}> <ListItem sx={{ mt: 0.5 }}> <ListItemButton selected>My profile</ListItemButton> </ListItem> <ListItem> <ListItemButton>Create a new user</ListItemButton> </ListItem> <ListItem> <ListItemButton>Roles & permission</ListItemButton> </ListItem> </List> </Toggler> </ListItem> </List> <List size="sm" sx={{ mt: 'auto', flexGrow: 0, '--ListItem-radius': (theme) => theme.vars.radius.sm, '--List-gap': '8px', mb: 2, }} > <ListItem> <ListItemButton> <SupportRoundedIcon /> Support </ListItemButton> </ListItem> <ListItem> <ListItemButton> <SettingsRoundedIcon /> Settings </ListItemButton> </ListItem> </List> <Card invertedColors variant="soft" color="warning" size="sm" sx={{ boxShadow: 'none' }} > <Stack direction="row" justifyContent="space-between" alignItems="center"> <Typography level="title-sm">Used space</Typography> <IconButton size="sm"> <CloseRoundedIcon /> </IconButton> </Stack> <Typography level="body-xs"> Your team has used 80% of your available space. Need more? </Typography> <LinearProgress variant="outlined" value={80} determinate sx={{ my: 1 }} /> <Button size="sm" variant="solid"> Upgrade plan </Button> </Card> </Box> <Divider /> <Box sx={{ display: 'flex', gap: 1, alignItems: 'center' }}> <Avatar variant="outlined" size="sm" src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=286" /> <Box sx={{ minWidth: 0, flex: 1 }}> <Typography level="title-sm">Siriwat K.</Typography> <Typography level="body-xs">[email protected]</Typography> </Box> <IconButton size="sm" variant="plain" color="neutral"> <LogoutRoundedIcon /> </IconButton> </Box> </Sheet> ); }
1,914
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard/App.tsx
import * as React from 'react'; import { CssVarsProvider } from '@mui/joy/styles'; import CssBaseline from '@mui/joy/CssBaseline'; import Box from '@mui/joy/Box'; import Stack from '@mui/joy/Stack'; import NavBar from './components/NavBar'; import RentalCard from './components/RentalCard'; import HeaderSection from './components/HeaderSection'; import Search from './components/Search'; import Filters from './components/Filters'; import Pagination from './components/Pagination'; export default function RentalDashboard() { return ( <CssVarsProvider disableTransitionOnChange> <CssBaseline /> <NavBar /> <Box component="main" sx={{ height: 'calc(100vh - 55px)', // 55px is the height of the NavBar display: 'grid', gridTemplateColumns: { xs: 'auto', md: '60% 40%' }, gridTemplateRows: 'auto 1fr auto', }} > <Stack sx={{ backgroundColor: 'background.surface', px: { xs: 2, md: 4 }, py: 2, borderBottom: '1px solid', borderColor: 'divider', }} > <HeaderSection /> <Search /> </Stack> <Box sx={{ gridRow: 'span 3', display: { xs: 'none', md: 'flex' }, backgroundColor: 'background.level1', backgroundSize: 'cover', backgroundImage: 'url("https://images.unsplash.com/photo-1569336415962-a4bd9f69cd83?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3731&q=80")', }} /> <Stack spacing={2} sx={{ px: { xs: 2, md: 4 }, pt: 2, minHeight: 0 }}> <Filters /> <Stack spacing={2} sx={{ overflow: 'auto' }}> <RentalCard title="A Stylish Apt, 5 min walk to Queen Victoria Market" category="Entire apartment rental in Collingwood" rareFind image="https://images.unsplash.com/photo-1568605114967-8130f3a36994?auto=format&fit=crop&w=400" /> <RentalCard title="Designer NY style loft" category="Entire loft in central business district" liked image="https://images.unsplash.com/photo-1600596542815-ffad4c1539a9?auto=format&fit=crop&w=400" /> <RentalCard title="5 minute walk from University of Melbourne" category="Entire rental unit in Carlton" image="https://images.unsplash.com/photo-1537726235470-8504e3beef77?auto=format&fit=crop&w=400" /> <RentalCard title="Magnificent apartment next to public transport" category="Entire apartment rental in Collingwood" image="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?auto=format&fit=crop&w=400" /> <RentalCard title="Next to shoppng mall and public transport" category="Entire apartment rental in Collingwood" image="https://images.unsplash.com/photo-1582268611958-ebfd161ef9cf?auto=format&fit=crop&w=400" /> <RentalCard title="Endless ocean view" category="A private room in a shared apartment in Docklands" image="https://images.unsplash.com/photo-1564013799919-ab600027ffc6?auto=format&fit=crop&w=400" /> <RentalCard title="A Stylish Apt, 5 min walk to Queen Victoria Market" category="one bedroom apartment in Collingwood" image="https://images.unsplash.com/photo-1481437156560-3205f6a55735?auto=format&fit=crop&w=400" /> </Stack> </Stack> <Pagination /> </Box> </CssVarsProvider> ); }
1,915
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard/components/ColorSchemeToggle.tsx
import * as React from 'react'; import { useColorScheme } from '@mui/joy/styles'; import IconButton, { IconButtonProps } from '@mui/joy/IconButton'; import DarkModeRoundedIcon from '@mui/icons-material/DarkModeRounded'; import LightModeIcon from '@mui/icons-material/LightMode'; export default function ColorSchemeToggle({ onClick, sx, ...props }: IconButtonProps) { const { mode, setMode } = useColorScheme(); const [mounted, setMounted] = React.useState(false); React.useEffect(() => { setMounted(true); }, []); if (!mounted) { return ( <IconButton size="sm" variant="outlined" color="neutral" {...props} sx={sx} disabled /> ); } return ( <IconButton id="toggle-mode" size="sm" variant="outlined" color="neutral" {...props} onClick={(event) => { if (mode === 'light') { setMode('dark'); } else { setMode('light'); } onClick?.(event); }} sx={[ { '& > *:first-of-type': { display: mode === 'dark' ? 'none' : 'initial', }, '& > *:last-of-type': { display: mode === 'light' ? 'none' : 'initial', }, }, ...(Array.isArray(sx) ? sx : [sx]), ]} > <DarkModeRoundedIcon /> <LightModeIcon /> </IconButton> ); }
1,916
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard/components/CountrySelector.tsx
import * as React from 'react'; import Autocomplete from '@mui/joy/Autocomplete'; import AutocompleteOption from '@mui/joy/AutocompleteOption'; import AspectRatio from '@mui/joy/AspectRatio'; import FormControl, { FormControlProps } from '@mui/joy/FormControl'; import FormLabel from '@mui/joy/FormLabel'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import Typography from '@mui/joy/Typography'; export default function ContrySelector({ sx, ...props }: FormControlProps) { return ( <FormControl {...props} sx={sx}> <FormLabel>Country</FormLabel> <Autocomplete autoHighlight isOptionEqualToValue={(option, value) => option.code === value.code} defaultValue={{ code: 'AU', label: 'Australia', phone: '61' }} options={countries} renderOption={(optionProps, option) => ( <AutocompleteOption {...optionProps}> <ListItemDecorator> <AspectRatio ratio="1" sx={{ minWidth: 20, borderRadius: '50%' }}> <img loading="lazy" width="20" srcSet={`https://flagcdn.com/w40/${option.code.toLowerCase()}.png 2x`} src={`https://flagcdn.com/w20/${option.code.toLowerCase()}.png`} alt="" /> </AspectRatio> </ListItemDecorator> {option.label} <Typography component="span" textColor="text.tertiary" ml={0.5}> (+{option.phone}) </Typography> </AutocompleteOption> )} slotProps={{ input: { autoComplete: 'new-password', // disable autocomplete and autofill }, }} /> </FormControl> ); } interface CountryType { code: string; label: string; phone: string; suggested?: boolean; } // From https://bitbucket.org/atlassian/atlaskit-mk-2/raw/4ad0e56649c3e6c973e226b7efaeb28cb240ccb0/packages/core/select/src/data/countries.js const countries: readonly CountryType[] = [ { code: 'AD', label: 'Andorra', phone: '376' }, { code: 'AE', label: 'United Arab Emirates', phone: '971', }, { code: 'AF', label: 'Afghanistan', phone: '93' }, { code: 'AG', label: 'Antigua and Barbuda', phone: '1-268', }, { code: 'AI', label: 'Anguilla', phone: '1-264' }, { code: 'AL', label: 'Albania', phone: '355' }, { code: 'AM', label: 'Armenia', phone: '374' }, { code: 'AO', label: 'Angola', phone: '244' }, { code: 'AQ', label: 'Antarctica', phone: '672' }, { code: 'AR', label: 'Argentina', phone: '54' }, { code: 'AS', label: 'American Samoa', phone: '1-684' }, { code: 'AT', label: 'Austria', phone: '43' }, { code: 'AU', label: 'Australia', phone: '61', suggested: true, }, { code: 'AW', label: 'Aruba', phone: '297' }, { code: 'AX', label: 'Alland Islands', phone: '358' }, { code: 'AZ', label: 'Azerbaijan', phone: '994' }, { code: 'BA', label: 'Bosnia and Herzegovina', phone: '387', }, { code: 'BB', label: 'Barbados', phone: '1-246' }, { code: 'BD', label: 'Bangladesh', phone: '880' }, { code: 'BE', label: 'Belgium', phone: '32' }, { code: 'BF', label: 'Burkina Faso', phone: '226' }, { code: 'BG', label: 'Bulgaria', phone: '359' }, { code: 'BH', label: 'Bahrain', phone: '973' }, { code: 'BI', label: 'Burundi', phone: '257' }, { code: 'BJ', label: 'Benin', phone: '229' }, { code: 'BL', label: 'Saint Barthelemy', phone: '590' }, { code: 'BM', label: 'Bermuda', phone: '1-441' }, { code: 'BN', label: 'Brunei Darussalam', phone: '673' }, { code: 'BO', label: 'Bolivia', phone: '591' }, { code: 'BR', label: 'Brazil', phone: '55' }, { code: 'BS', label: 'Bahamas', phone: '1-242' }, { code: 'BT', label: 'Bhutan', phone: '975' }, { code: 'BV', label: 'Bouvet Island', phone: '47' }, { code: 'BW', label: 'Botswana', phone: '267' }, { code: 'BY', label: 'Belarus', phone: '375' }, { code: 'BZ', label: 'Belize', phone: '501' }, { code: 'CA', label: 'Canada', phone: '1', suggested: true, }, { code: 'CC', label: 'Cocos (Keeling) Islands', phone: '61', }, { code: 'CD', label: 'Congo, Democratic Republic of the', phone: '243', }, { code: 'CF', label: 'Central African Republic', phone: '236', }, { code: 'CG', label: 'Congo, Republic of the', phone: '242', }, { code: 'CH', label: 'Switzerland', phone: '41' }, { code: 'CI', label: "Cote d'Ivoire", phone: '225' }, { code: 'CK', label: 'Cook Islands', phone: '682' }, { code: 'CL', label: 'Chile', phone: '56' }, { code: 'CM', label: 'Cameroon', phone: '237' }, { code: 'CN', label: 'China', phone: '86' }, { code: 'CO', label: 'Colombia', phone: '57' }, { code: 'CR', label: 'Costa Rica', phone: '506' }, { code: 'CU', label: 'Cuba', phone: '53' }, { code: 'CV', label: 'Cape Verde', phone: '238' }, { code: 'CW', label: 'Curacao', phone: '599' }, { code: 'CX', label: 'Christmas Island', phone: '61' }, { code: 'CY', label: 'Cyprus', phone: '357' }, { code: 'CZ', label: 'Czech Republic', phone: '420' }, { code: 'DE', label: 'Germany', phone: '49', suggested: true, }, { code: 'DJ', label: 'Djibouti', phone: '253' }, { code: 'DK', label: 'Denmark', phone: '45' }, { code: 'DM', label: 'Dominica', phone: '1-767' }, { code: 'DO', label: 'Dominican Republic', phone: '1-809', }, { code: 'DZ', label: 'Algeria', phone: '213' }, { code: 'EC', label: 'Ecuador', phone: '593' }, { code: 'EE', label: 'Estonia', phone: '372' }, { code: 'EG', label: 'Egypt', phone: '20' }, { code: 'EH', label: 'Western Sahara', phone: '212' }, { code: 'ER', label: 'Eritrea', phone: '291' }, { code: 'ES', label: 'Spain', phone: '34' }, { code: 'ET', label: 'Ethiopia', phone: '251' }, { code: 'FI', label: 'Finland', phone: '358' }, { code: 'FJ', label: 'Fiji', phone: '679' }, { code: 'FK', label: 'Falkland Islands (Malvinas)', phone: '500', }, { code: 'FM', label: 'Micronesia, Federated States of', phone: '691', }, { code: 'FO', label: 'Faroe Islands', phone: '298' }, { code: 'FR', label: 'France', phone: '33', suggested: true, }, { code: 'GA', label: 'Gabon', phone: '241' }, { code: 'GB', label: 'United Kingdom', phone: '44' }, { code: 'GD', label: 'Grenada', phone: '1-473' }, { code: 'GE', label: 'Georgia', phone: '995' }, { code: 'GF', label: 'French Guiana', phone: '594' }, { code: 'GG', label: 'Guernsey', phone: '44' }, { code: 'GH', label: 'Ghana', phone: '233' }, { code: 'GI', label: 'Gibraltar', phone: '350' }, { code: 'GL', label: 'Greenland', phone: '299' }, { code: 'GM', label: 'Gambia', phone: '220' }, { code: 'GN', label: 'Guinea', phone: '224' }, { code: 'GP', label: 'Guadeloupe', phone: '590' }, { code: 'GQ', label: 'Equatorial Guinea', phone: '240' }, { code: 'GR', label: 'Greece', phone: '30' }, { code: 'GS', label: 'South Georgia and the South Sandwich Islands', phone: '500', }, { code: 'GT', label: 'Guatemala', phone: '502' }, { code: 'GU', label: 'Guam', phone: '1-671' }, { code: 'GW', label: 'Guinea-Bissau', phone: '245' }, { code: 'GY', label: 'Guyana', phone: '592' }, { code: 'HK', label: 'Hong Kong', phone: '852' }, { code: 'HM', label: 'Heard Island and McDonald Islands', phone: '672', }, { code: 'HN', label: 'Honduras', phone: '504' }, { code: 'HR', label: 'Croatia', phone: '385' }, { code: 'HT', label: 'Haiti', phone: '509' }, { code: 'HU', label: 'Hungary', phone: '36' }, { code: 'ID', label: 'Indonesia', phone: '62' }, { code: 'IE', label: 'Ireland', phone: '353' }, { code: 'IL', label: 'Israel', phone: '972' }, { code: 'IM', label: 'Isle of Man', phone: '44' }, { code: 'IN', label: 'India', phone: '91' }, { code: 'IO', label: 'British Indian Ocean Territory', phone: '246', }, { code: 'IQ', label: 'Iraq', phone: '964' }, { code: 'IR', label: 'Iran, Islamic Republic of', phone: '98', }, { code: 'IS', label: 'Iceland', phone: '354' }, { code: 'IT', label: 'Italy', phone: '39' }, { code: 'JE', label: 'Jersey', phone: '44' }, { code: 'JM', label: 'Jamaica', phone: '1-876' }, { code: 'JO', label: 'Jordan', phone: '962' }, { code: 'JP', label: 'Japan', phone: '81', suggested: true, }, { code: 'KE', label: 'Kenya', phone: '254' }, { code: 'KG', label: 'Kyrgyzstan', phone: '996' }, { code: 'KH', label: 'Cambodia', phone: '855' }, { code: 'KI', label: 'Kiribati', phone: '686' }, { code: 'KM', label: 'Comoros', phone: '269' }, { code: 'KN', label: 'Saint Kitts and Nevis', phone: '1-869', }, { code: 'KP', label: "Korea, Democratic People's Republic of", phone: '850', }, { code: 'KR', label: 'Korea, Republic of', phone: '82' }, { code: 'KW', label: 'Kuwait', phone: '965' }, { code: 'KY', label: 'Cayman Islands', phone: '1-345' }, { code: 'KZ', label: 'Kazakhstan', phone: '7' }, { code: 'LA', label: "Lao People's Democratic Republic", phone: '856', }, { code: 'LB', label: 'Lebanon', phone: '961' }, { code: 'LC', label: 'Saint Lucia', phone: '1-758' }, { code: 'LI', label: 'Liechtenstein', phone: '423' }, { code: 'LK', label: 'Sri Lanka', phone: '94' }, { code: 'LR', label: 'Liberia', phone: '231' }, { code: 'LS', label: 'Lesotho', phone: '266' }, { code: 'LT', label: 'Lithuania', phone: '370' }, { code: 'LU', label: 'Luxembourg', phone: '352' }, { code: 'LV', label: 'Latvia', phone: '371' }, { code: 'LY', label: 'Libya', phone: '218' }, { code: 'MA', label: 'Morocco', phone: '212' }, { code: 'MC', label: 'Monaco', phone: '377' }, { code: 'MD', label: 'Moldova, Republic of', phone: '373', }, { code: 'ME', label: 'Montenegro', phone: '382' }, { code: 'MF', label: 'Saint Martin (French part)', phone: '590', }, { code: 'MG', label: 'Madagascar', phone: '261' }, { code: 'MH', label: 'Marshall Islands', phone: '692' }, { code: 'MK', label: 'Macedonia, the Former Yugoslav Republic of', phone: '389', }, { code: 'ML', label: 'Mali', phone: '223' }, { code: 'MM', label: 'Myanmar', phone: '95' }, { code: 'MN', label: 'Mongolia', phone: '976' }, { code: 'MO', label: 'Macao', phone: '853' }, { code: 'MP', label: 'Northern Mariana Islands', phone: '1-670', }, { code: 'MQ', label: 'Martinique', phone: '596' }, { code: 'MR', label: 'Mauritania', phone: '222' }, { code: 'MS', label: 'Montserrat', phone: '1-664' }, { code: 'MT', label: 'Malta', phone: '356' }, { code: 'MU', label: 'Mauritius', phone: '230' }, { code: 'MV', label: 'Maldives', phone: '960' }, { code: 'MW', label: 'Malawi', phone: '265' }, { code: 'MX', label: 'Mexico', phone: '52' }, { code: 'MY', label: 'Malaysia', phone: '60' }, { code: 'MZ', label: 'Mozambique', phone: '258' }, { code: 'NA', label: 'Namibia', phone: '264' }, { code: 'NC', label: 'New Caledonia', phone: '687' }, { code: 'NE', label: 'Niger', phone: '227' }, { code: 'NF', label: 'Norfolk Island', phone: '672' }, { code: 'NG', label: 'Nigeria', phone: '234' }, { code: 'NI', label: 'Nicaragua', phone: '505' }, { code: 'NL', label: 'Netherlands', phone: '31' }, { code: 'NO', label: 'Norway', phone: '47' }, { code: 'NP', label: 'Nepal', phone: '977' }, { code: 'NR', label: 'Nauru', phone: '674' }, { code: 'NU', label: 'Niue', phone: '683' }, { code: 'NZ', label: 'New Zealand', phone: '64' }, { code: 'OM', label: 'Oman', phone: '968' }, { code: 'PA', label: 'Panama', phone: '507' }, { code: 'PE', label: 'Peru', phone: '51' }, { code: 'PF', label: 'French Polynesia', phone: '689' }, { code: 'PG', label: 'Papua New Guinea', phone: '675' }, { code: 'PH', label: 'Philippines', phone: '63' }, { code: 'PK', label: 'Pakistan', phone: '92' }, { code: 'PL', label: 'Poland', phone: '48' }, { code: 'PM', label: 'Saint Pierre and Miquelon', phone: '508', }, { code: 'PN', label: 'Pitcairn', phone: '870' }, { code: 'PR', label: 'Puerto Rico', phone: '1' }, { code: 'PS', label: 'Palestine, State of', phone: '970', }, { code: 'PT', label: 'Portugal', phone: '351' }, { code: 'PW', label: 'Palau', phone: '680' }, { code: 'PY', label: 'Paraguay', phone: '595' }, { code: 'QA', label: 'Qatar', phone: '974' }, { code: 'RE', label: 'Reunion', phone: '262' }, { code: 'RO', label: 'Romania', phone: '40' }, { code: 'RS', label: 'Serbia', phone: '381' }, { code: 'RU', label: 'Russian Federation', phone: '7' }, { code: 'RW', label: 'Rwanda', phone: '250' }, { code: 'SA', label: 'Saudi Arabia', phone: '966' }, { code: 'SB', label: 'Solomon Islands', phone: '677' }, { code: 'SC', label: 'Seychelles', phone: '248' }, { code: 'SD', label: 'Sudan', phone: '249' }, { code: 'SE', label: 'Sweden', phone: '46' }, { code: 'SG', label: 'Singapore', phone: '65' }, { code: 'SH', label: 'Saint Helena', phone: '290' }, { code: 'SI', label: 'Slovenia', phone: '386' }, { code: 'SJ', label: 'Svalbard and Jan Mayen', phone: '47', }, { code: 'SK', label: 'Slovakia', phone: '421' }, { code: 'SL', label: 'Sierra Leone', phone: '232' }, { code: 'SM', label: 'San Marino', phone: '378' }, { code: 'SN', label: 'Senegal', phone: '221' }, { code: 'SO', label: 'Somalia', phone: '252' }, { code: 'SR', label: 'Suriname', phone: '597' }, { code: 'SS', label: 'South Sudan', phone: '211' }, { code: 'ST', label: 'Sao Tome and Principe', phone: '239', }, { code: 'SV', label: 'El Salvador', phone: '503' }, { code: 'SX', label: 'Sint Maarten (Dutch part)', phone: '1-721', }, { code: 'SY', label: 'Syrian Arab Republic', phone: '963', }, { code: 'SZ', label: 'Swaziland', phone: '268' }, { code: 'TC', label: 'Turks and Caicos Islands', phone: '1-649', }, { code: 'TD', label: 'Chad', phone: '235' }, { code: 'TF', label: 'French Southern Territories', phone: '262', }, { code: 'TG', label: 'Togo', phone: '228' }, { code: 'TH', label: 'Thailand', phone: '66' }, { code: 'TJ', label: 'Tajikistan', phone: '992' }, { code: 'TK', label: 'Tokelau', phone: '690' }, { code: 'TL', label: 'Timor-Leste', phone: '670' }, { code: 'TM', label: 'Turkmenistan', phone: '993' }, { code: 'TN', label: 'Tunisia', phone: '216' }, { code: 'TO', label: 'Tonga', phone: '676' }, { code: 'TR', label: 'Turkey', phone: '90' }, { code: 'TT', label: 'Trinidad and Tobago', phone: '1-868', }, { code: 'TV', label: 'Tuvalu', phone: '688' }, { code: 'TW', label: 'Taiwan', phone: '886', }, { code: 'TZ', label: 'United Republic of Tanzania', phone: '255', }, { code: 'UA', label: 'Ukraine', phone: '380' }, { code: 'UG', label: 'Uganda', phone: '256' }, { code: 'US', label: 'United States', phone: '1', suggested: true, }, { code: 'UY', label: 'Uruguay', phone: '598' }, { code: 'UZ', label: 'Uzbekistan', phone: '998' }, { code: 'VA', label: 'Holy See (Vatican City State)', phone: '379', }, { code: 'VC', label: 'Saint Vincent and the Grenadines', phone: '1-784', }, { code: 'VE', label: 'Venezuela', phone: '58' }, { code: 'VG', label: 'British Virgin Islands', phone: '1-284', }, { code: 'VI', label: 'US Virgin Islands', phone: '1-340', }, { code: 'VN', label: 'Vietnam', phone: '84' }, { code: 'VU', label: 'Vanuatu', phone: '678' }, { code: 'WF', label: 'Wallis and Futuna', phone: '681' }, { code: 'WS', label: 'Samoa', phone: '685' }, { code: 'XK', label: 'Kosovo', phone: '383' }, { code: 'YE', label: 'Yemen', phone: '967' }, { code: 'YT', label: 'Mayotte', phone: '262' }, { code: 'ZA', label: 'South Africa', phone: '27' }, { code: 'ZM', label: 'Zambia', phone: '260' }, { code: 'ZW', label: 'Zimbabwe', phone: '263' }, ];
1,917
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard/components/Filters.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Drawer from '@mui/joy/Drawer'; import DialogTitle from '@mui/joy/DialogTitle'; import FormControl from '@mui/joy/FormControl'; import FormLabel from '@mui/joy/FormLabel'; import Input from '@mui/joy/Input'; import ModalClose from '@mui/joy/ModalClose'; import Stack from '@mui/joy/Stack'; import Slider, { sliderClasses } from '@mui/joy/Slider'; import FilterAltOutlined from '@mui/icons-material/FilterAltOutlined'; import CountrySelector from './CountrySelector'; import OrderSelector from './OrderSelector'; function valueText(value: number) { return `$${value.toLocaleString('en-US')}`; } export default function Filters() { const [open, setOpen] = React.useState(false); return ( <Stack useFlexGap direction="row" spacing={{ xs: 0, sm: 2 }} justifyContent={{ xs: 'space-between' }} flexWrap="wrap" sx={{ minWidth: 0 }} > <Button variant="outlined" color="neutral" startDecorator={<FilterAltOutlined />} onClick={() => setOpen(true)} > Filters </Button> <OrderSelector /> <Drawer open={open} onClose={() => setOpen(false)}> <Stack useFlexGap spacing={3} sx={{ p: 2 }}> <DialogTitle>Filters</DialogTitle> <ModalClose /> <CountrySelector /> <Box sx={{ display: 'grid', gridTemplateColumns: '1fr auto 1fr', gridTemplateRows: 'auto auto', gap: 1, }} > <FormLabel htmlFor="filters-start-date">Start date</FormLabel> <div /> <FormLabel htmlFor="filters-end-date">End date</FormLabel> <Input id="filters-start-date" type="date" placeholder="Jan 6 - Jan 13" aria-label="Date" /> <Box sx={{ alignSelf: 'center' }}>-</Box> <Input id="filters-end-date" type="date" placeholder="Jan 6 - Jan 13" aria-label="Date" /> </Box> <FormControl> <FormLabel>Price range</FormLabel> <Slider defaultValue={[2000, 4900]} step={100} min={0} max={10000} getAriaValueText={valueText} valueLabelDisplay="auto" valueLabelFormat={valueText} marks={[ { value: 0, label: '$0' }, { value: 5000, label: '$5,000' }, { value: 10000, label: '$10,000' }, ]} sx={{ [`& .${sliderClasses.markLabel}[data-index="0"]`]: { transform: 'none', }, [`& .${sliderClasses.markLabel}[data-index="2"]`]: { transform: 'translateX(-100%)', }, }} /> </FormControl> </Stack> </Drawer> </Stack> ); }
1,918
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard/components/HeaderSection.tsx
import * as React from 'react'; import Stack from '@mui/joy/Stack'; import Typography from '@mui/joy/Typography'; export default function HeaderSection() { return ( <Stack sx={{ mb: 2 }}> <Stack direction="row" justifyContent="space-between" sx={{ width: '100%' }}> <Typography level="h2">Rental properties</Typography> </Stack> <Typography level="body-md" color="neutral"> Book your next stay at one of our properties. </Typography> </Stack> ); }
1,919
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard/components/MuiLogo.tsx
import * as React from 'react'; import AspectRatio, { AspectRatioProps } from '@mui/joy/AspectRatio'; export default function MuiLogo({ sx, ...props }: AspectRatioProps) { return ( <AspectRatio ratio="1" variant="plain" {...props} sx={[ { width: 36, borderRadius: 'sm', }, ...(Array.isArray(sx) ? sx : [sx]), ]} > <div> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="20" viewBox="0 0 36 32" fill="none" > <path d="M30.343 21.976a1 1 0 00.502-.864l.018-5.787a1 1 0 01.502-.864l3.137-1.802a1 1 0 011.498.867v10.521a1 1 0 01-.502.867l-11.839 6.8a1 1 0 01-.994.001l-9.291-5.314a1 1 0 01-.504-.868v-5.305c0-.006.007-.01.013-.007.005.003.012 0 .012-.007v-.006c0-.004.002-.008.006-.01l7.652-4.396c.007-.004.004-.015-.004-.015a.008.008 0 01-.008-.008l.015-5.201a1 1 0 00-1.5-.87l-5.687 3.277a1 1 0 01-.998 0L6.666 9.7a1 1 0 00-1.499.866v9.4a1 1 0 01-1.496.869l-3.166-1.81a1 1 0 01-.504-.87l.028-16.43A1 1 0 011.527.86l10.845 6.229a1 1 0 00.996 0L24.21.86a1 1 0 011.498.868v16.434a1 1 0 01-.501.867l-5.678 3.27a1 1 0 00.004 1.735l3.132 1.783a1 1 0 00.993-.002l6.685-3.839zM31 7.234a1 1 0 001.514.857l3-1.8A1 1 0 0036 5.434V1.766A1 1 0 0034.486.91l-3 1.8a1 1 0 00-.486.857v3.668z" fill="#007FFF" /> </svg> </div> </AspectRatio> ); }
1,920
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard/components/NavBar.tsx
import * as React from 'react'; import { Box, IconButton } from '@mui/joy'; import Typography from '@mui/joy/Typography'; import Avatar from '@mui/joy/Avatar'; import MapsHomeWorkIcon from '@mui/icons-material/MapsHomeWork'; import ColorSchemeToggle from './ColorSchemeToggle'; export default function HeaderSection() { return ( <Box sx={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', width: '100%', top: 0, px: 1.5, py: 1, zIndex: 10000, backgroundColor: 'background.body', borderBottom: '1px solid', borderColor: 'divider', position: 'sticky', }} > <Box sx={{ display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 1.5, }} > <IconButton size="sm" variant="soft"> <MapsHomeWorkIcon /> </IconButton> <Typography component="h1" fontWeight="xl"> Acme Rental </Typography> </Box> <Box sx={{ display: 'flex', flexDirection: 'row', gap: 3 }}> <Box sx={{ gap: 1, alignItems: 'center', display: { xs: 'none', sm: 'flex' }, }} > <Avatar variant="outlined" size="sm" src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=286" /> <Box sx={{ minWidth: 0, flex: 1 }}> <Typography level="title-sm">Siriwat K.</Typography> <Typography level="body-xs">[email protected]</Typography> </Box> </Box> <ColorSchemeToggle sx={{ alignSelf: 'center' }} /> </Box> </Box> ); }
1,921
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard/components/OrderSelector.tsx
import * as React from 'react'; import MenuButton from '@mui/joy/MenuButton'; import Menu from '@mui/joy/Menu'; import MenuItem from '@mui/joy/MenuItem'; import ArrowDropDown from '@mui/icons-material/ArrowDropDown'; import Dropdown from '@mui/joy/Dropdown'; export default function OrderSelector() { return ( <Dropdown> <MenuButton variant="plain" color="primary" endDecorator={<ArrowDropDown />} sx={{ whiteSpace: 'nowrap' }} > Order by </MenuButton> <Menu sx={{ minWidth: 120 }}> <MenuItem>Price</MenuItem> <MenuItem>Date</MenuItem> <MenuItem>Rating</MenuItem> </Menu> </Dropdown> ); }
1,922
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard/components/Pagination.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import IconButton, { iconButtonClasses } from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; import ArrowBackIosRoundedIcon from '@mui/icons-material/ArrowBackIosRounded'; import ArrowForwardIosRoundedIcon from '@mui/icons-material/ArrowForwardIosRounded'; export default function Pagination() { return ( <div> <Box className="Pagination-mobile" sx={{ display: { xs: 'flex', md: 'none' }, alignItems: 'center', mx: 2, my: 1, }} > <IconButton aria-label="previous page" variant="outlined" color="neutral" size="sm" > <ArrowBackIosRoundedIcon /> </IconButton> <Typography level="body-sm" mx="auto"> Page 1 of 10 </Typography> <IconButton aria-label="next page" variant="outlined" color="neutral" size="sm" > <ArrowForwardIosRoundedIcon /> </IconButton> </Box> <Box className="Pagination-laptopUp" sx={{ gap: 1, [`& .${iconButtonClasses.root}`]: { borderRadius: '50%' }, display: { xs: 'none', md: 'flex', }, mx: 4, my: 2, }} > <Button size="sm" variant="plain" color="neutral" startDecorator={<ArrowBackIosRoundedIcon />} > Previous </Button> <Box sx={{ flex: 1 }} /> {['1', '2', '3', '…', '8', '9', '10'].map((page) => ( <IconButton key={page} size="sm" variant={Number(page) ? 'plain' : 'soft'} color="neutral" > {page} </IconButton> ))} <Box sx={{ flex: 1 }} /> <Button size="sm" variant="plain" color="neutral" endDecorator={<ArrowForwardIosRoundedIcon />} > Next </Button> </Box> </div> ); }
1,923
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard/components/Rating.tsx
import * as React from 'react'; import Typography from '@mui/joy/Typography'; import Star from '@mui/icons-material/Star'; export default function Rating() { return ( <Typography level="title-sm" startDecorator={ <React.Fragment> <Star sx={{ color: 'warning.400' }} /> <Star sx={{ color: 'warning.400' }} /> <Star sx={{ color: 'warning.400' }} /> <Star sx={{ color: 'warning.400' }} /> <Star sx={{ color: 'warning.200' }} /> </React.Fragment> } > 4.0 </Typography> ); }
1,924
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard/components/RentalCard.tsx
import * as React from 'react'; import AspectRatio from '@mui/joy/AspectRatio'; import Card from '@mui/joy/Card'; import CardContent from '@mui/joy/CardContent'; import CardOverflow from '@mui/joy/CardOverflow'; import Chip from '@mui/joy/Chip'; import IconButton from '@mui/joy/IconButton'; import Link from '@mui/joy/Link'; import Stack from '@mui/joy/Stack'; import Typography from '@mui/joy/Typography'; import WorkspacePremiumRoundedIcon from '@mui/icons-material/WorkspacePremiumRounded'; import FavoriteRoundedIcon from '@mui/icons-material/FavoriteRounded'; import FmdGoodRoundedIcon from '@mui/icons-material/FmdGoodRounded'; import KingBedRoundedIcon from '@mui/icons-material/KingBedRounded'; import WifiRoundedIcon from '@mui/icons-material/WifiRounded'; import Star from '@mui/icons-material/Star'; type RentalCardProps = { category: React.ReactNode; image: string; liked?: boolean; rareFind?: boolean; title: React.ReactNode; }; export default function RentalCard({ category, title, rareFind = false, liked = false, image, }: RentalCardProps) { const [isLiked, setIsLiked] = React.useState(liked); return ( <Card variant="outlined" orientation="horizontal" sx={{ bgcolor: 'neutral.softBg', display: 'flex', flexDirection: { xs: 'column', sm: 'row' }, '&:hover': { boxShadow: 'lg', borderColor: 'var(--joy-palette-neutral-outlinedDisabledBorder)', }, }} > <CardOverflow sx={{ mr: { xs: 'var(--CardOverflow-offset)', sm: 0 }, mb: { xs: 0, sm: 'var(--CardOverflow-offset)' }, '--AspectRatio-radius': { xs: 'calc(var(--CardOverflow-radius) - var(--variant-borderWidth, 0px)) calc(var(--CardOverflow-radius) - var(--variant-borderWidth, 0px)) 0 0', sm: 'calc(var(--CardOverflow-radius) - var(--variant-borderWidth, 0px)) 0 0 calc(var(--CardOverflow-radius) - var(--variant-borderWidth, 0px))', }, }} > <AspectRatio ratio="1" flex sx={{ minWidth: { sm: 120, md: 160 }, '--AspectRatio-maxHeight': { xs: '160px', sm: '9999px' }, }} > <img alt="" src={image} /> <Stack alignItems="center" direction="row" sx={{ position: 'absolute', top: 0, width: '100%', p: 1 }} > {rareFind && ( <Chip variant="soft" color="success" startDecorator={<WorkspacePremiumRoundedIcon />} size="md" > Rare find </Chip> )} <IconButton variant="plain" size="sm" color={isLiked ? 'danger' : 'neutral'} onClick={() => setIsLiked((prev) => !prev)} sx={{ display: { xs: 'flex', sm: 'none' }, ml: 'auto', borderRadius: '50%', zIndex: '20', }} > <FavoriteRoundedIcon /> </IconButton> </Stack> </AspectRatio> </CardOverflow> <CardContent> <Stack spacing={1} direction="row" justifyContent="space-between" alignItems="flex-start" > <div> <Typography level="body-sm">{category}</Typography> <Typography level="title-md"> <Link overlay underline="none" href="#interactive-card" sx={{ color: 'text.primary' }} > {title} </Link> </Typography> </div> <IconButton variant="plain" size="sm" color={isLiked ? 'danger' : 'neutral'} onClick={() => setIsLiked((prev) => !prev)} sx={{ display: { xs: 'none', sm: 'flex' }, borderRadius: '50%', }} > <FavoriteRoundedIcon /> </IconButton> </Stack> <Stack spacing="0.25rem 1rem" direction="row" useFlexGap flexWrap="wrap" sx={{ my: 0.25 }} > <Typography level="body-xs" startDecorator={<FmdGoodRoundedIcon />}> Collingwood VIC </Typography> <Typography level="body-xs" startDecorator={<KingBedRoundedIcon />}> 1 bed </Typography> <Typography level="body-xs" startDecorator={<WifiRoundedIcon />}> Wi-Fi </Typography> </Stack> <Stack direction="row" sx={{ mt: 'auto' }}> <Typography level="title-sm" startDecorator={ <React.Fragment> <Star sx={{ color: 'warning.400' }} /> <Star sx={{ color: 'warning.400' }} /> <Star sx={{ color: 'warning.400' }} /> <Star sx={{ color: 'warning.400' }} /> <Star sx={{ color: 'warning.200' }} /> </React.Fragment> } sx={{ display: 'flex', gap: 1 }} > 4.0 </Typography> <Typography level="title-lg" sx={{ flexGrow: 1, textAlign: 'right' }}> <strong>$540</strong> <Typography level="body-md">total</Typography> </Typography> </Stack> </CardContent> </Card> ); }
1,925
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard/components/Search.tsx
import * as React from 'react'; import Button from '@mui/joy/Button'; import FormControl from '@mui/joy/FormControl'; import Input from '@mui/joy/Input'; import Stack from '@mui/joy/Stack'; import SearchRoundedIcon from '@mui/icons-material/SearchRounded'; import Typography from '@mui/joy/Typography'; export default function Search() { return ( <div> <Stack spacing={1} direction="row" sx={{ mb: 2 }}> <FormControl sx={{ flex: 1 }}> <Input placeholder="Search" value={'Melbourne'} startDecorator={<SearchRoundedIcon />} aria-label="Search" /> </FormControl> <Button variant="solid" color="primary"> Search </Button> </Stack> <Typography level="body-sm">232 stays in Melbourne, Australia</Typography> </div> ); }
1,926
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/rental-dashboard/components/ToggleGroup.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import Radio, { radioClasses } from '@mui/joy/Radio'; import RadioGroup from '@mui/joy/RadioGroup'; type Option = { label: React.ReactNode; value: string; }; type ToggleGroupProps = { options: Option[]; }; export default function ToggleGroup({ options }: ToggleGroupProps) { const [selectedOption, setSelectedOption] = React.useState(options[0].value); return ( <RadioGroup orientation="horizontal" aria-label="Alignment" name="alignment" variant="outlined" value={selectedOption} onChange={(event: React.ChangeEvent<HTMLInputElement>) => setSelectedOption(event.target.value) } > {options.map((option, index) => ( <Box key={option.value} sx={(theme) => ({ position: 'relative', display: 'flex', justifyContent: 'center', alignItems: 'center', height: 40, paddingX: 2, '&:not([data-first-child])': { borderLeft: '1px solid', borderColor: 'divider', }, [`&[data-first-child] .${radioClasses.action}`]: { borderTopLeftRadius: `calc(${theme.vars.radius.sm} - 1px)`, borderBottomLeftRadius: `calc(${theme.vars.radius.sm} - 1px)`, }, [`&[data-last-child] .${radioClasses.action}`]: { borderTopRightRadius: `calc(${theme.vars.radius.sm} - 1px)`, borderBottomRightRadius: `calc(${theme.vars.radius.sm} - 1px)`, }, })} data-first-child={index === 0 ? true : undefined} data-last-child={index === options.length - 1 ? true : undefined} > <Radio value={option.value} disableIcon overlay label={option.label} color="neutral" variant={selectedOption === option.value ? 'soft' : 'plain'} slotProps={{ input: { 'aria-label': option.value }, action: { sx: { borderRadius: 0, transition: 'none' }, }, label: { sx: { lineHeight: 0, fontSize: 'sm', fontWeight: 'lg' } }, }} /> </Box> ))} </RadioGroup> ); }
1,927
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/sign-in-side/App.tsx
import * as React from 'react'; import { CssVarsProvider, useColorScheme } from '@mui/joy/styles'; import GlobalStyles from '@mui/joy/GlobalStyles'; import CssBaseline from '@mui/joy/CssBaseline'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Checkbox from '@mui/joy/Checkbox'; import Divider from '@mui/joy/Divider'; import FormControl from '@mui/joy/FormControl'; import FormLabel, { formLabelClasses } from '@mui/joy/FormLabel'; import IconButton, { IconButtonProps } from '@mui/joy/IconButton'; import Link from '@mui/joy/Link'; import Input from '@mui/joy/Input'; import Typography from '@mui/joy/Typography'; import Stack from '@mui/joy/Stack'; import DarkModeRoundedIcon from '@mui/icons-material/DarkModeRounded'; import LightModeRoundedIcon from '@mui/icons-material/LightModeRounded'; import BadgeRoundedIcon from '@mui/icons-material/BadgeRounded'; import GoogleIcon from './GoogleIcon'; interface FormElements extends HTMLFormControlsCollection { email: HTMLInputElement; password: HTMLInputElement; persistent: HTMLInputElement; } interface SignInFormElement extends HTMLFormElement { readonly elements: FormElements; } function ColorSchemeToggle({ onClick, ...props }: IconButtonProps) { const { mode, setMode } = useColorScheme(); const [mounted, setMounted] = React.useState(false); React.useEffect(() => { setMounted(true); }, []); if (!mounted) { return <IconButton size="sm" variant="outlined" color="neutral" disabled />; } return ( <IconButton id="toggle-mode" size="sm" variant="outlined" color="neutral" aria-label="toggle light/dark mode" {...props} onClick={(event) => { if (mode === 'light') { setMode('dark'); } else { setMode('light'); } onClick?.(event); }} > {mode === 'light' ? <DarkModeRoundedIcon /> : <LightModeRoundedIcon />} </IconButton> ); } export default function JoySignInSideTemplate() { return ( <CssVarsProvider defaultMode="dark" disableTransitionOnChange> <CssBaseline /> <GlobalStyles styles={{ ':root': { '--Collapsed-breakpoint': '769px', // form will stretch when viewport is below `769px` '--Cover-width': '50vw', // must be `vw` only '--Form-maxWidth': '800px', '--Transition-duration': '0.4s', // set to `none` to disable transition }, }} /> <Box sx={(theme) => ({ width: 'clamp(100vw - var(--Cover-width), (var(--Collapsed-breakpoint) - 100vw) * 999, 100vw)', transition: 'width var(--Transition-duration)', transitionDelay: 'calc(var(--Transition-duration) + 0.1s)', position: 'relative', zIndex: 1, display: 'flex', justifyContent: 'flex-end', backdropFilter: 'blur(12px)', backgroundColor: 'rgba(255 255 255 / 0.2)', [theme.getColorSchemeSelector('dark')]: { backgroundColor: 'rgba(19 19 24 / 0.4)', }, })} > <Box sx={{ display: 'flex', flexDirection: 'column', minHeight: '100dvh', width: 'clamp(var(--Form-maxWidth), (var(--Collapsed-breakpoint) - 100vw) * 999, 100%)', maxWidth: '100%', px: 2, }} > <Box component="header" sx={{ py: 3, display: 'flex', alignItems: 'left', justifyContent: 'space-between', }} > <Box sx={{ gap: 2, display: 'flex', alignItems: 'center', }} > <IconButton variant="soft" color="primary" size="sm"> <BadgeRoundedIcon /> </IconButton> <Typography level="title-lg">Company logo</Typography> </Box> <ColorSchemeToggle /> </Box> <Box component="main" sx={{ my: 'auto', py: 2, pb: 5, display: 'flex', flexDirection: 'column', gap: 2, width: 400, maxWidth: '100%', mx: 'auto', borderRadius: 'sm', '& form': { display: 'flex', flexDirection: 'column', gap: 2, }, [`& .${formLabelClasses.asterisk}`]: { visibility: 'hidden', }, }} > <Stack gap={4} sx={{ mb: 2 }}> <Stack gap={1}> <Typography level="h3">Sign in</Typography> <Typography level="body-sm"> New to company?{' '} <Link href="#replace-with-a-link" level="title-sm"> Sign up! </Link> </Typography> </Stack> <Button variant="soft" color="neutral" fullWidth startDecorator={<GoogleIcon />} > Continue with Google </Button> </Stack> <Divider sx={(theme) => ({ [theme.getColorSchemeSelector('light')]: { color: { xs: '#FFF', md: 'text.tertiary' }, '--Divider-lineColor': { xs: '#FFF', md: 'var(--joy-palette-divider)', }, }, })} > or </Divider> <Stack gap={4} sx={{ mt: 2 }}> <form onSubmit={(event: React.FormEvent<SignInFormElement>) => { event.preventDefault(); const formElements = event.currentTarget.elements; const data = { email: formElements.email.value, password: formElements.password.value, persistent: formElements.persistent.checked, }; alert(JSON.stringify(data, null, 2)); }} > <FormControl required> <FormLabel>Email</FormLabel> <Input type="email" name="email" /> </FormControl> <FormControl required> <FormLabel>Password</FormLabel> <Input type="password" name="password" /> </FormControl> <Stack gap={4} sx={{ mt: 2 }}> <Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', }} > <Checkbox size="sm" label="Remember me" name="persistent" /> <Link level="title-sm" href="#replace-with-a-link"> Forgot your password? </Link> </Box> <Button type="submit" fullWidth> Sign in </Button> </Stack> </form> </Stack> </Box> <Box component="footer" sx={{ py: 3 }}> <Typography level="body-xs" textAlign="center"> Β© Your company {new Date().getFullYear()} </Typography> </Box> </Box> </Box> <Box sx={(theme) => ({ height: '100%', position: 'fixed', right: 0, top: 0, bottom: 0, left: 'clamp(0px, (100vw - var(--Collapsed-breakpoint)) * 999, 100vw - var(--Cover-width))', transition: 'background-image var(--Transition-duration), left var(--Transition-duration) !important', transitionDelay: 'calc(var(--Transition-duration) + 0.1s)', backgroundColor: 'background.level1', backgroundSize: 'cover', backgroundPosition: 'center', backgroundRepeat: 'no-repeat', backgroundImage: 'url(https://images.unsplash.com/photo-1527181152855-fc03fc7949c8?auto=format&w=1000&dpr=2)', [theme.getColorSchemeSelector('dark')]: { backgroundImage: 'url(https://images.unsplash.com/photo-1572072393749-3ca9c8ea0831?auto=format&w=1000&dpr=2)', }, })} /> </CssVarsProvider> ); }
1,928
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/sign-in-side/GoogleIcon.tsx
import * as React from 'react'; import SvgIcon from '@mui/joy/SvgIcon'; export default function GoogleIcon() { return ( <SvgIcon fontSize="xl"> <g transform="matrix(1, 0, 0, 1, 27.009001, -39.238998)"> <path fill="#4285F4" d="M -3.264 51.509 C -3.264 50.719 -3.334 49.969 -3.454 49.239 L -14.754 49.239 L -14.754 53.749 L -8.284 53.749 C -8.574 55.229 -9.424 56.479 -10.684 57.329 L -10.684 60.329 L -6.824 60.329 C -4.564 58.239 -3.264 55.159 -3.264 51.509 Z" /> <path fill="#34A853" d="M -14.754 63.239 C -11.514 63.239 -8.804 62.159 -6.824 60.329 L -10.684 57.329 C -11.764 58.049 -13.134 58.489 -14.754 58.489 C -17.884 58.489 -20.534 56.379 -21.484 53.529 L -25.464 53.529 L -25.464 56.619 C -23.494 60.539 -19.444 63.239 -14.754 63.239 Z" /> <path fill="#FBBC05" d="M -21.484 53.529 C -21.734 52.809 -21.864 52.039 -21.864 51.239 C -21.864 50.439 -21.724 49.669 -21.484 48.949 L -21.484 45.859 L -25.464 45.859 C -26.284 47.479 -26.754 49.299 -26.754 51.239 C -26.754 53.179 -26.284 54.999 -25.464 56.619 L -21.484 53.529 Z" /> <path fill="#EA4335" d="M -14.754 43.989 C -12.984 43.989 -11.404 44.599 -10.154 45.789 L -6.734 42.369 C -8.804 40.429 -11.514 39.239 -14.754 39.239 C -19.444 39.239 -23.494 41.939 -25.464 45.859 L -21.484 48.949 C -20.534 46.099 -17.884 43.989 -14.754 43.989 Z" /> </g> </SvgIcon> ); }
1,929
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/team/App.tsx
import * as React from 'react'; import { CssVarsProvider } from '@mui/joy/styles'; import CssBaseline from '@mui/joy/CssBaseline'; import Autocomplete from '@mui/joy/Autocomplete'; import Avatar from '@mui/joy/Avatar'; import Box from '@mui/joy/Box'; import Chip from '@mui/joy/Chip'; import ChipDelete from '@mui/joy/ChipDelete'; import Typography from '@mui/joy/Typography'; import Button from '@mui/joy/Button'; import List from '@mui/joy/List'; import Stack from '@mui/joy/Stack'; import Divider from '@mui/joy/Divider'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListItemContent from '@mui/joy/ListItemContent'; import RadioGroup from '@mui/joy/RadioGroup'; import Radio from '@mui/joy/Radio'; import Slider from '@mui/joy/Slider'; import Sheet from '@mui/joy/Sheet'; import AccordionGroup from '@mui/joy/AccordionGroup'; import Accordion from '@mui/joy/Accordion'; import AccordionDetails, { accordionDetailsClasses, } from '@mui/joy/AccordionDetails'; import AccordionSummary, { accordionSummaryClasses, } from '@mui/joy/AccordionSummary'; // Icons import import KeyboardArrowRightRoundedIcon from '@mui/icons-material/KeyboardArrowRightRounded'; import EmailRoundedIcon from '@mui/icons-material/EmailRounded'; import PeopleAltRoundedIcon from '@mui/icons-material/PeopleAltRounded'; import FolderRoundedIcon from '@mui/icons-material/FolderRounded'; import PersonRoundedIcon from '@mui/icons-material/PersonRounded'; // custom import Layout from './components/Layout'; import Header from './components/Header'; import Navigation from './components/Navigation'; export default function TeamExample() { const [drawerOpen, setDrawerOpen] = React.useState(false); const peopleData = [ { name: 'Andrew Smith', position: 'UI Designer', avatar2x: 'https://i.pravatar.cc/80?img=7', companyData: [ { role: 'Senior designer', name: 'Dribbble', logo: 'https://www.vectorlogo.zone/logos/dribbble/dribbble-icon.svg', years: '2015-now', }, { role: 'Designer', name: 'Pinterest', logo: 'https://www.vectorlogo.zone/logos/pinterest/pinterest-icon.svg', years: '2012-2015', }, ], skills: ['UI design', 'Illustration'], }, { name: 'John Doe', position: 'Frontend Developer', avatar2x: 'https://i.pravatar.cc/80?img=8', companyData: [ { role: 'UI Engineer', name: 'Google', logo: 'https://www.vectorlogo.zone/logos/google/google-icon.svg', years: '2018-now', }, { role: 'Frontend Developer', name: 'Amazon', logo: 'https://www.vectorlogo.zone/logos/amazon/amazon-icon.svg', years: '2015-2018', }, ], skills: ['HTML', 'CSS', 'JavaScript'], }, { name: 'Alice Johnson', position: 'Product Manager', avatar2x: 'https://i.pravatar.cc/80?img=9', companyData: [ { role: 'Product Manager', name: 'Microsoft', logo: 'https://www.vectorlogo.zone/logos/microsoft/microsoft-icon.svg', years: '2016-now', }, { role: 'Product Analyst', name: 'IBM', logo: 'https://www.vectorlogo.zone/logos/ibm/ibm-icon.svg', years: '2013-2016', }, ], skills: ['Product Management', 'Market Analysis'], }, { name: 'Eva Brown', position: 'Graphic Designer', avatar2x: 'https://i.pravatar.cc/80?img=10', companyData: [ { role: 'Art Director', name: 'Adobe', logo: 'https://www.vectorlogo.zone/logos/adobe/adobe-icon.svg', years: '2019-now', }, { role: 'Graphic Designer', name: 'Apple', logo: 'https://www.vectorlogo.zone/logos/apple/apple-icon.svg', years: '2016-2019', }, ], skills: ['Graphic Design', 'Illustration'], }, ]; return ( <CssVarsProvider disableTransitionOnChange> <CssBaseline /> {drawerOpen && ( <Layout.SideDrawer onClose={() => setDrawerOpen(false)}> <Navigation /> </Layout.SideDrawer> )} <Stack id="tab-bar" direction="row" justifyContent="space-around" spacing={1} sx={{ display: { xs: 'flex', sm: 'none' }, zIndex: '999', bottom: 0, position: 'fixed', width: '100dvw', py: 2, backgroundColor: 'background.body', borderTop: '1px solid', borderColor: 'divider', }} > <Button variant="plain" color="neutral" component="a" href="/joy-ui/getting-started/templates/email/" size="sm" startDecorator={<EmailRoundedIcon />} sx={{ flexDirection: 'column', '--Button-gap': 0 }} > Email </Button> <Button variant="plain" color="neutral" aria-pressed="true" component="a" href="/joy-ui/getting-started/templates/team/" size="sm" startDecorator={<PeopleAltRoundedIcon />} sx={{ flexDirection: 'column', '--Button-gap': 0 }} > Team </Button> <Button variant="plain" color="neutral" component="a" href="/joy-ui/getting-started/templates/files/" size="sm" startDecorator={<FolderRoundedIcon />} sx={{ flexDirection: 'column', '--Button-gap': 0 }} > Files </Button> </Stack> <Layout.Root sx={{ ...(drawerOpen && { height: '100vh', overflow: 'hidden', }), }} > <Layout.Header> <Header /> </Layout.Header> <Layout.SideNav> <Navigation /> </Layout.SideNav> <Layout.SidePane> <Box sx={{ p: 2, display: 'flex', alignItems: 'center', justifyContent: 'space-between', }} > <Typography level="title-lg" textColor="text.secondary"> People </Typography> <Button startDecorator={<PersonRoundedIcon />} size="sm"> Add new </Button> </Box> <Box sx={{ p: 2, display: 'flex', alignItems: 'center', justifyContent: 'space-between', }} > <Typography level="title-md">Filters</Typography> <Button size="sm" variant="plain"> Clear </Button> </Box> <AccordionGroup sx={{ [`& .${accordionDetailsClasses.content}`]: { px: 2, }, [`& .${accordionSummaryClasses.button}`]: { px: 2, }, }} > <Accordion defaultExpanded> <AccordionSummary> <Typography level="title-sm">Keywords</Typography> </AccordionSummary> <AccordionDetails> <Box sx={{ my: 2 }}> <Autocomplete size="sm" placeholder="Position, skills, etc…" options={[ { category: 'Position', title: 'Frontend engineer', }, { category: 'Position', title: 'Backend engineer', }, { category: 'Position', title: 'Product manager', }, { category: 'Skill', title: 'JavaScript', }, { category: 'Skill', title: 'TypeScript', }, { category: 'Skill', title: 'Project management', }, ]} groupBy={(option) => option.category} getOptionLabel={(option) => option.title} /> <Box sx={{ my: 2, display: 'flex', gap: 1 }}> <Chip variant="soft" size="sm" endDecorator={<ChipDelete variant="soft" />} > UI designer </Chip> </Box> </Box> </AccordionDetails> </Accordion> <Accordion defaultExpanded> <AccordionSummary> <Typography level="title-sm">Location</Typography> </AccordionSummary> <AccordionDetails> <Box sx={{ my: 2 }}> <Autocomplete size="sm" placeholder="Country, city, etc…" options={[ // some of Thailand provinces 'Bangkok', 'Amnat Charoen', 'Ang Thong', 'Bueng Kan', 'Buriram', 'Chachoengsao', 'Chai Nat', 'Chaiyaphum', 'Chanthaburi', 'Chiang Mai', 'Chiang Rai', 'Chonburi', ]} /> <Box sx={{ mt: 3, display: 'flex', flexDirection: 'column' }}> <Typography level="title-sm">Range</Typography> <Slider size="sm" variant="solid" valueLabelFormat={(value) => `${value} km`} defaultValue={6} step={1} min={0} max={20} valueLabelDisplay="on" /> </Box> </Box> </AccordionDetails> </Accordion> <Accordion defaultExpanded> <AccordionSummary> <Typography level="title-sm">Education</Typography> </AccordionSummary> <AccordionDetails> <Box sx={{ my: 2 }}> <RadioGroup name="education" defaultValue="any"> <Radio label="Any" value="any" size="sm" /> <Radio label="High School" value="high-school" size="sm" /> <Radio label="College" value="college" size="sm" /> <Radio label="Post-graduate" value="post-graduate" size="sm" /> </RadioGroup> </Box> </AccordionDetails> </Accordion> <Accordion defaultExpanded> <AccordionSummary> <Typography level="title-sm">Years of Experience</Typography> </AccordionSummary> <AccordionDetails> <Box sx={{ my: 2 }}> <Slider size="sm" valueLabelFormat={(value) => `${value} years`} defaultValue={[5, 10]} step={1} min={0} max={30} valueLabelDisplay="on" /> </Box> </AccordionDetails> </Accordion> <Accordion defaultExpanded> <AccordionSummary> <Typography level="title-sm">Languages Spoken</Typography> </AccordionSummary> <AccordionDetails> <Box sx={{ my: 2 }}> <Autocomplete size="sm" multiple placeholder="Select languages" options={[ 'English', 'French', 'German', 'Portuguese', 'Spanish', ]} getOptionLabel={(option) => option} filterSelectedOptions /> </Box> </AccordionDetails> </Accordion> </AccordionGroup> </Layout.SidePane> <Layout.Main> <List sx={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 1fr))', gap: 2, }} > {peopleData.map((person, index) => ( <Sheet key={index} component="li" variant="outlined" sx={{ borderRadius: 'sm', p: 2, listStyle: 'none', }} > <Box sx={{ display: 'flex', gap: 2 }}> <Avatar variant="outlined" src={person.avatar2x} srcSet={`${person.avatar2x} 2x`} sx={{ borderRadius: '50%' }} /> <div> <Typography level="title-md">{person.name}</Typography> <Typography level="body-xs">{person.position}</Typography> </div> </Box> <Divider component="div" sx={{ my: 2 }} /> <List sx={{ '--ListItemDecorator-size': '40px', gap: 2 }}> {person.companyData.map((company, companyIndex) => ( <ListItem key={companyIndex} sx={{ alignItems: 'flex-start' }}> <ListItemDecorator sx={{ '&:before': { content: '""', position: 'absolute', height: '100%', width: '1px', bgcolor: 'divider', left: 'calc(var(--ListItem-paddingLeft) + 12px)', top: '50%', }, }} > <Avatar src={company.logo} sx={{ '--Avatar-size': '24px' }} /> </ListItemDecorator> <ListItemContent> <Typography level="title-sm">{company.role}</Typography> <Typography level="body-xs">{company.name}</Typography> </ListItemContent> <Typography level="body-xs">{company.years}</Typography> </ListItem> ))} </List> <Button size="sm" variant="plain" endDecorator={<KeyboardArrowRightRoundedIcon fontSize="small" />} sx={{ px: 1, mt: 1 }} > Expand </Button> <Divider component="div" sx={{ my: 2 }} /> <Typography level="title-sm">Skills tags:</Typography> <Box sx={{ mt: 1.5, display: 'flex', gap: 1 }}> {person.skills.map((skill, skillIndex) => ( <Chip key={skillIndex} variant="outlined" color="neutral" size="sm" > {skill} </Chip> ))} </Box> </Sheet> ))} </List> </Layout.Main> </Layout.Root> </CssVarsProvider> ); }
1,930
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/team
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/team/components/Header.tsx
import * as React from 'react'; import { useColorScheme } from '@mui/joy/styles'; import Box from '@mui/joy/Box'; import Typography from '@mui/joy/Typography'; import IconButton from '@mui/joy/IconButton'; import Stack from '@mui/joy/Stack'; import Avatar from '@mui/joy/Avatar'; import Input from '@mui/joy/Input'; import Button from '@mui/joy/Button'; import Tooltip from '@mui/joy/Tooltip'; import Dropdown from '@mui/joy/Dropdown'; import Menu from '@mui/joy/Menu'; import MenuButton from '@mui/joy/MenuButton'; import MenuItem from '@mui/joy/MenuItem'; import ListDivider from '@mui/joy/ListDivider'; import Drawer from '@mui/joy/Drawer'; import ModalClose from '@mui/joy/ModalClose'; import DialogTitle from '@mui/joy/DialogTitle'; // Icons import import SearchRoundedIcon from '@mui/icons-material/SearchRounded'; import DarkModeRoundedIcon from '@mui/icons-material/DarkModeRounded'; import LightModeRoundedIcon from '@mui/icons-material/LightModeRounded'; import BookRoundedIcon from '@mui/icons-material/BookRounded'; import LanguageRoundedIcon from '@mui/icons-material/LanguageRounded'; import SettingsRoundedIcon from '@mui/icons-material/SettingsRounded'; import HelpRoundedIcon from '@mui/icons-material/HelpRounded'; import OpenInNewRoundedIcon from '@mui/icons-material/OpenInNewRounded'; import LogoutRoundedIcon from '@mui/icons-material/LogoutRounded'; import MenuRoundedIcon from '@mui/icons-material/MenuRounded'; // Custom import TeamNav from './Navigation'; function ColorSchemeToggle() { const { mode, setMode } = useColorScheme(); const [mounted, setMounted] = React.useState(false); React.useEffect(() => { setMounted(true); }, []); if (!mounted) { return <IconButton size="sm" variant="outlined" color="primary" />; } return ( <Tooltip title="Change theme" variant="outlined"> <IconButton id="toggle-mode" size="sm" variant="plain" color="neutral" sx={{ alignSelf: 'center' }} onClick={() => { if (mode === 'light') { setMode('dark'); } else { setMode('light'); } }} > {mode === 'light' ? <DarkModeRoundedIcon /> : <LightModeRoundedIcon />} </IconButton> </Tooltip> ); } export default function Header() { const [open, setOpen] = React.useState(false); return ( <Box sx={{ display: 'flex', flexGrow: 1, justifyContent: 'space-between', }} > <Stack direction="row" justifyContent="center" alignItems="center" spacing={1} sx={{ display: { xs: 'none', sm: 'flex' } }} > <IconButton size="md" variant="outlined" color="neutral" sx={{ display: { xs: 'none', sm: 'inline-flex' }, borderRadius: '50%', }} > <LanguageRoundedIcon /> </IconButton> <Button variant="plain" color="neutral" component="a" href="/joy-ui/getting-started/templates/email/" size="sm" sx={{ alignSelf: 'center' }} > Email </Button> <Button variant="plain" color="neutral" aria-pressed="true" component="a" href="/joy-ui/getting-started/templates/team/" size="sm" sx={{ alignSelf: 'center' }} > Team </Button> <Button variant="plain" color="neutral" component="a" href="/joy-ui/getting-started/templates/files/" size="sm" sx={{ alignSelf: 'center' }} > Files </Button> </Stack> <Box sx={{ display: { xs: 'inline-flex', sm: 'none' } }}> <IconButton variant="plain" color="neutral" onClick={() => setOpen(true)}> <MenuRoundedIcon /> </IconButton> <Drawer sx={{ display: { xs: 'inline-flex', sm: 'none' } }} open={open} onClose={() => setOpen(false)} > <ModalClose /> <DialogTitle>Acme Co.</DialogTitle> <Box sx={{ px: 1 }}> <TeamNav /> </Box> </Drawer> </Box> <Box sx={{ display: 'flex', flexDirection: 'row', gap: 1.5, alignItems: 'center', }} > <Input size="sm" variant="outlined" placeholder="Search anything…" startDecorator={<SearchRoundedIcon color="primary" />} endDecorator={ <IconButton variant="outlined" color="neutral" sx={{ bgcolor: 'background.level1' }} > <Typography level="title-sm" textColor="text.icon"> ⌘ K </Typography> </IconButton> } sx={{ alignSelf: 'center', display: { xs: 'none', sm: 'flex', }, }} /> <IconButton size="sm" variant="outlined" color="neutral" sx={{ display: { xs: 'inline-flex', sm: 'none' }, alignSelf: 'center' }} > <SearchRoundedIcon /> </IconButton> <Tooltip title="Joy UI overview" variant="outlined"> <IconButton size="sm" variant="plain" color="neutral" component="a" href="/blog/first-look-at-joy/" sx={{ alignSelf: 'center' }} > <BookRoundedIcon /> </IconButton> </Tooltip> <ColorSchemeToggle /> <Dropdown> <MenuButton variant="plain" size="sm" sx={{ maxWidth: '32px', maxHeight: '32px', borderRadius: '9999999px' }} > <Avatar src="https://i.pravatar.cc/40?img=2" srcSet="https://i.pravatar.cc/80?img=2" sx={{ maxWidth: '32px', maxHeight: '32px' }} /> </MenuButton> <Menu placement="bottom-end" size="sm" sx={{ zIndex: '99999', p: 1, gap: 1, '--ListItem-radius': 'var(--joy-radius-sm)', }} > <MenuItem> <Box sx={{ display: 'flex', alignItems: 'center', }} > <Avatar src="https://i.pravatar.cc/40?img=2" srcSet="https://i.pravatar.cc/80?img=2" sx={{ borderRadius: '50%' }} /> <Box sx={{ ml: 1.5 }}> <Typography level="title-sm" textColor="text.primary"> Rick Sanchez </Typography> <Typography level="body-xs" textColor="text.tertiary"> [email protected] </Typography> </Box> </Box> </MenuItem> <ListDivider /> <MenuItem> <HelpRoundedIcon /> Help </MenuItem> <MenuItem> <SettingsRoundedIcon /> Settings </MenuItem> <ListDivider /> <MenuItem component="a" href="/blog/first-look-at-joy/"> First look at Joy UI <OpenInNewRoundedIcon /> </MenuItem> <MenuItem component="a" href="https://github.com/mui/material-ui/tree/master/docs/data/joy/getting-started/templates/email" > Sourcecode <OpenInNewRoundedIcon /> </MenuItem> <ListDivider /> <MenuItem> <LogoutRoundedIcon /> Log out </MenuItem> </Menu> </Dropdown> </Box> </Box> ); }
1,931
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/team
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/team/components/Layout.tsx
import * as React from 'react'; import Box, { BoxProps } from '@mui/joy/Box'; import Sheet from '@mui/joy/Sheet'; function Root(props: BoxProps) { return ( <Box {...props} sx={[ { bgcolor: 'background.appBody', display: 'grid', gridTemplateColumns: { xs: '1fr', sm: 'minmax(64px, 200px) minmax(450px, 1fr)', md: 'minmax(160px, 300px) minmax(300px, 500px) minmax(500px, 1fr)', }, gridTemplateRows: '64px 1fr', minHeight: '100vh', }, ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} /> ); } function Header(props: BoxProps) { return ( <Box component="header" className="Header" {...props} sx={[ { p: 2, gap: 2, bgcolor: 'background.surface', display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', gridColumn: '1 / -1', borderBottom: '1px solid', borderColor: 'divider', position: 'sticky', top: 0, zIndex: 1100, }, ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} /> ); } function SideNav(props: BoxProps) { return ( <Box component="nav" className="Navigation" {...props} sx={[ { p: 2, bgcolor: 'background.surface', borderRight: '1px solid', borderColor: 'divider', display: { xs: 'none', sm: 'initial', }, }, ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} /> ); } function SidePane(props: BoxProps) { return ( <Box className="Inbox" {...props} sx={[ { bgcolor: 'background.surface', borderRight: '1px solid', borderColor: 'divider', display: { xs: 'none', md: 'initial', }, }, ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} /> ); } function Main(props: BoxProps) { return ( <Box component="main" className="Main" {...props} sx={[{ p: 2 }, ...(Array.isArray(props.sx) ? props.sx : [props.sx])]} /> ); } function SideDrawer({ onClose, ...props }: BoxProps & { onClose: React.MouseEventHandler<HTMLDivElement> }) { return ( <Box {...props} sx={[ { position: 'fixed', zIndex: 1200, width: '100%', height: '100%' }, ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} > <Box role="button" onClick={onClose} sx={{ position: 'absolute', inset: 0, bgcolor: (theme) => `rgba(${theme.vars.palette.neutral.darkChannel} / 0.8)`, }} /> <Sheet sx={{ minWidth: 256, width: 'max-content', height: '100%', p: 2, boxShadow: 'lg', bgcolor: 'background.surface', }} > {props.children} </Sheet> </Box> ); } export default { Root, Header, SideNav, SidePane, SideDrawer, Main, };
1,932
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/team
petrpan-code/mui/material-ui/docs/data/joy/getting-started/templates/team/components/Navigation.tsx
import * as React from 'react'; import Chip from '@mui/joy/Chip'; import List from '@mui/joy/List'; import ListSubheader from '@mui/joy/ListSubheader'; import ListItem from '@mui/joy/ListItem'; import ListItemButton from '@mui/joy/ListItemButton'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListItemContent from '@mui/joy/ListItemContent'; // Icons import import PeopleRoundedIcon from '@mui/icons-material/PeopleRounded'; import AssignmentIndRoundedIcon from '@mui/icons-material/AssignmentIndRounded'; import ArticleRoundedIcon from '@mui/icons-material/ArticleRounded'; import AccountTreeRoundedIcon from '@mui/icons-material/AccountTreeRounded'; import TodayRoundedIcon from '@mui/icons-material/TodayRounded'; export default function Navigation() { return ( <List size="sm" sx={{ '--ListItem-radius': 'var(--joy-radius-sm)', '--List-gap': '4px' }} > <ListItem nested> <ListSubheader sx={{ letterSpacing: '2px', fontWeight: '800' }}> Browse </ListSubheader> <List aria-labelledby="nav-list-browse" sx={{ '& .JoyListItemButton-root': { p: '8px' }, }} > <ListItem> <ListItemButton selected> <ListItemDecorator> <PeopleRoundedIcon fontSize="small" /> </ListItemDecorator> <ListItemContent>People</ListItemContent> </ListItemButton> </ListItem> <ListItem> <ListItemButton> <ListItemDecorator sx={{ color: 'neutral.500' }}> <AssignmentIndRoundedIcon fontSize="small" /> </ListItemDecorator> <ListItemContent>Managing accounts</ListItemContent> </ListItemButton> </ListItem> <ListItem> <ListItemButton> <ListItemDecorator sx={{ color: 'neutral.500' }}> <AccountTreeRoundedIcon fontSize="small" /> </ListItemDecorator> <ListItemContent>Org chart</ListItemContent> </ListItemButton> </ListItem> <ListItem> <ListItemButton> <ListItemDecorator sx={{ color: 'neutral.500' }}> <TodayRoundedIcon fontSize="small" /> </ListItemDecorator> <ListItemContent>Time off</ListItemContent> </ListItemButton> </ListItem> <ListItem> <ListItemButton> <ListItemDecorator sx={{ color: 'neutral.500' }}> <ArticleRoundedIcon fontSize="small" /> </ListItemDecorator> <ListItemContent>Policies</ListItemContent> <Chip variant="soft" color="warning" size="sm"> 2 </Chip> </ListItemButton> </ListItem> </List> </ListItem> </List> ); }
1,933
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started
petrpan-code/mui/material-ui/docs/data/joy/getting-started/tutorial/LoginFinal.js
import * as React from 'react'; import { CssVarsProvider, useColorScheme } from '@mui/joy/styles'; import Sheet from '@mui/joy/Sheet'; import Typography from '@mui/joy/Typography'; import FormControl from '@mui/joy/FormControl'; import FormLabel from '@mui/joy/FormLabel'; import Input from '@mui/joy/Input'; import Button from '@mui/joy/Button'; import Link from '@mui/joy/Link'; function ModeToggle() { const { mode, setMode } = useColorScheme(); const [mounted, setMounted] = React.useState(false); // necessary for server-side rendering // because mode is undefined on the server React.useEffect(() => { setMounted(true); }, []); if (!mounted) { return null; } return ( <Button variant="soft" onClick={() => { setMode(mode === 'light' ? 'dark' : 'light'); }} > {mode === 'light' ? 'Turn dark' : 'Turn light'} </Button> ); } export default function LoginFinal() { return ( <CssVarsProvider> <main> <ModeToggle /> <Sheet sx={{ width: 300, mx: 'auto', // margin left & right my: 4, // margin top & bottom py: 3, // padding top & bottom px: 2, // padding left & right display: 'flex', flexDirection: 'column', gap: 2, borderRadius: 'sm', boxShadow: 'md', }} variant="outlined" > <div> <Typography level="h4" component="h1"> <b>Welcome!</b> </Typography> <Typography level="body-sm">Sign in to continue.</Typography> </div> <FormControl> <FormLabel>Email</FormLabel> <Input // html input attribute name="email" type="email" placeholder="[email protected]" /> </FormControl> <FormControl> <FormLabel>Password</FormLabel> <Input // html input attribute name="password" type="password" placeholder="password" /> </FormControl> <Button sx={{ mt: 1 /* margin top */ }}>Log in</Button> <Typography endDecorator={<Link href="/sign-up">Sign up</Link>} fontSize="sm" sx={{ alignSelf: 'center' }} > Don&apos;t have an account? </Typography> </Sheet> </main> </CssVarsProvider> ); }
1,934
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started
petrpan-code/mui/material-ui/docs/data/joy/getting-started/tutorial/tutorial.md
# Introductory tutorial <p class="description">Learn how to import and style Joy UI components to build a simple login page with light and dark modes.</p> This tutorial will walk you through how to assemble the UI for a basic login page using Joy UI. You'll be introduced to several common components as well as some of the props you can use to control their styles. You'll also encounter key features of Joy UI such as global variants, the `sx` prop, and the `useColorScheme` hook. By the end, you should understand how to: 1. import and customize Joy UI components 2. add styles to Joy UI components with `sx` 3. override default HTML elements with `component` 4. toggle light and dark mode with `useColorScheme` ## Interactive demo Here's what the final product looks likeβ€”click on the "Show code" button underneath the demo to see the full source code: {{"demo": "LoginFinal.js"}} ## Prerequisites This tutorial assumes that you've already: - set up a React appβ€”try [Create React App](https://create-react-app.dev/) if you need a boilerplate - installed Joy UI in your appβ€”see [Installation](/joy-ui/getting-started/installation/) for instructions ## Import the Sheet component for structure The [Sheet](/joy-ui/react-sheet/) component is a `<div>` container that supports Joy UI's [global variants feature](/joy-ui/main-features/global-variants/), helping to ensure consistency across your app. Import Sheet and add it to your app as shown below. (If you're using Create React App, for example, all of this code should go in `App.js`.) ```jsx import * as React from 'react'; import { CssVarsProvider } from '@mui/joy/styles'; import Sheet from '@mui/joy/Sheet'; export default function App() { return ( <CssVarsProvider> <Sheet variant="outlined">Welcome!</Sheet> </CssVarsProvider> ); } ``` :::success Try playing around with different `variant` values to see the available styles. In addition to `outlined`, you can also use `solid`, `soft`, or `plain`β€”these are Joy UI's [global variants](/joy-ui/main-features/global-variants/), and they're available on all components. ::: ### Add styles with the sx prop All Joy UI components accept [the `sx` prop](/system/getting-started/the-sx-prop/), which gives you access to a shorthand syntax for writing CSS. It's great for creating one-off customizations or rapidly experimenting with different styles. Replace your basic Sheet from the previous step with the following `sx`-styled Sheet: ```jsx <Sheet sx={{ width: 300, mx: 'auto', // margin left & right my: 4, // margin top & bottom py: 3, // padding top & bottom px: 2, // padding left & right display: 'flex', flexDirection: 'column', gap: 2, borderRadius: 'sm', boxShadow: 'md', }} > Welcome! </Sheet> ``` :::success Try changing some of the values for the CSS properties above based on the patterns you observe. To go deeper, read about the `sx` prop in the [MUI System documentation](/system/getting-started/the-sx-prop/). ::: ## Add text with the Typography component The [Typography](/joy-ui/react-typography/) component replaces HTML header, paragraph, and span tags to help maintain a consistent hierarchy of text on the page. The `level` prop gives you access to a pre-defined scale of typographic values. Joy UI provides 11 typographic levels out of the box. - Four heading levels: `'h1' | 'h2' | 'h3' | 'h4'` - Three title levels: `'title-lg' | 'title-md' | 'title-sm'` - Four body levels: `'body-lg' | 'body-md' | 'body-sm' | 'body-xs'` Add an import for Typography with the rest of your imports: ```jsx import Typography from '@mui/joy/Typography'; ``` Replace `Welcome!` inside your Sheet component with this `<div>`: ```jsx <div> <Typography level="h4" component="h1"> Welcome! </Typography> <Typography level="body-sm">Sign in to continue.</Typography> </div> ``` :::success Try changing the values for the `level` and `component` props to see how they affect the typographic values and the elements rendered. (Note that while `level` only accepts the 13 values listed above, you can pass any HTML tag to `component`, as well as custom React components.) ::: ## Add text field for user inputs The Form Control, Form Label, and Input components can be used together to provide you with a sophisticated field for user input. Add imports for Form Control, Form Label, and Input with the rest of your imports: ```jsx import FormControl from '@mui/joy/FormControl'; import FormLabel from '@mui/joy/FormLabel'; import Input from '@mui/joy/Input'; ``` Insert these two text fields below the `<div>` from the previous step, inside the Sheet: ```jsx <FormControl> <FormLabel>Email</FormLabel> <Input // html input attribute name="email" type="email" placeholder="[email protected]" /> </FormControl> <FormControl> <FormLabel>Password</FormLabel> <Input name="password" type="password" placeholder="password" /> </FormControl> ``` ## Import Button and Link for user actions The [Button](/joy-ui/react-button/) and [Link](/joy-ui/react-link/) components replace the HTML `<button>` and `<a>` tags, respectively, giving you access to global variants, the `sx` and `component` props, and more. Add the following imports with the rest in your app: ```jsx import Button from '@mui/joy/Button'; import Link from '@mui/joy/Link'; ``` Add the following Button, Typography, and Link components after the text fields from the previous step, still nested inside the Sheet. Notice that the Link is appended to the Typography inside of [the `endDecorator` prop](/joy-ui/react-typography/#decorators): ```jsx <Button sx={{ mt: 1 /* margin top */ }}> Log in </Button> <Typography endDecorator={<Link href="/sign-up">Sign up</Link>} fontSize="sm" sx={{ alignSelf: 'center' }} > Don't have an account? </Typography> ``` ## 🎁 Bonus: Build a toggle for light and dark mode The `useColorScheme` hook aids in the implementation of a toggle button for switching between light and dark mode in an app. It also enables Joy UI to ensure that the user-selected mode (which is stored in `localStorage` by default) stays in sync across browser tabs. Add `useColorScheme` to your import from `@mui/joy/styles`: ```jsx import { CssVarsProvider, useColorScheme } from '@mui/joy/styles'; ``` Next, create a light/dark mode toggle button by adding the following code snippet in between your imports and your `App()`: ```jsx function ModeToggle() { const { mode, setMode } = useColorScheme(); const [mounted, setMounted] = React.useState(false); // necessary for server-side rendering // because mode is undefined on the server React.useEffect(() => { setMounted(true); }, []); if (!mounted) { return null; } return ( <Button variant="outlined" onClick={() => { setMode(mode === 'light' ? 'dark' : 'light'); }} > {mode === 'light' ? 'Turn dark' : 'Turn light'} </Button> ); } ``` Finally, add your newly built `<ModeToggle />` button above `<Sheet />`: ```diff export default function App() { return ( <CssVarsProvider> + <ModeToggle /> <Sheet>...</Sheet> </CssVarsProvider> ); } ``` Your app should now look like the [interactive demo](#interactive-demo) at the top of the page. Great job making it all the way to the end! ## Summary Here's a recap of the components used: - [Sheet](/joy-ui/react-sheet/) - [Typography](/joy-ui/react-typography/) - [Button](/joy-ui/react-button/) - [Link](/joy-ui/react-link/) Here are some of the major features introduced: - [global variants](/joy-ui/main-features/global-variants/) - [the `sx` prop](/system/getting-started/the-sx-prop/) - [dark mode](/joy-ui/customization/dark-mode/) ## Next steps This tutorial does not cover theming or general component customization. Learn more about [different customization approaches](/joy-ui/customization/approaches/) and when to apply them. To see some more sophisticated examples of Joy UI in action, check out our [collection of templates](/joy-ui/getting-started/templates/). Are you migrating from Material UI? Learn how to work with [Joy UI and Material UI together in one app](/joy-ui/integrations/material-ui/).
1,935
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started
petrpan-code/mui/material-ui/docs/data/joy/getting-started/usage/ButtonUsage.js
import * as React from 'react'; import Button from '@mui/joy/Button'; export default function ButtonUsage() { return <Button variant="solid">Hello world</Button>; }
1,936
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started
petrpan-code/mui/material-ui/docs/data/joy/getting-started/usage/ButtonUsage.tsx
import * as React from 'react'; import Button from '@mui/joy/Button'; export default function ButtonUsage() { return <Button variant="solid">Hello world</Button>; }
1,937
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started
petrpan-code/mui/material-ui/docs/data/joy/getting-started/usage/ButtonUsage.tsx.preview
<Button variant="solid">Hello world</Button>
1,938
0
petrpan-code/mui/material-ui/docs/data/joy/getting-started
petrpan-code/mui/material-ui/docs/data/joy/getting-started/usage/usage.md
# Usage <p class="description">Learn the basics of working with Joy UI components.</p> ## Quickstart After [installation](/joy-ui/getting-started/installation/), you can import any Joy UI component and start playing around. For example, try changing the `variant` on the [Button](/joy-ui/react-button/) to `soft` to see how the style changes: {{"demo": "ButtonUsage.js", "defaultCodeOpen": true}} ## Globals Since Joy UI components are built to function in isolation, they don't require any kind of globally scoped styles. For a better user experience and developer experience, we recommend adding the following globals to your app. ### Responsive meta tag Joy UI is a _mobile-first_ component libraryβ€”we write code for mobile devices first, and then scale up the components as necessary using CSS media queries. To ensure proper rendering and touch zooming for all devices, add the responsive viewport meta tag to your `<head>` element: ```html <meta name="viewport" content="initial-scale=1, width=device-width" /> ``` ### CssBaseline Joy UI provides an optional [CssBaseline](/joy-ui/react-css-baseline/) component. It fixes some inconsistencies across browsers and devices while providing resets that are better tailored to fit Joy UI than alternative global style sheets like [normalize.css](https://github.com/necolas/normalize.css/). ### CssVarsProvider Joy UI provides an optional `<CssVarsProvider />` component that unlocks a whole host of customization options powered by CSS variables. Visit the [Using CSS variables](/joy-ui/customization/using-css-variables/) guide to learn more. ### Default font Joy UI uses the Inter font by default. See [Installationβ€”Inter font](/joy-ui/getting-started/installation/#inter-font) for complete details.
1,939
0
petrpan-code/mui/material-ui/docs/data/joy/integrations
petrpan-code/mui/material-ui/docs/data/joy/integrations/icon-libraries/IconFontSizes.js
import * as React from 'react'; import { useTheme } from '@mui/joy/styles'; import Stack from '@mui/joy/Stack'; import Person from '@mui/icons-material/Person'; export default function IconFontSizes() { const theme = useTheme(); return ( <Stack spacing={2} direction="row" sx={{ gridColumn: '1 / -1', alignItems: 'center', justifyContent: 'center' }} > {Object.keys(theme.fontSize).map((size) => ( <Person key={size} fontSize={size} /> ))} </Stack> ); }
1,940
0
petrpan-code/mui/material-ui/docs/data/joy/integrations
petrpan-code/mui/material-ui/docs/data/joy/integrations/icon-libraries/IconFontSizes.tsx
import * as React from 'react'; import { useTheme } from '@mui/joy/styles'; import Stack from '@mui/joy/Stack'; import Person from '@mui/icons-material/Person'; export default function IconFontSizes() { const theme = useTheme(); return ( <Stack spacing={2} direction="row" sx={{ gridColumn: '1 / -1', alignItems: 'center', justifyContent: 'center' }} > {Object.keys(theme.fontSize).map((size) => ( <Person key={size} fontSize={size} /> ))} </Stack> ); }
1,941
0
petrpan-code/mui/material-ui/docs/data/joy/integrations
petrpan-code/mui/material-ui/docs/data/joy/integrations/icon-libraries/IconFontSizes.tsx.preview
{Object.keys(theme.fontSize).map((size) => ( <Person key={size} fontSize={size} /> ))}
1,942
0
petrpan-code/mui/material-ui/docs/data/joy/integrations
petrpan-code/mui/material-ui/docs/data/joy/integrations/icon-libraries/JoyMaterialIcon.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Input from '@mui/joy/Input'; import Typography from '@mui/joy/Typography'; import Stack from '@mui/joy/Stack'; import Person from '@mui/icons-material/Person'; export default function JoyMaterialIcon() { return ( <Box sx={{ display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: 2 }}> <Stack spacing={2}> {['sm', 'md', 'lg'].map((size) => ( <Button key={size} size={size} startDecorator={<Person />}> Button </Button> ))} </Stack> <Stack spacing={2}> {['sm', 'md', 'lg'].map((size) => ( <Input key={size} size={size} startDecorator={<Person />} placeholder="Placeholder" /> ))} </Stack> <Stack spacing={2}> {['sm', 'md', 'lg', 'xl'].map((size) => ( <Typography key={size} fontSize={size} startDecorator={<Person />}> Hello World </Typography> ))} </Stack> </Box> ); }
1,943
0
petrpan-code/mui/material-ui/docs/data/joy/integrations
petrpan-code/mui/material-ui/docs/data/joy/integrations/icon-libraries/JoyMaterialIcon.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Input from '@mui/joy/Input'; import Typography from '@mui/joy/Typography'; import Stack from '@mui/joy/Stack'; import Person from '@mui/icons-material/Person'; export default function JoyMaterialIcon() { return ( <Box sx={{ display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: 2 }}> <Stack spacing={2}> {(['sm', 'md', 'lg'] as const).map((size) => ( <Button key={size} size={size} startDecorator={<Person />}> Button </Button> ))} </Stack> <Stack spacing={2}> {(['sm', 'md', 'lg'] as const).map((size) => ( <Input key={size} size={size} startDecorator={<Person />} placeholder="Placeholder" /> ))} </Stack> <Stack spacing={2}> {(['sm', 'md', 'lg', 'xl'] as const).map((size) => ( <Typography key={size} fontSize={size} startDecorator={<Person />}> Hello World </Typography> ))} </Stack> </Box> ); }
1,944
0
petrpan-code/mui/material-ui/docs/data/joy/integrations
petrpan-code/mui/material-ui/docs/data/joy/integrations/icon-libraries/icon-libraries.md
# Using icon libraries <p class="description">Learn how to use your favorite icon library with Joy UI.</p> ## Material UI Icons [@mui/icons-material](https://www.npmjs.com/package/@mui/icons-material) includes the 2,100+ official [Material Icons](https://fonts.google.com/icons?icon.set=Material+Icons) converted to [SVG Icon](/material-ui/api/svg-icon/) components. ### Installation This section assumes that you've already installed Joy UI in your appβ€”see [Installation](/joy-ui/getting-started/installation/) for instructions. #### yarn ```bash yarn add @mui/icons-material @mui/material ``` :::warning Because `@mui/material` is a required dependency of `@mui/icons-material`, you have to add a workaround with yarn resolutions: ```json { "dependencies": { "@mui/material": "npm:@mui/joy@latest" }, "resolutions": { "@mui/material": "npm:@mui/joy@latest" } } ``` After that, run `yarn install` in your terminal. We are aware of this limitation and are considering removing the dependency. You can keep track of the progress in [this issue](https://github.com/mui/material-ui/issues/34489). ::: #### npm ```bash npm install @mui/icons-material @mui/material ``` :::warning Because `@mui/material` is a required dependency of `@mui/icons-material`, you have to update your bundler's config to add an alias. Here is an example of how you can do it, if you use [`webpack`](https://webpack.js.org/): **webpack.config.js** ```diff module.exports = { //... + resolve: { + alias: { + '@mui/material': '@mui/joy', + }, + }, }; ``` If you use TypeScript, you will need to update the TSConfig. **tsconfig.json** ```diff { "compilerOptions": { + "paths": { + "@mui/material": ["./node_modules/@mui/joy"] + } } } ``` ::: :::error `<CssVarsProvider />` is _required_ when working with Material UI's icons inside an app using Joy UI, so that the components can correctly adjust the icons based on the usage. ::: ### Usage By default, Joy UI components are able to control an icon's color, font size, and margins when its size or variant changes. {{"demo": "JoyMaterialIcon.js"}} ### Size To control the size of the icon, use `fontSize` prop. The value can be one of the keys in `theme.fontSize` (the default value is `"xl"`). {{"demo": "IconFontSizes.js"}} ## Third-party icons To use other icon libraries, web font icons, or plain SVG icons with Joy UI, apply the styles with specific CSS variables as shown in the example below: ```jsx import { CssVarsProvider } from '@mui/joy/styles'; import GlobalStyles from '@mui/joy/GlobalStyles'; // The `GlobalStyles` component is used to create a global style sheet. // You can replace it with your preferred CSS solution. function App() { return ( <CssVarsProvider> <GlobalStyles styles={{ // The {selector} is the CSS selector to target the icon. // We recommend using a class over a tag if possible. '{selector}': { color: "var(--Icon-color)", margin: "var(--Icon-margin)", fontSize: "var(--Icon-fontSize, 20px)", width: "1em", height: "1em" } }}> </CssVarsProvider> ) } ``` Joy UI components can control those variables based on their size and variant to make the icons fit perfectly. --- Here is a collection of well-known icon libraries that you can use with Joy UI. ### react-icons - [Installation](https://react-icons.github.io/react-icons/) <iframe src="https://codesandbox.io/embed/joy-ui-react-icons-n6jljq?fontsize=12&hidenavigation=1&module=%2Fdemo.tsx&theme=dark" style="width:100%; height:250px; border:0; border-radius: 12px; overflow:hidden;" title="joy-ui-react-icons" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" ></iframe> ### Ionicons - [Browse icons](https://ionic.io/ionicons) - [Installation](https://ionic.io/ionicons/usage) <iframe src="https://codesandbox.io/embed/inspiring-visvesvaraya-etcc3x?fontsize=12&hidenavigation=1&module=%2Fdemo.tsx&theme=dark" style="width:100%; height:250px; border:0; border-radius: 12px; overflow:hidden;" title="inspiring-visvesvaraya-etcc3x" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" ></iframe> ### Heroicons - [Browse icons](https://heroicons.com/) - [Installation](https://github.com/tailwindlabs/heroicons#react) <iframe src="https://codesandbox.io/embed/joy-ui-heroicons-wv2ev1?fontsize=12&hidenavigation=1&module=%2Fdemo.tsx&theme=dark" style="width:100%; height:250px; border:0; border-radius: 12px; overflow:hidden;" title="joy-ui-heroicons" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" ></iframe> ### Bootstrap Icons - [Browse icons](https://icons.getbootstrap.com/) - [Installation](https://icons.getbootstrap.com/#install) <iframe src="https://codesandbox.io/embed/joy-ui-bootstrap-icons-x8g0cm?fontsize=12&hidenavigation=1&module=%2Fdemo.tsx&theme=dark" style="width:100%; height:250px; border:0; border-radius: 12px; overflow:hidden;" title="joy-ui-bootstrap" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" ></iframe> ### Font Awesome Icons - [Browse icons](https://fontawesome.com/icons) - [Installation](https://fontawesome.com/docs/web/use-with/react/) <iframe src="https://codesandbox.io/embed/joy-ui-fontawesome-kjbnqj?fontsize=12&hidenavigation=1&module=%2Fdemo.tsx&theme=dark" style="width:100%; height:250px; border:0; border-radius: 12px; overflow:hidden;" title="joy-ui-fontawesome" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" ></iframe> ### Iconify - [Browse icons](https://icon-sets.iconify.design/) - [Installationβ€”React](https://iconify.design/docs/icon-components/react/) - [Installationβ€”Web component](https://iconify.design/docs/iconify-icon/) - [Figma plugin](https://iconify.design/docs/design/figma/) <iframe src="https://codesandbox.io/embed/joy-ui-iconify-r8fjrm?fontsize=12&hidenavigation=1&module=%2Fdemo.tsx&theme=dark" style="width:100%; height:250px; border:0; border-radius: 12px; overflow:hidden;" title="joy-ui-iconify" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" ></iframe> ### Lucide - [Browse icons](https://icon-sets.iconify.design/) - [Installationβ€”React](https://lucide.dev/guide/packages/lucide-react) <iframe src="https://codesandbox.io/embed/joy-ui-lucide-sy7hio?fontsize=12&hidenavigation=1&module=%2Fdemo.tsx&theme=dark" style="width:100%; height:250px; border:0; border-radius: 12px; overflow:hidden;" title="joy-ui-lucide" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" ></iframe>
1,945
0
petrpan-code/mui/material-ui/docs/data/joy/integrations
petrpan-code/mui/material-ui/docs/data/joy/integrations/material-ui/material-ui.md
# Using Joy UI and Material UI together <p class="description">Learn how to use Joy UI and Material UI together in the same project.</p> ## Introduction There are two main use cases for using them together: 1. Your existing project already uses Material UI but you're willing to explore the new components and style Joy UI offers. 2. You've started your project with Joy UI but you find a key component you need is missing. :::info Once Joy UI reaches component parity with Material UI, we recommend that you **_choose one or the other_**. Not only do they have a different design language (and therefore a different theme structure) but they would increase your bundle size as well as potentially create unnecessary complexities. ::: Additionally, keep these in mind when using them together: - Both of them use [MUI System](/system/getting-started/) as their style engine, which uses React context for theming. - Theme scoping must be done on one of the libraries. ## Prerequisite - Have `@mui/material` and `@mui/joy` installed in your project. - The version of both libraries must be [v5.12.0](https://github.com/mui/material-ui/releases/tag/v5.12.0) or higher. ## Set up the providers Render Joy UI's `CssVarsProvider` inside Material UI's provider and use `THEME_ID` to separate the themes from each other. ```js import { experimental_extendTheme as materialExtendTheme, Experimental_CssVarsProvider as MaterialCssVarsProvider, THEME_ID as MATERIAL_THEME_ID, } from '@mui/material/styles'; import { CssVarsProvider as JoyCssVarsProvider } from '@mui/joy/styles'; import CssBaseline from '@mui/material/CssBaseline'; const materialTheme = materialExtendTheme(); export default function App() { return ( <MaterialCssVarsProvider theme={{ [MATERIAL_THEME_ID]: materialTheme }}> <JoyCssVarsProvider> <CssBaseline enableColorScheme /> ...Material UI and Joy UI components </JoyCssVarsProvider> </MaterialCssVarsProvider> ); } ``` <iframe src="https://codesandbox.io/embed/using-joy-ui-and-material-ui-together-tx58w5?module=%2Fdemo.tsx&fontsize=14&hidenavigation=1&theme=dark&view=preview" style="width:100%; height:400px; border:0; border-radius: 4px; overflow:hidden;" title="Joy UI - Human Interface Guidelines Typography System" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" ></iframe> ### Sync the color mode To sync the color mode between the providers, call `setMode` from both of the libraries: ```js import { useColorScheme as useJoyColorScheme } from '@mui/joy/styles'; import { useColorScheme as useMaterialColorScheme } from '@mui/material/styles'; const ModeToggle = () => { const { mode, setMode: setMaterialMode } = useMaterialColorScheme(); const { setMode: setJoyMode } = useJoyColorScheme(); const [mounted, setMounted] = React.useState(false); React.useEffect(() => { setMounted(true); }, []); if (!mounted) { // prevent server-side rendering mismatch // because `mode` is undefined on the server. return null; } return ( <IconButton onClick={() => { setMaterialMode(mode === 'dark' ? 'light' : 'dark'); setJoyMode(mode === 'dark' ? 'light' : 'dark'); }} > {/** You can use `mode` from Joy UI or Material UI since they are synced **/} {mode === 'dark' ? <DarkMode /> : <LightMode />} </IconButton> ); }; ``` ### Default mode If you want to change the `defaultMode`, you have to specify the prop to both of the providers: ```js <MaterialCssVarsProvider defaultMode="system" theme={{ [MATERIAL_THEME_ID]: materialTheme }} > <JoyCssVarsProvider defaultMode="system"> <CssBaseline enableColorScheme /> ...Material UI and Joy UI components </JoyCssVarsProvider> </MaterialCssVarsProvider> ``` ## Caveat Both libraries have the same class name prefix: ```js import MaterialTypography, { typographyClasses as materialTypographyClasses, } from '@mui/material/Typography'; import JoyTypography, { typographyClasses as joyTyographyClasses, } from '@mui/joy/Typography'; import Stack from '@mui/material/Stack'; <Stack sx={{ // similar to `& .${joyTyographyClasses.root}` [`& .${materialTypographyClasses.root}`]: { color: 'red', }, }} > {/* Both components are red. */} <MaterialTypography>Red</MaterialTypography> <JoyTypography>Red</JoyTypography> </Stack>; ``` Joy UI and Material UI components have a different name for [theming the components](/joy-ui/customization/themed-components/#component-identifier). For example, Joy UI's Button uses `JoyButton` whereas Material UI's Button uses `MuiButton`.
1,946
0
petrpan-code/mui/material-ui/docs/data/joy/integrations
petrpan-code/mui/material-ui/docs/data/joy/integrations/next-js-app-router/next-js-app-router.md
# Next.js App Router <p class="description">Learn how to use Joy UI with the Next.js App Router.</p> ## Example Starting fresh on a new App Router-based project? Jump right into the code with [this example: Joy UI - Next.js App Router with TypeScript](https://github.com/mui/material-ui/tree/master/examples/joy-ui-nextjs-ts). ## Next.js and React Server Components The Next.js App Router implements React Server Components, [an upcoming feature for React](https://github.com/reactjs/rfcs/blob/main/text/0227-server-module-conventions.md). To support the App Router, the components and hooks from Joy UI that need access to browser APIs are exported with the `"use client"` directive. :::warning React Server Components should not be conflated with the concept of server-side rendering (SSR). So-called Client Components are still server-rendered to HTML. For more details, see [this explanation](https://github.com/reactwg/server-components/discussions/4) of Client Components and SSR from the React Working Group. ::: ## Using Joy UI with the App Router To set up Joy UI, create a custom `ThemeRegistry` component that combines the Emotion `CacheProvider`, Joy UI's `CssVarsProvider` and the `useServerInsertedHTML` hook from `next/navigation` as follows: ```tsx // app/ThemeRegistry.tsx 'use client'; import createCache from '@emotion/cache'; import { useServerInsertedHTML } from 'next/navigation'; import { CacheProvider } from '@emotion/react'; import { CssVarsProvider } from '@mui/joy/styles'; import CssBaseline from '@mui/joy/CssBaseline'; import theme from '/path/to/custom/theme'; // OPTIONAL // This implementation is from emotion-js // https://github.com/emotion-js/emotion/issues/2928#issuecomment-1319747902 export default function ThemeRegistry(props) { const { options, children } = props; const [{ cache, flush }] = React.useState(() => { const cache = createCache(options); cache.compat = true; const prevInsert = cache.insert; let inserted: string[] = []; cache.insert = (...args) => { const serialized = args[1]; if (cache.inserted[serialized.name] === undefined) { inserted.push(serialized.name); } return prevInsert(...args); }; const flush = () => { const prevInserted = inserted; inserted = []; return prevInserted; }; return { cache, flush }; }); useServerInsertedHTML(() => { const names = flush(); if (names.length === 0) { return null; } let styles = ''; for (const name of names) { styles += cache.inserted[name]; } return ( <style key={cache.key} data-emotion={`${cache.key} ${names.join(' ')}`} dangerouslySetInnerHTML={{ __html: styles, }} /> ); }); return ( <CacheProvider value={cache}> <CssVarsProvider theme={theme}> {/* the custom theme is optional */} <CssBaseline /> {children} </CssVarsProvider> </CacheProvider> ); } // app/layout.tsx export default function RootLayout(props) { const { children } = props; return ( <html lang="en"> <body> <ThemeRegistry options={{ key: 'joy' }}>{children}</ThemeRegistry> </body> </html> ); } ``` ## Props serialization Props passed from server components-for example `page.js` or other routing files-must be [serializable](https://nextjs.org/docs/app/building-your-application/rendering/composition-patterns#passing-props-from-server-to-client-components-serialization). :::success This works without any additional directives: ```tsx // app/page.tsx import Sheet from '@mui/joy/Sheet'; import Typography from '@mui/joy/Typography'; export default function Page() { return ( <Sheet> <Typography fontSize="sm">Hello World</Typography> </Sheet> ); } ``` ::: :::error This _doesn't work_ because the Button's click handler is **non-serializable**: ```tsx // app/page.tsx import Button from '@mui/joy/Button'; import Sheet from '@mui/joy/Sheet'; export default function Page() { return ( <Sheet> {/* Next.js won't render this button without 'use-client' */} <Button onClick={() => { console.log('handle click'); }} > Submit </Button> </Sheet> ); } ``` Instead, the Next.js team recommend moving components like these ["down the tree"](https://nextjs.org/docs/app/building-your-application/rendering/composition-patterns#moving-client-components-down-the-tree) to avoid this issue and improve overall performance. :::
1,947
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/automatic-adjustment/InputIntegration.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import IconButton from '@mui/joy/IconButton'; import Input from '@mui/joy/Input'; import KeyRoundedIcon from '@mui/icons-material/KeyRounded'; import VisibilityRoundedIcon from '@mui/icons-material/VisibilityRounded'; export default function InputIntegration() { return ( <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}> <Input size="sm" startDecorator={<KeyRoundedIcon />} placeholder="Password" type="password" endDecorator={ <IconButton color="neutral"> <VisibilityRoundedIcon /> </IconButton> } /> <Input startDecorator={<KeyRoundedIcon />} placeholder="Password" type="password" endDecorator={ <IconButton color="neutral"> <VisibilityRoundedIcon /> </IconButton> } /> <Input size="lg" startDecorator={<KeyRoundedIcon />} placeholder="Password" type="password" endDecorator={ <IconButton color="neutral"> <VisibilityRoundedIcon /> </IconButton> } /> </Box> ); }
1,948
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/automatic-adjustment/InputVariables.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import ListDivider from '@mui/joy/ListDivider'; import Input from '@mui/joy/Input'; import FormControl from '@mui/joy/FormControl'; import FormLabel from '@mui/joy/FormLabel'; export default function InputVariables() { const [radius, setRadius] = React.useState(16); const [childHeight, setChildHeight] = React.useState(28); return ( <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}> <Input size="md" placeholder="[email protected]" endDecorator={ <Button variant="soft" size="sm"> Subscribe </Button> } sx={{ '--Input-radius': `${radius}px`, '--Input-decoratorChildHeight': `${childHeight}px`, }} /> <ListDivider component="hr" /> <Box sx={{ mx: 'auto', display: 'flex', gap: 2 }}> <FormControl> <FormLabel>--Input-radius</FormLabel> <Input size="sm" type="number" value={radius} onChange={(event) => setRadius(event.target.valueAsNumber)} /> </FormControl> <FormControl> <FormLabel>--Input-decoratorChildHeight</FormLabel> <Input size="sm" type="number" value={childHeight} onChange={(event) => setChildHeight(event.target.valueAsNumber)} /> </FormControl> </Box> </Box> ); }
1,949
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/automatic-adjustment/ListThemes.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import FormLabel from '@mui/joy/FormLabel'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import ListItemButton from '@mui/joy/ListItemButton'; import Select from '@mui/joy/Select'; import Option from '@mui/joy/Option'; import ArticleRoundedIcon from '@mui/icons-material/ArticleRounded'; import ToggleOffRoundedIcon from '@mui/icons-material/ToggleOffRounded'; import HighlightedCode from 'docs/src/modules/components/HighlightedCode'; import BrandingProvider from 'docs/src/BrandingProvider'; export default function ListThemes() { const [preset, setPreset] = React.useState(''); const rootPresets = { dense: { '--ListItem-minHeight': '27px', '--ListItemDecorator-size': '28px', '--ListItem-radius': '5px', '--List-gap': '5px', '--List-padding': '10px', '--ListItem-paddingLeft': '5px', '--ListItem-paddingRight': '5px', '--ListItem-paddingY': '0px', '--List-nestedInsetStart': '28px', fontSize: '14px', }, cozy: { '--List-radius': '20px', '--ListItem-minHeight': '44px', '--List-padding': '8px', '--List-gap': '8px', '--List-nestedInsetStart': 'var(--ListItemDecorator-size)', }, }; const nestedPresets = { dense: { '--List-nestedInsetStart': '0px', }, }; return ( <Box sx={{ m: -1.5, mt: 0.5, flexGrow: 1, maxWidth: 'calc(100% + 24px)', borderRadius: '8px', '& .markdown-body pre': { margin: 0, borderRadius: 'xs', }, }} > <Box sx={{ display: 'flex', flexDirection: 'column', gap: 1, mb: 3 }}> <Box sx={{ m: 'auto' }}> <List variant="outlined" sx={{ ...rootPresets[preset] }}> <ListItem> <ListItemButton> <ListItemDecorator> <ToggleOffRoundedIcon /> </ListItemDecorator> Menu item 1 </ListItemButton> </ListItem> <ListItem nested> <ListItemButton id="category-1"> <ListItemDecorator> <ArticleRoundedIcon /> </ListItemDecorator> Menu item 2 </ListItemButton> <List aria-labelledby="category-1" sx={preset ? nestedPresets[preset] : {}} > <ListItem> <ListItemButton>Menu item 2.1</ListItemButton> </ListItem> <ListItem> <ListItemButton>Menu item 2.2</ListItemButton> </ListItem> </List> </ListItem> </List> </Box> <Box sx={{ mx: 'auto', pt: 2, width: '100%', display: 'flex', flexDirection: 'column', gap: 1, alignItems: 'center', justifyContent: 'center', }} > <FormLabel htmlFor="list-theme">Change the preset:</FormLabel> <Select size="sm" slotProps={{ button: { id: 'list-theme', }, }} value={preset} onChange={(event, newValue) => setPreset(newValue)} sx={{ minWidth: 160 }} > <Option value="">Default</Option> <Option value="dense">Dense</Option> <Option value="cozy">Cozy</Option> </Select> </Box> </Box> { <BrandingProvider mode="dark"> <HighlightedCode code={`// The code is shorten to show only the markup and the sx value. <List${ preset ? ` sx={{ ${JSON.stringify(rootPresets[preset], null, 4) .replace('{', '') .replace('}', '') .trim()} }} ` : '' }> <ListItem nested> <ListItemButton>...</ListItemButton> <List${ nestedPresets[preset] ? ` sx={{ ${JSON.stringify(nestedPresets[preset], null, 8) .replace('{', '') .replace('}', '') .trim()} }} ` : '' }> <ListItem nested> <ListItemButton>...</ListItemButton> <List> <ListItem>...</ListItem> <ListItem>...</ListItem> </List> </ListItem> <ListItem>...</ListItem> <ListItem>...</ListItem> </List> </ListItem> <ListItem>...</ListItem> </List> `} copyButtonHidden language="jsx" sx={{ display: { xs: 'none', md: 'block' }, borderRadius: '7px', }} /> </BrandingProvider> } </Box> ); }
1,950
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/automatic-adjustment/automatic-adjustment.md
# Automatic adjustment <p class="description">Joy UI components adapt to one another to ensure consistency across your app without the need to micromanage your CSS.</p> Joy UI components automatically adjust their styles and DOM structure relative to one another to ensure consistent sizing, spacing, and semantically appropriate HTML throughout your app. This makes it much faster and more efficient for you to apply pixel-perfect adjustments to your UI without having to worry to about minor inconsistencies between components. ## Style adjustments Joy UI components adapt their styles relative to the context in which they're rendered. You can see a few examples of this below. ### Input When using icons or buttons within an Input component, Joy UI automatically adjusts their size: {{"demo": "InputIntegration.js"}} If you customize their respective CSS variables, Joy UI ensures that their spacing and radii follow those of the Input: {{"demo": "InputVariables.js"}} ### List Nested lists are a common source of frustration when it comes to styling. Joy UI's meaningful variables are intended to simplify this process. Play around with different presets in the demo below to see which CSS variables are customized: {{"demo": "ListThemes.js"}} ## Structure adjustments Joy UI components adjust their DOM structure based on their context to ensure that the appropriate HTML tags are used. Check out a few examples below: ### Typography The Typography component renders as a `<p>` tag by default. When a second Typography component is nested inside, it will automatically render as a `<span>`, which is the correct markup in this situation: ```js <Typography> // the parent Typography renders as a <p> This is a very <Typography fontWeight="lg">important</Typography> // the child renders as a <span> message. </Typography> ``` ### List Item The List Item component renders as an `<li>` tag by default. If its parent List component is not a `<menu>`, `<ul>`, or `<ol>`, then the List Item will correct itself and render as a `<div>` instead. ```js <List component="div"> <ListItem> // automatically renders as a <div> ... </ListItem> </List> ```
1,951
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionAnyParent.js
import * as React from 'react'; import PropTypes from 'prop-types'; import { applySolidInversion } from '@mui/joy/colorInversion'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Typography from '@mui/joy/Typography'; function Stat({ description, value }) { return ( <Box sx={{ borderLeft: 3, borderColor: 'divider', px: 2, py: 0.5 }}> <Typography level="h3" component="div"> {value} </Typography> <Typography level="title-sm" textColor="text.secondary"> {description} </Typography> </Box> ); } Stat.propTypes = { description: PropTypes.node, value: PropTypes.node, }; export default function ColorInversionAnyParent() { return ( <Box sx={[ { display: 'grid', gridTemplateColumns: { sm: '1fr 1fr' }, alignItems: 'center', rowGap: 2, columnGap: 8, p: 4, borderRadius: 'sm', background: (theme) => `linear-gradient(45deg, ${theme.vars.palette.neutral[800]}, ${theme.vars.palette.neutral[600]})`, }, applySolidInversion('neutral'), ]} > <div> <Typography sx={{ mb: 2 }}> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </Typography> <Button variant="soft">Learn more</Button> </div> <Box sx={{ display: 'grid', gridTemplateColumns: { xs: 'repeat(auto-fill, minmax(min(100%, 180px), 1fr))', sm: '1fr 1fr', }, gap: 3, }} > <Stat value="4M" description="Weekly downloads" /> <Stat value="87k" description="Stars on GitHub" /> <Stat value="2.7k" description="Open source contributors" /> <Stat value="18.4k" description="Followers on Twitter" /> </Box> </Box> ); }
1,952
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionAnyParent.tsx
import * as React from 'react'; import { applySolidInversion } from '@mui/joy/colorInversion'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Typography from '@mui/joy/Typography'; function Stat({ description, value, }: { description: React.ReactNode; value: React.ReactNode; }) { return ( <Box sx={{ borderLeft: 3, borderColor: 'divider', px: 2, py: 0.5 }}> <Typography level="h3" component="div"> {value} </Typography> <Typography level="title-sm" textColor="text.secondary"> {description} </Typography> </Box> ); } export default function ColorInversionAnyParent() { return ( <Box sx={[ { display: 'grid', gridTemplateColumns: { sm: '1fr 1fr' }, alignItems: 'center', rowGap: 2, columnGap: 8, p: 4, borderRadius: 'sm', background: (theme) => `linear-gradient(45deg, ${theme.vars.palette.neutral[800]}, ${theme.vars.palette.neutral[600]})`, }, applySolidInversion('neutral'), ]} > <div> <Typography sx={{ mb: 2 }}> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </Typography> <Button variant="soft">Learn more</Button> </div> <Box sx={{ display: 'grid', gridTemplateColumns: { xs: 'repeat(auto-fill, minmax(min(100%, 180px), 1fr))', sm: '1fr 1fr', }, gap: 3, }} > <Stat value="4M" description="Weekly downloads" /> <Stat value="87k" description="Stars on GitHub" /> <Stat value="2.7k" description="Open source contributors" /> <Stat value="18.4k" description="Followers on Twitter" /> </Box> </Box> ); }
1,953
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionAnyParentStyled.js
import * as React from 'react'; import PropTypes from 'prop-types'; import { styled } from '@mui/joy/styles'; import { applySolidInversion } from '@mui/joy/colorInversion'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Typography from '@mui/joy/Typography'; const StyledBox = styled(Box)( ({ theme }) => ({ padding: 32, display: 'grid', gridTemplateColumns: '1fr 1fr', alignItems: 'center', rowGap: 16, columnGap: 64, borderRadius: 8, background: `linear-gradient(45deg, ${theme.vars.palette.neutral[800]}, ${theme.vars.palette.neutral[600]})`, }), applySolidInversion('neutral'), ); function Stat({ description, value }) { return ( <Box sx={{ borderLeft: 3, borderColor: 'divider', px: 2, py: 0.5 }}> <Typography level="h3" component="div"> {value} </Typography> <Typography level="title-sm" textColor="text.secondary"> {description} </Typography> </Box> ); } Stat.propTypes = { description: PropTypes.node, value: PropTypes.node, }; export default function ColorInversionAnyParentStyled() { return ( <StyledBox> <div> <Typography sx={{ mb: 2 }}> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </Typography> <Button variant="soft">Learn more</Button> </div> <Box sx={{ display: 'grid', gridTemplateColumns: { xs: 'repeat(auto-fill, minmax(min(100%, 180px), 1fr))', sm: '1fr 1fr', }, gap: 3, }} > <Stat value="4M" description="Weekly downloads" /> <Stat value="87k" description="Stars on GitHub" /> <Stat value="2.7k" description="Open source contributors" /> <Stat value="18.4k" description="Followers on Twitter" /> </Box> </StyledBox> ); }
1,954
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionAnyParentStyled.tsx
import * as React from 'react'; import { styled } from '@mui/joy/styles'; import { applySolidInversion } from '@mui/joy/colorInversion'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Typography from '@mui/joy/Typography'; const StyledBox = styled(Box)( ({ theme }) => ({ padding: 32, display: 'grid', gridTemplateColumns: '1fr 1fr', alignItems: 'center', rowGap: 16, columnGap: 64, borderRadius: 8, background: `linear-gradient(45deg, ${theme.vars.palette.neutral[800]}, ${theme.vars.palette.neutral[600]})`, }), applySolidInversion('neutral'), ); function Stat({ description, value, }: { description: React.ReactNode; value: React.ReactNode; }) { return ( <Box sx={{ borderLeft: 3, borderColor: 'divider', px: 2, py: 0.5 }}> <Typography level="h3" component="div"> {value} </Typography> <Typography level="title-sm" textColor="text.secondary"> {description} </Typography> </Box> ); } export default function ColorInversionAnyParentStyled() { return ( <StyledBox> <div> <Typography sx={{ mb: 2 }}> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </Typography> <Button variant="soft">Learn more</Button> </div> <Box sx={{ display: 'grid', gridTemplateColumns: { xs: 'repeat(auto-fill, minmax(min(100%, 180px), 1fr))', sm: '1fr 1fr', }, gap: 3, }} > <Stat value="4M" description="Weekly downloads" /> <Stat value="87k" description="Stars on GitHub" /> <Stat value="2.7k" description="Open source contributors" /> <Stat value="18.4k" description="Followers on Twitter" /> </Box> </StyledBox> ); }
1,955
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionFooter.js
import * as React from 'react'; import AspectRatio from '@mui/joy/AspectRatio'; import Box from '@mui/joy/Box'; import IconButton from '@mui/joy/IconButton'; import Card from '@mui/joy/Card'; import CardContent from '@mui/joy/CardContent'; import Divider from '@mui/joy/Divider'; import Input from '@mui/joy/Input'; import List from '@mui/joy/List'; import ListSubheader from '@mui/joy/ListSubheader'; import ListItem from '@mui/joy/ListItem'; import ListItemButton from '@mui/joy/ListItemButton'; import Typography from '@mui/joy/Typography'; import Sheet from '@mui/joy/Sheet'; import FacebookRoundedIcon from '@mui/icons-material/FacebookRounded'; import GitHubIcon from '@mui/icons-material/GitHub'; import SendIcon from '@mui/icons-material/Send'; import ColorLensRoundedIcon from '@mui/icons-material/ColorLensRounded'; export default function ColorInversionFooter() { const [color, setColor] = React.useState('neutral'); return ( <Sheet variant="solid" color={color} invertedColors sx={{ ...(color !== 'neutral' && { bgcolor: `${color}.800`, }), flexGrow: 1, p: 2, borderRadius: { xs: 0, sm: 'sm' }, }} > <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}> <IconButton variant="soft" size="sm" onClick={() => { const colors = ['primary', 'neutral', 'danger', 'success', 'warning']; const nextColorIndex = colors.indexOf(color) + 1; setColor(colors[nextColorIndex] ?? colors[0]); }} > <ColorLensRoundedIcon fontSize="small" /> </IconButton> <Divider orientation="vertical" /> <IconButton variant="plain"> <FacebookRoundedIcon /> </IconButton> <IconButton variant="plain"> <GitHubIcon /> </IconButton> <Input variant="soft" placeholder="Type in your email" type="email" name="email" endDecorator={ <IconButton variant="soft" aria-label="subscribe"> <SendIcon /> </IconButton> } sx={{ ml: 'auto', display: { xs: 'none', md: 'flex' } }} /> </Box> <Divider sx={{ my: 2 }} /> <Box sx={{ display: 'flex', flexDirection: { xs: 'column', md: 'row' }, alignItems: { md: 'flex-start' }, justifyContent: 'space-between', flexWrap: 'wrap', gap: 2, }} > <Card variant="soft" size="sm" sx={{ flexDirection: { xs: 'row', md: 'column' }, minWidth: { xs: '100%', md: 'auto' }, gap: 1, }} > <AspectRatio ratio="21/9" minHeight={80} sx={{ flexBasis: { xs: 200, md: 'initial' } }} > <img alt="" src="/static/blog/mui-product-comparison/ecosystem.png" /> </AspectRatio> <CardContent> <Typography level="body-sm">Intro to the MUI ecosystem</Typography> <Typography level="body-xs">Blog post</Typography> </CardContent> </Card> <List size="sm" orientation="horizontal" wrap sx={{ flexGrow: 0, '--ListItem-radius': '8px', '--ListItem-gap': '0px' }} > <ListItem nested sx={{ width: { xs: '50%', md: 140 } }}> <ListSubheader sx={{ fontWeight: 'xl' }}>Sitemap</ListSubheader> <List> <ListItem> <ListItemButton>Services</ListItemButton> </ListItem> <ListItem> <ListItemButton>Blog</ListItemButton> </ListItem> <ListItem> <ListItemButton>About</ListItemButton> </ListItem> </List> </ListItem> <ListItem nested sx={{ width: { xs: '50%', md: 180 } }}> <ListSubheader sx={{ fontWeight: 'xl' }}>Products</ListSubheader> <List sx={{ '--ListItemDecorator-size': '32px' }}> <ListItem> <ListItemButton>Joy UI</ListItemButton> </ListItem> <ListItem> <ListItemButton>Base UI</ListItemButton> </ListItem> <ListItem> <ListItemButton>Material UI</ListItemButton> </ListItem> </List> </ListItem> </List> </Box> </Sheet> ); }
1,956
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionFooter.tsx
import * as React from 'react'; import { ColorPaletteProp } from '@mui/joy/styles'; import AspectRatio from '@mui/joy/AspectRatio'; import Box from '@mui/joy/Box'; import IconButton from '@mui/joy/IconButton'; import Card from '@mui/joy/Card'; import CardContent from '@mui/joy/CardContent'; import Divider from '@mui/joy/Divider'; import Input from '@mui/joy/Input'; import List from '@mui/joy/List'; import ListSubheader from '@mui/joy/ListSubheader'; import ListItem from '@mui/joy/ListItem'; import ListItemButton from '@mui/joy/ListItemButton'; import Typography from '@mui/joy/Typography'; import Sheet from '@mui/joy/Sheet'; import FacebookRoundedIcon from '@mui/icons-material/FacebookRounded'; import GitHubIcon from '@mui/icons-material/GitHub'; import SendIcon from '@mui/icons-material/Send'; import ColorLensRoundedIcon from '@mui/icons-material/ColorLensRounded'; export default function ColorInversionFooter() { const [color, setColor] = React.useState<ColorPaletteProp>('neutral'); return ( <Sheet variant="solid" color={color} invertedColors sx={{ ...(color !== 'neutral' && { bgcolor: `${color}.800`, }), flexGrow: 1, p: 2, borderRadius: { xs: 0, sm: 'sm' }, }} > <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}> <IconButton variant="soft" size="sm" onClick={() => { const colors: ColorPaletteProp[] = [ 'primary', 'neutral', 'danger', 'success', 'warning', ]; const nextColorIndex = colors.indexOf(color) + 1; setColor(colors[nextColorIndex] ?? colors[0]); }} > <ColorLensRoundedIcon fontSize="small" /> </IconButton> <Divider orientation="vertical" /> <IconButton variant="plain"> <FacebookRoundedIcon /> </IconButton> <IconButton variant="plain"> <GitHubIcon /> </IconButton> <Input variant="soft" placeholder="Type in your email" type="email" name="email" endDecorator={ <IconButton variant="soft" aria-label="subscribe"> <SendIcon /> </IconButton> } sx={{ ml: 'auto', display: { xs: 'none', md: 'flex' } }} /> </Box> <Divider sx={{ my: 2 }} /> <Box sx={{ display: 'flex', flexDirection: { xs: 'column', md: 'row' }, alignItems: { md: 'flex-start' }, justifyContent: 'space-between', flexWrap: 'wrap', gap: 2, }} > <Card variant="soft" size="sm" sx={{ flexDirection: { xs: 'row', md: 'column' }, minWidth: { xs: '100%', md: 'auto' }, gap: 1, }} > <AspectRatio ratio="21/9" minHeight={80} sx={{ flexBasis: { xs: 200, md: 'initial' } }} > <img alt="" src="/static/blog/mui-product-comparison/ecosystem.png" /> </AspectRatio> <CardContent> <Typography level="body-sm">Intro to the MUI ecosystem</Typography> <Typography level="body-xs">Blog post</Typography> </CardContent> </Card> <List size="sm" orientation="horizontal" wrap sx={{ flexGrow: 0, '--ListItem-radius': '8px', '--ListItem-gap': '0px' }} > <ListItem nested sx={{ width: { xs: '50%', md: 140 } }}> <ListSubheader sx={{ fontWeight: 'xl' }}>Sitemap</ListSubheader> <List> <ListItem> <ListItemButton>Services</ListItemButton> </ListItem> <ListItem> <ListItemButton>Blog</ListItemButton> </ListItem> <ListItem> <ListItemButton>About</ListItemButton> </ListItem> </List> </ListItem> <ListItem nested sx={{ width: { xs: '50%', md: 180 } }}> <ListSubheader sx={{ fontWeight: 'xl' }}>Products</ListSubheader> <List sx={{ '--ListItemDecorator-size': '32px' }}> <ListItem> <ListItemButton>Joy UI</ListItemButton> </ListItem> <ListItem> <ListItemButton>Base UI</ListItemButton> </ListItem> <ListItem> <ListItemButton>Material UI</ListItemButton> </ListItem> </List> </ListItem> </List> </Box> </Sheet> ); }
1,957
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionHeader.js
import * as React from 'react'; import Badge from '@mui/joy/Badge'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Dropdown from '@mui/joy/Dropdown'; import Input from '@mui/joy/Input'; import IconButton from '@mui/joy/IconButton'; import ListDivider from '@mui/joy/ListDivider'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import Menu from '@mui/joy/Menu'; import MenuButton from '@mui/joy/MenuButton'; import MenuItem from '@mui/joy/MenuItem'; import Typography from '@mui/joy/Typography'; import Sheet from '@mui/joy/Sheet'; import Chip from '@mui/joy/Chip'; import AddIcon from '@mui/icons-material/Add'; import BubbleChartIcon from '@mui/icons-material/BubbleChart'; import NotificationsIcon from '@mui/icons-material/Notifications'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; import ColorLensRoundedIcon from '@mui/icons-material/ColorLensRounded'; export default function ColorInversionHeader() { const [color, setColor] = React.useState('primary'); return ( <Sheet variant="solid" color={color} invertedColors sx={{ display: 'flex', alignItems: 'center', flexGrow: 1, p: 2, borderRadius: { xs: 0, sm: 'sm' }, minWidth: 'min-content', ...(color !== 'warning' && { background: (theme) => `linear-gradient(to top, ${theme.vars.palette[color][600]}, ${theme.vars.palette[color][500]})`, }), }} > <IconButton variant="soft" size="sm" onClick={() => { const colors = ['primary', 'neutral', 'danger', 'success', 'warning']; const nextColorIndex = colors.indexOf(color) + 1; setColor(colors[nextColorIndex] ?? colors[0]); }} > <ColorLensRoundedIcon fontSize="small" /> </IconButton> <Box sx={{ flex: 1, display: 'flex', gap: 1, px: 2 }}> <Dropdown> <MenuButton sx={{ '--Button-radius': '1.5rem', }} variant="outlined" endDecorator={<KeyboardArrowDownIcon />} > Main </MenuButton> <Menu variant="outlined" placement="bottom-start" disablePortal size="sm" sx={{ '--ListItemDecorator-size': '24px', '--ListItem-minHeight': '40px', '--ListDivider-gap': '4px', minWidth: 200, }} > <MenuItem> <ListItemDecorator> <BubbleChartIcon /> </ListItemDecorator> Products </MenuItem> <ListDivider /> <MenuItem>Pricing</MenuItem> <MenuItem> Case studies{' '} <Chip variant="outlined" size="sm" sx={{ ml: 'auto', bgcolor: (theme) => `rgba(${theme.vars.palette.primary.mainChannel} / 0.1)`, }} > Beta </Chip> </MenuItem> </Menu> </Dropdown> </Box> <Box sx={{ display: 'flex', flexShrink: 0, gap: 2 }}> <Button startDecorator={<AddIcon />} sx={{ display: { xs: 'none', md: 'inline-flex' } }} > New invoice </Button> <Input placeholder="Search" variant="soft" size="sm" endDecorator={ <Typography component="span" variant="outlined" level="body-xs" sx={{ bgcolor: 'background.surface', mx: 0 }} > ⌘K </Typography> } sx={{ '--Input-paddingInline': '12px', width: 160, display: { xs: 'none', lg: 'flex' }, }} /> <Badge badgeContent={2} variant="solid" color="danger"> <IconButton variant="soft" sx={{ borderRadius: '50%' }}> <NotificationsIcon /> </IconButton> </Badge> </Box> </Sheet> ); }
1,958
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionHeader.tsx
import * as React from 'react'; import { ColorPaletteProp } from '@mui/joy/styles'; import Badge from '@mui/joy/Badge'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Dropdown from '@mui/joy/Dropdown'; import Input from '@mui/joy/Input'; import IconButton from '@mui/joy/IconButton'; import ListDivider from '@mui/joy/ListDivider'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import Menu from '@mui/joy/Menu'; import MenuButton from '@mui/joy/MenuButton'; import MenuItem from '@mui/joy/MenuItem'; import Typography from '@mui/joy/Typography'; import Sheet from '@mui/joy/Sheet'; import Chip from '@mui/joy/Chip'; import AddIcon from '@mui/icons-material/Add'; import BubbleChartIcon from '@mui/icons-material/BubbleChart'; import NotificationsIcon from '@mui/icons-material/Notifications'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; import ColorLensRoundedIcon from '@mui/icons-material/ColorLensRounded'; export default function ColorInversionHeader() { const [color, setColor] = React.useState<ColorPaletteProp>('primary'); return ( <Sheet variant="solid" color={color} invertedColors sx={{ display: 'flex', alignItems: 'center', flexGrow: 1, p: 2, borderRadius: { xs: 0, sm: 'sm' }, minWidth: 'min-content', ...(color !== 'warning' && { background: (theme) => `linear-gradient(to top, ${theme.vars.palette[color][600]}, ${theme.vars.palette[color][500]})`, }), }} > <IconButton variant="soft" size="sm" onClick={() => { const colors: ColorPaletteProp[] = [ 'primary', 'neutral', 'danger', 'success', 'warning', ]; const nextColorIndex = colors.indexOf(color) + 1; setColor(colors[nextColorIndex] ?? colors[0]); }} > <ColorLensRoundedIcon fontSize="small" /> </IconButton> <Box sx={{ flex: 1, display: 'flex', gap: 1, px: 2 }}> <Dropdown> <MenuButton sx={{ '--Button-radius': '1.5rem', }} variant="outlined" endDecorator={<KeyboardArrowDownIcon />} > Main </MenuButton> <Menu variant="outlined" placement="bottom-start" disablePortal size="sm" sx={{ '--ListItemDecorator-size': '24px', '--ListItem-minHeight': '40px', '--ListDivider-gap': '4px', minWidth: 200, }} > <MenuItem> <ListItemDecorator> <BubbleChartIcon /> </ListItemDecorator> Products </MenuItem> <ListDivider /> <MenuItem>Pricing</MenuItem> <MenuItem> Case studies{' '} <Chip variant="outlined" size="sm" sx={{ ml: 'auto', bgcolor: (theme) => `rgba(${theme.vars.palette.primary.mainChannel} / 0.1)`, }} > Beta </Chip> </MenuItem> </Menu> </Dropdown> </Box> <Box sx={{ display: 'flex', flexShrink: 0, gap: 2 }}> <Button startDecorator={<AddIcon />} sx={{ display: { xs: 'none', md: 'inline-flex' } }} > New invoice </Button> <Input placeholder="Search" variant="soft" size="sm" endDecorator={ <Typography component="span" variant="outlined" level="body-xs" sx={{ bgcolor: 'background.surface', mx: 0 }} > ⌘K </Typography> } sx={{ '--Input-paddingInline': '12px', width: 160, display: { xs: 'none', lg: 'flex' }, }} /> <Badge badgeContent={2} variant="solid" color="danger"> <IconButton variant="soft" sx={{ borderRadius: '50%' }}> <NotificationsIcon /> </IconButton> </Badge> </Box> </Sheet> ); }
1,959
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionMarketing.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import IconButton from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; import Sheet from '@mui/joy/Sheet'; import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; import ColorLensRoundedIcon from '@mui/icons-material/ColorLensRounded'; /** * Design credit: https://flutter.dev/ */ export default function ColorInversionMarketing() { const [color, setColor] = React.useState('primary'); return ( <Sheet variant="solid" color={color} invertedColors sx={{ flexGrow: 1, display: 'flex', bgcolor: color === 'primary' ? '#042449' : undefined, p: { xs: '36px', md: '70px' }, pt: { xs: '24px', md: '60px' }, borderRadius: 'lg', overflow: 'hidden', '& button': { borderRadius: 'xl' }, }} > <Box sx={{ zIndex: 1, position: 'relative' }}> <Typography level="h2">Get started</Typography> <Typography sx={{ mt: 0.5, mb: 2 }}> Instant access to the power of the Joy UI library. </Typography> <Box sx={{ display: 'flex', gap: 1, flexWrap: 'wrap', maxWidth: 'max-content', '& > *': { flexGrow: 1, fontWeight: 'lg' }, }} > <Button sx={{ minWidth: 120 }}>Install</Button> <Button variant="plain" endDecorator={<ArrowForwardIcon fontSize="md" />} sx={{ '&:hover': { '--Button-gap': '0.625rem' }, '& span': { transition: '0.15s' }, }} > See the docs </Button> </Box> </Box> <Box component="img" alt="" src="https://storage.googleapis.com/cms-storage-bucket/72521e62275b24d3c37d.png" sx={{ position: 'absolute', height: '100%', top: 0, right: 0 }} /> <IconButton sx={{ position: 'absolute', bottom: '1.5rem', right: '1.5rem', borderRadius: '50%', }} onClick={() => { const colors = ['primary', 'neutral', 'danger', 'success', 'warning']; const nextColorIndex = colors.indexOf(color) + 1; setColor(colors[nextColorIndex] ?? colors[0]); }} > <ColorLensRoundedIcon fontSize="small" /> </IconButton> </Sheet> ); }
1,960
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionMarketing.tsx
import * as React from 'react'; import { ColorPaletteProp } from '@mui/joy/styles'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import IconButton from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; import Sheet from '@mui/joy/Sheet'; import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; import ColorLensRoundedIcon from '@mui/icons-material/ColorLensRounded'; /** * Design credit: https://flutter.dev/ */ export default function ColorInversionMarketing() { const [color, setColor] = React.useState<ColorPaletteProp>('primary'); return ( <Sheet variant="solid" color={color} invertedColors sx={{ flexGrow: 1, display: 'flex', bgcolor: color === 'primary' ? '#042449' : undefined, p: { xs: '36px', md: '70px' }, pt: { xs: '24px', md: '60px' }, borderRadius: 'lg', overflow: 'hidden', '& button': { borderRadius: 'xl' }, }} > <Box sx={{ zIndex: 1, position: 'relative' }}> <Typography level="h2">Get started</Typography> <Typography sx={{ mt: 0.5, mb: 2 }}> Instant access to the power of the Joy UI library. </Typography> <Box sx={{ display: 'flex', gap: 1, flexWrap: 'wrap', maxWidth: 'max-content', '& > *': { flexGrow: 1, fontWeight: 'lg' }, }} > <Button sx={{ minWidth: 120 }}>Install</Button> <Button variant="plain" endDecorator={<ArrowForwardIcon fontSize="md" />} sx={{ '&:hover': { '--Button-gap': '0.625rem' }, '& span': { transition: '0.15s' }, }} > See the docs </Button> </Box> </Box> <Box component="img" alt="" src="https://storage.googleapis.com/cms-storage-bucket/72521e62275b24d3c37d.png" sx={{ position: 'absolute', height: '100%', top: 0, right: 0 }} /> <IconButton sx={{ position: 'absolute', bottom: '1.5rem', right: '1.5rem', borderRadius: '50%', }} onClick={() => { const colors: ColorPaletteProp[] = [ 'primary', 'neutral', 'danger', 'success', 'warning', ]; const nextColorIndex = colors.indexOf(color) + 1; setColor(colors[nextColorIndex] ?? colors[0]); }} > <ColorLensRoundedIcon fontSize="small" /> </IconButton> </Sheet> ); }
1,961
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionMotivation.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Card from '@mui/joy/Card'; import Chip from '@mui/joy/Chip'; import IconButton from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; import BookmarkOutlinedIcon from '@mui/icons-material/BookmarkOutlined'; import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; export default function ColorInversionMotivation() { const demo = ( <Card sx={{ gap: 2, maxWidth: 300 }}> <Chip size="sm" variant="soft" sx={{ alignSelf: 'flex-start', borderRadius: 'xl' }} > New </Chip> <IconButton variant="outlined" color="neutral" size="sm" sx={{ position: 'absolute', top: '0.75rem', right: '0.75rem' }} > <BookmarkOutlinedIcon /> </IconButton> <Typography level="title-lg" fontWeight="lg"> Learn how to build super fast websites. </Typography> <Button variant="solid" endDecorator={<KeyboardArrowRightIcon />}> Read more </Button> </Card> ); return ( <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 6, pt: 3, }} > {/* Left: The global variants are applied to children only */} <Box sx={{ maxWidth: 300 }}> {demo} <Typography level="body-sm" mt={2} textAlign="center"> <b>One layer</b> <br /> Global variants are applied only to the children. </Typography> </Box> {/* Right: The global variants are applied to both parent and children */} <Box sx={{ maxWidth: 300 }}> {React.cloneElement(demo, { variant: 'solid', color: 'primary', })} <Typography level="body-sm" mt={2} textAlign="center"> <b>Two layers</b> <br /> Global variants are applied to the card <i>and</i> children. </Typography> </Box> </Box> ); }
1,962
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionMotivation.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Card from '@mui/joy/Card'; import Chip from '@mui/joy/Chip'; import IconButton from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; import BookmarkOutlinedIcon from '@mui/icons-material/BookmarkOutlined'; import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; export default function ColorInversionMotivation() { const demo = ( <Card sx={{ gap: 2, maxWidth: 300 }}> <Chip size="sm" variant="soft" sx={{ alignSelf: 'flex-start', borderRadius: 'xl' }} > New </Chip> <IconButton variant="outlined" color="neutral" size="sm" sx={{ position: 'absolute', top: '0.75rem', right: '0.75rem' }} > <BookmarkOutlinedIcon /> </IconButton> <Typography level="title-lg" fontWeight="lg"> Learn how to build super fast websites. </Typography> <Button variant="solid" endDecorator={<KeyboardArrowRightIcon />}> Read more </Button> </Card> ); return ( <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 6, pt: 3, }} > {/* Left: The global variants are applied to children only */} <Box sx={{ maxWidth: 300 }}> {demo} <Typography level="body-sm" mt={2} textAlign="center"> <b>One layer</b> <br /> Global variants are applied only to the children. </Typography> </Box> {/* Right: The global variants are applied to both parent and children */} <Box sx={{ maxWidth: 300 }}> {React.cloneElement(demo, { variant: 'solid', color: 'primary', })} <Typography level="body-sm" mt={2} textAlign="center"> <b>Two layers</b> <br /> Global variants are applied to the card <i>and</i> children. </Typography> </Box> </Box> ); }
1,963
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionNavigation.js
import * as React from 'react'; import Avatar from '@mui/joy/Avatar'; import Badge, { badgeClasses } from '@mui/joy/Badge'; import Box from '@mui/joy/Box'; import Card from '@mui/joy/Card'; import CardContent from '@mui/joy/CardContent'; import CircularProgress from '@mui/joy/CircularProgress'; import Chip from '@mui/joy/Chip'; import IconButton from '@mui/joy/IconButton'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListSubheader from '@mui/joy/ListSubheader'; import ListItemButton from '@mui/joy/ListItemButton'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import Typography from '@mui/joy/Typography'; import Select from '@mui/joy/Select'; import Option from '@mui/joy/Option'; import Sheet from '@mui/joy/Sheet'; import PieChart from '@mui/icons-material/PieChart'; import SmsIcon from '@mui/icons-material/Sms'; import PersonIcon from '@mui/icons-material/Person'; import BubbleChartIcon from '@mui/icons-material/BubbleChart'; import AddIcon from '@mui/icons-material/Add'; import ColorLensRoundedIcon from '@mui/icons-material/ColorLensRounded'; export default function ColorInversionNavigation() { const [color, setColor] = React.useState('neutral'); return ( <Box sx={{ display: 'flex', borderRadius: 'sm', overflow: 'auto' }}> <Sheet variant="solid" color="neutral" invertedColors sx={{ p: 2, ...(color !== 'neutral' && { bgcolor: `${color}.800`, }), }} > <Select variant="outlined" defaultValue="1" size="sm" placeholder={ <div> <Typography level="inherit">Saleshouse</Typography> <Typography level="body-md">general team</Typography> </div> } startDecorator={ <Sheet variant="solid" sx={{ p: 0.75, borderRadius: '50%', lineHeight: 0, alignSelf: 'center', }} > <BubbleChartIcon sx={{ m: 0 }} /> </Sheet> } sx={{ py: 1 }} > <Option value="1">General team</Option> <Option value="2">Engineering team</Option> </Select> <List sx={{ '--ListItem-radius': '8px', '--List-gap': '4px', flexGrow: 0, minWidth: 200, }} > <ListItemButton> <ListItemDecorator> <PieChart /> </ListItemDecorator> Dashboard </ListItemButton> <ListItemButton selected variant="soft"> <ListItemDecorator> <SmsIcon /> </ListItemDecorator> Chat <Chip data-skip-inverted-colors size="sm" color="warning" variant="soft" sx={{ ml: 'auto' }} > 5 </Chip> </ListItemButton> <ListItemButton> <ListItemDecorator> <PersonIcon /> </ListItemDecorator> Team </ListItemButton> <ListItem nested> <ListSubheader>Shortcuts</ListSubheader> <List> <ListItemButton>Tasks</ListItemButton> <ListItemButton>Reports</ListItemButton> </List> </ListItem> </List> <Card variant="soft" orientation="horizontal" sx={{ mt: 2, display: 'flex', alignItems: 'center', borderRadius: 'sm' }} > <CircularProgress value={35} determinate thickness={8} size="lg"> 35% </CircularProgress> <CardContent sx={{ ml: 2 }}> <Chip size="sm" variant="outlined" sx={{ alignSelf: 'flex-start', mb: 1 }} > Active </Chip> <Typography fontSize="xs">Last update: 22/12/22</Typography> </CardContent> </Card> </Sheet> <Sheet variant="soft" color="neutral" invertedColors sx={(theme) => ({ p: 2, display: 'flex', flexDirection: 'column', gap: 2, ...(color !== 'neutral' && { bgcolor: `${color}.900`, }), '& button': { borderRadius: '50%', padding: 0, '&:hover': { boxShadow: theme.shadow.md, }, }, })} > <Badge badgeContent="7" size="sm"> <IconButton> <Avatar src="/static/images/avatar/3.jpg" /> </IconButton> </Badge> <Badge anchorOrigin={{ vertical: 'bottom', horizontal: 'right', }} badgeInset="14%" sx={{ [`& .${badgeClasses.badge}`]: { bgcolor: 'success.300' } }} > <IconButton> <Avatar src="/static/images/avatar/4.jpg" /> </IconButton> </Badge> <IconButton variant="soft" aria-label="Add another chat"> <AddIcon /> </IconButton> <IconButton variant="plain" size="sm" onClick={() => { const colors = ['primary', 'neutral', 'danger', 'success', 'warning']; const nextColorIndex = colors.indexOf(color) + 1; setColor(colors[nextColorIndex] ?? colors[0]); }} sx={{ mt: 'auto', height: '40px' }} > <ColorLensRoundedIcon fontSize="small" /> </IconButton> </Sheet> </Box> ); }
1,964
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionNavigation.tsx
import * as React from 'react'; import { ColorPaletteProp } from '@mui/joy/styles'; import Avatar from '@mui/joy/Avatar'; import Badge, { badgeClasses } from '@mui/joy/Badge'; import Box from '@mui/joy/Box'; import Card from '@mui/joy/Card'; import CardContent from '@mui/joy/CardContent'; import CircularProgress from '@mui/joy/CircularProgress'; import Chip from '@mui/joy/Chip'; import IconButton from '@mui/joy/IconButton'; import List from '@mui/joy/List'; import ListItem from '@mui/joy/ListItem'; import ListSubheader from '@mui/joy/ListSubheader'; import ListItemButton from '@mui/joy/ListItemButton'; import ListItemDecorator from '@mui/joy/ListItemDecorator'; import Typography from '@mui/joy/Typography'; import Select from '@mui/joy/Select'; import Option from '@mui/joy/Option'; import Sheet from '@mui/joy/Sheet'; import PieChart from '@mui/icons-material/PieChart'; import SmsIcon from '@mui/icons-material/Sms'; import PersonIcon from '@mui/icons-material/Person'; import BubbleChartIcon from '@mui/icons-material/BubbleChart'; import AddIcon from '@mui/icons-material/Add'; import ColorLensRoundedIcon from '@mui/icons-material/ColorLensRounded'; export default function ColorInversionNavigation() { const [color, setColor] = React.useState<ColorPaletteProp>('neutral'); return ( <Box sx={{ display: 'flex', borderRadius: 'sm', overflow: 'auto' }}> <Sheet variant="solid" color="neutral" invertedColors sx={{ p: 2, ...(color !== 'neutral' && { bgcolor: `${color}.800`, }), }} > <Select variant="outlined" defaultValue="1" size="sm" placeholder={ <div> <Typography level="inherit">Saleshouse</Typography> <Typography level="body-md">general team</Typography> </div> } startDecorator={ <Sheet variant="solid" sx={{ p: 0.75, borderRadius: '50%', lineHeight: 0, alignSelf: 'center', }} > <BubbleChartIcon sx={{ m: 0 }} /> </Sheet> } sx={{ py: 1 }} > <Option value="1">General team</Option> <Option value="2">Engineering team</Option> </Select> <List sx={{ '--ListItem-radius': '8px', '--List-gap': '4px', flexGrow: 0, minWidth: 200, }} > <ListItemButton> <ListItemDecorator> <PieChart /> </ListItemDecorator> Dashboard </ListItemButton> <ListItemButton selected variant="soft"> <ListItemDecorator> <SmsIcon /> </ListItemDecorator> Chat <Chip data-skip-inverted-colors size="sm" color="warning" variant="soft" sx={{ ml: 'auto' }} > 5 </Chip> </ListItemButton> <ListItemButton> <ListItemDecorator> <PersonIcon /> </ListItemDecorator> Team </ListItemButton> <ListItem nested> <ListSubheader>Shortcuts</ListSubheader> <List> <ListItemButton>Tasks</ListItemButton> <ListItemButton>Reports</ListItemButton> </List> </ListItem> </List> <Card variant="soft" orientation="horizontal" sx={{ mt: 2, display: 'flex', alignItems: 'center', borderRadius: 'sm' }} > <CircularProgress value={35} determinate thickness={8} size="lg"> 35% </CircularProgress> <CardContent sx={{ ml: 2 }}> <Chip size="sm" variant="outlined" sx={{ alignSelf: 'flex-start', mb: 1 }} > Active </Chip> <Typography fontSize="xs">Last update: 22/12/22</Typography> </CardContent> </Card> </Sheet> <Sheet variant="soft" color="neutral" invertedColors sx={(theme) => ({ p: 2, display: 'flex', flexDirection: 'column', gap: 2, ...(color !== 'neutral' && { bgcolor: `${color}.900`, }), '& button': { borderRadius: '50%', padding: 0, '&:hover': { boxShadow: theme.shadow.md, }, }, })} > <Badge badgeContent="7" size="sm"> <IconButton> <Avatar src="/static/images/avatar/3.jpg" /> </IconButton> </Badge> <Badge anchorOrigin={{ vertical: 'bottom', horizontal: 'right', }} badgeInset="14%" sx={{ [`& .${badgeClasses.badge}`]: { bgcolor: 'success.300' } }} > <IconButton> <Avatar src="/static/images/avatar/4.jpg" /> </IconButton> </Badge> <IconButton variant="soft" aria-label="Add another chat"> <AddIcon /> </IconButton> <IconButton variant="plain" size="sm" onClick={() => { const colors: ColorPaletteProp[] = [ 'primary', 'neutral', 'danger', 'success', 'warning', ]; const nextColorIndex = colors.indexOf(color) + 1; setColor(colors[nextColorIndex] ?? colors[0]); }} sx={{ mt: 'auto', height: '40px' }} > <ColorLensRoundedIcon fontSize="small" /> </IconButton> </Sheet> </Box> ); }
1,965
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionOverview.js
import * as React from 'react'; import Button from '@mui/joy/Button'; import Card from '@mui/joy/Card'; import Chip from '@mui/joy/Chip'; import IconButton from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; import BookmarkOutlinedIcon from '@mui/icons-material/BookmarkOutlined'; import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; export default function ColorInversionOverview() { return ( <Card variant="solid" color="primary" invertedColors sx={{ gap: 2, maxWidth: 300, boxShadow: 'md' }} > <Chip size="sm" variant="soft" sx={{ alignSelf: 'flex-start', borderRadius: 'xl' }} > New </Chip> <IconButton variant="outlined" size="sm" sx={{ position: 'absolute', top: '0.75rem', right: '0.75rem' }} > <BookmarkOutlinedIcon /> </IconButton> <Typography level="h3">Learn how to build super fast websites.</Typography> <Button variant="solid" endDecorator={<KeyboardArrowRightIcon />}> Read more </Button> </Card> ); }
1,966
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionOverview.tsx
import * as React from 'react'; import Button from '@mui/joy/Button'; import Card from '@mui/joy/Card'; import Chip from '@mui/joy/Chip'; import IconButton from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; import BookmarkOutlinedIcon from '@mui/icons-material/BookmarkOutlined'; import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; export default function ColorInversionOverview() { return ( <Card variant="solid" color="primary" invertedColors sx={{ gap: 2, maxWidth: 300, boxShadow: 'md' }} > <Chip size="sm" variant="soft" sx={{ alignSelf: 'flex-start', borderRadius: 'xl' }} > New </Chip> <IconButton variant="outlined" size="sm" sx={{ position: 'absolute', top: '0.75rem', right: '0.75rem' }} > <BookmarkOutlinedIcon /> </IconButton> <Typography level="h3">Learn how to build super fast websites.</Typography> <Button variant="solid" endDecorator={<KeyboardArrowRightIcon />}> Read more </Button> </Card> ); }
1,967
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionPopup.js
import * as React from 'react'; import Autocomplete from '@mui/joy/Autocomplete'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Card from '@mui/joy/Card'; import IconButton from '@mui/joy/IconButton'; import Menu from '@mui/joy/Menu'; import MenuItem from '@mui/joy/MenuItem'; import ListDivider from '@mui/joy/ListDivider'; import Tooltip from '@mui/joy/Tooltip'; import BookmarkOutlinedIcon from '@mui/icons-material/BookmarkOutlined'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; import PaletteIcon from '@mui/icons-material/Palette'; // disable flip for this demo // https://popper.js.org/docs/v2/modifiers/flip/ const modifiers = [ { name: 'flip', options: { fallbackPlacements: ['bottom'], }, }, ]; export default function ColorInversionPopup() { const [color, setColor] = React.useState('danger'); const [menuButton, setMenuButton] = React.useState(null); return ( <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2, py: 4 }}> <Button startDecorator={<PaletteIcon />} variant="outlined" onClick={() => { const colors = ['primary', 'neutral', 'danger', 'success', 'warning']; const nextColorIndex = colors.indexOf(color) + 1; setColor(colors[nextColorIndex] ?? colors[0]); }} > Change the color </Button> <Card orientation="horizontal" variant="solid" color={color} invertedColors sx={{ gap: 4, minHeight: 240, alignItems: 'flex-start', justifyContent: 'center', flexGrow: 1, zIndex: 0, borderRadius: 'sm', p: 4, }} > <Autocomplete placeholder="Combobox" options={films} sx={{ width: 240 }} open slotProps={{ listbox: { disablePortal: true, modifiers, sx: { maxHeight: 140 } }, }} /> <Button variant="soft" endDecorator={<KeyboardArrowDownIcon />} onClick={(event) => setMenuButton(event.currentTarget)} > Actions </Button> <Menu disablePortal modifiers={modifiers} anchorEl={menuButton} open={!!menuButton} onClose={() => setMenuButton(null)} > <MenuItem>New tab</MenuItem> <MenuItem>New window</MenuItem> <ListDivider /> <MenuItem>Delete</MenuItem> </Menu> <Tooltip title="Bookmark" disablePortal modifiers={modifiers} open variant="solid" > <IconButton> <BookmarkOutlinedIcon /> </IconButton> </Tooltip> </Card> </Box> ); } const films = [ { label: 'The Shawshank Redemption', year: 1994 }, { label: 'The Godfather', year: 1972 }, { label: 'The Godfather: Part II', year: 1974 }, { label: 'The Dark Knight', year: 2008 }, { label: '12 Angry Men', year: 1957 }, { label: "Schindler's List", year: 1993 }, { label: 'Pulp Fiction', year: 1994 }, { label: 'The Lord of the Rings: The Return of the King', year: 2003, }, { label: 'The Good, the Bad and the Ugly', year: 1966 }, { label: 'Fight Club', year: 1999 }, { label: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, ];
1,968
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionPopup.tsx
import * as React from 'react'; import { ColorPaletteProp } from '@mui/joy/styles'; import Autocomplete from '@mui/joy/Autocomplete'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Card from '@mui/joy/Card'; import IconButton from '@mui/joy/IconButton'; import Menu from '@mui/joy/Menu'; import MenuItem from '@mui/joy/MenuItem'; import ListDivider from '@mui/joy/ListDivider'; import Tooltip from '@mui/joy/Tooltip'; import BookmarkOutlinedIcon from '@mui/icons-material/BookmarkOutlined'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; import PaletteIcon from '@mui/icons-material/Palette'; // disable flip for this demo // https://popper.js.org/docs/v2/modifiers/flip/ const modifiers = [ { name: 'flip', options: { fallbackPlacements: ['bottom'], }, }, ]; export default function ColorInversionPopup() { const [color, setColor] = React.useState<ColorPaletteProp>('danger'); const [menuButton, setMenuButton] = React.useState<HTMLElement | null>(null); return ( <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2, py: 4 }}> <Button startDecorator={<PaletteIcon />} variant="outlined" onClick={() => { const colors: ColorPaletteProp[] = [ 'primary', 'neutral', 'danger', 'success', 'warning', ]; const nextColorIndex = colors.indexOf(color) + 1; setColor(colors[nextColorIndex] ?? colors[0]); }} > Change the color </Button> <Card orientation="horizontal" variant="solid" color={color} invertedColors sx={{ gap: 4, minHeight: 240, alignItems: 'flex-start', justifyContent: 'center', flexGrow: 1, zIndex: 0, borderRadius: 'sm', p: 4, }} > <Autocomplete placeholder="Combobox" options={films} sx={{ width: 240 }} open slotProps={{ listbox: { disablePortal: true, modifiers, sx: { maxHeight: 140 } }, }} /> <Button variant="soft" endDecorator={<KeyboardArrowDownIcon />} onClick={(event) => setMenuButton(event.currentTarget)} > Actions </Button> <Menu disablePortal modifiers={modifiers} anchorEl={menuButton} open={!!menuButton} onClose={() => setMenuButton(null)} > <MenuItem>New tab</MenuItem> <MenuItem>New window</MenuItem> <ListDivider /> <MenuItem>Delete</MenuItem> </Menu> <Tooltip title="Bookmark" disablePortal modifiers={modifiers} open variant="solid" > <IconButton> <BookmarkOutlinedIcon /> </IconButton> </Tooltip> </Card> </Box> ); } const films = [ { label: 'The Shawshank Redemption', year: 1994 }, { label: 'The Godfather', year: 1972 }, { label: 'The Godfather: Part II', year: 1974 }, { label: 'The Dark Knight', year: 2008 }, { label: '12 Angry Men', year: 1957 }, { label: "Schindler's List", year: 1993 }, { label: 'Pulp Fiction', year: 1994 }, { label: 'The Lord of the Rings: The Return of the King', year: 2003, }, { label: 'The Good, the Bad and the Ugly', year: 1966 }, { label: 'Fight Club', year: 1999 }, { label: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, ];
1,969
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionSkip.js
import * as React from 'react'; import AspectRatio from '@mui/joy/AspectRatio'; import Card from '@mui/joy/Card'; import SvgIcon from '@mui/joy/SvgIcon'; import IconButton from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; import ArrowForward from '@mui/icons-material/ArrowForward'; export default function ColorInversionSkip() { return ( <Card size="lg" variant="solid" color="neutral" invertedColors sx={{ maxWidth: 300, boxShadow: 'lg', borderRadius: 'xl' }} > <AspectRatio data-skip-inverted-colors variant="soft" color="success" ratio="1" sx={{ width: 48 }} > <div> <SvgIcon> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" > <rect x="3" y="8" width="18" height="4" rx="1" /> <path d="M12 8v13" /> <path d="M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7" /> <path d="M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5" /> </svg> </SvgIcon> </div> </AspectRatio> <Typography level="h3">Design Thinking</Typography> <Typography level="body-sm"> How to apply design thinking to your problem in order to generate innovative and user-centric solutions. </Typography> <IconButton variant="plain" size="lg" sx={{ alignSelf: 'flex-end', borderRadius: '50%', mr: -1, my: -1 }} > <ArrowForward /> </IconButton> </Card> ); }
1,970
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionSkip.tsx
import * as React from 'react'; import AspectRatio from '@mui/joy/AspectRatio'; import Card from '@mui/joy/Card'; import SvgIcon from '@mui/joy/SvgIcon'; import IconButton from '@mui/joy/IconButton'; import Typography from '@mui/joy/Typography'; import ArrowForward from '@mui/icons-material/ArrowForward'; export default function ColorInversionSkip() { return ( <Card size="lg" variant="solid" color="neutral" invertedColors sx={{ maxWidth: 300, boxShadow: 'lg', borderRadius: 'xl' }} > <AspectRatio data-skip-inverted-colors variant="soft" color="success" ratio="1" sx={{ width: 48 }} > <div> <SvgIcon> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" > <rect x="3" y="8" width="18" height="4" rx="1" /> <path d="M12 8v13" /> <path d="M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7" /> <path d="M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5" /> </svg> </SvgIcon> </div> </AspectRatio> <Typography level="h3">Design Thinking</Typography> <Typography level="body-sm"> How to apply design thinking to your problem in order to generate innovative and user-centric solutions. </Typography> <IconButton variant="plain" size="lg" sx={{ alignSelf: 'flex-end', borderRadius: '50%', mr: -1, my: -1 }} > <ArrowForward /> </IconButton> </Card> ); }
1,971
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionSurface.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Card from '@mui/joy/Card'; import CardContent from '@mui/joy/CardContent'; import Typography from '@mui/joy/Typography'; import SvgIcon from '@mui/joy/SvgIcon'; export default function ColorInversionSurface() { const creditCard = ( <Card size="lg" variant="solid" color="warning" invertedColors sx={{ gap: 2, minWidth: 300, boxShadow: 'md' }} > <CardContent orientation="horizontal"> <div> <Typography level="title-lg">$4,236</Typography> <Typography fontSize="xs" fontFamily="code"> CREDIT </Typography> </div> <SvgIcon sx={{ ml: 'auto' }}> <svg width="50" height="39" viewBox="0 0 50 39" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M16.4992 2H37.5808L22.0816 24.9729H1L16.4992 2Z" fill="currentColor" /> <path d="M17.4224 27.102L11.4192 36H33.5008L49 13.0271H32.7024L23.2064 27.102H17.4224Z" fill="#312ECB" /> </svg> </SvgIcon> </CardContent> <Typography level="title-lg" fontFamily="code"> β€’β€’β€’β€’ β€’β€’β€’β€’ β€’β€’β€’β€’ 1212 </Typography> <CardContent orientation="horizontal" sx={{ justifyContent: 'space-between' }}> <div> <Typography fontSize="xs" fontFamily="code"> CARD NAME </Typography> <Typography level="title-sm" fontSize="sm"> JOHN DOE </Typography> </div> <div> <Typography fontSize="xs" textAlign="right" fontFamily="code"> EXPIRE </Typography> <Typography level="title-sm" fontSize="sm" textAlign="right"> 07/25 </Typography> </div> </CardContent> </Card> ); return ( <Box sx={{ display: 'flex', gap: 2 }}> {creditCard} {React.cloneElement(creditCard, { variant: 'soft' })} </Box> ); }
1,972
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionSurface.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import Card from '@mui/joy/Card'; import CardContent from '@mui/joy/CardContent'; import Typography from '@mui/joy/Typography'; import SvgIcon from '@mui/joy/SvgIcon'; export default function ColorInversionSurface() { const creditCard = ( <Card size="lg" variant="solid" color="warning" invertedColors sx={{ gap: 2, minWidth: 300, boxShadow: 'md' }} > <CardContent orientation="horizontal"> <div> <Typography level="title-lg">$4,236</Typography> <Typography fontSize="xs" fontFamily="code"> CREDIT </Typography> </div> <SvgIcon sx={{ ml: 'auto' }}> <svg width="50" height="39" viewBox="0 0 50 39" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M16.4992 2H37.5808L22.0816 24.9729H1L16.4992 2Z" fill="currentColor" /> <path d="M17.4224 27.102L11.4192 36H33.5008L49 13.0271H32.7024L23.2064 27.102H17.4224Z" fill="#312ECB" /> </svg> </SvgIcon> </CardContent> <Typography level="title-lg" fontFamily="code"> β€’β€’β€’β€’ β€’β€’β€’β€’ β€’β€’β€’β€’ 1212 </Typography> <CardContent orientation="horizontal" sx={{ justifyContent: 'space-between' }}> <div> <Typography fontSize="xs" fontFamily="code"> CARD NAME </Typography> <Typography level="title-sm" fontSize="sm"> JOHN DOE </Typography> </div> <div> <Typography fontSize="xs" textAlign="right" fontFamily="code"> EXPIRE </Typography> <Typography level="title-sm" fontSize="sm" textAlign="right"> 07/25 </Typography> </div> </CardContent> </Card> ); return ( <Box sx={{ display: 'flex', gap: 2 }}> {creditCard} {React.cloneElement(creditCard, { variant: 'soft' })} </Box> ); }
1,973
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/ColorInversionSurface.tsx.preview
{creditCard} {React.cloneElement(creditCard, { variant: 'soft' })}
1,974
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/color-inversion/color-inversion.md
# Color inversion <p class="description">Joy UI components can invert their colors to match with the parent's variant.</p> ## Motivation The Joy UI [global variants feature](/joy-ui/main-features/global-variants/) provides a consistent set of values for the `variant` prop. But these variants can sometimes cause quirks when the same styles are applied to both parent and child components. Check out the two demo cards below to see how things can go wrong: {{"demo": "ColorInversionMotivation.js"}} - On the left, the Button variant is `solid`, while its parent Card is the default `outlined`, so the design works well. - On the right, the `solid` variant is applied to both the Button and the Card, disrupting the design's hierarchy and contrast. Joy UI's color inversion feature prevents this kind of situation from occurring, while still preserving the hierarchical meaning of the global variants themselves. ## Overview When color inversion is enabled on a parent component, all children components invert their styles (regardless of their respective color props) to match the parent's background. The inverted styles maintain the semantic meaning of their corresponding global variantsβ€”in the example below, the Button is still `solid` even though it's been inverted to contrast with its container. If you change the Button's variant to `outlined`, you'll see that the design still works; but try removing the `invertedColors` prop from the parent Card, and you'll see how the design falls apart (and thus, why this feature is so useful): {{"demo": "ColorInversionOverview.js"}} :::info The color inversion feature is only available for `soft` and `solid` variants because the rest of the global variants don't have background by default. ::: ### Benefits - Color inversion reduces a significant amount of styling effort. It handles all of the visual states (hover, active, and focus) on all the children. - It makes your interface scalable. New components added to the area will just work. - It works for both client-side and server-side rendering. - It works for both light and dark mode. - It can be disabled at any time without impacting the structure of the components. - It is an opt-in feature. If you don't use it, the extra CSS variables won't be included in the production style sheet. - Some children can be excluded from the color inversion, see ["skip color inversion on a child"](#skip-color-inversion-on-a-child) section. ### Trade-offs - If the parent component contains just a few children, the size of the stylesheet generated may be significantly larger than it would be if you customized each child individually. (This may be inconsequential for overall performance.) - It doesn't work with browsers that don't support [CSS variables](https://caniuse.com/css-variables). ## Usage ### Supported components The following components accept the `invertedColors` prop when applied in conjunction with the `solid` or `soft` variants: - [Alert](/joy-ui/react-alert/) - [Card](/joy-ui/react-card/) - [Drawer](/joy-ui/react-drawer/) - [Modal Dialog](/joy-ui/react-modal/#modal-dialog) - [Menu](/joy-ui/react-menu/) - [Sheet](/joy-ui/react-sheet/) {{"demo": "ColorInversionSurface.js"}} ### Exceptions Color inversion does not affect the popup slot of the Autocomplete, Menu, or Tooltip components by default. To enable it, set `disablePortal` to `"true"` using `slotProps` on the respective child component, as demonstrated below: {{"demo": "ColorInversionPopup.js"}} :::info To learn more about the concept of component slots and slot props, visit the [Overriding component structure](/joy-ui/customization/overriding-component-structure/) guide. ::: ### Skip inversion on a child When `invertedColors` is applied to a parent, you can add the `data-skip-inverted-colors` attribute to a child to prevent that child from being inverted. {{"demo": "ColorInversionSkip.js"}} ### Apply color inversion to any parent ```js import { applySolidInversion, applySoftInversion } from '@mui/joy/colorInversion'; ``` If you need color inversion for a parent component that isn't [supported by default](#supported-components), you can use the `applySolidInversion` or `applySoftInversion` utilities to add it to any component that contains children. (This is what the supported components use behind the scenes when the `invertedColors` prop is applied.) The examples below show how to use these utilities with both the `sx` prop and the `styled` API: #### With the sx prop ```jsx <Box sx={[{ ...baseStyles }, applySolidInversion('neutral')]}>...</Box> ``` {{"demo": "ColorInversionAnyParent.js"}} #### With the styled API ```jsx const Parent = styled('div')([{ ...baseStyles }, applySolidInversion('neutral')]); ``` {{"demo": "ColorInversionAnyParentStyled.js"}} ## How it works Color inversion adds CSS variables to the component using the `invertedColors` prop or the apply utilities. There's no [React context](https://react.dev/learn/passing-data-deeply-with-context) involved in this feature. ```jsx <Sheet invertedColors variant="solid" color="neutral"> // The parent's style sheet { // the values of these variables depends on the parent's variant and color. --variant-softColor: …; --variant-softBg: …; --variant-softHoverColor: …; --variant-softHoverBg: …; --variant-softActiveBg: …; … // other variants --joy-palette-text-primary: …; --joy-palette-text-secondary: …; --joy-palette-text-tertiary: …; --joy-palette-background-surface: …; … // other theme palette tokens } ``` As a result, the children will use these CSS variables instead of the theme: ```jsx // The children style sheet // The values of these variables are inherited from the parent. { color: var(--joy-palette-text-primary); background: var(--joy-palette-background-surface); … } ``` ## Common examples ### Header {{"demo": "ColorInversionHeader.js"}} ### Footer {{"demo": "ColorInversionFooter.js"}} ### Side navigation {{"demo": "ColorInversionNavigation.js"}} ### Marketing section {{"demo": "ColorInversionMarketing.js"}}
1,975
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/dark-mode-optimization/dark-mode-optimization.md
# Dark mode optimization <p class="description">Joy UI uses CSS variables to ensure that server-rendered apps can load in dark mode on first render.</p> Joy UI is optimized so that end users who select dark mode as their preferred color scheme never see a flash of light mode when the app first renders. This is a common problem for server-side-rendered (SSR) apps and sites built with static-site generators (SSGs). To solve this problem, Joy UI uses CSS variables to render all color schemes at build time so that the user's preferred mode can be served to them on first load. ## The problem: flickering on first load In a server-rendered context, an app is built long before it reaches the clientβ€”which means that it can't account for the user's preferred color scheme when it first loads. As a result, if you load such an app, switch to dark mode, and then refresh, you'll see a flash of the default light mode before client-side hydration kicks in and switches it back to dark mode. Indeed, this light-mode "flash" will occur _every_ time you load up the app in the future, as long as your browser remembers that you prefer dark mode. This can cause eye fatigue in a low-light setting, not to mention a frustrating interruption of the user experienceβ€”especially for those who interact with the app when it's in between modes. The gif below illustrates this problem as it would appear on [mui.com](https://mui.com/) without a fix: <img src="https://media.giphy.com/media/9hvxemkpotSiQGzLo8/giphy.gif" style="margin-bottom: 24px; width: 240px;" alt="The dark-mode flashing problem at mui.com." width="480" height="294" /> ## The solution: CSS variables Solving this problem required us to take a novel approach to styling and theming. (See this [RFC on CSS variables support](https://github.com/mui/material-ui/issues/27651) to learn more about the implementation of this feature.) Thanks to Joy UI's built-in support for CSS variables, your app can render all of its color schemes at build time, so that the user's preference can be injected _before_ the DOM is rendered in the browser. Joy UI provides the `getInitColorSchemeScript()` function to make this flash-free dark mode possible with React frameworks like Next.js or Remix. This function must be placed before the main script so it can apply the correct stylesheet before your components are rendered. The code snippet below shows how this works with the Next.js Pages Router: ```jsx import Document, { Html, Head, Main, NextScript } from 'next/document'; import { getInitColorSchemeScript } from '@mui/joy/styles'; export default class MyDocument extends Document { render() { return ( <Html data-color-scheme="light"> <Head>...</Head> <body> {getInitColorSchemeScript()} <Main /> <NextScript /> </body> </Html> ); } } ``` See the [Applying dark mode](/joy-ui/customization/dark-mode/) page for more details on usage with other frameworks.
1,976
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/global-variants/GlobalVariantComponents.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import Chip from '@mui/joy/Chip'; import Checkbox from '@mui/joy/Checkbox'; import Typography from '@mui/joy/Typography'; export default function GlobalVariantComponents() { return ( <Box sx={{ display: 'grid', gridTemplateColumns: { xs: 'repeat(1, minmax(0, 1fr))', sm: 'auto repeat(4, minmax(0, 1fr))', }, gap: 3, justifyItems: 'center', alignItems: 'center', }} > <Typography level="body-sm" justifySelf="flex-end"> Button: </Typography> <Button variant="solid" color="primary"> Solid </Button> <Button variant="soft" color="primary"> Soft </Button> <Button variant="outlined" color="primary"> Outlined </Button> <Button variant="plain" color="primary"> Plain </Button> <Typography level="body-sm" justifySelf="flex-end"> Chip: </Typography> <Chip variant="solid" size="sm" color="primary"> Solid </Chip> <Chip variant="soft" size="sm" color="primary"> Soft </Chip> <Chip variant="outlined" size="sm" color="primary"> Outlined </Chip> <Chip variant="plain" size="sm" color="primary"> Plain </Chip> <Typography level="body-sm" justifySelf="flex-end"> Checkbox: </Typography> <Checkbox variant="solid" defaultChecked label="Solid" /> <Checkbox variant="soft" defaultChecked label="Soft" /> <Checkbox variant="outlined" defaultChecked label="Outlined" /> <Checkbox variant="plain" defaultChecked label="Plain" /> </Box> ); }
1,977
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/global-variants/LevelOfImportance.js
import * as React from 'react'; import AspectRatio from '@mui/joy/AspectRatio'; import Box from '@mui/joy/Box'; import Button from '@mui/joy/Button'; import IconButton from '@mui/joy/IconButton'; import Sheet from '@mui/joy/Sheet'; import Typography from '@mui/joy/Typography'; import Close from '@mui/icons-material/Close'; import Delete from '@mui/icons-material/Delete'; import Download from '@mui/icons-material/Download'; import InsertLink from '@mui/icons-material/InsertLink'; import Crop from '@mui/icons-material/Crop'; export default function LevelOfImportance() { return ( <Box sx={{ display: 'flex', width: '100%', py: 2, borderRadius: 'xs', }} > <Box sx={{ border: '1px solid', borderColor: 'var(--joy-palette-neutral-outlinedBorder)', alignSelf: 'center', maxWidth: '100%', minWidth: { xs: 220, sm: 360 }, mx: 'auto', boxShadow: 'sm', borderRadius: 'md', overflow: 'auto', }} > <Sheet sx={{ borderWidth: '0 0 1px 0', display: 'flex', alignItems: 'center', p: 2, borderBottom: '1px solid', borderColor: 'var(--joy-palette-neutral-outlinedBorder)', }} > <Typography level="h2" fontSize="md"> Photo upload </Typography> <IconButton size="sm" variant="plain" color="neutral" sx={{ ml: 'auto' }}> <Close /> </IconButton> </Sheet> <Sheet sx={{ p: 2 }}> <Sheet variant="outlined" sx={{ borderRadius: 'md', overflow: 'auto', borderColor: 'var(--joy-palette-neutral-outlinedBorder)', bgcolor: 'background.level1', }} > <AspectRatio> <img alt="" src="/static/images/cards/yosemite.jpeg" /> </AspectRatio> <Box sx={{ display: 'flex', p: 1.5, gap: 1.5, '& > button': { bgcolor: 'background.surface' }, }} > <IconButton color="danger" variant="plain" size="sm" sx={{ mr: 'auto' }} > <Delete /> </IconButton> <IconButton color="neutral" variant="outlined" size="sm"> <Download /> </IconButton> <IconButton color="neutral" variant="outlined" size="sm"> <InsertLink /> </IconButton> <IconButton color="neutral" variant="outlined" size="sm"> <Crop /> </IconButton> </Box> </Sheet> </Sheet> <Sheet sx={{ display: 'flex', p: 2, borderTop: '1px solid', borderColor: 'var(--joy-palette-neutral-outlinedBorder)', gap: 1, }} > <Button size="md" variant="plain" sx={{ ml: 'auto' }}> Replace photo </Button> <Button size="md">Upload</Button> </Sheet> </Box> </Box> ); }
1,978
0
petrpan-code/mui/material-ui/docs/data/joy/main-features
petrpan-code/mui/material-ui/docs/data/joy/main-features/global-variants/global-variants.md
# Global variants <p class="description">Joy UI provides a set of global variants to ensure consistency across your app.</p> All Joy UI components accept four global variants: `solid`, `soft`, `outlined`, and `plain`. These variants are intended to cover the majority of use cases in modern web design. The demo below shows how the variants look and feel across several Joy UI components: {{"demo": "GlobalVariantComponents.js"}} Global variants pull their styles from a single source, helping you to ensure a consistent look and feel across both pre-built Joy UI components and any custom components you build. Under the hood, the variants are primarily differentiated by the values for their `color`, `background`, and `border` CSS properties. ## Hierarchy of importance Each variant conveys a different level of importance in the user interface: - `solid` is best suited for primary elements and the most important actions on the page - `soft`, `outlined`, and `plain` are better for secondary and tertiary actions Which variant you should choose largely depends on the context within the design, but it's important to keep this hierarchy in mind for a balanced UI. The demo below illustrates a well-balanced design using multiple variants: {{"demo": "LevelOfImportance.js"}} ## Customizing global variants Global variants build off of the atomic tokens from the palettes, which live within your app's themes. You can use standard CSS or CSS variables to customize these properties. Here's an example of some of the default `solid` variant tokens: ```js { colorSchemes: { light: { palette: { primary: { solidBg: 'var(--joy-palette-primary-600)', // the initial background solidColor: '#fff', // the initial color solidHoverBg: 'var(--joy-palette-primary-700)', // the :hover background solidActiveBg: 'var(--joy-palette-primary-800)', // the :active background // ...other tokens }, neutral: { solidBg: 'var(--joy-palette-primary-700)', solidColor: '#fff', solidHoverBg: 'var(--joy-palette-primary-800)', solidActiveBg: 'var(--joy-palette-primary-900)', // ...other tokens }, // ...other palettes } }, dark: { palette: { // similar structure but different values } }, } } ```
1,979
0
petrpan-code/mui/material-ui/docs/data/joy
petrpan-code/mui/material-ui/docs/data/joy/migration/PaletteChanges.js
import * as React from 'react'; import colors from '@mui/joy/colors'; import Box from '@mui/joy/Box'; import AspectRatio from '@mui/joy/AspectRatio'; import List from '@mui/joy/List'; import ListSubheader from '@mui/joy/ListSubheader'; import ListItem from '@mui/joy/ListItem'; import Typography from '@mui/joy/Typography'; import Sheet from '@mui/joy/Sheet'; import SvgIcon from '@mui/joy/SvgIcon'; const primary = { 50: '#F4FAFF', 100: '#DDF1FF', 200: '#ADDBFF', 300: '#6FB6FF', 400: '#3990FF', 500: '#096BDE', 600: '#054DA7', 700: '#02367D', 800: '#072859', 900: '#00153C', }; const neutral = { 50: '#F7F7F8', 100: '#EBEBEF', 200: '#D8D8DF', 300: '#B9B9C6', 400: '#8F8FA3', 500: '#73738C', 600: '#5A5A72', 700: '#434356', 800: '#25252D', 900: '#131318', }; const danger = { 50: '#FFF8F6', 100: '#FFE9E8', 200: '#FFC7C5', 300: '#FF9192', 400: '#FA5255', 500: '#D3232F', 600: '#A10E25', 700: '#77061B', 800: '#580013', 900: '#39000D', }; const success = { 50: '#F3FEF5', 100: '#D7F5DD', 200: '#77EC95', 300: '#4CC76E', 400: '#2CA24D', 500: '#1A7D36', 600: '#0F5D26', 700: '#034318', 800: '#002F0F', 900: '#001D09', }; const warning = { 50: '#FFF8C5', 100: '#FAE17D', 200: '#EAC54F', 300: '#D4A72C', 400: '#BF8700', 500: '#9A6700', 600: '#7D4E00', 700: '#633C01', 800: '#4D2D00', 900: '#3B2300', }; const oldColors = { primary, neutral, danger, success, warning, common: { white: '#FFF', black: '#09090D', }, }; const newColors = { primary: colors.blue, neutral: colors.grey, danger: colors.red, success: colors.green, warning: colors.yellow, common: { white: '#FCFCFD', black: '#09090B', }, }; export default function PaletteChanges() { return ( <Box sx={{ flex: 1, display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))', gap: 2, }} > {['primary', 'neutral', 'danger', 'success', 'warning', 'common'].map( (color) => { const oldColorRange = oldColors[color]; const newColorRange = newColors[color]; return ( <Sheet key={color} variant="outlined" sx={{ borderRadius: 'xs', boxShadow: 'xs' }} > <List size="sm"> <ListSubheader> {color} {color === 'common' ? '(white & black)' : '(50 - 900)'} </ListSubheader> {Object.keys(newColorRange).map((key) => { return ( <ListItem key={key} sx={{ gap: 1, display: 'grid', gridTemplateColumns: '24px 1fr 20px 24px 1fr', }} > <AspectRatio variant="outlined" ratio="1" sx={{ width: 24, bgcolor: oldColorRange[key], borderRadius: 'xs', }} > <div /> </AspectRatio> <Typography level="body-xs">{oldColorRange[key]}</Typography> <SvgIcon fontSize="sm"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" > <path strokeLinecap="round" strokeLinejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" /> </svg> </SvgIcon> <AspectRatio variant="outlined" ratio="1" sx={{ width: 24, bgcolor: newColorRange[key], borderRadius: 'xs', }} > <div /> </AspectRatio> <Typography level="body-xs">{newColorRange[key]}</Typography> </ListItem> ); })} </List> </Sheet> ); }, )} </Box> ); }
1,980
0
petrpan-code/mui/material-ui/docs/data/joy
petrpan-code/mui/material-ui/docs/data/joy/migration/TitleBodyIconExample.js
import * as React from 'react'; import Box from '@mui/joy/Box'; import Stack from '@mui/joy/Stack'; import Typography from '@mui/joy/Typography'; import SvgIcon from '@mui/joy/SvgIcon'; export default function TitleBodyIconExample() { return ( <Box sx={{ '& *:not(path, i)': { outline: '1px solid rgb(255 53 53 / 40%)' } }}> <Stack spacing={2} sx={{ maxWidth: '60ch' }}> <Stack direction="row" spacing={1.5}> <SvgIcon size="lg"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" > <path strokeLinecap="round" strokeLinejoin="round" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z" /> </svg> </SvgIcon> <div> <Typography level="title-lg"> <i>title-lg</i>: Title of the component </Typography> <Typography level="body-md"> <i>body-md</i>: This is the description of the component that contain some information of it. </Typography> </div> </Stack> <Stack direction="row" spacing={1.5}> <SvgIcon> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" > <path strokeLinecap="round" strokeLinejoin="round" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z" /> </svg> </SvgIcon> <div> <Typography level="title-md"> <i>title-md</i>: Title of the component </Typography> <Typography level="body-md"> <i>body-md</i>: This is the description of the component that contain some information of it. </Typography> <Typography level="body-sm"> <i>body-sm</i>: Metadata, e.g. a date. </Typography> </div> </Stack> <Stack direction="row" spacing={1.5}> <SvgIcon size="sm"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" > <path strokeLinecap="round" strokeLinejoin="round" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z" /> </svg> </SvgIcon> <div> <Typography level="title-sm"> <i>title-sm</i>: Title of the component </Typography> <Typography level="body-sm"> <i>body-sm</i>: This is the description of the component that contain some information of it. </Typography> <Typography level="body-xs"> <i>body-xs</i>: Metadata, e.g. a date. </Typography> </div> </Stack> </Stack> </Box> ); }
1,981
0
petrpan-code/mui/material-ui/docs/data/joy
petrpan-code/mui/material-ui/docs/data/joy/migration/TitleBodyIconExample.tsx
import * as React from 'react'; import Box from '@mui/joy/Box'; import Stack from '@mui/joy/Stack'; import Typography from '@mui/joy/Typography'; import SvgIcon from '@mui/joy/SvgIcon'; export default function TitleBodyIconExample() { return ( <Box sx={{ '& *:not(path, i)': { outline: '1px solid rgb(255 53 53 / 40%)' } }}> <Stack spacing={2} sx={{ maxWidth: '60ch' }}> <Stack direction="row" spacing={1.5}> <SvgIcon size="lg"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" > <path strokeLinecap="round" strokeLinejoin="round" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z" /> </svg> </SvgIcon> <div> <Typography level="title-lg"> <i>title-lg</i>: Title of the component </Typography> <Typography level="body-md"> <i>body-md</i>: This is the description of the component that contain some information of it. </Typography> </div> </Stack> <Stack direction="row" spacing={1.5}> <SvgIcon> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" > <path strokeLinecap="round" strokeLinejoin="round" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z" /> </svg> </SvgIcon> <div> <Typography level="title-md"> <i>title-md</i>: Title of the component </Typography> <Typography level="body-md"> <i>body-md</i>: This is the description of the component that contain some information of it. </Typography> <Typography level="body-sm"> <i>body-sm</i>: Metadata, e.g. a date. </Typography> </div> </Stack> <Stack direction="row" spacing={1.5}> <SvgIcon size="sm"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" > <path strokeLinecap="round" strokeLinejoin="round" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z" /> </svg> </SvgIcon> <div> <Typography level="title-sm"> <i>title-sm</i>: Title of the component </Typography> <Typography level="body-sm"> <i>body-sm</i>: This is the description of the component that contain some information of it. </Typography> <Typography level="body-xs"> <i>body-xs</i>: Metadata, e.g. a date. </Typography> </div> </Stack> </Stack> </Box> ); }
1,982
0
petrpan-code/mui/material-ui/docs/data/joy
petrpan-code/mui/material-ui/docs/data/joy/migration/migrating-default-theme.md
# Migrating to the new theme <p class="description">This guide walks through recent Joy UI default theme upgrades and how to update to it.</p> With the introduction of Joy UI's v5.0.0-beta.0, its default theme went under some significant restructuring and polish. Several changes were made, including renaming, removing, and adding new tokens. This guide walks through each and every one of them and provides instructions for a smooth migration process. ## Color & Typography ### Purple palette removed The purple palette has been removed as we updated the primary color. In case you want to continue using it, copy the snippet below to your project: ```js const purple = { 50: '#FDF7FF', 100: '#F4EAFF', 200: '#E1CBFF', 300: '#C69EFF', 400: '#A374F9', 500: '#814DDE', 600: '#5F35AE', 700: '#452382', 800: '#301761', 900: '#1D0A42', }; ``` ### Info palette removed The info palette has been removed to simplify the color set. We've realized that, in most cases, the neutral palette is used for info-related components and use cases. Additionally, we noticed a strong overlap between `info` and `neutral`, which motivated further this change. ```diff - <Chip color="info" variant="soft"> + <Chip color="neutral" variant="soft"> ``` If you want to continue using it, add the palette directly to the theme object file: ```js import { extendTheme } from '@mui/joy/styles'; const info = { 50: '#FDF7FF', 100: '#F4EAFF', 200: '#E1CBFF', 300: '#C69EFF', 400: '#A374F9', 500: '#814DDE', 600: '#5F35AE', 700: '#452382', 800: '#301761', 900: '#1D0A42', }; const theme = extendTheme({ colorSchemes: { light: { palette: { info: { ...info, plainColor: `var(--joy-palette-info-600)`, plainHoverBg: `var(--joy-palette-info-100)`, plainActiveBg: `var(--joy-palette-info-200)`, plainDisabledColor: `var(--joy-palette-info-200)`, outlinedColor: `var(--joy-palette-info-500)`, outlinedBorder: `var(--joy-palette-info-200)`, outlinedHoverBg: `var(--joy-palette-info-100)`, outlinedHoverBorder: `var(--joy-palette-info-300)`, outlinedActiveBg: `var(--joy-palette-info-200)`, outlinedDisabledColor: `var(--joy-palette-info-100)`, outlinedDisabledBorder: `var(--joy-palette-info-100)`, softColor: `var(--joy-palette-info-600)`, softBg: `var(--joy-palette-info-100)`, softHoverBg: `var(--joy-palette-info-200)`, softActiveBg: `var(--joy-palette-info-300)`, softDisabledColor: `var(--joy-palette-info-300)`, softDisabledBg: `var(--joy-paletteinfo}-50)`, solidColor: '#fff', solidBg: `var(--joy-palette-info-500)`, solidHoverBg: `var(--joy-palette-info-600)`, solidActiveBg: `var(--joy-palette-info-700)`, solidDisabledColor: `#fff`, solidDisabledBg: `var(--joy-palette-info-200)`, }, }, }, dark: { palette: { info: { ...info, plainColor: `var(--joy-palette-info-300)`, plainHoverBg: `var(--joy-palette-info-800)`, plainActiveBg: `var(--joy-palette-info-700)`, plainDisabledColor: `var(--joy-palette-info-800)`, outlinedColor: `var(--joy-palette-info-200)`, outlinedBorder: `var(--joy-palette-info-700)`, outlinedHoverBg: `var(--joy-palette-info-800)`, outlinedHoverBorder: `var(--joy-palette-info-600)`, outlinedActiveBg: `var(--joy-palette-info-900)`, outlinedDisabledColor: `var(--joy-palette-info-800)`, outlinedDisabledBorder: `var(--joy-palette-info-800)`, softColor: `var(--joy-palette-info-200)`, softBg: `var(--joy-palette-info-900)`, softHoverBg: `var(--joy-palette-info-800)`, softActiveBg: `var(--joy-palette-info-700)`, softDisabledColor: `var(--joy-palette-info-800)`, softDisabledBg: `var(--joy-palette-info-900)`, solidColor: `#fff`, solidBg: `var(--joy-palette-info-600)`, solidHoverBg: `var(--joy-palette-info-700)`, solidActiveBg: `var(--joy-palette-info-800)`, solidDisabledColor: `var(--joy-palette-info-700)`, solidDisabledBg: `var(--joy-palette-info-900)`, }, }, }, }, }); ``` Then provide the `theme` to the `CssVarsProvider`: ```js import { CssVarsProvider, extendTheme } from '@mui/joy/styles'; const theme = extendTheme({ … }); function App() { return <CssVarsProvider theme={theme}>…</CssVarsProvider>; } ``` #### TypeScript If working with TypeScript, add the `info` palette to the theme's palette types via module augmentation: ```ts // You can put this to any file that's included in your tsconfig import type { PaletteRange } from '@mui/joy/styles'; declare module '@mui/joy/styles' { interface ColorPalettePropOverrides { // apply to all Joy UI components that support `color` prop info: true; } interface Palette { // this will make the node `info` configurable in `extendTheme` // and add `info` to the theme's palette. info: PaletteRange; } } ``` ### Other palettes Each and every color of all palettes have been refined for better contrast ratios, vibrance, and personality. Here's a before and after: {{"demo": "PaletteChanges.js"}} #### Keep the old colors To keep using the old colors, add them to your theme: <details> <summary>Primary</summary> ```js const primary = { 50: '#F4FAFF', 100: '#DDF1FF', 200: '#ADDBFF', 300: '#6FB6FF', 400: '#3990FF', 500: '#096BDE', 600: '#054DA7', 700: '#02367D', 800: '#072859', 900: '#00153C', }; extendTheme({ colorSchemes: { light: { palette: { primary: { ...primary, plainColor: `var(--joy-palette-primary-600)`, plainHoverBg: `var(--joy-palette-primary-100)`, plainActiveBg: `var(--joy-palette-primary-200)`, plainDisabledColor: `var(--joy-palette-primary-200)`, outlinedColor: `var(--joy-palette-primary-500)`, outlinedBorder: `var(--joy-palette-primary-200)`, outlinedHoverBg: `var(--joy-palette-primary-100)`, outlinedHoverBorder: `var(--joy-palette-primary-300)`, outlinedActiveBg: `var(--joy-palette-primary-200)`, outlinedDisabledColor: `var(--joy-palette-primary-100)`, outlinedDisabledBorder: `var(--joy-palette-primary-100)`, softColor: `var(--joy-palette-primary-600)`, softBg: `var(--joy-palette-primary-100)`, softHoverBg: `var(--joy-palette-primary-200)`, softActiveBg: `var(--joy-palette-primary-300)`, softDisabledColor: `var(--joy-palette-primary-300)`, softDisabledBg: `var(--joy-palette-primary}-)50`, solidColor: '#fff', solidBg: `var(--joy-palette-primary-500)`, solidHoverBg: `var(--joy-palette-primary-600)`, solidActiveBg: `var(--joy-palette-primary-700)`, solidDisabledColor: `#fff`, solidDisabledBg: `var(--joy-palette-primary-200)`, }, }, }, dark: { palette: { primary: { ...primary, plainColor: `var(--joy-palette-primary-300)`, plainHoverBg: `var(--joy-palette-primary-800)`, plainActiveBg: `var(--joy-palette-primary-700)`, plainDisabledColor: `var(--joy-palette-primary-800)`, outlinedColor: `var(--joy-palette-primary-200)`, outlinedBorder: `var(--joy-palette-primary-700)`, outlinedHoverBg: `var(--joy-palette-primary-800)`, outlinedHoverBorder: `var(--joy-palette-primary-600)`, outlinedActiveBg: `var(--joy-palette-primary-900)`, outlinedDisabledColor: `var(--joy-palette-primary-800)`, outlinedDisabledBorder: `var(--joy-palette-primary-800)`, softColor: `var(--joy-palette-primary-200)`, softBg: `var(--joy-palette-primary-900)`, softHoverBg: `var(--joy-palette-primary-800)`, softActiveBg: `var(--joy-palette-primary-700)`, softDisabledColor: `var(--joy-palette-primary-800)`, softDisabledBg: `var(--joy-palette-primary-900)`, solidColor: `#fff`, solidBg: `var(--joy-palette-primary-600)`, solidHoverBg: `var(--joy-palette-primary-700)`, solidActiveBg: `var(--joy-palette-primary-800)`, solidDisabledColor: `var(--joy-palette-primary-700)`, solidDisabledBg: `var(--joy-palette-primary-900)`, }, }, }, }, }); ``` </details> <details> <summary>Neutral</summary> ```js const neutral = { 50: '#F7F7F8', 100: '#EBEBEF', 200: '#D8D8DF', 300: '#B9B9C6', 400: '#8F8FA3', 500: '#73738C', 600: '#5A5A72', 700: '#434356', 800: '#25252D', 900: '#131318', }; extendTheme({ colorSchemes: { light: { palette: { neutral: { ...neutral, plainColor: `var(--joy-palette-neutral-800)`, plainHoverColor: `var(--joy-palette-neutral-900)`, plainHoverBg: `var(--joy-palette-neutral-100)`, plainActiveBg: `var(--joy-palette-neutral-200)`, plainDisabledColor: `var(--joy-palette-neutral-300)`, outlinedColor: `var(--joy-palette-neutral-800)`, outlinedBorder: `var(--joy-palette-neutral-200)`, outlinedHoverColor: `var(--joy-palette-neutral-900)`, outlinedHoverBg: `var(--joy-palette-neutral-100)`, outlinedHoverBorder: `var(--joy-palette-neutral-300)`, outlinedActiveBg: `var(--joy-palette-neutral-200)`, outlinedDisabledColor: `var(--joy-palette-neutral-300)`, outlinedDisabledBorder: `var(--joy-palette-neutral-100)`, softColor: `var(--joy-palette-neutral-800)`, softBg: `var(--joy-palette-neutral-100)`, softHoverColor: `var(--joy-palette-neutral-900)`, softHoverBg: `var(--joy-palette-neutral-200)`, softActiveBg: `var(--joy-palette-neutral-300)`, softDisabledColor: `var(--joy-palette-neutral-300)`, softDisabledBg: `var(--joy-palette-neutral-50)`, solidColor: `var(--joy-palette-common-white)`, solidBg: `var(--joy-palette-neutral-600)`, solidHoverBg: `var(--joy-palette-neutral-700)`, solidActiveBg: `var(--joy-palette-neutral-800)`, solidDisabledColor: `var(--joy-palette-neutral-300)`, solidDisabledBg: `var(--joy-palette-neutral-50)`, }, common: { white: '#FFF', black: '#09090D', }, text: { secondary: 'var(--joy-palette-neutral-600)', tertiary: 'var(--joy-palette-neutral-500)', }, background: { body: 'var(--joy-palette-common-white)', tooltip: 'var(--joy-palette-neutral-800)', backdrop: 'rgba(255 255 255 / 0.5)', }, }, }, dark: { palette: { neutral: { ...neutral, plainColor: `var(--joy-palette-neutral-200)`, plainHoverColor: `var(--joy-palette-neutral-50)`, plainHoverBg: `var(--joy-palette-neutral-800)`, plainActiveBg: `var(--joy-palette-neutral-700)`, plainDisabledColor: `var(--joy-palette-neutral-700)`, outlinedColor: `var(--joy-palette-neutral-200)`, outlinedBorder: `var(--joy-palette-neutral-800)`, outlinedHoverColor: `var(--joy-palette-neutral-50)`, outlinedHoverBg: `var(--joy-palette-neutral-800)`, outlinedHoverBorder: `var(--joy-palette-neutral-700)`, outlinedActiveBg: `var(--joy-palette-neutral-800)`, outlinedDisabledColor: `var(--joy-palette-neutral-800)`, outlinedDisabledBorder: `var(--joy-palette-neutral-800)`, softColor: `var(--joy-palette-neutral-200)`, softBg: `var(--joy-palette-neutral-800)`, softHoverColor: `var(--joy-palette-neutral-50)`, softHoverBg: `var(--joy-palette-neutral-700)`, softActiveBg: `var(--joy-palette-neutral-600)`, softDisabledColor: `var(--joy-palette-neutral-700)`, softDisabledBg: `var(--joy-palette-neutral-900)`, solidColor: `var(--joy-palette-common-white)`, solidBg: `var(--joy-palette-neutral-600)`, solidHoverBg: `var(--joy-palette-neutral-700)`, solidActiveBg: `var(--joy-palette-neutral-800)`, solidDisabledColor: `var(--joy-palette-neutral-700)`, solidDisabledBg: `var(--joy-palette-neutral-900)`, }, common: { white: '#FFF', black: '#09090D', }, background: { body: 'var(--joy-palette-neutral-900)', surface: 'var(--joy-palette-common-black)', popup: 'var(--joy-palette-neutral-900)', level1: 'var(--joy-palette-neutral-800)', level2: 'var(--joy-palette-neutral-700)', level3: 'var(--joy-palette-neutral-600)', }, }, }, }, }); ``` </details> <details> <summary>Danger</summary> ```js const danger = { 50: '#FFF8F6', 100: '#FFE9E8', 200: '#FFC7C5', 300: '#FF9192', 400: '#FA5255', 500: '#D3232F', 600: '#A10E25', 700: '#77061B', 800: '#580013', 900: '#39000D', }; extendTheme({ colorSchemes: { light: { palette: { danger: { ...danger, plainColor: `var(--joy-palette-danger-600)`, plainHoverBg: `var(--joy-palette-danger-100)`, plainActiveBg: `var(--joy-palette-danger-200)`, plainDisabledColor: `var(--joy-palette-danger-200)`, outlinedColor: `var(--joy-palette-danger-500)`, outlinedBorder: `var(--joy-palette-danger-200)`, outlinedHoverBg: `var(--joy-palette-danger-100)`, outlinedHoverBorder: `var(--joy-palette-danger-300)`, outlinedActiveBg: `var(--joy-palette-danger-200)`, outlinedDisabledColor: `var(--joy-palette-danger-100)`, outlinedDisabledBorder: `var(--joy-palette-danger-100)`, softColor: `var(--joy-palette-danger-600)`, softBg: `var(--joy-palette-danger-100)`, softHoverBg: `var(--joy-palette-danger-200)`, softActiveBg: `var(--joy-palette-danger-300)`, softDisabledColor: `var(--joy-palette-danger-300)`, softDisabledBg: `var(--joy-palette-danger}-)50`, solidColor: '#fff', solidBg: `var(--joy-palette-danger-500)`, solidHoverBg: `var(--joy-palette-danger-600)`, solidActiveBg: `var(--joy-palette-danger-700)`, solidDisabledColor: `#fff`, solidDisabledBg: `var(--joy-palette-danger-200)`, }, }, }, dark: { palette: { danger: { ...danger, plainColor: `var(--joy-palette-danger-300)`, plainHoverBg: `var(--joy-palette-danger-800)`, plainActiveBg: `var(--joy-palette-danger-700)`, plainDisabledColor: `var(--joy-palette-danger-800)`, outlinedColor: `var(--joy-palette-danger-200)`, outlinedBorder: `var(--joy-palette-danger-700)`, outlinedHoverBg: `var(--joy-palette-danger-800)`, outlinedHoverBorder: `var(--joy-palette-danger-600)`, outlinedActiveBg: `var(--joy-palette-danger-900)`, outlinedDisabledColor: `var(--joy-palette-danger-800)`, outlinedDisabledBorder: `var(--joy-palette-danger-800)`, softColor: `var(--joy-palette-danger-200)`, softBg: `var(--joy-palette-danger-900)`, softHoverBg: `var(--joy-palette-danger-800)`, softActiveBg: `var(--joy-palette-danger-700)`, softDisabledColor: `var(--joy-palette-danger-800)`, softDisabledBg: `var(--joy-palette-danger-900)`, solidColor: `#fff`, solidBg: `var(--joy-palette-danger-600)`, solidHoverBg: `var(--joy-palette-danger-700)`, solidActiveBg: `var(--joy-palette-danger-800)`, solidDisabledColor: `var(--joy-palette-danger-700)`, solidDisabledBg: `var(--joy-palette-danger-900)`, }, }, }, }, }); ``` </details> <details> <summary>Success</summary> ```js const success = { 50: '#F3FEF5', 100: '#D7F5DD', 200: '#77EC95', 300: '#4CC76E', 400: '#2CA24D', 500: '#1A7D36', 600: '#0F5D26', 700: '#034318', 800: '#002F0F', 900: '#001D09', }; extendTheme({ colorSchemes: { light: { palette: { success: { ...success, plainColor: `var(--joy-palette-success-600)`, plainHoverBg: `var(--joy-palette-success-100)`, plainActiveBg: `var(--joy-palette-success-200)`, plainDisabledColor: `var(--joy-palette-success-200)`, outlinedColor: `var(--joy-palette-success-500)`, outlinedBorder: `var(--joy-palette-success-200)`, outlinedHoverBg: `var(--joy-palette-success-100)`, outlinedHoverBorder: `var(--joy-palette-success-300)`, outlinedActiveBg: `var(--joy-palette-success-200)`, outlinedDisabledColor: `var(--joy-palette-success-100)`, outlinedDisabledBorder: `var(--joy-palette-success-100)`, softColor: `var(--joy-palette-success-600)`, softBg: `var(--joy-palette-success-100)`, softHoverBg: `var(--joy-palette-success-200)`, softActiveBg: `var(--joy-palette-success-300)`, softDisabledColor: `var(--joy-palette-success-300)`, softDisabledBg: `var(--joy-palette-success}-)50`, solidColor: '#fff', solidBg: `var(--joy-palette-success-500)`, solidHoverBg: `var(--joy-palette-success-600)`, solidActiveBg: `var(--joy-palette-success-700)`, solidDisabledColor: `#fff`, solidDisabledBg: `var(--joy-palette-success-200)`, }, }, }, dark: { palette: { success: { ...success, plainColor: `var(--joy-palette-success-300)`, plainHoverBg: `var(--joy-palette-success-800)`, plainActiveBg: `var(--joy-palette-success-700)`, plainDisabledColor: `var(--joy-palette-success-800)`, outlinedColor: `var(--joy-palette-success-200)`, outlinedBorder: `var(--joy-palette-success-700)`, outlinedHoverBg: `var(--joy-palette-success-800)`, outlinedHoverBorder: `var(--joy-palette-success-600)`, outlinedActiveBg: `var(--joy-palette-success-900)`, outlinedDisabledColor: `var(--joy-palette-success-800)`, outlinedDisabledBorder: `var(--joy-palette-success-800)`, softColor: `var(--joy-palette-success-200)`, softBg: `var(--joy-palette-success-900)`, softHoverBg: `var(--joy-palette-success-800)`, softActiveBg: `var(--joy-palette-success-700)`, softDisabledColor: `var(--joy-palette-success-800)`, softDisabledBg: `var(--joy-palette-success-900)`, solidColor: '#fff', solidBg: `var(--joy-palette-success-600)`, solidHoverBg: `var(--joy-palette-success-700)`, solidActiveBg: `var(--joy-palette-success-800)`, solidDisabledColor: `var(--joy-palette-success-700)`, solidDisabledBg: `var(--joy-palette-success-900)`, }, }, }, }, }); ``` </details> <details> <summary>Warning</summary> ```js const warning = { 50: '#FFF8C5', 100: '#FAE17D', 200: '#EAC54F', 300: '#D4A72C', 400: '#BF8700', 500: '#9A6700', 600: '#7D4E00', 700: '#633C01', 800: '#4D2D00', 900: '#3B2300', }; extendTheme({ colorSchemes: { light: { palette: { warning: { ...warning, plainColor: `var(--joy-palette-warning-800)`, plainHoverBg: `var(--joy-palette-warning-50)`, plainActiveBg: `var(--joy-palette-warning-200)`, plainDisabledColor: `var(--joy-palette-warning-200)`, outlinedColor: `var(--joy-palette-warning-800)`, outlinedBorder: `var(--joy-palette-warning-200)`, outlinedHoverBg: `var(--joy-palette-warning-50)`, outlinedHoverBorder: `var(--joy-palette-warning-300)`, outlinedActiveBg: `var(--joy-palette-warning-200)`, outlinedDisabledColor: `var(--joy-palette-warning-100)`, outlinedDisabledBorder: `var(--joy-palette-warning-100)`, softColor: `var(--joy-palette-warning-800)`, softBg: `var(--joy-palette-warning-50)`, softHoverBg: `var(--joy-palette-warning-100)`, softActiveBg: `var(--joy-palette-warning-200)`, softDisabledColor: `var(--joy-palette-warning-200)`, softDisabledBg: `var(--joy-palette-warning-50)`, solidColor: `var(--joy-palette-warning-800)`, solidBg: `var(--joy-palette-warning-200)`, solidHoverBg: `var(--joy-palette-warning-300)`, solidActiveBg: `var(--joy-palette-warning-400)`, solidDisabledColor: `var(--joy-palette-warning-200)`, solidDisabledBg: `var(--joy-palette-warning-50)`, }, }, }, dark: { palette: { warning: { ...warning, plainColor: `var(--joy-palette-warning-300)`, plainHoverBg: `var(--joy-palette-warning-800)`, plainActiveBg: `var(--joy-palette-warning-700)`, plainDisabledColor: `var(--joy-palette-warning-800)`, outlinedColor: `var(--joy-palette-warning-200)`, outlinedBorder: `var(--joy-palette-warning-700)`, outlinedHoverBg: `var(--joy-palette-warning-800)`, outlinedHoverBorder: `var(--joy-palette-warning-600)`, outlinedActiveBg: `var(--joy-palette-warning-900)`, outlinedDisabledColor: `var(--joy-palette-warning-800)`, outlinedDisabledBorder: `var(--joy-palette-warning-800)`, softColor: `var(--joy-palette-warning-200)`, softBg: `var(--joy-palette-warning-900)`, softHoverBg: `var(--joy-palette-warning-800)`, softActiveBg: `var(--joy-palette-warning-700)`, softDisabledColor: `var(--joy-palette-warning-800)`, softDisabledBg: `var(--joy-palette-warning-900)`, solidColor: `var(--joy-palette-common-black)`, solidBg: `var(--joy-palette-warning-300)`, solidHoverBg: `var(--joy-palette-warning-400)`, solidActiveBg: `var(--joy-palette-warning-500)`, solidDisabledColor: `var(--joy-palette-warning-700)`, solidDisabledBg: `var(--joy-palette-warning-900)`, }, }, }, }, }); ``` </details> ### Font family The default theme typeface has been changed to [`Inter`](https://fonts.google.com/specimen/Inter?query=inter). Follow the [installation guide](/joy-ui/getting-started/installation/#inter-font) to install it. To keep the old font family, add the following to your theme: ```js extendTheme({ fontFamily: { display: '"Public Sans", var(--joy-fontFamily-fallback)', body: '"Public Sans", var(--joy-fontFamily-fallback)', }, }); ``` ### Font size The font size scale has been reduced to: ```diff { - xl7: '4.5rem', - xl6: '3.75rem', - xl5: '3rem', xl4: '2.25rem', xl3: '1.875rem', xl2: '1.5rem', xl: '1.25rem', lg: '1.125rem', md: '1rem', sm: '0.875rem', xs: '0.75rem', - xs2: '0.625rem', - xs3: '0.5rem', } ``` To keep the old font size scale, add the following to your theme: ```js extendTheme({ fontSize: { xl7: '4.5rem', xl6: '3.75rem', xl5: '3rem', xs2: '0.625rem', xs3: '0.5rem', }, }); ``` #### TypeScript If working with TypeScript, add the old font size scale to the theme's type via module augmentation: ```ts // You can put this to any file that's included in your tsconfig declare module '@mui/joy/styles' { interface FontSizeOverrides { xl7: true; xl6: true; xl5: true; xs2: true; xs3: true; } } ``` ### Font weight The font weight scale has been reduced to: ```diff { - xs: 200, sm: 300, md: 500, lg: 600, xl: 700, - xl2: 800, - xl3: 900, } ``` To keep the old font weight scale, add the following to your theme: ```js extendTheme({ fontWeight: { xs: 200, xl2: 800, xl3: 900, }, }); ``` #### TypeScript If working with TypeScript, add the old font weight scale to the theme's type via module augmentation: ```ts // You can put this to any file that's included in your tsconfig declare module '@mui/joy/styles' { interface FontWeightOverrides { xs: true; xl2: true; xl3: true; } } ``` ### Line height The font size scale has been changed to: ```diff { - sm: 1.25, - md: 1.5, - lg: 1.7, + xs: 1.33334, // largest font sizes for h1, h2 + sm: 1.42858, // normal font sizes + md: 1.5, // normal font sizes + lg: 1.55556, // large font sizes for components + xl: 1.66667, // smallest font sizes } ``` ### Letter spacing The letter spacing scale has been removed. To add it back, add the following to your theme: ```js extendTheme({ letterSpacing: { sm: '-0.01em', md: '0.083em', lg: '0.125em', }, }); ``` #### TypeScript If working with TypeScript, add the old letter spacing scale to the theme's type via module augmentation: ```ts // You can put this to any file that's included in your tsconfig declare module '@mui/joy/styles' { interface ThemeScales { letterSpacing: { sm: string; md: string; lg: string; }; } } ``` ### Level The default typography level scale (`theme.typography.*`) has been restructured to: ```diff h1 h2 h3 h4 + title-lg + title-md + title-sm + body-lg + body-md + body-sm + body-xs - display1 - display2 - h5 // recommend to use `title-lg` instead - h6 // recommend to use `title-md` instead - body1 // recommend to use `body-md` instead - body2 // recommend to use `body-sm` instead - body3 // recommend to use `body-xs` instead - body4 - body5 ``` The reason behind this restructure is to make the levels more consistent and easier to use. The `h1` through `h4` levels are intended to be used for page headings, while the `title-*` and `body-*` levels are intended to be used as page paragraphs and as component texts. The `title-*` and `body-*` levels are designed to be composable which align perfectly with each size of the `SvgIcon` component: {{"demo": "TitleBodyIconExample.js"}} ### Shadow The shadow scale remains the same but all values have been changed. To keep the old shadow scale, add the following to your theme: ```js extendTheme({ shadow: { xs: `var(--joy-shadowRing, 0 0 #000), 0 1px 2px 0 rgba(var(--joy-shadowChannel, 187 187 187) / 0.12)`, sm: `var(--joy-shadowRing, 0 0 #000), 0.3px 0.8px 1.1px rgba(var(--joy-shadowChannel, 187 187 187) / 0.11), 0.5px 1.3px 1.8px -0.6px rgba(var(--joy-shadowChannel, 187 187 187) / 0.18), 1.1px 2.7px 3.8px -1.2px rgba(var(--joy-shadowChannel, 187 187 187) / 0.26)`, md: `var(--joy-shadowRing, 0 0 #000), 0.3px 0.8px 1.1px rgba(var(--joy-shadowChannel, 187 187 187) / 0.12), 1.1px 2.8px 3.9px -0.4px rgba(var(--joy-shadowChannel, 187 187 187) / 0.17), 2.4px 6.1px 8.6px -0.8px rgba(var(--joy-shadowChannel, 187 187 187) / 0.23), 5.3px 13.3px 18.8px -1.2px rgba(var(--joy-shadowChannel, 187 187 187) / 0.29)`, lg: `var(--joy-shadowRing, 0 0 #000), 0.3px 0.8px 1.1px rgba(var(--joy-shadowChannel, 187 187 187) / 0.11), 1.8px 4.5px 6.4px -0.2px rgba(var(--joy-shadowChannel, 187 187 187) / 0.13), 3.2px 7.9px 11.2px -0.4px rgba(var(--joy-shadowChannel, 187 187 187) / 0.16), 4.8px 12px 17px -0.5px rgba(var(--joy-shadowChannel, 187 187 187) / 0.19), 7px 17.5px 24.7px -0.7px rgba(var(--joy-shadowChannel, 187 187 187) / 0.21)`, xl: `var(--joy-shadowRing, 0 0 #000), 0.3px 0.8px 1.1px rgba(var(--joy-shadowChannel, 187 187 187) / 0.11), 1.8px 4.5px 6.4px -0.2px rgba(var(--joy-shadowChannel, 187 187 187) / 0.13), 3.2px 7.9px 11.2px -0.4px rgba(var(--joy-shadowChannel, 187 187 187) / 0.16), 4.8px 12px 17px -0.5px rgba(var(--joy-shadowChannel, 187 187 187) / 0.19), 7px 17.5px 24.7px -0.7px rgba(var(--joy-shadowChannel, 187 187 187) / 0.21), 10.2px 25.5px 36px -0.9px rgba(var(--joy-shadowChannel, 187 187 187) / 0.24), 14.8px 36.8px 52.1px -1.1px rgba(var(--joy-shadowChannel, 187 187 187) / 0.27), 21px 52.3px 74px -1.2px rgba(var(--joy-shadowChannel, 187 187 187) / 0.29)`, }, }); ``` ## Components ### Alert The default variant has been changed to `outlined` and the default color has been changed to `neutral`. To keep the old default variant and color, add the following to your theme: ```js extendTheme({ components: { JoyAlert: { defaultProps: { variant: 'soft', color: 'primary', }, }, }, }); ``` ### Autocomplete The variant and color are now the same for `input` and `listbox` slots. If you want to use a different variant for a specific slot, use `slotProps`. In the following example, the `listbox` slot uses the `plain` variant: ```js <Autocomplete variant="plain" slotProps={{ listbox: { variant: 'plain', } }} > ``` ### Chip The default variant has been changed to `soft` and the default color has been changed to `neutral`. To keep the old default variant and color, add the following to your theme: ```js extendTheme({ components: { JoyChip: { defaultProps: { variant: 'solid', color: 'primary', }, }, }, }); ``` ### ChipDelete The default variant has been changed to `plain` and the default color has been changed to `neutral`. To keep the old default variant and color, add the following to your theme: ```js extendTheme({ components: { JoyChipDelete: { defaultProps: { variant: 'solid', color: 'primary', }, }, }, }); ``` ### IconButton The default variant has been changed to `plain` and the default color has been changed to `neutral`. To keep the old default variant and color, add the following to your theme: ```js extendTheme({ components: { JoyIconButton: { defaultProps: { variant: 'soft', color: 'primary', }, }, }, }); ``` ### Tabs The [Tabs](/joy-ui/react-tabs/) component has been redesigned following feedback we've received on [this GitHub issue](https://github.com/mui/material-ui/issues/36782). {{"demo": "../components/tabs/TabsBasic.js"}} To keep the old Tabs design, add the following to your theme: ```js extendTheme({ components: { JoyTabList: { defaultProps: { variant: 'soft', disableUnderline: true, }, styleOverrides: { root: { gap: '0.25rem', padding: '0.25rem', '--List-padding': '0.25rem', borderRadius: 'var(--joy-radius-xl)', '--List-radius': 'var(--joy-radius-xl)', }, }, }, JoyTab: { defaultProps: { disableIndicator: true, }, styleOverrides: { root: { '&[aria-selected="true"]': { boxShadow: 'var(--joy-shadow-sm)', backgroundColor: 'var(--joy-palette-background-surface)', }, }, }, }, }, }); ``` ### Select The variant and color are now the same for `button` and `listbox` slots. If you want to use a different variant for a specific slot, use `slotProps`. In the following example, the `listbox` slot uses the `plain` variant: ```js <Select variant="plain" slotProps={{ listbox: { variant: 'plain', } }} > ```
1,983
0
petrpan-code/mui/material-ui/docs/data
petrpan-code/mui/material-ui/docs/data/material/pages.ts
import standardNavIcons from 'docs/src/modules/components/AppNavIcons'; import pagesApi from 'docs/data/material/pagesApi'; import { MuiPage } from 'docs/src/MuiPage'; const pages: MuiPage[] = [ { pathname: '/material-ui/getting-started-group', title: 'Getting started', children: [ { pathname: '/material-ui/getting-started', title: 'Overview' }, { pathname: '/material-ui/getting-started/installation' }, { pathname: '/material-ui/getting-started/usage' }, { pathname: '/material-ui/getting-started/example-projects' }, { pathname: '/material-ui/getting-started/templates' }, { pathname: '/material-ui/getting-started/learn' }, { pathname: '/material-ui/getting-started/design-resources' }, { pathname: '/material-ui/getting-started/faq', title: 'FAQs' }, { pathname: '/material-ui/getting-started/supported-components' }, { pathname: '/material-ui/getting-started/supported-platforms' }, { pathname: '/material-ui/getting-started/support' }, ], }, { pathname: '/material-ui/react-', title: 'Components', children: [ { pathname: '/material-ui/components/inputs', subheader: 'inputs', children: [ { pathname: '/material-ui/react-autocomplete' }, { pathname: '/material-ui/react-button' }, { pathname: '/material-ui/react-button-group', title: 'Button Group' }, { pathname: '/material-ui/react-checkbox' }, { pathname: '/material-ui/react-floating-action-button', title: 'Floating Action Button', }, { pathname: '/material-ui/react-radio-button', title: 'Radio Group' }, { pathname: '/material-ui/react-rating' }, { pathname: '/material-ui/react-select' }, { pathname: '/material-ui/react-slider' }, { pathname: '/material-ui/react-switch' }, { pathname: '/material-ui/react-text-field', title: 'Text Field' }, { pathname: '/material-ui/react-transfer-list', title: 'Transfer List' }, { pathname: '/material-ui/react-toggle-button', title: 'Toggle Button' }, ], }, { pathname: '/material-ui/components/data-display', subheader: 'data-display', children: [ { pathname: '/material-ui/react-avatar' }, { pathname: '/material-ui/react-badge' }, { pathname: '/material-ui/react-chip' }, { pathname: '/material-ui/react-divider' }, { pathname: '/material-ui/icons' }, { pathname: '/material-ui/material-icons', title: 'Material Icons' }, { pathname: '/material-ui/react-list' }, { pathname: '/material-ui/react-table' }, { pathname: '/material-ui/react-tooltip' }, { pathname: '/material-ui/react-typography' }, ], }, { pathname: '/material-ui/components/feedback', subheader: 'feedback', children: [ { pathname: '/material-ui/react-alert' }, { pathname: '/material-ui/react-backdrop' }, { pathname: '/material-ui/react-dialog' }, { pathname: '/material-ui/react-progress' }, { pathname: '/material-ui/react-skeleton' }, { pathname: '/material-ui/react-snackbar' }, ], }, { pathname: '/material-ui/components/surfaces', subheader: 'surfaces', children: [ { pathname: '/material-ui/react-accordion' }, { pathname: '/material-ui/react-app-bar', title: 'App Bar' }, { pathname: '/material-ui/react-card' }, { pathname: '/material-ui/react-paper' }, ], }, { pathname: '/material-ui/components/navigation', subheader: 'navigation', children: [ { pathname: '/material-ui/react-bottom-navigation', title: 'Bottom Navigation' }, { pathname: '/material-ui/react-breadcrumbs' }, { pathname: '/material-ui/react-drawer' }, { pathname: '/material-ui/react-link' }, { pathname: '/material-ui/react-menu' }, { pathname: '/material-ui/react-pagination' }, { pathname: '/material-ui/react-speed-dial', title: 'Speed Dial' }, { pathname: '/material-ui/react-stepper' }, { pathname: '/material-ui/react-tabs' }, ], }, { pathname: '/material-ui/components/layout', subheader: 'layout', children: [ { pathname: '/material-ui/react-box' }, { pathname: '/material-ui/react-container' }, { pathname: '/material-ui/react-grid' }, { pathname: '/material-ui/react-grid2', title: 'Grid v2', newFeature: true }, { pathname: '/material-ui/react-stack' }, { pathname: '/material-ui/react-image-list', title: 'Image List' }, { pathname: '/material-ui/react-hidden' }, ], }, { pathname: '/material-ui/components/utils', subheader: 'utils', children: [ { pathname: '/material-ui/react-click-away-listener', title: 'Click-Away Listener' }, { pathname: '/material-ui/react-css-baseline', title: 'CSS Baseline' }, { pathname: '/material-ui/react-modal' }, { pathname: '/material-ui/react-no-ssr', title: 'No SSR' }, { pathname: '/material-ui/react-popover' }, { pathname: '/material-ui/react-popper' }, { pathname: '/material-ui/react-portal' }, { pathname: '/material-ui/react-textarea-autosize', title: 'Textarea Autosize' }, { pathname: '/material-ui/transitions' }, { pathname: '/material-ui/react-use-media-query', title: 'useMediaQuery' }, ], }, { pathname: '/mui-x', // the pathname does not matter here because the links to MUI X are outbound. subheader: 'MUI X', children: [ { pathname: '/x/react-data-grid', title: 'Data Grid' }, { pathname: '/x/react-date-pickers/getting-started', title: 'Date & Time Pickers' }, ], }, { pathname: '/material-ui', subheader: 'lab', children: [ { pathname: '/material-ui/about-the-lab', title: 'About the lab πŸ§ͺ' }, { pathname: '/material-ui/react-masonry' }, { pathname: '/material-ui/react-timeline' }, ], }, ], }, { title: 'Component API', pathname: '/material-ui/api', children: pagesApi, }, { pathname: '/material-ui/customization', children: [ { pathname: '/material-ui/customization/theme', subheader: '/material-ui/customization/theme', children: [ { pathname: '/material-ui/customization/theming' }, { pathname: '/material-ui/customization/palette' }, { pathname: '/material-ui/customization/dark-mode' }, { pathname: '/material-ui/customization/typography' }, { pathname: '/material-ui/customization/spacing' }, { pathname: '/material-ui/customization/breakpoints' }, { pathname: '/material-ui/customization/density' }, { pathname: '/material-ui/customization/z-index', title: 'z-index' }, { pathname: '/material-ui/customization/transitions' }, { pathname: '/material-ui/customization/theme-components', title: 'Components' }, { pathname: '/material-ui/customization/default-theme', title: 'Default theme viewer' }, ], }, { pathname: '/material-ui/customization/how-to-customize' }, { pathname: '/material-ui/customization/color' }, ], }, { pathname: '/material-ui/guides', title: 'How-to guides', children: [ { pathname: '/material-ui/guides/api', title: 'API design approach' }, { pathname: '/material-ui/guides/creating-themed-components', title: 'Creating themed components', }, { pathname: '/material-ui/guides/understand-mui-packages', title: 'Understand MUI packages' }, { pathname: '/material-ui/guides/typescript', title: 'TypeScript' }, { pathname: '/material-ui/guides/interoperability', title: 'Style library interoperability' }, { pathname: '/material-ui/guides/styled-components', title: 'Using styled-components' }, { pathname: '/material-ui/guides/theme-scoping' }, { pathname: '/material-ui/guides/minimizing-bundle-size' }, { pathname: '/material-ui/guides/composition' }, { pathname: '/material-ui/guides/routing' }, { pathname: '/material-ui/guides/server-rendering' }, { pathname: '/material-ui/guides/responsive-ui', title: 'Responsive UI' }, { pathname: '/material-ui/guides/pickers-migration', title: 'Migration from @material-ui/pickers', }, { pathname: '/material-ui/guides/testing' }, { pathname: '/material-ui/guides/localization' }, { pathname: '/material-ui/guides/content-security-policy', title: 'Content Security Policy' }, { pathname: '/material-ui/guides/right-to-left', title: 'Right-to-left' }, { pathname: '/material-ui/guides/shadow-dom', title: 'Shadow DOM' }, { pathname: '/material-ui/guides/next-js-app-router', title: 'Next.js App Router', }, ], }, { pathname: '/material-ui/experimental-api', title: 'Experimental APIs', children: [ { pathname: '/material-ui/experimental-api/classname-generator', title: 'ClassName generator', }, { pathname: '/material-ui/experimental-api/css-theme-variables', subheader: 'CSS theme variables', children: [ { pathname: '/material-ui/experimental-api/css-theme-variables/overview' }, { pathname: '/material-ui/experimental-api/css-theme-variables/usage' }, { pathname: '/material-ui/experimental-api/css-theme-variables/customization' }, { pathname: '/material-ui/experimental-api/css-theme-variables/migration', title: 'Migrating to CSS variables', }, ], }, ], }, { pathname: '/material-ui/discover-more', children: [ { pathname: '/material-ui/discover-more/showcase' }, { pathname: '/material-ui/discover-more/related-projects' }, { pathname: '/material-ui/discover-more/design-kits' }, { pathname: '/material-ui/discover-more/roadmap' }, { pathname: '/material-ui/discover-more/backers', title: 'Sponsors and Backers' }, { pathname: '/material-ui/discover-more/vision' }, { pathname: '/material-ui/discover-more/changelog' }, ], }, { pathname: '/material-ui/migration', title: 'Migration', children: [ { pathname: '/material-ui/migration/migration-grid-v2', title: 'Migrating to Grid v2', }, { pathname: '/material-ui/migration/v5', subheader: 'Upgrade to v5', children: [ { pathname: '/material-ui/migration/migration-v4', title: 'Migrating to v5: getting started', }, { pathname: '/material-ui/migration/v5-style-changes', title: 'Breaking changes: style and theme', }, { pathname: '/material-ui/migration/v5-component-changes', title: 'Breaking changes: components', }, { pathname: '/material-ui/migration/migrating-from-jss', title: 'Migrating from JSS (optional)', }, { pathname: '/material-ui/migration/troubleshooting', title: 'Troubleshooting', }, ], }, { pathname: '/material-ui/migration/earlier', subheader: 'Earlier versions', children: [ { pathname: '/material-ui/migration/migration-v3', title: 'Migration from v3 to v4' }, { pathname: '/material-ui/migration/migration-v0x', title: 'Migration from v0.x to v1' }, ], }, ], }, { pathname: 'https://mui.com/store/?utm_source=docs&utm_medium=referral&utm_campaign=sidenav', title: 'Templates', icon: standardNavIcons.ReaderIcon, }, ]; export default pages;
1,984
0
petrpan-code/mui/material-ui/docs/data
petrpan-code/mui/material-ui/docs/data/material/pagesApi.js
module.exports = [ { pathname: '/material-ui/api/accordion' }, { pathname: '/material-ui/api/accordion-actions' }, { pathname: '/material-ui/api/accordion-details' }, { pathname: '/material-ui/api/accordion-summary' }, { pathname: '/material-ui/api/alert' }, { pathname: '/material-ui/api/alert-title' }, { pathname: '/material-ui/api/app-bar' }, { pathname: '/material-ui/api/autocomplete' }, { pathname: '/material-ui/api/avatar' }, { pathname: '/material-ui/api/avatar-group' }, { pathname: '/material-ui/api/backdrop' }, { pathname: '/material-ui/api/badge' }, { pathname: '/material-ui/api/bottom-navigation' }, { pathname: '/material-ui/api/bottom-navigation-action' }, { pathname: '/material-ui/api/box' }, { pathname: '/material-ui/api/breadcrumbs' }, { pathname: '/material-ui/api/button' }, { pathname: '/material-ui/api/button-base' }, { pathname: '/material-ui/api/button-group' }, { pathname: '/material-ui/api/card' }, { pathname: '/material-ui/api/card-action-area' }, { pathname: '/material-ui/api/card-actions' }, { pathname: '/material-ui/api/card-content' }, { pathname: '/material-ui/api/card-header' }, { pathname: '/material-ui/api/card-media' }, { pathname: '/material-ui/api/checkbox' }, { pathname: '/material-ui/api/chip' }, { pathname: '/material-ui/api/circular-progress' }, { pathname: '/material-ui/api/collapse' }, { pathname: '/material-ui/api/container' }, { pathname: '/material-ui/api/css-baseline' }, { pathname: '/material-ui/api/dialog' }, { pathname: '/material-ui/api/dialog-actions' }, { pathname: '/material-ui/api/dialog-content' }, { pathname: '/material-ui/api/dialog-content-text' }, { pathname: '/material-ui/api/dialog-title' }, { pathname: '/material-ui/api/divider' }, { pathname: '/material-ui/api/drawer' }, { pathname: '/material-ui/api/fab' }, { pathname: '/material-ui/api/fade' }, { pathname: '/material-ui/api/filled-input' }, { pathname: '/material-ui/api/form-control' }, { pathname: '/material-ui/api/form-control-label' }, { pathname: '/material-ui/api/form-group' }, { pathname: '/material-ui/api/form-helper-text' }, { pathname: '/material-ui/api/form-label' }, { pathname: '/material-ui/api/global-styles' }, { pathname: '/material-ui/api/grid' }, { pathname: '/material-ui/api/grow' }, { pathname: '/material-ui/api/hidden' }, { pathname: '/material-ui/api/icon' }, { pathname: '/material-ui/api/icon-button' }, { pathname: '/material-ui/api/image-list' }, { pathname: '/material-ui/api/image-list-item' }, { pathname: '/material-ui/api/image-list-item-bar' }, { pathname: '/material-ui/api/input' }, { pathname: '/material-ui/api/input-adornment' }, { pathname: '/material-ui/api/input-base' }, { pathname: '/material-ui/api/input-label' }, { pathname: '/material-ui/api/linear-progress' }, { pathname: '/material-ui/api/link' }, { pathname: '/material-ui/api/list' }, { pathname: '/material-ui/api/list-item' }, { pathname: '/material-ui/api/list-item-avatar' }, { pathname: '/material-ui/api/list-item-button' }, { pathname: '/material-ui/api/list-item-icon' }, { pathname: '/material-ui/api/list-item-secondary-action' }, { pathname: '/material-ui/api/list-item-text' }, { pathname: '/material-ui/api/list-subheader' }, { pathname: '/material-ui/api/loading-button' }, { pathname: '/material-ui/api/masonry' }, { pathname: '/material-ui/api/menu' }, { pathname: '/material-ui/api/menu-item' }, { pathname: '/material-ui/api/menu-list' }, { pathname: '/material-ui/api/mobile-stepper' }, { pathname: '/material-ui/api/modal' }, { pathname: '/material-ui/api/native-select' }, { pathname: '/material-ui/api/outlined-input' }, { pathname: '/material-ui/api/pagination' }, { pathname: '/material-ui/api/pagination-item' }, { pathname: '/material-ui/api/paper' }, { pathname: '/material-ui/api/popover' }, { pathname: '/material-ui/api/popper' }, { pathname: '/material-ui/api/radio' }, { pathname: '/material-ui/api/radio-group' }, { pathname: '/material-ui/api/rating' }, { pathname: '/material-ui/api/scoped-css-baseline' }, { pathname: '/material-ui/api/select' }, { pathname: '/material-ui/api/skeleton' }, { pathname: '/material-ui/api/slide' }, { pathname: '/material-ui/api/slider' }, { pathname: '/material-ui/api/snackbar' }, { pathname: '/material-ui/api/snackbar-content' }, { pathname: '/material-ui/api/speed-dial' }, { pathname: '/material-ui/api/speed-dial-action' }, { pathname: '/material-ui/api/speed-dial-icon' }, { pathname: '/material-ui/api/stack' }, { pathname: '/material-ui/api/step' }, { pathname: '/material-ui/api/step-button' }, { pathname: '/material-ui/api/step-connector' }, { pathname: '/material-ui/api/step-content' }, { pathname: '/material-ui/api/step-icon' }, { pathname: '/material-ui/api/step-label' }, { pathname: '/material-ui/api/stepper' }, { pathname: '/material-ui/api/svg-icon' }, { pathname: '/material-ui/api/swipeable-drawer' }, { pathname: '/material-ui/api/switch' }, { pathname: '/material-ui/api/tab' }, { pathname: '/material-ui/api/tab-context' }, { pathname: '/material-ui/api/table' }, { pathname: '/material-ui/api/table-body' }, { pathname: '/material-ui/api/table-cell' }, { pathname: '/material-ui/api/table-container' }, { pathname: '/material-ui/api/table-footer' }, { pathname: '/material-ui/api/table-head' }, { pathname: '/material-ui/api/table-pagination' }, { pathname: '/material-ui/api/table-row' }, { pathname: '/material-ui/api/table-sort-label' }, { pathname: '/material-ui/api/tab-list' }, { pathname: '/material-ui/api/tab-panel' }, { pathname: '/material-ui/api/tabs' }, { pathname: '/material-ui/api/tab-scroll-button' }, { pathname: '/material-ui/api/text-field' }, { pathname: '/material-ui/api/timeline' }, { pathname: '/material-ui/api/timeline-connector' }, { pathname: '/material-ui/api/timeline-content' }, { pathname: '/material-ui/api/timeline-dot' }, { pathname: '/material-ui/api/timeline-item' }, { pathname: '/material-ui/api/timeline-opposite-content' }, { pathname: '/material-ui/api/timeline-separator' }, { pathname: '/material-ui/api/toggle-button' }, { pathname: '/material-ui/api/toggle-button-group' }, { pathname: '/material-ui/api/toolbar' }, { pathname: '/material-ui/api/tooltip' }, { pathname: '/material-ui/api/typography' }, { pathname: '/material-ui/api/zoom' }, ];
1,985
0
petrpan-code/mui/material-ui/docs/data/material
petrpan-code/mui/material-ui/docs/data/material/components/.eslintrc.js
module.exports = { rules: { // useful for interactions feedback 'no-console': ['off', { allow: ['info'] }], // not very friendly to prop forwarding 'react/jsx-handler-names': 'off', }, };
1,986
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/about-the-lab/about-the-lab.md
# About the lab <p class="description">This package hosts the incubator components that are not yet ready to move to the core.</p> The main difference between the lab and the core is how the components are versioned. Having a separate lab package allows us to release breaking changes when necessary while the core package follows a [slower-moving policy](https://mui.com/versions/#release-frequency). As developers use and test the components and report issues, the maintainers learn more about shortcomings of the components: missing features, accessibility issues, bugs, API design, etc. The older and more used a component is, the less likely it is that new issues will be found and subsequently need to introduce breaking changes. For a component to be ready to move to the core, the following criteria are considered: - It needs to be **used**. The MUI team uses Google Analytics in the documentation (among other metrics) to evaluate the usage of each component. A lab component with low usage either means that it isn't fully working yet, or that there is low demand for it. - It needs to match the **code quality** of the core components. It doesn't have to be perfect to be part of the core, but the component should be reliable enough that developers can depend on it. - Each component needs **type definitions**. It is not currently required that a lab component is typed, but it would need to be typed to move to the core. - Requires good **test coverage**. Some of the lab components don't currently have comprehensive tests. - Can it be used as **leverage** to incentivize users to upgrade to the latest major release? The less fragmented the community is, the better. - It needs to have a low probability of a **breaking change** in the short/medium future. For instance, if it needs a new feature that will likely require a breaking change, it may be preferable to delay its promotion to the core. ## Installation To install and save in your `package.json` dependencies, run one of the following commands: <codeblock storageKey="package-manager"> ```bash npm npm install @mui/lab @mui/material ``` ```bash yarn yarn add @mui/lab @mui/material ``` ```bash pnpm pnpm add @mui/lab @mui/material ``` </codeblock> Note that the lab has a peer dependency on the Material UI components. ## TypeScript In order to benefit from the [CSS overrides](/material-ui/customization/theme-components/#theme-style-overrides) and [default prop customization](/material-ui/customization/theme-components/#theme-default-props) with the theme, TypeScript users need to import the following types. Internally, it uses [module augmentation](/material-ui/guides/typescript/#customization-of-theme) to extend the default theme structure with the extension components available in the lab. ```tsx // When using TypeScript 4.x and above import type {} from '@mui/lab/themeAugmentation'; // When using TypeScript 3.x and below import '@mui/lab/themeAugmentation'; const theme = createTheme({ components: { MuiTimeline: { styleOverrides: { root: { backgroundColor: 'red', }, }, }, }, }); ```
1,987
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/accordion/BasicAccordion.js
import * as React from 'react'; import Accordion from '@mui/material/Accordion'; import AccordionSummary from '@mui/material/AccordionSummary'; import AccordionDetails from '@mui/material/AccordionDetails'; import Typography from '@mui/material/Typography'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; export default function BasicAccordion() { return ( <div> <Accordion> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel1a-content" id="panel1a-header" > <Typography>Accordion 1</Typography> </AccordionSummary> <AccordionDetails> <Typography> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </Typography> </AccordionDetails> </Accordion> <Accordion> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel2a-content" id="panel2a-header" > <Typography>Accordion 2</Typography> </AccordionSummary> <AccordionDetails> <Typography> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </Typography> </AccordionDetails> </Accordion> <Accordion disabled> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel3a-content" id="panel3a-header" > <Typography>Disabled Accordion</Typography> </AccordionSummary> </Accordion> </div> ); }
1,988
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/accordion/BasicAccordion.tsx
import * as React from 'react'; import Accordion from '@mui/material/Accordion'; import AccordionSummary from '@mui/material/AccordionSummary'; import AccordionDetails from '@mui/material/AccordionDetails'; import Typography from '@mui/material/Typography'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; export default function BasicAccordion() { return ( <div> <Accordion> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel1a-content" id="panel1a-header" > <Typography>Accordion 1</Typography> </AccordionSummary> <AccordionDetails> <Typography> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </Typography> </AccordionDetails> </Accordion> <Accordion> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel2a-content" id="panel2a-header" > <Typography>Accordion 2</Typography> </AccordionSummary> <AccordionDetails> <Typography> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </Typography> </AccordionDetails> </Accordion> <Accordion disabled> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel3a-content" id="panel3a-header" > <Typography>Disabled Accordion</Typography> </AccordionSummary> </Accordion> </div> ); }
1,989
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/accordion/ControlledAccordions.js
import * as React from 'react'; import Accordion from '@mui/material/Accordion'; import AccordionDetails from '@mui/material/AccordionDetails'; import AccordionSummary from '@mui/material/AccordionSummary'; import Typography from '@mui/material/Typography'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; export default function ControlledAccordions() { const [expanded, setExpanded] = React.useState(false); const handleChange = (panel) => (event, isExpanded) => { setExpanded(isExpanded ? panel : false); }; return ( <div> <Accordion expanded={expanded === 'panel1'} onChange={handleChange('panel1')}> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel1bh-content" id="panel1bh-header" > <Typography sx={{ width: '33%', flexShrink: 0 }}> General settings </Typography> <Typography sx={{ color: 'text.secondary' }}>I am an accordion</Typography> </AccordionSummary> <AccordionDetails> <Typography> Nulla facilisi. Phasellus sollicitudin nulla et quam mattis feugiat. Aliquam eget maximus est, id dignissim quam. </Typography> </AccordionDetails> </Accordion> <Accordion expanded={expanded === 'panel2'} onChange={handleChange('panel2')}> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel2bh-content" id="panel2bh-header" > <Typography sx={{ width: '33%', flexShrink: 0 }}>Users</Typography> <Typography sx={{ color: 'text.secondary' }}> You are currently not an owner </Typography> </AccordionSummary> <AccordionDetails> <Typography> Donec placerat, lectus sed mattis semper, neque lectus feugiat lectus, varius pulvinar diam eros in elit. Pellentesque convallis laoreet laoreet. </Typography> </AccordionDetails> </Accordion> <Accordion expanded={expanded === 'panel3'} onChange={handleChange('panel3')}> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel3bh-content" id="panel3bh-header" > <Typography sx={{ width: '33%', flexShrink: 0 }}> Advanced settings </Typography> <Typography sx={{ color: 'text.secondary' }}> Filtering has been entirely disabled for whole web server </Typography> </AccordionSummary> <AccordionDetails> <Typography> Nunc vitae orci ultricies, auctor nunc in, volutpat nisl. Integer sit amet egestas eros, vitae egestas augue. Duis vel est augue. </Typography> </AccordionDetails> </Accordion> <Accordion expanded={expanded === 'panel4'} onChange={handleChange('panel4')}> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel4bh-content" id="panel4bh-header" > <Typography sx={{ width: '33%', flexShrink: 0 }}>Personal data</Typography> </AccordionSummary> <AccordionDetails> <Typography> Nunc vitae orci ultricies, auctor nunc in, volutpat nisl. Integer sit amet egestas eros, vitae egestas augue. Duis vel est augue. </Typography> </AccordionDetails> </Accordion> </div> ); }
1,990
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/accordion/ControlledAccordions.tsx
import * as React from 'react'; import Accordion from '@mui/material/Accordion'; import AccordionDetails from '@mui/material/AccordionDetails'; import AccordionSummary from '@mui/material/AccordionSummary'; import Typography from '@mui/material/Typography'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; export default function ControlledAccordions() { const [expanded, setExpanded] = React.useState<string | false>(false); const handleChange = (panel: string) => (event: React.SyntheticEvent, isExpanded: boolean) => { setExpanded(isExpanded ? panel : false); }; return ( <div> <Accordion expanded={expanded === 'panel1'} onChange={handleChange('panel1')}> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel1bh-content" id="panel1bh-header" > <Typography sx={{ width: '33%', flexShrink: 0 }}> General settings </Typography> <Typography sx={{ color: 'text.secondary' }}>I am an accordion</Typography> </AccordionSummary> <AccordionDetails> <Typography> Nulla facilisi. Phasellus sollicitudin nulla et quam mattis feugiat. Aliquam eget maximus est, id dignissim quam. </Typography> </AccordionDetails> </Accordion> <Accordion expanded={expanded === 'panel2'} onChange={handleChange('panel2')}> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel2bh-content" id="panel2bh-header" > <Typography sx={{ width: '33%', flexShrink: 0 }}>Users</Typography> <Typography sx={{ color: 'text.secondary' }}> You are currently not an owner </Typography> </AccordionSummary> <AccordionDetails> <Typography> Donec placerat, lectus sed mattis semper, neque lectus feugiat lectus, varius pulvinar diam eros in elit. Pellentesque convallis laoreet laoreet. </Typography> </AccordionDetails> </Accordion> <Accordion expanded={expanded === 'panel3'} onChange={handleChange('panel3')}> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel3bh-content" id="panel3bh-header" > <Typography sx={{ width: '33%', flexShrink: 0 }}> Advanced settings </Typography> <Typography sx={{ color: 'text.secondary' }}> Filtering has been entirely disabled for whole web server </Typography> </AccordionSummary> <AccordionDetails> <Typography> Nunc vitae orci ultricies, auctor nunc in, volutpat nisl. Integer sit amet egestas eros, vitae egestas augue. Duis vel est augue. </Typography> </AccordionDetails> </Accordion> <Accordion expanded={expanded === 'panel4'} onChange={handleChange('panel4')}> <AccordionSummary expandIcon={<ExpandMoreIcon />} aria-controls="panel4bh-content" id="panel4bh-header" > <Typography sx={{ width: '33%', flexShrink: 0 }}>Personal data</Typography> </AccordionSummary> <AccordionDetails> <Typography> Nunc vitae orci ultricies, auctor nunc in, volutpat nisl. Integer sit amet egestas eros, vitae egestas augue. Duis vel est augue. </Typography> </AccordionDetails> </Accordion> </div> ); }
1,991
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/accordion/CustomizedAccordions.js
import * as React from 'react'; import { styled } from '@mui/material/styles'; import ArrowForwardIosSharpIcon from '@mui/icons-material/ArrowForwardIosSharp'; import MuiAccordion from '@mui/material/Accordion'; import MuiAccordionSummary from '@mui/material/AccordionSummary'; import MuiAccordionDetails from '@mui/material/AccordionDetails'; import Typography from '@mui/material/Typography'; const Accordion = styled((props) => ( <MuiAccordion disableGutters elevation={0} square {...props} /> ))(({ theme }) => ({ border: `1px solid ${theme.palette.divider}`, '&:not(:last-child)': { borderBottom: 0, }, '&:before': { display: 'none', }, })); const AccordionSummary = styled((props) => ( <MuiAccordionSummary expandIcon={<ArrowForwardIosSharpIcon sx={{ fontSize: '0.9rem' }} />} {...props} /> ))(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, .05)' : 'rgba(0, 0, 0, .03)', flexDirection: 'row-reverse', '& .MuiAccordionSummary-expandIconWrapper.Mui-expanded': { transform: 'rotate(90deg)', }, '& .MuiAccordionSummary-content': { marginLeft: theme.spacing(1), }, })); const AccordionDetails = styled(MuiAccordionDetails)(({ theme }) => ({ padding: theme.spacing(2), borderTop: '1px solid rgba(0, 0, 0, .125)', })); export default function CustomizedAccordions() { const [expanded, setExpanded] = React.useState('panel1'); const handleChange = (panel) => (event, newExpanded) => { setExpanded(newExpanded ? panel : false); }; return ( <div> <Accordion expanded={expanded === 'panel1'} onChange={handleChange('panel1')}> <AccordionSummary aria-controls="panel1d-content" id="panel1d-header"> <Typography>Collapsible Group Item #1</Typography> </AccordionSummary> <AccordionDetails> <Typography> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </Typography> </AccordionDetails> </Accordion> <Accordion expanded={expanded === 'panel2'} onChange={handleChange('panel2')}> <AccordionSummary aria-controls="panel2d-content" id="panel2d-header"> <Typography>Collapsible Group Item #2</Typography> </AccordionSummary> <AccordionDetails> <Typography> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </Typography> </AccordionDetails> </Accordion> <Accordion expanded={expanded === 'panel3'} onChange={handleChange('panel3')}> <AccordionSummary aria-controls="panel3d-content" id="panel3d-header"> <Typography>Collapsible Group Item #3</Typography> </AccordionSummary> <AccordionDetails> <Typography> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </Typography> </AccordionDetails> </Accordion> </div> ); }
1,992
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/accordion/CustomizedAccordions.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import ArrowForwardIosSharpIcon from '@mui/icons-material/ArrowForwardIosSharp'; import MuiAccordion, { AccordionProps } from '@mui/material/Accordion'; import MuiAccordionSummary, { AccordionSummaryProps, } from '@mui/material/AccordionSummary'; import MuiAccordionDetails from '@mui/material/AccordionDetails'; import Typography from '@mui/material/Typography'; const Accordion = styled((props: AccordionProps) => ( <MuiAccordion disableGutters elevation={0} square {...props} /> ))(({ theme }) => ({ border: `1px solid ${theme.palette.divider}`, '&:not(:last-child)': { borderBottom: 0, }, '&:before': { display: 'none', }, })); const AccordionSummary = styled((props: AccordionSummaryProps) => ( <MuiAccordionSummary expandIcon={<ArrowForwardIosSharpIcon sx={{ fontSize: '0.9rem' }} />} {...props} /> ))(({ theme }) => ({ backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, .05)' : 'rgba(0, 0, 0, .03)', flexDirection: 'row-reverse', '& .MuiAccordionSummary-expandIconWrapper.Mui-expanded': { transform: 'rotate(90deg)', }, '& .MuiAccordionSummary-content': { marginLeft: theme.spacing(1), }, })); const AccordionDetails = styled(MuiAccordionDetails)(({ theme }) => ({ padding: theme.spacing(2), borderTop: '1px solid rgba(0, 0, 0, .125)', })); export default function CustomizedAccordions() { const [expanded, setExpanded] = React.useState<string | false>('panel1'); const handleChange = (panel: string) => (event: React.SyntheticEvent, newExpanded: boolean) => { setExpanded(newExpanded ? panel : false); }; return ( <div> <Accordion expanded={expanded === 'panel1'} onChange={handleChange('panel1')}> <AccordionSummary aria-controls="panel1d-content" id="panel1d-header"> <Typography>Collapsible Group Item #1</Typography> </AccordionSummary> <AccordionDetails> <Typography> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </Typography> </AccordionDetails> </Accordion> <Accordion expanded={expanded === 'panel2'} onChange={handleChange('panel2')}> <AccordionSummary aria-controls="panel2d-content" id="panel2d-header"> <Typography>Collapsible Group Item #2</Typography> </AccordionSummary> <AccordionDetails> <Typography> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </Typography> </AccordionDetails> </Accordion> <Accordion expanded={expanded === 'panel3'} onChange={handleChange('panel3')}> <AccordionSummary aria-controls="panel3d-content" id="panel3d-header"> <Typography>Collapsible Group Item #3</Typography> </AccordionSummary> <AccordionDetails> <Typography> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </Typography> </AccordionDetails> </Accordion> </div> ); }
1,993
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/accordion/accordion.md
--- productId: material-ui title: React Accordion component components: Accordion, AccordionActions, AccordionDetails, AccordionSummary githubLabel: 'component: accordion' materialDesign: https://m1.material.io/components/expansion-panels.html waiAria: https://www.w3.org/WAI/ARIA/apg/patterns/accordion/ --- # Accordion <p class="description">The accordion component allows the user to show and hide sections of related content on a page.</p> An accordion is a lightweight container that may either be used standalone, or be connected to a larger surface, such as a card. {{"component": "modules/components/ComponentLinkHeader.js"}} :::info This component is no longer documented in the [Material Design guidelines](https://m2.material.io/), but Material UI will continue to support it. ::: ## Basic accordion {{"demo": "BasicAccordion.js", "bg": true}} ## Controlled accordion The Accordion component can be controlled or uncontrolled. :::info - A component is **controlled** when it's managed by its parent using props. - A component is **uncontrolled** when it's managed by its own local state. Learn more about controlled and uncontrolled components in the [React documentation](https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components). ::: {{"demo": "ControlledAccordions.js", "bg": true}} ## Customization Here is an example of customizing the component. You can learn more about this in the [overrides documentation page](/material-ui/customization/how-to-customize/). {{"demo": "CustomizedAccordions.js"}} ## Performance The content of Accordions is mounted by default even if the accordion is not expanded. This default behavior has server-side rendering and SEO in mind. If you render expensive component trees inside your accordion details or simply render many accordions it might be a good idea to change this default behavior by enabling the `unmountOnExit` in `TransitionProps`: ```jsx <Accordion TransitionProps={{ unmountOnExit: true }} /> ``` As with any performance optimization this is not a silver bullet. Be sure to identify bottlenecks first and then try out these optimization strategies. ## Accessibility (WAI-ARIA: https://www.w3.org/WAI/ARIA/apg/patterns/accordion/) For optimal accessibility we recommend setting `id` and `aria-controls` on the `AccordionSummary`. The `Accordion` will derive the necessary `aria-labelledby` and `id` for the content region of the accordion.
1,994
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/ActionAlerts.js
import * as React from 'react'; import Alert from '@mui/material/Alert'; import Button from '@mui/material/Button'; import Stack from '@mui/material/Stack'; export default function ActionAlerts() { return ( <Stack sx={{ width: '100%' }} spacing={2}> <Alert onClose={() => {}}>This is a success alert β€” check it out!</Alert> <Alert action={ <Button color="inherit" size="small"> UNDO </Button> } > This is a success alert β€” check it out! </Alert> </Stack> ); }
1,995
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/ActionAlerts.tsx
import * as React from 'react'; import Alert from '@mui/material/Alert'; import Button from '@mui/material/Button'; import Stack from '@mui/material/Stack'; export default function ActionAlerts() { return ( <Stack sx={{ width: '100%' }} spacing={2}> <Alert onClose={() => {}}>This is a success alert β€” check it out!</Alert> <Alert action={ <Button color="inherit" size="small"> UNDO </Button> } > This is a success alert β€” check it out! </Alert> </Stack> ); }
1,996
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/ActionAlerts.tsx.preview
<Alert onClose={() => {}}>This is a success alert β€” check it out!</Alert> <Alert action={ <Button color="inherit" size="small"> UNDO </Button> } > This is a success alert β€” check it out! </Alert>
1,997
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/BasicAlerts.js
import * as React from 'react'; import Alert from '@mui/material/Alert'; import Stack from '@mui/material/Stack'; export default function BasicAlerts() { return ( <Stack sx={{ width: '100%' }} spacing={2}> <Alert severity="error">This is an error alert β€” check it out!</Alert> <Alert severity="warning">This is a warning alert β€” check it out!</Alert> <Alert severity="info">This is an info alert β€” check it out!</Alert> <Alert severity="success">This is a success alert β€” check it out!</Alert> </Stack> ); }
1,998
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/BasicAlerts.tsx
import * as React from 'react'; import Alert from '@mui/material/Alert'; import Stack from '@mui/material/Stack'; export default function BasicAlerts() { return ( <Stack sx={{ width: '100%' }} spacing={2}> <Alert severity="error">This is an error alert β€” check it out!</Alert> <Alert severity="warning">This is a warning alert β€” check it out!</Alert> <Alert severity="info">This is an info alert β€” check it out!</Alert> <Alert severity="success">This is a success alert β€” check it out!</Alert> </Stack> ); }
1,999