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/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/BasicAlerts.tsx.preview
<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>
2,000
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/ColorAlerts.js
import * as React from 'react'; import Alert from '@mui/material/Alert'; export default function ColorAlerts() { return ( <Alert severity="success" color="info"> This is a success alert — check it out! </Alert> ); }
2,001
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/ColorAlerts.tsx
import * as React from 'react'; import Alert from '@mui/material/Alert'; export default function ColorAlerts() { return ( <Alert severity="success" color="info"> This is a success alert — check it out! </Alert> ); }
2,002
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/ColorAlerts.tsx.preview
<Alert severity="success" color="info"> This is a success alert — check it out! </Alert>
2,003
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/DescriptionAlerts.js
import * as React from 'react'; import Alert from '@mui/material/Alert'; import AlertTitle from '@mui/material/AlertTitle'; import Stack from '@mui/material/Stack'; export default function DescriptionAlerts() { return ( <Stack sx={{ width: '100%' }} spacing={2}> <Alert severity="error"> <AlertTitle>Error</AlertTitle> This is an error alert — <strong>check it out!</strong> </Alert> <Alert severity="warning"> <AlertTitle>Warning</AlertTitle> This is a warning alert — <strong>check it out!</strong> </Alert> <Alert severity="info"> <AlertTitle>Info</AlertTitle> This is an info alert — <strong>check it out!</strong> </Alert> <Alert severity="success"> <AlertTitle>Success</AlertTitle> This is a success alert — <strong>check it out!</strong> </Alert> </Stack> ); }
2,004
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/DescriptionAlerts.tsx
import * as React from 'react'; import Alert from '@mui/material/Alert'; import AlertTitle from '@mui/material/AlertTitle'; import Stack from '@mui/material/Stack'; export default function DescriptionAlerts() { return ( <Stack sx={{ width: '100%' }} spacing={2}> <Alert severity="error"> <AlertTitle>Error</AlertTitle> This is an error alert — <strong>check it out!</strong> </Alert> <Alert severity="warning"> <AlertTitle>Warning</AlertTitle> This is a warning alert — <strong>check it out!</strong> </Alert> <Alert severity="info"> <AlertTitle>Info</AlertTitle> This is an info alert — <strong>check it out!</strong> </Alert> <Alert severity="success"> <AlertTitle>Success</AlertTitle> This is a success alert — <strong>check it out!</strong> </Alert> </Stack> ); }
2,005
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/DescriptionAlerts.tsx.preview
<Alert severity="error"> <AlertTitle>Error</AlertTitle> This is an error alert — <strong>check it out!</strong> </Alert> <Alert severity="warning"> <AlertTitle>Warning</AlertTitle> This is a warning alert — <strong>check it out!</strong> </Alert> <Alert severity="info"> <AlertTitle>Info</AlertTitle> This is an info alert — <strong>check it out!</strong> </Alert> <Alert severity="success"> <AlertTitle>Success</AlertTitle> This is a success alert — <strong>check it out!</strong> </Alert>
2,006
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/FilledAlerts.js
import * as React from 'react'; import Alert from '@mui/material/Alert'; import Stack from '@mui/material/Stack'; export default function FilledAlerts() { return ( <Stack sx={{ width: '100%' }} spacing={2}> <Alert variant="filled" severity="error"> This is an error alert — check it out! </Alert> <Alert variant="filled" severity="warning"> This is a warning alert — check it out! </Alert> <Alert variant="filled" severity="info"> This is an info alert — check it out! </Alert> <Alert variant="filled" severity="success"> This is a success alert — check it out! </Alert> </Stack> ); }
2,007
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/FilledAlerts.tsx
import * as React from 'react'; import Alert from '@mui/material/Alert'; import Stack from '@mui/material/Stack'; export default function FilledAlerts() { return ( <Stack sx={{ width: '100%' }} spacing={2}> <Alert variant="filled" severity="error"> This is an error alert — check it out! </Alert> <Alert variant="filled" severity="warning"> This is a warning alert — check it out! </Alert> <Alert variant="filled" severity="info"> This is an info alert — check it out! </Alert> <Alert variant="filled" severity="success"> This is a success alert — check it out! </Alert> </Stack> ); }
2,008
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/FilledAlerts.tsx.preview
<Alert variant="filled" severity="error"> This is an error alert — check it out! </Alert> <Alert variant="filled" severity="warning"> This is a warning alert — check it out! </Alert> <Alert variant="filled" severity="info"> This is an info alert — check it out! </Alert> <Alert variant="filled" severity="success"> This is a success alert — check it out! </Alert>
2,009
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/IconAlerts.js
import * as React from 'react'; import Alert from '@mui/material/Alert'; import CheckIcon from '@mui/icons-material/Check'; import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'; import Stack from '@mui/material/Stack'; export default function IconAlerts() { return ( <Stack sx={{ width: '100%' }} spacing={2}> <Alert icon={<CheckIcon fontSize="inherit" />} severity="success"> This is a success alert — check it out! </Alert> <Alert iconMapping={{ success: <CheckCircleOutlineIcon fontSize="inherit" />, }} > This is a success alert — check it out! </Alert> <Alert icon={false} severity="success"> This is a success alert — check it out! </Alert> </Stack> ); }
2,010
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/IconAlerts.tsx
import * as React from 'react'; import Alert from '@mui/material/Alert'; import CheckIcon from '@mui/icons-material/Check'; import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'; import Stack from '@mui/material/Stack'; export default function IconAlerts() { return ( <Stack sx={{ width: '100%' }} spacing={2}> <Alert icon={<CheckIcon fontSize="inherit" />} severity="success"> This is a success alert — check it out! </Alert> <Alert iconMapping={{ success: <CheckCircleOutlineIcon fontSize="inherit" />, }} > This is a success alert — check it out! </Alert> <Alert icon={false} severity="success"> This is a success alert — check it out! </Alert> </Stack> ); }
2,011
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/IconAlerts.tsx.preview
<Alert icon={<CheckIcon fontSize="inherit" />} severity="success"> This is a success alert — check it out! </Alert> <Alert iconMapping={{ success: <CheckCircleOutlineIcon fontSize="inherit" />, }} > This is a success alert — check it out! </Alert> <Alert icon={false} severity="success"> This is a success alert — check it out! </Alert>
2,012
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/OutlinedAlerts.js
import * as React from 'react'; import Alert from '@mui/material/Alert'; import Stack from '@mui/material/Stack'; export default function OutlinedAlerts() { return ( <Stack sx={{ width: '100%' }} spacing={2}> <Alert variant="outlined" severity="error"> This is an error alert — check it out! </Alert> <Alert variant="outlined" severity="warning"> This is a warning alert — check it out! </Alert> <Alert variant="outlined" severity="info"> This is an info alert — check it out! </Alert> <Alert variant="outlined" severity="success"> This is a success alert — check it out! </Alert> </Stack> ); }
2,013
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/OutlinedAlerts.tsx
import * as React from 'react'; import Alert from '@mui/material/Alert'; import Stack from '@mui/material/Stack'; export default function OutlinedAlerts() { return ( <Stack sx={{ width: '100%' }} spacing={2}> <Alert variant="outlined" severity="error"> This is an error alert — check it out! </Alert> <Alert variant="outlined" severity="warning"> This is a warning alert — check it out! </Alert> <Alert variant="outlined" severity="info"> This is an info alert — check it out! </Alert> <Alert variant="outlined" severity="success"> This is a success alert — check it out! </Alert> </Stack> ); }
2,014
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/OutlinedAlerts.tsx.preview
<Alert variant="outlined" severity="error"> This is an error alert — check it out! </Alert> <Alert variant="outlined" severity="warning"> This is a warning alert — check it out! </Alert> <Alert variant="outlined" severity="info"> This is an info alert — check it out! </Alert> <Alert variant="outlined" severity="success"> This is a success alert — check it out! </Alert>
2,015
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/TransitionAlerts.js
import * as React from 'react'; import Box from '@mui/material/Box'; import Alert from '@mui/material/Alert'; import IconButton from '@mui/material/IconButton'; import Collapse from '@mui/material/Collapse'; import Button from '@mui/material/Button'; import CloseIcon from '@mui/icons-material/Close'; export default function TransitionAlerts() { const [open, setOpen] = React.useState(true); return ( <Box sx={{ width: '100%' }}> <Collapse in={open}> <Alert action={ <IconButton aria-label="close" color="inherit" size="small" onClick={() => { setOpen(false); }} > <CloseIcon fontSize="inherit" /> </IconButton> } sx={{ mb: 2 }} > Close me! </Alert> </Collapse> <Button disabled={open} variant="outlined" onClick={() => { setOpen(true); }} > Re-open </Button> </Box> ); }
2,016
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/TransitionAlerts.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Alert from '@mui/material/Alert'; import IconButton from '@mui/material/IconButton'; import Collapse from '@mui/material/Collapse'; import Button from '@mui/material/Button'; import CloseIcon from '@mui/icons-material/Close'; export default function TransitionAlerts() { const [open, setOpen] = React.useState(true); return ( <Box sx={{ width: '100%' }}> <Collapse in={open}> <Alert action={ <IconButton aria-label="close" color="inherit" size="small" onClick={() => { setOpen(false); }} > <CloseIcon fontSize="inherit" /> </IconButton> } sx={{ mb: 2 }} > Close me! </Alert> </Collapse> <Button disabled={open} variant="outlined" onClick={() => { setOpen(true); }} > Re-open </Button> </Box> ); }
2,017
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/alert/alert.md
--- productId: material-ui title: React Alert component components: Alert, AlertTitle githubLabel: 'component: alert' waiAria: https://www.w3.org/WAI/ARIA/apg/patterns/alert/ --- # Alert <p class="description">An alert displays a short, important message in a way that attracts the user's attention without interrupting the user's task.</p> :::info This component is not documented in the [Material Design guidelines](https://m2.material.io/), but it is available in Material UI. ::: {{"component": "modules/components/ComponentLinkHeader.js"}} ## Basic alerts The alert offers four severity levels that set a distinctive icon and color. {{"demo": "BasicAlerts.js"}} ## Description You can use the `AlertTitle` component to display a formatted title above the content. {{"demo": "DescriptionAlerts.js"}} ## Actions An alert can have an action, such as a close or undo button. It is rendered after the message, at the end of the alert. If an `onClose` callback is provided and no `action` prop is set, a close icon is displayed. The `action` prop can be used to provide an alternative action, for example using a Button or IconButton. {{"demo": "ActionAlerts.js"}} ### Transition You can use a [transition component](/material-ui/transitions/) such as `Collapse` to transition the appearance of the alert. {{"demo": "TransitionAlerts.js"}} ## Icons The `icon` prop allows you to add an icon to the beginning of the alert component. This will override the default icon for the specified severity. You can change the default severity to icon mapping with the `iconMapping` prop. This can be defined globally using [theme customization](/material-ui/customization/theme-components/#theme-default-props). Setting the icon prop to `false` will remove the icon altogether. {{"demo": "IconAlerts.js"}} ## Variants Two additional variants are available – outlined, and filled: ### Outlined {{"demo": "OutlinedAlerts.js"}} When using an outlined alert with the [`Snackbar` component](/material-ui/react-snackbar/#customization), background content will be visible and bleed through the alert by default. You can prevent this by adding `bgcolor: 'background.paper'` to the[`sx` prop](/material-ui/customization/how-to-customize/#the-sx-prop) on the `Alert` component. ### Filled {{"demo": "FilledAlerts.js"}} ## Toast You can use the Snackbar to [display a toast](/material-ui/react-snackbar/#customization) with the Alert. ## Color The `color` prop will override the default color for the specified severity. {{"demo": "ColorAlerts.js"}} ## Accessibility (WAI-ARIA: https://www.w3.org/WAI/ARIA/apg/patterns/alert/) When the component is dynamically displayed, the content is automatically announced by most screen readers. At this time, screen readers do not inform users of alerts that are present when the page loads. Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (for example the visible text), or is included through alternative means, such as additional hidden text. Actions must have a tab index of 0 so that they can be reached by keyboard-only users.
2,018
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/BackToTop.js
import * as React from 'react'; import PropTypes from 'prop-types'; import AppBar from '@mui/material/AppBar'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import CssBaseline from '@mui/material/CssBaseline'; import useScrollTrigger from '@mui/material/useScrollTrigger'; import Box from '@mui/material/Box'; import Container from '@mui/material/Container'; import Fab from '@mui/material/Fab'; import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp'; import Fade from '@mui/material/Fade'; function ScrollTop(props) { const { children, window } = props; // Note that you normally won't need to set the window ref as useScrollTrigger // will default to window. // This is only being set here because the demo is in an iframe. const trigger = useScrollTrigger({ target: window ? window() : undefined, disableHysteresis: true, threshold: 100, }); const handleClick = (event) => { const anchor = (event.target.ownerDocument || document).querySelector( '#back-to-top-anchor', ); if (anchor) { anchor.scrollIntoView({ block: 'center', }); } }; return ( <Fade in={trigger}> <Box onClick={handleClick} role="presentation" sx={{ position: 'fixed', bottom: 16, right: 16 }} > {children} </Box> </Fade> ); } ScrollTop.propTypes = { children: PropTypes.element.isRequired, /** * Injected by the documentation to work in an iframe. * You won't need it on your project. */ window: PropTypes.func, }; export default function BackToTop(props) { return ( <React.Fragment> <CssBaseline /> <AppBar> <Toolbar> <Typography variant="h6" component="div"> Scroll to see button </Typography> </Toolbar> </AppBar> <Toolbar id="back-to-top-anchor" /> <Container> <Box sx={{ my: 2 }}> {[...new Array(12)] .map( () => `Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.`, ) .join('\n')} </Box> </Container> <ScrollTop {...props}> <Fab size="small" aria-label="scroll back to top"> <KeyboardArrowUpIcon /> </Fab> </ScrollTop> </React.Fragment> ); }
2,019
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/BackToTop.tsx
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import CssBaseline from '@mui/material/CssBaseline'; import useScrollTrigger from '@mui/material/useScrollTrigger'; import Box from '@mui/material/Box'; import Container from '@mui/material/Container'; import Fab from '@mui/material/Fab'; import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp'; import Fade from '@mui/material/Fade'; interface Props { /** * Injected by the documentation to work in an iframe. * You won't need it on your project. */ window?: () => Window; children: React.ReactElement; } function ScrollTop(props: Props) { const { children, window } = props; // Note that you normally won't need to set the window ref as useScrollTrigger // will default to window. // This is only being set here because the demo is in an iframe. const trigger = useScrollTrigger({ target: window ? window() : undefined, disableHysteresis: true, threshold: 100, }); const handleClick = (event: React.MouseEvent<HTMLDivElement>) => { const anchor = ( (event.target as HTMLDivElement).ownerDocument || document ).querySelector('#back-to-top-anchor'); if (anchor) { anchor.scrollIntoView({ block: 'center', }); } }; return ( <Fade in={trigger}> <Box onClick={handleClick} role="presentation" sx={{ position: 'fixed', bottom: 16, right: 16 }} > {children} </Box> </Fade> ); } export default function BackToTop(props: Props) { return ( <React.Fragment> <CssBaseline /> <AppBar> <Toolbar> <Typography variant="h6" component="div"> Scroll to see button </Typography> </Toolbar> </AppBar> <Toolbar id="back-to-top-anchor" /> <Container> <Box sx={{ my: 2 }}> {[...new Array(12)] .map( () => `Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.`, ) .join('\n')} </Box> </Container> <ScrollTop {...props}> <Fab size="small" aria-label="scroll back to top"> <KeyboardArrowUpIcon /> </Fab> </ScrollTop> </React.Fragment> ); }
2,020
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/BottomAppBar.js
import * as React from 'react'; import { styled } from '@mui/material/styles'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import CssBaseline from '@mui/material/CssBaseline'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import IconButton from '@mui/material/IconButton'; import Paper from '@mui/material/Paper'; import Fab from '@mui/material/Fab'; import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import ListItemAvatar from '@mui/material/ListItemAvatar'; import ListItemText from '@mui/material/ListItemText'; import ListSubheader from '@mui/material/ListSubheader'; import Avatar from '@mui/material/Avatar'; import MenuIcon from '@mui/icons-material/Menu'; import AddIcon from '@mui/icons-material/Add'; import SearchIcon from '@mui/icons-material/Search'; import MoreIcon from '@mui/icons-material/MoreVert'; const messages = [ { id: 1, primary: 'Brunch this week?', secondary: "I'll be in the neighbourhood this week. Let's grab a bite to eat", person: '/static/images/avatar/5.jpg', }, { id: 2, primary: 'Birthday Gift', secondary: `Do you have a suggestion for a good present for John on his work anniversary. I am really confused & would love your thoughts on it.`, person: '/static/images/avatar/1.jpg', }, { id: 3, primary: 'Recipe to try', secondary: 'I am try out this new BBQ recipe, I think this might be amazing', person: '/static/images/avatar/2.jpg', }, { id: 4, primary: 'Yes!', secondary: 'I have the tickets to the ReactConf for this year.', person: '/static/images/avatar/3.jpg', }, { id: 5, primary: "Doctor's Appointment", secondary: 'My appointment for the doctor was rescheduled for next Saturday.', person: '/static/images/avatar/4.jpg', }, { id: 6, primary: 'Discussion', secondary: `Menus that are generated by the bottom app bar (such as a bottom navigation drawer or overflow menu) open as bottom sheets at a higher elevation than the bar.`, person: '/static/images/avatar/5.jpg', }, { id: 7, primary: 'Summer BBQ', secondary: `Who wants to have a cookout this weekend? I just got some furniture for my backyard and would love to fire up the grill.`, person: '/static/images/avatar/1.jpg', }, ]; const StyledFab = styled(Fab)({ position: 'absolute', zIndex: 1, top: -30, left: 0, right: 0, margin: '0 auto', }); export default function BottomAppBar() { return ( <React.Fragment> <CssBaseline /> <Paper square sx={{ pb: '50px' }}> <Typography variant="h5" gutterBottom component="div" sx={{ p: 2, pb: 0 }}> Inbox </Typography> <List sx={{ mb: 2 }}> {messages.map(({ id, primary, secondary, person }) => ( <React.Fragment key={id}> {id === 1 && ( <ListSubheader sx={{ bgcolor: 'background.paper' }}> Today </ListSubheader> )} {id === 3 && ( <ListSubheader sx={{ bgcolor: 'background.paper' }}> Yesterday </ListSubheader> )} <ListItem button> <ListItemAvatar> <Avatar alt="Profile Picture" src={person} /> </ListItemAvatar> <ListItemText primary={primary} secondary={secondary} /> </ListItem> </React.Fragment> ))} </List> </Paper> <AppBar position="fixed" color="primary" sx={{ top: 'auto', bottom: 0 }}> <Toolbar> <IconButton color="inherit" aria-label="open drawer"> <MenuIcon /> </IconButton> <StyledFab color="secondary" aria-label="add"> <AddIcon /> </StyledFab> <Box sx={{ flexGrow: 1 }} /> <IconButton color="inherit"> <SearchIcon /> </IconButton> <IconButton color="inherit"> <MoreIcon /> </IconButton> </Toolbar> </AppBar> </React.Fragment> ); }
2,021
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/BottomAppBar.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import CssBaseline from '@mui/material/CssBaseline'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import IconButton from '@mui/material/IconButton'; import Paper from '@mui/material/Paper'; import Fab from '@mui/material/Fab'; import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import ListItemAvatar from '@mui/material/ListItemAvatar'; import ListItemText from '@mui/material/ListItemText'; import ListSubheader from '@mui/material/ListSubheader'; import Avatar from '@mui/material/Avatar'; import MenuIcon from '@mui/icons-material/Menu'; import AddIcon from '@mui/icons-material/Add'; import SearchIcon from '@mui/icons-material/Search'; import MoreIcon from '@mui/icons-material/MoreVert'; const messages = [ { id: 1, primary: 'Brunch this week?', secondary: "I'll be in the neighbourhood this week. Let's grab a bite to eat", person: '/static/images/avatar/5.jpg', }, { id: 2, primary: 'Birthday Gift', secondary: `Do you have a suggestion for a good present for John on his work anniversary. I am really confused & would love your thoughts on it.`, person: '/static/images/avatar/1.jpg', }, { id: 3, primary: 'Recipe to try', secondary: 'I am try out this new BBQ recipe, I think this might be amazing', person: '/static/images/avatar/2.jpg', }, { id: 4, primary: 'Yes!', secondary: 'I have the tickets to the ReactConf for this year.', person: '/static/images/avatar/3.jpg', }, { id: 5, primary: "Doctor's Appointment", secondary: 'My appointment for the doctor was rescheduled for next Saturday.', person: '/static/images/avatar/4.jpg', }, { id: 6, primary: 'Discussion', secondary: `Menus that are generated by the bottom app bar (such as a bottom navigation drawer or overflow menu) open as bottom sheets at a higher elevation than the bar.`, person: '/static/images/avatar/5.jpg', }, { id: 7, primary: 'Summer BBQ', secondary: `Who wants to have a cookout this weekend? I just got some furniture for my backyard and would love to fire up the grill.`, person: '/static/images/avatar/1.jpg', }, ]; const StyledFab = styled(Fab)({ position: 'absolute', zIndex: 1, top: -30, left: 0, right: 0, margin: '0 auto', }); export default function BottomAppBar() { return ( <React.Fragment> <CssBaseline /> <Paper square sx={{ pb: '50px' }}> <Typography variant="h5" gutterBottom component="div" sx={{ p: 2, pb: 0 }}> Inbox </Typography> <List sx={{ mb: 2 }}> {messages.map(({ id, primary, secondary, person }) => ( <React.Fragment key={id}> {id === 1 && ( <ListSubheader sx={{ bgcolor: 'background.paper' }}> Today </ListSubheader> )} {id === 3 && ( <ListSubheader sx={{ bgcolor: 'background.paper' }}> Yesterday </ListSubheader> )} <ListItem button> <ListItemAvatar> <Avatar alt="Profile Picture" src={person} /> </ListItemAvatar> <ListItemText primary={primary} secondary={secondary} /> </ListItem> </React.Fragment> ))} </List> </Paper> <AppBar position="fixed" color="primary" sx={{ top: 'auto', bottom: 0 }}> <Toolbar> <IconButton color="inherit" aria-label="open drawer"> <MenuIcon /> </IconButton> <StyledFab color="secondary" aria-label="add"> <AddIcon /> </StyledFab> <Box sx={{ flexGrow: 1 }} /> <IconButton color="inherit"> <SearchIcon /> </IconButton> <IconButton color="inherit"> <MoreIcon /> </IconButton> </Toolbar> </AppBar> </React.Fragment> ); }
2,022
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/ButtonAppBar.js
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import Button from '@mui/material/Button'; import IconButton from '@mui/material/IconButton'; import MenuIcon from '@mui/icons-material/Menu'; export default function ButtonAppBar() { return ( <Box sx={{ flexGrow: 1 }}> <AppBar position="static"> <Toolbar> <IconButton size="large" edge="start" color="inherit" aria-label="menu" sx={{ mr: 2 }} > <MenuIcon /> </IconButton> <Typography variant="h6" component="div" sx={{ flexGrow: 1 }}> News </Typography> <Button color="inherit">Login</Button> </Toolbar> </AppBar> </Box> ); }
2,023
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/ButtonAppBar.tsx
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import Button from '@mui/material/Button'; import IconButton from '@mui/material/IconButton'; import MenuIcon from '@mui/icons-material/Menu'; export default function ButtonAppBar() { return ( <Box sx={{ flexGrow: 1 }}> <AppBar position="static"> <Toolbar> <IconButton size="large" edge="start" color="inherit" aria-label="menu" sx={{ mr: 2 }} > <MenuIcon /> </IconButton> <Typography variant="h6" component="div" sx={{ flexGrow: 1 }}> News </Typography> <Button color="inherit">Login</Button> </Toolbar> </AppBar> </Box> ); }
2,024
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/DenseAppBar.js
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import IconButton from '@mui/material/IconButton'; import MenuIcon from '@mui/icons-material/Menu'; export default function DenseAppBar() { return ( <Box sx={{ flexGrow: 1 }}> <AppBar position="static"> <Toolbar variant="dense"> <IconButton edge="start" color="inherit" aria-label="menu" sx={{ mr: 2 }}> <MenuIcon /> </IconButton> <Typography variant="h6" color="inherit" component="div"> Photos </Typography> </Toolbar> </AppBar> </Box> ); }
2,025
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/DenseAppBar.tsx
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import IconButton from '@mui/material/IconButton'; import MenuIcon from '@mui/icons-material/Menu'; export default function DenseAppBar() { return ( <Box sx={{ flexGrow: 1 }}> <AppBar position="static"> <Toolbar variant="dense"> <IconButton edge="start" color="inherit" aria-label="menu" sx={{ mr: 2 }}> <MenuIcon /> </IconButton> <Typography variant="h6" color="inherit" component="div"> Photos </Typography> </Toolbar> </AppBar> </Box> ); }
2,026
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/DenseAppBar.tsx.preview
<AppBar position="static"> <Toolbar variant="dense"> <IconButton edge="start" color="inherit" aria-label="menu" sx={{ mr: 2 }}> <MenuIcon /> </IconButton> <Typography variant="h6" color="inherit" component="div"> Photos </Typography> </Toolbar> </AppBar>
2,027
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/DrawerAppBar.js
import * as React from 'react'; import PropTypes from 'prop-types'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import CssBaseline from '@mui/material/CssBaseline'; import Divider from '@mui/material/Divider'; import Drawer from '@mui/material/Drawer'; import IconButton from '@mui/material/IconButton'; import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import ListItemButton from '@mui/material/ListItemButton'; import ListItemText from '@mui/material/ListItemText'; import MenuIcon from '@mui/icons-material/Menu'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import Button from '@mui/material/Button'; const drawerWidth = 240; const navItems = ['Home', 'About', 'Contact']; function DrawerAppBar(props) { const { window } = props; const [mobileOpen, setMobileOpen] = React.useState(false); const handleDrawerToggle = () => { setMobileOpen((prevState) => !prevState); }; const drawer = ( <Box onClick={handleDrawerToggle} sx={{ textAlign: 'center' }}> <Typography variant="h6" sx={{ my: 2 }}> MUI </Typography> <Divider /> <List> {navItems.map((item) => ( <ListItem key={item} disablePadding> <ListItemButton sx={{ textAlign: 'center' }}> <ListItemText primary={item} /> </ListItemButton> </ListItem> ))} </List> </Box> ); const container = window !== undefined ? () => window().document.body : undefined; return ( <Box sx={{ display: 'flex' }}> <CssBaseline /> <AppBar component="nav"> <Toolbar> <IconButton color="inherit" aria-label="open drawer" edge="start" onClick={handleDrawerToggle} sx={{ mr: 2, display: { sm: 'none' } }} > <MenuIcon /> </IconButton> <Typography variant="h6" component="div" sx={{ flexGrow: 1, display: { xs: 'none', sm: 'block' } }} > MUI </Typography> <Box sx={{ display: { xs: 'none', sm: 'block' } }}> {navItems.map((item) => ( <Button key={item} sx={{ color: '#fff' }}> {item} </Button> ))} </Box> </Toolbar> </AppBar> <nav> <Drawer container={container} variant="temporary" open={mobileOpen} onClose={handleDrawerToggle} ModalProps={{ keepMounted: true, // Better open performance on mobile. }} sx={{ display: { xs: 'block', sm: 'none' }, '& .MuiDrawer-paper': { boxSizing: 'border-box', width: drawerWidth }, }} > {drawer} </Drawer> </nav> <Box component="main" sx={{ p: 3 }}> <Toolbar /> <Typography> Lorem ipsum dolor sit amet consectetur adipisicing elit. Similique unde fugit veniam eius, perspiciatis sunt? Corporis qui ducimus quibusdam, aliquam dolore excepturi quae. Distinctio enim at eligendi perferendis in cum quibusdam sed quae, accusantium et aperiam? Quod itaque exercitationem, at ab sequi qui modi delectus quia corrupti alias distinctio nostrum. Minima ex dolor modi inventore sapiente necessitatibus aliquam fuga et. Sed numquam quibusdam at officia sapiente porro maxime corrupti perspiciatis asperiores, exercitationem eius nostrum consequuntur iure aliquam itaque, assumenda et! Quibusdam temporibus beatae doloremque voluptatum doloribus soluta accusamus porro reprehenderit eos inventore facere, fugit, molestiae ab officiis illo voluptates recusandae. Vel dolor nobis eius, ratione atque soluta, aliquam fugit qui iste architecto perspiciatis. Nobis, voluptatem! Cumque, eligendi unde aliquid minus quis sit debitis obcaecati error, delectus quo eius exercitationem tempore. Delectus sapiente, provident corporis dolorum quibusdam aut beatae repellendus est labore quisquam praesentium repudiandae non vel laboriosam quo ab perferendis velit ipsa deleniti modi! Ipsam, illo quod. Nesciunt commodi nihil corrupti cum non fugiat praesentium doloremque architecto laborum aliquid. Quae, maxime recusandae? Eveniet dolore molestiae dicta blanditiis est expedita eius debitis cupiditate porro sed aspernatur quidem, repellat nihil quasi praesentium quia eos, quibusdam provident. Incidunt tempore vel placeat voluptate iure labore, repellendus beatae quia unde est aliquid dolor molestias libero. Reiciendis similique exercitationem consequatur, nobis placeat illo laudantium! Enim perferendis nulla soluta magni error, provident repellat similique cupiditate ipsam, et tempore cumque quod! Qui, iure suscipit tempora unde rerum autem saepe nisi vel cupiditate iusto. Illum, corrupti? Fugiat quidem accusantium nulla. Aliquid inventore commodi reprehenderit rerum reiciendis! Quidem alias repudiandae eaque eveniet cumque nihil aliquam in expedita, impedit quas ipsum nesciunt ipsa ullam consequuntur dignissimos numquam at nisi porro a, quaerat rem repellendus. Voluptates perspiciatis, in pariatur impedit, nam facilis libero dolorem dolores sunt inventore perferendis, aut sapiente modi nesciunt. </Typography> </Box> </Box> ); } DrawerAppBar.propTypes = { /** * Injected by the documentation to work in an iframe. * You won't need it on your project. */ window: PropTypes.func, }; export default DrawerAppBar;
2,028
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/DrawerAppBar.tsx
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import CssBaseline from '@mui/material/CssBaseline'; import Divider from '@mui/material/Divider'; import Drawer from '@mui/material/Drawer'; import IconButton from '@mui/material/IconButton'; import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import ListItemButton from '@mui/material/ListItemButton'; import ListItemText from '@mui/material/ListItemText'; import MenuIcon from '@mui/icons-material/Menu'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import Button from '@mui/material/Button'; interface Props { /** * Injected by the documentation to work in an iframe. * You won't need it on your project. */ window?: () => Window; } const drawerWidth = 240; const navItems = ['Home', 'About', 'Contact']; export default function DrawerAppBar(props: Props) { const { window } = props; const [mobileOpen, setMobileOpen] = React.useState(false); const handleDrawerToggle = () => { setMobileOpen((prevState) => !prevState); }; const drawer = ( <Box onClick={handleDrawerToggle} sx={{ textAlign: 'center' }}> <Typography variant="h6" sx={{ my: 2 }}> MUI </Typography> <Divider /> <List> {navItems.map((item) => ( <ListItem key={item} disablePadding> <ListItemButton sx={{ textAlign: 'center' }}> <ListItemText primary={item} /> </ListItemButton> </ListItem> ))} </List> </Box> ); const container = window !== undefined ? () => window().document.body : undefined; return ( <Box sx={{ display: 'flex' }}> <CssBaseline /> <AppBar component="nav"> <Toolbar> <IconButton color="inherit" aria-label="open drawer" edge="start" onClick={handleDrawerToggle} sx={{ mr: 2, display: { sm: 'none' } }} > <MenuIcon /> </IconButton> <Typography variant="h6" component="div" sx={{ flexGrow: 1, display: { xs: 'none', sm: 'block' } }} > MUI </Typography> <Box sx={{ display: { xs: 'none', sm: 'block' } }}> {navItems.map((item) => ( <Button key={item} sx={{ color: '#fff' }}> {item} </Button> ))} </Box> </Toolbar> </AppBar> <nav> <Drawer container={container} variant="temporary" open={mobileOpen} onClose={handleDrawerToggle} ModalProps={{ keepMounted: true, // Better open performance on mobile. }} sx={{ display: { xs: 'block', sm: 'none' }, '& .MuiDrawer-paper': { boxSizing: 'border-box', width: drawerWidth }, }} > {drawer} </Drawer> </nav> <Box component="main" sx={{ p: 3 }}> <Toolbar /> <Typography> Lorem ipsum dolor sit amet consectetur adipisicing elit. Similique unde fugit veniam eius, perspiciatis sunt? Corporis qui ducimus quibusdam, aliquam dolore excepturi quae. Distinctio enim at eligendi perferendis in cum quibusdam sed quae, accusantium et aperiam? Quod itaque exercitationem, at ab sequi qui modi delectus quia corrupti alias distinctio nostrum. Minima ex dolor modi inventore sapiente necessitatibus aliquam fuga et. Sed numquam quibusdam at officia sapiente porro maxime corrupti perspiciatis asperiores, exercitationem eius nostrum consequuntur iure aliquam itaque, assumenda et! Quibusdam temporibus beatae doloremque voluptatum doloribus soluta accusamus porro reprehenderit eos inventore facere, fugit, molestiae ab officiis illo voluptates recusandae. Vel dolor nobis eius, ratione atque soluta, aliquam fugit qui iste architecto perspiciatis. Nobis, voluptatem! Cumque, eligendi unde aliquid minus quis sit debitis obcaecati error, delectus quo eius exercitationem tempore. Delectus sapiente, provident corporis dolorum quibusdam aut beatae repellendus est labore quisquam praesentium repudiandae non vel laboriosam quo ab perferendis velit ipsa deleniti modi! Ipsam, illo quod. Nesciunt commodi nihil corrupti cum non fugiat praesentium doloremque architecto laborum aliquid. Quae, maxime recusandae? Eveniet dolore molestiae dicta blanditiis est expedita eius debitis cupiditate porro sed aspernatur quidem, repellat nihil quasi praesentium quia eos, quibusdam provident. Incidunt tempore vel placeat voluptate iure labore, repellendus beatae quia unde est aliquid dolor molestias libero. Reiciendis similique exercitationem consequatur, nobis placeat illo laudantium! Enim perferendis nulla soluta magni error, provident repellat similique cupiditate ipsam, et tempore cumque quod! Qui, iure suscipit tempora unde rerum autem saepe nisi vel cupiditate iusto. Illum, corrupti? Fugiat quidem accusantium nulla. Aliquid inventore commodi reprehenderit rerum reiciendis! Quidem alias repudiandae eaque eveniet cumque nihil aliquam in expedita, impedit quas ipsum nesciunt ipsa ullam consequuntur dignissimos numquam at nisi porro a, quaerat rem repellendus. Voluptates perspiciatis, in pariatur impedit, nam facilis libero dolorem dolores sunt inventore perferendis, aut sapiente modi nesciunt. </Typography> </Box> </Box> ); }
2,029
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/ElevateAppBar.js
import * as React from 'react'; import PropTypes from 'prop-types'; import AppBar from '@mui/material/AppBar'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import CssBaseline from '@mui/material/CssBaseline'; import useScrollTrigger from '@mui/material/useScrollTrigger'; import Box from '@mui/material/Box'; import Container from '@mui/material/Container'; function ElevationScroll(props) { const { children, window } = props; // Note that you normally won't need to set the window ref as useScrollTrigger // will default to window. // This is only being set here because the demo is in an iframe. const trigger = useScrollTrigger({ disableHysteresis: true, threshold: 0, target: window ? window() : undefined, }); return React.cloneElement(children, { elevation: trigger ? 4 : 0, }); } ElevationScroll.propTypes = { children: PropTypes.element.isRequired, /** * Injected by the documentation to work in an iframe. * You won't need it on your project. */ window: PropTypes.func, }; export default function ElevateAppBar(props) { return ( <React.Fragment> <CssBaseline /> <ElevationScroll {...props}> <AppBar> <Toolbar> <Typography variant="h6" component="div"> Scroll to elevate App bar </Typography> </Toolbar> </AppBar> </ElevationScroll> <Toolbar /> <Container> <Box sx={{ my: 2 }}> {[...new Array(12)] .map( () => `Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.`, ) .join('\n')} </Box> </Container> </React.Fragment> ); }
2,030
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/ElevateAppBar.tsx
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import CssBaseline from '@mui/material/CssBaseline'; import useScrollTrigger from '@mui/material/useScrollTrigger'; import Box from '@mui/material/Box'; import Container from '@mui/material/Container'; interface Props { /** * Injected by the documentation to work in an iframe. * You won't need it on your project. */ window?: () => Window; children: React.ReactElement; } function ElevationScroll(props: Props) { const { children, window } = props; // Note that you normally won't need to set the window ref as useScrollTrigger // will default to window. // This is only being set here because the demo is in an iframe. const trigger = useScrollTrigger({ disableHysteresis: true, threshold: 0, target: window ? window() : undefined, }); return React.cloneElement(children, { elevation: trigger ? 4 : 0, }); } export default function ElevateAppBar(props: Props) { return ( <React.Fragment> <CssBaseline /> <ElevationScroll {...props}> <AppBar> <Toolbar> <Typography variant="h6" component="div"> Scroll to elevate App bar </Typography> </Toolbar> </AppBar> </ElevationScroll> <Toolbar /> <Container> <Box sx={{ my: 2 }}> {[...new Array(12)] .map( () => `Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.`, ) .join('\n')} </Box> </Container> </React.Fragment> ); }
2,031
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/EnableColorOnDarkAppBar.js
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Stack from '@mui/material/Stack'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import IconButton from '@mui/material/IconButton'; import MenuIcon from '@mui/icons-material/Menu'; import { ThemeProvider, createTheme } from '@mui/material/styles'; function appBarLabel(label) { return ( <Toolbar> <IconButton edge="start" color="inherit" aria-label="menu" sx={{ mr: 2 }}> <MenuIcon /> </IconButton> <Typography variant="h6" noWrap component="div" sx={{ flexGrow: 1 }}> {label} </Typography> </Toolbar> ); } const darkTheme = createTheme({ palette: { mode: 'dark', primary: { main: '#1976d2', }, }, }); export default function EnableColorOnDarkAppBar() { return ( <Stack spacing={2} sx={{ flexGrow: 1 }}> <ThemeProvider theme={darkTheme}> <AppBar position="static" color="primary" enableColorOnDark> {appBarLabel('enableColorOnDark')} </AppBar> <AppBar position="static" color="primary"> {appBarLabel('default')} </AppBar> </ThemeProvider> </Stack> ); }
2,032
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/EnableColorOnDarkAppBar.tsx
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Stack from '@mui/material/Stack'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import IconButton from '@mui/material/IconButton'; import MenuIcon from '@mui/icons-material/Menu'; import { ThemeProvider, createTheme } from '@mui/material/styles'; function appBarLabel(label: string) { return ( <Toolbar> <IconButton edge="start" color="inherit" aria-label="menu" sx={{ mr: 2 }}> <MenuIcon /> </IconButton> <Typography variant="h6" noWrap component="div" sx={{ flexGrow: 1 }}> {label} </Typography> </Toolbar> ); } const darkTheme = createTheme({ palette: { mode: 'dark', primary: { main: '#1976d2', }, }, }); export default function EnableColorOnDarkAppBar() { return ( <Stack spacing={2} sx={{ flexGrow: 1 }}> <ThemeProvider theme={darkTheme}> <AppBar position="static" color="primary" enableColorOnDark> {appBarLabel('enableColorOnDark')} </AppBar> <AppBar position="static" color="primary"> {appBarLabel('default')} </AppBar> </ThemeProvider> </Stack> ); }
2,033
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/EnableColorOnDarkAppBar.tsx.preview
<ThemeProvider theme={darkTheme}> <AppBar position="static" color="primary" enableColorOnDark> {appBarLabel('enableColorOnDark')} </AppBar> <AppBar position="static" color="primary"> {appBarLabel('default')} </AppBar> </ThemeProvider>
2,034
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/HideAppBar.js
import * as React from 'react'; import PropTypes from 'prop-types'; import AppBar from '@mui/material/AppBar'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import CssBaseline from '@mui/material/CssBaseline'; import useScrollTrigger from '@mui/material/useScrollTrigger'; import Box from '@mui/material/Box'; import Container from '@mui/material/Container'; import Slide from '@mui/material/Slide'; function HideOnScroll(props) { const { children, window } = props; // Note that you normally won't need to set the window ref as useScrollTrigger // will default to window. // This is only being set here because the demo is in an iframe. const trigger = useScrollTrigger({ target: window ? window() : undefined, }); return ( <Slide appear={false} direction="down" in={!trigger}> {children} </Slide> ); } HideOnScroll.propTypes = { children: PropTypes.element.isRequired, /** * Injected by the documentation to work in an iframe. * You won't need it on your project. */ window: PropTypes.func, }; export default function HideAppBar(props) { return ( <React.Fragment> <CssBaseline /> <HideOnScroll {...props}> <AppBar> <Toolbar> <Typography variant="h6" component="div"> Scroll to hide App bar </Typography> </Toolbar> </AppBar> </HideOnScroll> <Toolbar /> <Container> <Box sx={{ my: 2 }}> {[...new Array(12)] .map( () => `Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.`, ) .join('\n')} </Box> </Container> </React.Fragment> ); }
2,035
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/HideAppBar.tsx
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import CssBaseline from '@mui/material/CssBaseline'; import useScrollTrigger from '@mui/material/useScrollTrigger'; import Box from '@mui/material/Box'; import Container from '@mui/material/Container'; import Slide from '@mui/material/Slide'; interface Props { /** * Injected by the documentation to work in an iframe. * You won't need it on your project. */ window?: () => Window; children: React.ReactElement; } function HideOnScroll(props: Props) { const { children, window } = props; // Note that you normally won't need to set the window ref as useScrollTrigger // will default to window. // This is only being set here because the demo is in an iframe. const trigger = useScrollTrigger({ target: window ? window() : undefined, }); return ( <Slide appear={false} direction="down" in={!trigger}> {children} </Slide> ); } export default function HideAppBar(props: Props) { return ( <React.Fragment> <CssBaseline /> <HideOnScroll {...props}> <AppBar> <Toolbar> <Typography variant="h6" component="div"> Scroll to hide App bar </Typography> </Toolbar> </AppBar> </HideOnScroll> <Toolbar /> <Container> <Box sx={{ my: 2 }}> {[...new Array(12)] .map( () => `Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.`, ) .join('\n')} </Box> </Container> </React.Fragment> ); }
2,036
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/MenuAppBar.js
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import IconButton from '@mui/material/IconButton'; import MenuIcon from '@mui/icons-material/Menu'; import AccountCircle from '@mui/icons-material/AccountCircle'; import Switch from '@mui/material/Switch'; import FormControlLabel from '@mui/material/FormControlLabel'; import FormGroup from '@mui/material/FormGroup'; import MenuItem from '@mui/material/MenuItem'; import Menu from '@mui/material/Menu'; export default function MenuAppBar() { const [auth, setAuth] = React.useState(true); const [anchorEl, setAnchorEl] = React.useState(null); const handleChange = (event) => { setAuth(event.target.checked); }; const handleMenu = (event) => { setAnchorEl(event.currentTarget); }; const handleClose = () => { setAnchorEl(null); }; return ( <Box sx={{ flexGrow: 1 }}> <FormGroup> <FormControlLabel control={ <Switch checked={auth} onChange={handleChange} aria-label="login switch" /> } label={auth ? 'Logout' : 'Login'} /> </FormGroup> <AppBar position="static"> <Toolbar> <IconButton size="large" edge="start" color="inherit" aria-label="menu" sx={{ mr: 2 }} > <MenuIcon /> </IconButton> <Typography variant="h6" component="div" sx={{ flexGrow: 1 }}> Photos </Typography> {auth && ( <div> <IconButton size="large" aria-label="account of current user" aria-controls="menu-appbar" aria-haspopup="true" onClick={handleMenu} color="inherit" > <AccountCircle /> </IconButton> <Menu id="menu-appbar" anchorEl={anchorEl} anchorOrigin={{ vertical: 'top', horizontal: 'right', }} keepMounted transformOrigin={{ vertical: 'top', horizontal: 'right', }} open={Boolean(anchorEl)} onClose={handleClose} > <MenuItem onClick={handleClose}>Profile</MenuItem> <MenuItem onClick={handleClose}>My account</MenuItem> </Menu> </div> )} </Toolbar> </AppBar> </Box> ); }
2,037
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/MenuAppBar.tsx
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import IconButton from '@mui/material/IconButton'; import MenuIcon from '@mui/icons-material/Menu'; import AccountCircle from '@mui/icons-material/AccountCircle'; import Switch from '@mui/material/Switch'; import FormControlLabel from '@mui/material/FormControlLabel'; import FormGroup from '@mui/material/FormGroup'; import MenuItem from '@mui/material/MenuItem'; import Menu from '@mui/material/Menu'; export default function MenuAppBar() { const [auth, setAuth] = React.useState(true); const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null); const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { setAuth(event.target.checked); }; const handleMenu = (event: React.MouseEvent<HTMLElement>) => { setAnchorEl(event.currentTarget); }; const handleClose = () => { setAnchorEl(null); }; return ( <Box sx={{ flexGrow: 1 }}> <FormGroup> <FormControlLabel control={ <Switch checked={auth} onChange={handleChange} aria-label="login switch" /> } label={auth ? 'Logout' : 'Login'} /> </FormGroup> <AppBar position="static"> <Toolbar> <IconButton size="large" edge="start" color="inherit" aria-label="menu" sx={{ mr: 2 }} > <MenuIcon /> </IconButton> <Typography variant="h6" component="div" sx={{ flexGrow: 1 }}> Photos </Typography> {auth && ( <div> <IconButton size="large" aria-label="account of current user" aria-controls="menu-appbar" aria-haspopup="true" onClick={handleMenu} color="inherit" > <AccountCircle /> </IconButton> <Menu id="menu-appbar" anchorEl={anchorEl} anchorOrigin={{ vertical: 'top', horizontal: 'right', }} keepMounted transformOrigin={{ vertical: 'top', horizontal: 'right', }} open={Boolean(anchorEl)} onClose={handleClose} > <MenuItem onClick={handleClose}>Profile</MenuItem> <MenuItem onClick={handleClose}>My account</MenuItem> </Menu> </div> )} </Toolbar> </AppBar> </Box> ); }
2,038
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/PrimarySearchAppBar.js
import * as React from 'react'; import { styled, alpha } from '@mui/material/styles'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import InputBase from '@mui/material/InputBase'; import Badge from '@mui/material/Badge'; import MenuItem from '@mui/material/MenuItem'; import Menu from '@mui/material/Menu'; import MenuIcon from '@mui/icons-material/Menu'; import SearchIcon from '@mui/icons-material/Search'; import AccountCircle from '@mui/icons-material/AccountCircle'; import MailIcon from '@mui/icons-material/Mail'; import NotificationsIcon from '@mui/icons-material/Notifications'; import MoreIcon from '@mui/icons-material/MoreVert'; const Search = styled('div')(({ theme }) => ({ position: 'relative', borderRadius: theme.shape.borderRadius, backgroundColor: alpha(theme.palette.common.white, 0.15), '&:hover': { backgroundColor: alpha(theme.palette.common.white, 0.25), }, marginRight: theme.spacing(2), marginLeft: 0, width: '100%', [theme.breakpoints.up('sm')]: { marginLeft: theme.spacing(3), width: 'auto', }, })); const SearchIconWrapper = styled('div')(({ theme }) => ({ padding: theme.spacing(0, 2), height: '100%', position: 'absolute', pointerEvents: 'none', display: 'flex', alignItems: 'center', justifyContent: 'center', })); const StyledInputBase = styled(InputBase)(({ theme }) => ({ color: 'inherit', '& .MuiInputBase-input': { padding: theme.spacing(1, 1, 1, 0), // vertical padding + font size from searchIcon paddingLeft: `calc(1em + ${theme.spacing(4)})`, transition: theme.transitions.create('width'), width: '100%', [theme.breakpoints.up('md')]: { width: '20ch', }, }, })); export default function PrimarySearchAppBar() { const [anchorEl, setAnchorEl] = React.useState(null); const [mobileMoreAnchorEl, setMobileMoreAnchorEl] = React.useState(null); const isMenuOpen = Boolean(anchorEl); const isMobileMenuOpen = Boolean(mobileMoreAnchorEl); const handleProfileMenuOpen = (event) => { setAnchorEl(event.currentTarget); }; const handleMobileMenuClose = () => { setMobileMoreAnchorEl(null); }; const handleMenuClose = () => { setAnchorEl(null); handleMobileMenuClose(); }; const handleMobileMenuOpen = (event) => { setMobileMoreAnchorEl(event.currentTarget); }; const menuId = 'primary-search-account-menu'; const renderMenu = ( <Menu anchorEl={anchorEl} anchorOrigin={{ vertical: 'top', horizontal: 'right', }} id={menuId} keepMounted transformOrigin={{ vertical: 'top', horizontal: 'right', }} open={isMenuOpen} onClose={handleMenuClose} > <MenuItem onClick={handleMenuClose}>Profile</MenuItem> <MenuItem onClick={handleMenuClose}>My account</MenuItem> </Menu> ); const mobileMenuId = 'primary-search-account-menu-mobile'; const renderMobileMenu = ( <Menu anchorEl={mobileMoreAnchorEl} anchorOrigin={{ vertical: 'top', horizontal: 'right', }} id={mobileMenuId} keepMounted transformOrigin={{ vertical: 'top', horizontal: 'right', }} open={isMobileMenuOpen} onClose={handleMobileMenuClose} > <MenuItem> <IconButton size="large" aria-label="show 4 new mails" color="inherit"> <Badge badgeContent={4} color="error"> <MailIcon /> </Badge> </IconButton> <p>Messages</p> </MenuItem> <MenuItem> <IconButton size="large" aria-label="show 17 new notifications" color="inherit" > <Badge badgeContent={17} color="error"> <NotificationsIcon /> </Badge> </IconButton> <p>Notifications</p> </MenuItem> <MenuItem onClick={handleProfileMenuOpen}> <IconButton size="large" aria-label="account of current user" aria-controls="primary-search-account-menu" aria-haspopup="true" color="inherit" > <AccountCircle /> </IconButton> <p>Profile</p> </MenuItem> </Menu> ); return ( <Box sx={{ flexGrow: 1 }}> <AppBar position="static"> <Toolbar> <IconButton size="large" edge="start" color="inherit" aria-label="open drawer" sx={{ mr: 2 }} > <MenuIcon /> </IconButton> <Typography variant="h6" noWrap component="div" sx={{ display: { xs: 'none', sm: 'block' } }} > MUI </Typography> <Search> <SearchIconWrapper> <SearchIcon /> </SearchIconWrapper> <StyledInputBase placeholder="Search…" inputProps={{ 'aria-label': 'search' }} /> </Search> <Box sx={{ flexGrow: 1 }} /> <Box sx={{ display: { xs: 'none', md: 'flex' } }}> <IconButton size="large" aria-label="show 4 new mails" color="inherit"> <Badge badgeContent={4} color="error"> <MailIcon /> </Badge> </IconButton> <IconButton size="large" aria-label="show 17 new notifications" color="inherit" > <Badge badgeContent={17} color="error"> <NotificationsIcon /> </Badge> </IconButton> <IconButton size="large" edge="end" aria-label="account of current user" aria-controls={menuId} aria-haspopup="true" onClick={handleProfileMenuOpen} color="inherit" > <AccountCircle /> </IconButton> </Box> <Box sx={{ display: { xs: 'flex', md: 'none' } }}> <IconButton size="large" aria-label="show more" aria-controls={mobileMenuId} aria-haspopup="true" onClick={handleMobileMenuOpen} color="inherit" > <MoreIcon /> </IconButton> </Box> </Toolbar> </AppBar> {renderMobileMenu} {renderMenu} </Box> ); }
2,039
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/PrimarySearchAppBar.tsx
import * as React from 'react'; import { styled, alpha } from '@mui/material/styles'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import InputBase from '@mui/material/InputBase'; import Badge from '@mui/material/Badge'; import MenuItem from '@mui/material/MenuItem'; import Menu from '@mui/material/Menu'; import MenuIcon from '@mui/icons-material/Menu'; import SearchIcon from '@mui/icons-material/Search'; import AccountCircle from '@mui/icons-material/AccountCircle'; import MailIcon from '@mui/icons-material/Mail'; import NotificationsIcon from '@mui/icons-material/Notifications'; import MoreIcon from '@mui/icons-material/MoreVert'; const Search = styled('div')(({ theme }) => ({ position: 'relative', borderRadius: theme.shape.borderRadius, backgroundColor: alpha(theme.palette.common.white, 0.15), '&:hover': { backgroundColor: alpha(theme.palette.common.white, 0.25), }, marginRight: theme.spacing(2), marginLeft: 0, width: '100%', [theme.breakpoints.up('sm')]: { marginLeft: theme.spacing(3), width: 'auto', }, })); const SearchIconWrapper = styled('div')(({ theme }) => ({ padding: theme.spacing(0, 2), height: '100%', position: 'absolute', pointerEvents: 'none', display: 'flex', alignItems: 'center', justifyContent: 'center', })); const StyledInputBase = styled(InputBase)(({ theme }) => ({ color: 'inherit', '& .MuiInputBase-input': { padding: theme.spacing(1, 1, 1, 0), // vertical padding + font size from searchIcon paddingLeft: `calc(1em + ${theme.spacing(4)})`, transition: theme.transitions.create('width'), width: '100%', [theme.breakpoints.up('md')]: { width: '20ch', }, }, })); export default function PrimarySearchAppBar() { const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null); const [mobileMoreAnchorEl, setMobileMoreAnchorEl] = React.useState<null | HTMLElement>(null); const isMenuOpen = Boolean(anchorEl); const isMobileMenuOpen = Boolean(mobileMoreAnchorEl); const handleProfileMenuOpen = (event: React.MouseEvent<HTMLElement>) => { setAnchorEl(event.currentTarget); }; const handleMobileMenuClose = () => { setMobileMoreAnchorEl(null); }; const handleMenuClose = () => { setAnchorEl(null); handleMobileMenuClose(); }; const handleMobileMenuOpen = (event: React.MouseEvent<HTMLElement>) => { setMobileMoreAnchorEl(event.currentTarget); }; const menuId = 'primary-search-account-menu'; const renderMenu = ( <Menu anchorEl={anchorEl} anchorOrigin={{ vertical: 'top', horizontal: 'right', }} id={menuId} keepMounted transformOrigin={{ vertical: 'top', horizontal: 'right', }} open={isMenuOpen} onClose={handleMenuClose} > <MenuItem onClick={handleMenuClose}>Profile</MenuItem> <MenuItem onClick={handleMenuClose}>My account</MenuItem> </Menu> ); const mobileMenuId = 'primary-search-account-menu-mobile'; const renderMobileMenu = ( <Menu anchorEl={mobileMoreAnchorEl} anchorOrigin={{ vertical: 'top', horizontal: 'right', }} id={mobileMenuId} keepMounted transformOrigin={{ vertical: 'top', horizontal: 'right', }} open={isMobileMenuOpen} onClose={handleMobileMenuClose} > <MenuItem> <IconButton size="large" aria-label="show 4 new mails" color="inherit"> <Badge badgeContent={4} color="error"> <MailIcon /> </Badge> </IconButton> <p>Messages</p> </MenuItem> <MenuItem> <IconButton size="large" aria-label="show 17 new notifications" color="inherit" > <Badge badgeContent={17} color="error"> <NotificationsIcon /> </Badge> </IconButton> <p>Notifications</p> </MenuItem> <MenuItem onClick={handleProfileMenuOpen}> <IconButton size="large" aria-label="account of current user" aria-controls="primary-search-account-menu" aria-haspopup="true" color="inherit" > <AccountCircle /> </IconButton> <p>Profile</p> </MenuItem> </Menu> ); return ( <Box sx={{ flexGrow: 1 }}> <AppBar position="static"> <Toolbar> <IconButton size="large" edge="start" color="inherit" aria-label="open drawer" sx={{ mr: 2 }} > <MenuIcon /> </IconButton> <Typography variant="h6" noWrap component="div" sx={{ display: { xs: 'none', sm: 'block' } }} > MUI </Typography> <Search> <SearchIconWrapper> <SearchIcon /> </SearchIconWrapper> <StyledInputBase placeholder="Search…" inputProps={{ 'aria-label': 'search' }} /> </Search> <Box sx={{ flexGrow: 1 }} /> <Box sx={{ display: { xs: 'none', md: 'flex' } }}> <IconButton size="large" aria-label="show 4 new mails" color="inherit"> <Badge badgeContent={4} color="error"> <MailIcon /> </Badge> </IconButton> <IconButton size="large" aria-label="show 17 new notifications" color="inherit" > <Badge badgeContent={17} color="error"> <NotificationsIcon /> </Badge> </IconButton> <IconButton size="large" edge="end" aria-label="account of current user" aria-controls={menuId} aria-haspopup="true" onClick={handleProfileMenuOpen} color="inherit" > <AccountCircle /> </IconButton> </Box> <Box sx={{ display: { xs: 'flex', md: 'none' } }}> <IconButton size="large" aria-label="show more" aria-controls={mobileMenuId} aria-haspopup="true" onClick={handleMobileMenuOpen} color="inherit" > <MoreIcon /> </IconButton> </Box> </Toolbar> </AppBar> {renderMobileMenu} {renderMenu} </Box> ); }
2,040
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/ProminentAppBar.js
import * as React from 'react'; import { styled } from '@mui/material/styles'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import MenuIcon from '@mui/icons-material/Menu'; import SearchIcon from '@mui/icons-material/Search'; import MoreIcon from '@mui/icons-material/MoreVert'; const StyledToolbar = styled(Toolbar)(({ theme }) => ({ alignItems: 'flex-start', paddingTop: theme.spacing(1), paddingBottom: theme.spacing(2), // Override media queries injected by theme.mixins.toolbar '@media all': { minHeight: 128, }, })); export default function ProminentAppBar() { return ( <Box sx={{ flexGrow: 1 }}> <AppBar position="static"> <StyledToolbar> <IconButton size="large" edge="start" color="inherit" aria-label="open drawer" sx={{ mr: 2 }} > <MenuIcon /> </IconButton> <Typography variant="h5" noWrap component="div" sx={{ flexGrow: 1, alignSelf: 'flex-end' }} > MUI </Typography> <IconButton size="large" aria-label="search" color="inherit"> <SearchIcon /> </IconButton> <IconButton size="large" aria-label="display more actions" edge="end" color="inherit" > <MoreIcon /> </IconButton> </StyledToolbar> </AppBar> </Box> ); }
2,041
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/ProminentAppBar.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import MenuIcon from '@mui/icons-material/Menu'; import SearchIcon from '@mui/icons-material/Search'; import MoreIcon from '@mui/icons-material/MoreVert'; const StyledToolbar = styled(Toolbar)(({ theme }) => ({ alignItems: 'flex-start', paddingTop: theme.spacing(1), paddingBottom: theme.spacing(2), // Override media queries injected by theme.mixins.toolbar '@media all': { minHeight: 128, }, })); export default function ProminentAppBar() { return ( <Box sx={{ flexGrow: 1 }}> <AppBar position="static"> <StyledToolbar> <IconButton size="large" edge="start" color="inherit" aria-label="open drawer" sx={{ mr: 2 }} > <MenuIcon /> </IconButton> <Typography variant="h5" noWrap component="div" sx={{ flexGrow: 1, alignSelf: 'flex-end' }} > MUI </Typography> <IconButton size="large" aria-label="search" color="inherit"> <SearchIcon /> </IconButton> <IconButton size="large" aria-label="display more actions" edge="end" color="inherit" > <MoreIcon /> </IconButton> </StyledToolbar> </AppBar> </Box> ); }
2,042
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/ResponsiveAppBar.js
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import Menu from '@mui/material/Menu'; import MenuIcon from '@mui/icons-material/Menu'; import Container from '@mui/material/Container'; import Avatar from '@mui/material/Avatar'; import Button from '@mui/material/Button'; import Tooltip from '@mui/material/Tooltip'; import MenuItem from '@mui/material/MenuItem'; import AdbIcon from '@mui/icons-material/Adb'; const pages = ['Products', 'Pricing', 'Blog']; const settings = ['Profile', 'Account', 'Dashboard', 'Logout']; function ResponsiveAppBar() { const [anchorElNav, setAnchorElNav] = React.useState(null); const [anchorElUser, setAnchorElUser] = React.useState(null); const handleOpenNavMenu = (event) => { setAnchorElNav(event.currentTarget); }; const handleOpenUserMenu = (event) => { setAnchorElUser(event.currentTarget); }; const handleCloseNavMenu = () => { setAnchorElNav(null); }; const handleCloseUserMenu = () => { setAnchorElUser(null); }; return ( <AppBar position="static"> <Container maxWidth="xl"> <Toolbar disableGutters> <AdbIcon sx={{ display: { xs: 'none', md: 'flex' }, mr: 1 }} /> <Typography variant="h6" noWrap component="a" href="#app-bar-with-responsive-menu" sx={{ mr: 2, display: { xs: 'none', md: 'flex' }, fontFamily: 'monospace', fontWeight: 700, letterSpacing: '.3rem', color: 'inherit', textDecoration: 'none', }} > LOGO </Typography> <Box sx={{ flexGrow: 1, display: { xs: 'flex', md: 'none' } }}> <IconButton size="large" aria-label="account of current user" aria-controls="menu-appbar" aria-haspopup="true" onClick={handleOpenNavMenu} color="inherit" > <MenuIcon /> </IconButton> <Menu id="menu-appbar" anchorEl={anchorElNav} anchorOrigin={{ vertical: 'bottom', horizontal: 'left', }} keepMounted transformOrigin={{ vertical: 'top', horizontal: 'left', }} open={Boolean(anchorElNav)} onClose={handleCloseNavMenu} sx={{ display: { xs: 'block', md: 'none' }, }} > {pages.map((page) => ( <MenuItem key={page} onClick={handleCloseNavMenu}> <Typography textAlign="center">{page}</Typography> </MenuItem> ))} </Menu> </Box> <AdbIcon sx={{ display: { xs: 'flex', md: 'none' }, mr: 1 }} /> <Typography variant="h5" noWrap component="a" href="#app-bar-with-responsive-menu" sx={{ mr: 2, display: { xs: 'flex', md: 'none' }, flexGrow: 1, fontFamily: 'monospace', fontWeight: 700, letterSpacing: '.3rem', color: 'inherit', textDecoration: 'none', }} > LOGO </Typography> <Box sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' } }}> {pages.map((page) => ( <Button key={page} onClick={handleCloseNavMenu} sx={{ my: 2, color: 'white', display: 'block' }} > {page} </Button> ))} </Box> <Box sx={{ flexGrow: 0 }}> <Tooltip title="Open settings"> <IconButton onClick={handleOpenUserMenu} sx={{ p: 0 }}> <Avatar alt="Remy Sharp" src="/static/images/avatar/2.jpg" /> </IconButton> </Tooltip> <Menu sx={{ mt: '45px' }} id="menu-appbar" anchorEl={anchorElUser} anchorOrigin={{ vertical: 'top', horizontal: 'right', }} keepMounted transformOrigin={{ vertical: 'top', horizontal: 'right', }} open={Boolean(anchorElUser)} onClose={handleCloseUserMenu} > {settings.map((setting) => ( <MenuItem key={setting} onClick={handleCloseUserMenu}> <Typography textAlign="center">{setting}</Typography> </MenuItem> ))} </Menu> </Box> </Toolbar> </Container> </AppBar> ); } export default ResponsiveAppBar;
2,043
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/ResponsiveAppBar.tsx
import * as React from 'react'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import Menu from '@mui/material/Menu'; import MenuIcon from '@mui/icons-material/Menu'; import Container from '@mui/material/Container'; import Avatar from '@mui/material/Avatar'; import Button from '@mui/material/Button'; import Tooltip from '@mui/material/Tooltip'; import MenuItem from '@mui/material/MenuItem'; import AdbIcon from '@mui/icons-material/Adb'; const pages = ['Products', 'Pricing', 'Blog']; const settings = ['Profile', 'Account', 'Dashboard', 'Logout']; function ResponsiveAppBar() { const [anchorElNav, setAnchorElNav] = React.useState<null | HTMLElement>(null); const [anchorElUser, setAnchorElUser] = React.useState<null | HTMLElement>(null); const handleOpenNavMenu = (event: React.MouseEvent<HTMLElement>) => { setAnchorElNav(event.currentTarget); }; const handleOpenUserMenu = (event: React.MouseEvent<HTMLElement>) => { setAnchorElUser(event.currentTarget); }; const handleCloseNavMenu = () => { setAnchorElNav(null); }; const handleCloseUserMenu = () => { setAnchorElUser(null); }; return ( <AppBar position="static"> <Container maxWidth="xl"> <Toolbar disableGutters> <AdbIcon sx={{ display: { xs: 'none', md: 'flex' }, mr: 1 }} /> <Typography variant="h6" noWrap component="a" href="#app-bar-with-responsive-menu" sx={{ mr: 2, display: { xs: 'none', md: 'flex' }, fontFamily: 'monospace', fontWeight: 700, letterSpacing: '.3rem', color: 'inherit', textDecoration: 'none', }} > LOGO </Typography> <Box sx={{ flexGrow: 1, display: { xs: 'flex', md: 'none' } }}> <IconButton size="large" aria-label="account of current user" aria-controls="menu-appbar" aria-haspopup="true" onClick={handleOpenNavMenu} color="inherit" > <MenuIcon /> </IconButton> <Menu id="menu-appbar" anchorEl={anchorElNav} anchorOrigin={{ vertical: 'bottom', horizontal: 'left', }} keepMounted transformOrigin={{ vertical: 'top', horizontal: 'left', }} open={Boolean(anchorElNav)} onClose={handleCloseNavMenu} sx={{ display: { xs: 'block', md: 'none' }, }} > {pages.map((page) => ( <MenuItem key={page} onClick={handleCloseNavMenu}> <Typography textAlign="center">{page}</Typography> </MenuItem> ))} </Menu> </Box> <AdbIcon sx={{ display: { xs: 'flex', md: 'none' }, mr: 1 }} /> <Typography variant="h5" noWrap component="a" href="#app-bar-with-responsive-menu" sx={{ mr: 2, display: { xs: 'flex', md: 'none' }, flexGrow: 1, fontFamily: 'monospace', fontWeight: 700, letterSpacing: '.3rem', color: 'inherit', textDecoration: 'none', }} > LOGO </Typography> <Box sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' } }}> {pages.map((page) => ( <Button key={page} onClick={handleCloseNavMenu} sx={{ my: 2, color: 'white', display: 'block' }} > {page} </Button> ))} </Box> <Box sx={{ flexGrow: 0 }}> <Tooltip title="Open settings"> <IconButton onClick={handleOpenUserMenu} sx={{ p: 0 }}> <Avatar alt="Remy Sharp" src="/static/images/avatar/2.jpg" /> </IconButton> </Tooltip> <Menu sx={{ mt: '45px' }} id="menu-appbar" anchorEl={anchorElUser} anchorOrigin={{ vertical: 'top', horizontal: 'right', }} keepMounted transformOrigin={{ vertical: 'top', horizontal: 'right', }} open={Boolean(anchorElUser)} onClose={handleCloseUserMenu} > {settings.map((setting) => ( <MenuItem key={setting} onClick={handleCloseUserMenu}> <Typography textAlign="center">{setting}</Typography> </MenuItem> ))} </Menu> </Box> </Toolbar> </Container> </AppBar> ); } export default ResponsiveAppBar;
2,044
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/SearchAppBar.js
import * as React from 'react'; import { styled, alpha } from '@mui/material/styles'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import InputBase from '@mui/material/InputBase'; import MenuIcon from '@mui/icons-material/Menu'; import SearchIcon from '@mui/icons-material/Search'; const Search = styled('div')(({ theme }) => ({ position: 'relative', borderRadius: theme.shape.borderRadius, backgroundColor: alpha(theme.palette.common.white, 0.15), '&:hover': { backgroundColor: alpha(theme.palette.common.white, 0.25), }, marginLeft: 0, width: '100%', [theme.breakpoints.up('sm')]: { marginLeft: theme.spacing(1), width: 'auto', }, })); const SearchIconWrapper = styled('div')(({ theme }) => ({ padding: theme.spacing(0, 2), height: '100%', position: 'absolute', pointerEvents: 'none', display: 'flex', alignItems: 'center', justifyContent: 'center', })); const StyledInputBase = styled(InputBase)(({ theme }) => ({ color: 'inherit', '& .MuiInputBase-input': { padding: theme.spacing(1, 1, 1, 0), // vertical padding + font size from searchIcon paddingLeft: `calc(1em + ${theme.spacing(4)})`, transition: theme.transitions.create('width'), width: '100%', [theme.breakpoints.up('sm')]: { width: '12ch', '&:focus': { width: '20ch', }, }, }, })); export default function SearchAppBar() { return ( <Box sx={{ flexGrow: 1 }}> <AppBar position="static"> <Toolbar> <IconButton size="large" edge="start" color="inherit" aria-label="open drawer" sx={{ mr: 2 }} > <MenuIcon /> </IconButton> <Typography variant="h6" noWrap component="div" sx={{ flexGrow: 1, display: { xs: 'none', sm: 'block' } }} > MUI </Typography> <Search> <SearchIconWrapper> <SearchIcon /> </SearchIconWrapper> <StyledInputBase placeholder="Search…" inputProps={{ 'aria-label': 'search' }} /> </Search> </Toolbar> </AppBar> </Box> ); }
2,045
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/SearchAppBar.tsx
import * as React from 'react'; import { styled, alpha } from '@mui/material/styles'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import InputBase from '@mui/material/InputBase'; import MenuIcon from '@mui/icons-material/Menu'; import SearchIcon from '@mui/icons-material/Search'; const Search = styled('div')(({ theme }) => ({ position: 'relative', borderRadius: theme.shape.borderRadius, backgroundColor: alpha(theme.palette.common.white, 0.15), '&:hover': { backgroundColor: alpha(theme.palette.common.white, 0.25), }, marginLeft: 0, width: '100%', [theme.breakpoints.up('sm')]: { marginLeft: theme.spacing(1), width: 'auto', }, })); const SearchIconWrapper = styled('div')(({ theme }) => ({ padding: theme.spacing(0, 2), height: '100%', position: 'absolute', pointerEvents: 'none', display: 'flex', alignItems: 'center', justifyContent: 'center', })); const StyledInputBase = styled(InputBase)(({ theme }) => ({ color: 'inherit', '& .MuiInputBase-input': { padding: theme.spacing(1, 1, 1, 0), // vertical padding + font size from searchIcon paddingLeft: `calc(1em + ${theme.spacing(4)})`, transition: theme.transitions.create('width'), width: '100%', [theme.breakpoints.up('sm')]: { width: '12ch', '&:focus': { width: '20ch', }, }, }, })); export default function SearchAppBar() { return ( <Box sx={{ flexGrow: 1 }}> <AppBar position="static"> <Toolbar> <IconButton size="large" edge="start" color="inherit" aria-label="open drawer" sx={{ mr: 2 }} > <MenuIcon /> </IconButton> <Typography variant="h6" noWrap component="div" sx={{ flexGrow: 1, display: { xs: 'none', sm: 'block' } }} > MUI </Typography> <Search> <SearchIconWrapper> <SearchIcon /> </SearchIconWrapper> <StyledInputBase placeholder="Search…" inputProps={{ 'aria-label': 'search' }} /> </Search> </Toolbar> </AppBar> </Box> ); }
2,046
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/app-bar/app-bar.md
--- productId: material-ui title: App Bar React component components: AppBar, Toolbar, Menu githubLabel: 'component: app bar' materialDesign: https://m2.material.io/components/app-bars-top --- # App Bar <p class="description">The App Bar displays information and actions relating to the current screen.</p> The top App bar provides content and actions related to the current screen. It's used for branding, screen titles, navigation, and actions. It can transform into a contextual action bar or be used as a navbar. {{"component": "modules/components/ComponentLinkHeader.js"}} ## Basic App bar {{"demo": "ButtonAppBar.js", "bg": true}} ## App bar with menu {{"demo": "MenuAppBar.js", "bg": true}} ## App bar with responsive menu {{"demo": "ResponsiveAppBar.js", "bg": true}} ## App bar with search field A side searchbar. {{"demo": "SearchAppBar.js", "bg": true}} ## Responsive App bar with Drawer {{"demo": "DrawerAppBar.js", "bg": true,"iframe": true}} ## App bar with a primary search field A primary searchbar. {{"demo": "PrimarySearchAppBar.js", "bg": true}} ## Dense (desktop only) {{"demo": "DenseAppBar.js", "bg": true}} ## Prominent A prominent app bar. {{"demo": "ProminentAppBar.js", "bg": true}} ## Bottom App bar {{"demo": "BottomAppBar.js", "iframe": true, "maxWidth": 400}} ## Fixed placement When you render the app bar position fixed, the dimension of the element doesn't impact the rest of the page. This can cause some part of your content to be invisible, behind the app bar. Here are 3 possible solutions: 1. You can use `position="sticky"` instead of fixed. ⚠️ sticky is not supported by IE11. 2. You can render a second `<Toolbar />` component: ```jsx function App() { return ( <React.Fragment> <AppBar position="fixed"> <Toolbar>{/* content */}</Toolbar> </AppBar> <Toolbar /> </React.Fragment> ); } ``` 3. You can use `theme.mixins.toolbar` CSS: ```jsx const Offset = styled('div')(({ theme }) => theme.mixins.toolbar); function App() { return ( <React.Fragment> <AppBar position="fixed"> <Toolbar>{/* content */}</Toolbar> </AppBar> <Offset /> </React.Fragment> ); } ``` ## Scrolling You can use the `useScrollTrigger()` hook to respond to user scroll actions. ### Hide App bar The app bar hides on scroll down to leave more space for reading. {{"demo": "HideAppBar.js", "iframe": true, "disableLiveEdit": true}} ### Elevate App bar The app bar elevates on scroll to communicate that the user is not at the top of the page. {{"demo": "ElevateAppBar.js", "iframe": true, "disableLiveEdit": true}} ### Back to top A floating action button appears on scroll to make it easy to get back to the top of the page. {{"demo": "BackToTop.js", "iframe": true, "disableLiveEdit": true}} ### `useScrollTrigger([options]) => trigger` #### Arguments 1. `options` (_object_ [optional]): - `options.disableHysteresis` (_bool_ [optional]): Defaults to `false`. Disable the hysteresis. Ignore the scroll direction when determining the `trigger` value. - `options.target` (_Node_ [optional]): Defaults to `window`. - `options.threshold` (_number_ [optional]): Defaults to `100`. Change the `trigger` value when the vertical scroll strictly crosses this threshold (exclusive). #### Returns `trigger`: Does the scroll position match the criteria? #### Examples ```jsx import useScrollTrigger from '@mui/material/useScrollTrigger'; function HideOnScroll(props) { const trigger = useScrollTrigger(); return ( <Slide in={!trigger}> <div>Hello</div> </Slide> ); } ``` ## Enable color on dark Following the [Material Design guidelines](https://m2.material.io/design/color/dark-theme.html), the `color` prop has no effect on the appearance of the app bar in dark mode. You can override this behavior by setting the `enableColorOnDark` prop to `true`. {{"demo": "EnableColorOnDarkAppBar.js", "bg": true}}
2,047
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/Asynchronous.js
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import CircularProgress from '@mui/material/CircularProgress'; function sleep(duration) { return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); }); } export default function Asynchronous() { const [open, setOpen] = React.useState(false); const [options, setOptions] = React.useState([]); const loading = open && options.length === 0; React.useEffect(() => { let active = true; if (!loading) { return undefined; } (async () => { await sleep(1e3); // For demo purposes. if (active) { setOptions([...topFilms]); } })(); return () => { active = false; }; }, [loading]); React.useEffect(() => { if (!open) { setOptions([]); } }, [open]); return ( <Autocomplete id="asynchronous-demo" sx={{ width: 300 }} open={open} onOpen={() => { setOpen(true); }} onClose={() => { setOpen(false); }} isOptionEqualToValue={(option, value) => option.title === value.title} getOptionLabel={(option) => option.title} options={options} loading={loading} renderInput={(params) => ( <TextField {...params} label="Asynchronous" InputProps={{ ...params.InputProps, endAdornment: ( <React.Fragment> {loading ? <CircularProgress color="inherit" size={20} /> : null} {params.InputProps.endAdornment} </React.Fragment> ), }} /> )} /> ); } // Top films as rated by IMDb users. http://www.imdb.com/chart/top const topFilms = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, ];
2,048
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/Asynchronous.tsx
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import CircularProgress from '@mui/material/CircularProgress'; interface Film { title: string; year: number; } function sleep(duration: number): Promise<void> { return new Promise<void>((resolve) => { setTimeout(() => { resolve(); }, duration); }); } export default function Asynchronous() { const [open, setOpen] = React.useState(false); const [options, setOptions] = React.useState<readonly Film[]>([]); const loading = open && options.length === 0; React.useEffect(() => { let active = true; if (!loading) { return undefined; } (async () => { await sleep(1e3); // For demo purposes. if (active) { setOptions([...topFilms]); } })(); return () => { active = false; }; }, [loading]); React.useEffect(() => { if (!open) { setOptions([]); } }, [open]); return ( <Autocomplete id="asynchronous-demo" sx={{ width: 300 }} open={open} onOpen={() => { setOpen(true); }} onClose={() => { setOpen(false); }} isOptionEqualToValue={(option, value) => option.title === value.title} getOptionLabel={(option) => option.title} options={options} loading={loading} renderInput={(params) => ( <TextField {...params} label="Asynchronous" InputProps={{ ...params.InputProps, endAdornment: ( <React.Fragment> {loading ? <CircularProgress color="inherit" size={20} /> : null} {params.InputProps.endAdornment} </React.Fragment> ), }} /> )} /> ); } // Top films as rated by IMDb users. http://www.imdb.com/chart/top const topFilms = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, ];
2,049
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/AutocompleteHint.js
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import { Box, Typography } from '@mui/material'; export default function AutocompleteHint() { const hint = React.useRef(''); const [inputValue, setInputValue] = React.useState(''); return ( <Autocomplete onKeyDown={(event) => { if (event.key === 'Tab') { if (hint.current) { setInputValue(hint.current); event.preventDefault(); } } }} onBlur={() => { hint.current = ''; }} disablePortal inputValue={inputValue} filterOptions={(options, state) => { const displayOptions = options.filter((option) => option.label .toLowerCase() .trim() .includes(state.inputValue.toLowerCase().trim()), ); return displayOptions; }} id="combo-box-hint-demo" options={top100Films} sx={{ width: 300 }} renderInput={(params) => { return ( <Box sx={{ position: 'relative' }}> <Typography sx={{ position: 'absolute', opacity: 0.5, left: 14, top: 16 }} > {hint.current} </Typography> <TextField {...params} onChange={(e) => { const newValue = e.target.value; setInputValue(newValue); const matchingOption = top100Films.find((option) => option.label.startsWith(newValue), ); if (newValue && matchingOption) { hint.current = matchingOption.label; } else { hint.current = ''; } }} label="Movie" /> </Box> ); }} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { 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, }, { label: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { label: 'Forrest Gump', year: 1994 }, { label: 'Inception', year: 2010 }, { label: 'The Lord of the Rings: The Two Towers', year: 2002, }, { label: "One Flew Over the Cuckoo's Nest", year: 1975 }, { label: 'Goodfellas', year: 1990 }, { label: 'The Matrix', year: 1999 }, { label: 'Seven Samurai', year: 1954 }, { label: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { label: 'City of God', year: 2002 }, { label: 'Se7en', year: 1995 }, { label: 'The Silence of the Lambs', year: 1991 }, { label: "It's a Wonderful Life", year: 1946 }, { label: 'Life Is Beautiful', year: 1997 }, { label: 'The Usual Suspects', year: 1995 }, { label: 'Léon: The Professional', year: 1994 }, { label: 'Spirited Away', year: 2001 }, { label: 'Saving Private Ryan', year: 1998 }, { label: 'Once Upon a Time in the West', year: 1968 }, { label: 'American History X', year: 1998 }, { label: 'Interstellar', year: 2014 }, { label: 'Casablanca', year: 1942 }, { label: 'City Lights', year: 1931 }, { label: 'Psycho', year: 1960 }, { label: 'The Green Mile', year: 1999 }, { label: 'The Intouchables', year: 2011 }, { label: 'Modern Times', year: 1936 }, { label: 'Raiders of the Lost Ark', year: 1981 }, { label: 'Rear Window', year: 1954 }, { label: 'The Pianist', year: 2002 }, { label: 'The Departed', year: 2006 }, { label: 'Terminator 2: Judgment Day', year: 1991 }, { label: 'Back to the Future', year: 1985 }, { label: 'Whiplash', year: 2014 }, { label: 'Gladiator', year: 2000 }, { label: 'Memento', year: 2000 }, { label: 'The Prestige', year: 2006 }, { label: 'The Lion King', year: 1994 }, { label: 'Apocalypse Now', year: 1979 }, { label: 'Alien', year: 1979 }, { label: 'Sunset Boulevard', year: 1950 }, { label: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { label: 'The Great Dictator', year: 1940 }, { label: 'Cinema Paradiso', year: 1988 }, { label: 'The Lives of Others', year: 2006 }, { label: 'Grave of the Fireflies', year: 1988 }, { label: 'Paths of Glory', year: 1957 }, { label: 'Django Unchained', year: 2012 }, { label: 'The Shining', year: 1980 }, { label: 'WALL·E', year: 2008 }, { label: 'American Beauty', year: 1999 }, { label: 'The Dark Knight Rises', year: 2012 }, { label: 'Princess Mononoke', year: 1997 }, { label: 'Aliens', year: 1986 }, { label: 'Oldboy', year: 2003 }, { label: 'Once Upon a Time in America', year: 1984 }, { label: 'Witness for the Prosecution', year: 1957 }, { label: 'Das Boot', year: 1981 }, { label: 'Citizen Kane', year: 1941 }, { label: 'North by Northwest', year: 1959 }, { label: 'Vertigo', year: 1958 }, { label: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { label: 'Reservoir Dogs', year: 1992 }, { label: 'Braveheart', year: 1995 }, { label: 'M', year: 1931 }, { label: 'Requiem for a Dream', year: 2000 }, { label: 'Amélie', year: 2001 }, { label: 'A Clockwork Orange', year: 1971 }, { label: 'Like Stars on Earth', year: 2007 }, { label: 'Taxi Driver', year: 1976 }, { label: 'Lawrence of Arabia', year: 1962 }, { label: 'Double Indemnity', year: 1944 }, { label: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { label: 'Amadeus', year: 1984 }, { label: 'To Kill a Mockingbird', year: 1962 }, { label: 'Toy Story 3', year: 2010 }, { label: 'Logan', year: 2017 }, { label: 'Full Metal Jacket', year: 1987 }, { label: 'Dangal', year: 2016 }, { label: 'The Sting', year: 1973 }, { label: '2001: A Space Odyssey', year: 1968 }, { label: "Singin' in the Rain", year: 1952 }, { label: 'Toy Story', year: 1995 }, { label: 'Bicycle Thieves', year: 1948 }, { label: 'The Kid', year: 1921 }, { label: 'Inglourious Basterds', year: 2009 }, { label: 'Snatch', year: 2000 }, { label: '3 Idiots', year: 2009 }, { label: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,050
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/AutocompleteHint.tsx
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import { Box, Typography } from '@mui/material'; export default function AutocompleteHint() { const hint = React.useRef(''); const [inputValue, setInputValue] = React.useState(''); return ( <Autocomplete onKeyDown={(event) => { if (event.key === 'Tab') { if (hint.current) { setInputValue(hint.current); event.preventDefault(); } } }} onBlur={() => { hint.current = ''; }} disablePortal inputValue={inputValue} filterOptions={(options, state) => { const displayOptions = options.filter((option) => option.label .toLowerCase() .trim() .includes(state.inputValue.toLowerCase().trim()), ); return displayOptions; }} id="combo-box-hint-demo" options={top100Films} sx={{ width: 300 }} renderInput={(params) => { return ( <Box sx={{ position: 'relative' }}> <Typography sx={{ position: 'absolute', opacity: 0.5, left: 14, top: 16 }} > {hint.current} </Typography> <TextField {...params} onChange={(e) => { const newValue = e.target.value; setInputValue(newValue); const matchingOption = top100Films.find((option) => option.label.startsWith(newValue), ); if (newValue && matchingOption) { hint.current = matchingOption.label; } else { hint.current = ''; } }} label="Movie" /> </Box> ); }} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { 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, }, { label: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { label: 'Forrest Gump', year: 1994 }, { label: 'Inception', year: 2010 }, { label: 'The Lord of the Rings: The Two Towers', year: 2002, }, { label: "One Flew Over the Cuckoo's Nest", year: 1975 }, { label: 'Goodfellas', year: 1990 }, { label: 'The Matrix', year: 1999 }, { label: 'Seven Samurai', year: 1954 }, { label: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { label: 'City of God', year: 2002 }, { label: 'Se7en', year: 1995 }, { label: 'The Silence of the Lambs', year: 1991 }, { label: "It's a Wonderful Life", year: 1946 }, { label: 'Life Is Beautiful', year: 1997 }, { label: 'The Usual Suspects', year: 1995 }, { label: 'Léon: The Professional', year: 1994 }, { label: 'Spirited Away', year: 2001 }, { label: 'Saving Private Ryan', year: 1998 }, { label: 'Once Upon a Time in the West', year: 1968 }, { label: 'American History X', year: 1998 }, { label: 'Interstellar', year: 2014 }, { label: 'Casablanca', year: 1942 }, { label: 'City Lights', year: 1931 }, { label: 'Psycho', year: 1960 }, { label: 'The Green Mile', year: 1999 }, { label: 'The Intouchables', year: 2011 }, { label: 'Modern Times', year: 1936 }, { label: 'Raiders of the Lost Ark', year: 1981 }, { label: 'Rear Window', year: 1954 }, { label: 'The Pianist', year: 2002 }, { label: 'The Departed', year: 2006 }, { label: 'Terminator 2: Judgment Day', year: 1991 }, { label: 'Back to the Future', year: 1985 }, { label: 'Whiplash', year: 2014 }, { label: 'Gladiator', year: 2000 }, { label: 'Memento', year: 2000 }, { label: 'The Prestige', year: 2006 }, { label: 'The Lion King', year: 1994 }, { label: 'Apocalypse Now', year: 1979 }, { label: 'Alien', year: 1979 }, { label: 'Sunset Boulevard', year: 1950 }, { label: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { label: 'The Great Dictator', year: 1940 }, { label: 'Cinema Paradiso', year: 1988 }, { label: 'The Lives of Others', year: 2006 }, { label: 'Grave of the Fireflies', year: 1988 }, { label: 'Paths of Glory', year: 1957 }, { label: 'Django Unchained', year: 2012 }, { label: 'The Shining', year: 1980 }, { label: 'WALL·E', year: 2008 }, { label: 'American Beauty', year: 1999 }, { label: 'The Dark Knight Rises', year: 2012 }, { label: 'Princess Mononoke', year: 1997 }, { label: 'Aliens', year: 1986 }, { label: 'Oldboy', year: 2003 }, { label: 'Once Upon a Time in America', year: 1984 }, { label: 'Witness for the Prosecution', year: 1957 }, { label: 'Das Boot', year: 1981 }, { label: 'Citizen Kane', year: 1941 }, { label: 'North by Northwest', year: 1959 }, { label: 'Vertigo', year: 1958 }, { label: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { label: 'Reservoir Dogs', year: 1992 }, { label: 'Braveheart', year: 1995 }, { label: 'M', year: 1931 }, { label: 'Requiem for a Dream', year: 2000 }, { label: 'Amélie', year: 2001 }, { label: 'A Clockwork Orange', year: 1971 }, { label: 'Like Stars on Earth', year: 2007 }, { label: 'Taxi Driver', year: 1976 }, { label: 'Lawrence of Arabia', year: 1962 }, { label: 'Double Indemnity', year: 1944 }, { label: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { label: 'Amadeus', year: 1984 }, { label: 'To Kill a Mockingbird', year: 1962 }, { label: 'Toy Story 3', year: 2010 }, { label: 'Logan', year: 2017 }, { label: 'Full Metal Jacket', year: 1987 }, { label: 'Dangal', year: 2016 }, { label: 'The Sting', year: 1973 }, { label: '2001: A Space Odyssey', year: 1968 }, { label: "Singin' in the Rain", year: 1952 }, { label: 'Toy Story', year: 1995 }, { label: 'Bicycle Thieves', year: 1948 }, { label: 'The Kid', year: 1921 }, { label: 'Inglourious Basterds', year: 2009 }, { label: 'Snatch', year: 2000 }, { label: '3 Idiots', year: 2009 }, { label: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,051
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/CheckboxesTags.js
import * as React from 'react'; import Checkbox from '@mui/material/Checkbox'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank'; import CheckBoxIcon from '@mui/icons-material/CheckBox'; const icon = <CheckBoxOutlineBlankIcon fontSize="small" />; const checkedIcon = <CheckBoxIcon fontSize="small" />; export default function CheckboxesTags() { return ( <Autocomplete multiple id="checkboxes-tags-demo" options={top100Films} disableCloseOnSelect getOptionLabel={(option) => option.title} renderOption={(props, option, { selected }) => ( <li {...props}> <Checkbox icon={icon} checkedIcon={checkedIcon} style={{ marginRight: 8 }} checked={selected} /> {option.title} </li> )} style={{ width: 500 }} renderInput={(params) => ( <TextField {...params} label="Checkboxes" placeholder="Favorites" /> )} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, ];
2,052
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/CheckboxesTags.tsx
import * as React from 'react'; import Checkbox from '@mui/material/Checkbox'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank'; import CheckBoxIcon from '@mui/icons-material/CheckBox'; const icon = <CheckBoxOutlineBlankIcon fontSize="small" />; const checkedIcon = <CheckBoxIcon fontSize="small" />; export default function CheckboxesTags() { return ( <Autocomplete multiple id="checkboxes-tags-demo" options={top100Films} disableCloseOnSelect getOptionLabel={(option) => option.title} renderOption={(props, option, { selected }) => ( <li {...props}> <Checkbox icon={icon} checkedIcon={checkedIcon} style={{ marginRight: 8 }} checked={selected} /> {option.title} </li> )} style={{ width: 500 }} renderInput={(params) => ( <TextField {...params} label="Checkboxes" placeholder="Favorites" /> )} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, ];
2,053
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/ComboBox.js
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; export default function ComboBox() { return ( <Autocomplete disablePortal id="combo-box-demo" options={top100Films} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="Movie" />} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { 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, }, { label: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { label: 'Forrest Gump', year: 1994 }, { label: 'Inception', year: 2010 }, { label: 'The Lord of the Rings: The Two Towers', year: 2002, }, { label: "One Flew Over the Cuckoo's Nest", year: 1975 }, { label: 'Goodfellas', year: 1990 }, { label: 'The Matrix', year: 1999 }, { label: 'Seven Samurai', year: 1954 }, { label: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { label: 'City of God', year: 2002 }, { label: 'Se7en', year: 1995 }, { label: 'The Silence of the Lambs', year: 1991 }, { label: "It's a Wonderful Life", year: 1946 }, { label: 'Life Is Beautiful', year: 1997 }, { label: 'The Usual Suspects', year: 1995 }, { label: 'Léon: The Professional', year: 1994 }, { label: 'Spirited Away', year: 2001 }, { label: 'Saving Private Ryan', year: 1998 }, { label: 'Once Upon a Time in the West', year: 1968 }, { label: 'American History X', year: 1998 }, { label: 'Interstellar', year: 2014 }, { label: 'Casablanca', year: 1942 }, { label: 'City Lights', year: 1931 }, { label: 'Psycho', year: 1960 }, { label: 'The Green Mile', year: 1999 }, { label: 'The Intouchables', year: 2011 }, { label: 'Modern Times', year: 1936 }, { label: 'Raiders of the Lost Ark', year: 1981 }, { label: 'Rear Window', year: 1954 }, { label: 'The Pianist', year: 2002 }, { label: 'The Departed', year: 2006 }, { label: 'Terminator 2: Judgment Day', year: 1991 }, { label: 'Back to the Future', year: 1985 }, { label: 'Whiplash', year: 2014 }, { label: 'Gladiator', year: 2000 }, { label: 'Memento', year: 2000 }, { label: 'The Prestige', year: 2006 }, { label: 'The Lion King', year: 1994 }, { label: 'Apocalypse Now', year: 1979 }, { label: 'Alien', year: 1979 }, { label: 'Sunset Boulevard', year: 1950 }, { label: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { label: 'The Great Dictator', year: 1940 }, { label: 'Cinema Paradiso', year: 1988 }, { label: 'The Lives of Others', year: 2006 }, { label: 'Grave of the Fireflies', year: 1988 }, { label: 'Paths of Glory', year: 1957 }, { label: 'Django Unchained', year: 2012 }, { label: 'The Shining', year: 1980 }, { label: 'WALL·E', year: 2008 }, { label: 'American Beauty', year: 1999 }, { label: 'The Dark Knight Rises', year: 2012 }, { label: 'Princess Mononoke', year: 1997 }, { label: 'Aliens', year: 1986 }, { label: 'Oldboy', year: 2003 }, { label: 'Once Upon a Time in America', year: 1984 }, { label: 'Witness for the Prosecution', year: 1957 }, { label: 'Das Boot', year: 1981 }, { label: 'Citizen Kane', year: 1941 }, { label: 'North by Northwest', year: 1959 }, { label: 'Vertigo', year: 1958 }, { label: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { label: 'Reservoir Dogs', year: 1992 }, { label: 'Braveheart', year: 1995 }, { label: 'M', year: 1931 }, { label: 'Requiem for a Dream', year: 2000 }, { label: 'Amélie', year: 2001 }, { label: 'A Clockwork Orange', year: 1971 }, { label: 'Like Stars on Earth', year: 2007 }, { label: 'Taxi Driver', year: 1976 }, { label: 'Lawrence of Arabia', year: 1962 }, { label: 'Double Indemnity', year: 1944 }, { label: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { label: 'Amadeus', year: 1984 }, { label: 'To Kill a Mockingbird', year: 1962 }, { label: 'Toy Story 3', year: 2010 }, { label: 'Logan', year: 2017 }, { label: 'Full Metal Jacket', year: 1987 }, { label: 'Dangal', year: 2016 }, { label: 'The Sting', year: 1973 }, { label: '2001: A Space Odyssey', year: 1968 }, { label: "Singin' in the Rain", year: 1952 }, { label: 'Toy Story', year: 1995 }, { label: 'Bicycle Thieves', year: 1948 }, { label: 'The Kid', year: 1921 }, { label: 'Inglourious Basterds', year: 2009 }, { label: 'Snatch', year: 2000 }, { label: '3 Idiots', year: 2009 }, { label: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,054
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/ComboBox.tsx
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; export default function ComboBox() { return ( <Autocomplete disablePortal id="combo-box-demo" options={top100Films} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="Movie" />} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { 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, }, { label: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { label: 'Forrest Gump', year: 1994 }, { label: 'Inception', year: 2010 }, { label: 'The Lord of the Rings: The Two Towers', year: 2002, }, { label: "One Flew Over the Cuckoo's Nest", year: 1975 }, { label: 'Goodfellas', year: 1990 }, { label: 'The Matrix', year: 1999 }, { label: 'Seven Samurai', year: 1954 }, { label: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { label: 'City of God', year: 2002 }, { label: 'Se7en', year: 1995 }, { label: 'The Silence of the Lambs', year: 1991 }, { label: "It's a Wonderful Life", year: 1946 }, { label: 'Life Is Beautiful', year: 1997 }, { label: 'The Usual Suspects', year: 1995 }, { label: 'Léon: The Professional', year: 1994 }, { label: 'Spirited Away', year: 2001 }, { label: 'Saving Private Ryan', year: 1998 }, { label: 'Once Upon a Time in the West', year: 1968 }, { label: 'American History X', year: 1998 }, { label: 'Interstellar', year: 2014 }, { label: 'Casablanca', year: 1942 }, { label: 'City Lights', year: 1931 }, { label: 'Psycho', year: 1960 }, { label: 'The Green Mile', year: 1999 }, { label: 'The Intouchables', year: 2011 }, { label: 'Modern Times', year: 1936 }, { label: 'Raiders of the Lost Ark', year: 1981 }, { label: 'Rear Window', year: 1954 }, { label: 'The Pianist', year: 2002 }, { label: 'The Departed', year: 2006 }, { label: 'Terminator 2: Judgment Day', year: 1991 }, { label: 'Back to the Future', year: 1985 }, { label: 'Whiplash', year: 2014 }, { label: 'Gladiator', year: 2000 }, { label: 'Memento', year: 2000 }, { label: 'The Prestige', year: 2006 }, { label: 'The Lion King', year: 1994 }, { label: 'Apocalypse Now', year: 1979 }, { label: 'Alien', year: 1979 }, { label: 'Sunset Boulevard', year: 1950 }, { label: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { label: 'The Great Dictator', year: 1940 }, { label: 'Cinema Paradiso', year: 1988 }, { label: 'The Lives of Others', year: 2006 }, { label: 'Grave of the Fireflies', year: 1988 }, { label: 'Paths of Glory', year: 1957 }, { label: 'Django Unchained', year: 2012 }, { label: 'The Shining', year: 1980 }, { label: 'WALL·E', year: 2008 }, { label: 'American Beauty', year: 1999 }, { label: 'The Dark Knight Rises', year: 2012 }, { label: 'Princess Mononoke', year: 1997 }, { label: 'Aliens', year: 1986 }, { label: 'Oldboy', year: 2003 }, { label: 'Once Upon a Time in America', year: 1984 }, { label: 'Witness for the Prosecution', year: 1957 }, { label: 'Das Boot', year: 1981 }, { label: 'Citizen Kane', year: 1941 }, { label: 'North by Northwest', year: 1959 }, { label: 'Vertigo', year: 1958 }, { label: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { label: 'Reservoir Dogs', year: 1992 }, { label: 'Braveheart', year: 1995 }, { label: 'M', year: 1931 }, { label: 'Requiem for a Dream', year: 2000 }, { label: 'Amélie', year: 2001 }, { label: 'A Clockwork Orange', year: 1971 }, { label: 'Like Stars on Earth', year: 2007 }, { label: 'Taxi Driver', year: 1976 }, { label: 'Lawrence of Arabia', year: 1962 }, { label: 'Double Indemnity', year: 1944 }, { label: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { label: 'Amadeus', year: 1984 }, { label: 'To Kill a Mockingbird', year: 1962 }, { label: 'Toy Story 3', year: 2010 }, { label: 'Logan', year: 2017 }, { label: 'Full Metal Jacket', year: 1987 }, { label: 'Dangal', year: 2016 }, { label: 'The Sting', year: 1973 }, { label: '2001: A Space Odyssey', year: 1968 }, { label: "Singin' in the Rain", year: 1952 }, { label: 'Toy Story', year: 1995 }, { label: 'Bicycle Thieves', year: 1948 }, { label: 'The Kid', year: 1921 }, { label: 'Inglourious Basterds', year: 2009 }, { label: 'Snatch', year: 2000 }, { label: '3 Idiots', year: 2009 }, { label: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,055
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/ComboBox.tsx.preview
<Autocomplete disablePortal id="combo-box-demo" options={top100Films} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="Movie" />} />
2,056
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/ControllableStates.js
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; const options = ['Option 1', 'Option 2']; export default function ControllableStates() { const [value, setValue] = React.useState(options[0]); const [inputValue, setInputValue] = React.useState(''); return ( <div> <div>{`value: ${value !== null ? `'${value}'` : 'null'}`}</div> <div>{`inputValue: '${inputValue}'`}</div> <br /> <Autocomplete value={value} onChange={(event, newValue) => { setValue(newValue); }} inputValue={inputValue} onInputChange={(event, newInputValue) => { setInputValue(newInputValue); }} id="controllable-states-demo" options={options} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="Controllable" />} /> </div> ); }
2,057
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/ControllableStates.tsx
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; const options = ['Option 1', 'Option 2']; export default function ControllableStates() { const [value, setValue] = React.useState<string | null>(options[0]); const [inputValue, setInputValue] = React.useState(''); return ( <div> <div>{`value: ${value !== null ? `'${value}'` : 'null'}`}</div> <div>{`inputValue: '${inputValue}'`}</div> <br /> <Autocomplete value={value} onChange={(event: any, newValue: string | null) => { setValue(newValue); }} inputValue={inputValue} onInputChange={(event, newInputValue) => { setInputValue(newInputValue); }} id="controllable-states-demo" options={options} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="Controllable" />} /> </div> ); }
2,058
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/CountrySelect.js
import * as React from 'react'; import Box from '@mui/material/Box'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; export default function CountrySelect() { return ( <Autocomplete id="country-select-demo" sx={{ width: 300 }} options={countries} autoHighlight getOptionLabel={(option) => option.label} renderOption={(props, option) => ( <Box component="li" sx={{ '& > img': { mr: 2, flexShrink: 0 } }} {...props}> <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="" /> {option.label} ({option.code}) +{option.phone} </Box> )} renderInput={(params) => ( <TextField {...params} label="Choose a country" inputProps={{ ...params.inputProps, autoComplete: 'new-password', // disable autocomplete and autofill }} /> )} /> ); } // From https://bitbucket.org/atlassian/atlaskit-mk-2/raw/4ad0e56649c3e6c973e226b7efaeb28cb240ccb0/packages/core/select/src/data/countries.js const countries = [ { 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' }, ];
2,059
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/CountrySelect.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; export default function CountrySelect() { return ( <Autocomplete id="country-select-demo" sx={{ width: 300 }} options={countries} autoHighlight getOptionLabel={(option) => option.label} renderOption={(props, option) => ( <Box component="li" sx={{ '& > img': { mr: 2, flexShrink: 0 } }} {...props}> <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="" /> {option.label} ({option.code}) +{option.phone} </Box> )} renderInput={(params) => ( <TextField {...params} label="Choose a country" inputProps={{ ...params.inputProps, autoComplete: 'new-password', // disable autocomplete and autofill }} /> )} /> ); } 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' }, ];
2,060
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/CustomInputAutocomplete.js
import * as React from 'react'; import Autocomplete from '@mui/material/Autocomplete'; const options = ['Option 1', 'Option 2']; export default function CustomInputAutocomplete() { return ( <label> Value:{' '} <Autocomplete sx={{ display: 'inline-block', '& input': { width: 200, bgcolor: 'background.paper', color: (theme) => theme.palette.getContrastText(theme.palette.background.paper), }, }} id="custom-input-demo" options={options} renderInput={(params) => ( <div ref={params.InputProps.ref}> <input type="text" {...params.inputProps} /> </div> )} /> </label> ); }
2,061
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/CustomInputAutocomplete.tsx
import * as React from 'react'; import Autocomplete from '@mui/material/Autocomplete'; const options = ['Option 1', 'Option 2']; export default function CustomInputAutocomplete() { return ( <label> Value:{' '} <Autocomplete sx={{ display: 'inline-block', '& input': { width: 200, bgcolor: 'background.paper', color: (theme) => theme.palette.getContrastText(theme.palette.background.paper), }, }} id="custom-input-demo" options={options} renderInput={(params) => ( <div ref={params.InputProps.ref}> <input type="text" {...params.inputProps} /> </div> )} /> </label> ); }
2,062
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/CustomizedHook.js
import * as React from 'react'; import PropTypes from 'prop-types'; import { useAutocomplete } from '@mui/base/useAutocomplete'; import CheckIcon from '@mui/icons-material/Check'; import CloseIcon from '@mui/icons-material/Close'; import { styled } from '@mui/material/styles'; import { autocompleteClasses } from '@mui/material/Autocomplete'; const Root = styled('div')( ({ theme }) => ` color: ${ theme.palette.mode === 'dark' ? 'rgba(255,255,255,0.65)' : 'rgba(0,0,0,.85)' }; font-size: 14px; `, ); const Label = styled('label')` padding: 0 0 4px; line-height: 1.5; display: block; `; const InputWrapper = styled('div')( ({ theme }) => ` width: 300px; border: 1px solid ${theme.palette.mode === 'dark' ? '#434343' : '#d9d9d9'}; background-color: ${theme.palette.mode === 'dark' ? '#141414' : '#fff'}; border-radius: 4px; padding: 1px; display: flex; flex-wrap: wrap; &:hover { border-color: ${theme.palette.mode === 'dark' ? '#177ddc' : '#40a9ff'}; } &.focused { border-color: ${theme.palette.mode === 'dark' ? '#177ddc' : '#40a9ff'}; box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2); } & input { background-color: ${theme.palette.mode === 'dark' ? '#141414' : '#fff'}; color: ${ theme.palette.mode === 'dark' ? 'rgba(255,255,255,0.65)' : 'rgba(0,0,0,.85)' }; height: 30px; box-sizing: border-box; padding: 4px 6px; width: 0; min-width: 30px; flex-grow: 1; border: 0; margin: 0; outline: 0; } `, ); function Tag(props) { const { label, onDelete, ...other } = props; return ( <div {...other}> <span>{label}</span> <CloseIcon onClick={onDelete} /> </div> ); } Tag.propTypes = { label: PropTypes.string.isRequired, onDelete: PropTypes.func.isRequired, }; const StyledTag = styled(Tag)( ({ theme }) => ` display: flex; align-items: center; height: 24px; margin: 2px; line-height: 22px; background-color: ${ theme.palette.mode === 'dark' ? 'rgba(255,255,255,0.08)' : '#fafafa' }; border: 1px solid ${theme.palette.mode === 'dark' ? '#303030' : '#e8e8e8'}; border-radius: 2px; box-sizing: content-box; padding: 0 4px 0 10px; outline: 0; overflow: hidden; &:focus { border-color: ${theme.palette.mode === 'dark' ? '#177ddc' : '#40a9ff'}; background-color: ${theme.palette.mode === 'dark' ? '#003b57' : '#e6f7ff'}; } & span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } & svg { font-size: 12px; cursor: pointer; padding: 4px; } `, ); const Listbox = styled('ul')( ({ theme }) => ` width: 300px; margin: 2px 0 0; padding: 0; position: absolute; list-style: none; background-color: ${theme.palette.mode === 'dark' ? '#141414' : '#fff'}; overflow: auto; max-height: 250px; border-radius: 4px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); z-index: 1; & li { padding: 5px 12px; display: flex; & span { flex-grow: 1; } & svg { color: transparent; } } & li[aria-selected='true'] { background-color: ${theme.palette.mode === 'dark' ? '#2b2b2b' : '#fafafa'}; font-weight: 600; & svg { color: #1890ff; } } & li.${autocompleteClasses.focused} { background-color: ${theme.palette.mode === 'dark' ? '#003b57' : '#e6f7ff'}; cursor: pointer; & svg { color: currentColor; } } `, ); export default function CustomizedHook() { const { getRootProps, getInputLabelProps, getInputProps, getTagProps, getListboxProps, getOptionProps, groupedOptions, value, focused, setAnchorEl, } = useAutocomplete({ id: 'customized-hook-demo', defaultValue: [top100Films[1]], multiple: true, options: top100Films, getOptionLabel: (option) => option.title, }); return ( <Root> <div {...getRootProps()}> <Label {...getInputLabelProps()}>Customized hook</Label> <InputWrapper ref={setAnchorEl} className={focused ? 'focused' : ''}> {value.map((option, index) => ( <StyledTag label={option.title} {...getTagProps({ index })} /> ))} <input {...getInputProps()} /> </InputWrapper> </div> {groupedOptions.length > 0 ? ( <Listbox {...getListboxProps()}> {groupedOptions.map((option, index) => ( <li {...getOptionProps({ option, index })}> <span>{option.title}</span> <CheckIcon fontSize="small" /> </li> ))} </Listbox> ) : null} </Root> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,063
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/CustomizedHook.tsx
import * as React from 'react'; import { useAutocomplete, AutocompleteGetTagProps } from '@mui/base/useAutocomplete'; import CheckIcon from '@mui/icons-material/Check'; import CloseIcon from '@mui/icons-material/Close'; import { styled } from '@mui/material/styles'; import { autocompleteClasses } from '@mui/material/Autocomplete'; const Root = styled('div')( ({ theme }) => ` color: ${ theme.palette.mode === 'dark' ? 'rgba(255,255,255,0.65)' : 'rgba(0,0,0,.85)' }; font-size: 14px; `, ); const Label = styled('label')` padding: 0 0 4px; line-height: 1.5; display: block; `; const InputWrapper = styled('div')( ({ theme }) => ` width: 300px; border: 1px solid ${theme.palette.mode === 'dark' ? '#434343' : '#d9d9d9'}; background-color: ${theme.palette.mode === 'dark' ? '#141414' : '#fff'}; border-radius: 4px; padding: 1px; display: flex; flex-wrap: wrap; &:hover { border-color: ${theme.palette.mode === 'dark' ? '#177ddc' : '#40a9ff'}; } &.focused { border-color: ${theme.palette.mode === 'dark' ? '#177ddc' : '#40a9ff'}; box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2); } & input { background-color: ${theme.palette.mode === 'dark' ? '#141414' : '#fff'}; color: ${ theme.palette.mode === 'dark' ? 'rgba(255,255,255,0.65)' : 'rgba(0,0,0,.85)' }; height: 30px; box-sizing: border-box; padding: 4px 6px; width: 0; min-width: 30px; flex-grow: 1; border: 0; margin: 0; outline: 0; } `, ); interface TagProps extends ReturnType<AutocompleteGetTagProps> { label: string; } function Tag(props: TagProps) { const { label, onDelete, ...other } = props; return ( <div {...other}> <span>{label}</span> <CloseIcon onClick={onDelete} /> </div> ); } const StyledTag = styled(Tag)<TagProps>( ({ theme }) => ` display: flex; align-items: center; height: 24px; margin: 2px; line-height: 22px; background-color: ${ theme.palette.mode === 'dark' ? 'rgba(255,255,255,0.08)' : '#fafafa' }; border: 1px solid ${theme.palette.mode === 'dark' ? '#303030' : '#e8e8e8'}; border-radius: 2px; box-sizing: content-box; padding: 0 4px 0 10px; outline: 0; overflow: hidden; &:focus { border-color: ${theme.palette.mode === 'dark' ? '#177ddc' : '#40a9ff'}; background-color: ${theme.palette.mode === 'dark' ? '#003b57' : '#e6f7ff'}; } & span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } & svg { font-size: 12px; cursor: pointer; padding: 4px; } `, ); const Listbox = styled('ul')( ({ theme }) => ` width: 300px; margin: 2px 0 0; padding: 0; position: absolute; list-style: none; background-color: ${theme.palette.mode === 'dark' ? '#141414' : '#fff'}; overflow: auto; max-height: 250px; border-radius: 4px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); z-index: 1; & li { padding: 5px 12px; display: flex; & span { flex-grow: 1; } & svg { color: transparent; } } & li[aria-selected='true'] { background-color: ${theme.palette.mode === 'dark' ? '#2b2b2b' : '#fafafa'}; font-weight: 600; & svg { color: #1890ff; } } & li.${autocompleteClasses.focused} { background-color: ${theme.palette.mode === 'dark' ? '#003b57' : '#e6f7ff'}; cursor: pointer; & svg { color: currentColor; } } `, ); export default function CustomizedHook() { const { getRootProps, getInputLabelProps, getInputProps, getTagProps, getListboxProps, getOptionProps, groupedOptions, value, focused, setAnchorEl, } = useAutocomplete({ id: 'customized-hook-demo', defaultValue: [top100Films[1]], multiple: true, options: top100Films, getOptionLabel: (option) => option.title, }); return ( <Root> <div {...getRootProps()}> <Label {...getInputLabelProps()}>Customized hook</Label> <InputWrapper ref={setAnchorEl} className={focused ? 'focused' : ''}> {value.map((option: FilmOptionType, index: number) => ( <StyledTag label={option.title} {...getTagProps({ index })} /> ))} <input {...getInputProps()} /> </InputWrapper> </div> {groupedOptions.length > 0 ? ( <Listbox {...getListboxProps()}> {(groupedOptions as typeof top100Films).map((option, index) => ( <li {...getOptionProps({ option, index })}> <span>{option.title}</span> <CheckIcon fontSize="small" /> </li> ))} </Listbox> ) : null} </Root> ); } interface FilmOptionType { title: string; year: number; } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,064
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/DisabledOptions.js
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; export default function DisabledOptions() { return ( <Autocomplete id="disabled-options-demo" options={timeSlots} getOptionDisabled={(option) => option === timeSlots[0] || option === timeSlots[2] } sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="Disabled options" />} /> ); } // One time slot every 30 minutes. const timeSlots = Array.from(new Array(24 * 2)).map( (_, index) => `${index < 20 ? '0' : ''}${Math.floor(index / 2)}:${ index % 2 === 0 ? '00' : '30' }`, );
2,065
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/DisabledOptions.tsx
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; export default function DisabledOptions() { return ( <Autocomplete id="disabled-options-demo" options={timeSlots} getOptionDisabled={(option) => option === timeSlots[0] || option === timeSlots[2] } sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="Disabled options" />} /> ); } // One time slot every 30 minutes. const timeSlots = Array.from(new Array(24 * 2)).map( (_, index) => `${index < 20 ? '0' : ''}${Math.floor(index / 2)}:${ index % 2 === 0 ? '00' : '30' }`, );
2,066
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/DisabledOptions.tsx.preview
<Autocomplete id="disabled-options-demo" options={timeSlots} getOptionDisabled={(option) => option === timeSlots[0] || option === timeSlots[2] } sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="Disabled options" />} />
2,067
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/Filter.js
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete'; const filterOptions = createFilterOptions({ matchFrom: 'start', stringify: (option) => option.title, }); export default function Filter() { return ( <Autocomplete id="filter-demo" options={top100Films} getOptionLabel={(option) => option.title} filterOptions={filterOptions} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="Custom filter" />} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,068
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/Filter.tsx
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete'; const filterOptions = createFilterOptions({ matchFrom: 'start', stringify: (option: FilmOptionType) => option.title, }); export default function Filter() { return ( <Autocomplete id="filter-demo" options={top100Films} getOptionLabel={(option) => option.title} filterOptions={filterOptions} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="Custom filter" />} /> ); } interface FilmOptionType { title: string; year: number; } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,069
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/Filter.tsx.preview
<Autocomplete id="filter-demo" options={top100Films} getOptionLabel={(option) => option.title} filterOptions={filterOptions} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="Custom filter" />} />
2,070
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/FixedTags.js
import * as React from 'react'; import Chip from '@mui/material/Chip'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; export default function FixedTags() { const fixedOptions = [top100Films[6]]; const [value, setValue] = React.useState([...fixedOptions, top100Films[13]]); return ( <Autocomplete multiple id="fixed-tags-demo" value={value} onChange={(event, newValue) => { setValue([ ...fixedOptions, ...newValue.filter((option) => fixedOptions.indexOf(option) === -1), ]); }} options={top100Films} getOptionLabel={(option) => option.title} renderTags={(tagValue, getTagProps) => tagValue.map((option, index) => ( <Chip label={option.title} {...getTagProps({ index })} disabled={fixedOptions.indexOf(option) !== -1} /> )) } style={{ width: 500 }} renderInput={(params) => ( <TextField {...params} label="Fixed tag" placeholder="Favorites" /> )} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,071
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/FixedTags.tsx
import * as React from 'react'; import Chip from '@mui/material/Chip'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; export default function FixedTags() { const fixedOptions = [top100Films[6]]; const [value, setValue] = React.useState([...fixedOptions, top100Films[13]]); return ( <Autocomplete multiple id="fixed-tags-demo" value={value} onChange={(event, newValue) => { setValue([ ...fixedOptions, ...newValue.filter((option) => fixedOptions.indexOf(option) === -1), ]); }} options={top100Films} getOptionLabel={(option) => option.title} renderTags={(tagValue, getTagProps) => tagValue.map((option, index) => ( <Chip label={option.title} {...getTagProps({ index })} disabled={fixedOptions.indexOf(option) !== -1} /> )) } style={{ width: 500 }} renderInput={(params) => ( <TextField {...params} label="Fixed tag" placeholder="Favorites" /> )} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,072
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/FreeSolo.js
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Stack from '@mui/material/Stack'; import Autocomplete from '@mui/material/Autocomplete'; export default function FreeSolo() { return ( <Stack spacing={2} sx={{ width: 300 }}> <Autocomplete id="free-solo-demo" freeSolo options={top100Films.map((option) => option.title)} renderInput={(params) => <TextField {...params} label="freeSolo" />} /> <Autocomplete freeSolo id="free-solo-2-demo" disableClearable options={top100Films.map((option) => option.title)} renderInput={(params) => ( <TextField {...params} label="Search input" InputProps={{ ...params.InputProps, type: 'search', }} /> )} /> </Stack> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,073
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/FreeSolo.tsx
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Stack from '@mui/material/Stack'; import Autocomplete from '@mui/material/Autocomplete'; export default function FreeSolo() { return ( <Stack spacing={2} sx={{ width: 300 }}> <Autocomplete id="free-solo-demo" freeSolo options={top100Films.map((option) => option.title)} renderInput={(params) => <TextField {...params} label="freeSolo" />} /> <Autocomplete freeSolo id="free-solo-2-demo" disableClearable options={top100Films.map((option) => option.title)} renderInput={(params) => ( <TextField {...params} label="Search input" InputProps={{ ...params.InputProps, type: 'search', }} /> )} /> </Stack> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,074
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/FreeSoloCreateOption.js
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete'; const filter = createFilterOptions(); export default function FreeSoloCreateOption() { const [value, setValue] = React.useState(null); return ( <Autocomplete value={value} onChange={(event, newValue) => { if (typeof newValue === 'string') { setValue({ title: newValue, }); } else if (newValue && newValue.inputValue) { // Create a new value from the user input setValue({ title: newValue.inputValue, }); } else { setValue(newValue); } }} filterOptions={(options, params) => { const filtered = filter(options, params); const { inputValue } = params; // Suggest the creation of a new value const isExisting = options.some((option) => inputValue === option.title); if (inputValue !== '' && !isExisting) { filtered.push({ inputValue, title: `Add "${inputValue}"`, }); } return filtered; }} selectOnFocus clearOnBlur handleHomeEndKeys id="free-solo-with-text-demo" options={top100Films} getOptionLabel={(option) => { // Value selected with enter, right from the input if (typeof option === 'string') { return option; } // Add "xxx" option created dynamically if (option.inputValue) { return option.inputValue; } // Regular option return option.title; }} renderOption={(props, option) => <li {...props}>{option.title}</li>} sx={{ width: 300 }} freeSolo renderInput={(params) => ( <TextField {...params} label="Free solo with text demo" /> )} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,075
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/FreeSoloCreateOption.tsx
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete'; const filter = createFilterOptions<FilmOptionType>(); export default function FreeSoloCreateOption() { const [value, setValue] = React.useState<FilmOptionType | null>(null); return ( <Autocomplete value={value} onChange={(event, newValue) => { if (typeof newValue === 'string') { setValue({ title: newValue, }); } else if (newValue && newValue.inputValue) { // Create a new value from the user input setValue({ title: newValue.inputValue, }); } else { setValue(newValue); } }} filterOptions={(options, params) => { const filtered = filter(options, params); const { inputValue } = params; // Suggest the creation of a new value const isExisting = options.some((option) => inputValue === option.title); if (inputValue !== '' && !isExisting) { filtered.push({ inputValue, title: `Add "${inputValue}"`, }); } return filtered; }} selectOnFocus clearOnBlur handleHomeEndKeys id="free-solo-with-text-demo" options={top100Films} getOptionLabel={(option) => { // Value selected with enter, right from the input if (typeof option === 'string') { return option; } // Add "xxx" option created dynamically if (option.inputValue) { return option.inputValue; } // Regular option return option.title; }} renderOption={(props, option) => <li {...props}>{option.title}</li>} sx={{ width: 300 }} freeSolo renderInput={(params) => ( <TextField {...params} label="Free solo with text demo" /> )} /> ); } interface FilmOptionType { inputValue?: string; title: string; year?: number; } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films: readonly FilmOptionType[] = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,076
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/FreeSoloCreateOptionDialog.js
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Dialog from '@mui/material/Dialog'; import DialogTitle from '@mui/material/DialogTitle'; import DialogContent from '@mui/material/DialogContent'; import DialogContentText from '@mui/material/DialogContentText'; import DialogActions from '@mui/material/DialogActions'; import Button from '@mui/material/Button'; import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete'; const filter = createFilterOptions(); export default function FreeSoloCreateOptionDialog() { const [value, setValue] = React.useState(null); const [open, toggleOpen] = React.useState(false); const handleClose = () => { setDialogValue({ title: '', year: '', }); toggleOpen(false); }; const [dialogValue, setDialogValue] = React.useState({ title: '', year: '', }); const handleSubmit = (event) => { event.preventDefault(); setValue({ title: dialogValue.title, year: parseInt(dialogValue.year, 10), }); handleClose(); }; return ( <React.Fragment> <Autocomplete value={value} onChange={(event, newValue) => { if (typeof newValue === 'string') { // timeout to avoid instant validation of the dialog's form. setTimeout(() => { toggleOpen(true); setDialogValue({ title: newValue, year: '', }); }); } else if (newValue && newValue.inputValue) { toggleOpen(true); setDialogValue({ title: newValue.inputValue, year: '', }); } else { setValue(newValue); } }} filterOptions={(options, params) => { const filtered = filter(options, params); if (params.inputValue !== '') { filtered.push({ inputValue: params.inputValue, title: `Add "${params.inputValue}"`, }); } return filtered; }} id="free-solo-dialog-demo" options={top100Films} getOptionLabel={(option) => { // e.g. value selected with enter, right from the input if (typeof option === 'string') { return option; } if (option.inputValue) { return option.inputValue; } return option.title; }} selectOnFocus clearOnBlur handleHomeEndKeys renderOption={(props, option) => <li {...props}>{option.title}</li>} sx={{ width: 300 }} freeSolo renderInput={(params) => <TextField {...params} label="Free solo dialog" />} /> <Dialog open={open} onClose={handleClose}> <form onSubmit={handleSubmit}> <DialogTitle>Add a new film</DialogTitle> <DialogContent> <DialogContentText> Did you miss any film in our list? Please, add it! </DialogContentText> <TextField autoFocus margin="dense" id="name" value={dialogValue.title} onChange={(event) => setDialogValue({ ...dialogValue, title: event.target.value, }) } label="title" type="text" variant="standard" /> <TextField margin="dense" id="name" value={dialogValue.year} onChange={(event) => setDialogValue({ ...dialogValue, year: event.target.value, }) } label="year" type="number" variant="standard" /> </DialogContent> <DialogActions> <Button onClick={handleClose}>Cancel</Button> <Button type="submit">Add</Button> </DialogActions> </form> </Dialog> </React.Fragment> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,077
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/FreeSoloCreateOptionDialog.tsx
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Dialog from '@mui/material/Dialog'; import DialogTitle from '@mui/material/DialogTitle'; import DialogContent from '@mui/material/DialogContent'; import DialogContentText from '@mui/material/DialogContentText'; import DialogActions from '@mui/material/DialogActions'; import Button from '@mui/material/Button'; import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete'; const filter = createFilterOptions<FilmOptionType>(); export default function FreeSoloCreateOptionDialog() { const [value, setValue] = React.useState<FilmOptionType | null>(null); const [open, toggleOpen] = React.useState(false); const handleClose = () => { setDialogValue({ title: '', year: '', }); toggleOpen(false); }; const [dialogValue, setDialogValue] = React.useState({ title: '', year: '', }); const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => { event.preventDefault(); setValue({ title: dialogValue.title, year: parseInt(dialogValue.year, 10), }); handleClose(); }; return ( <React.Fragment> <Autocomplete value={value} onChange={(event, newValue) => { if (typeof newValue === 'string') { // timeout to avoid instant validation of the dialog's form. setTimeout(() => { toggleOpen(true); setDialogValue({ title: newValue, year: '', }); }); } else if (newValue && newValue.inputValue) { toggleOpen(true); setDialogValue({ title: newValue.inputValue, year: '', }); } else { setValue(newValue); } }} filterOptions={(options, params) => { const filtered = filter(options, params); if (params.inputValue !== '') { filtered.push({ inputValue: params.inputValue, title: `Add "${params.inputValue}"`, }); } return filtered; }} id="free-solo-dialog-demo" options={top100Films} getOptionLabel={(option) => { // e.g. value selected with enter, right from the input if (typeof option === 'string') { return option; } if (option.inputValue) { return option.inputValue; } return option.title; }} selectOnFocus clearOnBlur handleHomeEndKeys renderOption={(props, option) => <li {...props}>{option.title}</li>} sx={{ width: 300 }} freeSolo renderInput={(params) => <TextField {...params} label="Free solo dialog" />} /> <Dialog open={open} onClose={handleClose}> <form onSubmit={handleSubmit}> <DialogTitle>Add a new film</DialogTitle> <DialogContent> <DialogContentText> Did you miss any film in our list? Please, add it! </DialogContentText> <TextField autoFocus margin="dense" id="name" value={dialogValue.title} onChange={(event) => setDialogValue({ ...dialogValue, title: event.target.value, }) } label="title" type="text" variant="standard" /> <TextField margin="dense" id="name" value={dialogValue.year} onChange={(event) => setDialogValue({ ...dialogValue, year: event.target.value, }) } label="year" type="number" variant="standard" /> </DialogContent> <DialogActions> <Button onClick={handleClose}>Cancel</Button> <Button type="submit">Add</Button> </DialogActions> </form> </Dialog> </React.Fragment> ); } interface FilmOptionType { inputValue?: string; title: string; year?: number; } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films: readonly FilmOptionType[] = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,078
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/GitHubLabel.js
import * as React from 'react'; import PropTypes from 'prop-types'; import { useTheme, styled } from '@mui/material/styles'; import Popper from '@mui/material/Popper'; import ClickAwayListener from '@mui/material/ClickAwayListener'; import SettingsIcon from '@mui/icons-material/Settings'; import CloseIcon from '@mui/icons-material/Close'; import DoneIcon from '@mui/icons-material/Done'; import Autocomplete, { autocompleteClasses } from '@mui/material/Autocomplete'; import ButtonBase from '@mui/material/ButtonBase'; import InputBase from '@mui/material/InputBase'; import Box from '@mui/material/Box'; const StyledAutocompletePopper = styled('div')(({ theme }) => ({ [`& .${autocompleteClasses.paper}`]: { boxShadow: 'none', margin: 0, color: 'inherit', fontSize: 13, }, [`& .${autocompleteClasses.listbox}`]: { backgroundColor: theme.palette.mode === 'light' ? '#fff' : '#1c2128', padding: 0, [`& .${autocompleteClasses.option}`]: { minHeight: 'auto', alignItems: 'flex-start', padding: 8, borderBottom: `1px solid ${ theme.palette.mode === 'light' ? ' #eaecef' : '#30363d' }`, '&[aria-selected="true"]': { backgroundColor: 'transparent', }, [`&.${autocompleteClasses.focused}, &.${autocompleteClasses.focused}[aria-selected="true"]`]: { backgroundColor: theme.palette.action.hover, }, }, }, [`&.${autocompleteClasses.popperDisablePortal}`]: { position: 'relative', }, })); function PopperComponent(props) { const { disablePortal, anchorEl, open, ...other } = props; return <StyledAutocompletePopper {...other} />; } PopperComponent.propTypes = { anchorEl: PropTypes.any, disablePortal: PropTypes.bool, open: PropTypes.bool.isRequired, }; const StyledPopper = styled(Popper)(({ theme }) => ({ border: `1px solid ${theme.palette.mode === 'light' ? '#e1e4e8' : '#30363d'}`, boxShadow: `0 8px 24px ${ theme.palette.mode === 'light' ? 'rgba(149, 157, 165, 0.2)' : 'rgb(1, 4, 9)' }`, borderRadius: 6, width: 300, zIndex: theme.zIndex.modal, fontSize: 13, color: theme.palette.mode === 'light' ? '#24292e' : '#c9d1d9', backgroundColor: theme.palette.mode === 'light' ? '#fff' : '#1c2128', })); const StyledInput = styled(InputBase)(({ theme }) => ({ padding: 10, width: '100%', borderBottom: `1px solid ${ theme.palette.mode === 'light' ? '#eaecef' : '#30363d' }`, '& input': { borderRadius: 4, backgroundColor: theme.palette.mode === 'light' ? '#fff' : '#0d1117', padding: 8, transition: theme.transitions.create(['border-color', 'box-shadow']), border: `1px solid ${theme.palette.mode === 'light' ? '#eaecef' : '#30363d'}`, fontSize: 14, '&:focus': { boxShadow: `0px 0px 0px 3px ${ theme.palette.mode === 'light' ? 'rgba(3, 102, 214, 0.3)' : 'rgb(12, 45, 107)' }`, borderColor: theme.palette.mode === 'light' ? '#0366d6' : '#388bfd', }, }, })); const Button = styled(ButtonBase)(({ theme }) => ({ fontSize: 13, width: '100%', textAlign: 'left', paddingBottom: 8, color: theme.palette.mode === 'light' ? '#586069' : '#8b949e', fontWeight: 600, '&:hover,&:focus': { color: theme.palette.mode === 'light' ? '#0366d6' : '#58a6ff', }, '& span': { width: '100%', }, '& svg': { width: 16, height: 16, }, })); export default function GitHubLabel() { const [anchorEl, setAnchorEl] = React.useState(null); const [value, setValue] = React.useState([labels[1], labels[11]]); const [pendingValue, setPendingValue] = React.useState([]); const theme = useTheme(); const handleClick = (event) => { setPendingValue(value); setAnchorEl(event.currentTarget); }; const handleClose = () => { setValue(pendingValue); if (anchorEl) { anchorEl.focus(); } setAnchorEl(null); }; const open = Boolean(anchorEl); const id = open ? 'github-label' : undefined; return ( <React.Fragment> <Box sx={{ width: 221, fontSize: 13 }}> <Button disableRipple aria-describedby={id} onClick={handleClick}> <span>Labels</span> <SettingsIcon /> </Button> {value.map((label) => ( <Box key={label.name} sx={{ mt: '3px', height: 20, padding: '.15em 4px', fontWeight: 600, lineHeight: '15px', borderRadius: '2px', }} style={{ backgroundColor: label.color, color: theme.palette.getContrastText(label.color), }} > {label.name} </Box> ))} </Box> <StyledPopper id={id} open={open} anchorEl={anchorEl} placement="bottom-start"> <ClickAwayListener onClickAway={handleClose}> <div> <Box sx={{ borderBottom: `1px solid ${ theme.palette.mode === 'light' ? '#eaecef' : '#30363d' }`, padding: '8px 10px', fontWeight: 600, }} > Apply labels to this pull request </Box> <Autocomplete open multiple onClose={(event, reason) => { if (reason === 'escape') { handleClose(); } }} value={pendingValue} onChange={(event, newValue, reason) => { if ( event.type === 'keydown' && event.key === 'Backspace' && reason === 'removeOption' ) { return; } setPendingValue(newValue); }} disableCloseOnSelect PopperComponent={PopperComponent} renderTags={() => null} noOptionsText="No labels" renderOption={(props, option, { selected }) => ( <li {...props}> <Box component={DoneIcon} sx={{ width: 17, height: 17, mr: '5px', ml: '-2px' }} style={{ visibility: selected ? 'visible' : 'hidden', }} /> <Box component="span" sx={{ width: 14, height: 14, flexShrink: 0, borderRadius: '3px', mr: 1, mt: '2px', }} style={{ backgroundColor: option.color }} /> <Box sx={{ flexGrow: 1, '& span': { color: theme.palette.mode === 'light' ? '#586069' : '#8b949e', }, }} > {option.name} <br /> <span>{option.description}</span> </Box> <Box component={CloseIcon} sx={{ opacity: 0.6, width: 18, height: 18 }} style={{ visibility: selected ? 'visible' : 'hidden', }} /> </li> )} options={[...labels].sort((a, b) => { // Display the selected labels first. let ai = value.indexOf(a); ai = ai === -1 ? value.length + labels.indexOf(a) : ai; let bi = value.indexOf(b); bi = bi === -1 ? value.length + labels.indexOf(b) : bi; return ai - bi; })} getOptionLabel={(option) => option.name} renderInput={(params) => ( <StyledInput ref={params.InputProps.ref} inputProps={params.inputProps} autoFocus placeholder="Filter labels" /> )} /> </div> </ClickAwayListener> </StyledPopper> </React.Fragment> ); } // From https://github.com/abdonrd/github-labels const labels = [ { name: 'good first issue', color: '#7057ff', description: 'Good for newcomers', }, { name: 'help wanted', color: '#008672', description: 'Extra attention is needed', }, { name: 'priority: critical', color: '#b60205', description: '', }, { name: 'priority: high', color: '#d93f0b', description: '', }, { name: 'priority: low', color: '#0e8a16', description: '', }, { name: 'priority: medium', color: '#fbca04', description: '', }, { name: "status: can't reproduce", color: '#fec1c1', description: '', }, { name: 'status: confirmed', color: '#215cea', description: '', }, { name: 'status: duplicate', color: '#cfd3d7', description: 'This issue or pull request already exists', }, { name: 'status: needs information', color: '#fef2c0', description: '', }, { name: 'status: wont do/fix', color: '#eeeeee', description: 'This will not be worked on', }, { name: 'type: bug', color: '#d73a4a', description: "Something isn't working", }, { name: 'type: discussion', color: '#d4c5f9', description: '', }, { name: 'type: documentation', color: '#006b75', description: '', }, { name: 'type: enhancement', color: '#84b6eb', description: '', }, { name: 'type: epic', color: '#3e4b9e', description: 'A theme of work that contain sub-tasks', }, { name: 'type: feature request', color: '#fbca04', description: 'New feature or request', }, { name: 'type: question', color: '#d876e3', description: 'Further information is requested', }, ];
2,079
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/GitHubLabel.tsx
import * as React from 'react'; import { useTheme, styled } from '@mui/material/styles'; import Popper from '@mui/material/Popper'; import ClickAwayListener from '@mui/material/ClickAwayListener'; import SettingsIcon from '@mui/icons-material/Settings'; import CloseIcon from '@mui/icons-material/Close'; import DoneIcon from '@mui/icons-material/Done'; import Autocomplete, { AutocompleteCloseReason, autocompleteClasses, } from '@mui/material/Autocomplete'; import ButtonBase from '@mui/material/ButtonBase'; import InputBase from '@mui/material/InputBase'; import Box from '@mui/material/Box'; interface PopperComponentProps { anchorEl?: any; disablePortal?: boolean; open: boolean; } const StyledAutocompletePopper = styled('div')(({ theme }) => ({ [`& .${autocompleteClasses.paper}`]: { boxShadow: 'none', margin: 0, color: 'inherit', fontSize: 13, }, [`& .${autocompleteClasses.listbox}`]: { backgroundColor: theme.palette.mode === 'light' ? '#fff' : '#1c2128', padding: 0, [`& .${autocompleteClasses.option}`]: { minHeight: 'auto', alignItems: 'flex-start', padding: 8, borderBottom: `1px solid ${ theme.palette.mode === 'light' ? ' #eaecef' : '#30363d' }`, '&[aria-selected="true"]': { backgroundColor: 'transparent', }, [`&.${autocompleteClasses.focused}, &.${autocompleteClasses.focused}[aria-selected="true"]`]: { backgroundColor: theme.palette.action.hover, }, }, }, [`&.${autocompleteClasses.popperDisablePortal}`]: { position: 'relative', }, })); function PopperComponent(props: PopperComponentProps) { const { disablePortal, anchorEl, open, ...other } = props; return <StyledAutocompletePopper {...other} />; } const StyledPopper = styled(Popper)(({ theme }) => ({ border: `1px solid ${theme.palette.mode === 'light' ? '#e1e4e8' : '#30363d'}`, boxShadow: `0 8px 24px ${ theme.palette.mode === 'light' ? 'rgba(149, 157, 165, 0.2)' : 'rgb(1, 4, 9)' }`, borderRadius: 6, width: 300, zIndex: theme.zIndex.modal, fontSize: 13, color: theme.palette.mode === 'light' ? '#24292e' : '#c9d1d9', backgroundColor: theme.palette.mode === 'light' ? '#fff' : '#1c2128', })); const StyledInput = styled(InputBase)(({ theme }) => ({ padding: 10, width: '100%', borderBottom: `1px solid ${ theme.palette.mode === 'light' ? '#eaecef' : '#30363d' }`, '& input': { borderRadius: 4, backgroundColor: theme.palette.mode === 'light' ? '#fff' : '#0d1117', padding: 8, transition: theme.transitions.create(['border-color', 'box-shadow']), border: `1px solid ${theme.palette.mode === 'light' ? '#eaecef' : '#30363d'}`, fontSize: 14, '&:focus': { boxShadow: `0px 0px 0px 3px ${ theme.palette.mode === 'light' ? 'rgba(3, 102, 214, 0.3)' : 'rgb(12, 45, 107)' }`, borderColor: theme.palette.mode === 'light' ? '#0366d6' : '#388bfd', }, }, })); const Button = styled(ButtonBase)(({ theme }) => ({ fontSize: 13, width: '100%', textAlign: 'left', paddingBottom: 8, color: theme.palette.mode === 'light' ? '#586069' : '#8b949e', fontWeight: 600, '&:hover,&:focus': { color: theme.palette.mode === 'light' ? '#0366d6' : '#58a6ff', }, '& span': { width: '100%', }, '& svg': { width: 16, height: 16, }, })); export default function GitHubLabel() { const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null); const [value, setValue] = React.useState<LabelType[]>([labels[1], labels[11]]); const [pendingValue, setPendingValue] = React.useState<LabelType[]>([]); const theme = useTheme(); const handleClick = (event: React.MouseEvent<HTMLElement>) => { setPendingValue(value); setAnchorEl(event.currentTarget); }; const handleClose = () => { setValue(pendingValue); if (anchorEl) { anchorEl.focus(); } setAnchorEl(null); }; const open = Boolean(anchorEl); const id = open ? 'github-label' : undefined; return ( <React.Fragment> <Box sx={{ width: 221, fontSize: 13 }}> <Button disableRipple aria-describedby={id} onClick={handleClick}> <span>Labels</span> <SettingsIcon /> </Button> {value.map((label) => ( <Box key={label.name} sx={{ mt: '3px', height: 20, padding: '.15em 4px', fontWeight: 600, lineHeight: '15px', borderRadius: '2px', }} style={{ backgroundColor: label.color, color: theme.palette.getContrastText(label.color), }} > {label.name} </Box> ))} </Box> <StyledPopper id={id} open={open} anchorEl={anchorEl} placement="bottom-start"> <ClickAwayListener onClickAway={handleClose}> <div> <Box sx={{ borderBottom: `1px solid ${ theme.palette.mode === 'light' ? '#eaecef' : '#30363d' }`, padding: '8px 10px', fontWeight: 600, }} > Apply labels to this pull request </Box> <Autocomplete open multiple onClose={( event: React.ChangeEvent<{}>, reason: AutocompleteCloseReason, ) => { if (reason === 'escape') { handleClose(); } }} value={pendingValue} onChange={(event, newValue, reason) => { if ( event.type === 'keydown' && (event as React.KeyboardEvent).key === 'Backspace' && reason === 'removeOption' ) { return; } setPendingValue(newValue); }} disableCloseOnSelect PopperComponent={PopperComponent} renderTags={() => null} noOptionsText="No labels" renderOption={(props, option, { selected }) => ( <li {...props}> <Box component={DoneIcon} sx={{ width: 17, height: 17, mr: '5px', ml: '-2px' }} style={{ visibility: selected ? 'visible' : 'hidden', }} /> <Box component="span" sx={{ width: 14, height: 14, flexShrink: 0, borderRadius: '3px', mr: 1, mt: '2px', }} style={{ backgroundColor: option.color }} /> <Box sx={{ flexGrow: 1, '& span': { color: theme.palette.mode === 'light' ? '#586069' : '#8b949e', }, }} > {option.name} <br /> <span>{option.description}</span> </Box> <Box component={CloseIcon} sx={{ opacity: 0.6, width: 18, height: 18 }} style={{ visibility: selected ? 'visible' : 'hidden', }} /> </li> )} options={[...labels].sort((a, b) => { // Display the selected labels first. let ai = value.indexOf(a); ai = ai === -1 ? value.length + labels.indexOf(a) : ai; let bi = value.indexOf(b); bi = bi === -1 ? value.length + labels.indexOf(b) : bi; return ai - bi; })} getOptionLabel={(option) => option.name} renderInput={(params) => ( <StyledInput ref={params.InputProps.ref} inputProps={params.inputProps} autoFocus placeholder="Filter labels" /> )} /> </div> </ClickAwayListener> </StyledPopper> </React.Fragment> ); } interface LabelType { name: string; color: string; description?: string; } // From https://github.com/abdonrd/github-labels const labels = [ { name: 'good first issue', color: '#7057ff', description: 'Good for newcomers', }, { name: 'help wanted', color: '#008672', description: 'Extra attention is needed', }, { name: 'priority: critical', color: '#b60205', description: '', }, { name: 'priority: high', color: '#d93f0b', description: '', }, { name: 'priority: low', color: '#0e8a16', description: '', }, { name: 'priority: medium', color: '#fbca04', description: '', }, { name: "status: can't reproduce", color: '#fec1c1', description: '', }, { name: 'status: confirmed', color: '#215cea', description: '', }, { name: 'status: duplicate', color: '#cfd3d7', description: 'This issue or pull request already exists', }, { name: 'status: needs information', color: '#fef2c0', description: '', }, { name: 'status: wont do/fix', color: '#eeeeee', description: 'This will not be worked on', }, { name: 'type: bug', color: '#d73a4a', description: "Something isn't working", }, { name: 'type: discussion', color: '#d4c5f9', description: '', }, { name: 'type: documentation', color: '#006b75', description: '', }, { name: 'type: enhancement', color: '#84b6eb', description: '', }, { name: 'type: epic', color: '#3e4b9e', description: 'A theme of work that contain sub-tasks', }, { name: 'type: feature request', color: '#fbca04', description: 'New feature or request', }, { name: 'type: question', color: '#d876e3', description: 'Further information is requested', }, ];
2,080
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/GloballyCustomizedOptions.js
import * as React from 'react'; import Autocomplete, { autocompleteClasses } from '@mui/material/Autocomplete'; import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; import TextField from '@mui/material/TextField'; import { createTheme, useTheme, ThemeProvider } from '@mui/material/styles'; // Theme.ts const customTheme = (outerTheme) => createTheme({ palette: { mode: outerTheme.palette.mode, }, components: { MuiAutocomplete: { defaultProps: { renderOption: (props, option, state, ownerState) => ( <Box sx={{ borderRadius: '8px', margin: '5px', [`&.${autocompleteClasses.option}`]: { padding: '8px', }, }} component="li" {...props} > {ownerState.getOptionLabel(option)} </Box> ), }, }, }, }); export default function GloballyCustomizedOptions() { // useTheme is used to determine the dark or light mode of the docs to maintain the Autocomplete component default styles. const outerTheme = useTheme(); return ( <ThemeProvider theme={customTheme(outerTheme)}> <Stack spacing={5} sx={{ width: 300 }}> <MovieSelect /> <CountrySelect /> </Stack> </ThemeProvider> ); } function MovieSelect() { return ( <Autocomplete options={top100Films} getOptionLabel={(option) => `${option.title} (${option.year})`} id="movie-customized-option-demo" disableCloseOnSelect renderInput={(params) => ( <TextField {...params} label="Choose a movie" variant="standard" /> )} /> ); } function CountrySelect() { return ( <Autocomplete id="country-customized-option-demo" options={countries} disableCloseOnSelect getOptionLabel={(option) => `${option.label} (${option.code}) +${option.phone}` } renderInput={(params) => <TextField {...params} label="Choose a country" />} /> ); } // From https://bitbucket.org/atlassian/atlaskit-mk-2/raw/4ad0e56649c3e6c973e226b7efaeb28cb240ccb0/packages/core/select/src/data/countries.js const countries = [ { 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' }, ]; // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,081
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/GloballyCustomizedOptions.tsx
import * as React from 'react'; import Autocomplete, { autocompleteClasses } from '@mui/material/Autocomplete'; import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; import TextField from '@mui/material/TextField'; import { createTheme, useTheme, ThemeProvider, Theme } from '@mui/material/styles'; // Theme.ts const customTheme = (outerTheme: Theme) => createTheme({ palette: { mode: outerTheme.palette.mode, }, components: { MuiAutocomplete: { defaultProps: { renderOption: (props, option, state, ownerState) => ( <Box sx={{ borderRadius: '8px', margin: '5px', [`&.${autocompleteClasses.option}`]: { padding: '8px', }, }} component="li" {...props} > {ownerState.getOptionLabel(option)} </Box> ), }, }, }, }); export default function GloballyCustomizedOptions() { // useTheme is used to determine the dark or light mode of the docs to maintain the Autocomplete component default styles. const outerTheme = useTheme(); return ( <ThemeProvider theme={customTheme(outerTheme)}> <Stack spacing={5} sx={{ width: 300 }}> <MovieSelect /> <CountrySelect /> </Stack> </ThemeProvider> ); } function MovieSelect() { return ( <Autocomplete options={top100Films} getOptionLabel={(option: FilmOptionType) => `${option.title} (${option.year})`} id="movie-customized-option-demo" disableCloseOnSelect renderInput={(params) => ( <TextField {...params} label="Choose a movie" variant="standard" /> )} /> ); } function CountrySelect() { return ( <Autocomplete id="country-customized-option-demo" options={countries} disableCloseOnSelect getOptionLabel={(option: CountryType) => `${option.label} (${option.code}) +${option.phone}` } renderInput={(params) => <TextField {...params} label="Choose a country" />} /> ); } 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' }, ]; interface FilmOptionType { title: string; year: number; } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,082
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/GloballyCustomizedOptions.tsx.preview
<ThemeProvider theme={customTheme(outerTheme)}> <Stack spacing={5} sx={{ width: 300 }}> <MovieSelect /> <CountrySelect /> </Stack> </ThemeProvider>
2,083
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/GoogleMaps.js
import * as React from 'react'; import Box from '@mui/material/Box'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import LocationOnIcon from '@mui/icons-material/LocationOn'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import parse from 'autosuggest-highlight/parse'; import { debounce } from '@mui/material/utils'; // This key was created specifically for the demo in mui.com. // You need to create a new one for your application. const GOOGLE_MAPS_API_KEY = 'AIzaSyC3aviU6KHXAjoSnxcw6qbOhjnFctbxPkE'; function loadScript(src, position, id) { if (!position) { return; } const script = document.createElement('script'); script.setAttribute('async', ''); script.setAttribute('id', id); script.src = src; position.appendChild(script); } const autocompleteService = { current: null }; export default function GoogleMaps() { const [value, setValue] = React.useState(null); const [inputValue, setInputValue] = React.useState(''); const [options, setOptions] = React.useState([]); const loaded = React.useRef(false); if (typeof window !== 'undefined' && !loaded.current) { if (!document.querySelector('#google-maps')) { loadScript( `https://maps.googleapis.com/maps/api/js?key=${GOOGLE_MAPS_API_KEY}&libraries=places`, document.querySelector('head'), 'google-maps', ); } loaded.current = true; } const fetch = React.useMemo( () => debounce((request, callback) => { autocompleteService.current.getPlacePredictions(request, callback); }, 400), [], ); React.useEffect(() => { let active = true; if (!autocompleteService.current && window.google) { autocompleteService.current = new window.google.maps.places.AutocompleteService(); } if (!autocompleteService.current) { return undefined; } if (inputValue === '') { setOptions(value ? [value] : []); return undefined; } fetch({ input: inputValue }, (results) => { if (active) { let newOptions = []; if (value) { newOptions = [value]; } if (results) { newOptions = [...newOptions, ...results]; } setOptions(newOptions); } }); return () => { active = false; }; }, [value, inputValue, fetch]); return ( <Autocomplete id="google-map-demo" sx={{ width: 300 }} getOptionLabel={(option) => typeof option === 'string' ? option : option.description } filterOptions={(x) => x} options={options} autoComplete includeInputInList filterSelectedOptions value={value} noOptionsText="No locations" onChange={(event, newValue) => { setOptions(newValue ? [newValue, ...options] : options); setValue(newValue); }} onInputChange={(event, newInputValue) => { setInputValue(newInputValue); }} renderInput={(params) => ( <TextField {...params} label="Add a location" fullWidth /> )} renderOption={(props, option) => { const matches = option.structured_formatting.main_text_matched_substrings || []; const parts = parse( option.structured_formatting.main_text, matches.map((match) => [match.offset, match.offset + match.length]), ); return ( <li {...props}> <Grid container alignItems="center"> <Grid item sx={{ display: 'flex', width: 44 }}> <LocationOnIcon sx={{ color: 'text.secondary' }} /> </Grid> <Grid item sx={{ width: 'calc(100% - 44px)', wordWrap: 'break-word' }}> {parts.map((part, index) => ( <Box key={index} component="span" sx={{ fontWeight: part.highlight ? 'bold' : 'regular' }} > {part.text} </Box> ))} <Typography variant="body2" color="text.secondary"> {option.structured_formatting.secondary_text} </Typography> </Grid> </Grid> </li> ); }} /> ); }
2,084
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/GoogleMaps.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import LocationOnIcon from '@mui/icons-material/LocationOn'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import parse from 'autosuggest-highlight/parse'; import { debounce } from '@mui/material/utils'; // This key was created specifically for the demo in mui.com. // You need to create a new one for your application. const GOOGLE_MAPS_API_KEY = 'AIzaSyC3aviU6KHXAjoSnxcw6qbOhjnFctbxPkE'; function loadScript(src: string, position: HTMLElement | null, id: string) { if (!position) { return; } const script = document.createElement('script'); script.setAttribute('async', ''); script.setAttribute('id', id); script.src = src; position.appendChild(script); } const autocompleteService = { current: null }; interface MainTextMatchedSubstrings { offset: number; length: number; } interface StructuredFormatting { main_text: string; secondary_text: string; main_text_matched_substrings?: readonly MainTextMatchedSubstrings[]; } interface PlaceType { description: string; structured_formatting: StructuredFormatting; } export default function GoogleMaps() { const [value, setValue] = React.useState<PlaceType | null>(null); const [inputValue, setInputValue] = React.useState(''); const [options, setOptions] = React.useState<readonly PlaceType[]>([]); const loaded = React.useRef(false); if (typeof window !== 'undefined' && !loaded.current) { if (!document.querySelector('#google-maps')) { loadScript( `https://maps.googleapis.com/maps/api/js?key=${GOOGLE_MAPS_API_KEY}&libraries=places`, document.querySelector('head'), 'google-maps', ); } loaded.current = true; } const fetch = React.useMemo( () => debounce( ( request: { input: string }, callback: (results?: readonly PlaceType[]) => void, ) => { (autocompleteService.current as any).getPlacePredictions( request, callback, ); }, 400, ), [], ); React.useEffect(() => { let active = true; if (!autocompleteService.current && (window as any).google) { autocompleteService.current = new ( window as any ).google.maps.places.AutocompleteService(); } if (!autocompleteService.current) { return undefined; } if (inputValue === '') { setOptions(value ? [value] : []); return undefined; } fetch({ input: inputValue }, (results?: readonly PlaceType[]) => { if (active) { let newOptions: readonly PlaceType[] = []; if (value) { newOptions = [value]; } if (results) { newOptions = [...newOptions, ...results]; } setOptions(newOptions); } }); return () => { active = false; }; }, [value, inputValue, fetch]); return ( <Autocomplete id="google-map-demo" sx={{ width: 300 }} getOptionLabel={(option) => typeof option === 'string' ? option : option.description } filterOptions={(x) => x} options={options} autoComplete includeInputInList filterSelectedOptions value={value} noOptionsText="No locations" onChange={(event: any, newValue: PlaceType | null) => { setOptions(newValue ? [newValue, ...options] : options); setValue(newValue); }} onInputChange={(event, newInputValue) => { setInputValue(newInputValue); }} renderInput={(params) => ( <TextField {...params} label="Add a location" fullWidth /> )} renderOption={(props, option) => { const matches = option.structured_formatting.main_text_matched_substrings || []; const parts = parse( option.structured_formatting.main_text, matches.map((match: any) => [match.offset, match.offset + match.length]), ); return ( <li {...props}> <Grid container alignItems="center"> <Grid item sx={{ display: 'flex', width: 44 }}> <LocationOnIcon sx={{ color: 'text.secondary' }} /> </Grid> <Grid item sx={{ width: 'calc(100% - 44px)', wordWrap: 'break-word' }}> {parts.map((part, index) => ( <Box key={index} component="span" sx={{ fontWeight: part.highlight ? 'bold' : 'regular' }} > {part.text} </Box> ))} <Typography variant="body2" color="text.secondary"> {option.structured_formatting.secondary_text} </Typography> </Grid> </Grid> </li> ); }} /> ); }
2,085
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/Grouped.js
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; export default function Grouped() { const options = top100Films.map((option) => { const firstLetter = option.title[0].toUpperCase(); return { firstLetter: /[0-9]/.test(firstLetter) ? '0-9' : firstLetter, ...option, }; }); return ( <Autocomplete id="grouped-demo" options={options.sort((a, b) => -b.firstLetter.localeCompare(a.firstLetter))} groupBy={(option) => option.firstLetter} getOptionLabel={(option) => option.title} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="With categories" />} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,086
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/Grouped.tsx
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; export default function Grouped() { const options = top100Films.map((option) => { const firstLetter = option.title[0].toUpperCase(); return { firstLetter: /[0-9]/.test(firstLetter) ? '0-9' : firstLetter, ...option, }; }); return ( <Autocomplete id="grouped-demo" options={options.sort((a, b) => -b.firstLetter.localeCompare(a.firstLetter))} groupBy={(option) => option.firstLetter} getOptionLabel={(option) => option.title} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="With categories" />} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,087
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/Grouped.tsx.preview
<Autocomplete id="grouped-demo" options={options.sort((a, b) => -b.firstLetter.localeCompare(a.firstLetter))} groupBy={(option) => option.firstLetter} getOptionLabel={(option) => option.title} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="With categories" />} />
2,088
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/Highlights.js
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import parse from 'autosuggest-highlight/parse'; import match from 'autosuggest-highlight/match'; export default function Highlights() { return ( <Autocomplete id="highlights-demo" sx={{ width: 300 }} options={top100Films} getOptionLabel={(option) => option.title} renderInput={(params) => ( <TextField {...params} label="Highlights" margin="normal" /> )} renderOption={(props, option, { inputValue }) => { const matches = match(option.title, inputValue, { insideWords: true }); const parts = parse(option.title, matches); return ( <li {...props}> <div> {parts.map((part, index) => ( <span key={index} style={{ fontWeight: part.highlight ? 700 : 400, }} > {part.text} </span> ))} </div> </li> ); }} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,089
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/Highlights.tsx
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import parse from 'autosuggest-highlight/parse'; import match from 'autosuggest-highlight/match'; export default function Highlights() { return ( <Autocomplete id="highlights-demo" sx={{ width: 300 }} options={top100Films} getOptionLabel={(option) => option.title} renderInput={(params) => ( <TextField {...params} label="Highlights" margin="normal" /> )} renderOption={(props, option, { inputValue }) => { const matches = match(option.title, inputValue, { insideWords: true }); const parts = parse(option.title, matches); return ( <li {...props}> <div> {parts.map((part, index) => ( <span key={index} style={{ fontWeight: part.highlight ? 700 : 400, }} > {part.text} </span> ))} </div> </li> ); }} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,090
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/LimitTags.js
import * as React from 'react'; import Autocomplete from '@mui/material/Autocomplete'; import TextField from '@mui/material/TextField'; export default function LimitTags() { return ( <Autocomplete multiple limitTags={2} id="multiple-limit-tags" options={top100Films} getOptionLabel={(option) => option.title} defaultValue={[top100Films[13], top100Films[12], top100Films[11]]} renderInput={(params) => ( <TextField {...params} label="limitTags" placeholder="Favorites" /> )} sx={{ width: '500px' }} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,091
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/LimitTags.tsx
import * as React from 'react'; import Autocomplete from '@mui/material/Autocomplete'; import TextField from '@mui/material/TextField'; export default function LimitTags() { return ( <Autocomplete multiple limitTags={2} id="multiple-limit-tags" options={top100Films} getOptionLabel={(option) => option.title} defaultValue={[top100Films[13], top100Films[12], top100Films[11]]} renderInput={(params) => ( <TextField {...params} label="limitTags" placeholder="Favorites" /> )} sx={{ width: '500px' }} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,092
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/LimitTags.tsx.preview
<Autocomplete multiple limitTags={2} id="multiple-limit-tags" options={top100Films} getOptionLabel={(option) => option.title} defaultValue={[top100Films[13], top100Films[12], top100Films[11]]} renderInput={(params) => ( <TextField {...params} label="limitTags" placeholder="Favorites" /> )} sx={{ width: '500px' }} />
2,093
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/Playground.js
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import Stack from '@mui/material/Stack'; export default function Playground() { const defaultProps = { options: top100Films, getOptionLabel: (option) => option.title, }; const flatProps = { options: top100Films.map((option) => option.title), }; const [value, setValue] = React.useState(null); return ( <Stack spacing={1} sx={{ width: 300 }}> <Autocomplete {...defaultProps} id="disable-close-on-select" disableCloseOnSelect renderInput={(params) => ( <TextField {...params} label="disableCloseOnSelect" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="clear-on-escape" clearOnEscape renderInput={(params) => ( <TextField {...params} label="clearOnEscape" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="disable-clearable" disableClearable renderInput={(params) => ( <TextField {...params} label="disableClearable" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="include-input-in-list" includeInputInList renderInput={(params) => ( <TextField {...params} label="includeInputInList" variant="standard" /> )} /> <Autocomplete {...flatProps} id="flat-demo" renderInput={(params) => ( <TextField {...params} label="flat" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="controlled-demo" value={value} onChange={(event, newValue) => { setValue(newValue); }} renderInput={(params) => ( <TextField {...params} label="controlled" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="auto-complete" autoComplete includeInputInList renderInput={(params) => ( <TextField {...params} label="autoComplete" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="disable-list-wrap" disableListWrap renderInput={(params) => ( <TextField {...params} label="disableListWrap" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="open-on-focus" openOnFocus renderInput={(params) => ( <TextField {...params} label="openOnFocus" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="auto-highlight" autoHighlight renderInput={(params) => ( <TextField {...params} label="autoHighlight" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="auto-select" autoSelect renderInput={(params) => ( <TextField {...params} label="autoSelect" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="disabled" disabled renderInput={(params) => ( <TextField {...params} label="disabled" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="disable-portal" disablePortal renderInput={(params) => ( <TextField {...params} label="disablePortal" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="blur-on-select" blurOnSelect renderInput={(params) => ( <TextField {...params} label="blurOnSelect" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="clear-on-blur" clearOnBlur renderInput={(params) => ( <TextField {...params} label="clearOnBlur" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="select-on-focus" selectOnFocus renderInput={(params) => ( <TextField {...params} label="selectOnFocus" variant="standard" /> )} /> <Autocomplete {...flatProps} id="readOnly" readOnly defaultValue={flatProps.options[13]} renderInput={(params) => ( <TextField {...params} label="readOnly" variant="standard" /> )} /> </Stack> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,094
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/Playground.tsx
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import Stack from '@mui/material/Stack'; export default function Playground() { const defaultProps = { options: top100Films, getOptionLabel: (option: FilmOptionType) => option.title, }; const flatProps = { options: top100Films.map((option) => option.title), }; const [value, setValue] = React.useState<FilmOptionType | null>(null); return ( <Stack spacing={1} sx={{ width: 300 }}> <Autocomplete {...defaultProps} id="disable-close-on-select" disableCloseOnSelect renderInput={(params) => ( <TextField {...params} label="disableCloseOnSelect" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="clear-on-escape" clearOnEscape renderInput={(params) => ( <TextField {...params} label="clearOnEscape" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="disable-clearable" disableClearable renderInput={(params) => ( <TextField {...params} label="disableClearable" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="include-input-in-list" includeInputInList renderInput={(params) => ( <TextField {...params} label="includeInputInList" variant="standard" /> )} /> <Autocomplete {...flatProps} id="flat-demo" renderInput={(params) => ( <TextField {...params} label="flat" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="controlled-demo" value={value} onChange={(event: any, newValue: FilmOptionType | null) => { setValue(newValue); }} renderInput={(params) => ( <TextField {...params} label="controlled" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="auto-complete" autoComplete includeInputInList renderInput={(params) => ( <TextField {...params} label="autoComplete" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="disable-list-wrap" disableListWrap renderInput={(params) => ( <TextField {...params} label="disableListWrap" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="open-on-focus" openOnFocus renderInput={(params) => ( <TextField {...params} label="openOnFocus" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="auto-highlight" autoHighlight renderInput={(params) => ( <TextField {...params} label="autoHighlight" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="auto-select" autoSelect renderInput={(params) => ( <TextField {...params} label="autoSelect" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="disabled" disabled renderInput={(params) => ( <TextField {...params} label="disabled" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="disable-portal" disablePortal renderInput={(params) => ( <TextField {...params} label="disablePortal" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="blur-on-select" blurOnSelect renderInput={(params) => ( <TextField {...params} label="blurOnSelect" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="clear-on-blur" clearOnBlur renderInput={(params) => ( <TextField {...params} label="clearOnBlur" variant="standard" /> )} /> <Autocomplete {...defaultProps} id="select-on-focus" selectOnFocus renderInput={(params) => ( <TextField {...params} label="selectOnFocus" variant="standard" /> )} /> <Autocomplete {...flatProps} id="readOnly" readOnly defaultValue={flatProps.options[13]} renderInput={(params) => ( <TextField {...params} label="readOnly" variant="standard" /> )} /> </Stack> ); } interface FilmOptionType { title: string; year: number; } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,095
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/RenderGroup.js
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import { styled, lighten, darken } from '@mui/system'; const GroupHeader = styled('div')(({ theme }) => ({ position: 'sticky', top: '-8px', padding: '4px 10px', color: theme.palette.primary.main, backgroundColor: theme.palette.mode === 'light' ? lighten(theme.palette.primary.light, 0.85) : darken(theme.palette.primary.main, 0.8), })); const GroupItems = styled('ul')({ padding: 0, }); export default function RenderGroup() { const options = top100Films.map((option) => { const firstLetter = option.title[0].toUpperCase(); return { firstLetter: /[0-9]/.test(firstLetter) ? '0-9' : firstLetter, ...option, }; }); return ( <Autocomplete id="grouped-demo" options={options.sort((a, b) => -b.firstLetter.localeCompare(a.firstLetter))} groupBy={(option) => option.firstLetter} getOptionLabel={(option) => option.title} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="With categories" />} renderGroup={(params) => ( <li key={params.key}> <GroupHeader>{params.group}</GroupHeader> <GroupItems>{params.children}</GroupItems> </li> )} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,096
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/RenderGroup.tsx
import * as React from 'react'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import { styled, lighten, darken } from '@mui/system'; const GroupHeader = styled('div')(({ theme }) => ({ position: 'sticky', top: '-8px', padding: '4px 10px', color: theme.palette.primary.main, backgroundColor: theme.palette.mode === 'light' ? lighten(theme.palette.primary.light, 0.85) : darken(theme.palette.primary.main, 0.8), })); const GroupItems = styled('ul')({ padding: 0, }); export default function RenderGroup() { const options = top100Films.map((option) => { const firstLetter = option.title[0].toUpperCase(); return { firstLetter: /[0-9]/.test(firstLetter) ? '0-9' : firstLetter, ...option, }; }); return ( <Autocomplete id="grouped-demo" options={options.sort((a, b) => -b.firstLetter.localeCompare(a.firstLetter))} groupBy={(option) => option.firstLetter} getOptionLabel={(option) => option.title} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="With categories" />} renderGroup={(params) => ( <li key={params.key}> <GroupHeader>{params.group}</GroupHeader> <GroupItems>{params.children}</GroupItems> </li> )} /> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,097
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/RenderGroup.tsx.preview
<Autocomplete id="grouped-demo" options={options.sort((a, b) => -b.firstLetter.localeCompare(a.firstLetter))} groupBy={(option) => option.firstLetter} getOptionLabel={(option) => option.title} sx={{ width: 300 }} renderInput={(params) => <TextField {...params} label="With categories" />} renderGroup={(params) => ( <li key={params.key}> <GroupHeader>{params.group}</GroupHeader> <GroupItems>{params.children}</GroupItems> </li> )} />
2,098
0
petrpan-code/mui/material-ui/docs/data/material/components
petrpan-code/mui/material-ui/docs/data/material/components/autocomplete/Sizes.js
import * as React from 'react'; import Stack from '@mui/material/Stack'; import Chip from '@mui/material/Chip'; import Autocomplete from '@mui/material/Autocomplete'; import TextField from '@mui/material/TextField'; export default function Sizes() { return ( <Stack spacing={2} sx={{ width: 500 }}> <Autocomplete id="size-small-standard" size="small" options={top100Films} getOptionLabel={(option) => option.title} defaultValue={top100Films[13]} renderInput={(params) => ( <TextField {...params} variant="standard" label="Size small" placeholder="Favorites" /> )} /> <Autocomplete multiple id="size-small-standard-multi" size="small" options={top100Films} getOptionLabel={(option) => option.title} defaultValue={[top100Films[13]]} renderInput={(params) => ( <TextField {...params} variant="standard" label="Size small" placeholder="Favorites" /> )} /> <Autocomplete id="size-small-outlined" size="small" options={top100Films} getOptionLabel={(option) => option.title} defaultValue={top100Films[13]} renderInput={(params) => ( <TextField {...params} label="Size small" placeholder="Favorites" /> )} /> <Autocomplete multiple id="size-small-outlined-multi" size="small" options={top100Films} getOptionLabel={(option) => option.title} defaultValue={[top100Films[13]]} renderInput={(params) => ( <TextField {...params} label="Size small" placeholder="Favorites" /> )} /> <Autocomplete id="size-small-filled" size="small" options={top100Films} getOptionLabel={(option) => option.title} defaultValue={top100Films[13]} renderTags={(value, getTagProps) => value.map((option, index) => ( <Chip variant="outlined" label={option.title} size="small" {...getTagProps({ index })} /> )) } renderInput={(params) => ( <TextField {...params} variant="filled" label="Size small" placeholder="Favorites" /> )} /> <Autocomplete multiple id="size-small-filled-multi" size="small" options={top100Films} getOptionLabel={(option) => option.title} defaultValue={[top100Films[13]]} renderTags={(value, getTagProps) => value.map((option, index) => ( <Chip variant="outlined" label={option.title} size="small" {...getTagProps({ index })} /> )) } renderInput={(params) => ( <TextField {...params} variant="filled" label="Size small" placeholder="Favorites" /> )} /> </Stack> ); } // Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top const top100Films = [ { title: 'The Shawshank Redemption', year: 1994 }, { title: 'The Godfather', year: 1972 }, { title: 'The Godfather: Part II', year: 1974 }, { title: 'The Dark Knight', year: 2008 }, { title: '12 Angry Men', year: 1957 }, { title: "Schindler's List", year: 1993 }, { title: 'Pulp Fiction', year: 1994 }, { title: 'The Lord of the Rings: The Return of the King', year: 2003, }, { title: 'The Good, the Bad and the Ugly', year: 1966 }, { title: 'Fight Club', year: 1999 }, { title: 'The Lord of the Rings: The Fellowship of the Ring', year: 2001, }, { title: 'Star Wars: Episode V - The Empire Strikes Back', year: 1980, }, { title: 'Forrest Gump', year: 1994 }, { title: 'Inception', year: 2010 }, { title: 'The Lord of the Rings: The Two Towers', year: 2002, }, { title: "One Flew Over the Cuckoo's Nest", year: 1975 }, { title: 'Goodfellas', year: 1990 }, { title: 'The Matrix', year: 1999 }, { title: 'Seven Samurai', year: 1954 }, { title: 'Star Wars: Episode IV - A New Hope', year: 1977, }, { title: 'City of God', year: 2002 }, { title: 'Se7en', year: 1995 }, { title: 'The Silence of the Lambs', year: 1991 }, { title: "It's a Wonderful Life", year: 1946 }, { title: 'Life Is Beautiful', year: 1997 }, { title: 'The Usual Suspects', year: 1995 }, { title: 'Léon: The Professional', year: 1994 }, { title: 'Spirited Away', year: 2001 }, { title: 'Saving Private Ryan', year: 1998 }, { title: 'Once Upon a Time in the West', year: 1968 }, { title: 'American History X', year: 1998 }, { title: 'Interstellar', year: 2014 }, { title: 'Casablanca', year: 1942 }, { title: 'City Lights', year: 1931 }, { title: 'Psycho', year: 1960 }, { title: 'The Green Mile', year: 1999 }, { title: 'The Intouchables', year: 2011 }, { title: 'Modern Times', year: 1936 }, { title: 'Raiders of the Lost Ark', year: 1981 }, { title: 'Rear Window', year: 1954 }, { title: 'The Pianist', year: 2002 }, { title: 'The Departed', year: 2006 }, { title: 'Terminator 2: Judgment Day', year: 1991 }, { title: 'Back to the Future', year: 1985 }, { title: 'Whiplash', year: 2014 }, { title: 'Gladiator', year: 2000 }, { title: 'Memento', year: 2000 }, { title: 'The Prestige', year: 2006 }, { title: 'The Lion King', year: 1994 }, { title: 'Apocalypse Now', year: 1979 }, { title: 'Alien', year: 1979 }, { title: 'Sunset Boulevard', year: 1950 }, { title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb', year: 1964, }, { title: 'The Great Dictator', year: 1940 }, { title: 'Cinema Paradiso', year: 1988 }, { title: 'The Lives of Others', year: 2006 }, { title: 'Grave of the Fireflies', year: 1988 }, { title: 'Paths of Glory', year: 1957 }, { title: 'Django Unchained', year: 2012 }, { title: 'The Shining', year: 1980 }, { title: 'WALL·E', year: 2008 }, { title: 'American Beauty', year: 1999 }, { title: 'The Dark Knight Rises', year: 2012 }, { title: 'Princess Mononoke', year: 1997 }, { title: 'Aliens', year: 1986 }, { title: 'Oldboy', year: 2003 }, { title: 'Once Upon a Time in America', year: 1984 }, { title: 'Witness for the Prosecution', year: 1957 }, { title: 'Das Boot', year: 1981 }, { title: 'Citizen Kane', year: 1941 }, { title: 'North by Northwest', year: 1959 }, { title: 'Vertigo', year: 1958 }, { title: 'Star Wars: Episode VI - Return of the Jedi', year: 1983, }, { title: 'Reservoir Dogs', year: 1992 }, { title: 'Braveheart', year: 1995 }, { title: 'M', year: 1931 }, { title: 'Requiem for a Dream', year: 2000 }, { title: 'Amélie', year: 2001 }, { title: 'A Clockwork Orange', year: 1971 }, { title: 'Like Stars on Earth', year: 2007 }, { title: 'Taxi Driver', year: 1976 }, { title: 'Lawrence of Arabia', year: 1962 }, { title: 'Double Indemnity', year: 1944 }, { title: 'Eternal Sunshine of the Spotless Mind', year: 2004, }, { title: 'Amadeus', year: 1984 }, { title: 'To Kill a Mockingbird', year: 1962 }, { title: 'Toy Story 3', year: 2010 }, { title: 'Logan', year: 2017 }, { title: 'Full Metal Jacket', year: 1987 }, { title: 'Dangal', year: 2016 }, { title: 'The Sting', year: 1973 }, { title: '2001: A Space Odyssey', year: 1968 }, { title: "Singin' in the Rain", year: 1952 }, { title: 'Toy Story', year: 1995 }, { title: 'Bicycle Thieves', year: 1948 }, { title: 'The Kid', year: 1921 }, { title: 'Inglourious Basterds', year: 2009 }, { title: 'Snatch', year: 2000 }, { title: '3 Idiots', year: 2009 }, { title: 'Monty Python and the Holy Grail', year: 1975 }, ];
2,099