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
petrpan-code/mui/material-ui/docs/scripts/playground.template.tsx
import * as React from 'react'; export default function Playground() { return ( <div>A playground for a fast iteration development cycle in isolation outside of git.</div> ); }
5,100
0
petrpan-code/mui/material-ui/docs
petrpan-code/mui/material-ui/docs/scripts/reportBrokenLinks.js
/* eslint-disable no-console */ const path = require('path'); const fse = require('fs-extra'); const { createRender } = require('@mui/markdown'); const { marked } = require('marked'); const { LANGUAGES_IGNORE_PAGES } = require('../config'); // Use renderer to extract all links into a markdown document function getPageLinks(markdown) { const hrefs = []; const renderer = new marked.Renderer(); renderer.link = (href) => { if (href[0] === '/') { hrefs.push(href); } }; marked(markdown, { mangle: false, headerIds: false, renderer }); return hrefs; } // List all .js files in a folder function getJsFilesInFolder(folderPath) { const files = fse.readdirSync(folderPath, { withFileTypes: true }); return files.reduce((acc, file) => { if (file.isDirectory()) { const filesInFolder = getJsFilesInFolder(path.join(folderPath, file.name)); return [...acc, ...filesInFolder]; } if (file.name.endsWith('.js') || file.name.endsWith('.tsx')) { return [...acc, path.join(folderPath, file.name).replace(/\\/g, '/')]; } return acc; }, []); } // Returns url assuming it's "./docs/pages/x/..." becomes "mui.com/x/..." const jsFilePathToUrl = (jsFilePath) => { const folder = path.dirname(jsFilePath); const file = path.basename(jsFilePath); const root = folder.slice(jsFilePath.indexOf('/pages') + '/pages'.length); const suffix = path.extname(file); let page = `/${file.slice(0, file.length - suffix.length)}/`; if (page === '/index/') { page = '/'; } return `${root}${page}`; }; function cleanLink(link) { const startQueryIndex = link.indexOf('?'); const endQueryIndex = link.indexOf('#', startQueryIndex); if (startQueryIndex === -1) { return link; } if (endQueryIndex === -1) { return link.slice(0, startQueryIndex); } return `${link.slice(0, startQueryIndex)}${link.slice(endQueryIndex)}`; } function getLinksAndAnchors(fileName) { const toc = []; const headingHashes = {}; const userLanguage = 'en'; const render = createRender({ headingHashes, toc, userLanguage, options: { ignoreLanguagePages: LANGUAGES_IGNORE_PAGES, env: { SOURCE_CODE_REPO: '', }, }, }); const data = fse.readFileSync(fileName, { encoding: 'utf8' }); render(data); const links = getPageLinks(data).map(cleanLink); return { hashes: Object.keys(headingHashes), links, }; } const getMdFilesImported = (jsPageFile) => { // For each JS file extract the markdown rendered if it exists const fileContent = fse.readFileSync(jsPageFile, 'utf8'); /** * Content files can be represented by either: * - 'docsx/data/advanced-components/overview.md?@mui/markdown'; (for mui-x) * - 'docs/data/advanced-components/overview.md?@mui/markdown'; * - './index.md?@mui/markdown'; */ const importPaths = fileContent.match(/'.*\?@mui\/markdown'/g); if (importPaths === null) { return []; } return importPaths.map((importPath) => { let cleanImportPath = importPath.slice(1, importPath.length - "?@mui/markdown'".length); if (cleanImportPath.startsWith('.')) { cleanImportPath = path.join(path.dirname(jsPageFile), cleanImportPath); } else if (cleanImportPath.startsWith('docs/')) { cleanImportPath = path.join( jsPageFile.slice(0, jsPageFile.indexOf('docs/')), cleanImportPath, ); } else if (cleanImportPath.startsWith('docsx/')) { cleanImportPath = path.join( jsPageFile.slice(0, jsPageFile.indexOf('docs/')), cleanImportPath.replace('docsx', 'docs'), ); } else { console.error(`unable to deal with import path: ${cleanImportPath}`); } return cleanImportPath; }); }; const parseDocFolder = (folderPath, availableLinks = {}, usedLinks = {}) => { const jsPageFiles = getJsFilesInFolder(folderPath); const mdFiles = jsPageFiles.flatMap((jsPageFile) => { const pageUrl = jsFilePathToUrl(jsPageFile); const importedMds = getMdFilesImported(jsPageFile); return importedMds.map((fileName) => ({ fileName, url: pageUrl })); }); // Mark all the existing page as available jsPageFiles.forEach((jsFilePath) => { const url = jsFilePathToUrl(jsFilePath); availableLinks[url] = true; }); // For each markdown file, extract links mdFiles.forEach(({ fileName, url }) => { const { hashes, links } = getLinksAndAnchors(fileName); links.forEach((link) => { if (usedLinks[link] === undefined) { usedLinks[link] = [fileName]; } else { usedLinks[link].push(fileName); } }); hashes.forEach((hash) => { availableLinks[`${url}#${hash}`] = true; }); }); }; const getAnchor = (link) => { const splittedPath = link.split('/'); const potentialAnchor = splittedPath[splittedPath.length - 1]; return potentialAnchor.includes('#') ? potentialAnchor : ''; }; // Export useful method for doing similar checks in other repositories module.exports = { parseDocFolder, getAnchor }; /** * The remaining pat to the code is specific to this repository */ const UNSUPPORTED_PATHS = ['/api/', '/careers/', '/store/', '/x/']; const docsSpaceRoot = path.join(__dirname, '../'); const buffer = []; function write(text) { buffer.push(text); } function save(lines) { const fileContents = [...lines, ''].join('\n'); fse.writeFileSync(path.join(docsSpaceRoot, '.link-check-errors.txt'), fileContents); } function getPageUrlFromLink(link) { const [rep] = link.split('/#'); return rep; } if (require.main === module) { // {[url with hash]: true} const availableLinks = {}; // {[url with hash]: list of files using this link} const usedLinks = {}; parseDocFolder(path.join(docsSpaceRoot, './pages/'), availableLinks, usedLinks); write('Broken links found by `yarn docs:link-check` that exist:\n'); Object.keys(usedLinks) .filter((link) => link.startsWith('/')) .filter((link) => !availableLinks[link]) // these url segments are specific to Base UI and added by scripts (can not be found in markdown) .filter((link) => ['components-api', 'hooks-api', '#unstyled'].every((str) => !link.includes(str)), ) .filter((link) => UNSUPPORTED_PATHS.every((unsupportedPath) => !link.includes(unsupportedPath))) .sort() .forEach((linkKey) => { write(`- https://mui.com${linkKey}`); console.log(`https://mui.com${linkKey}`); console.log(`used in`); usedLinks[linkKey].forEach((f) => console.log(`- ${path.relative(docsSpaceRoot, f)}`)); console.log('available anchors on the same page:'); console.log( Object.keys(availableLinks) .filter((link) => getPageUrlFromLink(link) === getPageUrlFromLink(linkKey)) .sort() .map(getAnchor) .join('\n'), ); console.log('\n\n'); }); save(buffer); }
5,101
0
petrpan-code/mui/material-ui/docs
petrpan-code/mui/material-ui/docs/scripts/tsconfig.json
{ "extends": "../../tsconfig.json", "include": ["*.ts", "i18n.js"], "compilerOptions": { "allowJs": true, "isolatedModules": true, "noEmit": true, "noUnusedLocals": true, "resolveJsonModule": true, "skipLibCheck": true, "esModuleInterop": true, "types": ["node"] } }
5,102
0
petrpan-code/mui/material-ui/docs
petrpan-code/mui/material-ui/docs/scripts/updateIconSynonyms.js
/* eslint-disable no-console */ import path from 'path'; import fetch from 'cross-fetch'; import fse from 'fs-extra'; import * as mui from '@mui/icons-material'; import synonyms from 'docs/data/material/components/material-icons/synonyms'; import myDestRewriter from '../../packages/mui-icons-material/renameFilters/material-design-icons'; function not(a, b) { return a.filter((value) => b.indexOf(value) === -1); } function union(a, b) { return [...new Set([...a, ...b])]; } async function run() { try { const response = await fetch('https://fonts.google.com/metadata/icons'); const text = await response.text(); const data = JSON.parse(text.replace(")]}'", '')); const materialIcons = data.icons.reduce((acc, icon) => { icon.tags = not(icon.tags, icon.name.replace('_')) // remove the icon name strings from the tags .filter((t) => { // remove invalid tags if ( t.includes('Remove') || t.includes('Duplicate') || t.includes('Same as') || t.includes('remove others') ) { console.log(`Skipping invalid tag (${t}) in ${icon.name}`); return false; } return true; }) .map((t) => t.replace(/'/g, '')); // Fix names that can't be exported as ES modules. icon.name = myDestRewriter({ base: icon.name }); acc[icon.name] = icon.tags; return acc; }, {}); const npmPackageIcons = Object.keys(mui).reduce((acc, icon) => { const name = icon.replace(/(Outlined|TwoTone|Rounded|Sharp)$/, ''); acc[name] = true; return acc; }, {}); const iconList = union(Object.keys(materialIcons), Object.keys(synonyms)) .filter((icon) => { // The icon is not in @mui/material so no point in having synonyms. return npmPackageIcons[icon]; }) .sort((a, b) => -b.localeCompare(a)); let newSynonyms = 'const synonyms = {\n'; iconList.forEach((icon) => { const synonymsIconStrings = synonyms[icon] ? synonyms[icon].split(' ') : []; // Some MD tags have multiple words in a string, so we separate those out to dedupe them const materialIconStrings = materialIcons[icon] ? materialIcons[icon].reduce((tags, tag) => tags.concat(tag.split(' ')), []) : []; let mergedStrings = union(synonymsIconStrings, materialIconStrings); mergedStrings = mergedStrings // remove strings that are substrings of others .filter((tag) => !mergedStrings.some((one) => one.includes(tag) && one !== tag)) .sort() .join(' '); if (mergedStrings !== '') { newSynonyms += ` ${icon}: '${mergedStrings}',\n`; } }); newSynonyms += '};\n\nexport default synonyms;\n'; fse.writeFile( path.join(__dirname, `../../docs/data/material/components/material-icons/synonyms.js`), newSynonyms, ); console.log('Stats:'); console.log(`${iconList.length} synonyms icons in the generated file`); console.log(`${Object.keys(npmPackageIcons).length} icons in @mui/material`); console.log(`${Object.keys(materialIcons).length} icons in Material Design`); } catch (err) { console.log('err', err); throw err; } } run();
5,103
0
petrpan-code/mui/material-ui/docs
petrpan-code/mui/material-ui/docs/src/BrandingCssVarsProvider.tsx
import * as React from 'react'; import { deepmerge } from '@mui/utils'; import { Experimental_CssVarsProvider as CssVarsProvider, experimental_extendTheme as extendTheme, PaletteColorOptions, } from '@mui/material/styles'; import CssBaseline from '@mui/material/CssBaseline'; import { NextNProgressBar } from 'docs/src/modules/components/AppFrame'; import { getDesignTokens, getThemedComponents } from 'docs/src/modules/brandingTheme'; import SkipLink from 'docs/src/modules/components/SkipLink'; import MarkdownLinks from 'docs/src/modules/components/MarkdownLinks'; declare module '@mui/material/styles' { interface PaletteOptions { primaryDark?: PaletteColorOptions; } } const { palette: lightPalette, typography, ...designTokens } = getDesignTokens('light'); const { palette: darkPalette } = getDesignTokens('dark'); const theme = extendTheme({ cssVarPrefix: 'muidocs', colorSchemes: { light: { palette: lightPalette, }, dark: { palette: darkPalette, }, }, ...designTokens, typography: deepmerge(typography, { h1: { ':where([data-mui-color-scheme="dark"]) &': { color: 'var(--muidocs-palette-common-white)', }, }, h2: { ':where([data-mui-color-scheme="dark"]) &': { color: 'var(--muidocs-palette-grey-100)', }, }, h5: { ':where([data-mui-color-scheme="dark"]) &': { color: 'var(--muidocs-palette-primary-300)', }, }, }), ...getThemedComponents(), }); export default function BrandingCssVarsProvider(props: { children: React.ReactNode }) { const { children } = props; return ( <CssVarsProvider theme={theme} defaultMode="system" disableTransitionOnChange> <NextNProgressBar /> <CssBaseline /> <SkipLink /> <MarkdownLinks /> {children} </CssVarsProvider> ); }
5,104
0
petrpan-code/mui/material-ui/docs
petrpan-code/mui/material-ui/docs/src/BrandingProvider.tsx
import * as React from 'react'; import { ThemeProvider, useTheme } from '@mui/material/styles'; import { brandingDarkTheme, brandingLightTheme } from 'docs/src/modules/brandingTheme'; interface BrandingProviderProps { children: React.ReactNode; /** * If not `undefined`, the provider is considered nesting and does not render NextNProgressBar & CssBaseline */ mode: 'light' | 'dark'; } export default function BrandingProvider(props: BrandingProviderProps) { const { children, mode: modeProp } = props; const upperTheme = useTheme(); const mode = modeProp || upperTheme.palette.mode; const theme = mode === 'dark' ? brandingDarkTheme : brandingLightTheme; return <ThemeProvider theme={modeProp ? () => theme : theme}>{children}</ThemeProvider>; }
5,105
0
petrpan-code/mui/material-ui/docs
petrpan-code/mui/material-ui/docs/src/MuiPage.ts
import * as React from 'react'; export interface MuiPage { pathname: string; query?: object; children?: MuiPage[]; disableDrawer?: boolean; icon?: string | React.ComponentType; /** * Indicates if the pages are regarding some legacy API. */ legacy?: boolean; /** * Indicates if the pages are only available in some plan. * @default 'community' */ plan?: 'community' | 'pro' | 'premium'; /** * In case the children have pathnames out of pathname value, use this field to scope other pathnames. * Pathname can be partial, e.g. '/components/' will cover '/components/button/' and '/components/link/'. * @deprecated Dead code, to remove. */ scopePathnames?: string[]; /** * Pages are considered to be ordered depth-first. * If a page should be excluded from this order, set `order: false`. * You want to set `inSideNav: false` if you don't want the page to appear in an ordered list e.g. for previous/next page navigation. */ inSideNav?: boolean; /** * Props spread to the Link component. */ linkProps?: Record<string, unknown>; /** * Subheader to display before navigation links. */ subheader?: string; /** * Overrides the default page title. */ title?: string; /** * Indicates if the feature has been recently released. * @default false */ newFeature?: boolean; /** * Indicates if the feature is planned for development. * @default false */ planned?: boolean; /** * Indicates if the component/hook is not stable yet. */ unstable?: boolean; } export interface OrderedMuiPage extends MuiPage { ordered?: true; }
5,106
0
petrpan-code/mui/material-ui/docs
petrpan-code/mui/material-ui/docs/src/createEmotionCache.ts
/* eslint-disable default-case */ import createCache from '@emotion/cache'; import { prefixer, Element, RULESET } from 'stylis'; // A workaround to https://github.com/emotion-js/emotion/issues/2836 // to be able to use `:where` selector for styling. function globalSelector(element: Element) { switch (element.type) { case RULESET: element.props = (element.props as string[]).map((value: any) => { if (value.match(/(:where|:is)\(/)) { value = value.replace(/\.[^:]+(:where|:is)/, '$1'); return value; } return value; }); } } export default function createEmotionCache() { // TODO remove prepend: true once JSS is out return createCache({ key: 'css', prepend: true, stylisPlugins: [prefixer, globalSelector] }); }
5,107
0
petrpan-code/mui/material-ui/docs
petrpan-code/mui/material-ui/docs/src/featureToggle.js
// need to use commonjs export so that @mui/markdown can use module.exports = { enable_website_banner: false, enable_toc_banner: true, enable_docsnav_banner: false, enable_job_banner: false, };
5,108
0
petrpan-code/mui/material-ui/docs
petrpan-code/mui/material-ui/docs/src/pagesApi.js
module.exports = [ { pathname: '/api-docs/accordion' }, { pathname: '/api-docs/accordion-actions' }, { pathname: '/api-docs/accordion-details' }, { pathname: '/api-docs/accordion-summary' }, { pathname: '/api-docs/alert' }, { pathname: '/api-docs/alert-title' }, { pathname: '/api-docs/app-bar' }, { pathname: '/api-docs/autocomplete' }, { pathname: '/api-docs/avatar' }, { pathname: '/api-docs/avatar-group' }, { pathname: '/api-docs/backdrop' }, { pathname: '/api-docs/badge' }, { pathname: '/api-docs/bottom-navigation' }, { pathname: '/api-docs/bottom-navigation-action' }, { pathname: '/api-docs/breadcrumbs' }, { pathname: '/api-docs/button' }, { pathname: '/api-docs/button-base' }, { pathname: '/api-docs/button-group' }, { pathname: '/api-docs/card' }, { pathname: '/api-docs/card-action-area' }, { pathname: '/api-docs/card-actions' }, { pathname: '/api-docs/card-content' }, { pathname: '/api-docs/card-header' }, { pathname: '/api-docs/card-media' }, { pathname: '/api-docs/checkbox' }, { pathname: '/api-docs/chip' }, { pathname: '/api-docs/circular-progress' }, { pathname: '/api-docs/collapse' }, { pathname: '/api-docs/container' }, { pathname: '/api-docs/css-baseline' }, { pathname: '/api-docs/dialog' }, { pathname: '/api-docs/dialog-actions' }, { pathname: '/api-docs/dialog-content' }, { pathname: '/api-docs/dialog-content-text' }, { pathname: '/api-docs/dialog-title' }, { pathname: '/api-docs/divider' }, { pathname: '/api-docs/drawer' }, { pathname: '/api-docs/fab' }, { pathname: '/api-docs/fade' }, { pathname: '/api-docs/filled-input' }, { pathname: '/api-docs/form-control' }, { pathname: '/api-docs/form-control-label' }, { pathname: '/api-docs/form-group' }, { pathname: '/api-docs/form-helper-text' }, { pathname: '/api-docs/form-label' }, { pathname: '/api-docs/global-styles' }, { pathname: '/api-docs/grid' }, { pathname: '/api-docs/grow' }, { pathname: '/api-docs/hidden' }, { pathname: '/api-docs/icon' }, { pathname: '/api-docs/icon-button' }, { pathname: '/api-docs/image-list' }, { pathname: '/api-docs/image-list-item' }, { pathname: '/api-docs/image-list-item-bar' }, { pathname: '/api-docs/input' }, { pathname: '/api-docs/input-adornment' }, { pathname: '/api-docs/input-base' }, { pathname: '/api-docs/input-label' }, { pathname: '/api-docs/linear-progress' }, { pathname: '/api-docs/link' }, { pathname: '/api-docs/list' }, { pathname: '/api-docs/list-item' }, { pathname: '/api-docs/list-item-avatar' }, { pathname: '/api-docs/list-item-button' }, { pathname: '/api-docs/list-item-icon' }, { pathname: '/api-docs/list-item-secondary-action' }, { pathname: '/api-docs/list-item-text' }, { pathname: '/api-docs/list-subheader' }, { pathname: '/api-docs/loading-button' }, { pathname: '/api-docs/masonry' }, { pathname: '/api-docs/menu' }, { pathname: '/api-docs/menu-item' }, { pathname: '/api-docs/menu-list' }, { pathname: '/api-docs/mobile-stepper' }, { pathname: '/api-docs/modal' }, { pathname: '/api-docs/native-select' }, { pathname: '/api-docs/outlined-input' }, { pathname: '/api-docs/pagination' }, { pathname: '/api-docs/pagination-item' }, { pathname: '/api-docs/paper' }, { pathname: '/api-docs/popover' }, { pathname: '/api-docs/popper' }, { pathname: '/api-docs/radio' }, { pathname: '/api-docs/radio-group' }, { pathname: '/api-docs/rating' }, { pathname: '/api-docs/scoped-css-baseline' }, { pathname: '/api-docs/select' }, { pathname: '/api-docs/skeleton' }, { pathname: '/api-docs/slide' }, { pathname: '/api-docs/slider' }, { pathname: '/api-docs/snackbar' }, { pathname: '/api-docs/snackbar-content' }, { pathname: '/api-docs/speed-dial' }, { pathname: '/api-docs/speed-dial-action' }, { pathname: '/api-docs/speed-dial-icon' }, { pathname: '/api-docs/stack' }, { pathname: '/api-docs/step' }, { pathname: '/api-docs/step-button' }, { pathname: '/api-docs/step-connector' }, { pathname: '/api-docs/step-content' }, { pathname: '/api-docs/step-icon' }, { pathname: '/api-docs/step-label' }, { pathname: '/api-docs/stepper' }, { pathname: '/api-docs/svg-icon' }, { pathname: '/api-docs/swipeable-drawer' }, { pathname: '/api-docs/switch' }, { pathname: '/api-docs/tab' }, { pathname: '/api-docs/tab-context' }, { pathname: '/api-docs/table' }, { pathname: '/api-docs/table-body' }, { pathname: '/api-docs/table-cell' }, { pathname: '/api-docs/table-container' }, { pathname: '/api-docs/table-footer' }, { pathname: '/api-docs/table-head' }, { pathname: '/api-docs/table-pagination' }, { pathname: '/api-docs/table-row' }, { pathname: '/api-docs/table-sort-label' }, { pathname: '/api-docs/tab-list' }, { pathname: '/api-docs/tab-panel' }, { pathname: '/api-docs/tabs' }, { pathname: '/api-docs/tab-scroll-button' }, { pathname: '/api-docs/textarea-autosize' }, { pathname: '/api-docs/text-field' }, { pathname: '/api-docs/timeline' }, { pathname: '/api-docs/timeline-connector' }, { pathname: '/api-docs/timeline-content' }, { pathname: '/api-docs/timeline-dot' }, { pathname: '/api-docs/timeline-item' }, { pathname: '/api-docs/timeline-opposite-content' }, { pathname: '/api-docs/timeline-separator' }, { pathname: '/api-docs/toggle-button' }, { pathname: '/api-docs/toggle-button-group' }, { pathname: '/api-docs/toolbar' }, { pathname: '/api-docs/tooltip' }, { pathname: '/api-docs/tree-item' }, { pathname: '/api-docs/tree-view' }, { pathname: '/api-docs/typography' }, { pathname: '/api-docs/zoom' }, ];
5,109
0
petrpan-code/mui/material-ui/docs
petrpan-code/mui/material-ui/docs/src/route.ts
const ROUTES = { productCore: '/core/', productBase: '/base-ui/', productMaterial: '/material-ui/', productAdvanced: '/x/', productToolpad: '/toolpad/', productTemplates: '/templates/', productDesignKits: '/design-kits/', careers: '/careers/', pricing: '/pricing/', about: '/about/', rssFeed: '/feed/blog/rss.xml', handbook: 'https://mui-org.notion.site/Handbook-f086d47e10794d5e839aef9dc67f324b', baseDocs: '/base-ui/getting-started/', baseComponents: '/base-ui/all-components/', baseQuickstart: '/base-ui/getting-started/quickstart/', materialDocs: '/material-ui/getting-started/', joyDocs: '/joy-ui/getting-started/', systemDocs: '/system/getting-started/', materialIcons: '/material-ui/material-icons/', freeTemplates: '/material-ui/getting-started/templates/', components: '/material-ui/getting-started/supported-components/', customization: '/material-ui/customization/how-to-customize/', theming: '/material-ui/customization/theming/', documentation: '/material-ui/getting-started/', communityHelp: '/material-ui/getting-started/support/#community-help-free', blog: '/blog/', showcase: '/material-ui/discover-more/showcase/', coreRoadmap: '/material-ui/discover-more/roadmap/', xRoadmap: 'https://github.com/mui/mui-x/projects/1', vision: '/material-ui/discover-more/vision/', support: '/material-ui/getting-started/support/#professional-support-premium', privacyPolicy: 'https://mui.com/legal/privacy/', goldSponsor: '/material-ui/discover-more/backers/#gold-sponsors', store: 'https://mui.com/store/', advancedComponents: '/x/introduction/', toolpadDocs: '/toolpad/getting-started/overview/', xDocs: '/x/introduction/', dataGridSpace: '/x/react-data-grid/getting-started/', dataGridDocs: '/x/react-data-grid/getting-started/', dataGridFeatures: '/x/react-data-grid/#features', dataGridFeaturesComparison: '/x/react-data-grid/getting-started/#feature-comparison', }; export default ROUTES;
5,110
0
petrpan-code/mui/material-ui/docs
petrpan-code/mui/material-ui/docs/src/sw.js
/* eslint-env serviceworker */ // https://github.com/airbnb/javascript/issues/1632 /* eslint-disable no-restricted-globals */ // See https://developer.chrome.com/docs/workbox/remove-buggy-service-workers/ self.addEventListener('install', () => { // Skip over the "waiting" lifecycle state, to ensure that our // new service worker is activated immediately, even if there's // another tab open controlled by our older service worker code. self.skipWaiting(); }); self.addEventListener('message', () => { // Optional: Get a list of all the current open windows/tabs under // our service worker's control, and force them to reload. // This can "unbreak" any open windows/tabs as soon as the new // service worker activates, rather than users having to manually reload. self.clients.matchAll({ type: 'window' }).then((windowClients) => { windowClients.forEach((windowClient) => { windowClient.navigate(windowClient.url); }); }); });
5,111
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/about/AboutEnd.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Typography from '@mui/material/Typography'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import Link from 'docs/src/modules/components/Link'; import GradientText from 'docs/src/components/typography/GradientText'; import ROUTES from 'docs/src/route'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; export default function AboutEnd() { return ( <Section bg="gradient" sx={{ p: { sm: 8 } }}> <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', position: 'relative', }} > <SectionHeadline alwaysCenter overline="Join us" title={ <Typography variant="h2"> <GradientText>Build the next generation</GradientText> <br /> of tools for UI development </Typography> } description="Together, we are enabling developers & designers to bring stunning UIs to life with unrivalled speed and ease." /> <Button component={Link} noLinkStyle href={ROUTES.careers} endIcon={<KeyboardArrowRightRounded fontSize="small" />} variant="contained" sx={{ width: { xs: '100%', sm: 'fit-content' } }} > View careers </Button> </Box> <Box component="img" src="/static/branding/about/illustrations/team-globe-distribution-light.png" alt="A map illustration with pins loosely positioned where team members from MUI are located." loading="lazy" sx={(theme) => ({ mt: -8, display: { xs: 'none', sm: 'block' }, width: '100%', aspectRatio: '231/145', ...theme.applyDarkStyles({ content: 'url(/static/branding/about/illustrations/team-globe-distribution-dark.png)', }), })} /> </Section> ); }
5,112
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/about/AboutHero.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import { styled, keyframes } from '@mui/material/styles'; import Section from 'docs/src/layouts/Section'; import GradientText from 'docs/src/components/typography/GradientText'; import TeamStatistics from 'docs/src/components/about/TeamStatistics'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; const teamPhotos = [ { img: '/static/branding/about/group-photo/teide-group.jpg', title: 'A group photo of the MUI crew posing near the base of Mount Teide at the start of the hike.', }, { img: '/static/branding/about/group-photo/skiers.jpg', title: 'MUI team members standing lined-up in the snow with their skigear.', }, { img: '/static/branding/about/group-photo/group-photo.jpg', title: 'Photo of the MUI team in front of the pool at our accommodations in Tenerife', }, { img: '/static/branding/about/group-photo/team-dinner.png', title: 'Members of the MUI team sitting around a large wooden dining table.', }, { img: '/static/branding/about/group-photo/working-table-tenerife.png', title: 'The Toolpad team working together on a heads-down moment in Tenerife.', }, { img: '/static/branding/about/group-photo/scuba-gear.png', title: 'MUI team members and their diving instructors pose in scuba gear before a scuba diving lesson.', }, { img: '/static/branding/about/group-photo/outdoor-focus-group.png', title: 'An impromptu focus group gathered next to the pool to discuss cross-team marketing strategies.', }, { img: '/static/branding/about/group-photo/working-table-portugal.png', title: 'MUI team members working together on a heads-down moment in Portugal.', }, { img: '/static/branding/about/group-photo/snow-tea.png', title: 'The team shares a cup of tea up in the mountains of Chamonix, France.', }, { img: '/static/branding/about/group-photo/portugal-sight-seeing.png', title: 'MUI team selfie while sightseeing in Lisbon, Portugal.', }, ]; const ImageContainer = styled('div')(() => ({ display: 'flex', gap: 16, justifyContent: 'center', })); const Image = styled('img')(({ theme }) => ({ width: 400, height: 300, boxSizing: 'content-box', objectFit: 'cover', borderRadius: theme.shape.borderRadius, border: '1px solid', borderColor: (theme.vars || theme).palette.divider, boxShadow: `0px 2px 8px ${(theme.vars || theme).palette.grey[200]}`, transition: 'all 100ms ease', ...theme.applyDarkStyles({ borderColor: (theme.vars || theme).palette.primaryDark[600], boxShadow: `0px 2px 8px ${(theme.vars || theme).palette.common.black}`, }), })); const scroll = keyframes` 0% { transform: translateX(0); } 100% { transform: translateX(-100%) } `; function PhotoGallery() { return ( <Box sx={(theme) => ({ borderRadius: 1, overflow: 'hidden', position: 'relative', minWidth: '100%', display: 'flex', gap: 2, my: 5, '& > div': { animation: `${scroll} 120s linear infinite`, }, '&::before, &::after': { background: `linear-gradient(to right, #FFF 0%, rgba(255, 255, 255, 0) 100%)`, content: "''", height: '100%', position: 'absolute', width: 200, zIndex: 1, pointerEvents: 'none', }, '&::before': { right: { xs: -64, sm: -20 }, top: 0, transform: 'rotateZ(180deg)', }, '&::after': { left: { xs: -64, sm: -20 }, top: 0, }, ...theme.applyDarkStyles({ '&::before, &::after': { background: `linear-gradient(to right, ${ (theme.vars || theme).palette.primaryDark[900] } 0%, rgba(0, 0, 0, 0) 100%)`, }, }), })} > <ImageContainer> {teamPhotos.map((item, index) => ( <Image key={index} src={item.img} alt={item.title} loading={index > 2 ? 'lazy' : undefined} fetchPriority={index > 2 ? undefined : 'high'} /> ))} </ImageContainer> <ImageContainer aria-hidden="true"> {/* aria-hidden is used here because this element is a copy from the above, meaning we want to hide it from screen readers. */} {teamPhotos.map((item, index) => ( <Image key={index} src={item.img} alt={item.title} loading="lazy" /> ))} </ImageContainer> </Box> ); } export default function AboutHero() { return ( <Section cozy bg="gradient"> <SectionHeadline alwaysCenter overline="About us" title={ <Typography variant="h2" component="h1"> We&apos;re on a mission to make <br />{' '} <GradientText>building better UIs effortless</GradientText> </Typography> } description="Together, we are enabling developers & designers to bring stunning UIs to life with unrivalled speed and ease." /> <PhotoGallery /> <TeamStatistics /> </Section> ); }
5,113
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/about/HowToSupport.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Grid from '@mui/material/Grid'; import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import ForumRoundedIcon from '@mui/icons-material/ForumRounded'; import PeopleRoundedIcon from '@mui/icons-material/PeopleRounded'; import LocalAtmRoundedIcon from '@mui/icons-material/LocalAtmRounded'; import GradientText from 'docs/src/components/typography/GradientText'; import Link from 'docs/src/modules/components/Link'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import { GlowingIconContainer } from 'docs/src/components/action/InfoCard'; function Widget({ children, title, icon, }: { children: React.ReactNode; title: string; icon: React.ReactElement; }) { return ( <Paper variant="outlined" sx={(theme) => ({ p: 4, height: '100%', display: 'flex', flexDirection: 'column', borderRadius: '12px', border: '1px solid', borderColor: 'grey.100', background: `${(theme.vars || theme).palette.gradients.linearSubtle}`, ...theme.applyDarkStyles({ bgcolor: 'primaryDark.900', borderColor: 'primaryDark.700', background: `${(theme.vars || theme).palette.gradients.linearSubtle}`, }), })} > <GlowingIconContainer icon={icon} /> <Typography fontWeight="bold" component="h3" color="text.primary" variant="body2" mt={2} mb={0.5} > {title} </Typography> {children} </Paper> ); } export default function HowToSupport() { return ( <Section cozy> <SectionHeadline overline="Support us" title={ <Typography variant="h2" sx={{ mb: 4 }}> Learn how to support <br /> <GradientText>MUI&apos;s growth</GradientText> </Typography> } description="" /> <Grid container spacing={3}> <Grid item xs={12} sm={6} md={4}> <Widget icon={<ForumRoundedIcon fontSize="small" color="primary" />} title="Give feedback" > <Typography variant="body2" color="text.secondary" sx={{ mb: 1 }}> Tell us what and where we can improve or share your happy moments with us! You can also up or downvote any page on our documentation. <br /> <br /> And lastly, from time to time, we send our community a survey for more structured feedback, you&apos;re always invited to participate to share your thoughts. </Typography> <Button component="a" // @ts-expect-error variant="link" size="small" href="https://github.com/mui/material-ui/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc" endIcon={<KeyboardArrowRightRounded />} sx={{ ml: -1, mt: 'auto', width: 'fit-content' }} > Leave your feedback{' '} </Button> </Widget> </Grid> <Grid item xs={12} sm={6} md={4}> <Widget icon={<PeopleRoundedIcon fontSize="small" color="primary" />} title="Join the community" > <Typography variant="body2" color="text.secondary" sx={{ mb: 1 }}> Become a member of a huge community of developers supporting MUI. You can: </Typography> <Box component="ul" sx={{ typography: 'body2', color: 'text.secondary', pl: 2, mb: 2, }} > <li> Add new features by{' '} <Link href="https://github.com/mui/material-ui/blob/HEAD/CONTRIBUTING.md#your-first-pull-request"> submitting a pull request </Link> . </li> <li> Fix bugs or{' '} <Link href="https://github.com/mui/material-ui/tree/HEAD/docs"> improve our documentation </Link> . </li> <li> Help others by reviewing and commenting on existing{' '} <Link href="https://github.com/mui/material-ui/pulls">PRs</Link> and{' '} <Link href="https://github.com/mui/material-ui/issues">issues</Link>. </li> <li> Help <Link href="https://crowdin.com/project/material-ui-docs">translate</Link> the documentation. </li> <li> Answer questions on{' '} <Link href="https://stackoverflow.com/questions/tagged/material-ui"> Stack Overflow </Link> . </li> </Box> <Button component="a" // @ts-expect-error variant="link" size="small" href="https://github.com/mui/material-ui" endIcon={<KeyboardArrowRightRounded />} sx={{ ml: -1, mt: 'auto', width: 'fit-content' }} > See the repository </Button> </Widget> </Grid> <Grid item xs={12} sm={6} md={4}> <Widget icon={<LocalAtmRoundedIcon fontSize="small" color="primary" />} title="Support us financially" > <Typography variant="body2" color="text.secondary" sx={{ mb: 1 }}> If you use MUI in a commercial project and would like to support its continued development by becoming a Sponsor, or in a side or hobby project and would like to become a Backer, you can do so through {'Open Collective'}. <br /> <br /> All funds donated are managed transparently, and Sponsors receive recognition in the README and on the MUI home page. </Typography> <Button component="a" // @ts-expect-error variant="link" size="small" href="https://opencollective.com/mui-org" endIcon={<KeyboardArrowRightRounded />} sx={{ ml: -1, mt: 'auto', width: 'fit-content' }} > {'See Open Collective'} </Button> </Widget> </Grid> </Grid> </Section> ); }
5,114
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/about/OurValues.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Grid from '@mui/material/Grid'; import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import Link from 'docs/src/modules/components/Link'; import GradientText from 'docs/src/components/typography/GradientText'; import ROUTES from 'docs/src/route'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; const values = [ { title: 'Put community first 💙', description: "We never lose sight of who we're serving and why.", lightIcon: 'url(/static/branding/about/illustrations/community-light.svg)', darkIcon: 'url(/static/branding/about/illustrations/community-dark.svg)', width: 92, height: 84, }, { title: 'Avoid bureaucracy 🚫', description: "We're so not corporate — and we like it that way.", lightIcon: 'url(/static/branding/about/illustrations/bureaucracy-light.svg)', darkIcon: 'url(/static/branding/about/illustrations/bureaucracy-dark.svg)', width: 81, height: 94, }, { title: 'Chase "better" 🌱', description: "We're driven by an unending desire to improve.", lightIcon: 'url(/static/branding/about/illustrations/better-light.svg)', darkIcon: 'url(/static/branding/about/illustrations/better-dark.svg)', width: 89, height: 89, }, { title: 'Trust and deliver together 🚀', description: 'We choose to cultivate unity as the core of achievement.', lightIcon: 'url(/static/branding/about/illustrations/trust-light.svg)', darkIcon: 'url(/static/branding/about/illustrations/trust-dark.svg)', width: 75, height: 92, }, ]; export default function OurValues() { return ( <Section cozy> <Box sx={{ display: 'flex', flexDirection: 'column', }} > <SectionHeadline overline="Our values" title={ <Typography variant="h2"> The MUI <GradientText>team pact</GradientText> </Typography> } description="They explain the behaviors and mindsets we actively encourage, discourage, and why. They serve as a guide toward better decision-making, results, and experiences at work." /> <Button component={Link} noLinkStyle href={ROUTES.handbook} endIcon={<KeyboardArrowRightRounded fontSize="small" />} variant="contained" sx={{ width: { xs: '100%', sm: 'fit-content' } }} > View our handbook </Button> </Box> <Grid container spacing={3} sx={{ mt: { xs: 1, sm: 2 } }}> {values.map(({ title, description, darkIcon, lightIcon, height, width }) => ( <Grid key={title} item xs={12} md={3}> <Paper variant="outlined" sx={(theme) => ({ p: 4, height: '100%', display: 'flex', flexDirection: 'column', alignItems: 'space-between', gap: 1.5, background: `${(theme.vars || theme).palette.gradients.linearSubtle}`, ...theme.applyDarkStyles({ bgcolor: 'primaryDark.900', background: `${(theme.vars || theme).palette.gradients.linearSubtle}`, borderColor: 'primaryDark.700', }), })} > <Box sx={{ height: 94 }}> <Box sx={(theme) => ({ background: `${lightIcon}`, ...theme.applyDarkStyles({ background: `${darkIcon}`, }), })} width={width} height={height} /> </Box> <Box sx={{ flexGrow: 1 }}> <Typography fontWeight="bold" component="h3" variant="body2" sx={(theme) => ({ mb: 0.5, color: (theme.vars || theme).palette.text.primary, '&::first-letter': { mr: 0.1, fontSize: theme.typography.pxToRem(16), color: (theme.vars || theme).palette.primary.main, }, ...theme.applyDarkStyles({ '&::first-letter': { color: (theme.vars || theme).palette.primary[400], }, }), })} > {title} </Typography> <Typography variant="body2" color="text.secondary"> {description} </Typography> </Box> </Paper> </Grid> ))} </Grid> </Section> ); }
5,115
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/about/Team.tsx
import * as React from 'react'; import Avatar from '@mui/material/Avatar'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Container from '@mui/material/Container'; import Divider from '@mui/material/Divider'; import IconButton from '@mui/material/IconButton'; import Grid from '@mui/material/Grid'; import Paper, { PaperProps } from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import Tooltip from '@mui/material/Tooltip'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import TwitterIcon from '@mui/icons-material/Twitter'; import GitHubIcon from '@mui/icons-material/GitHub'; import LinkedInIcon from '@mui/icons-material/LinkedIn'; import Link from 'docs/src/modules/components/Link'; import ROUTES from 'docs/src/route'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import GradientText from 'docs/src/components/typography/GradientText'; import teamMembers from 'docs/data/about/teamMembers.json'; interface Profile { name: string; /** * Role, what are you working on? */ title: string; /** * Country where you live in, ISO 3166-1. */ locationCountry: string; // https://flagpedia.net/download/api /** * Image URL. */ src?: string; /** * Lives in. */ location?: string; /** * Short summary about you. */ about?: string; github?: string; twitter?: string; linkedin?: string; } function Person(props: Profile & { sx?: PaperProps['sx'] }) { return ( <Paper variant="outlined" sx={{ p: 2, height: '100%', ...props.sx }}> <Box sx={{ display: 'flex', alignItems: 'flex-start', flexWrap: 'wrap', '& > div': { minWidth: 'clamp(0px, (150px - 100%) * 999 ,100%)' }, }} > <Tooltip title={props.location || false} placement="right-end" describeChild PopperProps={{ popperOptions: { modifiers: [ { name: 'offset', options: { offset: [3, 2], }, }, ], }, }} > <Box sx={{ position: 'relative', display: 'inline-block' }}> <Avatar variant="rounded" imgProps={{ width: '70', height: '70', loading: 'lazy', }} src={props.src} alt={props.name} {...(props.src?.startsWith('https://avatars.githubusercontent.com') && { src: `${props.src}?s=70`, srcSet: `${props.src}?s=140 2x`, })} sx={(theme) => ({ width: 70, height: 70, borderRadius: 1, border: '1px solid', borderColor: 'grey.100', backgroundColor: 'primary.50', ...theme.applyDarkStyles({ backgroundColor: 'primary.900', borderColor: 'primaryDark.500', }), })} /> <Box sx={(theme) => ({ width: 24, height: 24, display: 'flex', justifyContent: 'center', position: 'absolute', bottom: 0, right: 0, backgroundColor: '#FFF', borderRadius: 40, border: '2px solid', borderColor: 'primary.50', boxShadow: '0px 2px 8px rgba(0, 0, 0, 0.15)', transform: 'translateX(50%)', overflow: 'hidden', ...theme.applyDarkStyles({ borderColor: 'primary.200', }), })} > <img loading="lazy" height="20" width="40" src={`https://flagcdn.com/${props.locationCountry}.svg`} alt="" /> </Box> </Box> </Tooltip> <Box sx={{ mt: -0.5, mr: -0.5, ml: 'auto' }}> {props.github && ( <IconButton aria-label={`${props.name} GitHub profile`} component="a" href={`https://github.com/${props.github}`} target="_blank" rel="noreferrer noopener" > <GitHubIcon fontSize="small" sx={{ color: 'grey.500' }} /> </IconButton> )} {props.twitter && ( <IconButton aria-label={`${props.name} Twitter profile`} component="a" href={`https://twitter.com/${props.twitter}`} target="_blank" rel="noreferrer noopener" > <TwitterIcon fontSize="small" sx={{ color: 'grey.500' }} /> </IconButton> )} {props.linkedin && ( <IconButton aria-label={`${props.name} LinkedIn profile`} component="a" href={`https://www.linkedin.com/${props.linkedin}`} target="_blank" rel="noreferrer noopener" > <LinkedInIcon fontSize="small" sx={{ color: 'grey.500' }} /> </IconButton> )} </Box> </Box> <Typography variant="body2" fontWeight="bold" sx={{ mt: 2, mb: 0.5 }}> {props.name} </Typography> <Typography variant="body2" color="text.secondary"> {props.title} </Typography> {props.about && <Divider sx={{ my: 1.5 }} />} {props.about && ( <Typography variant="body2" color="grey.600"> {props.about} </Typography> )} </Paper> ); } const contributors = [ { name: 'Sebastian Silbermann', github: 'eps1lon', title: 'MUI Core, everything Open Source', location: 'Berlin, Germany', locationCountry: 'de', src: 'https://avatars.githubusercontent.com/u/12292047', twitter: 'sebsilbermann', }, { name: 'Ryan Cogswell', github: 'ryancogswell', title: 'Stack Overflow top contributor', location: 'Minnesota, United States', locationCountry: 'us', src: 'https://avatars.githubusercontent.com/u/287804', }, { name: 'Yan Lee', github: 'AGDholo', title: 'Chinese docs', location: 'China', locationCountry: 'cn', src: 'https://avatars.githubusercontent.com/u/13300332', }, { name: 'Jairon Alves Lima', github: 'jaironalves', title: 'Brazilian Portuguese docs', location: 'São Paulo, Brazil', locationCountry: 'br', src: 'https://avatars.githubusercontent.com/u/29267813', }, { name: 'Danica Shen', github: 'DDDDDanica', title: 'Chinese docs', location: 'Ireland', locationCountry: 'ie', src: 'https://avatars.githubusercontent.com/u/12678455', }, ]; const emeriti = [ { name: 'Hai Nguyen', github: 'hai-cea', twitter: 'haicea', title: 'MUI Core, v0.x creator', location: 'Dallas, US', locationCountry: 'us', src: 'https://avatars.githubusercontent.com/u/2007468', }, { name: 'Nathan Marks', github: 'nathanmarks', title: 'MUI Core, v1.x co-creator', location: 'Toronto, CA', locationCountry: 'ca', src: 'https://avatars.githubusercontent.com/u/4420103', }, { name: 'Kevin Ross', github: 'rosskevin', twitter: 'rosskevin', title: 'MUI Core, flow', location: 'Franklin, US', locationCountry: 'us', src: 'https://avatars.githubusercontent.com/u/136564', }, { name: 'Sebastian Sebald', github: 'sebald', twitter: 'sebastiansebald', title: 'MUI Core', location: 'Freiburg, Germany', locationCountry: 'de', src: 'https://avatars.githubusercontent.com/u/985701', }, { name: 'Ken Gregory', github: 'kgregory', title: 'MUI Core', location: 'New Jersey, US', locationCountry: 'us', src: 'https://avatars.githubusercontent.com/u/3155127', }, { name: 'Tom Crockett', github: 'pelotom', twitter: 'pelotom', title: 'MUI Core', location: 'Los Angeles, US', locationCountry: 'us', src: 'https://avatars.githubusercontent.com/u/128019', }, { name: 'Maik Marschner', github: 'leMaik', twitter: 'leMaikOfficial', title: 'MUI Core', location: 'Hannover, Germany', locationCountry: 'de', src: 'https://avatars.githubusercontent.com/u/5544859', }, { name: 'Oleg Slobodskoi', github: 'kof', twitter: 'oleg008', title: 'MUI Core, JSS', location: 'Berlin, Germany', locationCountry: 'de', src: 'https://avatars.githubusercontent.com/u/52824', }, { name: 'Dmitriy Kovalenko', github: 'dmtrKovalenko', twitter: 'goose_plus_plus', title: 'MUI X, date pickers', location: 'Kharkiv, Ukraine', locationCountry: 'ua', src: 'https://avatars.githubusercontent.com/u/16926049', }, { name: 'Josh Wooding', github: 'joshwooding', twitter: 'JoshWooding_', title: 'MUI Core, J.P. Morgan', location: 'London, UK', locationCountry: 'gb', src: 'https://avatars.githubusercontent.com/u/12938082', }, ]; export default function Team() { return ( <React.Fragment> <Section cozy> <Box sx={{ my: 4, display: 'flex', flexDirection: 'column', }} > <SectionHeadline overline="Team" title={ <Typography variant="h2" id="muiers"> Meet the <GradientText>MUIers</GradientText> </Typography> } description="Contributing from all corners of the world, MUI is a global, fully-remote team & community." /> <Button component={Link} noLinkStyle href={ROUTES.careers} endIcon={<KeyboardArrowRightRounded fontSize="small" />} variant="contained" sx={{ width: { xs: '100%', sm: 'fit-content' } }} > View careers </Button> </Box> <Grid container spacing={2}> {(teamMembers as Array<Profile>).map((profileJson) => { const profile = { src: `/static/branding/about/${profileJson.name .split(' ') .map((x) => x.toLowerCase()) .join('-')}.png`, ...profileJson, }; return ( <Grid key={profile.name} item xs={12} sm={6} md={3}> <Person {...profile} /> </Grid> ); })} </Grid> </Section> <Divider /> {/* Community contributors */} <Box data-mui-color-scheme="dark" sx={{ bgcolor: 'primaryDark.900' }}> <Container sx={{ py: { xs: 4, sm: 8 } }}> <Typography component="h3" variant="h4" color="primary.200" fontWeight="semiBold"> Community contributors </Typography> <Typography color="text.secondary" sx={{ maxWidth: { md: 500 } }}> Special members of the community deserve a shout-out for their ever-lasting impact on MUI&apos;s products. </Typography> <Grid container spacing={2} mt={2}> {contributors.map((profile) => ( <Grid key={profile.name} item xs={12} sm={6} md={3}> <Person {...profile} sx={{ bgcolor: 'primaryDark.600' }} /> </Grid> ))} </Grid> <Divider sx={{ my: { xs: 2, sm: 6 } }} /> <Typography component="h3" variant="h4" color="warning.300" fontWeight="semiBold"> Community emeriti </Typography> <Typography color="text.secondary" sx={{ maxWidth: { md: 500 } }}> We honor some no-longer-active core team members who have made valuable contributions in the past. They advise us from time to time. </Typography> <Grid container spacing={2} mt={2}> {emeriti.map((profile) => ( <Grid key={profile.name} item xs={12} sm={6} md={3}> <Person {...profile} sx={{ bgcolor: 'primaryDark.600' }} /> </Grid> ))} </Grid> </Container> </Box> </React.Fragment> ); }
5,116
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/about/TeamStatistics.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; const data = [ { number: '2014', metadata: 'The starting year' }, { number: '100%', metadata: 'Remote global team' }, { number: '20+', metadata: 'Countries represented' }, ]; export default function TeamStatistics() { return ( <Box sx={{ display: 'flex', justifyContent: 'center', gap: 2 }}> {data.map((item) => ( <Box key={item.number} sx={{ height: '100%', width: { xs: '100%', sm: 200 } }}> <Typography component="p" variant="h4" fontWeight="bold" sx={(theme) => ({ textAlign: { xs: 'left', sm: 'center' }, color: 'primary.main', ...theme.applyDarkStyles({ color: 'primary.200', }), })} > {item.number} </Typography> <Typography color="text.secondary" sx={{ textAlign: { xs: 'left', sm: 'center' } }}> {item.metadata} </Typography> </Box> ))} </Box> ); }
5,117
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/action/ArrowButton.tsx
import * as React from 'react'; import IconButton, { IconButtonProps } from '@mui/material/IconButton'; import KeyboardArrowLeftRounded from '@mui/icons-material/KeyboardArrowLeftRounded'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; export default function ArrowButton({ direction, ...props }: { direction: 'left' | 'right' } & IconButtonProps) { const label = { left: 'Previous', right: 'Next', }; return ( <IconButton size="small" aria-label={label[direction]} {...props} sx={[ { border: '1px solid', color: 'primary.main', borderColor: 'grey.200', '&:hover': { borderColor: 'grey.300', }, '&.Mui-disabled': { opacity: 0.5, color: 'grey.700', borderColor: 'grey.300', }, '& + .MuiIconButton-root': { ml: 2, }, }, (theme) => theme.applyDarkStyles({ color: 'primary.200', borderColor: 'primaryDark.400', '&:hover': { borderColor: 'primary.300', }, '&.Mui-disabled': { color: 'primaryDark.200', borderColor: 'primaryDark.400', }, }), ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} > {direction === 'left' && <KeyboardArrowLeftRounded fontSize="small" />} {direction === 'right' && <KeyboardArrowRightRounded fontSize="small" />} </IconButton> ); }
5,118
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/action/Frame.tsx
import * as React from 'react'; import Box, { BoxProps } from '@mui/material/Box'; const FrameDemo = React.forwardRef<HTMLDivElement, BoxProps>(function FrameDemo(props, ref) { return ( <Box ref={ref} {...props} sx={[ (theme) => ({ position: 'relative', border: '1px solid', background: `${(theme.vars || theme).palette.gradients.linearSubtle}`, borderColor: 'grey.100', ...theme.applyDarkStyles({ background: `${(theme.vars || theme).palette.gradients.linearSubtle}`, borderColor: 'primaryDark.700', }), }), ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} /> ); }); const FrameInfo = React.forwardRef<HTMLDivElement, BoxProps>(function FrameInfo(props, ref) { return ( <Box ref={ref} {...props} sx={{ color: '#fff', p: 2, bgcolor: 'common.black', border: '1px solid', borderColor: 'primaryDark.700', colorScheme: 'dark', '* pre, code': { bgcolor: 'common.black', }, ...props.sx, }} /> ); }); function Frame({ sx, ...props }: BoxProps) { return ( <Box {...props} sx={[ { display: 'flex', flexDirection: 'column', '& > div:first-of-type': { borderTopLeftRadius: '12px', borderTopRightRadius: '12px', }, '& > div:last-of-type': { borderBottomLeftRadius: '12px', borderBottomRightRadius: '12px', }, }, ...(Array.isArray(sx) ? sx : [sx]), ]} /> ); } Frame.Demo = FrameDemo; Frame.Info = FrameInfo; export default Frame;
5,119
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/action/Highlighter.tsx
import * as React from 'react'; import ButtonBase, { ButtonBaseProps } from '@mui/material/ButtonBase'; import { alpha } from '@mui/material/styles'; export default function Highlighter({ disableBorder = false, selected = false, sx, ...props }: { disableBorder?: boolean; selectedBg?: 'white' | 'comfort'; selected?: boolean; } & ButtonBaseProps) { const ref = React.useRef<HTMLButtonElement>(null); return ( <ButtonBase component="span" ref={ref} {...props} onClick={(event: any) => { if (ref.current) { ref.current.scrollIntoView({ block: 'nearest' }); } if (props.onClick) { props.onClick(event); } }} onFocusVisible={(event) => { if (ref.current) { ref.current.scrollIntoView({ block: 'nearest' }); } if (props.onFocusVisible) { props.onFocusVisible(event); } }} sx={[ (theme) => ({ justifyContent: 'flex-start', textAlign: 'left', alignItems: 'center', borderRadius: 1, height: '100%', border: '1px solid transparent', transitionProperty: 'all', transitionDuration: '150ms', color: 'primary.300', overflow: 'auto', ...((!disableBorder || selected) && { borderColor: 'grey.100', }), ...(selected && { bgcolor: `${alpha(theme.palette.primary[50], 0.5)}`, borderColor: 'primary.300', boxShadow: `0px 1px 4px ${ (theme.vars || theme).palette.primary[200] }, inset 0px 2px 4px ${alpha(theme.palette.primary[100], 0.5)}`, color: 'primary.500', }), ...(!selected && { '&:hover, &:focus': { bgcolor: 'primary.50', borderColor: 'primary.100', '@media (hover: none)': { bgcolor: 'transparent', }, }, }), ...theme.applyDarkStyles({ color: 'primary.800', ...((!disableBorder || selected) && { borderColor: `${alpha(theme.palette.primaryDark[600], 0.3)}`, }), ...(!selected && { '&:hover, &:focus': { bgcolor: `${alpha(theme.palette.primary[800], 0.1)}`, borderColor: `${alpha(theme.palette.primary[500], 0.3)}`, '@media (hover: none)': { bgcolor: 'transparent', }, }, }), ...(selected && { bgcolor: `${alpha(theme.palette.primary[800], 0.3)}`, borderColor: 'primary.700', color: 'primary.300', boxShadow: `0px 1px 4px ${ (theme.vars || theme).palette.primary[900] }, inset 0px 2px 4px ${(theme.vars || theme).palette.primaryDark[800]}`, }), }), '&.Mui-disabled': { opacity: 0.4, }, }), ...(Array.isArray(sx) ? sx : [sx]), ]} /> ); }
5,120
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/action/InfoCard.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import Link from 'docs/src/modules/components/Link'; interface GlowingIconContainerProps { icon: React.ReactNode; } export function GlowingIconContainer({ icon }: GlowingIconContainerProps) { return ( <Box sx={(theme) => ({ width: 40, height: 40, display: 'flex', justifyContent: 'center', alignItems: 'center', flexShrink: 0, borderRadius: 1, border: '1px solid', borderColor: 'primary.200', bgcolor: 'primary.50', boxShadow: '0px 1px 6px 0px rgba(194, 224, 255, 1), 0px 2px 30px 0px rgba(234, 237, 241, 0.3) inset', ...theme.applyDarkStyles({ borderColor: 'primary.400', bgcolor: 'primary.900', boxShadow: '0px 1px 6px 0px rgba(0, 89, 178, 1), 0px 2px 30px 0px rgba(0, 0, 0, 0.25) inset', }), })} > {icon} </Box> ); } interface InfoCardProps { title: string; classNameTitle?: string; description?: string; classNameDescription?: string; link?: string; icon?: React.ReactNode; svg?: React.ReactNode; } export default function InfoCard(props: InfoCardProps) { const { icon, svg, title, classNameTitle, description, classNameDescription, link } = props; return ( <Paper component={link ? Link : 'div'} href={link} {...(link ? { noLinkStyle: true, } : {})} variant="outlined" sx={(theme) => ({ p: 3.5, height: '100%', background: `${(theme.vars || theme).palette.gradients.linearSubtle}`, ...theme.applyDarkStyles({ bgcolor: 'primaryDark.900', background: `${(theme.vars || theme).palette.gradients.linearSubtle}`, borderColor: 'primaryDark.700', }), })} > {svg && svg} {icon && <GlowingIconContainer icon={icon} />} <Typography fontWeight="bold" component="h3" color="text.primary" variant="body2" mt={icon ? 2 : 0} mb={description ? 0.5 : 0} className={classNameTitle} > {title} </Typography> <Typography variant="body2" color="text.secondary" className={classNameDescription}> {description} </Typography> </Paper> ); }
5,121
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/action/Item.tsx
import * as React from 'react'; import { useTheme } from '@mui/material/styles'; import Box, { BoxProps } from '@mui/material/Box'; import Typography from '@mui/material/Typography'; export function Group({ desktopColumns = 1, rowLayout = false, ...props }: { desktopColumns?: number; rowLayout?: boolean } & BoxProps) { const theme = useTheme(); return ( <Box {...props} sx={{ maxWidth: rowLayout ? 'none' : { md: 500 }, overflow: 'auto', display: { xs: 'grid', sm: rowLayout ? 'flex' : 'grid' }, justifyContent: { xs: 'start', sm: rowLayout ? 'center' : null }, gap: 1, gridTemplateColumns: `repeat(${desktopColumns}, 1fr)`, '@media (prefers-reduced-motion: no-preference)': { scrollBehavior: 'smooth', }, '& > *': { minWidth: { xs: desktopColumns === 1 ? 300 : 225, sm: desktopColumns === 1 ? 400 : 225, md: 'auto', }, gridRow: { xs: 1, md: 'auto' }, }, [theme.breakpoints.down('md')]: { mx: -3, px: 3, mb: -1.5, pb: 2, scrollSnapType: 'inline mandatory', scrollPaddingLeft: 30, scrollPaddingRight: 30, '& > *': { scrollSnapAlign: 'start', }, '& > *:last-child': { position: 'relative', '&:after': { // to create scroll spacing on the right edge content: '""', position: 'absolute', blockSize: '100%', inlineSize: 30, insetBlockStart: 0, insetInlineEnd: -30, }, }, }, [theme.breakpoints.down('sm')]: { mx: -2, px: 2, scrollPaddingLeft: 20, scrollPaddingRight: 20, '& > *:last-child:after': { inlineSize: 20, insetBlockStart: 0, insetInlineEnd: -20, }, }, ...props.sx, }} /> ); } export default function Item({ icon, title, description, ...props }: { icon: React.ReactNode; title: string; description?: string; } & BoxProps) { return ( <Box {...props} component="span" sx={{ p: 2, display: 'flex', alignItems: 'center', ...props.sx, }} > <Box component="span" sx={{ mr: 2, lineHeight: 0 }}> {icon} </Box> <span> <Typography component="span" color="text.primary" variant="body2" fontWeight="bold" sx={{ display: 'block' }} > {title} </Typography> {description && ( <Typography component="span" color="text.secondary" variant="body2" fontWeight="regular" sx={{ mt: 0.5 }} > {description} </Typography> )} </span> </Box> ); }
5,122
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/action/More.tsx
import * as React from 'react'; import { alpha } from '@mui/material/styles'; import Box from '@mui/material/Box'; import ButtonBase, { ButtonBaseProps } from '@mui/material/ButtonBase'; import Typography from '@mui/material/Typography'; import AddCircleRoundedIcon from '@mui/icons-material/AddCircleRounded'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; export default (function More(props: ButtonBaseProps) { const ref = React.useRef<HTMLButtonElement>(null); return ( <ButtonBase ref={ref} {...props} onClick={(event) => { if (ref.current) { ref.current.scrollIntoView({ block: 'nearest' }); } if (props.onClick) { props.onClick(event); } }} onFocusVisible={(event) => { if (ref.current) { ref.current.scrollIntoView({ block: 'nearest' }); } if (props.onFocusVisible) { props.onFocusVisible(event); } }} sx={[ (theme) => ({ p: 2, display: 'flex', alignItems: 'center', justifyContent: 'flex-start', cursor: 'pointer', borderRadius: 1, height: '100%', border: '1px dashed', transitionProperty: 'all', transitionDuration: '150ms', borderColor: 'grey.200', '& * svg': { transition: '0.2s' }, '&:hover, &:focus': { borderColor: 'primary.main', bgcolor: alpha(theme.palette.primary[100], 0.4), '* .chevron': { transform: 'translateX(2px)' }, '@media (hover: none)': { bgcolor: 'transparent', }, }, ...theme.applyDarkStyles({ borderColor: `${alpha(theme.palette.primaryDark[400], 0.3)}`, '&:hover, &:focus': { bgcolor: alpha(theme.palette.primary[900], 0.4), }, }), }), ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} > <Box component="span" sx={{ mr: 1, px: '3px', lineHeight: 0 }}> <AddCircleRoundedIcon color="primary" fontSize="small" /> </Box> <Typography component="span" color="primary.main" variant="body2" fontWeight="bold" sx={{ width: '100%', }} > Much more{' '} <KeyboardArrowRightRounded className="chevron" color="primary" fontSize="small" sx={{ verticalAlign: 'middle', ml: 'auto' }} /> </Typography> </ButtonBase> ); } as typeof ButtonBase);
5,123
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/action/NpmCopyButton.tsx
/* eslint-disable react/prop-types */ import * as React from 'react'; import copy from 'clipboard-copy'; import { SxProps } from '@mui/system'; import { styled, Theme } from '@mui/material/styles'; import ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'; import CheckRounded from '@mui/icons-material/CheckRounded'; const Button = styled('button')(({ theme }) => ({ boxSizing: 'border-box', minWidth: 64, margin: 0, marginTop: 16, cursor: 'copy', padding: 0, display: 'inline-flex', alignItems: 'flex-start', justifyContent: 'center', verticalAlign: 'middle', gap: 8, outline: 0, border: 0, boxShadow: 'none', backgroundColor: 'transparent', fontFamily: theme.typography.fontFamilyCode, fontSize: theme.typography.pxToRem(12), textDecoration: 'none', textTransform: 'initial', lineHeight: 1.5, letterSpacing: 0, transition: theme.transitions.create('color', { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.shortest, }), WebkitTapHighlightColor: 'transparent', WebkitFontSmoothing: 'subpixel-antialiased', color: (theme.vars || theme).palette.grey[600], '&:hover, &:focus-visible': { color: (theme.vars || theme).palette.primary.main, '@media (hover: none)': { color: (theme.vars || theme).palette.grey[600], }, }, '& svg': { display: 'inline-block', position: 'relative', right: 3, top: 1, opacity: 0, transition: theme.transitions.create('opacity', { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.shortest, }), }, '&:focus, &:hover svg': { opacity: 1, }, })); export default function NpmCopyButton( props: React.HTMLAttributes<HTMLButtonElement> & { installation: string; sx?: SxProps<Theme> }, ) { const { installation, onClick, sx, ...other } = props; const [copied, setCopied] = React.useState(false); const handleCopy = () => { setCopied(true); copy(installation).then(() => { setTimeout(() => setCopied(false), 2000); }); }; return ( <Button onClick={(event: any) => { handleCopy(); onClick?.(event); }} {...other} > $ {installation} {copied ? ( <CheckRounded color="inherit" sx={{ fontSize: 15 }} /> ) : ( <ContentCopyRounded color="inherit" sx={{ fontSize: 15 }} /> )} </Button> ); }
5,124
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/action/StylingInfo.tsx
import * as React from 'react'; import { alpha } from '@mui/material/styles'; import Box, { BoxProps } from '@mui/material/Box'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import KeyboardArrowUpRounded from '@mui/icons-material/KeyboardArrowUpRounded'; import KeyboardArrowDownRounded from '@mui/icons-material/KeyboardArrowDownRounded'; import Link from 'docs/src/modules/components/Link'; import ROUTES from 'docs/src/route'; export default function StylingInfo({ appeared, stylingContent, ...props }: { appeared: boolean; stylingContent?: React.ReactElement } & BoxProps) { const [hidden, setHidden] = React.useState(false); const defaultContent = ( <React.Fragment> <Typography fontWeight="bold" color="#fff" variant="body2"> Own the styling! </Typography> <Typography color="grey.400" variant="body2"> Build your own design system using the{' '} <Link href={ROUTES.theming} sx={{ color: 'primary.300' }}> sophisticated theming features </Link> . You can also start by using Google&apos;s Material Design. </Typography> </React.Fragment> ); return ( <Box data-mui-color-scheme="dark" {...props} sx={{ position: 'absolute', bottom: 0, transform: hidden || !appeared ? 'translateY(100%)' : 'translateY(0)', transition: '0.3s', left: 0, right: 0, px: 2, pt: 1, pb: 2, background: ({ palette }) => alpha(palette.primaryDark[900], 0.95), backdropFilter: 'blur(8px)', zIndex: 1, borderTop: '1px solid', borderColor: 'divider', borderRadius: '0 0 10px 10px', ...props.sx, }} > <IconButton aria-label={hidden ? 'show' : 'hide'} onClick={() => setHidden((bool) => !bool)} sx={{ position: 'absolute', zIndex: 2, transition: '0.3s', right: 10, bottom: '100%', transform: hidden || !appeared ? 'translateY(-10px)' : 'translateY(50%)', opacity: appeared ? 1 : 0, bgcolor: 'primary.600', '&:hover, &.Mui-focused': { bgcolor: 'primary.700', }, }} > {hidden ? ( <KeyboardArrowUpRounded fontSize="small" /> ) : ( <KeyboardArrowDownRounded fontSize="small" /> )} </IconButton> {stylingContent || defaultContent} </Box> ); }
5,125
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/animation/FadeDelay.tsx
import * as React from 'react'; import Fade, { FadeProps } from '@mui/material/Fade'; export default function FadeDelay({ delay, ...props }: { delay: number } & FadeProps) { const [fadeIn, setFadeIn] = React.useState(false); React.useEffect(() => { const time = setTimeout(() => { setFadeIn(true); }, delay); return () => { clearTimeout(time); }; }, [delay]); return <Fade in={fadeIn} timeout={1000} {...props} />; }
5,126
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/animation/FlashCode.tsx
import { styled, alpha } from '@mui/material/styles'; import { shouldForwardProp } from '@mui/system'; const FlashCode = styled('div', { shouldForwardProp: (prop) => shouldForwardProp(prop) && prop !== 'endLine' && prop !== 'startLine' && prop !== 'lineHeight', })<{ endLine?: number; startLine?: number; lineHeight?: number | string }>( ({ theme, startLine = 0, endLine = startLine, lineHeight = '0.75rem' }) => ({ borderRadius: 2, pointerEvents: 'none', position: 'absolute', left: 0, right: 0, top: `calc(${lineHeight} * 1.5 * ${startLine})`, height: `calc(${lineHeight} * 1.5 * ${endLine - startLine + 1})`, transition: '0.3s', ...theme.typography.caption, backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / 0.15)` : alpha(theme.palette.primary.main, 0.1), border: '1px solid', borderColor: (theme.vars || theme).palette.primary.dark, zIndex: 1, }), ); export default FlashCode;
5,127
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/animation/Slide.tsx
import * as React from 'react'; import Box, { BoxProps } from '@mui/material/Box'; export default function Slide({ animationName, keyframes, ...props }: BoxProps & { animationName: string; keyframes: Record<string, object> }) { return ( <Box {...props} sx={{ display: 'grid', gridTemplateRows: 'min-content', gap: { xs: 2, sm: 4, md: 8 }, width: 'min-content', animation: `${animationName} 30s ease-out forwards`, '@media (prefers-reduced-motion)': { animation: 'none', }, [`@keyframes ${animationName}`]: { ...keyframes, }, ...props.sx, }} /> ); }
5,128
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/banner/AppFrameBanner.tsx
import * as React from 'react'; import { alpha } from '@mui/material/styles'; import Link from 'docs/src/modules/components/Link'; import FEATURE_TOGGLE from 'docs/src/featureToggle'; export default function AppFrameBanner() { return FEATURE_TOGGLE.enable_docsnav_banner ? ( <Link href="https://mui.com/blog/mui-x-v6/" target="_blank" variant="caption" sx={[ (theme) => ({ display: { xs: 'none', lg: 'block' }, p: 1, maxHeight: '34px', backgroundColor: (theme.vars || theme).palette.primary[50], border: '1px solid', borderColor: (theme.vars || theme).palette.grey[200], borderRadius: 1, transitionProperty: 'all', transitionTiming: 'cubic-bezier(0.4, 0, 0.2, 1)', transitionDuration: '150ms', color: (theme.vars || theme).palette.primary[600], fontWeight: 'medium', '&:hover, &:focus-visible': { backgroundColor: alpha(theme.palette.primary[100], 0.4), borderColor: (theme.vars || theme).palette.primary[200], }, }), (theme) => theme.applyDarkStyles({ backgroundColor: alpha(theme.palette.primary[900], 0.3), borderColor: (theme.vars || theme).palette.primaryDark[700], color: (theme.vars || theme).palette.primary[100], '&:hover, &:focus-visible': { backgroundColor: alpha(theme.palette.primary[900], 0.6), borderColor: (theme.vars || theme).palette.primaryDark[500], }, }), ]} > 🚀 MUI X v6 is out! Discover what&apos;s new and get started now! <br /> </Link> ) : null; }
5,129
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/banner/AppHeaderBanner.tsx
import * as React from 'react'; import Typography from '@mui/material/Typography'; import Link from 'docs/src/modules/components/Link'; import ROUTES from 'docs/src/route'; import FEATURE_TOGGLE from 'docs/src/featureToggle'; function getSurveyMessage() { return ( <React.Fragment> 🚀&nbsp;Influence the future of MUI!&nbsp;&nbsp;Please take a few minutes for the&nbsp; <Link href="https://www.surveymonkey.com/r/mui-developer-survey-2022?source=website" target="_blank" color="inherit" underline="always" sx={{ '&:hover': { opacity: 0.9, }, }} > MUI Developer survey 2022 → </Link> </React.Fragment> ); } function getDefaultHiringMessage() { return ( <React.Fragment> 🚀&#160;&#160;We&apos;re hiring a Designer, Full-stack Engineer, React Community Engineer, and more!&nbsp;&#160; <Link href={ROUTES.careers} // Fix me! target="_blank" color="inherit" underline="always" sx={{ '&:hover': { opacity: 0.9, }, }} > Check the careers page → </Link> </React.Fragment> ); } export default function AppHeaderBanner() { const showSurveyMessage = false; const bannerMessage = showSurveyMessage ? getSurveyMessage() : getDefaultHiringMessage(); return FEATURE_TOGGLE.enable_website_banner ? ( <Typography fontWeight="medium" sx={(theme) => ({ color: '#fff', p: '12px', display: 'flex', flexDirection: { xs: 'column', md: 'row' }, alignItems: { xs: 'start', sm: 'center' }, justifyContent: 'center', fontSize: theme.typography.pxToRem(13), background: `linear-gradient(-90deg, ${(theme.vars || theme).palette.primary[700]}, ${ (theme.vars || theme).palette.primary[500] } 120%)`, ...theme.applyDarkStyles({ background: `linear-gradient(90deg, ${(theme.vars || theme).palette.primary[900]}, ${ (theme.vars || theme).palette.primary[600] } 120%)`, }), })} > {bannerMessage} </Typography> ) : null; }
5,130
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/banner/TableOfContentsBanner.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import { alpha } from '@mui/material/styles'; import Link from 'docs/src/modules/components/Link'; import FEATURE_TOGGLE from 'docs/src/featureToggle'; export default function TableOfContentsBanner() { return FEATURE_TOGGLE.enable_toc_banner ? ( <Link href="https://war.ukraine.ua/support-ukraine/" target="_blank" sx={[ (theme) => ({ mb: 2, mx: 0.5, p: 1, pl: '10px', display: 'flex', alignItems: 'center', gap: '10px', backgroundColor: alpha(theme.palette.grey[50], 0.4), border: '1px solid', borderColor: (theme.vars || theme).palette.divider, borderRadius: 1, transitionProperty: 'all', transitionTiming: 'cubic-bezier(0.4, 0, 0.2, 1)', transitionDuration: '150ms', '&:hover, &:focus-visible': { backgroundColor: (theme.vars || theme).palette.primary[50], borderColor: (theme.vars || theme).palette.primary[200], }, }), (theme) => theme.applyDarkStyles({ backgroundColor: alpha(theme.palette.primary[900], 0.2), borderColor: (theme.vars || theme).palette.divider, '&:hover, &:focus-visible': { backgroundColor: alpha(theme.palette.primary[900], 0.4), borderColor: (theme.vars || theme).palette.primaryDark[500], }, }), ]} > <Box sx={{ borderRadius: '3px', overflow: 'auto', width: 'fit-content', flexShrink: 0 }}> <Box sx={{ height: 6, width: 16, backgroundColor: '#0057B7' }} /> <Box sx={{ height: 6, width: 16, backgroundColor: '#FFD700' }} /> </Box> <Typography component="span" variant="caption" fontWeight="medium" color="text.secondary"> MUI stands in solidarity with Ukraine. </Typography> </Link> ) : null; }
5,131
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/footer/EmailSubscribe.tsx
import * as React from 'react'; import { SxProps } from '@mui/system'; import { Theme, styled, alpha } from '@mui/material/styles'; import Alert from '@mui/material/Alert'; import AlertTitle from '@mui/material/AlertTitle'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import FormLabel from '@mui/material/FormLabel'; import FormHelperText from '@mui/material/FormHelperText'; import InputBase, { inputBaseClasses } from '@mui/material/InputBase'; import CheckCircleRoundedIcon from '@mui/icons-material/CheckCircleRounded'; const NEWSLETTER_SUBSCRIBE_URL = process.env.DEPLOY_ENV === 'production' || process.env.DEPLOY_ENV === 'staging' ? 'https://f0433e60.sibforms.com/serve/MUIEAHEhgYhMvLAw0tycwk1BQaIB-q0akob3JdtDBmHLhSR-jLheJ2T44LFCz27alz9wq_Nkdz9EK7Y8hzM1vQND9kTFyKkkhTIbEzXaH5d-_S9Fw4PXS1zAK8efPY6nhCdoAop1SKTeZ_GAPW5S0xBFQRLUGYbvvRgE4Q2Ki_f1KjbiCqaRuzmj_I3SD1r0CoR4INmK3CLtF4kF' : 'https://f0433e60.sibforms.com/serve/MUIEAE9LexIU5u5hYkoDJ-Mc379-irLHNIlGEgCm5njkAwg6OYFfNQTd25n4SO6vJom9WvQ89GJ0sYBzFYswLRewcOvD_dRtoFycXIObP8SMm-kNO1CdXKaWEZutrfqMKygHb1Je1QBGrMUnJg8J5qVeCwa7rSPBN0A1_6Ug3SiGjgIlbiCcMVA4KbhaYTiBvKkaejlCjgZcLHBT'; const Form = styled('form')({}); function searchParams(params: any) { return Object.keys(params) .filter((key) => params[key] != null) .map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`) .join('&'); } export default function EmailSubscribe({ sx }: { sx?: SxProps<Theme> }) { const [form, setForm] = React.useState<{ email: string; status: 'initial' | 'loading' | 'failure' | 'sent'; }>({ email: '', status: 'initial', }); const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => { event.preventDefault(); setForm((current) => ({ ...current, status: 'loading' })); try { await fetch(NEWSLETTER_SUBSCRIBE_URL, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, mode: 'no-cors', body: searchParams({ EMAIL: form.email, email_address_check: '', locale: 'en', }), }); setForm((current) => ({ ...current, status: 'sent' })); } catch (error) { setForm((current) => ({ ...current, status: 'failure' })); } }; if (form.status === 'sent') { return ( <Alert severity="success" sx={[ (theme) => ({ maxWidth: { sm: 400 }, bgcolor: 'success.50', ...theme.applyDarkStyles({ bgcolor: 'primaryDark.700', }), }), ...(Array.isArray(sx) ? sx : [sx]), ]} iconMapping={{ success: ( <CheckCircleRoundedIcon fontSize="small" sx={(theme: Theme) => ({ color: 'success.700', ...theme.applyDarkStyles({ color: 'success.600', }), })} /> ), }} > <AlertTitle sx={{ typography: 'body2', fontWeight: 700 }}> Thanks for subscribing! </AlertTitle> Go to your email and open the <strong>confirmation email</strong> to confirm your subscription. </Alert> ); } return ( <Form onSubmit={handleSubmit} sx={sx}> <FormLabel htmlFor="email-subscribe" sx={{ typography: 'caption', color: 'text.secondary', fontWeight: 'medium' }} > Your email </FormLabel> <Box sx={{ display: 'flex', flexDirection: { xs: 'column', sm: 'row' }, mt: 1, gap: 1.5, width: { xs: '100%', sm: 'auto' }, maxWidth: 320, }} > <InputBase id="email-subscribe" name="email" type="email" placeholder="[email protected]" value={form.email} onChange={(event) => setForm({ email: event.target.value, status: 'initial' })} inputProps={{ required: true }} sx={[ (theme) => ({ minWidth: 220, borderRadius: 1, border: '1px solid', bgcolor: '#fff', boxShadow: `inset 0 1px 2px ${ (theme.vars || theme).palette.grey[50] }, 0 1px 0.5px ${alpha(theme.palette.grey[100], 0.6)}`, borderColor: 'grey.200', typography: 'body2', '&:hover': { borderColor: 'grey.300', boxShadow: `inset 0 1px 2px ${(theme.vars || theme).palette.grey[50]}, 0 1px 2px ${ (theme.vars || theme).palette.grey[100] }`, }, [`&.${inputBaseClasses.focused}`]: { boxShadow: `0 0 0 3px ${(theme.vars || theme).palette.primary[200]}`, borderColor: 'primary.300', }, [`& .${inputBaseClasses.input}`]: { borderRadius: `calc(${theme.shape.borderRadius}px - 1px)`, py: 1, px: 1.5, }, }), (theme) => theme.applyDarkStyles({ bgcolor: 'primaryDark.900', boxShadow: `inset 0 1px 1px ${ (theme.vars || theme).palette.primaryDark[900] }, 0 1px 0.5px ${(theme.vars || theme).palette.common.black}`, borderColor: 'primaryDark.500', '&:hover': { borderColor: 'primaryDark.400', boxShadow: `inset 0 1px 1px ${ (theme.vars || theme).palette.primaryDark[900] }, 0 1px 2px ${(theme.vars || theme).palette.common.black}`, }, [`&.${inputBaseClasses.focused}`]: { boxShadow: `0 0 0 3px ${(theme.vars || theme).palette.primary[800]}`, borderColor: 'primary.600', }, }), ]} /> <Button variant="outlined" disabled={form.status === 'loading'} type="submit"> Subscribe </Button> </Box> {form.status === 'failure' && ( <FormHelperText sx={(theme) => ({ color: 'warning.800', ...theme.applyDarkStyles({ color: 'warning.500', }), })} > Oops! Something went wrong, please try again later. </FormHelperText> )} </Form> ); }
5,132
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/header/HeaderNavBar.tsx
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ import * as React from 'react'; import { styled, alpha } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Chip from '@mui/material/Chip'; import ButtonBase from '@mui/material/ButtonBase'; import Popper from '@mui/material/Popper'; import Paper from '@mui/material/Paper'; import { unstable_debounce as debounce } from '@mui/utils'; import Fade from '@mui/material/Fade'; import Typography from '@mui/material/Typography'; import IconImage from 'docs/src/components/icon/IconImage'; import ROUTES from 'docs/src/route'; import Link from 'docs/src/modules/components/Link'; import MuiProductSelector from 'docs/src/modules/components/MuiProductSelector'; const Navigation = styled('nav')(({ theme }) => [ { '& ul': { padding: 0, margin: 0, listStyle: 'none', display: 'flex', }, '& li': { color: (theme.vars || theme).palette.text.primary, ...theme.typography.body2, fontWeight: theme.typography.fontWeightBold, '& > a, & > button': { display: 'inline-block', color: 'inherit', font: 'inherit', textDecoration: 'none', padding: theme.spacing('8px', 1), borderRadius: (theme.vars || theme).shape.borderRadius, '&:hover': { color: (theme.vars || theme).palette.grey[700], backgroundColor: (theme.vars || theme).palette.grey[50], // Reset on touch devices, it doesn't add specificity '@media (hover: none)': { backgroundColor: 'initial', }, }, '&:focus-visible': { color: (theme.vars || theme).palette.grey[700], outline: 0, backgroundColor: (theme.vars || theme).palette.grey[100], }, }, '& > div': { cursor: 'default', }, }, }, theme.applyDarkStyles({ '& li': { '& > a, & > button': { '&:hover': { backgroundColor: (theme.vars || theme).palette.primaryDark[700], color: (theme.vars || theme).palette.primaryDark[200], }, '&:focus-visible': { backgroundColor: (theme.vars || theme).palette.primaryDark[600], color: (theme.vars || theme).palette.primaryDark[100], }, }, }, }), ]); const PRODUCT_IDS = [ 'product-core', 'product-advanced', 'product-templates', 'product-design', 'product-toolpad', ]; type ProductSubMenuProps = { icon: React.ReactElement; name: React.ReactNode; description: React.ReactNode; chip?: React.ReactNode; href: string; } & Omit<JSX.IntrinsicElements['a'], 'ref'>; const ProductSubMenu = React.forwardRef<HTMLAnchorElement, ProductSubMenuProps>( function ProductSubMenu({ icon, name, description, chip, href, ...props }, ref) { return ( <Box component={Link} href={href} ref={ref} sx={[ (theme) => ({ display: 'flex', alignItems: 'center', py: 2, pr: 3, '&:hover, &:focus': { backgroundColor: (theme.vars || theme).palette.grey[50], outline: 0, '@media (hover: none)': { backgroundColor: 'initial', outline: 'initial', }, }, }), (theme) => theme.applyDarkStyles({ '&:hover, &:focus': { backgroundColor: alpha(theme.palette.primaryDark[700], 0.4), }, }), ]} {...props} > <Box sx={[ (theme) => ({ px: 2, '& circle': { fill: (theme.vars || theme).palette.grey[100], }, }), (theme) => theme.applyDarkStyles({ '& circle': { fill: (theme.vars || theme).palette.primaryDark[700], }, }), ]} > {icon} </Box> <Box sx={{ flexGrow: 1 }}> <Typography color="text.primary" variant="body2" fontWeight="bold"> {name} </Typography> <Typography color="text.secondary" variant="body2"> {description} </Typography> </Box> {chip} </Box> ); }, ); export default function HeaderNavBar() { const [subMenuOpen, setSubMenuOpen] = React.useState<null | 'products' | 'docs'>(null); const [subMenuIndex, setSubMenuIndex] = React.useState<number | null>(null); const navRef = React.useRef<HTMLUListElement | null>(null); const productsMenuRef = React.useRef<HTMLButtonElement>(null); const docsMenuRef = React.useRef<HTMLButtonElement>(null); React.useEffect(() => { if (typeof subMenuIndex === 'number') { document.getElementById(PRODUCT_IDS[subMenuIndex])?.focus(); } }, [subMenuIndex]); function handleKeyDown(event: React.KeyboardEvent) { let menuItem; if (subMenuOpen === 'products') { menuItem = productsMenuRef.current!; } else if (subMenuOpen === 'docs') { menuItem = docsMenuRef.current!; } else { return; } if (event.key === 'ArrowDown' && subMenuOpen === 'products') { event.preventDefault(); setSubMenuIndex((prevValue) => { if (prevValue === null) { return 0; } if (prevValue === PRODUCT_IDS.length - 1) { return 0; } return prevValue + 1; }); } if (event.key === 'ArrowUp' && subMenuOpen === 'products') { event.preventDefault(); setSubMenuIndex((prevValue) => { if (prevValue === null) { return 0; } if (prevValue === 0) { return PRODUCT_IDS.length - 1; } return prevValue - 1; }); } if (event.key === 'Escape' || event.key === 'Tab') { menuItem.focus(); setSubMenuOpen(null); setSubMenuIndex(null); } } const setSubMenuOpenDebounced = React.useMemo( () => debounce(setSubMenuOpen, 40), [setSubMenuOpen], ); const setSubMenuOpenUndebounce = (value: typeof subMenuOpen) => () => { setSubMenuOpenDebounced.clear(); setSubMenuOpen(value); }; const handleClickMenu = (value: typeof subMenuOpen) => () => { setSubMenuOpenDebounced.clear(); setSubMenuOpen(subMenuOpen ? null : value); }; React.useEffect(() => { return () => { setSubMenuOpenDebounced.clear(); }; }, [setSubMenuOpenDebounced]); return ( <Navigation> <ul ref={navRef} onKeyDown={handleKeyDown}> <li onMouseEnter={setSubMenuOpenUndebounce('products')} onFocus={setSubMenuOpenUndebounce('products')} onMouseLeave={() => setSubMenuOpenDebounced(null)} onBlur={setSubMenuOpenUndebounce(null)} > <ButtonBase ref={productsMenuRef} aria-haspopup aria-expanded={subMenuOpen === 'products' ? 'true' : 'false'} onClick={handleClickMenu('products')} aria-controls={subMenuOpen === 'products' ? 'products-popper' : undefined} > Products </ButtonBase> <Popper id="products-popper" open={subMenuOpen === 'products'} anchorEl={productsMenuRef.current} transition placement="bottom-start" style={{ zIndex: 1200, pointerEvents: subMenuOpen === 'products' ? undefined : 'none', }} > {({ TransitionProps }) => ( <Fade {...TransitionProps} timeout={350}> <Paper variant="outlined" sx={[ (theme) => ({ minWidth: 498, overflow: 'hidden', borderColor: 'grey.200', bgcolor: 'background.paper', boxShadow: `0px 4px 20px rgba(170, 180, 190, 0.3)`, ...theme.applyDarkStyles({ borderColor: 'primaryDark.700', bgcolor: 'primaryDark.900', boxShadow: `0px 4px 20px ${alpha(theme.palette.background.paper, 0.72)}`, }), '& ul': { margin: 0, padding: 0, listStyle: 'none', }, '& li:not(:last-of-type)': { borderBottom: '1px solid', borderColor: 'grey.100', }, '& a': { textDecoration: 'none' }, }), (theme) => theme.applyDarkStyles({ '& li:not(:last-of-type)': { borderColor: 'primaryDark.700', }, }), ]} > <ul> <li> <ProductSubMenu id={PRODUCT_IDS[0]} href={ROUTES.productCore} icon={<IconImage name="product-core" />} name="MUI Core" description="Ready-to-use foundational React components, free forever." /> </li> <li> <ProductSubMenu id={PRODUCT_IDS[1]} href={ROUTES.productAdvanced} icon={<IconImage name="product-advanced" />} name="MUI X" description="Advanced and powerful components for complex use cases." /> </li> <li> <ProductSubMenu id={PRODUCT_IDS[2]} href={ROUTES.productTemplates} icon={<IconImage name="product-templates" />} name="Templates" description="Fully built, out-of-the-box, templates for your application." /> </li> <li> <ProductSubMenu id={PRODUCT_IDS[3]} href={ROUTES.productDesignKits} icon={<IconImage name="product-designkits" />} name="Design kits" description="Our components available in your favorite design tool." /> </li> <li> <ProductSubMenu id={PRODUCT_IDS[4]} href={ROUTES.productToolpad} icon={<IconImage name="product-toolpad" />} name="MUI Toolpad" chip={<Chip label="Beta" size="small" color="primary" variant="outlined" />} description="Low-code admin builder." /> </li> </ul> </Paper> </Fade> )} </Popper> </li> <li onMouseEnter={setSubMenuOpenUndebounce('docs')} onFocus={setSubMenuOpenUndebounce('docs')} onMouseLeave={() => setSubMenuOpenDebounced(null)} onBlur={setSubMenuOpenUndebounce(null)} > <ButtonBase ref={docsMenuRef} aria-haspopup aria-expanded={subMenuOpen === 'docs' ? 'true' : 'false'} onClick={handleClickMenu('docs')} aria-controls={subMenuOpen === 'docs' ? 'docs-popper' : undefined} > Docs </ButtonBase> <Popper id="docs-popper" open={subMenuOpen === 'docs'} anchorEl={docsMenuRef.current} transition placement="bottom-start" style={{ zIndex: 1200, pointerEvents: subMenuOpen === 'docs' ? undefined : 'none' }} > {({ TransitionProps }) => ( <Fade {...TransitionProps} timeout={350}> <Paper variant="outlined" sx={(theme) => ({ minWidth: 498, overflow: 'hidden', borderColor: 'grey.200', bgcolor: 'background.paper', boxShadow: `0px 4px 20px rgba(170, 180, 190, 0.3)`, ...theme.applyDarkStyles({ borderColor: 'primaryDark.700', bgcolor: 'primaryDark.900', boxShadow: `0px 4px 20px ${alpha(theme.palette.background.paper, 0.72)}`, }), '& ul': { margin: 0, padding: 0, listStyle: 'none', }, })} > <ul> <MuiProductSelector /> </ul> </Paper> </Fade> )} </Popper> </li> <li> <Link href={ROUTES.pricing}>Pricing</Link> </li> <li> <Link href={ROUTES.about}>About us</Link> </li> <li> <Link href={ROUTES.blog}>Blog</Link> </li> </ul> </Navigation> ); }
5,133
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/header/HeaderNavDropdown.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Collapse from '@mui/material/Collapse'; import Chip from '@mui/material/Chip'; import { ClickAwayListener } from '@mui/base/ClickAwayListener'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import KeyboardArrowDownRounded from '@mui/icons-material/KeyboardArrowDownRounded'; import SvgHamburgerMenu from 'docs/src/icons/SvgHamburgerMenu'; import Link from 'docs/src/modules/components/Link'; import ROUTES from 'docs/src/route'; const Anchor = styled('a')<{ component?: React.ElementType; noLinkStyle?: boolean }>( ({ theme }) => [ { ...theme.typography.body2, fontWeight: theme.typography.fontWeightBold, textDecoration: 'none', border: 'none', width: '100%', backgroundColor: 'transparent', color: (theme.vars || theme).palette.text.secondary, cursor: 'pointer', display: 'flex', alignItems: 'center', padding: theme.spacing(1), borderRadius: theme.spacing(1), transition: theme.transitions.create('background'), '&:hover, &:focus-visible': { backgroundColor: (theme.vars || theme).palette.grey[100], // Reset on touch devices, it doesn't add specificity '@media (hover: none)': { backgroundColor: 'transparent', }, }, }, theme.applyDarkStyles({ color: '#fff', '&:hover, &:focus-visible': { backgroundColor: (theme.vars || theme).palette.primaryDark[700], // Reset on touch devices, it doesn't add specificity '@media (hover: none)': { backgroundColor: 'transparent', }, }, }), ], ); const UList = styled('ul')({ listStyleType: 'none', padding: 0, margin: 0, }); const PRODUCTS = [ { name: 'MUI Core', description: 'Ready-to-use foundational React components, free forever.', href: ROUTES.productCore, }, { name: 'MUI X', description: 'Advanced and powerful components for complex use-cases.', href: ROUTES.productAdvanced, }, { name: 'Templates', description: 'Fully built, out-of-the-box, templates for your application.', href: ROUTES.productTemplates, }, { name: 'Design kits', description: 'Our components available in your favorite design tool.', href: ROUTES.productDesignKits, }, { name: 'MUI Toolpad', description: 'Low-code admin builder.', href: ROUTES.productToolpad, chip: 'Beta', }, ]; const DOCS = [ { name: 'Material UI', description: "React components that implement Google's Material Design.", href: ROUTES.materialDocs, }, { name: 'Joy UI', description: 'React components for building your design system.', href: ROUTES.joyDocs, }, { name: 'Base UI', description: 'Unstyled React components and low-level hooks.', href: ROUTES.baseDocs, }, { name: 'MUI System', description: 'CSS utilities for rapidly laying out custom designs.', href: ROUTES.systemDocs, }, { name: 'MUI X', description: 'Advanced and powerful components for complex use cases.', href: ROUTES.advancedComponents, }, { name: 'MUI Toolpad', description: 'Low-code admin builder.', href: ROUTES.toolpadDocs, chip: 'Beta', }, ]; export default function HeaderNavDropdown() { const [open, setOpen] = React.useState(false); const [productsOpen, setProductsOpen] = React.useState(true); const [docsOpen, setDocsOpen] = React.useState(false); const hambugerRef = React.useRef<HTMLButtonElement>(null); return ( <React.Fragment> <IconButton color="primary" aria-label="Menu" ref={hambugerRef} disableRipple onClick={() => setOpen((value) => !value)} sx={{ position: 'relative', '& rect': { transformOrigin: 'center', transition: '0.2s', }, ...(open && { '& rect:first-of-type': { transform: 'translate(1.5px, 1.6px) rotateZ(-45deg)', }, '& rect:last-of-type': { transform: 'translate(1.5px, -1.2px) rotateZ(45deg)', }, }), }} > <SvgHamburgerMenu /> </IconButton> <ClickAwayListener onClickAway={(event) => { if (!hambugerRef.current!.contains(event.target as Node)) { setOpen(false); } }} > <Collapse in={open} sx={(theme) => ({ position: 'fixed', top: 56, left: 0, right: 0, boxShadow: `0px 4px 20px rgba(170, 180, 190, 0.3)`, ...theme.applyDarkStyles({ boxShadow: '0px 4px 20px rgba(0, 0, 0, 0.5)', }), })} > <Box sx={{ p: 2, bgcolor: 'background.paper', maxHeight: 'calc(100vh - 56px)', overflow: 'auto', }} > <UList sx={(theme) => ({ '& ul': { borderLeft: '1px solid', borderColor: 'grey.100', ...theme.applyDarkStyles({ borderColor: 'primaryDark.700', }), pl: 1, pb: 1, ml: 1, }, })} > <li> <Anchor as="button" onClick={() => setProductsOpen((bool) => !bool)} sx={{ justifyContent: 'space-between' }} > Products <KeyboardArrowDownRounded color="primary" sx={{ transition: '0.3s', transform: productsOpen ? 'rotate(-180deg)' : 'rotate(0)', }} /> </Anchor> <Collapse in={productsOpen}> <UList> {PRODUCTS.map((item) => ( <li key={item.name}> <Anchor href={item.href} as={Link} noLinkStyle sx={{ flexDirection: 'column', alignItems: 'initial' }} > <Box sx={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', }} > {item.name} {item.chip ? ( <Chip size="small" label={item.chip} color="primary" variant="outlined" /> ) : null} </Box> <Typography variant="body2" color="text.secondary"> {item.description} </Typography> </Anchor> </li> ))} </UList> </Collapse> </li> <li> <Anchor as="button" onClick={() => setDocsOpen((bool) => !bool)} sx={{ justifyContent: 'space-between' }} > Docs <KeyboardArrowDownRounded color="primary" sx={{ transition: '0.3s', transform: docsOpen ? 'rotate(-180deg)' : 'rotate(0)', }} /> </Anchor> <Collapse in={docsOpen}> <UList> {DOCS.map((item) => ( <li key={item.name}> <Anchor href={item.href} as={Link} noLinkStyle sx={{ flexDirection: 'column', alignItems: 'initial' }} > <Box sx={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', }} > {item.name} {item.chip ? ( <Chip size="small" label={item.chip} color="primary" variant="outlined" /> ) : null} </Box> <Typography variant="body2" color="text.secondary"> {item.description} </Typography> </Anchor> </li> ))} </UList> </Collapse> </li> <li> <Anchor href={ROUTES.pricing} as={Link} noLinkStyle> Pricing </Anchor> </li> <li> <Anchor href={ROUTES.about} as={Link} noLinkStyle> About us </Anchor> </li> <li> <Anchor href={ROUTES.blog} as={Link} noLinkStyle> Blog </Anchor> </li> </UList> </Box> </Collapse> </ClickAwayListener> </React.Fragment> ); }
5,134
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/header/ThemeModeToggle.tsx
import * as React from 'react'; import { useColorScheme, useTheme } from '@mui/material/styles'; import IconButton from '@mui/material/IconButton'; import Tooltip from '@mui/material/Tooltip'; import DarkModeOutlined from '@mui/icons-material/DarkModeOutlined'; import LightModeOutlined from '@mui/icons-material/LightModeOutlined'; import useMediaQuery from '@mui/material/useMediaQuery'; import { useChangeTheme } from 'docs/src/modules/components/ThemeContext'; function CssVarsModeToggle(props: { onChange: (checked: boolean) => void }) { const [mounted, setMounted] = React.useState(false); const { mode, systemMode, setMode } = useColorScheme(); React.useEffect(() => { setMounted(true); }, []); const calculatedMode = mode === 'system' ? systemMode : mode; return ( <Tooltip title={calculatedMode === 'dark' ? 'Turn on the light' : 'Turn off the light'}> <IconButton color="primary" disableTouchRipple disabled={!calculatedMode} onClick={() => { props.onChange(calculatedMode === 'light'); setMode(calculatedMode === 'dark' ? 'light' : 'dark'); }} > {!calculatedMode || !mounted ? null : { light: <DarkModeOutlined fontSize="small" />, dark: <LightModeOutlined fontSize="small" />, }[calculatedMode]} </IconButton> </Tooltip> ); } export default function ThemeModeToggle() { const theme = useTheme(); const changeTheme = useChangeTheme(); const [mode, setMode] = React.useState<string | null>(null); const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)'); React.useEffect(() => { let initialMode = 'system'; try { initialMode = localStorage.getItem('mui-mode') || initialMode; } catch (error) { // do nothing } setMode(initialMode); }, []); const handleChangeThemeMode = (checked: boolean) => { const paletteMode = checked ? 'dark' : 'light'; setMode(paletteMode); try { localStorage.setItem('mui-mode', paletteMode); // syncing with homepage, can be removed once all pages are migrated to CSS variables } catch (error) { // do nothing } changeTheme({ paletteMode }); }; if (mode === null) { return <IconButton color="primary" disableTouchRipple />; } if (theme.vars) { // Temporarily renders conditionally because `useColorScheme` could not be used in the pages that haven't migrated to CSS theme variables. return <CssVarsModeToggle onChange={handleChangeThemeMode} />; } const checked = mode === 'system' ? prefersDarkMode : mode === 'dark'; return ( <Tooltip title={checked ? 'Turn on the light' : 'Turn off the light'}> <IconButton color="primary" disableTouchRipple onClick={() => { handleChangeThemeMode(!checked); }} > {checked ? <LightModeOutlined fontSize="small" /> : <DarkModeOutlined fontSize="small" />} </IconButton> </Tooltip> ); }
5,135
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/AdvancedShowcase.tsx
import * as React from 'react'; import { DataGrid, GridCellParams, GridRenderEditCellParams, GridColDef } from '@mui/x-data-grid'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import ShowcaseContainer from 'docs/src/components/home/ShowcaseContainer'; import HighlightedCode from 'docs/src/modules/components/HighlightedCode'; import MarkdownElement from 'docs/src/components/markdown/MarkdownElement'; import XGridGlobalStyles from 'docs/src/components/home/XGridGlobalStyles'; import ProgressBar from 'docs/src/components/x-grid/ProgressBar'; import EditProgress from 'docs/src/components/x-grid/EditProgress'; import Status from 'docs/src/components/x-grid/Status'; import EditStatus from 'docs/src/components/x-grid/EditStatus'; const columns: Array<GridColDef> = [ { field: 'desk', headerName: 'desk', width: 72, sortable: false, editable: true, }, { field: 'commodity', headerName: 'Commodity', width: 132, editable: true }, { field: 'traderName', headerName: 'Trader Name', width: 143, editable: true }, { field: 'filledQuantity', headerName: 'Filled', width: 85, sortable: false, editable: true, renderCell: (params: GridCellParams) => { return <ProgressBar value={Number(params.value)!} />; }, renderEditCell: (params: GridRenderEditCellParams) => { return <EditProgress {...params} />; }, }, { field: 'status', headerName: 'Status', width: 78, sortable: false, editable: true, renderCell: (params: GridCellParams) => { return <Status status={(params.value || '').toString()} />; }, renderEditCell: (params: GridRenderEditCellParams) => { return <EditStatus {...params} />; }, }, ]; const code = `<DataGrid density="compact" hideFooter rows={[ { desk: 'D-985', commodity: 'Adzuki bean', traderName: 'Roy Green', quantity: '83,996', filledQuantity: 1, status: 'PartiallyFilled', }, ]} columns={[ // column definition example { field: 'filledQuantity', headerName: 'Filled', editable: true, renderCell: (params) => <ProgressBar value={Number(params.value)} />, renderEditCell: (params) => <EditProgress {...params} />, }, ]} />`; const rows = [ { id: 'c7c5977f-efc6-58a3-a20d-669c636da015', desk: 'D-4716', commodity: 'Oats', traderName: 'Gabriel Cummings', filledQuantity: 0.0479549532825939, status: 'Open', }, { id: '4636d35f-3ec4-5e7b-90e0-30120d5d83d2', desk: 'D-4580', commodity: 'Milk', traderName: 'Martha Waters', filledQuantity: 0.2534935430195403, status: 'Open', }, { id: 'dd07fa31-e355-5b4c-ad8d-8ae97f56a716', desk: 'D-6196', commodity: 'Wheat', traderName: 'Jimmy Malone', filledQuantity: 0.6676395476103612, status: 'PartiallyFilled', }, { id: 'b85fda59-5ca0-578c-830b-4fdb47df1099', desk: 'D-996', commodity: 'Wheat', traderName: 'Lenora Olson', filledQuantity: 0.7537063736024592, status: 'Filled', }, { id: '363b4295-c82d-5f67-8ef4-bb34bf37d059', desk: 'D-6860', commodity: 'Rough Rice', traderName: 'Carolyn Massey', filledQuantity: 0.7031953975185417, status: 'PartiallyFilled', }, { id: 'bae95560-8148-5026-a436-807f24600557', desk: 'D-4685', commodity: 'Soybean Oil', traderName: 'Agnes Silva', filledQuantity: 0.8838178308032056, status: 'PartiallyFilled', }, { id: '38a84161-6f0b-5ca5-a5b1-d613532e4fa6', desk: 'D-1123', commodity: 'Coffee C', traderName: 'Zachary Clark', filledQuantity: 0.7112560229799851, status: 'PartiallyFilled', }, { id: 'f7d8861d-3561-5c4c-ab02-631899d93310', desk: 'D-7941', commodity: 'Robusta coffee', traderName: 'Jeff Jimenez', filledQuantity: 0.6904698699230156, status: 'PartiallyFilled', }, { id: 'd2ca5413-edf7-5292-8b30-69fb1b49d1ee', desk: 'D-1361', commodity: 'Adzuki bean', traderName: 'Wesley Marshall', filledQuantity: 0.36190808841874156, status: 'PartiallyFilled', }, { id: '39764aea-bb06-5857-a0a3-ff1dc42e4f9b', desk: 'D-9230', commodity: 'Rough Rice', traderName: 'Maud Simmons', filledQuantity: 0.7662438958220293, status: 'Filled', }, { id: 'b0a6e433-4227-5d75-a2ab-80e40a2eec55', desk: 'D-7688', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Lelia Torres', filledQuantity: 0.28704903185867087, status: 'Filled', }, { id: 'a1351174-8a1d-5638-810e-2b671030b2e9', desk: 'D-1790', commodity: 'Coffee C', traderName: 'Edna Bryan', filledQuantity: 0.3989893401202464, status: 'Filled', }, { id: 'c4c22dd0-948d-531d-bde8-9040633e9bd4', desk: 'D-4897', commodity: 'Cotton No.2', traderName: 'Carolyn Nichols', filledQuantity: 0.10424570183227057, status: 'Open', }, { id: '5210de80-8dcb-5d80-847c-6178d6c0260b', desk: 'D-65', commodity: 'Robusta coffee', traderName: 'Ricardo Wright', filledQuantity: 0.8049823113207547, status: 'PartiallyFilled', }, { id: 'f86fa451-471e-55da-b441-5e20915a2122', desk: 'D-8769', commodity: 'Wheat', traderName: 'Ruby Nelson', filledQuantity: 0.11215377033021193, status: 'Rejected', }, { id: '35353401-e788-51bd-a716-b861f2820be4', desk: 'D-525', commodity: 'Wheat', traderName: 'Troy Wong', filledQuantity: 0.4741861465653234, status: 'PartiallyFilled', }, { id: '98872efb-af7f-5345-bae6-03dec13cd3fa', desk: 'D-518', commodity: 'Sugar No.11', traderName: 'Louis Crawford', filledQuantity: 0.524862693663415, status: 'PartiallyFilled', }, { id: 'f0378708-fd92-51d5-8121-f01ef1045ff1', desk: 'D-5497', commodity: 'Soybean Oil', traderName: 'Evelyn Morrison', filledQuantity: 0.5463434089508225, status: 'PartiallyFilled', }, { id: 'f52fe7ae-9418-50c1-9407-120ff96781c6', desk: 'D-2293', commodity: 'Soybean Oil', traderName: 'Melvin Lawson', filledQuantity: 0.2514770194052941, status: 'PartiallyFilled', }, { id: '742e140a-6344-57de-bcdd-33bb4989a5dd', desk: 'D-663', commodity: 'Robusta coffee', traderName: 'Glen Gilbert', filledQuantity: 0.314012076348458, status: 'Filled', }, { id: '1e36b0d9-1b51-5234-8ff6-d2a4c28b32ea', desk: 'D-2531', commodity: 'Rough Rice', traderName: 'Francisco Norton', filledQuantity: 0.1836575339319753, status: 'PartiallyFilled', }, { id: '6ac4d048-c24f-5322-bf67-ec6f8bea3b93', desk: 'D-3787', commodity: 'Milk', traderName: 'Thomas Salazar', filledQuantity: 0.37326607818411095, status: 'Rejected', }, { id: 'c81331d3-8de6-5df5-858e-5d5ed119c1fd', desk: 'D-8858', commodity: 'Cotton No.2', traderName: 'Lucille Wise', filledQuantity: 0.869984727152646, status: 'Rejected', }, { id: 'dc26c4c7-30ed-588d-bcb2-44cd25ed2943', desk: 'D-579', commodity: 'Sugar No.14', traderName: 'Lena Garza', filledQuantity: 0.9933732864916994, status: 'Filled', }, { id: '66bc0b77-e9f7-59f2-9315-c16232f6f5f8', desk: 'D-7370', commodity: 'Sugar No.14', traderName: 'Rodney Douglas', filledQuantity: 0.049633779588669, status: 'Filled', }, { id: '6f04f0b6-18fa-56fd-aa9a-de6508854152', desk: 'D-1193', commodity: 'Sugar No.11', traderName: 'Eliza Erickson', filledQuantity: 0.9258048289738431, status: 'PartiallyFilled', }, { id: '837da291-6130-5c81-806a-67589dbf3f50', desk: 'D-5989', commodity: 'Rough Rice', traderName: 'Marie Gregory', filledQuantity: 0.45995529450930966, status: 'PartiallyFilled', }, { id: '8b0c9f9e-c004-50ef-9c7f-d1c022ca976b', desk: 'D-117', commodity: 'Cocoa', traderName: 'Jeanette Hicks', filledQuantity: 0.4722404161047968, status: 'Filled', }, { id: '46fcb561-3de8-5485-b9cd-5da9f9f01628', desk: 'D-4659', commodity: 'Oats', traderName: 'Eugene Moran', filledQuantity: 0.28724322458139134, status: 'Open', }, { id: 'ad75196d-724f-52d5-a353-6a5797e08310', desk: 'D-6831', commodity: 'Wheat', traderName: 'Norman Hodges', filledQuantity: 0.5609013580062677, status: 'Rejected', }, { id: '5ae02b20-964e-5760-9a4d-7f6f299df30a', desk: 'D-8135', commodity: 'Rough Rice', traderName: 'Josephine Lamb', filledQuantity: 0.689861075157477, status: 'PartiallyFilled', }, { id: 'c9c06672-638e-585a-996a-32f8682d2f54', desk: 'D-3385', commodity: 'Wheat', traderName: 'Nina Christensen', filledQuantity: 0.06040954363014717, status: 'PartiallyFilled', }, { id: '5a1946ea-589f-55fa-9117-64caad3a37d9', desk: 'D-9036', commodity: 'Cocoa', traderName: 'Stanley Munoz', filledQuantity: 0.1275418120563109, status: 'Rejected', }, { id: 'ab237f11-ac6a-50f1-b9a6-a9c9f9f4e24d', desk: 'D-7682', commodity: 'Soybean Oil', traderName: 'Oscar Lambert', filledQuantity: 0.9839746183854833, status: 'Filled', }, { id: '5c51439b-1591-522e-96cf-076bdae40655', desk: 'D-4502', commodity: 'Cocoa', traderName: 'Kenneth Miles', filledQuantity: 0.25830009205277693, status: 'Open', }, { id: '64bfe805-6632-59fe-9835-18e2c7ef7df3', desk: 'D-2325', commodity: 'Soybean Meal', traderName: 'Ray Greene', filledQuantity: 0.0014699524427150886, status: 'Rejected', }, { id: 'a8bcf050-34ad-52ec-a9f1-845ccfa943bb', desk: 'D-2013', commodity: 'Soybeans', traderName: 'Georgia McDaniel', filledQuantity: 0.7551895272190895, status: 'PartiallyFilled', }, { id: '74c6c7eb-591d-5ce9-9a8b-3880d95ed5fb', desk: 'D-7267', commodity: 'Corn', traderName: 'Jordan Anderson', filledQuantity: 0.801270122581598, status: 'Rejected', }, { id: 'c2410927-00b9-5fea-b2f7-04a45c1f1586', desk: 'D-5965', commodity: 'Sugar No.11', traderName: 'Keith Harvey', filledQuantity: 0.9677904122626859, status: 'Filled', }, { id: '42f6796a-429a-5be4-9ea3-b03dd850db06', desk: 'D-9929', commodity: 'Sugar No.11', traderName: 'Millie Burke', filledQuantity: 0.8673800259403373, status: 'Filled', }, { id: '08cbdea1-a9e2-55b4-ab89-95b92a8430f9', desk: 'D-786', commodity: 'Sugar No.11', traderName: 'Wesley Davis', filledQuantity: 0.2330411076067782, status: 'Open', }, { id: '156d7091-eea4-5df0-81d3-1634871595f8', desk: 'D-4467', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Carolyn Robertson', filledQuantity: 0.0968306776396428, status: 'Filled', }, { id: '3cb30764-f296-5ba0-a788-2e6006b1b2e2', desk: 'D-7832', commodity: 'Sugar No.14', traderName: 'Adele Tucker', filledQuantity: 0.9380997258396162, status: 'Rejected', }, { id: 'a266c8d7-83ac-53ce-8916-da103c501901', desk: 'D-5677', commodity: 'Wheat', traderName: 'Emma Rodriguez', filledQuantity: 0.9924235750154171, status: 'PartiallyFilled', }, { id: '38727ca2-b64c-5de6-94df-20827d4ed4ce', desk: 'D-6863', commodity: 'Adzuki bean', traderName: 'Iva Rose', filledQuantity: 0.6088916817217814, status: 'PartiallyFilled', }, { id: 'e60dee5b-e105-5261-9e21-72f1ab2bb4a4', desk: 'D-2036', commodity: 'Coffee C', traderName: 'Hattie Castro', filledQuantity: 0.8496925185809324, status: 'PartiallyFilled', }, { id: '79aefe4e-1bf5-553d-9a03-1901d8378567', desk: 'D-2946', commodity: 'Adzuki bean', traderName: 'Mario Harris', filledQuantity: 0.2892613962645957, status: 'PartiallyFilled', }, { id: '5197d9a8-fddd-5961-aafc-ac9324f7bab0', desk: 'D-7605', commodity: 'Sugar No.14', traderName: 'Juan Reyes', filledQuantity: 0.1377354863514033, status: 'Open', }, { id: '3145255d-b4ff-595a-bdfa-f78c781991cc', desk: 'D-5400', commodity: 'Rapeseed', traderName: 'Adele Gray', filledQuantity: 0.13151126174851566, status: 'Rejected', }, { id: 'b4028076-e520-519f-ab47-aca99595d668', desk: 'D-5526', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Estelle May', filledQuantity: 0.025332033435087664, status: 'PartiallyFilled', }, { id: 'eeb80b26-46a0-5ce2-8aec-b26aeb05ad05', desk: 'D-9779', commodity: 'Cocoa', traderName: 'Cordelia Barnett', filledQuantity: 0.3473095737246681, status: 'Open', }, { id: 'ae3d7416-c90e-56c2-826c-8de629a90efa', desk: 'D-4769', commodity: 'Coffee C', traderName: 'Caroline Garza', filledQuantity: 0.6020121274752663, status: 'PartiallyFilled', }, { id: 'bd17e936-515f-5756-823b-25108c95140d', desk: 'D-2882', commodity: 'Soybeans', traderName: 'Rosetta Perkins', filledQuantity: 0.1712309429700734, status: 'Filled', }, { id: 'bc069177-a127-585e-ab85-04608552c83a', desk: 'D-9733', commodity: 'Soybean Oil', traderName: 'Jason Cain', filledQuantity: 0.7983991064780342, status: 'Rejected', }, { id: '11a484c3-9163-549b-b04a-eb73af890281', desk: 'D-5408', commodity: 'Coffee C', traderName: 'Steven Ortega', filledQuantity: 0.6365814973893513, status: 'PartiallyFilled', }, { id: '2f034401-c06f-5e11-ba70-ea067750ca4c', desk: 'D-8614', commodity: 'Oats', traderName: 'Allie Brewer', filledQuantity: 0.7054064048517121, status: 'Filled', }, { id: 'f62c6b11-7ca2-5b13-9a93-863af76f9ab7', desk: 'D-1461', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Johanna Harvey', filledQuantity: 0.11258119476094133, status: 'PartiallyFilled', }, { id: 'dc80dd21-15cd-5d33-b84b-e75e401407ef', desk: 'D-6751', commodity: 'Milk', traderName: 'Willie Castro', filledQuantity: 0.385713952348727, status: 'PartiallyFilled', }, { id: '81ea4524-9723-5736-9abd-103ca0497c5f', desk: 'D-9687', commodity: 'Soybean Meal', traderName: 'Mable Wilkins', filledQuantity: 0.6218296665060757, status: 'PartiallyFilled', }, { id: '99539ac3-c87b-55f6-91d4-c442022107b8', desk: 'D-8260', commodity: 'Soybeans', traderName: 'Lora Chandler', filledQuantity: 0.3371109755034435, status: 'Open', }, { id: '0d2f8123-129c-5c0b-99fc-aa6856667ba1', desk: 'D-8306', commodity: 'Rough Rice', traderName: 'Jeffery Reynolds', filledQuantity: 0.17820411392405064, status: 'Open', }, { id: '6cad0de2-1c11-59b2-aa02-037fa2bb1326', desk: 'D-6616', commodity: 'Robusta coffee', traderName: 'Sean Daniels', filledQuantity: 0.8600548380114005, status: 'Filled', }, { id: '357c2bf3-9580-52f7-8205-28376bc23a7a', desk: 'D-9068', commodity: 'Milk', traderName: 'Tom Cruz', filledQuantity: 0.24869715688444435, status: 'PartiallyFilled', }, { id: '3b21e23d-035c-5292-b601-331759a7ba2a', desk: 'D-928', commodity: 'Cotton No.2', traderName: 'Sallie Reed', filledQuantity: 0.3883119527591122, status: 'Rejected', }, { id: 'eee5f670-0a9c-5682-b356-f37eb1624650', desk: 'D-2278', commodity: 'Oats', traderName: 'Eddie Collier', filledQuantity: 0.4391332611050921, status: 'PartiallyFilled', }, { id: 'ade4fc5f-143c-57d3-9aff-bb73e0c4cb91', desk: 'D-8088', commodity: 'Cotton No.2', traderName: 'Randy Horton', filledQuantity: 0.4539785604900459, status: 'PartiallyFilled', }, { id: '40a5bf58-9314-5046-99b2-f5c0ef42e598', desk: 'D-1523', commodity: 'Cotton No.2', traderName: 'Virginia Douglas', filledQuantity: 0.9567493226044831, status: 'PartiallyFilled', }, { id: '561b4d4c-70ab-5f4b-b26e-e87339728293', desk: 'D-1429', commodity: 'Sugar No.14', traderName: 'Lela Cunningham', filledQuantity: 0.18127620545073375, status: 'Rejected', }, { id: '93859c37-d158-5cb4-a9eb-a2b2d6bdb28b', desk: 'D-4687', commodity: 'Sugar No.14', traderName: 'Ian Norton', filledQuantity: 0.6055132227700583, status: 'Rejected', }, { id: 'aa703f8e-4a96-5655-98cb-3ea5b798ad72', desk: 'D-1889', commodity: 'Sugar No.14', traderName: 'Evan Morris', filledQuantity: 0.407198982888347, status: 'Open', }, { id: '94534799-c911-5aeb-a0f8-b17aebd93936', desk: 'D-3509', commodity: 'Coffee C', traderName: 'Steve Hart', filledQuantity: 0.5375611152711095, status: 'PartiallyFilled', }, { id: '8fffed75-63cc-556e-baf5-eee7ca12d48f', desk: 'D-474', commodity: 'Wheat', traderName: 'Marvin Rios', filledQuantity: 0.9431855233126833, status: 'PartiallyFilled', }, { id: 'adbec39c-5481-500e-b813-d03094bb96c0', desk: 'D-1294', commodity: 'Sugar No.11', traderName: 'Adam Anderson', filledQuantity: 0.6335130816856401, status: 'Rejected', }, { id: 'fc1e7f6a-e235-53ae-ab41-7c6130caa085', desk: 'D-2391', commodity: 'Cocoa', traderName: 'Austin Chambers', filledQuantity: 0.8607138605948271, status: 'PartiallyFilled', }, { id: 'b4cf5197-f388-55fe-8933-e4a019121b6a', desk: 'D-3444', commodity: 'Adzuki bean', traderName: 'Virgie Massey', filledQuantity: 0.40006891798759475, status: 'PartiallyFilled', }, { id: '667b4761-b263-5c4c-bbff-6c3c073a3ca5', desk: 'D-1223', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Mark Cortez', filledQuantity: 0.4825927576150357, status: 'Rejected', }, { id: '9398a9d6-4665-5efa-a58a-b9c8006b8161', desk: 'D-1192', commodity: 'Soybeans', traderName: 'Alex Mack', filledQuantity: 0.7543978871607951, status: 'Filled', }, { id: '93b61d8b-e5c7-5bd3-9a2c-8d54d65f0234', desk: 'D-594', commodity: 'Oats', traderName: 'Viola Page', filledQuantity: 0.7671992174763612, status: 'Filled', }, { id: '082ee086-4ca4-5435-9b00-5a1ee84e1b3f', desk: 'D-5247', commodity: 'Rapeseed', traderName: 'Jean Craig', filledQuantity: 0.6694073624595469, status: 'PartiallyFilled', }, { id: 'e75b260d-fd17-5a95-96d9-e05c67d4fa2a', desk: 'D-7971', commodity: 'Rough Rice', traderName: 'Virgie Barker', filledQuantity: 0.8371273314730504, status: 'Filled', }, { id: '697310a4-12e5-5617-9267-faf19cd26a33', desk: 'D-5387', commodity: 'Sugar No.11', traderName: 'Bill Joseph', filledQuantity: 0.6125830428946863, status: 'Rejected', }, { id: '7b2dc8e6-273f-5701-aa37-993800bc9ef1', desk: 'D-8059', commodity: 'Rapeseed', traderName: 'John Anderson', filledQuantity: 0.4437171966656375, status: 'Rejected', }, { id: '45ded38a-3ac2-5f3e-b334-e1bb6221b212', desk: 'D-2321', commodity: 'Oats', traderName: 'Leon Jacobs', filledQuantity: 0.11606812487445951, status: 'Filled', }, { id: '4b04aa91-4921-5bdd-91c8-40bce5d678b6', desk: 'D-2730', commodity: 'Milk', traderName: 'Ada Rowe', filledQuantity: 0.4711698320946876, status: 'Filled', }, { id: 'f8a9562d-02e4-5a5e-9800-3f2e84926701', desk: 'D-8605', commodity: 'Wheat', traderName: 'Harry Garrett', filledQuantity: 0.5865080647022175, status: 'PartiallyFilled', }, { id: 'e5a3cc2b-4ce9-5418-9697-2b1deaced5d6', desk: 'D-9428', commodity: 'Sugar No.14', traderName: 'Vernon Bowen', filledQuantity: 0.09028256374913853, status: 'PartiallyFilled', }, { id: '356b87c5-b3ea-54bb-a62b-28a0a8793770', desk: 'D-7083', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Frank Weber', filledQuantity: 0.57327852004111, status: 'Filled', }, { id: '961d891a-70d4-5725-80c6-459f710db02b', desk: 'D-5408', commodity: 'Rough Rice', traderName: 'Lenora Lamb', filledQuantity: 0.07783614413418118, status: 'Open', }, { id: '9fa93762-095f-500a-a059-b91e6cc4ea98', desk: 'D-4924', commodity: 'Sugar No.14', traderName: 'Christian Abbott', filledQuantity: 0.9482298048155008, status: 'Filled', }, { id: '561c34bd-fa2a-5303-8973-1994b2a15ad9', desk: 'D-6663', commodity: 'Corn', traderName: 'Lena Hill', filledQuantity: 0.8127893980520517, status: 'Filled', }, { id: '55293c3f-94e2-5ce3-b965-e35c5f0639a2', desk: 'D-1114', commodity: 'Sugar No.11', traderName: 'Cecilia Mason', filledQuantity: 0.9393481316466439, status: 'Open', }, { id: '02eb1442-1902-50ca-a9a3-c2b048878290', desk: 'D-1749', commodity: 'Adzuki bean', traderName: 'Julia Maldonado', filledQuantity: 0.3119066455696203, status: 'Filled', }, { id: '5c193801-1d91-5afa-a339-9c1d8f416e92', desk: 'D-7306', commodity: 'Wheat', traderName: 'Jane Shaw', filledQuantity: 0.5279746470757707, status: 'PartiallyFilled', }, { id: '5e3c9e2f-6401-5a4c-afdf-4e89266c9017', desk: 'D-7077', commodity: 'Rough Rice', traderName: 'Claudia Harmon', filledQuantity: 0.54239663629993, status: 'PartiallyFilled', }, { id: 'd8ee32ee-d611-501f-b21b-b916c254d0e7', desk: 'D-101', commodity: 'Soybeans', traderName: 'Glenn Allison', filledQuantity: 0.8814050759417142, status: 'Open', }, { id: '00c0882e-07d1-5c62-8a5d-69ec49084f38', desk: 'D-7110', commodity: 'Sugar No.11', traderName: 'Henrietta Curtis', filledQuantity: 0.4624904028771164, status: 'Filled', }, { id: 'ac7688eb-3365-5e34-8d1b-f79c5aaf0b81', desk: 'D-677', commodity: 'Robusta coffee', traderName: 'Elmer Bryan', filledQuantity: 0.40958857531451887, status: 'PartiallyFilled', }, { id: '4c2836fa-c51c-569b-8ad7-9140c3e7d63b', desk: 'D-9920', commodity: 'Milk', traderName: 'Elizabeth Clark', filledQuantity: 0.4049911026306198, status: 'Open', }, { id: '6109f3ed-e043-5979-af12-3875c79aa79f', desk: 'D-7787', commodity: 'Adzuki bean', traderName: 'Edgar Evans', filledQuantity: 0.7634387200489934, status: 'Filled', }, { id: 'f18a2566-c372-5638-8092-d2848a65a16c', desk: 'D-6303', commodity: 'Sugar No.14', traderName: 'Lina Todd', filledQuantity: 0.16883514465023725, status: 'Filled', }, { id: '8bc49cb4-acdf-5a8b-be1c-95f3c593deef', desk: 'D-73', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Gordon Baldwin', filledQuantity: 0.6484654135505205, status: 'PartiallyFilled', }, { id: 'a476668c-dabb-5aa2-b530-428c731d7b3c', desk: 'D-3452', commodity: 'Oats', traderName: 'Gussie Reynolds', filledQuantity: 0.6928500781673739, status: 'Open', }, { id: '30057e00-ec9d-5a37-82ff-dd6137399957', desk: 'D-827', commodity: 'Rapeseed', traderName: 'Mitchell Matthews', filledQuantity: 0.22168627332385762, status: 'PartiallyFilled', }, { id: '1383a9a2-56fc-55e8-99d3-c457fc9fa2c5', desk: 'D-1633', commodity: 'Soybeans', traderName: 'Jane Hammond', filledQuantity: 0.2868775280153836, status: 'Filled', }, { id: '7f7cc9da-bbf7-5aee-b68f-1ee94f5f89c2', desk: 'D-1622', commodity: 'Robusta coffee', traderName: 'Georgie Tate', filledQuantity: 0.9259330388579476, status: 'PartiallyFilled', }, { id: '9584996b-09b8-5abf-8a20-71fbc617995e', desk: 'D-696', commodity: 'Oats', traderName: 'Ethel Armstrong', filledQuantity: 0.6007850088630033, status: 'PartiallyFilled', }, { id: 'ed0c3d0d-6cc2-5732-858f-6352178575ac', desk: 'D-9020', commodity: 'Soybean Meal', traderName: 'Jack Santos', filledQuantity: 0.6486944952602695, status: 'PartiallyFilled', }, { id: '60d91d44-247a-5131-9388-f1d65db16e8c', desk: 'D-5260', commodity: 'Soybeans', traderName: 'Charlotte Cunningham', filledQuantity: 0.09144508891824116, status: 'Filled', }, { id: '6cf3566d-5a3f-52d8-97a4-73dd58918142', desk: 'D-5319', commodity: 'Oats', traderName: 'Hannah Wolfe', filledQuantity: 0.8605679898648648, status: 'Filled', }, { id: 'e6d2b6b1-fb2b-546e-a259-721dfc1a0a7c', desk: 'D-2444', commodity: 'Soybean Meal', traderName: 'Willie Patrick', filledQuantity: 0.5127380856706582, status: 'Open', }, { id: 'b6d6ac58-8d0e-55b3-b8f9-d2adb0b3faa8', desk: 'D-6901', commodity: 'Sugar No.11', traderName: 'Daisy Porter', filledQuantity: 0.8720827421709538, status: 'PartiallyFilled', }, { id: '8030ac87-ac3e-55fa-baa3-587249085cc8', desk: 'D-6814', commodity: 'Sugar No.11', traderName: 'Patrick Ferguson', filledQuantity: 0.19896190022105673, status: 'Filled', }, { id: '1a418179-f135-5817-a6dc-1763d4f7ebb2', desk: 'D-8029', commodity: 'Adzuki bean', traderName: 'Jose Buchanan', filledQuantity: 0.13700966458214894, status: 'Open', }, { id: 'f7864a66-0ac8-5ade-ac9c-8191d1aa3846', desk: 'D-5221', commodity: 'Robusta coffee', traderName: 'Jordan Henry', filledQuantity: 0.13788405524758057, status: 'PartiallyFilled', }, { id: '020f45bb-c953-5e2a-b2f3-df651c2b44f8', desk: 'D-7174', commodity: 'Coffee C', traderName: 'Connor Floyd', filledQuantity: 0.9599152968005539, status: 'Open', }, { id: 'ca47b7b8-98d5-547b-a187-b37616befdec', desk: 'D-6977', commodity: 'Soybean Oil', traderName: 'Caleb Miles', filledQuantity: 0.46562702352687246, status: 'Filled', }, { id: '673d5d84-c70a-5469-a5f6-fed183257bf8', desk: 'D-6344', commodity: 'Wheat', traderName: 'Elizabeth Dixon', filledQuantity: 0.8978073507452912, status: 'Open', }, { id: '6df57e0d-e389-5d06-942f-7179300a34ec', desk: 'D-4484', commodity: 'Cocoa', traderName: 'Nina Ortiz', filledQuantity: 0.8820417417592, status: 'Filled', }, { id: '9a9b6eb7-05e5-5794-aa2f-acd817f30d7d', desk: 'D-854', commodity: 'Soybeans', traderName: 'Lewis McBride', filledQuantity: 0.8699638788552375, status: 'PartiallyFilled', }, { id: '2abea9d1-218b-50fe-94da-576364d08282', desk: 'D-1529', commodity: 'Rough Rice', traderName: 'Arthur Russell', filledQuantity: 0.18258313641865023, status: 'PartiallyFilled', }, { id: '65762dc4-fdf5-5d7b-90ef-a0be20efbd7e', desk: 'D-4896', commodity: 'Rapeseed', traderName: 'Lucile Gill', filledQuantity: 0.836220733018946, status: 'PartiallyFilled', }, { id: 'f8e7bff4-2294-5aa9-80ee-430766164909', desk: 'D-4359', commodity: 'Soybeans', traderName: 'Rosalie Shaw', filledQuantity: 0.20641564516980004, status: 'Filled', }, { id: '947d2e1e-fd87-5df1-a2e4-dcd620956af3', desk: 'D-2992', commodity: 'Sugar No.14', traderName: 'Leon Cortez', filledQuantity: 0.27640399225383583, status: 'Rejected', }, { id: 'b8010891-3c6c-5681-bb63-cc47703cddf3', desk: 'D-4954', commodity: 'Soybeans', traderName: 'Jennie Clayton', filledQuantity: 0.2528291641470548, status: 'Filled', }, { id: '9318f3b7-8861-5d38-b79e-a03423f28ff5', desk: 'D-1917', commodity: 'Soybeans', traderName: 'Evan Yates', filledQuantity: 0.327082368678294, status: 'Rejected', }, { id: 'ff3bea9e-3846-5ed6-a09e-26173880e81a', desk: 'D-8926', commodity: 'Oats', traderName: 'Augusta Carpenter', filledQuantity: 0.5060205712227949, status: 'Filled', }, { id: 'a579acb0-4caf-524b-a972-628d6d8e9421', desk: 'D-9265', commodity: 'Sugar No.14', traderName: 'Gerald McKenzie', filledQuantity: 0.753277076847452, status: 'PartiallyFilled', }, { id: '7a4bc79d-60bf-5038-87f4-a478edecdf43', desk: 'D-6801', commodity: 'Sugar No.14', traderName: 'Dennis Frazier', filledQuantity: 0.14595478458694724, status: 'Filled', }, { id: '99e56777-0ee3-5771-9439-f37177e2b3bb', desk: 'D-6846', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Thomas Smith', filledQuantity: 0.5260112245194685, status: 'Filled', }, { id: '63d1d1fb-7c1c-525f-b214-5a91d42e4bd0', desk: 'D-1835', commodity: 'Soybeans', traderName: 'Warren Gardner', filledQuantity: 0.6412226973304056, status: 'PartiallyFilled', }, { id: 'd0f5ddcb-4273-52fc-b376-c2b7891cb4a4', desk: 'D-2494', commodity: 'Cotton No.2', traderName: 'Albert Griffith', filledQuantity: 0.6776469588132784, status: 'Rejected', }, { id: 'c41dc863-f609-5bc6-81b5-212d7a094e01', desk: 'D-3989', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Irene Wolfe', filledQuantity: 0.759032379047381, status: 'PartiallyFilled', }, { id: '8e48d92f-09f8-57ad-9e8a-d4d313a9068e', desk: 'D-3263', commodity: 'Cotton No.2', traderName: 'Eddie Glover', filledQuantity: 0.401577299568026, status: 'PartiallyFilled', }, { id: '67d0abcd-49fd-51dd-aebf-7c3cd1e8a741', desk: 'D-5366', commodity: 'Rough Rice', traderName: 'Etta Greer', filledQuantity: 0.9780777362172711, status: 'Open', }, { id: 'fec31b73-d18b-50bd-b19f-5789d212ff47', desk: 'D-4258', commodity: 'Soybeans', traderName: 'Nettie Dixon', filledQuantity: 0.4353044106738688, status: 'PartiallyFilled', }, { id: '982c7284-8af4-5c4e-b5fd-0be67f3974b5', desk: 'D-1185', commodity: 'Oats', traderName: 'Emma Gomez', filledQuantity: 0.5668686723372116, status: 'Filled', }, { id: '81503a18-b7c8-5bdb-b0fa-2d98a46871ef', desk: 'D-8891', commodity: 'Soybean Oil', traderName: 'Eric Parks', filledQuantity: 0.7137033140452393, status: 'Filled', }, { id: '239c90d5-b6ec-54f9-9dd2-fe73f5b9489e', desk: 'D-1669', commodity: 'Cocoa', traderName: 'Mario Morgan', filledQuantity: 0.716187147082549, status: 'PartiallyFilled', }, { id: '984495dd-7ffb-5360-b7ed-c8f92d0cb761', desk: 'D-9520', commodity: 'Sugar No.11', traderName: 'Clifford Diaz', filledQuantity: 0.5322128851540616, status: 'Rejected', }, { id: '4c7c8a62-a6ae-51d3-a7df-39579f1461b8', desk: 'D-335', commodity: 'Cotton No.2', traderName: 'Melvin Fisher', filledQuantity: 0.21332400769365273, status: 'Filled', }, { id: 'a6ba9e40-2ce7-5f6d-abda-75a9c7ae8abd', desk: 'D-4901', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Tillie Potter', filledQuantity: 0.11376253790529507, status: 'PartiallyFilled', }, { id: '56a78fa3-7033-5be1-9f07-2c57c69af0f4', desk: 'D-7948', commodity: 'Milk', traderName: 'Mina Jackson', filledQuantity: 0.021882794620586798, status: 'Open', }, { id: '36f4e5c8-c466-54ab-adca-698da7fca3ac', desk: 'D-3160', commodity: 'Cotton No.2', traderName: 'Sadie Lynch', filledQuantity: 0.5820230368406618, status: 'Filled', }, { id: '0a63ebb1-2ff7-5396-af2e-f3e7ddf70db9', desk: 'D-6388', commodity: 'Soybeans', traderName: 'Augusta Boone', filledQuantity: 0.20745885550354823, status: 'Open', }, { id: '9119f66b-aade-5490-942d-bef561942b12', desk: 'D-6395', commodity: 'Rapeseed', traderName: 'Anthony Grant', filledQuantity: 0.18759469696969697, status: 'Open', }, { id: '601d9704-ff32-5f84-a635-8085af7ea9d4', desk: 'D-8527', commodity: 'Soybeans', traderName: 'Sarah Stokes', filledQuantity: 0.9958730977559969, status: 'Filled', }, { id: 'f4270e8b-7eec-5053-9657-16faa4c77108', desk: 'D-2447', commodity: 'Wheat', traderName: 'Kenneth Thompson', filledQuantity: 0.7215147684174232, status: 'Filled', }, { id: '49e18fdd-0ea3-5ae0-adc8-05e96eb424f7', desk: 'D-8272', commodity: 'Rough Rice', traderName: 'Tom Richardson', filledQuantity: 0.10178603875629282, status: 'PartiallyFilled', }, { id: '65511ff7-d830-5de3-9b92-61660297fb67', desk: 'D-6016', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Rebecca Allen', filledQuantity: 0.3697001407281781, status: 'Filled', }, { id: 'dfe37aaa-e284-5f5b-97df-7a69250aa64b', desk: 'D-1813', commodity: 'Rough Rice', traderName: 'Lucas Ray', filledQuantity: 0.007795966356154472, status: 'PartiallyFilled', }, { id: '6f00155c-8f99-5691-b87b-ef23bff14eef', desk: 'D-804', commodity: 'Sugar No.11', traderName: 'Ruby Barber', filledQuantity: 0.6615372187891272, status: 'Filled', }, { id: '614c5f20-6a1d-5031-9fc8-d4a60df78d1a', desk: 'D-3998', commodity: 'Soybeans', traderName: 'Hunter Swanson', filledQuantity: 0.8843857331571995, status: 'Rejected', }, { id: '62fff371-d80d-5654-a364-b849a0ae4a19', desk: 'D-6260', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Cornelia Robinson', filledQuantity: 0.4125294968409835, status: 'Filled', }, { id: '5b6a0f2f-2ec3-5a70-b006-f4e930fa7ca4', desk: 'D-5767', commodity: 'Cotton No.2', traderName: 'Ricardo Hernandez', filledQuantity: 0.17815980105957402, status: 'Filled', }, { id: '219369d4-18e5-57f1-9761-f32a9ae19e0b', desk: 'D-1216', commodity: 'Wheat', traderName: 'Myrtie Massey', filledQuantity: 0.9622784887078635, status: 'Rejected', }, { id: 'e7a2d636-36dd-560b-aaea-1d4c0f2bc6b8', desk: 'D-7374', commodity: 'Wheat', traderName: 'Gordon Sparks', filledQuantity: 0.5062003179650238, status: 'Open', }, { id: 'b6e1298c-922b-53f2-a434-cd99d50b08cc', desk: 'D-9051', commodity: 'Cotton No.2', traderName: 'Steven Wilkerson', filledQuantity: 0.08907510322119824, status: 'Filled', }, { id: 'ca9c6a4f-5f79-59f3-9783-4fe9272225f6', desk: 'D-9018', commodity: 'Soybean Meal', traderName: 'Bertha Robbins', filledQuantity: 0.5928485931520475, status: 'Filled', }, { id: 'd0b50e9d-242b-5e81-92af-2889e7a39cd5', desk: 'D-600', commodity: 'Cotton No.2', traderName: 'Theresa Santiago', filledQuantity: 0.44335126825518834, status: 'Open', }, { id: '1bcc00a4-3afb-5c70-be8f-0afea02e811e', desk: 'D-5711', commodity: 'Soybeans', traderName: 'Gene Weber', filledQuantity: 0.42178051673755174, status: 'Filled', }, { id: '25f0e17a-ab67-5075-945c-e67ad4f86c8f', desk: 'D-8972', commodity: 'Oats', traderName: 'Helena Curry', filledQuantity: 0.6762161395546731, status: 'Open', }, { id: 'b9bf4be8-6299-58a6-bcd7-fc4685295ba4', desk: 'D-6672', commodity: 'Milk', traderName: 'Lula Freeman', filledQuantity: 0.5764499121265377, status: 'PartiallyFilled', }, { id: 'aab692c8-2094-5340-98f9-0baf69a36fe2', desk: 'D-9971', commodity: 'Soybeans', traderName: 'Dominic Anderson', filledQuantity: 0.4093620026681315, status: 'Open', }, { id: '470a6aaa-7376-56c7-94be-a57bd65eb62d', desk: 'D-981', commodity: 'Coffee C', traderName: 'Joseph Hicks', filledQuantity: 0.9378176338494267, status: 'PartiallyFilled', }, { id: '9db28b56-c269-5e6b-a4d8-d05afcf26627', desk: 'D-3204', commodity: 'Robusta coffee', traderName: 'Isabel Ramsey', filledQuantity: 0.8009162579120328, status: 'Filled', }, { id: 'be6a547b-7330-54f5-8779-a89087e8bcdd', desk: 'D-282', commodity: 'Cocoa', traderName: 'Amanda Garza', filledQuantity: 0.06479994862243915, status: 'PartiallyFilled', }, { id: '43466317-5930-5d4a-93b7-4a227a3e30fe', desk: 'D-1035', commodity: 'Sugar No.14', traderName: 'Elmer Jacobs', filledQuantity: 0.5697795836832906, status: 'Filled', }, { id: '4eb1caa8-696d-58fe-bcab-138daec5814e', desk: 'D-511', commodity: 'Oats', traderName: 'Alvin Phelps', filledQuantity: 0.34110178169158306, status: 'Filled', }, { id: 'c2b861af-eec9-56f6-90f3-f9388b7f6eaa', desk: 'D-8137', commodity: 'Soybeans', traderName: 'Ina Willis', filledQuantity: 0.7466206741825117, status: 'Open', }, { id: 'c0637e33-1336-546e-b5e1-5a2ce426ec3a', desk: 'D-8018', commodity: 'Cotton No.2', traderName: 'Estella Collins', filledQuantity: 0.6232984752000935, status: 'PartiallyFilled', }, { id: '13fcb1aa-c567-5c82-afd9-a3e04f71466a', desk: 'D-7772', commodity: 'Coffee C', traderName: 'Lola Mann', filledQuantity: 0.5522795010486808, status: 'Open', }, { id: '3d0aad20-72a9-540d-bc41-7a310f91b5d9', desk: 'D-630', commodity: 'Soybean Oil', traderName: 'Franklin Thornton', filledQuantity: 0.28935298136039816, status: 'Open', }, { id: 'f4f55b77-c9c0-5bed-8cdf-2b68aadacf6f', desk: 'D-4613', commodity: 'Milk', traderName: 'Lela McBride', filledQuantity: 0.2257077625570776, status: 'PartiallyFilled', }, { id: 'bdd212d2-a280-5942-87fc-e5a728edf171', desk: 'D-3035', commodity: 'Sugar No.11', traderName: 'Edward McBride', filledQuantity: 0.8091825099481069, status: 'PartiallyFilled', }, { id: '6ece3ed1-90e4-55ef-8d7e-8222d2f0b1f2', desk: 'D-9833', commodity: 'Robusta coffee', traderName: 'Joel Robertson', filledQuantity: 0.8882958085944389, status: 'Filled', }, { id: 'e10fe986-becd-5b39-8412-1d8826394a6d', desk: 'D-8533', commodity: 'Cotton No.2', traderName: 'Rodney May', filledQuantity: 0.28414283296666104, status: 'PartiallyFilled', }, { id: 'a0aed756-d08f-573b-a517-6d2d4bab9170', desk: 'D-9899', commodity: 'Adzuki bean', traderName: 'Virginia Brady', filledQuantity: 0.5070655441972339, status: 'PartiallyFilled', }, { id: 'e87a5504-3322-5d38-b952-e8d52463ed62', desk: 'D-4518', commodity: 'Soybeans', traderName: 'Maria White', filledQuantity: 0.5472522029302883, status: 'PartiallyFilled', }, { id: '0e254661-cdfc-564a-836a-d0fd0980d0f0', desk: 'D-2069', commodity: 'Coffee C', traderName: 'Essie Howard', filledQuantity: 0.048437863714109325, status: 'Rejected', }, { id: '10a70a63-eeaa-5132-ac98-0cec025913ea', desk: 'D-9776', commodity: 'Adzuki bean', traderName: 'Lela Barnett', filledQuantity: 0.4080142764438676, status: 'Rejected', }, { id: 'd947d50c-00e6-52ac-894a-bfa47226b63d', desk: 'D-4801', commodity: 'Sugar No.14', traderName: 'Mina Waters', filledQuantity: 0.6062576958292551, status: 'Filled', }, { id: '849330f7-418e-51af-aae4-ea0cdb1a85b1', desk: 'D-9358', commodity: 'Soybeans', traderName: 'Chase Zimmerman', filledQuantity: 0.7944031698860822, status: 'Open', }, { id: '93d37354-ace3-54ab-a53f-f87db5b6fafd', desk: 'D-7626', commodity: 'Soybeans', traderName: 'Estella Newton', filledQuantity: 0.01828448110209451, status: 'Filled', }, { id: '610d92e0-c078-5b83-b24a-a0f8bf9a0d37', desk: 'D-3212', commodity: 'Soybean Oil', traderName: 'Ronald Zimmerman', filledQuantity: 0.21670483307219476, status: 'PartiallyFilled', }, { id: '9cf7794f-e8fd-5d61-a493-b83be5b3221f', desk: 'D-2748', commodity: 'Rough Rice', traderName: 'Bobby Wagner', filledQuantity: 0.5886395309721755, status: 'Filled', }, { id: '9232fa2f-6f8e-58f7-951e-a5d7c25ddf7d', desk: 'D-3854', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Derrick Wood', filledQuantity: 0.6387955125349317, status: 'Rejected', }, { id: 'ce533c5f-de65-5fb0-9086-c6d3c2b2abda', desk: 'D-832', commodity: 'Soybean Meal', traderName: 'Justin Nguyen', filledQuantity: 0.7956241780389076, status: 'Open', }, { id: '385ce0d1-9881-5b92-a1ce-3c0486a5dc22', desk: 'D-5726', commodity: 'Rough Rice', traderName: 'Isabelle Harvey', filledQuantity: 0.06558734069995766, status: 'PartiallyFilled', }, { id: '80aeab16-b8f2-57ad-afe9-07f9deaa2c84', desk: 'D-3402', commodity: 'Adzuki bean', traderName: 'Lydia Maxwell', filledQuantity: 0.9934729398966549, status: 'Rejected', }, { id: '858285fd-8f21-5615-a90e-098487658c54', desk: 'D-7330', commodity: 'Frozen Concentrated Orange Juice', traderName: 'Caleb Stokes', filledQuantity: 0.09865810327354424, status: 'Filled', }, { id: '7493d12e-74c5-5b23-bb7b-a2ff9379244b', desk: 'D-6008', commodity: 'Milk', traderName: 'Manuel Sanchez', filledQuantity: 0.26201065232068416, status: 'PartiallyFilled', }, { id: 'd9a9170a-effd-5bea-a04a-bf51a7661324', desk: 'D-4277', commodity: 'Soybeans', traderName: 'Mark Cannon', filledQuantity: 0.3274965735620776, status: 'Open', }, { id: '53ac954a-52ad-591e-82d5-99d63d3fd701', desk: 'D-167', commodity: 'Adzuki bean', traderName: 'Amanda Thompson', filledQuantity: 0.717225368461782, status: 'PartiallyFilled', }, { id: 'c6f4698b-c900-5ff1-8687-78dd717b0ac6', desk: 'D-7217', commodity: 'Soybean Oil', traderName: 'Timothy Wagner', filledQuantity: 0.8917463495460665, status: 'PartiallyFilled', }, { id: 'd8741891-6de1-5537-b976-ce268cb3c2c8', desk: 'D-2963', commodity: 'Frozen Concentrated Orange Juice', traderName: 'May Fowler', filledQuantity: 0.29648334241897495, status: 'PartiallyFilled', }, { id: '34770bfe-5bce-5161-bdbb-b082601c561f', desk: 'D-2896', commodity: 'Rapeseed', traderName: 'Ida Allison', filledQuantity: 0.8602341005847483, status: 'Open', }, { id: '8d239da8-d6ec-5c80-ae00-a76433034c6d', desk: 'D-7200', commodity: 'Adzuki bean', traderName: 'Ricardo Burke', filledQuantity: 0.939605184959121, status: 'PartiallyFilled', }, { id: 'db0b6030-4f8d-5056-9b1d-07b496b2a68a', desk: 'D-2292', commodity: 'Coffee C', traderName: 'Luis Wallace', filledQuantity: 0.44027139812062804, status: 'Rejected', }, { id: '1473141a-806f-5128-83e7-c6d9059fd69d', desk: 'D-6626', commodity: 'Soybeans', traderName: 'Lottie Salazar', filledQuantity: 0.476674027577333, status: 'PartiallyFilled', }, { id: '9b4788f8-2fff-5a28-bfd1-6e67e5dd90c5', desk: 'D-4592', commodity: 'Cotton No.2', traderName: 'Tillie Dean', filledQuantity: 0.9632860040567951, status: 'Open', }, ]; export default function DataTable() { return ( <ShowcaseContainer sx={{ mt: { md: 2 } }} previewSx={{ py: 2, }} preview={ <Paper variant="outlined" sx={(theme) => ({ overflow: 'hidden', width: '100%', boxShadow: '0px 4px 16px rgba(61, 71, 82, 0.15)', bgcolor: '#fff', border: '1px solid', borderColor: 'grey.200', ...theme.applyDarkStyles({ bgcolor: 'primaryDark.800', boxShadow: '0px 4px 16px rgba(0, 0, 0, 0.4)', }), })} > <XGridGlobalStyles /> <Box sx={(theme) => ({ textAlign: 'center', py: 1, position: 'relative', borderBottom: '1px solid', borderColor: 'grey.100', ...theme.applyDarkStyles({ borderColor: 'primaryDark.600', }), })} > <Typography color="primary.main" fontWeight={700}> Trades, October 2020 </Typography> </Box> <Box sx={{ height: 200 }}> <DataGrid rows={rows} columns={columns} hideFooter density="compact" /> </Box> </Paper> } code={ <Box sx={{ p: 2, overflow: 'auto', flexGrow: 1, '&::-webkit-scrollbar': { display: 'none', }, '& pre': { bgcolor: 'transparent !important', '&::-webkit-scrollbar': { display: 'none', }, }, }} > <HighlightedCode copyButtonHidden component={MarkdownElement} code={code} language="jsx" /> </Box> } /> ); }
5,136
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/CompaniesGrid.tsx
import * as React from 'react'; import Grid from '@mui/material/Grid'; import IconImage, { IconImageProps } from 'docs/src/components/icon/IconImage'; export const CORE_CUSTOMERS: Array<IconImageProps> = [ { alt: 'Spotify logo', name: 'companies/spotify', width: 100, height: 52, }, { alt: 'Amazon logo', name: 'companies/amazon', width: 80, height: 52, }, { alt: 'Nasa logo', name: 'companies/nasa', mode: '', width: 52, height: 42, }, { alt: 'Netflix logo', name: 'companies/netflix', mode: '', width: 80, height: 52, }, { alt: 'Unity logo', name: 'companies/unity', width: 69, height: 52, }, { alt: 'Shutterstock logo', name: 'companies/shutterstock', width: 100, height: 52, }, ]; export const ADVANCED_CUSTOMERS: Array<IconImageProps> = [ { alt: 'Southwest logo', name: 'companies/southwest', width: 130, height: 54, style: { marginTop: -10, }, }, { alt: 'Boeing logo', name: 'companies/boeing', width: 160, height: 86, style: { marginTop: -23, }, }, { alt: 'Apple logo', name: 'companies/apple', width: 29, height: 52, style: { marginTop: -21, }, }, { alt: 'Siemens logo', name: 'companies/siemens', mode: '', width: 119, height: 59, style: { marginTop: -13, }, }, { alt: 'Volvo logo', name: 'companies/volvo', width: 128, height: 52, style: { marginTop: -11, }, }, { alt: 'Deloitte logo', name: 'companies/deloitte', width: 97, height: 52, style: { marginTop: -12, }, }, ]; export const DESIGNKITS_CUSTOMERS: Array<IconImageProps> = [ { alt: 'Spotify logo', name: 'companies/spotify', width: 100, height: 52, }, { alt: 'Amazon logo', name: 'companies/amazon', width: 80, height: 52, }, { alt: 'Apple logo', name: 'companies/apple', width: 29, height: 52, }, { alt: 'Netflix logo', name: 'companies/netflix', mode: '', width: 80, height: 52, }, { alt: 'Twitter logo', name: 'companies/twitter', mode: '', width: 31, height: 52, }, { alt: 'Salesforce logo', name: 'companies/salesforce', mode: '', width: 50, height: 52, }, ]; export const TEMPLATES_CUSTOMERS: Array<IconImageProps> = [ { alt: 'Ebay logo', name: 'companies/ebay', width: 73, height: 52, }, { alt: 'Amazon logo', name: 'companies/amazon', width: 80, height: 52, }, { alt: 'Samsung logo', name: 'companies/samsung', mode: '', width: 88, height: 52, }, { alt: 'Patreon logo', name: 'companies/patreon', width: 103, height: 52, }, { alt: 'AT&T logo', name: 'companies/atandt', width: 71, height: 52, }, { alt: 'Verizon logo', name: 'companies/verizon', width: 91, height: 52, }, ]; export default function CompaniesGrid({ data }: { data: Array<IconImageProps> }) { return ( <Grid container spacing={4}> {data.map((imgProps) => ( <Grid key={imgProps.name} item xs={6} sm={4} md={2} sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', objectFit: 'contain', }} > <IconImage alt={imgProps.alt} loading="eager" {...imgProps} /> </Grid> ))} </Grid> ); }
5,137
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/CoreShowcase.tsx
import * as React from 'react'; import { ThemeProvider, createTheme, useTheme } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Button, { buttonClasses } from '@mui/material/Button'; import Typography from '@mui/material/Typography'; import TouchAppRounded from '@mui/icons-material/TouchAppRounded'; import HighlightedCode from 'docs/src/modules/components/HighlightedCode'; import MarkdownElement from 'docs/src/components/markdown/MarkdownElement'; import MaterialDesignDemo, { componentCode } from 'docs/src/components/home/MaterialDesignDemo'; import ShowcaseContainer from 'docs/src/components/home/ShowcaseContainer'; import PointerContainer, { Data } from 'docs/src/components/home/ElementPointer'; import StylingInfo from 'docs/src/components/action/StylingInfo'; import FlashCode from 'docs/src/components/animation/FlashCode'; const lineMapping: Record<string, number | number[]> = { avatar: 2, divider: 13, chip: 20, stack: 3, iconButton: 9, card: 0, switch: 21, editIcon: 10, typography: 4, typography2: 5, locationOnIcon: 6, stack2: [14, 19], }; export default function CoreShowcase() { const { vars, ...globalTheme } = useTheme(); const mode = globalTheme.palette.mode; const [element, setElement] = React.useState<Data>({ id: null, name: null, target: null }); const [customized, setCustomized] = React.useState(false); const theme = React.useMemo( () => customized ? createTheme(globalTheme, { palette: { background: { default: mode === 'dark' ? globalTheme.palette.primaryDark[900] : globalTheme.palette.grey[50], }, }, shape: { borderRadius: 10, }, shadows: ['none', '0px 4px 20px 0px hsla(210, 14%, 28%, 0.2)'], components: { MuiCard: { styleOverrides: { root: { boxShadow: mode === 'dark' ? '0px 4px 30px rgba(29, 29, 29, 0.6)' : '0px 4px 20px rgba(61, 71, 82, 0.2)', backgroundColor: mode === 'dark' ? globalTheme.palette.primaryDark[800] : '#fff', border: '1px solid', borderColor: mode === 'dark' ? globalTheme.palette.primaryDark[600] : globalTheme.palette.grey[200], }, }, }, MuiAvatar: { styleOverrides: { root: { width: 60, height: 60, borderRadius: 99, }, }, }, MuiIconButton: { styleOverrides: { root: { border: '1px solid', borderColor: mode === 'dark' ? globalTheme.palette.primaryDark[500] : globalTheme.palette.grey[200], color: mode === 'dark' ? globalTheme.palette.grey[200] : globalTheme.palette.grey[800], borderRadius: 10, '&:hover, &.Mui-focusVisible': { borderColor: globalTheme.palette.primary.main, color: globalTheme.palette.primary.main, }, }, }, }, MuiSwich: globalTheme.components?.MuiSwitch, MuiChip: { styleOverrides: { filled: { fontWeight: 700, '&.MuiChip-colorSuccess': { backgroundColor: mode === 'dark' ? globalTheme.palette.success[800] : globalTheme.palette.success[100], color: mode === 'dark' ? globalTheme.palette.success[100] : globalTheme.palette.success[800], }, '&.MuiChip-colorDefault': { backgroundColor: mode === 'dark' ? globalTheme.palette.primaryDark[600] : globalTheme.palette.grey[200], color: mode === 'dark' ? globalTheme.palette.grey[200] : globalTheme.palette.grey[800], }, }, }, }, }, }) : createTheme({ palette: { mode: globalTheme.palette.mode } }), [customized, globalTheme, mode], ); const highlightedLines = element.id ? lineMapping[element.id] : null; let startLine; let endLine; if (highlightedLines !== null) { startLine = Array.isArray(highlightedLines) ? highlightedLines[0] : highlightedLines; endLine = Array.isArray(highlightedLines) ? highlightedLines[1] : startLine; } return ( <ShowcaseContainer sx={{ mt: { md: 2 } }} previewSx={{ minHeight: 220, pb: 4, }} preview={ <React.Fragment> <Box textAlign="center" sx={{ py: 0.5, ml: 'auto', position: 'absolute', bottom: 0, left: '50%', transform: 'translate(-50%)', width: '100%', }} > <Typography variant="caption" fontWeight={500} color="text.primary" noWrap sx={{ opacity: 0.5 }} > <TouchAppRounded sx={{ fontSize: '0.875rem', verticalAlign: 'text-bottom' }} /> Hover over the component to highlight the code. </Typography> </Box> <ThemeProvider theme={theme}> <PointerContainer onElementChange={setElement} sx={{ minWidth: 300, width: '80%', maxWidth: '100%' }} > <MaterialDesignDemo sx={{ transform: 'translate(0, -8px)' }} /> </PointerContainer> </ThemeProvider> </React.Fragment> } code={ <div data-mui-color-scheme="dark"> <Box sx={{ p: { xs: 2, sm: 1 }, display: 'flex', alignItems: 'center', right: 0, zIndex: 10, [`& .${buttonClasses.root}`]: { borderRadius: 40, padding: '2px 10px', fontSize: '0.75rem', lineHeight: 18 / 12, }, [`& .${buttonClasses.outlined}`]: { color: '#fff', backgroundColor: 'primary.700', borderColor: 'primary.500', '&:hover': { backgroundColor: 'primary.700', }, }, [`& .${buttonClasses.text}`]: { color: 'grey.400', }, }} > <Button size="small" variant={customized ? 'text' : 'outlined'} onClick={() => { setCustomized(false); }} sx={{ ml: 0 }} > Material Design </Button> <Button size="small" variant={customized ? 'outlined' : 'text'} onClick={() => { setCustomized(true); }} > Custom Theme </Button> </Box> <Box sx={{ p: 2, pt: 0, overflow: 'hidden', flexGrow: 1, '&::-webkit-scrollbar': { display: 'none', }, '& pre': { bgcolor: 'transparent !important', position: 'relative', zIndex: 1, '&::-webkit-scrollbar': { display: 'none', }, }, }} > <Box sx={{ position: 'relative' }}> {startLine !== undefined && ( <FlashCode startLine={startLine} endLine={endLine} sx={{ mx: -2 }} /> )} <HighlightedCode copyButtonHidden component={MarkdownElement} code={componentCode} language="jsx" /> <StylingInfo appeared={customized} sx={{ mb: -2, mx: -2 }} /> </Box> </Box> </div> } /> ); }
5,138
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/DesignKits.tsx
import * as React from 'react'; import { styled, alpha } from '@mui/material/styles'; import { AvatarProps } from '@mui/material/Avatar'; import Box, { BoxProps } from '@mui/material/Box'; import Slide from 'docs/src/components/animation/Slide'; import FadeDelay from 'docs/src/components/animation/FadeDelay'; const ratio = 900 / 494; // 'transparent' is interpreted as transparent black in Safari // See https://css-tricks.com/thing-know-gradients-transparent-black/ const transparent = 'rgba(255,255,255,0)'; const Image = styled('img')(({ theme }) => ({ display: 'block', width: 200, height: 200 / ratio, [theme.breakpoints.up('sm')]: { width: 300, height: 300 / ratio, }, [theme.breakpoints.up('md')]: { width: 450, height: 450 / ratio, }, border: '6px solid', borderColor: (theme.vars || theme).palette.grey[400], borderRadius: theme.shape.borderRadius, objectFit: 'cover', transitionProperty: 'all', transitionDuration: '150ms', boxShadow: '0px 4px 20px rgba(61, 71, 82, 0.25)', ...theme.applyDarkStyles({ borderColor: (theme.vars || theme).palette.grey[800], boxShadow: '0px 4px 20px rgba(0, 0, 0, 0.6)', }), })); const Anchor = styled('a')(({ theme }) => [ { display: 'inline-block', position: 'relative', transitionProperty: 'all', transitionDuration: '150ms', borderRadius: '50%', border: '1px solid', borderColor: (theme.vars || theme).palette.grey[200], boxShadow: `0px 2px 12px ${alpha(theme.palette.primary[200], 0.3)}`, '&:hover, &:focus': { borderColor: (theme.vars || theme).palette.primary[300], boxShadow: `0px 4px 20px ${alpha(theme.palette.primary[400], 0.3)}`, }, } as const, theme.applyDarkStyles({ borderColor: (theme.vars || theme).palette.primary[900], boxShadow: `0px 2px 12px ${alpha(theme.palette.primaryDark[800], 0.5)}`, '&:hover, &:focus': { borderColor: (theme.vars || theme).palette.primary[700], boxShadow: `0 2px 20px 0 ${alpha(theme.palette.primary[800], 0.5)}`, }, }), ]); const DesignToolLink = React.forwardRef< HTMLAnchorElement, React.PropsWithChildren<{ brand: 'figma' | 'sketch' | 'adobexd' }> >(function DesignToolLink(props, ref) { const { brand, ...other } = props; return ( <Anchor ref={ref} aria-label="Go to MUI Store" href={ { figma: 'https://mui.com/store/items/figma-react/?utm_source=marketing&utm_medium=referral&utm_campaign=home-products', sketch: 'https://mui.com/store/items/sketch-react/?utm_source=marketing&utm_medium=referral&utm_campaign=home-products', adobexd: 'https://mui.com/store/items/adobe-xd-react/?utm_source=marketing&utm_medium=referral&utm_campaign=home-products', }[brand] } target="_blank" {...other} /> ); }); const DesignToolLogo = React.forwardRef< HTMLImageElement, { brand: 'figma' | 'sketch' | 'adobexd' } & AvatarProps >(function DesignToolLogo({ brand, ...props }, ref) { return ( <Box ref={ref} {...props} sx={[ (theme) => ({ display: 'flex', backgroundColor: '#FFF', p: 2, borderRadius: '50%', ...theme.applyDarkStyles({ backgroundColor: alpha(theme.palette.primary[900], 0.5), }), }), ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} > <img src={`/static/branding/design-kits/${brand}-logo.svg`} alt="" loading="lazy" width="60" height="60" /> </Box> ); }); export function PrefetchDesignKitImages() { return ( <Box sx={{ width: 0, height: 0, position: 'fixed', top: -1000, zIndex: -1, '& > img': { position: 'absolute', }, }} > <img src="/static/branding/design-kits/designkits1.jpeg" alt="" loading="lazy" /> <img src="/static/branding/design-kits/designkits2.jpeg" alt="" loading="lazy" /> <img src="/static/branding/design-kits/designkits3.jpeg" alt="" loading="lazy" /> <img src="/static/branding/design-kits/designkits4.jpeg" alt="" loading="lazy" /> <img src="/static/branding/design-kits/designkits5.jpeg" alt="" loading="lazy" /> <img src="/static/branding/design-kits/designkits6.jpeg" alt="" loading="lazy" /> <img src="/static/branding/design-kits/designkits-figma.png" alt="" loading="lazy" /> <img src="/static/branding/design-kits/designkits-sketch.png" alt="" loading="lazy" /> <img src="/static/branding/design-kits/designkits-xd.png" alt="" loading="lazy" /> </Box> ); } const defaultSlideUp = { '0%': { transform: 'translateY(-300px)', }, '100%': { transform: 'translateY(-20px)', }, }; export function DesignKitImagesSet1({ keyframes = defaultSlideUp, ...props }: BoxProps & { keyframes?: Record<string, object> }) { return ( <Slide animationName="designkit-slideup" {...props} keyframes={keyframes}> <FadeDelay delay={400}> <Image src="/static/branding/design-kits/designkits1.jpeg" alt="" /> </FadeDelay> <FadeDelay delay={200}> <Image src="/static/branding/design-kits/designkits3.jpeg" alt="" /> </FadeDelay> <FadeDelay delay={0}> <Image src="/static/branding/design-kits/designkits5.jpeg" alt="" /> </FadeDelay> </Slide> ); } const defaultSlideDown = { '0%': { transform: 'translateY(150px)', }, '100%': { transform: 'translateY(-80px)', }, }; export function DesignKitImagesSet2({ keyframes = defaultSlideDown, ...props }: BoxProps & { keyframes?: Record<string, object> }) { return ( <Slide animationName="designkit-slidedown" {...props} keyframes={keyframes}> <FadeDelay delay={100}> <Image src="/static/branding/design-kits/designkits2.jpeg" alt="" /> </FadeDelay> <FadeDelay delay={300}> <Image src="/static/branding/design-kits/designkits4.jpeg" alt="" /> </FadeDelay> <FadeDelay delay={500}> <Image src="/static/branding/design-kits/designkits6.jpeg" alt="" /> </FadeDelay> </Slide> ); } export function DesignKitTools({ disableLink, ...props }: { disableLink?: boolean } & BoxProps) { function renderTool(brand: 'figma' | 'sketch' | 'adobexd') { if (disableLink) { return <DesignToolLogo brand={brand} />; } return ( <DesignToolLink brand={brand}> <DesignToolLogo brand={brand} /> </DesignToolLink> ); } return ( <Box {...props} sx={{ position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', zIndex: 10, display: 'grid', gap: { xs: 3, lg: 6 }, py: 4, gridTemplateColumns: '1fr 1fr 1fr', '& .MuiAvatar-root': { width: { xs: 80, sm: 100 }, height: { xs: 80, sm: 100 }, }, ...props.sx, }} > <FadeDelay delay={200}>{renderTool('figma')}</FadeDelay> <FadeDelay delay={400}>{renderTool('sketch')}</FadeDelay> <FadeDelay delay={600}>{renderTool('adobexd')}</FadeDelay> </Box> ); } export default function DesignKits() { return ( <Box sx={{ mx: { xs: -2, sm: -3, md: 0 }, my: { md: -18 }, height: { xs: 300, sm: 360, md: 'calc(100% + 320px)' }, overflow: 'hidden', position: 'relative', width: { xs: '100vw', md: '50vw' }, }} > <Box sx={(theme) => ({ position: 'absolute', width: '100%', height: '100%', bgcolor: 'grey.50', opacity: 0.6, zIndex: 1, ...theme.applyDarkStyles({ bgcolor: 'primaryDark.900', }), })} /> <Box sx={(theme) => ({ display: { xs: 'block', md: 'none' }, position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', background: `linear-gradient(to bottom, ${ (theme.vars || theme).palette.primary[50] } 0%, ${transparent} 30%, ${transparent} 70%, ${ (theme.vars || theme).palette.primary[50] } 100%)`, zIndex: 2, ...theme.applyDarkStyles({ background: `linear-gradient(to bottom, ${ (theme.vars || theme).palette.primaryDark[900] } 0%, ${alpha(theme.palette.primaryDark[900], 0)} 30%, ${alpha( theme.palette.primaryDark[900], 0, )} 70%, ${(theme.vars || theme).palette.primaryDark[900]} 100%)`, }), })} /> <Box sx={(theme) => ({ display: { xs: 'none', md: 'block' }, position: 'absolute', top: 0, left: 0, width: 400, height: '100%', background: `linear-gradient(to right, ${ (theme.vars || theme).palette.primary[50] }, ${transparent})`, zIndex: 2, ...theme.applyDarkStyles({ background: `linear-gradient(to right, ${ (theme.vars || theme).palette.primaryDark[900] }, ${alpha(theme.palette.primaryDark[900], 0)})`, }), })} /> <DesignKitTools sx={{ top: { xs: '50%', md: 'calc(50% + 80px)', xl: '50%' }, transform: { xs: 'translate(-50%, -50%)' }, left: { xs: 'min(50%, 500px)' }, }} /> <Box sx={{ // need perspective on this wrapper to work in Safari position: 'relative', height: '100%', perspective: '1000px', }} > <Box sx={{ left: '36%', position: 'absolute', display: 'flex', transform: 'translateX(-40%) rotateZ(30deg) rotateX(8deg) rotateY(-8deg)', transformOrigin: 'center center', }} > <DesignKitImagesSet1 /> <DesignKitImagesSet2 sx={{ ml: { xs: 2, sm: 4, md: 8 } }} /> </Box> </Box> </Box> ); }
5,139
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/DesignSystemComponents.tsx
import * as React from 'react'; import dynamic from 'next/dynamic'; import { useInView } from 'react-intersection-observer'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import Section from 'docs/src/layouts/Section'; import GradientText from 'docs/src/components/typography/GradientText'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; function Placeholder() { return ( <Box sx={(theme) => ({ height: { xs: 1484, sm: 825, md: 605 }, borderRadius: 1, bgcolor: 'grey.100', ...theme.applyDarkStyles({ bgcolor: 'primaryDark.900', }), })} /> ); } const MaterialDesignComponents = dynamic(() => import('./MaterialDesignComponents'), { loading: Placeholder, }); function DesignSystemComponents() { const { ref, inView } = useInView({ triggerOnce: true, threshold: 0, rootMargin: '500px', }); return ( <Section ref={ref}> <SectionHeadline overline="Production-ready components" title={ <Typography variant="h2" sx={{ mt: 1, mb: { xs: 2, sm: 4 } }}> Beautiful and powerful, <br /> <GradientText>right out of the box</GradientText> </Typography> } /> {inView ? <MaterialDesignComponents /> : <Placeholder />} </Section> ); } export default DesignSystemComponents;
5,140
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/DiamondSponsors.tsx
import * as React from 'react'; import { useInView } from 'react-intersection-observer'; import Grid from '@mui/material/Grid'; import Paper from '@mui/material/Paper'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import AddRounded from '@mui/icons-material/AddRounded'; import Link from 'docs/src/modules/components/Link'; import SponsorCard from 'docs/src/components/home/SponsorCard'; const DIAMONDs = [ { src: '/static/sponsors/octopus-square.svg', name: 'Octopus Deploy', description: 'A unified DevOps automation platform for your team.', href: 'https://octopus.com/?utm_source=MUI&utm_medium=referral&utm_content=homepage', }, { src: '/static/sponsors/doit-square.svg', name: 'Doit International', description: 'Management platform for Google Cloud and AWS.', href: 'https://www.doit.com/flexsave/?utm_source=MUI&utm_medium=referral&utm_content=homepage', }, ]; export default function DiamondSponsors() { const { ref, inView } = useInView({ triggerOnce: true, threshold: 0, rootMargin: '500px', }); const maxNumberOfDiamondSponsors = 3; const spotIsAvailable = maxNumberOfDiamondSponsors > DIAMONDs.length; return ( <div ref={ref}> <Typography component="h3" variant="h6" fontWeight="bold" sx={(theme) => ({ mt: 4, mb: 1.5, background: `linear-gradient(90deg, ${(theme.vars || theme).palette.primary[400]} 50%, ${ (theme.vars || theme).palette.primary[700] } 100%)`, WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent', })} > Diamond </Typography> <Grid container spacing={{ xs: 2, md: 3 }}> {DIAMONDs.map((item) => ( <Grid item key={item.name} xs={12} sm={6} md={4}> <SponsorCard logoSize={64} inView={inView} item={item} /> </Grid> ))} {spotIsAvailable && ( <Grid item xs={12} sm={6} md={4}> <Paper variant="outlined" sx={(theme) => ({ p: 2, display: 'flex', alignItems: 'center', height: '100%', borderStyle: 'dashed', borderColor: 'grey.300', ...theme.applyDarkStyles({ borderColor: 'primaryDark.400', }), })} > <IconButton aria-label="Become MUI sponsor" component="a" href="mailto:[email protected]" target="_blank" rel="noopener noreferrer" color="primary" sx={(theme) => ({ mr: 2, border: '1px solid', borderColor: 'grey.300', ...theme.applyDarkStyles({ borderColor: 'primaryDark.400', }), })} > <AddRounded /> </IconButton> <div> <Typography variant="body2" color="text.primary" fontWeight="bold"> Become our sponsor! </Typography> <Typography variant="body2" color="text.secondary"> To join us, contact us at{' '} <Link href="mailto:[email protected]" target="_blank" rel="noopener noreferrer"> [email protected] </Link>{' '} for pre-approval. </Typography> </div> </Paper> </Grid> )} </Grid> </div> ); }
5,141
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/ElementPointer.tsx
import * as React from 'react'; import Box, { BoxProps } from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import { debounce } from '@mui/material/utils'; const PointerContext = React.createContext<undefined | ((data: Data) => void)>(undefined); export const withPointer = <T extends React.ElementType>( Component: T, options: { id: string; name: string }, ) => { function WithPointer(props: object) { const root = React.useRef<HTMLElement>(null); const handleMouseOver = React.useContext(PointerContext); return ( <React.Fragment> {/* @ts-ignore */} <Component ref={root} {...props} onMouseOver={(event: React.MouseEvent) => { event.stopPropagation(); if (handleMouseOver && root.current) { handleMouseOver({ id: options.id, target: root.current, name: options.name, }); } }} /> </React.Fragment> ); } return WithPointer as T; }; export type Data = { id: null | string; name: null | string; target: null | HTMLElement }; export default function PointerContainer({ onElementChange, ...props }: BoxProps & { onElementChange?: (data: Data) => void }) { const container = React.useRef<HTMLDivElement>(null); const [data, setData] = React.useState<Data>({ id: null, name: null, target: null, }); const handleMouseOver = React.useMemo( () => debounce((elementData: Data) => { setData(elementData); }, 200), [], ); React.useEffect(() => { if (onElementChange) { onElementChange(data); } }, [data, onElementChange]); return ( <PointerContext.Provider value={handleMouseOver}> <Box ref={container} {...props} onMouseLeave={() => handleMouseOver({ id: null, name: null, target: null })} sx={{ position: 'relative', ...props.sx }} > {props.children} {container.current && data.target && ( <Box sx={{ border: '1px solid', borderColor: '#0072E5', pointerEvents: 'none', position: 'absolute', zIndex: 10, transition: 'none !important', ...(() => { const containerRect = container.current.getBoundingClientRect(); const targetRect = data.target.getBoundingClientRect(); return { top: targetRect.top - containerRect.top, left: targetRect.left - containerRect.left, width: `${targetRect.width}px`, height: `${targetRect.height}px`, }; })(), }} > <Box sx={{ bgcolor: '#0072E5', borderTopLeftRadius: '2px', borderTopRightRadius: '2px', px: 0.5, position: 'absolute', top: 0, transform: 'translateY(-100%)', left: -1, }} > <Typography color="#fff" fontSize="0.625rem" fontWeight={500} sx={{ display: 'block' }} > {data.name} </Typography> </Box> </Box> )} </Box> </PointerContext.Provider> ); }
5,142
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/GetStartedButtons.tsx
import * as React from 'react'; import copy from 'clipboard-copy'; import Box, { BoxProps } from '@mui/material/Box'; import Button from '@mui/material/Button'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'; import CheckRounded from '@mui/icons-material/CheckRounded'; import Link from 'docs/src/modules/components/Link'; import NpmCopyButton from 'docs/src/components/action/NpmCopyButton'; interface GetStartedButtonsProps extends BoxProps { primaryLabel?: string; primaryUrl: string; primaryUrlTarget?: string; secondaryLabel?: string; secondaryUrl?: string; secondaryUrlTarget?: string; installation?: string; altInstallation?: string; } export default function GetStartedButtons(props: GetStartedButtonsProps) { const [copied, setCopied] = React.useState(false); const { primaryLabel = 'Get started', primaryUrl, primaryUrlTarget = '_self', secondaryLabel, secondaryUrl, secondaryUrlTarget = '_self', installation, altInstallation, ...other } = props; const handleCopy = () => { setCopied(true); copy(installation!).then(() => { setTimeout(() => setCopied(false), 2000); }); }; return ( <React.Fragment> <Box {...other} sx={{ display: 'flex', flexWrap: { xs: 'wrap', md: 'nowrap' }, '&& > *': { minWidth: { xs: '100%', md: '0%' }, }, ...other.sx, }} > <Button href={primaryUrl} component={Link} target={primaryUrlTarget} rel={primaryUrlTarget ? 'noopener' : ''} noLinkStyle size="large" variant="contained" endIcon={<KeyboardArrowRightRounded />} sx={{ flexShrink: 0, mr: { xs: 0, md: 1.5 }, mb: { xs: 2, md: 0 }, }} > {primaryLabel} </Button> {installation ? ( <Button size="large" // @ts-expect-error variant="codeOutlined" endIcon={copied ? <CheckRounded color="primary" /> : <ContentCopyRounded />} onClick={handleCopy} sx={{ maxWidth: '324px', display: 'inline-block', justifyContent: 'start', overflowX: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', position: 'relative', pr: 5, }} > {installation} </Button> ) : null} {secondaryLabel ? ( <Button href={secondaryUrl} component={Link} target={secondaryUrlTarget} rel={secondaryUrlTarget ? 'noopener' : ''} noLinkStyle variant="outlined" size="large" color="secondary" endIcon={<KeyboardArrowRightRounded />} > {secondaryLabel} </Button> ) : null} </Box> {altInstallation && <NpmCopyButton installation={altInstallation} sx={{ mt: 2 }} />} </React.Fragment> ); }
5,143
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/GoldSponsors.tsx
import * as React from 'react'; import { useInView } from 'react-intersection-observer'; import Paper from '@mui/material/Paper'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import AddRounded from '@mui/icons-material/AddRounded'; import Grid from '@mui/material/Grid'; import SponsorCard from 'docs/src/components/home/SponsorCard'; import Link from 'docs/src/modules/components/Link'; import ROUTES from 'docs/src/route'; const GOLDs = [ { src: '/static/sponsors/tidelift.svg', srcSet: '/static/sponsors/tidelift.svg', name: 'Tidelift', description: 'Enterprise-ready open-source software.', href: 'https://tidelift.com/subscription/pkg/npm-material-ui?utm_source=npm-material-ui&utm_medium=referral&utm_campaign=homepage', }, { src: 'https://avatars.githubusercontent.com/u/1262264?size=40', srcSet: 'https://avatars.githubusercontent.com/u/1262264?s=80 2x', name: 'Text-em-all', description: 'The easy way to message your group.', href: 'https://www.text-em-all.com/?utm_source=MUI&utm_medium=referral&utm_content=homepage', }, { src: 'https://images.opencollective.com/spotify/f37ea28/logo/40.png', srcSet: 'https://images.opencollective.com/spotify/f37ea28/logo/80.png 2x', name: 'Spotify', description: 'Music service to access to millions of songs.', href: 'https://open.spotify.com?utm_source=MUI&utm_medium=referral&utm_content=homepage', }, { src: '/static/sponsors//megafamous.png', name: 'MegaFamous', description: 'Buy Instagram followers & likes.', href: 'https://megafamous.com/?utm_source=MUI&utm_medium=referral&utm_content=homepage', }, { src: 'https://images.opencollective.com/dialmycalls/f5ae9ab/avatar/40.png', srcSet: 'https://images.opencollective.com/dialmycalls/f5ae9ab/avatar/80.png 2x', name: 'DialMyCalls', description: 'Send text messages, calls to thousands.', href: 'https://www.dialmycalls.com/?utm_source=MUI&utm_medium=referral&utm_content=homepage', }, { src: 'https://images.opencollective.com/goread_io/eb6337d/logo/40.png', srcSet: 'https://images.opencollective.com/goread_io/eb6337d/logo/80.png 2x', name: 'Goread.io', description: 'Instagram followers, likes, views, comments.', href: 'https://goread.io/?utm_source=MUI&utm_medium=referral&utm_content=homepage', }, { src: 'https://images.opencollective.com/icons8/7fa1641/logo/40.png', srcSet: 'https://images.opencollective.com/icons8/7fa1641/logo/80.png 2x', name: 'Icons8', description: 'Icons, illustrations, design tools, and more.', href: 'https://icons8.com?utm_source=MUI&utm_medium=referral&utm_content=homepage', }, ]; export default function GoldSponsors() { const { ref, inView } = useInView({ triggerOnce: true, threshold: 0, rootMargin: '500px', }); return ( <div ref={ref}> <Typography component="h3" variant="h6" fontWeight="bold" sx={(theme) => ({ mt: 4, mb: 1.5, background: `linear-gradient(90deg, ${(theme.vars || theme).palette.warning[500]} 50%, ${ (theme.vars || theme).palette.warning[700] } 100%)`, WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent', ...theme.applyDarkStyles({ background: `linear-gradient(90deg, ${ (theme.vars || theme).palette.warning[400] } 50%, ${(theme.vars || theme).palette.warning[700]} 100%)`, WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent', }), })} > Gold </Typography> <Grid container spacing={{ xs: 2, md: 3 }}> {GOLDs.map((item) => ( <Grid item key={item.name} xs={12} sm={6} md={4} lg={3}> <SponsorCard inView={inView} item={item} /> </Grid> ))} <Grid item xs={12} sm={6} md={4} lg={3}> <Paper variant="outlined" sx={(theme) => ({ p: 2, display: 'flex', alignItems: 'center', height: '100%', borderStyle: 'dashed', borderColor: 'grey.300', ...theme.applyDarkStyles({ borderColor: 'primaryDark.400', }), })} > <IconButton aria-label="Sponsor MUI" component="a" href={ROUTES.goldSponsor} target="_blank" rel="noopener noreferrer" color="primary" sx={(theme) => ({ mr: 2, border: '1px solid', borderColor: 'grey.300', ...theme.applyDarkStyles({ borderColor: 'primaryDark.400', }), })} > <AddRounded /> </IconButton> <div> <Typography variant="body2" color="text.primary" fontWeight="bold"> Become a sponsor </Typography> <Typography variant="body2" color="text.secondary"> Find out how{' '} <Link href={ROUTES.goldSponsor} target="_blank" rel="noopener noreferrer"> you can support MUI. </Link> </Typography> </div> </Paper> </Grid> </Grid> </div> ); }
5,144
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/Hero.tsx
import * as React from 'react'; import dynamic from 'next/dynamic'; import { useTheme } from '@mui/material/styles'; import Box, { BoxProps } from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import Stack from '@mui/material/Stack'; import useMediaQuery from '@mui/material/useMediaQuery'; import GradientText from 'docs/src/components/typography/GradientText'; import GetStartedButtons from 'docs/src/components/home/GetStartedButtons'; import HeroContainer from 'docs/src/layouts/HeroContainer'; function createLoading(sx: BoxProps['sx']) { return function Loading() { return ( <Box sx={[ (theme) => ({ borderRadius: 1, bgcolor: 'grey.100', ...theme.applyDarkStyles({ bgcolor: 'primaryDark.800', }), }), ...(Array.isArray(sx) ? sx : [sx]), ]} /> ); }; } const TaskCard = dynamic(() => import('../showcase/TaskCard'), { ssr: false, loading: createLoading({ width: 360, height: 280 }), }); const PlayerCard = dynamic(() => import('../showcase/PlayerCard'), { ssr: false, loading: createLoading({ width: 400, height: 240 }), }); const ThemeToggleButton = dynamic(() => import('../showcase/ThemeToggleButton'), { ssr: false, loading: createLoading({ width: 360, height: 48 }), }); const ThemeChip = dynamic(() => import('../showcase/ThemeChip'), { ssr: false, loading: createLoading({ width: 400, height: 24 }), }); const ThemeTimeline = dynamic(() => import('../showcase/ThemeTimeline'), { ssr: false, loading: createLoading({ width: 400, height: 180 }), }); const FolderTable = dynamic(() => import('../showcase/FolderTable'), { ssr: false, loading: createLoading({ width: 360, height: 210 }), }); const ThemeDatePicker = dynamic(() => import('../showcase/ThemeDatePicker'), { ssr: false, loading: createLoading({ width: 360, height: 260 }), }); const ThemeTabs = dynamic(() => import('../showcase/ThemeTabs'), { ssr: false, loading: createLoading({ width: { md: 360, xl: 400 }, height: 48 }), }); const ThemeSlider = dynamic(() => import('../showcase/ThemeSlider'), { ssr: false, loading: createLoading({ width: 400, height: 104 }), }); const ThemeAccordion = dynamic(() => import('../showcase/ThemeAccordion'), { ssr: false, loading: createLoading({ width: { md: 360, xl: 400 }, height: 231 }), }); const NotificationCard = dynamic(() => import('../showcase/NotificationCard'), { ssr: false, loading: createLoading({ width: { md: 360, xl: 400 }, height: 103 }), }); export default function Hero() { const globalTheme = useTheme(); const isMdUp = useMediaQuery(globalTheme.breakpoints.up('md')); return ( <HeroContainer linearGradient left={ <Box sx={{ textAlign: { xs: 'center', md: 'left' } }}> <Typography variant="h1" sx={{ mb: 2, maxWidth: 500 }}> <GradientText>Move faster</GradientText> <br /> with intuitive React UI tools </Typography> <Typography color="text.secondary" sx={{ mb: 3, maxWidth: 500 }}> MUI offers a comprehensive suite of free UI tools to help you ship new features faster. Start with Material UI, our fully-loaded component library, or bring your own design system to our production-ready components. </Typography> <GetStartedButtons primaryLabel="Discover the Core libraries" primaryUrl="/core/" /> </Box> } rightSx={{ p: 4, ml: 2, minWidth: 2000, overflow: 'hidden', // the components in the Hero section are mostly illustrative, even though they're interactive. That's why scrolling is disabled. '& > div': { width: 360, display: 'inline-flex', verticalAlign: 'top', '&:nth-of-type(2)': { width: { xl: 400 }, }, }, '&& *': { fontFamily: ['"IBM Plex Sans"', '-apple-system', 'BlinkMacSystemFont', 'sans-serif'].join( ',', ), }, }} right={ <React.Fragment> {isMdUp && ( <Stack spacing={3} sx={{ '& > .MuiPaper-root': { maxWidth: 'none' } }}> <TaskCard /> <ThemeChip /> <ThemeDatePicker /> <NotificationCard /> <ThemeAccordion /> </Stack> )} {isMdUp && ( <Stack spacing={3} sx={{ ml: 3, '& > .MuiPaper-root': { maxWidth: 'none' } }}> <ThemeTimeline /> <ThemeToggleButton /> <ThemeSlider /> <ThemeTabs /> <PlayerCard /> <FolderTable /> </Stack> )} </React.Fragment> } /> ); }
5,145
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/HeroEnd.tsx
import * as React from 'react'; import dynamic from 'next/dynamic'; import { useInView } from 'react-intersection-observer'; import Box from '@mui/material/Box'; import { alpha } from '@mui/material/styles'; import Section from 'docs/src/layouts/Section'; function Placeholder() { return <Box sx={{ height: { xs: 587, sm: 303, md: 289 } }} />; } const StartToday = dynamic(() => import('./StartToday'), { loading: Placeholder }); export default function HeroEnd() { const { ref, inView } = useInView({ triggerOnce: true, threshold: 0, rootMargin: '500px', }); return ( <Box ref={ref} sx={(theme) => ({ background: `linear-gradient(180deg, #FFF 50%, ${(theme.vars || theme).palette.primary[50]} 100%) `, ...theme.applyDarkStyles({ background: `linear-gradient(180deg, ${ (theme.vars || theme).palette.primaryDark[800] } 50%, ${alpha(theme.palette.primary[900], 0.2)} 100%) `, }), })} > <Section bg="transparent" cozy> {inView ? <StartToday /> : <Placeholder />} </Section> </Box> ); }
5,146
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/MaterialDesignComponents.tsx
import * as React from 'react'; import { styled, Theme, ThemeOptions, alpha, experimental_extendTheme as extendTheme, Experimental_CssVarsProvider as CssVarsProvider, } from '@mui/material/styles'; import { capitalize } from '@mui/material/utils'; import Alert from '@mui/material/Alert'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Chip from '@mui/material/Chip'; import Tabs from '@mui/material/Tabs'; import Menu from '@mui/material/Menu'; import MenuItem from '@mui/material/MenuItem'; import ListItemIcon from '@mui/material/ListItemIcon'; import Paper from '@mui/material/Paper'; import Tab from '@mui/material/Tab'; import Table from '@mui/material/Table'; import TableBody from '@mui/material/TableBody'; import TableCell from '@mui/material/TableCell'; import TableContainer from '@mui/material/TableContainer'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; import TextField from '@mui/material/TextField'; import Typography from '@mui/material/Typography'; import ShoppingCartRounded from '@mui/icons-material/ShoppingCartRounded'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import CheckCircleRounded from '@mui/icons-material/CheckCircleRounded'; import MailRounded from '@mui/icons-material/MailRounded'; import VerifiedUserRounded from '@mui/icons-material/VerifiedUserRounded'; import HelpCenterRounded from '@mui/icons-material/HelpCenterRounded'; import ROUTES from 'docs/src/route'; import Link from 'docs/src/modules/components/Link'; import { getDesignTokens, getThemedComponents } from 'docs/src/modules/brandingTheme'; const Grid = styled('div')(({ theme }) => [ { borderRadius: (theme.vars || theme).shape.borderRadius, backgroundColor: alpha(theme.palette.grey[50], 0.4), display: 'grid', gridTemplateColumns: '1fr', gridAutoRows: 240, [theme.breakpoints.up('sm')]: { gridAutoRows: 260, paddingTop: 1, gridTemplateColumns: '1fr 1fr', }, [theme.breakpoints.up('md')]: { gridAutoRows: 280, gridTemplateColumns: '1fr 1fr 1fr', }, '& > div': { padding: theme.spacing(2), alignSelf: 'stretch', border: '1px solid', borderColor: (theme.vars || theme).palette.grey[200], [theme.breakpoints.only('xs')]: { '&:first-of-type': { borderTopLeftRadius: (theme.vars || theme).shape.borderRadius, borderTopRightRadius: (theme.vars || theme).shape.borderRadius, }, '&:last-of-type': { borderBottomLeftRadius: (theme.vars || theme).shape.borderRadius, borderBottomRightRadius: (theme.vars || theme).shape.borderRadius, }, '&:not(:first-of-type)': { marginTop: -1, }, }, [theme.breakpoints.only('sm')]: { marginTop: -1, '&:first-of-type': { borderTopLeftRadius: (theme.vars || theme).shape.borderRadius, }, '&:last-of-type': { borderBottomRightRadius: (theme.vars || theme).shape.borderRadius, borderStyle: 'dashed', }, '&:nth-of-type(even)': { marginLeft: -1, }, '&:nth-last-of-type(2)': { borderBottomLeftRadius: (theme.vars || theme).shape.borderRadius, }, '&:nth-of-type(2)': { borderTopRightRadius: (theme.vars || theme).shape.borderRadius, }, }, [theme.breakpoints.up('md')]: { marginTop: -1, '&:not(:nth-of-type(3n + 1))': { marginLeft: -1, }, '&:first-of-type': { borderTopLeftRadius: (theme.vars || theme).shape.borderRadius, }, '&:last-of-type': { borderBottomRightRadius: (theme.vars || theme).shape.borderRadius, }, '&:nth-last-of-type(3)': { borderBottomLeftRadius: (theme.vars || theme).shape.borderRadius, }, '&:nth-of-type(3)': { borderTopRightRadius: (theme.vars || theme).shape.borderRadius, }, }, }, }, theme.applyDarkStyles({ backgroundColor: (theme.vars || theme).palette.background.paper, '& > div': { borderColor: alpha(theme.palette.primaryDark[600], 0.3), }, }), ]); function Demo({ name, children, control, ...props }: { name: string; theme: Theme | undefined; children: React.ReactElement; control?: { prop: string; values: Array<string>; defaultValue?: string }; }) { const [propValue, setPropValue] = React.useState( control ? control.defaultValue || control.values[0] : '', ); return ( <Box sx={{ display: 'flex', flexDirection: 'column', height: '100%' }}> {control ? ( <Box sx={{ minHeight: 40, ml: -1, mt: -1 }}> <Tabs value={propValue} onChange={(event, value) => setPropValue(value)} sx={{ minHeight: 'initial', '& .MuiTabs-indicator': { bgcolor: 'transparent', '&:before': { height: '100%', content: '""', display: 'block', width: (theme) => `calc(100% - ${theme.spacing(2)})`, bgcolor: 'primary.main', position: 'absolute', top: 0, left: (theme) => theme.spacing(1), }, }, '& .MuiTab-root': { px: 1, pt: 0.5, minWidth: 'initial', minHeight: 'initial', fontWeight: 'medium', }, }} > {control.values.map((value) => ( <Tab key={value} value={value} label={capitalize(value)} /> ))} </Tabs> </Box> ) : null} <Box className="mui-default-theme" sx={{ flexGrow: 1, display: 'flex', alignItems: 'center', justifyContent: 'center' }} > <CssVarsProvider theme={props.theme}> {React.cloneElement(children, { ...(control && { [control.prop]: propValue, }), })} </CssVarsProvider> </Box> <Typography fontWeight="semiBold" variant="body2"> {name} </Typography> </Box> ); } const StyledChip = styled(Chip)(({ theme }) => [ { fontWeight: 700, transition: 'none', '&.MuiChip-outlined': { border: 'none', color: (theme.vars || theme).palette.text.secondary, }, '&.MuiChip-clickable:active': { boxShadow: 'none', }, '&.MuiChip-filled': { border: '1px solid', borderColor: (theme.vars || theme).palette.primary[300], backgroundColor: (theme.vars || theme).palette.primary[500], color: '#fff', }, }, theme.applyDarkStyles({ '&.MuiChip-filled': { backgroundColor: (theme.vars || theme).palette.primary[700], }, }), ]); const themedComponents = getThemedComponents(); export function buildTheme(): ThemeOptions { return { components: { MuiButtonBase: { defaultProps: { disableTouchRipple: true, }, }, MuiButton: { defaultProps: { disableElevation: true, }, styleOverrides: { root: { borderRadius: '99px', fontWeight: 500, fontSize: '0.875rem', lineHeight: 24 / 16, textTransform: 'none', }, sizeSmall: ({ theme }) => ({ padding: theme.spacing(0.5, 1), }), sizeMedium: ({ theme }) => ({ padding: theme.spacing(0.8, 2), }), sizeLarge: ({ theme }) => ({ padding: theme.spacing(1, 2), fontSize: '1rem', }), text: ({ theme }) => ({ color: (theme.vars || theme).palette.primary[600], ...theme.applyDarkStyles({ color: (theme.vars || theme).palette.primary[300], }), }), contained: ({ theme }) => ({ color: (theme.vars || theme).palette.primaryDark[50], backgroundColor: (theme.vars || theme).palette.primary[600], ...theme.applyDarkStyles({ backgroundColor: (theme.vars || theme).palette.primary[600], }), }), outlined: ({ theme }) => ({ borderColor: (theme.vars || theme).palette.primary[300], ...theme.applyDarkStyles({ color: (theme.vars || theme).palette.primary[300], backgroundColor: alpha(theme.palette.primary[900], 0.1), borderColor: alpha(theme.palette.primary[300], 0.5), }), }), iconSizeSmall: { '& > *:nth-of-type(1)': { fontSize: '0.875rem', }, }, iconSizeMedium: { '& > *:nth-of-type(1)': { fontSize: '0.875rem', }, }, iconSizeLarge: { '& > *:nth-of-type(1)': { fontSize: '1rem', }, }, }, }, MuiAlert: { defaultProps: { icon: <CheckCircleRounded />, }, styleOverrides: { root: ({ theme }) => [ { padding: theme.spacing(1.5), '& .MuiAlert-icon': { color: (theme.vars || theme).palette.primaryDark[800], }, }, theme.applyDarkStyles({ '& .MuiAlert-icon': { color: (theme.vars || theme).palette.primaryDark[100], }, }), ], filled: ({ theme }) => ({ color: (theme.vars || theme).palette.primary[50], backgroundColor: (theme.vars || theme).palette.primary[600], '& .MuiAlert-icon': { color: '#fff', }, ...theme.applyDarkStyles({ backgroundColor: (theme.vars || theme).palette.primary[600], }), }), outlined: ({ theme }) => [ { color: (theme.vars || theme).palette.primaryDark[700], backgroundColor: '#fff', borderColor: (theme.vars || theme).palette.primary[100], '& .MuiAlert-icon': { color: (theme.vars || theme).palette.primary[500], }, }, theme.applyDarkStyles({ color: (theme.vars || theme).palette.primaryDark[50], backgroundColor: 'transparent', borderColor: (theme.vars || theme).palette.primaryDark[600], '& .MuiAlert-icon': { color: (theme.vars || theme).palette.primaryDark[100], }, }), ], message: { padding: 0, fontWeight: 500, }, standardInfo: ({ theme }) => [ { backgroundColor: (theme.vars || theme).palette.primary[50], color: (theme.vars || theme).palette.primary[600], border: '1px solid', borderColor: alpha(theme.palette.primaryDark[100], 0.5), '& .MuiAlert-icon': { color: (theme.vars || theme).palette.primary[500], }, }, theme.applyDarkStyles({ backgroundColor: alpha(theme.palette.primaryDark[900], 0.5), color: (theme.vars || theme).palette.primaryDark[50], borderColor: alpha(theme.palette.primaryDark[500], 0.2), '& .MuiAlert-icon': { color: (theme.vars || theme).palette.primaryDark[50], }, }), ], icon: { paddingTop: 1, paddingBottom: 0, '& > svg': { fontSize: '1.125rem', }, }, }, }, MuiTextField: { styleOverrides: { root: ({ theme }) => [ { '& .MuiInputLabel-outlined.Mui-focused': { color: (theme.vars || theme).palette.grey[800], }, '& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline': { background: 'transparent', borderColor: (theme.vars || theme).palette.primary[400], }, '& .MuiOutlinedInput-root': { backgroundColor: 'transparent', borderColor: (theme.vars || theme).palette.grey[50], }, '& .MuiInputBase-root': { fontWeight: 700, '&:before': { borderColor: (theme.vars || theme).palette.grey[300], }, }, '& .MuiFilledInput-root': { backgroundColor: '#fff', border: '1px solid', borderColor: (theme.vars || theme).palette.grey[100], '&:before': { borderColor: (theme.vars || theme).palette.grey[300], }, '&:after': { borderColor: (theme.vars || theme).palette.primary[400], }, '&:hover': { borderColor: (theme.vars || theme).palette.grey[200], }, }, '& .MuiInputLabel-filled.Mui-focused': { color: (theme.vars || theme).palette.grey[800], }, '& .MuiInput-root.Mui-focused': { '&:after': { borderColor: (theme.vars || theme).palette.primary[400], }, }, '& .MuiInputLabel-root.Mui-focused': { color: (theme.vars || theme).palette.grey[800], }, }, theme.applyDarkStyles({ '& .MuiInputBase-root': { '&:before': { borderColor: (theme.vars || theme).palette.primaryDark[500], }, }, '& .MuiInputLabel-outlined.Mui-focused': { color: (theme.vars || theme).palette.primary[300], }, '& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline': { borderColor: (theme.vars || theme).palette.primary[300], }, '& .MuiOutlinedInput-input': { backgroundColor: 'transparent', }, '& .MuiFilledInput-root': { borderColor: (theme.vars || theme).palette.primaryDark[800], backgroundColor: alpha(theme.palette.primaryDark[800], 0.5), '&:after': { borderColor: (theme.vars || theme).palette.primary[300], }, '&:hover': { backgroundColor: alpha(theme.palette.primaryDark[700], 0.8), borderColor: (theme.vars || theme).palette.primaryDark[500], }, }, '& .MuiInputLabel-filled.Mui-focused': { color: (theme.vars || theme).palette.grey[500], }, '& .MuiInput-root.Mui-focused': { '&:after': { borderColor: (theme.vars || theme).palette.primaryDark[800], }, }, '& .MuiInputLabel-root.Mui-focused': { color: (theme.vars || theme).palette.grey[500], }, }), ], }, }, MuiTooltip: themedComponents.components?.MuiTooltip, MuiPaper: themedComponents.components?.MuiPaper, MuiTableHead: { styleOverrides: { root: ({ theme }) => ({ padding: 10, backgroundColor: alpha(theme.palette.grey[50], 0.5), borderColor: (theme.vars || theme).palette.divider, ...theme.applyDarkStyles({ backgroundColor: alpha(theme.palette.primaryDark[600], 0.5), }), }), }, }, MuiTableCell: { styleOverrides: { root: ({ theme }) => ({ padding: 10, borderColor: (theme.vars || theme).palette.divider, }), }, }, MuiPopover: { styleOverrides: { paper: ({ theme }) => ({ boxShadow: '0px 4px 20px rgba(170, 180, 190, 0.3)', ...theme.applyDarkStyles({ boxShadow: '0px 4px 20px rgba(0, 0, 0, 0.5)', }), }), }, }, MuiMenu: { styleOverrides: { list: ({ theme }) => ({ padding: theme.spacing(1, 0), }), }, }, MuiMenuItem: { styleOverrides: { root: ({ theme }) => [ { padding: theme.spacing(1, 2), '& svg': { fontSize: '1.125rem', color: (theme.vars || theme).palette.primaryDark[400], }, }, theme.applyDarkStyles({ '& svg': { color: (theme.vars || theme).palette.primary[300], }, }), ], }, }, }, }; } const { palette: lightPalette, typography, ...designTokens } = getDesignTokens('light'); const { palette: darkPalette } = getDesignTokens('dark'); export const customTheme = extendTheme({ cssVarPrefix: 'muidocs', colorSchemes: { light: { palette: lightPalette, }, dark: { palette: darkPalette, }, }, ...designTokens, ...buildTheme(), }); export default function MaterialDesignComponents() { const [anchor, setAnchor] = React.useState<HTMLElement | null>(null); const [customized, setCustomized] = React.useState(false); const theme = customized ? customTheme : undefined; return ( <div> <Box sx={{ mt: { xs: 2, md: 4 }, mb: 2, display: 'flex', justifyContent: { sm: 'flex-start', md: 'flex-end' }, }} > <StyledChip color="primary" label="Material Design" size="small" variant={!customized ? 'filled' : 'outlined'} onClick={() => setCustomized(false)} /> <StyledChip color="primary" label="Custom theme" size="small" variant={customized ? 'filled' : 'outlined'} onClick={() => setCustomized(true)} sx={{ ml: 1 }} /> </Box> <Grid> <div> <Demo theme={theme} name="Button" control={{ prop: 'size', values: ['small', 'medium', 'large'], defaultValue: 'medium' }} > <Button variant="contained" startIcon={<ShoppingCartRounded />}> Add to Cart </Button> </Demo> </div> <div> <Demo theme={theme} name="Alert" control={{ prop: 'variant', values: ['standard', 'filled', 'outlined'] }} > <Alert color="info">Check out this alert!</Alert> </Demo> </div> <div> <Demo theme={theme} name="Text Field" control={{ prop: 'variant', values: ['outlined', 'standard', 'filled'] }} > <TextField id="material-design-textfield" label="Username" defaultValue="Ultraviolet" /> </Demo> </div> <div> <Demo theme={theme} name="Menu"> <React.Fragment> <Button onClick={(event) => setAnchor(event.target as HTMLElement)}> Click to open </Button> <Menu open={Boolean(anchor)} anchorEl={anchor} onClose={() => setAnchor(null)} PaperProps={{ variant: 'outlined', elevation: 0 }} > <MenuItem> <ListItemIcon> <MailRounded /> </ListItemIcon> Contact </MenuItem> <MenuItem> <ListItemIcon> <VerifiedUserRounded /> </ListItemIcon> Security </MenuItem> <MenuItem> <ListItemIcon> <HelpCenterRounded /> </ListItemIcon> About us </MenuItem> </Menu> </React.Fragment> </Demo> </div> <div> <Demo theme={theme} name="Table"> <TableContainer component={Paper} variant="outlined" sx={{ '& .MuiTableBody-root > .MuiTableRow-root:last-of-type > .MuiTableCell-root': { borderBottomWidth: 0, }, }} > <Table aria-label="demo table"> <TableHead> <TableRow> <TableCell>Dessert</TableCell> <TableCell>Calories</TableCell> </TableRow> </TableHead> <TableBody> <TableRow> <TableCell>Frozen yoghurt</TableCell> <TableCell>109</TableCell> </TableRow> <TableRow> <TableCell>Cupcake</TableCell> <TableCell>305</TableCell> </TableRow> </TableBody> </Table> </TableContainer> </Demo> </div> <Box sx={{ textAlign: 'center', display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', }} > <Typography variant="body2" fontWeight="bold" sx={{ mb: 0.5 }}> Want to see more? </Typography> <Typography variant="body2" color="text.secondary" sx={{ mb: 0.5, maxWidth: 250, mx: 'auto' }} > Check out the docs for details of the complete library. </Typography> <Button component={Link} noLinkStyle href={ROUTES.documentation} endIcon={<KeyboardArrowRightRounded />} > Learn more </Button> </Box> </Grid> </div> ); }
5,147
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/MaterialDesignDemo.tsx
import * as React from 'react'; import MuiAvatar from '@mui/material/Avatar'; import MuiBox from '@mui/material/Box'; import MuiChip from '@mui/material/Chip'; import MuiDivider from '@mui/material/Divider'; import MuiIconButton from '@mui/material/IconButton'; import MuiCard, { CardProps } from '@mui/material/Card'; import MuiSwitch from '@mui/material/Switch'; import MuiTypography from '@mui/material/Typography'; import MuiStack from '@mui/material/Stack'; import MuiEdit from '@mui/icons-material/Edit'; import MuiLocationOn from '@mui/icons-material/LocationOn'; import { grey } from '@mui/material/colors'; import { withPointer } from 'docs/src/components/home/ElementPointer'; export const componentCode = `<Card> <Box sx={{ p: 2, display: 'flex' }}> <Avatar variant="rounded" src="avatar.jpg" /> <Stack spacing={0.5}> <Typography fontWeight="bold">Lucas Smith</Typography> <Typography variant="body2" color="text.secondary"> <LocationOn sx={{color: grey[500]}} /> Scranton, PA, United States </Typography> </Stack> <IconButton size="small"> <Edit fontSize="small" /> </IconButton> </Box> <Divider /> <Stack direction="row" alignItems="center" justifyContent="space-between" sx={{ px: 2, py: 1, bgcolor: 'background.default' }} > <Chip label={active ? 'Active account' : 'Inactive account'} color={active ? 'success' : 'default'} size="small" /> <Switch /> </Stack> </Card> `; const Box = MuiBox; const Avatar = withPointer(MuiAvatar, { id: 'avatar', name: 'Avatar' }); const Divider = withPointer(MuiBox, { id: 'divider', name: 'Divider' }); const Chip = withPointer(MuiChip, { id: 'chip', name: 'Chip' }); const IconButton = withPointer(MuiIconButton, { id: 'iconButton', name: 'IconButton' }); const Card = withPointer(MuiCard, { id: 'card', name: 'Card' }); const Switch = withPointer(MuiSwitch, { id: 'switch', name: 'Switch' }); const Typography = withPointer(MuiTypography, { id: 'typography', name: 'Typography' }); const Typography2 = withPointer(MuiTypography, { id: 'typography2', name: 'Typography' }); const Stack = withPointer(MuiStack, { id: 'stack', name: 'Stack' }); const Stack2 = withPointer(MuiStack, { id: 'stack2', name: 'Stack' }); const Edit = withPointer(MuiEdit, { id: 'editIcon', name: 'EditIcon' }); const LocationOn = withPointer(MuiLocationOn, { id: 'locationOnIcon', name: 'LocationOnIcon' }); export default function MaterialDesignDemo(props: CardProps) { const [active, setActive] = React.useState(false); return ( <Card {...props}> <Box sx={{ p: 2, display: 'flex' }}> <Avatar variant="rounded" src="/static/images/avatar/2.jpg" imgProps={{ 'aria-labelledby': 'demo-task-card-assignee-name' }} /> <Stack spacing={0.5} alignItems="flex-start" sx={{ mx: 2, flexGrow: 1, '& svg': { fontSize: 18, verticalAlign: 'bottom', mr: 0.5, mb: 0.1 }, }} > <Typography fontWeight="bold">Lucas Smith</Typography> <Typography2 variant="body2" color="text.secondary"> <LocationOn sx={{ color: grey[500] }} /> Scranton, PA, United States </Typography2> </Stack> <IconButton aria-label="Edit" size="small" sx={{ alignSelf: 'flex-start' }}> <Edit fontSize="small" /> </IconButton> </Box> <Divider sx={{ my: -1, py: 1, position: 'relative', zIndex: 1 }}> <MuiDivider /> </Divider> <Stack2 direction="row" alignItems="center" justifyContent="space-between" sx={{ px: 2, py: 1.5, bgcolor: 'background.default' }} > <Chip label={active ? 'Active account' : 'Inactive account'} color={active ? 'success' : 'default'} size="small" /> <Switch inputProps={{ 'aria-label': active ? 'disable account' : 'activate account', }} checked={active} onChange={(event) => setActive(event.target.checked)} sx={{ ml: 'auto' }} /> </Stack2> </Card> ); }
5,148
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/MuiStatistics.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; const data = [ { title: '4M', metadata: 'Weekly downloads on npm' }, { title: '87k', metadata: 'Stars on GitHub' }, { title: '2.7k', metadata: 'Open-source contributors' }, { title: '18.4k', metadata: 'Followers on Twitter' }, ]; export default function MuiStatistics() { return ( <Grid item xs={12} md={6} container spacing={4}> {data.map((item) => ( <Grid key={item.title} item xs={6}> <Box sx={(theme) => ({ height: '100%', pl: 2, borderLeft: '1px solid', borderColor: 'primary.100', ...theme.applyDarkStyles({ borderColor: 'primaryDark.600', }), })} > <Typography component="div" variant="h4" fontWeight="bold" sx={(theme) => ({ color: 'primary.main', ...theme.applyDarkStyles({ color: 'primary.200', }), })} > {item.title} </Typography> <Typography color="text.secondary">{item.metadata}</Typography> </Box> </Grid> ))} </Grid> ); }
5,149
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/NewsletterToast.tsx
import * as React from 'react'; import { useRouter } from 'next/router'; import Slide from '@mui/material/Slide'; import Box from '@mui/material/Box'; import Card from '@mui/material/Card'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import CloseRounded from '@mui/icons-material/CloseRounded'; import MarkEmailReadTwoTone from '@mui/icons-material/MarkEmailReadTwoTone'; export default function NewsletterToast() { const router = useRouter(); const [hidden, setHidden] = React.useState(router.query.newsletter !== 'subscribed'); React.useEffect(() => { if (router.query.newsletter === 'subscribed') { setHidden(false); router.replace(router.pathname); } }, [router.query.newsletter, router]); React.useEffect(() => { const time = setTimeout(() => { if (!hidden) { setHidden(true); } }, 4000); return () => { clearTimeout(time); }; }, [hidden]); return ( <Slide in={!hidden} timeout={400} direction="down"> <Box sx={{ position: 'fixed', zIndex: 1300, top: 80, left: 0, width: '100%', }} > <Card variant="outlined" role="alert" sx={(theme) => ({ p: 1, position: 'absolute', left: '50%', transform: 'translate(-50%)', opacity: hidden ? 0 : 1, transition: '0.5s', display: 'flex', alignItems: 'center', boxShadow: '0px 4px 20px rgba(61, 71, 82, 0.25)', ...theme.applyDarkStyles({ boxShadow: '0px 4px 20px rgba(0, 0, 0, 0.6)', }), })} > <MarkEmailReadTwoTone color="success" sx={{ mx: 0.5 }} /> <div> <Typography variant="body2" color="text.secondary" fontWeight={500} sx={{ ml: 1, mr: 2 }} > You have subscribed to MUI newsletter. </Typography> </div> <IconButton aria-hidden size="small" onClick={() => setHidden(true)} aria-label="close"> <CloseRounded fontSize="small" /> </IconButton> </Card> </Box> </Slide> ); }
5,150
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/ProductSuite.tsx
import * as React from 'react'; import dynamic from 'next/dynamic'; import { useInView } from 'react-intersection-observer'; import Grid from '@mui/material/Grid'; import Box, { BoxProps } from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import Section from 'docs/src/layouts/Section'; import GradientText from 'docs/src/components/typography/GradientText'; import ProductsSwitcher from 'docs/src/components/home/ProductsSwitcher'; import { PrefetchStoreTemplateImages } from 'docs/src/components/home/StoreTemplatesBanner'; import { PrefetchDesignKitImages } from 'docs/src/components/home/DesignKits'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; function createLoading(sx: BoxProps['sx']) { return function Loading() { return ( <Box sx={[ (theme) => ({ borderRadius: 1, bgcolor: 'grey.100', ...theme.applyDarkStyles({ bgcolor: 'primaryDark.800', }), }), ...(Array.isArray(sx) ? sx : [sx]), ]} /> ); }; } const CoreShowcase = dynamic(() => import('./CoreShowcase'), { loading: createLoading({ height: 723, mt: { md: 2 } }), }); const AdvancedShowcase = dynamic(() => import('./AdvancedShowcase'), { loading: createLoading({ height: 750, mt: { md: 2 } }), }); const StoreTemplatesBanner = dynamic(() => import('./StoreTemplatesBanner')); const DesignKits = dynamic(() => import('./DesignKits')); function ProductSuite() { const [productIndex, setProductIndex] = React.useState(0); const { ref, inView } = useInView({ triggerOnce: true, threshold: 0, rootMargin: '200px', }); return ( <Section bg="gradient" ref={ref}> <Grid container spacing={2}> <Grid item md={6}> <Box sx={{ maxWidth: 500 }}> <SectionHeadline overline="Products" title={ <Typography variant="h2" sx={{ my: 1 }}> Every component you need is <GradientText>ready for production</GradientText> </Typography> } description="Build at an accelerated pace without sacrificing flexibility or control." /> </Box> <Box sx={{ mt: 4 }} /> <ProductsSwitcher inView={inView} productIndex={productIndex} setProductIndex={setProductIndex} /> </Grid> <Grid item xs={12} md={6} sx={productIndex === 0 ? { minHeight: { xs: 777, sm: 757, md: 'unset' } } : {}} > {inView && ( <React.Fragment> <PrefetchStoreTemplateImages /> <PrefetchDesignKitImages /> {productIndex === 0 && <CoreShowcase />} {productIndex === 1 && <AdvancedShowcase />} {productIndex === 2 && <StoreTemplatesBanner />} {productIndex === 3 && <DesignKits />} </React.Fragment> )} </Grid> </Grid> </Section> ); } export default ProductSuite;
5,151
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/ProductsSwitcher.tsx
import * as React from 'react'; import dynamic from 'next/dynamic'; import { Theme } from '@mui/material/styles'; import Box from '@mui/material/Box'; import { visuallyHidden } from '@mui/utils'; import useMediaQuery from '@mui/material/useMediaQuery'; import Typography from '@mui/material/Typography'; import Stack from '@mui/material/Stack'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import IconImage from 'docs/src/components/icon/IconImage'; import Highlighter from 'docs/src/components/action/Highlighter'; import Link from 'docs/src/modules/components/Link'; import ROUTES from 'docs/src/route'; const SwipeableViews = dynamic(() => import('react-swipeable-views'), { ssr: false }); function ProductItem({ label, icon, name, description, href, }: { label: string; icon: React.ReactNode; name: React.ReactNode; description: React.ReactNode; href: string; }) { return ( <Box component="span" sx={{ display: 'flex', p: 2, flexDirection: { xs: 'column', md: 'row' }, alignItems: { md: 'center' }, gap: 2.5, }} > <span>{icon}</span> <span> <Typography component="span" color="text.primary" variant="body2" fontWeight="bold" display="block" > {name} </Typography> <Typography component="span" color="text.secondary" variant="body2" fontWeight="regular" display="block" sx={{ my: 0.5 }} > {description} </Typography> <Link href={href} color="primary" variant="body2" fontWeight="bold" sx={{ display: 'inline-flex', alignItems: 'center', '& > svg': { transition: '0.2s' }, '&:hover > svg': { transform: 'translateX(2px)' }, }} onClick={(event: React.MouseEvent<HTMLAnchorElement>) => { event.stopPropagation(); }} > <span>Learn more</span>{' '} <Box component="span" sx={visuallyHidden}> {label} </Box> <KeyboardArrowRightRounded fontSize="small" sx={{ mt: '1px', ml: '2px' }} /> </Link> </span> </Box> ); } export default function ProductsSwitcher(props: { inView?: boolean; productIndex: number; setProductIndex: React.Dispatch<React.SetStateAction<number>>; }) { const { inView = false, productIndex, setProductIndex } = props; const isBelowMd = useMediaQuery((theme: Theme) => theme.breakpoints.down('md')); const productElements = [ <ProductItem label="by going to the Core components page" icon={<IconImage name="product-core" />} name="MUI Core" description="Foundational components for shipping features faster. Includes Material UI." href={ROUTES.productCore} />, <ProductItem label="by going to the Advanced components page" icon={<IconImage name="product-advanced" />} name={ <Box component="span" sx={{ display: 'inline-flex', alignItems: 'center' }}> MUI X </Box> } description="Advanced components for complex use cases." href={ROUTES.productAdvanced} />, <ProductItem label="by going to the templates page" icon={<IconImage name="product-templates" />} name="Templates" description="Professionally designed UI layouts to jumpstart your next project." href={ROUTES.productTemplates} />, <ProductItem label="by going to the design-kits page" icon={<IconImage name="product-designkits" />} name="Design kits" description="Bring our components to your favorite design tool." href={ROUTES.productDesignKits} />, ]; return ( <React.Fragment> <Box sx={{ display: { md: 'none' }, maxWidth: 'calc(100vw - 40px)', minHeight: { xs: 200, sm: 166 }, '& > div': { pr: '32%' }, }} > {isBelowMd && inView && ( <SwipeableViews index={productIndex} resistance enableMouseEvents onChangeIndex={(index) => setProductIndex(index)} > {productElements.map((elm, index) => ( <Highlighter key={index} disableBorder onClick={() => setProductIndex(index)} selected={productIndex === index} sx={{ width: '100%', transition: '0.3s', transform: productIndex !== index ? 'scale(0.9)' : 'scale(1)', }} > {elm} </Highlighter> ))} </SwipeableViews> )} </Box> <Stack spacing={1} sx={{ display: { xs: 'none', md: 'flex' }, maxWidth: 500 }}> {productElements.map((elm, index) => ( <Highlighter key={index} disableBorder onClick={() => setProductIndex(index)} selected={productIndex === index} > {elm} </Highlighter> ))} </Stack> </React.Fragment> ); }
5,152
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/References.tsx
import * as React from 'react'; import dynamic from 'next/dynamic'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import Section from 'docs/src/layouts/Section'; import { CORE_CUSTOMERS, ADVANCED_CUSTOMERS, DESIGNKITS_CUSTOMERS, TEMPLATES_CUSTOMERS, } from 'docs/src/components/home/CompaniesGrid'; export { CORE_CUSTOMERS, ADVANCED_CUSTOMERS, DESIGNKITS_CUSTOMERS, TEMPLATES_CUSTOMERS }; const CompaniesGrid = dynamic(() => import('./CompaniesGrid')); export default function References({ companies, }: { companies: | typeof CORE_CUSTOMERS | typeof ADVANCED_CUSTOMERS | typeof DESIGNKITS_CUSTOMERS | typeof TEMPLATES_CUSTOMERS; }) { return ( <Section> <Box sx={{ minHeight: { xs: 236, sm: 144, md: 52 } }}> <CompaniesGrid data={companies} /> </Box> <Typography textAlign="center" variant="body2" color="text.secondary" sx={{ mt: 4, mx: 'auto', maxWidth: 400, minHeight: 42, // hard-coded to reduce CLS (layout shift) }} > The world&apos;s best product teams trust MUI to deliver an unrivaled experience for both developers and users. </Typography> </Section> ); }
5,153
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/ShowcaseContainer.tsx
import * as React from 'react'; import Box, { BoxProps } from '@mui/material/Box'; import Fade from '@mui/material/Fade'; import NoSsr from '@mui/material/NoSsr'; import Paper, { PaperProps } from '@mui/material/Paper'; export default function ShowcaseContainer({ preview, previewSx, code, codeSx, sx, }: { preview?: React.ReactNode; previewSx?: PaperProps['sx']; code?: React.ReactNode; codeSx?: BoxProps['sx']; sx?: BoxProps['sx']; }) { return ( <Fade in timeout={700}> <Box sx={{ display: 'flex', flexDirection: 'column', height: '100%', ...sx, }} > <Paper variant="outlined" sx={[ { display: 'flex', position: 'relative', minHeight: 220, justifyContent: 'center', alignItems: 'center', p: 2, bgcolor: 'grey.50', borderColor: 'divider', borderBottomLeftRadius: 0, borderBottomRightRadius: 0, }, (theme) => theme.applyDarkStyles({ bgcolor: 'primaryDark.700', borderColor: 'divider', }), ...(Array.isArray(previewSx) ? previewSx : [previewSx]), ]} > {preview} </Paper> <Box sx={[ { flexGrow: 0, display: 'flex', flexDirection: 'column', maxWidth: '100%', position: 'relative', minHeight: 200, borderWidth: '0 1px 1px 1px', borderStyle: 'solid', borderColor: 'divider', bgcolor: 'primaryDark.800', borderBottomLeftRadius: 10, borderBottomRightRadius: 10, }, (theme) => theme.applyDarkStyles({ borderColor: 'divider', }), ...(Array.isArray(codeSx) ? codeSx : [codeSx]), ]} > <NoSsr>{code}</NoSsr> </Box> </Box> </Fade> ); }
5,154
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/SponsorCard.tsx
import * as React from 'react'; import Avatar from '@mui/material/Avatar'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import Paper from '@mui/material/Paper'; import LaunchRounded from '@mui/icons-material/LaunchRounded'; import Link from 'docs/src/modules/components/Link'; export default function SponsorCard({ item, inView = false, logoSize = 40, }: { item: { src: string; srcSet?: string; name: string; description: string; href: string; }; inView?: boolean; logoSize?: number | string; }) { // Keep it under two rows maximum. if (item.description.length > 50 && logoSize === 40) { throw new Error( `${item.name}'s description is too long (${item.description.length} characters). It must fit into two line, so under 50 characters.`, ); } return ( <Paper component={Link} noLinkStyle data-ga-event-category="sponsor" data-ga-event-action="homepage" data-ga-event-label={new URL(item.href).hostname} href={item.href} target="_blank" rel="sponsored noopener" variant="outlined" sx={{ p: 2, display: 'flex', height: '100%', '& svg': { transition: '0.2s', }, '&:hover': { '& svg': { transform: 'translateY(-2px)', }, }, }} > <Avatar {...(inView && { src: item.src, srcSet: item.srcSet, alt: `${item.name} logo` })} sx={{ borderRadius: '4px', width: logoSize, height: logoSize }} /> <Box sx={{ ml: 2 }}> <Typography variant="body2" fontWeight="bold"> {item.name}{' '} <LaunchRounded color="primary" sx={{ fontSize: 14, verticalAlign: 'middle', ml: 0.5 }} /> </Typography> <Typography variant="body2" color="text.secondary"> {item.description} </Typography> </Box> </Paper> ); }
5,155
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/Sponsors.tsx
import * as React from 'react'; import Typography from '@mui/material/Typography'; import Section from 'docs/src/layouts/Section'; import DiamondSponsors from 'docs/src/components/home/DiamondSponsors'; import GoldSponsors from 'docs/src/components/home/GoldSponsors'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import GradientText from 'docs/src/components/typography/GradientText'; export default function Sponsors() { return ( <Section cozy> <SectionHeadline id="sponsors" overline="Sponsors" title={ <Typography variant="h2" sx={{ my: 1 }}> <GradientText>You</GradientText> make this possible </Typography> } description="The development of these open-source tools is accelerated by our generous sponsors." /> <DiamondSponsors /> <GoldSponsors /> </Section> ); }
5,156
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/StartToday.tsx
import * as React from 'react'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import Paper from '@mui/material/Paper'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import Link from 'docs/src/modules/components/Link'; import GradientText from 'docs/src/components/typography/GradientText'; import ROUTES from 'docs/src/route'; import GetStartedButtons from 'docs/src/components/home/GetStartedButtons'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; export default function StartToday() { return ( <Grid container spacing={{ xs: 5, md: 4 }} alignItems="center"> <Grid item xs={12} sm={6} md={6} sx={{ mb: { md: 4 } }}> <SectionHeadline overline="Start now" title={ <Typography variant="h2" sx={{ maxWidth: 460, mb: 1 }}> Ship your next project <GradientText>faster</GradientText> </Typography> } description="Find out why MUI's tools are trusted by thousands of open-source developers and teams around the world." /> <GetStartedButtons primaryLabel="Discover the Core libraries" primaryUrl="/core/" /> </Grid> <Grid item xs={12} sm={6} md={6} container spacing={2}> <Grid item xs={12} md={6}> <Paper component={Link} href={ROUTES.showcase} noLinkStyle variant="outlined" sx={{ p: 2, height: '100%' }} > <Typography variant="body2" fontWeight="bold" sx={{ mb: 0.5 }}> Showcase </Typography> <Typography variant="body2" color="text.secondary" sx={{ mb: 1 }}> Check out some great examples of MUI&apos;s products in action. </Typography> <Typography color="primary" variant="body2" fontWeight="bold" sx={{ '& > svg': { transition: '0.2s' }, '&:hover > svg': { transform: 'translateX(2px)' }, }} > Learn more{' '} <KeyboardArrowRightRounded fontSize="small" sx={{ verticalAlign: 'middle' }} /> </Typography> </Paper> </Grid> <Grid item xs={12} md={6}> <Paper component={Link} href={ROUTES.blog} noLinkStyle variant="outlined" sx={{ p: 2, height: '100%' }} > <Typography variant="body2" fontWeight="bold" sx={{ mb: 0.5 }}> Blog </Typography> <Typography variant="body2" color="text.secondary" sx={{ mb: 1 }}> Read the latest updates about our company and products. </Typography> <Typography color="primary" variant="body2" fontWeight="bold" sx={{ '& > svg': { transition: '0.2s' }, '&:hover > svg': { transform: 'translateX(2px)' }, }} > Learn more{' '} <KeyboardArrowRightRounded fontSize="small" sx={{ verticalAlign: 'middle' }} /> </Typography> </Paper> </Grid> </Grid> </Grid> ); }
5,157
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/StoreTemplatesBanner.tsx
import * as React from 'react'; import { styled, alpha } from '@mui/material/styles'; import Box, { BoxProps } from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import LaunchRounded from '@mui/icons-material/LaunchRounded'; import Slide from 'docs/src/components/animation/Slide'; import FadeDelay from 'docs/src/components/animation/FadeDelay'; const ratio = 900 / 494; // 'transparent' is interpreted as transparent black in Safari // See https://css-tricks.com/thing-know-gradients-transparent-black/ const transparent = 'rgba(255,255,255,0)'; const Image = styled('img')(({ theme }) => ({ display: 'block', width: 200, height: 200 / ratio, [theme.breakpoints.up('sm')]: { width: 300, height: 300 / ratio, }, [theme.breakpoints.up('md')]: { width: 450, height: 450 / ratio, }, border: '4px solid', borderColor: (theme.vars || theme).palette.grey[400], borderRadius: (theme.vars || theme).shape.borderRadius, objectFit: 'cover', objectPosition: 'top', boxShadow: '0px 4px 20px rgba(61, 71, 82, 0.25)', ...theme.applyDarkStyles({ borderColor: (theme.vars || theme).palette.grey[800], boxShadow: '0px 4px 20px rgba(0, 0, 0, 0.6)', }), })); const Anchor = styled('a')({ display: 'inline-block', position: 'relative', transition: '0.3s', '&:hover, &:focus': { '& > div': { opacity: 1, }, }, }); const linkMapping = { minimal: 'https://mui.com/store/items/minimal-dashboard/', theFront: 'https://mui.com/store/items/the-front-landing-page/', miro: 'https://mui.com/store/items/mira-pro-react-material-admin-dashboard/', devias: 'https://mui.com/store/items/devias-kit-pro/', berry: 'https://mui.com/store/items/berry-react-material-admin/', webbee: 'https://mui.com/store/items/webbee-landing-page/', }; const brands = Object.keys(linkMapping) as Array<keyof typeof linkMapping>; type TemplateBrand = (typeof brands)[number]; const StoreTemplateLink = React.forwardRef< HTMLAnchorElement, React.PropsWithChildren<{ brand: TemplateBrand; }> >(function StoreTemplateLink({ brand, ...props }, ref) { return ( <Anchor ref={ref} aria-label="Go to MUI Store" href={`${linkMapping[brand]}?utm_source=marketing&utm_medium=referral&utm_campaign=home-cta`} target="_blank" {...props} > {props.children} <Box sx={{ transition: '0.3s', borderRadius: 1, position: 'absolute', width: '100%', height: '100%', opacity: 0, top: 0, left: 0, bgcolor: (theme) => alpha(theme.palette.primaryDark[500], 0.8), color: '#fff', display: 'flex', alignItems: 'center', justifyContent: 'center', }} > <Typography fontWeight="bold">Go to store</Typography> <LaunchRounded fontSize="small" sx={{ ml: 1 }} /> </Box> </Anchor> ); }); const StoreTemplateImage = React.forwardRef< HTMLImageElement, { brand: TemplateBrand } & Omit<JSX.IntrinsicElements['img'], 'ref'> >(function StoreTemplateImage({ brand, ...props }, ref) { return ( <Image ref={ref} src={`/static/branding/store-templates/template-${ Object.keys(linkMapping).indexOf(brand) + 1 }light.jpg`} alt="" loading="lazy" sx={(theme) => theme.applyDarkStyles({ content: `url(/static/branding/store-templates/template-${ Object.keys(linkMapping).indexOf(brand) + 1 }dark.jpg)`, }) } {...props} /> ); }); export function PrefetchStoreTemplateImages() { function makeImg(mode: string, num: number) { return { loading: 'lazy' as const, width: '900', height: '494', src: `/static/branding/store-templates/template-${num}${mode}.jpg`, }; } return ( <Box sx={{ width: 0, height: 0, position: 'fixed', zIndex: -1, top: -1000, '& > img': { position: 'absolute', }, }} > {[...Array(6)].map((_, index) => ( <React.Fragment key={index}> <img alt="" {...makeImg('light', index + 1)} /> <img alt="" {...makeImg('dark', index + 1)} /> </React.Fragment> ))} </Box> ); } const defaultSlideDown = { '0%': { transform: 'translateY(-300px)', }, '100%': { transform: 'translateY(-60px)', }, }; export function StoreTemplatesSet1({ keyframes = defaultSlideDown, disableLink, ...props }: { disableLink?: boolean; keyframes?: Record<string, object> } & BoxProps) { function renderTemplate(brand: TemplateBrand) { if (disableLink) { return <StoreTemplateImage brand={brand} />; } return ( <StoreTemplateLink brand={brand}> <StoreTemplateImage brand={brand} /> </StoreTemplateLink> ); } return ( <Slide animationName="template-slidedown" {...props} keyframes={keyframes}> <FadeDelay delay={400}>{renderTemplate(brands[4])}</FadeDelay> <FadeDelay delay={200}>{renderTemplate(brands[2])}</FadeDelay> <FadeDelay delay={0}>{renderTemplate(brands[0])}</FadeDelay> </Slide> ); } const defaultSlideUp = { '0%': { transform: 'translateY(150px)', }, '100%': { transform: 'translateY(-20px)', }, }; export function StoreTemplatesSet2({ keyframes = defaultSlideUp, disableLink, ...props }: { disableLink?: boolean; keyframes?: Record<string, object> } & BoxProps) { function renderTemplate(brand: TemplateBrand) { if (disableLink) { return <StoreTemplateImage brand={brand} />; } return ( <StoreTemplateLink brand={brand}> <StoreTemplateImage brand={brand} /> </StoreTemplateLink> ); } return ( <Slide animationName="template-slidedup" {...props} keyframes={keyframes}> <FadeDelay delay={100}>{renderTemplate(brands[1])}</FadeDelay> <FadeDelay delay={300}>{renderTemplate(brands[3])}</FadeDelay> <FadeDelay delay={500}>{renderTemplate(brands[5])}</FadeDelay> </Slide> ); } export default function StoreTemplatesBanner() { return ( <Box sx={{ mx: { xs: -2, sm: -3, md: 0 }, my: { md: -18 }, height: { xs: 300, sm: 360, md: 'calc(100% + 320px)' }, overflow: 'hidden', position: 'relative', width: { xs: '100vw', md: '50vw' }, }} > <Box sx={(theme) => ({ display: { xs: 'block', md: 'none' }, position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', pointerEvents: 'none', zIndex: 2, ...theme.applyDarkStyles({ background: `linear-gradient(to bottom, ${ (theme.vars || theme).palette.primaryDark[900] } 0%, ${alpha(theme.palette.primaryDark[900], 0)} 30%, ${alpha( theme.palette.primaryDark[900], 0, )} 70%, ${(theme.vars || theme).palette.primaryDark[900]} 100%)`, }), })} /> <Box sx={{ // need perspective on this wrapper to work in Safari height: '100%', position: 'relative', perspective: '1000px', }} > <Box sx={{ left: { xs: '45%', md: '40%' }, position: 'absolute', zIndex: -1, display: 'flex', transform: 'translateX(-40%) rotateZ(-30deg) rotateX(8deg) rotateY(8deg)', transformOrigin: 'center center', }} > <StoreTemplatesSet1 /> <StoreTemplatesSet2 sx={{ ml: { xs: 2, sm: 4, md: 8 } }} /> </Box> </Box> <Box sx={(theme) => ({ display: { xs: 'none', md: 'block' }, position: 'absolute', top: 0, left: 0, width: 400, height: '150%', pointerEvents: 'none', zIndex: 10, background: `linear-gradient(to right, ${ (theme.vars || theme).palette.primary[50] }, ${transparent})`, ...theme.applyDarkStyles({ background: `linear-gradient(to right, ${ (theme.vars || theme).palette.primaryDark[900] }, ${alpha(theme.palette.primary[900], 0)})`, }), })} /> </Box> ); }
5,158
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/Testimonials.tsx
import * as React from 'react'; import dynamic from 'next/dynamic'; import { useInView } from 'react-intersection-observer'; import Box from '@mui/material/Box'; import Container from '@mui/material/Container'; import Grid from '@mui/material/Grid'; import { alpha } from '@mui/material/styles'; import MuiStatistics from 'docs/src/components/home/MuiStatistics'; const UserFeedbacks = dynamic(() => import('./UserFeedbacks')); function Testimonials() { const { ref, inView } = useInView({ triggerOnce: true, threshold: 0, rootMargin: '500px', }); return ( <Box data-mui-color-scheme="dark" ref={ref} sx={(theme) => ({ background: `linear-gradient(180deg, ${ (theme.vars || theme).palette.primaryDark[900] } 2%, ${alpha(theme.palette.primaryDark[700], 0.5)} 80%), ${(theme.vars || theme).palette.primaryDark[900]} `, })} > <Container sx={{ py: { xs: 8, md: 12 } }}> <Grid container spacing={3} alignItems="center"> <Grid item xs={12} md={6} sx={{ zIndex: 1, minHeight: { xs: 400, sm: 307, lg: 355 } }}> {inView && <UserFeedbacks />} </Grid> <MuiStatistics /> </Grid> </Container> </Box> ); } export default Testimonials;
5,159
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/UserFeedbacks.tsx
import * as React from 'react'; import { alpha } from '@mui/material/styles'; import SwipeableViews from 'react-swipeable-views'; import Avatar from '@mui/material/Avatar'; import ButtonBase from '@mui/material/ButtonBase'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import ArrowButton from 'docs/src/components/action/ArrowButton'; function Feedback({ quote, profile, }: { quote: string; profile: { avatarSrc: string; avatarSrcSet: string; name: string; role: string; company?: React.ReactElement; }; }) { return ( <Box sx={{ color: '#fff' }}> <Typography variant="body1" fontWeight="medium" component="div" sx={{ mb: 2.5 }}> {quote} </Typography> <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}> <Box sx={(theme) => ({ p: 0.5, border: '1px solid', borderColor: 'primary.800', bgcolor: alpha(theme.palette.primary[900], 0.5), borderRadius: 99, })} > <Avatar srcSet={profile.avatarSrcSet} src={profile.avatarSrc} alt={`${profile.name}'s profile picture`} imgProps={{ loading: 'lazy' }} sx={{ width: 52, height: 52, }} /> </Box> <div> <Typography fontWeight="semiBold" color="text.primary"> {profile.name} </Typography> <Typography variant="body2" color="text.secondary"> {profile.role} </Typography> </div> <Box sx={{ ml: 'auto' }}>{profile.company}</Box> </Box> </Box> ); } const TESTIMONIALS = [ { quote: '"Material UI looks great and lets us deliver fast, thanks to their solid API design and documentation - it\'s refreshing to use a component library where you get everything you need from their site rather than Stack Overflow. We think the upcoming version, with extra themes and customizability, will make Material UI even more of a game changer. We\'re extremely grateful to the team for the time and effort spent maintaining the project."', profile: { avatarSrc: 'https://avatars.githubusercontent.com/u/197016?s=58', avatarSrcSet: 'https://avatars.githubusercontent.com/u/197016?s=116 2x', name: 'Jean-Laurent de Morlhon', role: 'VP of Engineering', company: ( <img src="/static/branding/companies/docker-blue.svg" width="81" height="21" alt="Docker logo" loading="lazy" /> ), }, }, { quote: '"Material UI offers a wide variety of high quality components that have allowed us to ship features faster. It has been used by more than a hundred engineers in our organization. What\'s more, Material UI\'s well architected customization system has allowed us to differentiate ourselves in the marketplace."', profile: { avatarSrc: 'https://avatars.githubusercontent.com/u/28296253?s=58', avatarSrcSet: 'https://avatars.githubusercontent.com/u/28296253?s=116 2x', name: 'Joona Rahko', role: 'Staff Software Engineer', company: ( <img src="/static/branding/companies/unity-blue.svg" width="56" height="21" alt="Unity logo" loading="lazy" /> ), }, }, { quote: '"After much research on React component libraries, we decided to ditch our in-house library for Material UI, using its powerful customization system to implement our Design System. This simple move did a rare thing in engineering: it lowered our maintenance costs while enhancing both developer and customer experience. All of this was done without sacrificing the organization\'s branding and visual identity."', profile: { avatarSrc: 'https://avatars.githubusercontent.com/u/732422?s=58', avatarSrcSet: 'https://avatars.githubusercontent.com/u/732422?s=116 2x', name: 'Gustavo de Paula', role: 'Specialist Software Engineer', company: ( <img src="/static/branding/companies/loggi-blue.svg" width="61" height="20" alt="Loggi logo" loading="lazy" /> ), }, }, ]; export default function UserFeedbacks() { const [slideIndex, setSlideIndex] = React.useState(0); return ( <Box sx={{ maxWidth: { md: 500 } }}> <Box sx={{ display: 'flex', justifyContent: 'space-between', mb: 2 }}> <ArrowButton direction="left" disabled={slideIndex === 0} onClick={() => setSlideIndex((i) => i - 1)} /> <ArrowButton direction="right" disabled={slideIndex === TESTIMONIALS.length - 1} onClick={() => setSlideIndex((i) => i + 1)} sx={{ mr: 'auto' }} /> <Box sx={{ alignSelf: 'center' }}> {TESTIMONIALS.map((item, index) => ( <ButtonBase key={index} aria-label={`Testimonial from ${item.profile.name}`} onClick={() => setSlideIndex(index)} sx={{ display: 'inline-block', width: 16, height: 16, borderRadius: '50%', p: '4px', ml: index !== 0 ? '2px' : 0, '&:focus': { boxShadow: (theme) => `0px 0px 0px 2px ${theme.palette.primaryDark[400]}`, }, }} > <Box sx={{ height: '100%', borderRadius: 1, bgcolor: 'primaryDark.500', ...(index === slideIndex && { bgcolor: 'primaryDark.300', }), }} /> </ButtonBase> ))} </Box> </Box> <SwipeableViews index={slideIndex} onChangeIndex={(index) => setSlideIndex(index)}> {TESTIMONIALS.map((item) => ( <Feedback key={item.profile.name} {...item} /> ))} </SwipeableViews> </Box> ); }
5,160
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/ValueProposition.tsx
import * as React from 'react'; import Typography from '@mui/material/Typography'; import Grid from '@mui/material/Grid'; import InvertColorsRoundedIcon from '@mui/icons-material/InvertColorsRounded'; import HandymanRoundedIcon from '@mui/icons-material/HandymanRounded'; import ArticleRoundedIcon from '@mui/icons-material/ArticleRounded'; import AccessibilityNewRounded from '@mui/icons-material/AccessibilityNewRounded'; import GradientText from 'docs/src/components/typography/GradientText'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import InfoCard from 'docs/src/components/action/InfoCard'; const content = [ { icon: <InvertColorsRoundedIcon fontSize="small" color="primary" />, title: 'Timeless aesthetics', description: "Build beautiful UIs with ease. Start with Google's Material Design, or create your own sophisticated theme.", }, { icon: <HandymanRoundedIcon fontSize="small" color="primary" />, title: 'Intuitive customization', description: 'Our components are as flexible as they are powerful. You always have full control over how they look and behave.', }, { icon: <ArticleRoundedIcon fontSize="small" color="primary" />, title: 'Unrivaled documentation', description: 'The answer to your problem can be found in our documentation. How can we be so sure? Because our docs boast over 2,000 contributors.', }, { icon: <AccessibilityNewRounded fontSize="small" color="primary" />, title: 'Dedicated to accessibility', description: "We believe in building for everyone. That's why accessibility is one of our highest priorities with every new feature we ship.", }, ]; function ValueProposition() { return ( <Section> <SectionHeadline overline="Why build with MUI?" title={ <Typography variant="h2" sx={{ mt: 1, mb: { xs: 2, sm: 4 } }}> A <GradientText>delightful experience</GradientText> <br /> for you and your users </Typography> } /> <Grid container spacing={3}> {content.map(({ icon, title, description }) => ( <Grid key={title} item xs={12} sm={3}> <InfoCard title={title} icon={icon} description={description} /> </Grid> ))} </Grid> </Section> ); } export default ValueProposition;
5,161
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/home/XGridGlobalStyles.tsx
import * as React from 'react'; import { CSSObject, Keyframes } from '@emotion/react'; import { alpha } from '@mui/material/styles'; import GlobalStyles from '@mui/material/GlobalStyles'; export default function XGridGlobalStyles({ selector = 'body', pro = false, }: { selector?: string; pro?: boolean; }) { return ( <GlobalStyles styles={(theme) => [ { [selector]: { '& .MuiDataGrid-root': { border: 'none', fontSize: '0.75rem', borderRadius: '0px', // toolbar // style GridToolbar '& .MuiDataGrid-toolbarContainer': { flexShrink: 0, padding: theme.spacing(1, 1, 0.5, 1), '& > button': { flexShrink: 0, border: '1px solid', padding: theme.spacing(0, 1), borderColor: (theme.vars || theme).palette.grey[200], '& svg': { fontSize: '1.125rem', }, }, '& > button:not(:last-of-type)': { marginRight: theme.spacing(0.5), }, }, '& .MuiCheckbox-root': { color: (theme.vars || theme).palette.grey[600], padding: theme.spacing(0.5), '& > svg': { fontSize: '1.2rem', }, }, '& .MuiIconButton-root:not(.Mui-disabled)': { color: (theme.vars || theme).palette.primary.main, opacity: 1, }, // table head elements '& .MuiDataGrid-menuIcon svg': { fontSize: '1rem', }, '& .MuiDataGrid-columnHeaders': { borderColor: (theme.vars || theme).palette.grey[200], }, '& .MuiDataGrid-columnSeparator': { color: (theme.vars || theme).palette.grey[200], '&:hover': { color: (theme.vars || theme).palette.grey[800], }, ...(!pro && { display: 'none' }), }, // ------------------------------- // table body elements '& .MuiDataGrid-virtualScroller': { backgroundColor: (theme.vars || theme).palette.grey[50], }, '& .MuiDataGrid-cell': { borderBottom: '1px solid', borderColor: (theme.vars || theme).palette.grey[200], }, '& .MuiDataGrid-editInputCell': { fontSize: '0.75rem', '& > input': { padding: theme.spacing(0, 1), }, }, '& .MuiDataGrid-cell--editing': { '& .MuiSelect-root': { '& .MuiListItemIcon-root': { display: 'none', }, '& .MuiTypography-root': { fontSize: '0.75rem', }, }, }, '& .MuiTablePagination-root': { marginRight: theme.spacing(1), '& .MuiIconButton-root': { '&:not([disabled])': { color: (theme.vars || theme).palette.primary.main, borderColor: (theme.vars || theme).palette.grey[400], }, borderRadius: (theme.vars || theme).shape.borderRadius, padding: theme.spacing(0.5), border: '1px solid', borderColor: (theme.vars || theme).palette.grey[200], '&:last-of-type': { marginLeft: theme.spacing(1), }, '& > svg': { fontSize: '1rem', }, }, }, }, '& .MuiDataGrid-gridMenuList': { boxShadow: '0px 4px 20px rgb(61 71 82 / 25%)', borderRadius: '10px', '& .MuiMenuItem-root': { fontSize: '0.75rem', }, }, }, }, theme.applyDarkStyles({ [selector]: { '& .MuiDataGrid-root': { '& .MuiDataGrid-toolbarContainer': { '& > button': { borderColor: (theme.vars || theme).palette.primaryDark[600], }, }, '& .MuiCheckbox-root': { color: (theme.vars || theme).palette.primary[300], }, '& .MuiIconButton-root:not(.Mui-disabled)': { color: (theme.vars || theme).palette.primary[300], }, '& .MuiDataGrid-columnHeaders': { borderColor: (theme.vars || theme).palette.primaryDark[500], }, '& .MuiDataGrid-columnSeparator': { color: (theme.vars || theme).palette.primaryDark[400], '&:hover': { color: (theme.vars || theme).palette.primaryDark[100], }, }, // ------------------------------- // table body elements '& .MuiDataGrid-virtualScroller': { backgroundColor: (theme.vars || theme).palette.primaryDark[900], }, '& .MuiDataGrid-cell': { borderColor: alpha(theme.palette.primaryDark[500], 0.5), }, '& .MuiTablePagination-root': { '& .MuiIconButton-root': { '&:not([disabled])': { color: (theme.vars || theme).palette.primaryDark[100], borderColor: (theme.vars || theme).palette.primaryDark[400], }, borderColor: (theme.vars || theme).palette.primaryDark[600], }, }, }, }, }) as CSSObject | Keyframes, ]} /> ); }
5,162
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/icon/IconImage.tsx
import * as React from 'react'; import { useTheme, styled, Theme } from '@mui/material/styles'; import Box from '@mui/material/Box'; import { SxProps } from '@mui/system'; export type IconImageProps = { name: | 'product-core' | 'product-advanced' | 'product-toolpad' | 'product-templates' | 'product-designkits' | 'pricing/x-plan-pro' | 'pricing/x-plan-premium' | 'pricing/x-plan-community' | 'pricing/yes' | 'pricing/no' | 'pricing/time' | 'companies/spotify' | 'companies/amazon' | 'companies/nasa' | 'companies/netflix' | 'companies/unity' | 'companies/shutterstock' | 'companies/southwest' | 'companies/boeing' | 'companies/siemens' | 'companies/deloitte' | 'companies/apple' | 'companies/twitter' | 'companies/salesforce' | 'companies/verizon' | 'companies/atandt' | 'companies/patreon' | 'companies/ebay' | 'companies/samsung' | 'companies/volvo' | string; height?: number; mode?: '' | 'light' | 'dark'; sx?: SxProps<Theme>; width?: number; } & Omit<JSX.IntrinsicElements['img'], 'ref'>; const Img = styled('img')({ display: 'inline-block', verticalAlign: 'bottom' }); let neverHydrated = true; export default function IconImage(props: IconImageProps) { const { height: heightProp, name, width: widthProp, mode: modeProp, ...other } = props; const theme = useTheme(); const [firstRender, setFirstRender] = React.useState(true); React.useEffect(() => { setFirstRender(false); neverHydrated = false; }, []); let defaultWidth; let defaultHeight; const mode = modeProp ?? (theme.palette.mode as any); if (name.startsWith('product-')) { defaultWidth = 36; defaultHeight = 36; } else if (name.startsWith('pricing/x-plan-')) { defaultWidth = 13; defaultHeight = 15; } else if (['pricing/yes', 'pricing/no', 'pricing/time'].indexOf(name) !== -1) { defaultWidth = 18; defaultHeight = 18; } const width = widthProp ?? defaultWidth; const height = heightProp ?? defaultHeight; // First time render with a theme depend image if (firstRender && neverHydrated && mode !== '') { if (other.loading === 'eager') { return ( <React.Fragment> <Img className="only-light-mode-v2" src={`/static/branding/${name}-light.svg`} alt="" width={width} height={height} {...other} loading="lazy" /> <Img className="only-dark-mode-v2" src={`/static/branding/${name}-dark.svg`} alt="" width={width} height={height} {...other} loading="lazy" /> </React.Fragment> ); } // Prevent hydration mismatch between the light and dark mode image source. return <Box component="span" sx={{ width, height, display: 'inline-block' }} />; } return ( <Img src={`/static/branding/${name}${mode ? `-${mode}` : ''}.svg`} alt="" loading="lazy" width={width} height={height} {...other} /> ); }
5,163
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/markdown/MarkdownElement.tsx
import * as React from 'react'; import clsx from 'clsx'; import { // alpha, // darken, styled, } from '@mui/material/styles'; const Root = styled('div')(({ theme }) => ({ ...theme.typography.caption, color: (theme.vars || theme).palette.text.primary, '& pre': { backgroundColor: '#0F1924', // a special, one-off, color tailored for the code blocks using MUI's branding theme blue palette as the starting point. It has a less saturaded color but still maintaining a bit of the blue tint. color: '#f8f8f2', // fallback color until Prism's theme is loaded overflow: 'auto', margin: 0, WebkitOverflowScrolling: 'touch', // iOS momentum scrolling. maxWidth: 'calc(100vw - 32px)', [theme.breakpoints.up('md')]: { maxWidth: 'calc(100vw - 32px - 16px)', }, }, '& code': { // Avoid layout jump after hydration (style injected by prism) ...theme.typography.caption, fontFamily: theme.typography.fontFamilyCode, fontWeight: 400, WebkitFontSmoothing: 'subpixel-antialiased', // Reset for Safari // https://github.com/necolas/normalize.css/blob/master/normalize.css#L102 fontSize: '1em', }, })); type MarkdownElementProps = { renderedMarkdown: string; } & Omit<JSX.IntrinsicElements['div'], 'ref'>; const MarkdownElement = React.forwardRef<HTMLDivElement, MarkdownElementProps>( function MarkdownElement(props, ref) { const { className, renderedMarkdown, ...other } = props; const more: Record<string, unknown> = {}; if (typeof renderedMarkdown === 'string') { // workaround for https://github.com/facebook/react/issues/17170 // otherwise we could just set `dangerouslySetInnerHTML={undefined}` more.dangerouslySetInnerHTML = { __html: renderedMarkdown }; } return <Root className={clsx('markdown-body', className)} {...more} {...other} ref={ref} />; }, ); export default MarkdownElement;
5,164
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/pricing/EarlyBird.tsx
import * as React from 'react'; import Container from '@mui/material/Container'; import Typography from '@mui/material/Typography'; import Stack from '@mui/material/Stack'; import Button from '@mui/material/Button'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import { alpha } from '@mui/material/styles'; import Link from 'docs/src/modules/components/Link'; export default function EarlyBird() { return ( <Container sx={{ pt: 2, pb: { xs: 2, sm: 4, md: 8 }, scrollMarginTop: 'calc(var(--MuiDocs-header-height) + 32px)', }} id="early-bird" > <Stack sx={(theme) => ({ borderRadius: 1, px: 2, py: 3, background: `linear-gradient(180deg, ${alpha(theme.palette.primary[50], 0.2)} 50%, ${(theme.vars || theme).palette.primary[50]} 100%) `, border: '1px solid', borderColor: 'grey.100', display: 'flex', flexDirection: { xs: 'column', sm: 'row', }, justifyContent: 'space-between', alignItems: { xs: 'flex-start', sm: 'center', }, ...theme.applyDarkStyles({ background: `linear-gradient(180deg, ${alpha(theme.palette.primary[900], 0.4)} 50%, ${alpha(theme.palette.primary[800], 0.6)} 100%) `, borderColor: 'primaryDark.600', }), })} > <div> <Typography fontWeight="bold" sx={{ mb: 0.5 }}> 🐦&nbsp;&nbsp;Early bird special! </Typography> <Typography variant="body2" color="text.secondary" sx={{ maxWidth: 700 }}> Buy now at a reduced price (~25% off), and get early access to MUI X Premium, with the added opportunity to influence its development. The early bird special is available for a limited time, so don&apos;t miss this opportunity! </Typography> </div> <Button component={Link} noLinkStyle href="https://mui.com/store/items/mui-x-premium/" variant="contained" fullWidth endIcon={<KeyboardArrowRightRounded />} sx={{ py: 1, flexShrink: 0, ml: { xs: 0, sm: 2 }, mt: { xs: 3, sm: 0 }, width: { xs: '100%', sm: '50%', md: 'fit-content' }, }} > Buy now </Button> </Stack> </Container> ); }
5,165
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/pricing/HeroPricing.tsx
import * as React from 'react'; import Typography from '@mui/material/Typography'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import GradientText from 'docs/src/components/typography/GradientText'; export default function HeroPricing() { return ( <Section cozy> <SectionHeadline alwaysCenter overline="Pricing" title={ <Typography variant="h2" component="h1"> Start using MUI&apos;s products <GradientText>for free!</GradientText> </Typography> } description="Switch to a commercial plan to access advanced features & technical support." /> </Section> ); }
5,166
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/pricing/LicensingModelContext.tsx
import * as React from 'react'; const LicenseModel = React.createContext<any>({}); if (process.env.NODE_ENV !== 'production') { LicenseModel.displayName = 'LicenseModel'; } export function LicensingModelProvider(props: any) { const [licensingModel, setLicensingModel] = React.useState<string>('annual'); const value = React.useMemo( () => ({ licensingModel, setLicensingModel }), [licensingModel, setLicensingModel], ); return <LicenseModel.Provider value={value}>{props.children}</LicenseModel.Provider>; } export function useLicensingModel() { return React.useContext(LicenseModel); }
5,167
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/pricing/LicensingModelSwitch.tsx
import * as React from 'react'; import { styled, alpha } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Tooltip from '@mui/material/Tooltip'; import Tabs from '@mui/material/Tabs'; import Tab from '@mui/material/Tab'; import { useLicensingModel } from 'docs/src/components/pricing/LicensingModelContext'; const StyledTabs = styled(Tabs)(({ theme }) => ({ margin: '14px auto 4px', padding: 2, maxWidth: 170, minHeight: 0, overflow: 'visible', borderRadius: 20, border: '1px solid', borderColor: (theme.vars || theme).palette.grey[100], backgroundColor: (theme.vars || theme).palette.grey[50], '&:has(.Mui-focusVisible)': { outline: `2px solid ${(theme.vars || theme).palette.primary.main}`, }, '& .MuiTabs-scroller, & .MuiTab-root': { // Override inline-style to see the box-shadow overflow: 'visible!important', }, '& span': { zIndex: 1, }, '& .MuiTab-root': { padding: '4px 8px', fontSize: theme.typography.pxToRem(13), fontWeight: theme.typography.fontWeightSemiBold, minWidth: 0, minHeight: 0, color: (theme.vars || theme).palette.grey[600], borderRadius: 20, '&:hover': { color: (theme.vars || theme).palette.grey[800], }, '&.Mui-selected': { color: (theme.vars || theme).palette.primary[500], fontWeight: theme.typography.fontWeightSemiBold, }, }, '& .MuiTabs-indicator': { backgroundColor: '#FFF', border: '1px solid', borderColor: (theme.vars || theme).palette.grey[200], height: '100%', borderRadius: 20, zIndex: 0, boxShadow: `0px 1px 2px ${(theme.vars || theme).palette.grey[200]}`, }, ...theme.applyDarkStyles({ borderColor: (theme.vars || theme).palette.primaryDark[700], backgroundColor: (theme.vars || theme).palette.primaryDark[900], color: (theme.vars || theme).palette.grey[400], '& .MuiTabs-indicator': { height: '100%', borderRadius: 20, backgroundColor: alpha(theme.palette.primaryDark[600], 0.5), borderColor: (theme.vars || theme).palette.primaryDark[500], boxShadow: `0px 1px 4px ${(theme.vars || theme).palette.common.black}`, }, '& .MuiTab-root': { color: (theme.vars || theme).palette.grey[400], '&:hover': { color: (theme.vars || theme).palette.grey[300], }, '&.Mui-selected': { color: (theme.vars || theme).palette.primary[200], }, }, }), })); const perpetualDescription = 'One-time purchase to use the current released versions forever. 12 months of updates included.'; const annualDescription = 'Upon expiration, your permission to use the Software in development ends. The license is perpetual in production.'; const tooltipProps = { enterDelay: 400, enterNextDelay: 50, enterTouchDelay: 500, placement: 'top' as 'top', describeChild: true, slotProps: { tooltip: { sx: { fontSize: 12, }, }, }, }; export default function LicensingModelSwitch() { const { licensingModel, setLicensingModel } = useLicensingModel(); const handleChange = (event: React.SyntheticEvent, newValue: number) => { setLicensingModel(newValue); }; return ( <Box sx={{ display: 'flex' }}> <StyledTabs aria-label="licensing model" selectionFollowsFocus value={licensingModel} onChange={handleChange} > <Tab disableFocusRipple value="perpetual" label={ <Tooltip title={perpetualDescription} {...tooltipProps}> <span>Perpetual</span> </Tooltip> } /> <Tab disableFocusRipple value="annual" label={ <Tooltip title={annualDescription} {...tooltipProps}> <span>Annual</span> </Tooltip> } /> </StyledTabs> </Box> ); }
5,168
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/pricing/PricingFAQ.tsx
/* eslint-disable react/no-unescaped-entities */ import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Grid'; import Link from '@mui/material/Link'; import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import MuiAccordion from '@mui/material/Accordion'; import MuiAccordionSummary from '@mui/material/AccordionSummary'; import MuiAccordionDetail from '@mui/material/AccordionDetails'; import KeyboardArrowDownRounded from '@mui/icons-material/KeyboardArrowDownRounded'; import Section from 'docs/src/layouts/Section'; const faqData = [ { summary: 'How do I know if I need to buy a license?', detail: ( <React.Fragment> If you are in doubt, check the license file of the npm package you're installing. For instance <Link href="https://unpkg.com/@mui/x-data-grid/LICENSE">@mui/x-data-grid</Link> is an MIT License (free) while{' '} <Link href="https://unpkg.com/@mui/x-data-grid-pro/LICENSE">@mui/x-data-grid-pro</Link> is a Commercial License. </React.Fragment> ), }, { summary: 'How many developer licenses do I need?', detail: ( <React.Fragment> The number of licenses purchased must correspond to the number of concurrent developers contributing changes to the front-end code of projects that use MUI X Pro or Premium. <br /> <br /> <b>Example 1.</b> Company 'A' is developing an application named 'AppA'. The app needs to render 10k rows of data in a table and allow users to group, filter, and sort. The dev team adds MUI X Pro to the project to satisfy this requirement. 5 front-end and 10 back-end developers are working on 'AppA'. Only 1 developer is tasked with configuring and modifying the data grid. Only the front-end developers are contributing code to the front-end so Company 'A' purchases 5 licenses. <br /> <br /> <b>Example 2.</b> A UI development team at Company 'A' creates its own UI library for internal development and includes MUI X Pro as a component. The team working on 'AppA' uses the new library and so does the team working on 'AppB'. 'AppA' has 5 front-end developers and 'AppB' has 3. There are 2 front-end developers on the UI development team. Company 'B' purchases 10 licenses. <br /> <br /> <Link target="_blank" rel="noopener" href="https://mui.com/legal/mui-x-eula/#required-quantity-of-licenses" > The clause in the EULA. </Link> </React.Fragment> ), }, { summary: 'Am I allowed to use the product after the update entitlement expires?', detail: ( <React.Fragment> <strong>Yes.</strong> You can continue to use the product in production environments after the entitlement expires. But you will need to keep your subscription active to continue development, update for new features, or gain access to technical support. <br /> <br /> To renew your license, please <Link href="mailto:[email protected]">contact sales</Link>. </React.Fragment> ), }, { summary: 'How to remove the "unlicensed" watermark?', detail: ( <React.Fragment> After you purchase a license, you'll receive a license key by email. Once you have the license key, you need to follow the{' '} <Link href="/x/introduction/licensing/#license-key-installation">instructions</Link>{' '} necessary to set it up. </React.Fragment> ), }, { summary: 'Why are you calling it "early access"?', detail: ( <React.Fragment> We think you'll love the features we've built so far, but we're planning to release more. We opened it up as soon as we had something useful so that you can start getting value from it right away, and we'll be adding new features and components based on our own ideas, and on suggestions from early access customers. </React.Fragment> ), }, { summary: 'Do developers have to be named?', detail: ( <React.Fragment> <strong>No.</strong> We trust that you will not go over the number of licensed developers. Developers moving on and off projects is expected occasionally, and the license can be transferred between developers at that time. </React.Fragment> ), }, { summary: 'What is the policy on redistributing the software?', detail: ( <React.Fragment> The commerial licenses are royalty-free. The licensed entity can use the components without a sublicense in: <ul> <li>Solutions for internal company use</li> <li>Hosted applications</li> <li>Commercial solutions deployed for end-users</li> </ul> Based on the{' '} <Link target="_blank" rel="noopener" href="https://mui.com/legal/mui-x-eula/#deployment"> 'Deployment' section of the EULA </Link> , you can sublicense the software if it's made part of a larger work. The new licenses must be in writing and substantially the same as these EULA. <br /> <br /> <b>Example 1.</b> Agency 'A' is building two applications for companies 'B' and 'C'. Agency 'A' purchases four licenses for four developers. They build the applications and sublicense the software to companies 'B' and 'C' without any extra fee. Company 'B' can deploy the application built by the agency without modifying the sources. Company 'C' decides to continue working on the application. They purchase one license per developer working on the front end of the application. <br /> <br /> There are only two limitations that require additional discussion with our sales team: <ul> <li> A product that exposes the components in a form that allows for using them to build applications, for example, in a CMS or a design-builder. </li> <li> Modules/components that DO NOT add significant primary functionality. Example: a theme for a set of components that is sold as a separate product and includes the XGrid components. In such cases, we offer reseller arrangements so that everyone has an incentive to enter into a relationship. </li> </ul> If your desired use falls under any of the three categories listed above, please{' '} <Link href="mailto:[email protected]">contact sales</Link>. We will be happy to discuss your needs and see what we can do to accommodate your case. </React.Fragment> ), }, { summary: 'Do you offer discounts to educational and non-profit organizations?', detail: ( <React.Fragment> Yes, we offer a 50% discount on all products licensed to students, instructors, non-profit, and charity entities. <br /> <br /> To qualify for this discount you need to send us a document clearly indicating that you are a member of the respective institution. An email from your official account which bears your signature is sufficient in most cases. <br /> <br /> For more information on how to qualify for a discount, please contact sales. </React.Fragment> ), }, { summary: 'Why must we license developers not using the software directly?', detail: ( <React.Fragment> Our pricing model requires all developers working on a project using MUI X Pro or Premium to be licensed. This is intended to make it easier for you and your team to know if the right number of developers are licensed. <br /> <br /> Our licensing model also requires developers indirectly using MUI X Pro or Premium (e.g. through a wrapper library) to be licensed. <br /> <br /> The price point per developer is adjusted to be lower than if only direct use needed a license.{' '} <Link target="_blank" rel="noopener" href="https://mui.com/legal/mui-x-eula/#required-quantity-of-licenses" > The relevant EULA clause. </Link> </React.Fragment> ), }, ]; const Accordion = styled(MuiAccordion)(({ theme }) => ({ padding: theme.spacing(2), transition: theme.transitions.create('box-shadow'), '&&': { borderRadius: theme.shape.borderRadius, }, '&:hover': { boxShadow: '1px 1px 20px 0 rgb(90 105 120 / 20%)', }, '&:not(:last-of-type)': { marginBottom: theme.spacing(2), }, '&:before': { display: 'none', }, '&:after': { display: 'none', }, })); const AccordionSummary = styled(MuiAccordionSummary)(({ theme }) => ({ padding: theme.spacing(2), margin: theme.spacing(-2), minHeight: 'auto', '&.Mui-expanded': { minHeight: 'auto', }, '& .MuiAccordionSummary-content': { margin: 0, paddingRight: theme.spacing(2), '&.Mui-expanded': { margin: 0, }, }, })); const AccordionDetails = styled(MuiAccordionDetail)(({ theme }) => ({ marginTop: theme.spacing(1), padding: 0, })); export default function PricingFAQ() { function renderItem(index: number) { const faq = faqData[index]; return ( <Accordion variant="outlined"> <AccordionSummary expandIcon={<KeyboardArrowDownRounded sx={{ fontSize: 20, color: 'primary.main' }} />} > <Typography variant="body2" fontWeight="bold" component="h3"> {faq.summary} </Typography> </AccordionSummary> <AccordionDetails> <Typography component="div" variant="body2" color="text.secondary" sx={{ '& ul': { pl: 2 } }} > {faq.detail} </Typography> </AccordionDetails> </Accordion> ); } return ( <Section cozy> <Typography id="faq" variant="h2" sx={{ mb: { xs: 2, sm: 4 } }}> Frequently asked questions </Typography> <Grid container spacing={2}> <Grid item xs={12} md={4}> {renderItem(0)} {renderItem(1)} {renderItem(2)} {renderItem(3)} </Grid> <Grid item xs={12} md={4}> {renderItem(4)} {renderItem(5)} {renderItem(6)} {renderItem(7)} </Grid> <Grid item xs={12} md={4}> <Paper variant="outlined" sx={(theme) => ({ p: 2, textAlign: 'center', borderStyle: 'dashed', borderColor: 'grey.300', bgcolor: 'white', ...theme.applyDarkStyles({ borderColor: 'primaryDark.400', bgcolor: 'primaryDark.800', }), })} > <Box sx={{ textAlign: 'left' }}> <Typography variant="body2" color="text.primary" fontWeight="bold" component="h3"> Got any questions unanswered or need help? </Typography> </Box> <Typography variant="body2" color="text.secondary" sx={{ my: 1, textAlign: 'left' }}> Email us at <Link href="mailto:[email protected]">[email protected]</Link> for sales-related questions. </Typography> <Typography variant="body2" color="text.secondary" sx={{ my: 1, textAlign: 'left' }}> For product-related problems, please open <Link href="https://github.com/mui/mui-x/issues/new/choose">a new GitHub issue</Link>. (If you need to share private information, you can{' '} <Link href="mailto:[email protected]">email</Link> us.) </Typography> </Paper> </Grid> </Grid> </Section> ); }
5,169
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/pricing/PricingList.tsx
import * as React from 'react'; import { useTheme } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Fade from '@mui/material/Fade'; import Paper, { PaperProps } from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import Tabs from '@mui/material/Tabs'; import Tab from '@mui/material/Tab'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import Link from 'docs/src/modules/components/Link'; import PricingTable, { PlanName, PlanPrice } from 'docs/src/components/pricing/PricingTable'; import { useLicensingModel } from 'docs/src/components/pricing/LicensingModelContext'; const Plan = React.forwardRef< HTMLDivElement, { plan: 'community' | 'pro' | 'premium'; benefits?: Array<string>; unavailable?: boolean; } & PaperProps >(function Plan({ plan, benefits, unavailable, sx, ...props }, ref) { const globalTheme = useTheme(); const mode = globalTheme.palette.mode; const { licensingModel } = useLicensingModel(); return ( <Paper ref={ref} variant="outlined" sx={{ p: 2, ...(unavailable && { '& .MuiTypography-root': { opacity: 0.5 } }), ...sx }} {...props} > <PlanName plan={plan} /> <Box {...(plan === 'community' && { my: 2 })} {...(plan === 'premium' && { mb: 2 })}> <PlanPrice plan={plan} /> </Box> {unavailable ? ( <Button variant="outlined" disabled fullWidth sx={{ py: 1, '&.Mui-disabled': { color: 'text.disabled' } }} > In progress! </Button> ) : ( <Button variant={plan.match(/(pro|premium)/) ? 'contained' : 'outlined'} fullWidth component={Link} noLinkStyle href={ { community: '/material-ui/getting-started/usage/', pro: licensingModel === 'annual' ? 'https://mui.com/store/items/mui-x-pro/' : 'https://mui.com/store/items/mui-x-pro-perpetual/', premium: licensingModel === 'annual' ? 'https://mui.com/store/items/mui-x-premium/' : 'https://mui.com/store/items/mui-x-premium-perpetual/', }[plan] } endIcon={<KeyboardArrowRightRounded />} sx={{ py: 1 }} > {plan.match(/(pro|premium)/) ? 'Buy now' : 'Get started'} </Button> )} {benefits && benefits.map((text) => ( <Box key={text} sx={{ display: 'flex', alignItems: 'center', mt: 2 }}> <img src={`/static/branding/pricing/yes-${mode}.svg`} alt="" /> <Typography variant="body2" color="text.secondary" fontWeight="extraBold" sx={{ ml: 1 }} > {text} </Typography> </Box> ))} </Paper> ); }); export default function PricingList() { const [planIndex, setPlanIndex] = React.useState(0); return ( <React.Fragment> <Tabs value={planIndex} variant="fullWidth" onChange={(event, value) => setPlanIndex(value)} sx={[ { mb: 2, position: 'sticky', top: 55, bgcolor: 'background.paper', zIndex: 1, mx: { xs: -2, sm: -3 }, borderTop: '1px solid', borderColor: 'divider', '& .MuiTab-root': { borderBottom: '1px solid', borderColor: 'divider', '&.Mui-selected': { bgcolor: 'grey.50', }, }, }, (theme) => theme.applyDarkStyles({ '& .MuiTab-root': { '&.Mui-selected': { bgcolor: 'primaryDark.700', }, }, }), ]} > <Tab label="Community" /> <Tab label="Pro" sx={{ borderWidth: '0 1px 0 1px', borderStyle: 'solid', borderColor: 'divider' }} /> <Tab label="Premium" /> </Tabs> {planIndex === 0 && ( <Fade in> <div> <Plan plan="community" /> <PricingTable columnHeaderHidden plans={['community']} /> </div> </Fade> )} {planIndex === 1 && ( <Fade in> <div> <Plan plan="pro" /> <PricingTable columnHeaderHidden plans={['pro']} /> </div> </Fade> )} {planIndex === 2 && ( <Fade in> <div> <Plan plan="premium" /> <PricingTable columnHeaderHidden plans={['premium']} /> </div> </Fade> )} </React.Fragment> ); }
5,170
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/pricing/PricingTable.tsx
import * as React from 'react'; import { alpha, styled } from '@mui/material/styles'; import Box, { BoxProps } from '@mui/material/Box'; import Button from '@mui/material/Button'; import Container from '@mui/material/Container'; import Collapse from '@mui/material/Collapse'; import Divider from '@mui/material/Divider'; import Typography from '@mui/material/Typography'; import Tooltip from '@mui/material/Tooltip'; import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'; import { useRouter } from 'next/router'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import LaunchRounded from '@mui/icons-material/LaunchRounded'; import UnfoldMoreRounded from '@mui/icons-material/UnfoldMoreRounded'; import Link from 'docs/src/modules/components/Link'; import IconImage from 'docs/src/components/icon/IconImage'; import LicensingModelSwitch from 'docs/src/components/pricing/LicensingModelSwitch'; import { useLicensingModel } from 'docs/src/components/pricing/LicensingModelContext'; const planInfo = { community: { iconName: 'pricing/x-plan-community', title: 'Community', description: 'Get started with the industry-standard React UI library, MIT-licensed.', }, pro: { iconName: 'pricing/x-plan-pro', title: 'Pro', description: 'Best for professional developers building enterprise or data-rich applications.', }, premium: { iconName: 'pricing/x-plan-premium', title: 'Premium', description: 'The most advanced features for data-rich applications, as well as the highest priority for support.', }, } as const; const formatter = new Intl.NumberFormat('en-US'); function formatCurrency(value: number) { return `$${formatter.format(value)}`; } export function PlanName({ plan, disableDescription = false, }: { plan: 'community' | 'pro' | 'premium'; disableDescription?: boolean; }) { const { title, iconName, description } = planInfo[plan]; return ( <React.Fragment> <Typography variant="body2" fontWeight="bold" sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', pr: 0.5 }} > <IconImage name={iconName} mode="" loading="eager" sx={{ mr: 1 }} /> {title} </Typography> {!disableDescription && ( <Typography variant="body2" color="text.secondary" sx={{ display: 'flex', textAlign: 'center', justifyContent: 'center', alignItems: 'baseline', mt: 1, minHeight: { md: 63 }, }} > {description} </Typography> )} </React.Fragment> ); } interface PlanPriceProps { plan: 'community' | 'pro' | 'premium'; } export function PlanPrice(props: PlanPriceProps) { const { plan } = props; const { licensingModel } = useLicensingModel(); const annual = licensingModel === 'annual'; const planPriceMinHeight = 64; if (plan === 'community') { return ( <React.Fragment> <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', mt: 1, mb: 4 }}> <Typography variant="h3" component="div" fontWeight="bold" color="success.600" sx={{ mt: 4.5 }} > $0 </Typography> </Box> <Typography variant="body2" color="text.secondary" textAlign="center"> Free forever! </Typography> </React.Fragment> ); } const monthlyDisplay = annual; const priceUnit = monthlyDisplay ? '/ month / dev' : '/ dev'; const getPriceExplanation = (displayedValue: number) => { if (!annual) { return `$${displayedValue}/dev billed once.`; } return monthlyDisplay ? `Billed annually at $${displayedValue}/dev.` : `$${displayedValue}/dev/month billed annualy.`; }; if (plan === 'pro') { const monthlyValue = annual ? 15 : 15 * 3; const annualValue = monthlyValue * 12; const mainDisplayValue = monthlyDisplay ? monthlyValue : annualValue; const priceExplanation = getPriceExplanation(monthlyDisplay ? annualValue : monthlyValue); return ( <React.Fragment> <LicensingModelSwitch /> <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', mt: 1, mb: 4 }}> <Typography variant="h3" component="div" fontWeight="bold" color="primary.main"> {formatCurrency(mainDisplayValue)} </Typography> <Box sx={{ width: 5 }} /> <Typography variant="body2" color="text.secondary" sx={{ mt: '3px' }}> {priceUnit} </Typography> </Box> <Box sx={{ minHeight: planPriceMinHeight }}> {(annual || monthlyDisplay) && ( <Typography variant="body2" color="text.secondary" textAlign="center"> {priceExplanation} </Typography> )} <Typography variant="body2" color="text.secondary" sx={{ mb: 3 }} textAlign="center"> {'No additional fee beyond 10 devs.'} </Typography> </Box> </React.Fragment> ); } // else Premium const originalPriceMultiplicator = monthlyDisplay ? 1 : 12; const premiumOriginalValue = annual ? 49 * originalPriceMultiplicator : 49 * 3 * originalPriceMultiplicator; const premiumMonthlyValue = annual ? 37 : 37 * 3; const premiumAnnualValue = premiumMonthlyValue * 12; const premiumDisplayedValue = monthlyDisplay ? premiumMonthlyValue : premiumAnnualValue; const priceExplanation = getPriceExplanation( monthlyDisplay ? premiumAnnualValue : premiumMonthlyValue, ); return ( <React.Fragment> <LicensingModelSwitch /> <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', mt: 1, mb: 4 }}> <Typography variant="caption" fontWeight="medium" sx={(theme) => ({ borderRadius: 0.5, alignSelf: 'flex-end', textDecoration: 'line-through', py: 0.5, px: 1, mb: 0.5, fontWeight: 'medium', bgcolor: 'error.50', color: 'error.500', border: '1px solid', borderColor: 'error.100', ...theme.applyDarkStyles({ color: 'error.300', bgcolor: 'error.900', borderColor: 'error.800', }), })} > {formatCurrency(premiumOriginalValue)} </Typography> <Box sx={{ width: 10 }} /> <Typography variant="h3" component="div" fontWeight="bold" color="primary.main"> {formatCurrency(premiumDisplayedValue)} </Typography> <Box sx={{ width: 5 }} /> <Typography variant="body2" color="text.secondary" sx={{ mt: '3px' }}> {priceUnit} </Typography> </Box> <Box sx={{ minHeight: planPriceMinHeight }}> {(annual || monthlyDisplay) && ( <Typography variant="body2" color="text.secondary" textAlign="center"> {priceExplanation} </Typography> )} <Typography variant="body2" color="text.secondary" sx={{ mb: 2 }} textAlign="center"> 🐦 Early bird special (25% off). </Typography> </Box> </React.Fragment> ); } function Info(props: { value: React.ReactNode; metadata?: React.ReactNode }) { const { value, metadata } = props; return ( <React.Fragment> {typeof value === 'string' ? ( <Typography variant="body2" sx={{ color: 'text.secondary', textAlign: 'center' }}> {value} </Typography> ) : ( value )} {metadata && ( <Typography variant="caption" color="text.secondary" fontWeight="normal" sx={{ display: 'block', mt: 0.8, textAlign: 'center' }} > {metadata} </Typography> )} </React.Fragment> ); } function ColumnHead({ label, metadata, tooltip, href, }: { label: React.ReactNode; metadata?: string; tooltip?: string; href?: string; }) { const text = ( <Typography {...(href && { component: Link, href, target: '_blank', })} variant="body2" sx={{ '&:hover > svg': { color: 'primary.main' }, ...(href && { fontWeight: 500, '&:hover > svg': { opacity: 1, ml: 0.5, }, }), }} > {label}{' '} {href && ( <LaunchRounded color="primary" sx={{ fontSize: 14, opacity: 0, transition: '0.3s' }} /> )} {tooltip && ( <InfoOutlinedIcon sx={{ fontSize: 16, verticalAlign: 'middle', ml: 0.5, color: 'text.secondary' }} /> )} </Typography> ); return ( <Box sx={{ px: 1, alignSelf: 'center', justifySelf: 'flex-start', width: '100%', height: '100%', display: 'flex', alignItems: 'center', }} > {tooltip ? ( <Tooltip title={tooltip} placement="right" describeChild> {text} </Tooltip> ) : ( text )} {metadata && ( <Typography variant="caption" color="text.secondary" fontWeight="normal" sx={{ display: 'block' }} > {metadata} </Typography> )} </Box> ); } function ColumnHeadHighlight(props: BoxProps) { return ( <Box {...props} sx={[ () => ({ p: 2, pt: 1.5, display: 'flex', flexDirection: 'column', position: 'relative', borderRadius: '10px 10px 0 0', borderWidth: '1px 1px 0 1px', borderStyle: 'solid', borderColor: 'grey.100', background: 'linear-gradient(0deg, rgba(250, 250, 250, 1) 0%, rgba(255,255,255,0) 100%)', }), (theme) => theme.applyDarkStyles({ borderColor: 'primaryDark.700', background: alpha(theme.palette.primaryDark[900], 0.5), }), ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} /> ); } function Cell({ highlighted = false, ...props }: BoxProps & { highlighted?: boolean }) { return ( <Box {...props} sx={[ { py: '16px', minHeight: 54, px: [1, 2], display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', }, (theme) => ({ ...(highlighted && { borderWidth: '0 1px 0 1px', borderStyle: 'solid', borderColor: 'grey.100', bgcolor: alpha(theme.palette.grey[50], 0.5), }), }), (theme) => theme.applyDarkStyles({ ...(highlighted && { borderColor: 'primaryDark.700', bgcolor: alpha(theme.palette.primaryDark[900], 0.5), }), }), ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} /> ); } function RowHead({ children, startIcon, ...props }: BoxProps & { startIcon?: React.ReactElement }) { return ( <Box {...props} sx={[ { justifyContent: 'flex-start', borderRadius: 1, p: 1, transition: 'none', typography: 'body2', fontWeight: 700, display: 'flex', alignItems: 'center', bgcolor: 'grey.50', border: '1px solid', borderColor: 'divider', }, (theme) => theme.applyDarkStyles({ bgcolor: 'primaryDark.900', }), ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} > {startIcon && <Box sx={{ lineHeight: 0, mr: 1 }}>{startIcon}</Box>} {children} </Box> ); } const rowHeaders: Record<string, React.ReactNode> = { // Core 'Base UI': ( <ColumnHead label="Base UI" tooltip="A library of headless ('unstyled') React UI components and low-level hooks, available in @mui/base." /> ), 'MUI System': ( <ColumnHead label="MUI System" tooltip="CSS utilities for rapidly laying out custom designs, available in @mui/system." /> ), 'Material UI': ( <ColumnHead label="Material UI" tooltip="A library of React UI components that implements Google's Material Design, available in @mui/material." /> ), 'Joy UI': ( <ColumnHead label="Joy UI" tooltip="A library of beautifully designed React UI components, available in @mui/joy." /> ), // Advanced 'data-grid/column-groups': ( <ColumnHead label="Column groups" href="/x/react-data-grid/column-groups/" /> ), 'data-grid/column-spanning': ( <ColumnHead label="Column spanning" href="/x/react-data-grid/column-spanning/" /> ), 'data-grid/column-resizing': ( <ColumnHead label="Column resizing" href="/x/react-data-grid/column-dimensions/#resizing" /> ), 'data-grid/column-reorder': ( <ColumnHead label="Column reorder" href="/x/react-data-grid/column-ordering/" /> ), 'data-grid/column-pinning': ( <ColumnHead label="Column pinning" href="/x/react-data-grid/column-pinning/" /> ), 'data-grid/column-sorting': ( <ColumnHead label="Column sorting" href="/x/react-data-grid/sorting/" /> ), 'data-grid/multi-column-sorting': ( <ColumnHead label="Multi-column sorting" href="/x/react-data-grid/sorting/#multi-sorting" /> ), 'data-grid/row-height': <ColumnHead label="Row height" href="/x/react-data-grid/row-height/" />, 'data-grid/row-spanning': ( <ColumnHead label="Row spanning" href="/x/react-data-grid/row-spanning/" /> ), 'data-grid/row-reordering': ( <ColumnHead label="Row reordering" href="/x/react-data-grid/row-ordering/" /> ), 'data-grid/row-pinning': ( <ColumnHead label="Row pinning" href="/x/react-data-grid/row-pinning/" /> ), 'data-grid/row-selection': ( <ColumnHead label="Row selection" href="/x/react-data-grid/row-selection/" /> ), 'data-grid/row-multiselection': ( <ColumnHead label="Multi-row selection" href="/x/react-data-grid/row-selection/#multiple-row-selection" /> ), 'data-grid/row-cell-selection': ( <ColumnHead label="Cell selection (and Range)" href="/x/react-data-grid/cell-selection/" /> ), 'data-grid/filter-column': ( <ColumnHead label="Column filters" href="/x/react-data-grid/filtering/" /> ), 'data-grid/filter-quick': ( <ColumnHead label="Quick filter (Search)" href="/x/react-data-grid/filtering/quick-filter/" /> ), 'data-grid/header-filters': ( <ColumnHead label="Header filters" href="/x/react-data-grid/filtering/header-filters/" /> ), 'data-grid/filter-multicolumn': ( <ColumnHead label="Multi-column filtering" href="/x/react-data-grid/filtering/multi-filters/" /> ), 'data-grid/pagination': <ColumnHead label="Pagination" href="/x/react-data-grid/pagination/" />, 'data-grid/pagination-large': ( <ColumnHead label="Pagination > 100 rows per page" href="/x/react-data-grid/pagination/#size-of-the-page" /> ), 'data-grid/edit-row': ( <ColumnHead label="Row editing" href="/x/react-data-grid/editing/#row-editing" /> ), 'data-grid/edit-cell': ( <ColumnHead label="Cell editing" href="/x/react-data-grid/editing/#cell-editing" /> ), 'data-grid/file-csv': ( <ColumnHead label="CSV export" href="/x/react-data-grid/export/#csv-export" /> ), 'data-grid/file-print': ( <ColumnHead label="Print" href="/x/react-data-grid/export/#print-export" /> ), 'data-grid/file-clipboard-copy': ( <ColumnHead label="Clipboard copy" href="/x/react-data-grid/clipboard/#clipboard-copy" /> ), 'data-grid/file-clipboard-paste': ( <ColumnHead label="Clipboard paste" href="/x/react-data-grid/clipboard/#clipboard-paste" /> ), 'data-grid/file-excel': ( <ColumnHead label="Excel export" href="/x/react-data-grid/export/#excel-export" /> ), 'data-grid/customizable-components': ( <ColumnHead label="Customizable components" href="/x/react-data-grid/components/" /> ), 'data-grid/virtualize-column': ( <ColumnHead label="Column virtualization" href="/x/react-data-grid/virtualization/#column-virtualization" /> ), 'data-grid/virtualize-row': ( <ColumnHead label="Row virtualization > 100 rows" href="/x/react-data-grid/virtualization/#row-virtualization" /> ), 'data-grid/tree-data': <ColumnHead label="Tree data" href="/x/react-data-grid/tree-data/" />, 'data-grid/master-detail': ( <ColumnHead label="Master detail" href="/x/react-data-grid/master-detail/" /> ), 'data-grid/grouping': ( <ColumnHead label="Row grouping" href="https://mui.com/x/react-data-grid/row-grouping/" /> ), 'data-grid/aggregation': ( <ColumnHead label="Aggregation" href="/x/react-data-grid/aggregation/" /> ), 'data-grid/pivoting': <ColumnHead label="Pivoting" href="/x/react-data-grid/pivoting/" />, 'data-grid/accessibility': ( <ColumnHead label="Accessibility" href="/x/react-data-grid/accessibility/" /> ), 'data-grid/keyboard-nav': ( <ColumnHead label="Keyboard navigation" href="/x/react-data-grid/accessibility/#keyboard-navigation" /> ), 'data-grid/localization': ( <ColumnHead label="Localization" href="/x/react-data-grid/localization/" /> ), 'date-picker/simple': <ColumnHead label="Date Picker" />, 'date-picker/range': <ColumnHead label="Date Range Picker" />, // -- charts - components -- 'charts/line': <ColumnHead label="Line chart" href="/x/react-charts/lines/" />, 'charts/bar': <ColumnHead label="Bar chart" href="/x/react-charts/bars/" />, 'charts/scatter': <ColumnHead label="Scatter chart" href="/x/react-charts/scatter/" />, 'charts/pie': <ColumnHead label="Pie chart" href="/x/react-charts/pie/" />, 'charts/sparkline': <ColumnHead label="Sparkline" href="/x/react-charts/sparkline/" />, 'charts/gauge': <ColumnHead label="Gauge" href="/x/react-charts/gauge/" />, 'charts/treemap': <ColumnHead label="Tree map" href="/x/react-charts/tree-map/" />, 'charts/heatmap': <ColumnHead label="Heat map" href="/x/react-charts/heat-map/" />, 'charts/radar': <ColumnHead label="Radar" href="/x/react-charts/radar/" />, 'charts/funnel': <ColumnHead label="Funnel" href="/x/react-charts/funnel/" />, 'charts/sankey': <ColumnHead label="Sankey" href="/x/react-charts/sankey/" />, 'charts/gantt': <ColumnHead label="Gantt" href="/x/react-charts/gantt/" />, 'charts/gantt-advanced': <ColumnHead label="Advanced Gantt" />, 'charts/candlestick': <ColumnHead label="Candlestick" />, 'charts/large-dataset': <ColumnHead label="Large dataset with canvas" />, // -- charts - features -- 'charts/legend': <ColumnHead label="Legend" href="/x/react-charts/legend/" />, 'charts/tooltip': <ColumnHead label="Tooltip" href="/x/react-charts/tooltip/" />, 'charts/mouse-zoom': <ColumnHead label="Zoom on mouse" />, 'charts/export': <ColumnHead label="Export" />, // -- charts - datagrid -- 'charts/cell-with-charts': <ColumnHead label="Cell with chart" />, 'charts/filter-interaction': <ColumnHead label="Row filtering" />, 'charts/selection-interaction': <ColumnHead label="Range selection" />, 'mui-x-production': <ColumnHead label="Perpetual use in production" />, 'mui-x-development': <ColumnHead label="Development license" tooltip="For active development" />, 'mui-x-development-perpetual': ( <ColumnHead label="Development license" tooltip="For active development" /> ), 'mui-x-updates': <ColumnHead label="Access to new releases" />, // Support 'core-support': ( <ColumnHead {...{ label: 'Technical support for MUI Core', tooltip: 'Support for MUI Core (e.g. Material UI) is provided by the community. MUI Core maintainers focus on solving root issues to support the community at large.', }} /> ), 'x-support': ( <ColumnHead {...{ label: 'Technical support for MUI X', tooltip: 'You can ask for technical support, report bugs and submit unlimited feature requests to the advanced components. We take your subscription plan as one of the prioritization criteria.', }} /> ), 'tech-advisory': ( <ColumnHead {...{ label: 'Technical advisory', metadata: 'Subject to fair use policy', tooltip: 'Get the advice you need, from the people who build the product.', }} /> ), 'support-duration': ( <ColumnHead {...{ label: 'Support duration', tooltip: 'Covers the duration of your subscription.' }} /> ), 'response-time': ( <ColumnHead {...{ label: 'Guaranteed response time', tooltip: 'Maximum lead time for each response.' }} /> ), 'pre-screening': ( <ColumnHead {...{ label: 'Pre-screening', tooltip: 'Ensure we have enough details in the ticket you submitted so our support team can work on it.', }} /> ), 'issue-escalation': ( <ColumnHead {...{ label: 'Issue escalation', tooltip: 'Escalate your tickets to highest priority in our support queue.', }} /> ), 'security-questionnaire': ( <ColumnHead {...{ label: ( <React.Fragment> Security questionnaire & <Box component="span" sx={{ display: ['none', 'block'] }} /> custom agreements </React.Fragment> ), }} /> ), }; const yes = <IconImage name="pricing/yes" title="Included" />; const pending = <IconImage name="pricing/time" title="Work in progress" />; const no = <IconImage name="pricing/no" title="Not included" />; const toBeDefined = ( <Typography component={Link} href="https://forms.gle/19vN87eBvmXPjBVp6" target="_blank" variant="body2" sx={{ '&:hover > svg': { color: 'primary.main', opacity: 1 }, fontWeight: 500, pl: '16px', }} title="To be determined" > TBD <LaunchRounded color="primary" sx={{ fontSize: 14, ml: 0.5, opacity: 0, transition: '0.3s' }} /> </Typography> ); const communityData: Record<string, React.ReactNode> = { // MUI Core 'Base UI': yes, 'MUI System': yes, 'Material UI': yes, 'Joy UI': yes, // MUI X // -- data grid - columns -- 'data-grid/column-groups': yes, 'data-grid/column-spanning': yes, 'data-grid/column-resizing': no, 'data-grid/column-reorder': no, 'data-grid/column-pinning': no, // -- data grid - rows -- 'data-grid/row-height': yes, 'data-grid/row-spanning': pending, 'data-grid/row-reordering': no, 'data-grid/row-pinning': no, 'data-grid/row-selection': yes, 'data-grid/row-multiselection': no, 'data-grid/row-cell-selection': no, // -- data grid - filter -- 'data-grid/filter-quick': yes, 'data-grid/filter-column': yes, 'data-grid/header-filters': no, 'data-grid/filter-multicolumn': no, 'data-grid/column-sorting': yes, 'data-grid/multi-column-sorting': no, 'data-grid/pagination': yes, 'data-grid/pagination-large': no, // -- data grid - edit -- 'data-grid/edit-row': yes, 'data-grid/edit-cell': yes, // -- data grid - export -- 'data-grid/file-csv': yes, 'data-grid/file-print': yes, 'data-grid/file-clipboard-copy': yes, 'data-grid/file-clipboard-paste': no, 'data-grid/file-excel': no, 'data-grid/customizable-components': yes, 'data-grid/virtualize-column': yes, 'data-grid/virtualize-row': no, 'data-grid/tree-data': no, 'data-grid/master-detail': no, 'data-grid/grouping': no, 'data-grid/aggregation': no, 'data-grid/pivoting': no, 'data-grid/accessibility': yes, 'data-grid/keyboard-nav': yes, 'data-grid/localization': yes, // -- picker -- 'date-picker/simple': yes, 'date-picker/range': no, // -- charts - components -- 'charts/line': yes, 'charts/bar': yes, 'charts/scatter': yes, 'charts/pie': yes, 'charts/sparkline': yes, 'charts/gauge': pending, 'charts/treemap': pending, 'charts/heatmap': pending, 'charts/radar': pending, 'charts/funnel': no, 'charts/sankey': no, 'charts/gantt': no, 'charts/gantt-advanced': no, 'charts/candlestick': no, 'charts/large-dataset': no, // -- charts - features -- 'charts/legend': yes, 'charts/tooltip': yes, 'charts/mouse-zoom': no, 'charts/export': no, // -- charts - datagrid -- 'charts/cell-with-charts': pending, 'charts/filter-interaction': no, 'charts/selection-interaction': no, // -- general -- 'mui-x-production': yes, 'mui-x-updates': yes, 'mui-x-development': yes, 'mui-x-development-perpetual': yes, // Support 'core-support': <Info value="Community" />, 'x-support': <Info value="Community" />, 'tech-advisory': no, 'support-duration': no, 'response-time': no, 'pre-screening': no, 'issue-escalation': no, 'security-questionnaire': no, }; const proData: Record<string, React.ReactNode> = { // MUI Core 'Base UI': yes, 'MUI System': yes, 'Material UI': yes, 'Joy UI': yes, // MUI X // -- data grid - columns -- 'data-grid/column-groups': yes, 'data-grid/column-spanning': yes, 'data-grid/column-resizing': yes, 'data-grid/column-reorder': yes, 'data-grid/column-pinning': yes, // -- data grid - rows -- 'data-grid/row-height': yes, 'data-grid/row-spanning': pending, 'data-grid/row-reordering': yes, 'data-grid/row-pinning': yes, 'data-grid/row-selection': yes, 'data-grid/row-multiselection': yes, 'data-grid/row-cell-selection': no, // -- data grid - filter -- 'data-grid/filter-quick': yes, 'data-grid/filter-column': yes, 'data-grid/header-filters': yes, 'data-grid/filter-multicolumn': yes, 'data-grid/column-sorting': yes, 'data-grid/multi-column-sorting': yes, 'data-grid/pagination': yes, 'data-grid/pagination-large': yes, // -- data grid - edit -- 'data-grid/edit-row': yes, 'data-grid/edit-cell': yes, // -- data grid - export -- 'data-grid/file-csv': yes, 'data-grid/file-print': yes, 'data-grid/file-clipboard-copy': yes, 'data-grid/file-clipboard-paste': no, 'data-grid/file-excel': no, 'data-grid/customizable-components': yes, 'data-grid/virtualize-column': yes, 'data-grid/virtualize-row': yes, 'data-grid/tree-data': yes, 'data-grid/master-detail': yes, 'data-grid/grouping': no, 'data-grid/aggregation': no, 'data-grid/pivoting': no, 'data-grid/accessibility': yes, 'data-grid/keyboard-nav': yes, 'data-grid/localization': yes, 'date-picker/simple': yes, 'date-picker/range': yes, // -- charts - components -- 'charts/line': yes, 'charts/bar': yes, 'charts/scatter': yes, 'charts/pie': yes, 'charts/sparkline': yes, 'charts/gauge': pending, 'charts/treemap': pending, 'charts/heatmap': pending, 'charts/radar': pending, 'charts/funnel': pending, 'charts/sankey': pending, 'charts/gantt': pending, 'charts/gantt-advanced': no, 'charts/candlestick': no, 'charts/large-dataset': no, // -- charts - features -- 'charts/legend': yes, 'charts/tooltip': yes, 'charts/mouse-zoom': pending, 'charts/export': pending, // -- charts - datagrid -- 'charts/cell-with-charts': pending, 'charts/filter-interaction': pending, 'charts/selection-interaction': no, // -- general -- 'mui-x-production': yes, 'mui-x-development': <Info value="1 year" />, 'mui-x-development-perpetual': <Info value="Perpetual" />, 'mui-x-updates': <Info value="1 year" />, // Support 'core-support': <Info value="Community" />, 'x-support': <Info value={yes} metadata="Priority over Community" />, 'tech-advisory': no, 'support-duration': <Info value="1 year" />, 'response-time': no, 'pre-screening': no, 'issue-escalation': no, 'security-questionnaire': ( <Info value="Available from 10+ devs" metadata={'Not available under the "Capped at 10 licenses" policy'} /> ), }; const premiumData: Record<string, React.ReactNode> = { // MUI Core 'Base UI': yes, 'MUI System': yes, 'Material UI': yes, 'Joy UI': yes, // MUI X // -- data grid - columns -- 'data-grid/column-groups': yes, 'data-grid/column-spanning': yes, 'data-grid/column-resizing': yes, 'data-grid/column-reorder': yes, 'data-grid/column-pinning': yes, // -- data grid - rows -- 'data-grid/row-height': yes, 'data-grid/row-spanning': pending, 'data-grid/row-reordering': yes, 'data-grid/row-pinning': yes, 'data-grid/row-selection': yes, 'data-grid/row-multiselection': yes, 'data-grid/row-cell-selection': yes, // -- data grid - filter -- 'data-grid/filter-quick': yes, 'data-grid/filter-column': yes, 'data-grid/header-filters': yes, 'data-grid/filter-multicolumn': yes, 'data-grid/column-sorting': yes, 'data-grid/multi-column-sorting': yes, 'data-grid/pagination': yes, 'data-grid/pagination-large': yes, // -- data grid - edit -- 'data-grid/edit-row': yes, 'data-grid/edit-cell': yes, // -- data grid - export -- 'data-grid/file-csv': yes, 'data-grid/file-print': yes, 'data-grid/file-clipboard-copy': yes, 'data-grid/file-clipboard-paste': yes, 'data-grid/file-excel': yes, 'data-grid/customizable-components': yes, 'data-grid/virtualize-column': yes, 'data-grid/virtualize-row': yes, 'data-grid/tree-data': yes, 'data-grid/master-detail': yes, 'data-grid/grouping': yes, 'data-grid/aggregation': yes, 'data-grid/pivoting': pending, 'data-grid/accessibility': yes, 'data-grid/keyboard-nav': yes, 'data-grid/localization': yes, 'date-picker/simple': yes, 'date-picker/range': yes, // -- charts - components -- 'charts/line': yes, 'charts/bar': yes, 'charts/scatter': yes, 'charts/pie': yes, 'charts/sparkline': yes, 'charts/gauge': pending, 'charts/treemap': pending, 'charts/heatmap': pending, 'charts/radar': pending, 'charts/funnel': pending, 'charts/sankey': pending, 'charts/gantt': pending, 'charts/gantt-advanced': toBeDefined, 'charts/candlestick': toBeDefined, 'charts/large-dataset': toBeDefined, // -- charts - features -- 'charts/legend': yes, 'charts/tooltip': yes, 'charts/mouse-zoom': pending, 'charts/export': pending, // -- charts - datagrid -- 'charts/cell-with-charts': pending, 'charts/filter-interaction': pending, 'charts/selection-interaction': pending, // -- general -- 'mui-x-production': yes, 'mui-x-development': <Info value="1 year" />, 'mui-x-development-perpetual': <Info value="Perpetual" />, 'mui-x-updates': <Info value="1 year" />, // Support 'core-support': <Info value={pending} metadata="priority add-on only" />, 'x-support': <Info value={yes} metadata="Priority over Pro" />, 'tech-advisory': pending, 'support-duration': <Info value="1 year" />, 'response-time': ( <Info value={pending} metadata={ <React.Fragment> Available later on <br /> 2 business days. <br />1 business day (priority add-on only) </React.Fragment> } /> ), 'pre-screening': <Info value={pending} metadata="4 hours (priority add-on only)" />, 'issue-escalation': <Info value={pending} metadata="priority add-on only" />, 'security-questionnaire': <Info value="Available from 4+ devs" />, }; function RowCategory(props: BoxProps) { return ( <Box {...props} sx={[ (theme) => ({ py: 1.5, pl: 1.5, display: 'block', textTransform: 'uppercase', letterSpacing: '.08rem', fontWeight: theme.typography.fontWeightBold, fontSize: theme.typography.pxToRem(11), color: 'text.secondary', borderBottom: '1px solid', bgcolor: 'grey.50', borderColor: 'grey.200', ...theme.applyDarkStyles({ bgcolor: 'primaryDark.900', borderColor: 'primaryDark.600', }), }), ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} /> ); } function StickyHead({ container, disableCalculation = false, }: { container: React.MutableRefObject<HTMLElement | null>; disableCalculation?: boolean; }) { const [hidden, setHidden] = React.useState(true); React.useEffect(() => { function handleScroll() { if (container.current) { const rect = container.current.getBoundingClientRect(); const appHeaderHeight = 64; const headHeight = 41; const tablePaddingTop = 40; if ( rect.top + appHeaderHeight < 0 && rect.height + rect.top - appHeaderHeight - headHeight - tablePaddingTop > 0 ) { setHidden(false); } else { setHidden(true); } } } if (!disableCalculation) { document.addEventListener('scroll', handleScroll); return () => { document.removeEventListener('scroll', handleScroll); }; } return () => {}; }, [container, disableCalculation]); return ( <Box sx={[ (theme) => ({ position: 'fixed', zIndex: 10, top: 56, left: 0, right: 0, transition: '0.3s', ...(hidden && { opacity: 0, top: 0, }), py: 1, display: { xs: 'none', md: 'block' }, backdropFilter: 'blur(20px)', boxShadow: `inset 0px -1px 1px ${(theme.vars || theme).palette.grey[100]}`, backgroundColor: 'rgba(255,255,255,0.72)', }), (theme) => theme.applyDarkStyles({ boxShadow: `inset 0px -1px 1px ${(theme.vars || theme).palette.primaryDark[700]}`, backgroundColor: alpha(theme.palette.primaryDark[900], 0.7), }), ]} > <Container sx={{ display: 'grid', gridTemplateColumns: `minmax(160px, 1fr) repeat(3, minmax(240px, 1fr))`, }} > <Typography variant="body2" fontWeight="bold" sx={{ px: 2, py: 1 }}> Plans </Typography> {(['community', 'pro', 'premium'] as const).map((plan) => ( <Box key={plan} sx={{ px: 2, py: 1 }}> <PlanName plan={plan} disableDescription /> </Box> ))} </Container> </Box> ); } const divider = <Divider />; function renderMasterRow(key: string, gridSx: object, plans: Array<any>) { return ( <Box sx={[ gridSx, (theme) => ({ '&:hover > div': { bgcolor: alpha(theme.palette.grey[50], 0.4), }, ...theme.applyDarkStyles({ '&:hover > div': { bgcolor: alpha(theme.palette.primaryDark[900], 0.5), }, }), }), ]} > {rowHeaders[key]} {plans.map((id, index) => ( <Cell key={id} highlighted={index % 2 === 1}> {id === 'community' && communityData[key]} {id === 'pro' && proData[key]} {id === 'premium' && premiumData[key]} </Cell> ))} </Box> ); } function PricingTableDevelopment(props: any) { const { renderRow } = props; const { licensingModel } = useLicensingModel(); return licensingModel === 'annual' ? renderRow('mui-x-development') : renderRow('mui-x-development-perpetual'); } function PricingTableBuyPro() { const { licensingModel } = useLicensingModel(); return ( <Button component={Link} noLinkStyle href={ licensingModel === 'annual' ? 'https://mui.com/store/items/mui-x-pro/' : 'https://mui.com/store/items/mui-x-pro-perpetual/' } variant="contained" endIcon={<KeyboardArrowRightRounded />} sx={{ py: 1, mt: 'auto' }} > Buy now </Button> ); } function PricingTableBuyPremium() { const { licensingModel } = useLicensingModel(); return ( <Button component={Link} noLinkStyle href={ licensingModel === 'annual' ? 'https://mui.com/store/items/mui-x-premium/' : 'https://mui.com/store/items/mui-x-premium-perpetual/' } variant="contained" fullWidth endIcon={<KeyboardArrowRightRounded />} sx={{ py: 1, mt: 'auto' }} > Buy now </Button> ); } const StyledCollapse = styled(Collapse, { name: 'MuiSlider', slot: 'Track', })(({ theme }) => { return { position: 'relative', marginLeft: theme.spacing(1.5), borderLeftWidth: '2px', borderLeftStyle: 'solid', borderColor: theme.palette.grey[100], ...theme.applyDarkStyles({ borderColor: theme.palette.primaryDark[700], }), }; }); export default function PricingTable({ columnHeaderHidden, plans = ['community', 'pro', 'premium'], ...props }: BoxProps & { columnHeaderHidden?: boolean; plans?: Array<'community' | 'pro' | 'premium'>; }) { const router = useRouter(); const [dataGridCollapsed, setDataGridCollapsed] = React.useState(false); const [chartsCollapsed, setChartsCollapsed] = React.useState(false); React.useEffect(() => { if (router.query['expand-path'] === 'all') { setDataGridCollapsed(true); setChartsCollapsed(true); } }, [router.query]); const tableRef = React.useRef<HTMLDivElement | null>(null); const gridSx = { display: 'grid', gridTemplateColumns: `minmax(160px, 1fr) repeat(${plans.length}, minmax(${ columnHeaderHidden ? '0px' : '240px' }, 1fr))`, }; const nestedGridSx = { ...gridSx, // Hack to keep nested grid aligned with others ml: '-14px', '&>div:first-of-type': { ml: '14px', width: 'calc(100% - 14px)', // avoid overflow on hover transparent background }, }; const dataGridUnfoldMore = ( <UnfoldMoreRounded fontSize="small" sx={{ color: 'grey.600', opacity: dataGridCollapsed ? 0 : 1 }} /> ); const chartsUnfoldMore = ( <UnfoldMoreRounded fontSize="small" sx={{ color: 'grey.600', opacity: chartsCollapsed ? 0 : 1 }} /> ); const renderRow = (key: string) => renderMasterRow(key, gridSx, plans); const renderNestedRow = (key: string) => renderMasterRow(key, nestedGridSx, plans); return ( <Box ref={tableRef} {...props} sx={{ pt: 8, ...props.sx }}> <StickyHead container={tableRef} disableCalculation={columnHeaderHidden} /> {!columnHeaderHidden && ( <Box sx={gridSx}> <Typography variant="body2" fontWeight="bold" sx={{ p: 2 }}> Plans </Typography> <Box sx={{ display: 'flex', flexDirection: 'column', p: 2, pt: 1.5 }}> <PlanName plan="community" /> <PlanPrice plan="community" /> <Button component={Link} noLinkStyle href="/material-ui/getting-started/usage/" variant="outlined" fullWidth endIcon={<KeyboardArrowRightRounded />} sx={{ py: 1, mt: 'auto' }} > Get started </Button> </Box> <ColumnHeadHighlight> <div> <PlanName plan="pro" /> <PlanPrice plan="pro" /> </div> <PricingTableBuyPro /> </ColumnHeadHighlight> <Box sx={{ display: 'flex', flexDirection: 'column', p: 2, pt: 1.5 }}> <PlanName plan="premium" /> <PlanPrice plan="premium" /> <PricingTableBuyPremium /> </Box> </Box> )} <RowHead startIcon={<IconImage name="product-core" width={28} height={28} />}> MUI Core (open-source) </RowHead> {renderRow('Material UI')} {divider} {renderRow('Joy UI')} {divider} {renderRow('Base UI')} {divider} {renderRow('MUI System')} <RowHead startIcon={<IconImage name="product-advanced" width={28} height={28} />}> MUI X (open-core) </RowHead> <Box sx={{ position: 'relative', minHeight: 58, '& svg': { transition: '0.3s' }, '&:hover svg': { color: 'primary.main' }, ...gridSx, }} > <Cell /> <Cell sx={{ minHeight: 60 }}>{dataGridUnfoldMore}</Cell> <Cell highlighted sx={{ display: { xs: 'none', md: 'flex' }, minHeight: 60 }}> {dataGridUnfoldMore} </Cell> <Cell sx={{ display: { xs: 'none', md: 'flex' }, minHeight: 60 }}> {dataGridUnfoldMore} </Cell> <Button fullWidth onClick={() => setDataGridCollapsed((bool) => !bool)} endIcon={ <KeyboardArrowRightRounded color="primary" sx={{ transform: dataGridCollapsed ? 'rotate(-90deg)' : 'rotate(90deg)', }} /> } sx={[ (theme) => ({ p: 1, py: 1.5, justifyContent: 'flex-start', fontWeight: 400, borderRadius: '0px', color: 'text.primary', position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', '&:hover': { bgcolor: alpha(theme.palette.primary.main, 0.06), '@media (hover: none)': { bgcolor: 'initial', }, }, }), (theme) => theme.applyDarkStyles({ '&:hover': { bgcolor: alpha(theme.palette.primary.main, 0.06), }, }), ]} > Data Grid </Button> </Box> <StyledCollapse in={dataGridCollapsed} timeout={700}> <RowCategory>Column features</RowCategory> {renderNestedRow('data-grid/column-groups')} {divider} {renderNestedRow('data-grid/column-spanning')} {divider} {renderNestedRow('data-grid/column-resizing')} {divider} {renderNestedRow('data-grid/column-reorder')} {divider} {renderNestedRow('data-grid/column-pinning')} {divider} <RowCategory>Row features</RowCategory> {renderNestedRow('data-grid/row-height')} {divider} {renderNestedRow('data-grid/row-spanning')} {divider} {renderNestedRow('data-grid/row-reordering')} {divider} {renderNestedRow('data-grid/row-pinning')} {divider} <RowCategory>Selection features</RowCategory> {renderNestedRow('data-grid/row-selection')} {divider} {renderNestedRow('data-grid/row-multiselection')} {divider} {renderNestedRow('data-grid/row-cell-selection')} {divider} <RowCategory>Filtering features</RowCategory> {renderNestedRow('data-grid/filter-column')} {divider} {renderNestedRow('data-grid/filter-quick')} {divider} {renderNestedRow('data-grid/header-filters')} {divider} {renderNestedRow('data-grid/filter-multicolumn')} {divider} <RowCategory>Sorting</RowCategory> {renderNestedRow('data-grid/column-sorting')} {divider} {renderNestedRow('data-grid/multi-column-sorting')} {divider} <RowCategory>Pagination features</RowCategory> {renderNestedRow('data-grid/pagination')} {divider} {renderNestedRow('data-grid/pagination-large')} {divider} <RowCategory>Editing features</RowCategory> {renderNestedRow('data-grid/edit-row')} {divider} {renderNestedRow('data-grid/edit-cell')} {divider} <RowCategory>Import & export</RowCategory> {renderNestedRow('data-grid/file-csv')} {divider} {renderNestedRow('data-grid/file-print')} {divider} {renderNestedRow('data-grid/file-clipboard-copy')} {divider} {renderNestedRow('data-grid/file-clipboard-paste')} {divider} {renderNestedRow('data-grid/file-excel')} {divider} <RowCategory>Rendering features</RowCategory> {renderNestedRow('data-grid/customizable-components')} {divider} {renderNestedRow('data-grid/virtualize-column')} {divider} {renderNestedRow('data-grid/virtualize-row')} {divider} <RowCategory>Group & pivot</RowCategory> {renderNestedRow('data-grid/tree-data')} {divider} {renderNestedRow('data-grid/master-detail')} {divider} {renderNestedRow('data-grid/grouping')} {divider} {renderNestedRow('data-grid/aggregation')} {divider} {renderNestedRow('data-grid/pivoting')} {divider} <RowCategory>Miscellaneous</RowCategory> {renderNestedRow('data-grid/accessibility')} {divider} {renderNestedRow('data-grid/keyboard-nav')} {divider} {renderNestedRow('data-grid/localization')} </StyledCollapse> {divider} {renderRow('date-picker/simple')} {divider} {renderRow('date-picker/range')} {divider} <Box sx={{ position: 'relative', minHeight: 58, '& svg': { transition: '0.3s' }, '&:hover svg': { color: 'primary.main' }, ...gridSx, }} > <Cell /> <Cell sx={{ minHeight: 60 }}>{chartsUnfoldMore}</Cell> <Cell highlighted sx={{ display: { xs: 'none', md: 'flex' }, minHeight: 60 }}> {chartsUnfoldMore} </Cell> <Cell sx={{ display: { xs: 'none', md: 'flex' }, minHeight: 60 }}>{chartsUnfoldMore}</Cell> <Button fullWidth onClick={() => setChartsCollapsed((bool) => !bool)} endIcon={ <KeyboardArrowRightRounded color="primary" sx={{ transform: chartsCollapsed ? 'rotate(-90deg)' : 'rotate(90deg)', }} /> } sx={[ (theme) => ({ p: 1, py: 1.5, justifyContent: 'flex-start', fontWeight: 400, borderRadius: '0px', color: 'text.primary', position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', '&:hover': { bgcolor: alpha(theme.palette.primary.main, 0.06), '@media (hover: none)': { bgcolor: 'initial', }, }, }), (theme) => theme.applyDarkStyles({ '&:hover': { bgcolor: alpha(theme.palette.primary.main, 0.06), }, }), ]} > Charts </Button> </Box> <StyledCollapse in={chartsCollapsed} timeout={700}> <RowCategory>Components</RowCategory> {renderNestedRow('charts/line')} {divider} {renderNestedRow('charts/bar')} {divider} {renderNestedRow('charts/scatter')} {divider} {renderNestedRow('charts/pie')} {divider} {renderNestedRow('charts/sparkline')} {divider} {renderNestedRow('charts/gauge')} {divider} {renderNestedRow('charts/treemap')} {divider} {renderNestedRow('charts/heatmap')} {divider} {renderNestedRow('charts/radar')} {divider} {renderNestedRow('charts/funnel')} {divider} {renderNestedRow('charts/sankey')} {divider} {renderNestedRow('charts/gantt')} {divider} {renderNestedRow('charts/gantt-advanced')} {divider} {renderNestedRow('charts/candlestick')} {divider} {renderNestedRow('charts/large-dataset')} {divider} <RowCategory>Interactions</RowCategory> {renderNestedRow('charts/legend')} {divider} {renderNestedRow('charts/tooltip')} {divider} {renderNestedRow('charts/mouse-zoom')} {divider} {renderNestedRow('charts/export')} {divider} <RowCategory>Data Grid Integration</RowCategory> {renderNestedRow('charts/cell-with-charts')} {divider} {renderNestedRow('charts/filter-interaction')} {divider} {renderNestedRow('charts/selection-interaction')} </StyledCollapse> {divider} {renderRow('mui-x-production')} {divider} <PricingTableDevelopment renderRow={renderRow} /> {divider} {renderRow('mui-x-updates')} <RowHead>Support</RowHead> {renderRow('core-support')} {divider} {renderRow('x-support')} {divider} {renderRow('support-duration')} {divider} {renderRow('response-time')} {divider} {renderRow('pre-screening')} {divider} {renderRow('issue-escalation')} {divider} {renderRow('security-questionnaire')} {divider} </Box> ); }
5,171
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/pricing/PricingWhatToExpect.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import Paper from '@mui/material/Paper'; import LocalOfferOutlinedIcon from '@mui/icons-material/LocalOfferOutlined'; import FunctionsIcon from '@mui/icons-material/Functions'; import AllInclusiveOutlinedIcon from '@mui/icons-material/AllInclusiveOutlined'; import ReplayRoundedIcon from '@mui/icons-material/ReplayRounded'; import AcUnitIcon from '@mui/icons-material/AcUnit'; import HelpOutlineOutlinedIcon from '@mui/icons-material/HelpOutlineOutlined'; import Section from 'docs/src/layouts/Section'; import Link from 'docs/src/modules/components/Link'; import GradientText from 'docs/src/components/typography/GradientText'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; export default function PricingWhatToExpect() { return ( <Section cozy> <SectionHeadline overline="Paid plans" title={ <Typography variant="h2" sx={{ mt: 1, mb: 4 }}> Key information about <br /> <GradientText>the paid plans</GradientText> </Typography> } /> <Box sx={{ columnGap: 3, columnCount: { sm: 1, md: 2, lg: 3 }, '& > *': { breakInside: 'avoid', marginBottom: 2, }, }} > <Paper variant="outlined" sx={{ p: 2, height: 'fit-content', gridColumn: 'span 1' }}> <Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}> <FunctionsIcon fontSize="small" color="primary" /> <Typography fontWeight="bold" component="h3" color="text.primary" variant="body2" sx={{ ml: 1 }} > Required quantity </Typography> </Box> <Typography variant="body2" color="text.secondary"> The number of developers licensed must correspond to the maximum number of concurrent developers contributing changes to the front-end code of the projects that use the software. <br /> You can learn more about this in{' '} <Link target="_blank" rel="noopener" href="https://mui.com/legal/mui-x-eula/#required-quantity-of-licenses" > the EULA </Link> . </Typography> </Paper> <Paper variant="outlined" sx={{ p: 2, height: 'fit-content' }}> <Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}> <AcUnitIcon fontSize="small" color="primary" /> <Typography fontWeight="bold" component="h3" color="text.primary" variant="body2" sx={{ ml: 1 }} > Perpetual license model </Typography> </Box> <Typography variant="body2" color="text.secondary" component="div"> The Perpetual license model offers the right to keep using your licensed versions forever in production and development. It comes with 12 months of maintenance (free updates & support). <br /> <br /> Upon expiration, you can renew your maintenance plan with a discount that depends on when you renew: <ul> <li>before the support expires: 50% discount</li> <li>up to 60 days after the support has expired: 35% discount</li> <li>more than 60 days after the support has expired: 15% discount</li> </ul> </Typography> </Paper> <Paper variant="outlined" sx={{ p: 2, height: 'fit-content' }}> <Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}> <AllInclusiveOutlinedIcon fontSize="small" color="primary" /> <Typography fontWeight="bold" component="h3" color="text.primary" variant="body2" sx={{ ml: 1 }} > Perpetual vs. Annual license model </Typography> </Box> <Typography variant="body2" color="text.secondary"> On both license models, any version released before the end of your license term is forever available for applications deployed in production. <br /> <br /> The difference regards the right to use the components for <strong> development </strong>{' '} purposes. Only the perpetual license model allows you to continue development once your license expires. </Typography> </Paper> <Paper variant="outlined" sx={{ p: 2, height: 'fit-content' }}> <Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}> <ReplayRoundedIcon fontSize="small" color="primary" /> <Typography fontWeight="bold" component="h3" color="text.primary" variant="body2" sx={{ ml: 1 }} > Annual license model </Typography> </Box> <Typography variant="body2" color="text.secondary"> The Annual license model requires an active license to use the software in development. You will need to renew your license if you wish to continue active development after your current license term expires. <br /> <br /> The license is perpetual in production so you {"don't"} need to renew your license if you have stopped active development with the commercial components. <br /> <br /> You can learn more about this in{' '} <Link target="_blank" rel="noopener" href="https://mui.com/legal/mui-x-eula/#annual-license" > the EULA </Link> . </Typography> </Paper> <Paper variant="outlined" sx={{ p: 2, height: 'fit-content' }}> <Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}> <HelpOutlineOutlinedIcon fontSize="small" color="primary" /> <Typography fontWeight="bold" component="h3" color="text.primary" variant="body2" sx={{ ml: 1 }} > Maintenance and support </Typography> </Box> <Typography variant="body2" color="text.secondary"> With your purchase, you receive support and access to new versions for the duration of your subscription. You can{' '} <Link href="https://mui.com/x/introduction/support/#technical-support"> learn more about support </Link>{' '} in the docs. Note that, except for critical issues, such as security flaws, we release bug fixes and other improvements on top of the latest version, instead of patching older versions. </Typography> </Paper> <Paper variant="outlined" sx={{ p: 2, height: 'fit-content' }}> <Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}> <LocalOfferOutlinedIcon fontSize="small" color="primary" /> <Typography fontWeight="bold" component="h3" color="text.primary" variant="body2" sx={{ ml: 1 }} > Volume discounts </Typography> </Box> <Typography variant="body2" color="text.secondary"> The Pro plan is capped at 10 developers licensed; you do not need to pay for additional licenses for more than 10 developers. <br /> You can contact <Link href="mailto:[email protected]">sales</Link> for a volume discount when licensing over 25 developers under the Premium plan. </Typography> </Paper> </Box> </Section> ); }
5,172
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productBaseUI/BaseUIComponents.tsx
import * as React from 'react'; import { styled as materialStyled } from '@mui/material/styles'; import Button from '@mui/material/Button'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Unstable_Grid2'; import Typography from '@mui/material/Typography'; import SmartButtonRoundedIcon from '@mui/icons-material/SmartButtonRounded'; import TabUnselectedRoundedIcon from '@mui/icons-material/TabUnselectedRounded'; import InputRoundedIcon from '@mui/icons-material/InputRounded'; import MenuOpenRoundedIcon from '@mui/icons-material/MenuOpenRounded'; import LinearScaleRoundedIcon from '@mui/icons-material/LinearScaleRounded'; import GradientText from 'docs/src/components/typography/GradientText'; import Item, { Group } from 'docs/src/components/action/Item'; import Highlighter from 'docs/src/components/action/Highlighter'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import More from 'docs/src/components/action/More'; import Frame from 'docs/src/components/action/Frame'; import ROUTES from 'docs/src/route'; // switcher icons import HighlightedCode from 'docs/src/modules/components/HighlightedCode'; import MarkdownElement from 'docs/src/components/markdown/MarkdownElement'; import BaseButtonDemo from './components/BaseButtonDemo'; import BaseMenuDemo from './components/BaseMenuDemo'; import BaseInputDemo from './components/BaseInputDemo'; import BaseTabsDemo from './components/BaseTabsDemo'; import BaseSliderDemo from './components/BaseSliderDemo'; const StyledButton = materialStyled(Button)(({ theme }) => ({ borderRadius: 40, padding: theme.spacing('2px', 1), fontSize: theme.typography.pxToRem(12), lineHeight: 18 / 12, '&.MuiButton-text': { color: theme.palette.grey[500], border: '1px solid', borderColor: theme.palette.primaryDark[700], '&:hover': { backgroundColor: theme.palette.primaryDark[700], }, }, '&.MuiButton-outlined': { color: '#fff', backgroundColor: 'var(--palette-primary-dark)', borderColor: 'var(--palette-primary)', }, })); const DEMOS = ['Tabs', 'Button', 'Input', 'Menu', 'Slider'] as const; const CODES: Record< (typeof DEMOS)[number], string | ((styling: 'system' | 'tailwindcss' | 'css') => string) > = { Button: BaseButtonDemo.getCode, Menu: BaseMenuDemo.getCode, Input: BaseInputDemo.getCode, Tabs: BaseTabsDemo.getCode, Slider: BaseSliderDemo.getCode, }; export default function BaseUIComponents() { const [styling, setStyling] = React.useState<'system' | 'tailwindcss' | 'css'>('system'); const [demo, setDemo] = React.useState<(typeof DEMOS)[number]>(DEMOS[0]); const icons = { [DEMOS[0]]: <TabUnselectedRoundedIcon fontSize="small" />, [DEMOS[1]]: <SmartButtonRoundedIcon fontSize="small" />, [DEMOS[2]]: <InputRoundedIcon fontSize="small" />, [DEMOS[3]]: <MenuOpenRoundedIcon fontSize="small" />, [DEMOS[4]]: <LinearScaleRoundedIcon fontSize="small" />, }; return ( <Section bg="gradient"> <Grid container spacing={2}> <Grid md={6} sx={{ minWidth: 0 }}> <SectionHeadline overline="Unstyled components" title={ <Typography variant="h2"> Choose your own <br /> <GradientText>CSS adventure</GradientText> </Typography> } description="Base UI's skeletal components give you a sturdy foundation to apply custom styles with ease. With no defaults to override, you're free to start from scratch using vanilla CSS, Tailwind CSS, MUI System, or any other framework you prefer." /> <Group desktopColumns={2} sx={{ m: -2, p: 2 }}> {DEMOS.map((name) => ( <Highlighter key={name} selected={name === demo} onClick={() => setDemo(name)}> <Item icon={React.cloneElement(icons[name])} title={name} /> </Highlighter> ))} <More href={ROUTES.baseComponents} /> </Group> </Grid> <Grid xs={12} md={6}> <Frame sx={[ { height: '100%', '--palette-primary': 'var(--muidocs-palette-primary-main)', '--palette-primary-light': 'var(--muidocs-palette-primary-300)', '--palette-primary-hover': 'var(--muidocs-palette-primary-600)', '--palette-primary-dark': 'var(--muidocs-palette-primary-800)', '--focus-ring': 'rgba(102, 178, 255, 0.3)', '--shadow': '0px 2px 2px rgba(205, 210, 215, 0.5)', ...(styling === 'tailwindcss' && { '--palette-primary': '#4F46E5', '--palette-primary-light': '#7B74EC', '--palette-primary-hover': '#463EC6', '--palette-primary-dark': '#3730A3', '--focus-ring': 'rgba(165, 180, 252, 0.6)', '--shadow': '0px 2px 2px rgba(205, 210, 215, 0.5)', }), ...(styling === 'css' && { '--palette-primary': '#9333EA', '--palette-primary-light': '#AC62EF', '--palette-hover': '#7F17DE', '--palette-primary-dark': '#581C87', '--focus-ring': 'rgba(216, 180, 254, 0.6)', '--shadow': '0px 2px 2px rgba(205, 210, 215, 0.5)', }), }, (theme) => theme.applyDarkStyles({ '--focus-ring': 'rgba(102, 178, 255, 0.3)', '--shadow': '0px 2px 2px rgba(0, 0, 0, 0.5)', ...(styling === 'tailwindcss' && { '--palette-primary': '#5B69F6', '--palette-primary-hover': '#3446F4', '--focus-ring': 'rgba(123, 120, 207, 0.6)', '--shadow': '0px 2px 2px rgba(0, 0, 0, 0.5)', }), ...(styling === 'css' && { '--palette-primary': '#B56FFB', '--palette-primary-hover': '#A651FB', '--focus-ring': 'rgba(166, 94, 222, 0.6)', '--shadow': '0px 2px 2px rgba(0, 0, 0, 0.5)', }), }), ]} > <Frame.Demo className="mui-default-theme" sx={{ flexGrow: 1 }}> {demo === 'Tabs' && <BaseTabsDemo styling={styling} />} {demo === 'Button' && <BaseButtonDemo styling={styling} />} {demo === 'Menu' && <BaseMenuDemo styling={styling} />} {demo === 'Input' && <BaseInputDemo styling={styling} />} {demo === 'Slider' && <BaseSliderDemo styling={styling} />} </Frame.Demo> <Frame.Info sx={{ height: 360, position: 'relative', overflow: 'hidden', p: 0, pt: 5, }} > <Box sx={{ overflow: 'auto', pt: 2, pb: 1, px: 2, height: '100%', }} > <HighlightedCode copyButtonHidden component={MarkdownElement} code={(() => { const result = CODES[demo]; if (typeof result === 'function') { return result(styling); } return result; })()} language="jsx" /> </Box> <Box sx={(theme) => ({ pb: 3, display: 'flex', alignItems: 'center', position: 'absolute', top: 12, left: 16, right: 0, zIndex: 10, background: `linear-gradient(to bottom, ${ (theme.vars || theme).palette.common.black } 30%, transparent)`, })} > <StyledButton size="small" variant={styling === 'system' ? 'outlined' : 'text'} onClick={() => { setStyling('system'); }} > MUI System </StyledButton> <StyledButton size="small" variant={styling === 'tailwindcss' ? 'outlined' : 'text'} onClick={() => { setStyling('tailwindcss'); }} sx={{ ml: 1 }} > Tailwind CSS </StyledButton> <StyledButton size="small" variant={styling === 'css' ? 'outlined' : 'text'} onClick={() => { setStyling('css'); }} sx={{ ml: 1 }} > Plain CSS </StyledButton> </Box> </Frame.Info> </Frame> </Grid> </Grid> </Section> ); }
5,173
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productBaseUI/BaseUICustomization.tsx
import * as React from 'react'; import { styled } from '@mui/system'; import clsx from 'clsx'; import { Switch as SwitchUnstyled } from '@mui/base/Switch'; import { useSwitch, UseSwitchParameters } from '@mui/base/useSwitch'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import SvgTwinkle from 'docs/src/icons/SvgTwinkle'; import Section from 'docs/src/layouts/Section'; import Highlighter from 'docs/src/components/action/Highlighter'; import Item, { Group } from 'docs/src/components/action/Item'; import GradientText from 'docs/src/components/typography/GradientText'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import FlashCode from 'docs/src/components/animation/FlashCode'; import Frame from 'docs/src/components/action/Frame'; import HighlightedCode from 'docs/src/modules/components/HighlightedCode'; import MarkdownElement from 'docs/src/components/markdown/MarkdownElement'; const code = ` import clsx from 'clsx'; import { styled } from '@mui/system'; import { SwitchUnstyled } from '@mui/base/Switch'; import { useSwitch } from '@mui/base/useSwitch'; const StyledSwitchRoot = styled('span')(\` font-size: 0; position: relative; display: inline-block; width: 40px; height: 24px; margin: 10px; cursor: pointer; border-radius: 16px; background: #A0AAB4; &.Mui-disabled { opacity: 0.4; cursor: not-allowed; } &.Mui-checked { background: #007FFF; & .MuiSwitch-thumb { left: 20px; } } &.Mui-focusVisible { outline: 2px solid #007FFF; outline-offset: 2px; } \`); const StyledSwitchInput = styled('input')\` cursor: inherit; position: absolute; width: 100%; height: 100%; top: 0; left: 0; opacity: 0; z-index: 1; margin: 0; \`; const StyledSwitchThumb = styled('span')\` display: block; width: 16px; height: 16px; top: 4px; left: 4px; border-radius: 16px; background-color: #FFF; position: relative; transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 120ms; &.Mui-checked { left: 20px; } \`; function SwitchFromHook(props) { const { getInputProps, checked, disabled, focusVisible, } = useSwitch(props); const stateClasses = { 'Mui-checked': checked, 'Mui-disabled': disabled, 'Mui-focusVisible': focusVisible, }; return ( <StyledSwitchRoot className={clsx(stateClasses)}> <StyledSwitchThumb className={clsx(stateClasses)} /> <StyledSwitchInput {...getInputProps()} aria-label="Demo switch" /> </StyledSwitchRoot> ); } function App() { return ( <SwitchUnstyled slots={{ root: StyledSwitchRoot, input: StyledSwitchInput, thumb: StyledSwitchThumb, }} slotProps={{ input: { 'aria-label': 'Demo switch' }, }} /> <SwitchFromHook /> ) } `; const startLine = [6, 89, 64]; const endLine = [26, 93, 84]; const scrollTo = [0, 1400, 1140]; const StyledSwitchRoot = styled('span')(` font-size: 0; position: relative; display: inline-block; width: 40px; height: 24px; margin: 10px; cursor: pointer; border-radius: 16px; background: #A0AAB4; &.Mui-disabled { opacity: 0.4; cursor: not-allowed; } &.Mui-checked { background: #007FFF; & .MuiSwitch-thumb { left: 20px; } } &.Mui-focusVisible { outline: 2px solid #007FFF; outline-offset: 2px; } `); const StyledSwitchInput = styled('input')` cursor: inherit; position: absolute; width: 100%; height: 100%; top: 0; left: 0; opacity: 0; z-index: 1; margin: 0; `; const StyledSwitchThumb = styled('span')` display: block; width: 16px; height: 16px; top: 4px; left: 4px; border-radius: 16px; background-color: #fff; position: relative; transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; &.Mui-checked { left: 20px; } `; function SwitchFromHook(props: UseSwitchParameters) { const { getInputProps, checked, disabled, focusVisible } = useSwitch(props); const stateClasses = { 'Mui-checked': checked, 'Mui-disabled': disabled, 'Mui-focusVisible': focusVisible, }; return ( <StyledSwitchRoot className={clsx(stateClasses)}> <StyledSwitchThumb className={clsx(stateClasses)} /> <StyledSwitchInput {...getInputProps()} aria-label="Demo switch" /> </StyledSwitchRoot> ); } export default function BaseUICustomization() { const [index, setIndex] = React.useState(0); const infoRef = React.useRef<HTMLDivElement | null>(null); function getSelectedProps(i: number) { return { selected: index === i, sx: { '& svg': { opacity: index === i ? 1 : 0.5 } }, }; } React.useEffect(() => { if (infoRef.current) { infoRef.current.scroll({ top: scrollTo[index], behavior: 'smooth' }); } }, [index]); return ( <Section> <Grid container spacing={2}> <Grid item md={6} sx={{ minWidth: 0 }}> <Box maxWidth={500} sx={{ mb: 4 }}> <SectionHeadline overline="Customization" title={ <Typography variant="h2"> <GradientText>Endless possibilities </GradientText> <br /> with a lightweight API </Typography> } description="With Base UI, you have the freedom to decide how much you want to customize a component's structure and style." /> </Box> <Group sx={{ m: -2, p: 2 }}> <Highlighter disableBorder {...getSelectedProps(0)} onClick={() => setIndex(0)}> <Item icon={<SvgTwinkle />} title="Applying custom CSS rules" description="Your CSS, your rules. With Base UI there are no styles to override, so you can start with a clean slate." /> </Highlighter> <Highlighter disableBorder {...getSelectedProps(1)} onClick={() => setIndex(1)}> <Item icon={<SvgTwinkle />} title="Overriding subcomponent slots" description="Default DOM structure doesn't suit your needs? Replace any node with the element you prefer using the `slots` prop." /> </Highlighter> <Highlighter disableBorder {...getSelectedProps(2)} onClick={() => setIndex(2)}> <Item icon={<SvgTwinkle />} title="Creating custom components using hooks" description="Base UI includes low-level hooks for adding functionality to your own fully custom-built components." /> </Highlighter> </Group> </Grid> <Grid item xs={12} md={6}> <Frame sx={{ height: '100%' }}> <Frame.Demo sx={(theme) => ({ overflow: 'auto', flexGrow: 1, height: '140px', display: 'flex', justifyContent: 'center', alignItems: 'center', backgroundSize: '100%, 72px', background: `${(theme.vars || theme).palette.gradients.linearSubtle}`, ...theme.applyDarkStyles({ backgroundSize: '72px, 100%', background: `${(theme.vars || theme).palette.gradients.linearSubtle}`, }), })} > <SwitchUnstyled slots={{ root: StyledSwitchRoot, input: StyledSwitchInput, thumb: StyledSwitchThumb, }} slotProps={{ input: { 'aria-label': 'Demo switch' }, }} /> <SwitchFromHook defaultChecked /> </Frame.Demo> <Frame.Info ref={infoRef} sx={{ maxHeight: 450, overflow: 'auto', }} > <Box sx={{ position: 'relative', '&& pre': { bgcolor: 'transparent' } }}> <Box sx={{ position: 'relative', zIndex: 1 }}> <HighlightedCode copyButtonHidden component={MarkdownElement} code={code} language="jsx" /> </Box> <FlashCode startLine={startLine[index]} endLine={endLine[index]} sx={{ mx: -1 }} /> </Box> </Frame.Info> </Frame> </Grid> </Grid> </Section> ); }
5,174
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productBaseUI/BaseUIEnd.tsx
import * as React from 'react'; import { alpha } from '@mui/material/styles'; import Grid from '@mui/material/Unstable_Grid2'; import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import Typography from '@mui/material/Typography'; import CompareIcon from '@mui/icons-material/Compare'; import StyleRoundedIcon from '@mui/icons-material/StyleRounded'; import { GlowingIconContainer } from 'docs/src/components/action/InfoCard'; import GetStartedButtons from 'docs/src/components/home/GetStartedButtons'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import GradientText from 'docs/src/components/typography/GradientText'; import ROUTES from 'docs/src/route'; export default function BaseUIEnd() { return ( <Section data-mui-color-scheme="dark" sx={{ color: 'text.secondary', background: (theme) => `linear-gradient(180deg, ${(theme.vars || theme).palette.primaryDark[800]} 50%, ${alpha(theme.palette.primary[800], 0.2)} 100%), ${ (theme.vars || theme).palette.primaryDark[800] }`, }} > <Grid container spacing={{ xs: 6, sm: 10 }} alignItems="center"> <Grid xs={12} sm={6}> <SectionHeadline overline="Community" title={ <Typography variant="h2"> Join our <GradientText>global community</GradientText> </Typography> } description={ <React.Fragment> Base UI wouldn&apos;t be possible without our global community of contributors. Join us today to get help when you need it, and lend a hand when you can. </React.Fragment> } /> <GetStartedButtons primaryUrl={ROUTES.baseDocs} secondaryLabel="Learn Base UI" secondaryUrl={ROUTES.baseQuickstart} altInstallation="npm install @mui/base" /> </Grid> <Grid xs={12} sm={6}> <List sx={{ '& > li': { alignItems: 'flex-start' } }}> <ListItem sx={{ p: 0, mb: 4, gap: 2.5 }}> <GlowingIconContainer icon={<CompareIcon color="primary" />} /> <div> <Typography color="text.primary" fontWeight="semiBold" gutterBottom> Base UI vs. Material UI </Typography> <Typography> Base UI features many of the same components as Material UI, but without the Material Design implementation. </Typography> </div> </ListItem> <ListItem sx={{ p: 0, gap: 2.5 }}> <GlowingIconContainer icon={<StyleRoundedIcon color="primary" />} /> <div> <Typography color="text.primary" fontWeight="semiBold" gutterBottom> Does it come with styles? </Typography> <Typography> Base UI <i>is not packaged</i> with any default theme or built-in style engine. This makes it a great choice if you need complete control over how your app&apos;s CSS is implemented. </Typography> </div> </ListItem> </List> </Grid> </Grid> </Section> ); }
5,175
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productBaseUI/BaseUIHero.tsx
import * as React from 'react'; import dynamic from 'next/dynamic'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; // Local imports import HeroContainer from 'docs/src/layouts/HeroContainer'; import IconImage from 'docs/src/components/icon/IconImage'; import GradientText from 'docs/src/components/typography/GradientText'; import ROUTES from 'docs/src/route'; import GetStartedButtons from 'docs/src/components/home/GetStartedButtons'; import Link from 'docs/src/modules/components/Link'; const BaseUIThemesDemo = dynamic(() => import('./BaseUIThemesDemo'), { ssr: false, loading: function Loading() { return ( <Box sx={[ (theme) => ({ width: 338, height: 557, borderRadius: '12px', bgcolor: 'grey.100', ...theme.applyDarkStyles({ bgcolor: 'primaryDark.800', }), }), ]} /> ); }, }); export default function BaseUIHero() { return ( <HeroContainer linearGradient disableMobileHidden disableTabExclusion left={ <Box sx={{ textAlign: { xs: 'center', md: 'left' }, ml: { xl: '-40px' } }}> <Typography fontWeight="bold" variant="body2" sx={(theme) => ({ color: 'primary.600', display: 'flex', alignItems: 'center', gap: 1, justifyContent: { xs: 'center', md: 'flex-start' }, ...theme.applyDarkStyles({ color: 'primary.300', }), })} > <IconImage width={28} height={28} loading="eager" name="product-core" />{' '} <Link href={ROUTES.productCore}>MUI Core</Link>{' '} <Typography component="span" variant="inherit" sx={{ color: 'divider' }}> / </Typography> <Typography component="span" variant="inherit" sx={{ color: 'text.primary' }}> Base UI </Typography> </Typography> <Typography variant="h1" sx={{ my: 2, maxWidth: { xs: 500, md: 'unset' }, minWidth: { lg: 650 }, position: 'relative', zIndex: 1, }} > A <GradientText>blank canvas</GradientText> for <br /> total flexibility </Typography> <Typography color="text.secondary" sx={{ mb: 3, maxWidth: 500 }}> Base UI gives you a set of foundational &quot;headless&quot; components that you can build with using any styling solution you choose—no need to override any default style engine or theme. </Typography> <GetStartedButtons primaryUrl={ROUTES.baseDocs} secondaryLabel="Learn Base UI" secondaryUrl={ROUTES.baseQuickstart} altInstallation="npm install @mui/base" /> </Box> } right={ <Box sx={{ position: 'relative', height: '100%', py: { xs: 9, sm: 2 }, px: 2, display: 'flex', '& > div': { margin: 'auto' }, }} > <BaseUIThemesDemo /> </Box> } /> ); }
5,176
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productBaseUI/BaseUISummary.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Container from '@mui/material/Container'; import Typography from '@mui/material/Typography'; import Grid from '@mui/material/Grid'; import StyleRoundedIcon from '@mui/icons-material/StyleRounded'; import AccessibilityNewRounded from '@mui/icons-material/AccessibilityNewRounded'; import PhishingRoundedIcon from '@mui/icons-material/PhishingRounded'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import GradientText from 'docs/src/components/typography/GradientText'; import InfoCard from 'docs/src/components/action/InfoCard'; const content = [ { icon: <StyleRoundedIcon color="primary" />, title: 'Completely unstyled', description: 'Nothing to override—start fresh with any style solution or design system.', link: '/base-ui/getting-started/', }, { icon: <PhishingRoundedIcon color="primary" />, title: 'Low-level hooks', description: "When it's time to go fully custom, Base UI has you covered with low-level hooks for fine-grained flexibility in component design.", link: '/base-ui/getting-started/usage/#components-vs-hooks', }, { icon: <AccessibilityNewRounded color="primary" />, title: 'Accessibility', description: 'We take accessibility seriously. The Base UI docs are loaded with guidelines and best practices.', link: '/base-ui/getting-started/accessibility/', }, ]; export default function BaseUISummary() { return ( <Container sx={{ py: { xs: 6, sm: 10, md: 20 } }}> <SectionHeadline alwaysCenter overline="Why Base UI" title={ <Typography variant="h2" sx={{ mt: 1 }}> Essential building blocks <br /> for <GradientText>sleek and accessible</GradientText> UIs </Typography> } description="Base UI abstracts away the more frustrating aspects of UI development—like accessibility, cross-browser compatibility, and event handling—so you can skip ahead to design implementation." /> <Box sx={{ mt: 8 }}> <Grid container spacing={3}> {content.map(({ icon, title, description, link }) => ( <Grid key={title} item xs={12} md={4}> <InfoCard link={link} title={title} icon={icon} description={description} /> </Grid> ))} </Grid> </Box> <Typography fontWeight={500} textAlign="center" mt={8} mb={2} fontSize="0.875rem"> Alternative to libraries such as: </Typography> <Box sx={{ display: 'flex', gap: 2, justifyContent: 'center' }}> <Box sx={(theme) => ({ background: 'url(/static/branding/base-ui/radix.svg)', ...theme.applyDarkStyles({ background: 'url(/static/branding/base-ui/radix-dark.svg)', }), })} width={77} height={37} /> <Box sx={(theme) => ({ background: 'url(/static/branding/base-ui/react-aria.svg)', ...theme.applyDarkStyles({ background: 'url(/static/branding/base-ui/react-aria-dark.svg)', }), })} width={113} height={37} /> <Box sx={(theme) => ({ background: 'url(/static/branding/base-ui/headless-ui.svg)', ...theme.applyDarkStyles({ background: 'url(/static/branding/base-ui/headless-ui-dark.svg)', }), })} width={116} height={37} /> </Box> </Container> ); }
5,177
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productBaseUI/BaseUITestimonial.tsx
/* eslint-disable material-ui/straight-quotes */ import * as React from 'react'; import { alpha } from '@mui/material/styles'; import Avatar from '@mui/material/Avatar'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Unstable_Grid2'; import Divider from '@mui/material/Divider'; import Typography from '@mui/material/Typography'; import ChevronRightRoundedIcon from '@mui/icons-material/ChevronRightRounded'; import Link from 'docs/src/modules/components/Link'; import Section from 'docs/src/layouts/Section'; export default function BaseUITestimonial() { return ( <Section> <Grid container spacing={{ xs: 6, sm: 10 }} alignItems="center"> <Grid xs={12} sm={6}> <Box sx={{ border: '1px solid', borderColor: 'divider', borderRadius: 1, pt: 2, pl: 3, background: 'linear-gradient(260deg, #3399FF 0%, #0059B3 95%)', backgroundClip: 'padding-box', overflow: 'auto', '& img': { width: '100%', borderTopLeftRadius: '8px', display: 'block', }, }} > <Typography variant="h4" component="h2" fontWeight="medium" color="#FFF" mb={2.5}> Nhost&apos;s dashboard </Typography> <Box component="img" srcSet="/static/branding/base-ui/nhost.jpg, /static/branding/base-ui/nhost-2x.jpg 2x " alt="Screenshot displaying part of the Nhost dashboard that used Base UI to be built." loading="lazy" sx={{ backgroundColor: '#fff', width: 510, height: 210, }} /> </Box> <Typography variant="body2" sx={{ mt: 2 }}> Nhost&apos;s new dashboard, powered by Base UI &nbsp;&nbsp; <Typography component="span" variant="inherit" color="divider"> / </Typography> &nbsp;&nbsp; <Link href="https://nhost.io/blog/new-database-ui" target="_blank"> View the blog post <ChevronRightRoundedIcon fontSize="small" /> </Link> </Typography> </Grid> <Grid xs={12} sm={6} sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> <Typography> “After considering various options, we decided to migrate our custom components to Material UI, and that&apos;s when we discovered Base UI. As a set of headless components, it offered exactly what we needed to implement our design system while maintaining full customizability. The focus on accessibility was also a big plus, as it ensured that our dashboard was usable by everyone. Low-level component hooks were just the icing on the cake.” </Typography> <Divider /> <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}> <Box sx={(theme) => ({ p: 0.5, bgcolor: 'primary.50', border: '1px solid', borderColor: 'primary.200', borderRadius: 99, ...theme.applyDarkStyles({ borderColor: 'primary.800', bgcolor: alpha(theme.palette.primary[900], 0.5), }), })} > <Avatar alt="Szilárd Dóró's profile picture" src="https://media.licdn.com/dms/image/C4D03AQHm6cbz2UDXpw/profile-displayphoto-shrink_800_800/0/1642674447256?e=2147483647&v=beta&t=L8g2vW_8mG8AvB3lwui0CT8969_Cx9QQ0iJXIS47i0o" /> </Box> <Box sx={{ flex: 1 }}> <Typography variant="body2" fontWeight="semiBold"> Szilárd Dóró </Typography> <Typography variant="body2" color="text.secondary"> Senior Software Engineer </Typography> </Box> <Box component="img" src="https://docs.nhost.io/img/logo.svg" alt="" sx={(theme) => ({ width: '80px', alignSelf: 'center', ...theme.applyDarkStyles({ content: `url(https://nhost.io/common/logo.svg)`, }), })} /> </Box> </Grid> </Grid> </Section> ); }
5,178
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productBaseUI/BaseUIThemesDemo.tsx
import * as React from 'react'; import clsx from 'clsx'; // Base UI imports import { Badge, badgeClasses } from '@mui/base/Badge'; import { Input, InputProps } from '@mui/base/Input'; import { Dropdown } from '@mui/base/Dropdown'; import { Menu } from '@mui/base/Menu'; import { MenuItem, menuItemClasses } from '@mui/base/MenuItem'; import { MenuButton } from '@mui/base/MenuButton'; import { Modal, modalClasses } from '@mui/base/Modal'; import { Option } from '@mui/base/Option'; import { Popper } from '@mui/base/Popper'; import { Select } from '@mui/base/Select'; import { Slider, sliderClasses } from '@mui/base/Slider'; import { Snackbar } from '@mui/base/Snackbar'; import { SnackbarCloseReason } from '@mui/base/useSnackbar'; import { Switch, switchClasses } from '@mui/base/Switch'; import { Tab } from '@mui/base/Tab'; import { Tabs } from '@mui/base/Tabs'; import { TabsList } from '@mui/base/TabsList'; // Other packages import { css, styled, keyframes } from '@mui/system'; import Box from '@mui/material/Box'; import Fade from '@mui/material/Fade'; import ChevronRightRoundedIcon from '@mui/icons-material/ChevronRightRounded'; import AutoAwesomeRounded from '@mui/icons-material/AutoAwesomeRounded'; import SmartButtonRounded from '@mui/icons-material/SmartButtonRounded'; import InputRounded from '@mui/icons-material/InputRounded'; import PlaylistAddCheckRounded from '@mui/icons-material/PlaylistAddCheckRounded'; import ToggleOnRoundedIcon from '@mui/icons-material/ToggleOnRounded'; import LinearScaleRounded from '@mui/icons-material/LinearScaleRounded'; import CircleNotificationsRounded from '@mui/icons-material/CircleNotificationsRounded'; import ReportGmailerrorredRounded from '@mui/icons-material/ReportGmailerrorredRounded'; import MenuOpenRounded from '@mui/icons-material/MenuOpenRounded'; import FirstPageRounded from '@mui/icons-material/FirstPageRounded'; import TabRounded from '@mui/icons-material/TabRounded'; import CheckCircleRoundedIcon from '@mui/icons-material/CheckCircleRounded'; import InterestsRoundedIcon from '@mui/icons-material/InterestsRounded'; import RadioRoundedIcon from '@mui/icons-material/RadioRounded'; import ROUTES from 'docs/src/route'; import Link from 'docs/src/modules/components/Link'; import heroVariables from 'docs/src/components/productBaseUI/heroVariables'; const Panel = styled('div')({ width: 340, backgroundColor: 'var(--muidocs-palette-background-paper)', borderRadius: 'min(var(--border-radius) * 2, 32px)', border: 'var(--border-width) solid', borderColor: 'var(--border-color)', boxShadow: 'var(--Panel-shadow)', overflow: 'hidden', }); const StyledLabel = styled('label')({ fontSize: 12, fontWeight: 600, color: 'var(--muidocs-palette-text-secondary)', margin: '0.25rem 0', }); const StyledLabelCategory = styled('label')({ fontSize: 10, fontWeight: 700, textTransform: 'uppercase', letterSpacing: '.08rem', color: 'var(--muidocs-palette-text-secondary)', margin: '0.5rem 0.4rem', }); const StyledParagraph = styled('p')({ margin: 0, fontSize: 14, fontWeight: 600, color: 'text.primary', }); const StyledSwitchLabel = styled('label')({ margin: 0, fontSize: 14, fontWeight: 600, color: 'text.primary', }); const StyledTabsList = styled('div')({ display: 'flex', borderBottom: 'var(--border-width) solid var(--border-color)', background: 'var(--TabsList-background)', padding: '4px', }); const StyledTab = styled('button')({ display: 'flex', alignItems: 'center', cursor: 'pointer', justifyContent: 'center', gap: 6, position: 'relative', flex: 1, maxHeight: 42, padding: '0.75rem 0.875rem', background: 'transparent', border: 'none', borderRadius: 'var(--Tab-radius)', fontSize: 14, fontWeight: 600, color: 'var(--muidocs-palette-text-secondary)', '&:hover:not(.Mui-selected)': { background: 'var(--Tab-hoverBackground)', }, '&:focus-visible': { outline: '3px solid var(--muidocs-palette-primary-300)', outlineOffset: -4, }, '&.Mui-selected': { color: 'var(--color-primary)', '&::after': { content: '""', display: 'block', height: 'max(2px, var(--border-width, 0px))', left: 2, right: 2, bottom: 'var(--Tab-activeSelector)', position: 'absolute', backgroundColor: 'var(--color-primary)', }, }, }); const StyledSelectButton = styled('button')({ width: '100%', cursor: 'pointer', maxWidth: '100%', minHeight: 'calc(2 * var(--border-width, 0px) + 37px)', border: 'var(--border-width, 1px) solid', borderColor: 'var(--Select-ringColor, var(--border-color))', borderRadius: 'var(--border-radius)', padding: '8px 12px', backgroundColor: 'var(--Select-background)', display: 'flex', color: 'var(--muidocs-palette-text-secondary)', alignItems: 'center', fontSize: '0.875rem', fontFamily: 'var(--muidocs-font-family)', lineHeight: 21 / 14, boxShadow: 'var(--formControl-shadow, 0px 2px 2px rgba(205, 210, 215, 0.3))', '&:hover': { backgroundColor: 'var(--Tab-hoverBackground)', }, '&:focus-visible': { outline: '3px solid var(--muidocs-palette-primary-300)', }, '& svg:last-child': { marginLeft: 'auto', }, '& svg:first-child': { marginRight: 'var(--Select-spacing)', }, '&:not(:empty)': { fontWeight: 500, }, }); const StyledModalButton = styled('button')({ display: 'flex', justifyContent: 'center', width: '100%', padding: '8px 12px', cursor: 'pointer', backgroundColor: 'var(--muidocs-palette-primary-50)', border: '1px solid', borderColor: 'var(--muidocs-palette-primary-100)', borderRadius: 'var(--border-radius)', boxShadow: 'var(--formControl-shadow), inset 0px 4px 4px rgba(205, 210, 215, 0.3)', fontFamily: 'var(--muidocs-font-family)', fontSize: '0.875rem', fontWeight: 600, color: 'var(--muidocs-palette-primary-600)', lineHeight: 21 / 14, '&:hover': { backgroundColor: 'var(--muidocs-palette-primary-100)', }, '&:focus-visible': { outline: '3px solid var(--muidocs-palette-primary-300)', }, '[data-mui-color-scheme="dark"] &': { borderColor: 'var(--muidocs-palette-primary-700)', backgroundColor: 'var(--muidocs-palette-primary-900)', color: 'var(--muidocs-palette-primary-200)', boxShadow: 'var(--formControl-shadow), inset 0px 4px 4px rgba(205, 210, 215, 0.15)', '&:hover': { backgroundColor: 'var(--muidocs-palette-primary-800)', }, }, }); const StyledSnackbarButton = styled('button')({ display: 'flex', justifyContent: 'center', width: '100%', padding: '8px 12px', cursor: 'pointer', backgroundColor: 'var(--muidocs-palette-grey-50)', border: '1px solid', borderColor: 'var(--muidocs-palette-grey-200)', borderRadius: 'var(--border-radius)', boxShadow: 'var(--formControl-shadow), inset 0px 4px 4px rgba(205, 210, 215, 0.3)', fontFamily: 'var(--muidocs-font-family)', fontSize: '0.875rem', fontWeight: 600, color: 'var(--muidocs-palette-grey-900)', lineHeight: 21 / 14, '&:hover': { backgroundColor: 'var(--muidocs-palette-grey-200)', }, '&:focus-visible': { outline: '3px solid var(--muidocs-palette-primary-300)', }, '[data-mui-color-scheme="dark"] &': { borderColor: 'var(--muidocs-palette-grey-800)', backgroundColor: 'var(--muidocs-palette-grey-900)', color: 'var(--muidocs-palette-primary-100)', boxShadow: 'var(--formControl-shadow), inset 0px 4px 4px rgba(205, 210, 215, 0.05)', '&:hover': { backgroundColor: 'var(--muidocs-palette-primaryDark-700)', }, }, }); const StyledViewCode = styled(Link)({ display: 'flex', justifyContent: 'center', alignItems: 'end', width: '100%', padding: '12px 16px', cursor: 'pointer', backgroundColor: 'var(--muidocs-palette-primaryDark-800)', border: '1px solid', borderColor: 'var(--muidocs-palette-grey-800)', borderRadius: 'var(--border-radius)', boxShadow: 'var(--formControl-shadow), inset 0px 4px 4px rgba(205, 210, 215, 0.3)', fontFamily: 'var(--muidocs-font-family)', fontSize: '0.875rem', fontWeight: 600, color: 'var(--muidocs-palette-grey-200)', lineHeight: 21 / 14, '&:hover': { backgroundColor: 'var(--muidocs-palette-primaryDark-600)', color: 'var(--muidocs-palette-primary-50)', }, '&:focus-visible': { outline: '3px solid var(--muidocs-palette-primary-300)', }, '[data-mui-color-scheme="dark"] &': { color: 'var(--muidocs-palette-primary-100)', boxShadow: 'var(--formControl-shadow), inset 0px 4px 4px rgba(205, 210, 215, 0.05)', '&:hover': { color: 'var(--muidocs-palette-primary-50)', backgroundColor: 'var(--muidocs-palette-primaryDark-700)', }, }, }); const StyledPopper = styled(Popper)({ zIndex: 1, }); const MenuRoot = styled('div')({ zIndex: 1, }); const StyledListbox = styled('ul')({ '--_listbox-radius': 'min(var(--border-radius), 12px)', width: 'calc(320px - 1rem)', maxHeight: 'calc(320px - 1rem)', overflow: 'auto', display: 'flex', flexDirection: 'column', border: 'var(--border-width) solid', borderColor: 'var(--Select-ringColor, var(--border-color))', borderRadius: 'var(--_listbox-radius)', backgroundColor: 'var(--muidocs-palette-background-paper)', boxShadow: '0px 4px 40px rgba(62, 80, 96, 0.1)', padding: 'calc(var(--Select-spacing) * 0.5)', gap: 'calc(var(--Select-spacing) * 0.2)', fontFamily: 'var(--muidocs-font-family)', fontSize: '0.875rem', lineHeight: 21 / 14, margin: '6px 0', '& li': { display: 'flex', borderRadius: '12px', '&[role="none"]': { flexDirection: 'column', padding: 0, '& > ul': { padding: 0, }, }, '&[role="presentation"]': { fontSize: '0.625rem', color: 'var(--muidocs-palette-text-tertiary)', fontWeight: 'bold', textTransform: 'uppercase', letterSpacing: '1px', alignItems: 'center', minHeight: 0, paddingBottom: '0.5rem', }, '&[role="option"]': { boxSizing: 'border-box', border: 'var(--border-width) solid transparent', padding: 'calc(var(--Select-spacing) * 0.5)', fontSize: '0.875rem', fontWeight: 500, color: 'var(--muidocs-palette-text-secondary)', alignItems: 'center', cursor: 'pointer', borderRadius: 'calc(var(--_listbox-radius) - var(--Select-spacing) * 0.05)', '&:hover, &.MuiOption-highlighted': { backgroundColor: 'var(--Option-hoverBackground, var(--muidocs-palette-grey-50))', color: 'var(--muidocs-palette-text-primary)', }, '&.Mui-selected': { backgroundColor: 'var(--Option-selectedBackground, var(--muidocs-palette-grey-50))', borderColor: 'var(--border-color)', color: 'var(--muidocs-palette-text-primary)', }, '& svg:first-child': { color: 'var(--muidocs-palette-primary-main)', marginRight: 'var(--Select-spacing)', fontSize: '1.125rem', }, }, }, }); const marks = [ { value: 0, label: '0°C', }, { value: 25, label: '25°C', }, { value: 50, label: '50°C', }, { value: 75, label: '75°C', }, { value: 100, label: '100°C', }, ]; function valuetext(value: number) { return `${value}°C`; } const StyledSlider = styled(Slider)(` --_margin: 4px; color: var(--color-primary); height: 8px; width: 100%; max-width: calc(100% - var(--_margin)); padding: 16px 0; margin: 0 var(--_margin); display: inline-block; position: relative; cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent; &:hover { opacity: 1; } & .${sliderClasses.rail} { display: block; position: absolute; width: 100%; height: 4px; border-radius: var(--border-radius); background-color: var(--color-primary-light) } & .${sliderClasses.track} { display: block; position: absolute; height: 4px; border-radius: var(--border-radius); background-color: currentColor; } & .${sliderClasses.thumb} { position: absolute; width: 16px; height: 16px; margin-left: -6px; margin-top: -6px; box-sizing: border-box; border-radius: var(--border-radius); outline: 0; border: 4px solid currentColor; background-color: #fff; :hover, &.${sliderClasses.focusVisible} { box-shadow: 0 0 0 0.25rem var(--Slider-thumb-focus); } &.${sliderClasses.active} { box-shadow: 0 0 0 0.25rem var(--Slider-thumb-focus); } } & .${sliderClasses.mark} { position: absolute; width: 8px; height: 8px; border-radius: var(--border-radius); background-color: var(--color-primary-light); top: 44%; transform: translateX(-50%); } & .${sliderClasses.markActive} { background-color: var(--color-primary); } & .${sliderClasses.markLabel} { font-weight: 600; font-size: 10px; position: absolute; top: 24px; transform: translateX(-50%); margin-top: 8px; &[data-index="0"] { transform: translateX(calc(-1 * var(--_margin))); } &[data-index="4"] { transform: translate(-100%); } } `); const StyledSwitch = styled('span')(` font-size: 0; position: relative; display: inline-block; width: 34px; height: 20px; cursor: pointer; &.${switchClasses.disabled} { opacity: 0.4; cursor: not-allowed; } & .${switchClasses.track} { background: var(--Switch-background, var(--muidocs-palette-grey-300)); border-radius: max(2px, var(--border-radius) * 4); display: block; height: 100%; width: 100%; position: absolute; } & .${switchClasses.thumb} { display: block; width: 14px; height: 14px; top: 3px; left: 3px; border-radius: max(2px, var(--border-radius)); background-color: #fff; position: relative; transition-property: left; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 120ms; } &.${switchClasses.focusVisible} { border-radius: max(2px, var(--border-radius) * 4); outline: 3px solid var(--muidocs-palette-primary-300); } &.${switchClasses.checked} { .${switchClasses.thumb} { left: 17px; top: 3px; background-color: #fff; } .${switchClasses.track} { background: var(--muidocs-palette-primary-500); } } & .${switchClasses.input} { cursor: inherit; position: absolute; width: 100%; height: 100%; top: 0; left: 0; opacity: 0; z-index: 1; margin: 0; } `); const Backdrop = React.forwardRef<HTMLDivElement, { open?: boolean; className: string }>( (props, ref) => { const { open, className, ...other } = props; return <div className={clsx({ 'MuiBackdrop-open': open }, className)} ref={ref} {...other} />; }, ); const StyledModal = styled(Modal)` position: fixed; z-index: 1300; inset: 0; display: flex; align-items: center; justify-content: center; &.${modalClasses.hidden} { visibility: hidden; } `; const StyledBackdrop = styled(Backdrop)` z-index: -1; position: fixed; inset: 0; background-color: rgb(0 0 0 / 0.5); -webkit-tap-highlight-color: transparent; opacity: ${({ open }) => (open ? 1 : 0)}; transition: opacity 0.3s ease; `; const AnimatedElement = React.forwardRef(function AnimatedElement( props: { in?: boolean; onEnter?: () => void; onExited?: () => void; children: React.ReactNode; }, ref: React.ForwardedRef<HTMLDivElement>, ) { const { in: inProp, onEnter = () => {}, onExited = () => {}, ...other } = props; React.useEffect(() => { if (inProp) { onEnter(); } }, [inProp, onEnter]); const handleTransitionEnd = React.useCallback(() => { if (!inProp) { onExited(); } }, [inProp, onExited]); return <div onTransitionEnd={handleTransitionEnd} data-open={inProp} {...other} ref={ref} />; }); const Dialog = styled(AnimatedElement)({ backgroundColor: 'var(--muidocs-palette-background-paper)', borderRadius: 'min(var(--border-radius) * 2, 32px)', border: 'var(--border-width) solid', borderColor: 'var(--border-color)', overflow: 'hidden', padding: '1.5rem', textAlign: 'center', outline: 'none', maxWidth: 500, width: 'auto', transform: 'translateY(8px)', opacity: 0, transition: 'opacity 0.2s ease-out, transform 0.2s ease-out', '&[data-open="true"]': { transform: 'translateY(0)', opacity: 1, boxShadow: 'var(--Panel-shadow)', transition: 'opacity 0.3s ease, transform 0.3s ease', }, }); const StyledBadge = styled(Badge)( ({ theme }) => ` box-sizing: border-box; list-style: none; font-family: IBM Plex Sans, sans-serif; position: relative; display: inline-block; & .${badgeClasses.badge} { --_scale: 1.5em; z-index: auto; position: absolute; top: 0; right: 0; font-size: 0.75rem; border-radius: var(--_scale); line-height: var(--_scale); width: var(--_scale); height: var(--_scale); color: #fff; font-weight: 600; white-space: nowrap; text-align: center; background: var(--muidocs-palette-error-main); outline: 3px solid ${ theme.palette.mode === 'dark' ? 'var(--muidocs-palette-primaryDark-900)' : '#FFF' }; transform: translate(50%, -50%); transform-origin: 100% 0; } `, ); const StyledMenuItem = styled(MenuItem)( ({ theme }) => ` list-style: none; padding: 6px 8px; margin: 4px 0; border-radius: 8px; cursor: default; user-select: none; border-radius: min(var(--border-radius), 8px); font-weight: 500; &:last-of-type { border-bottom: none; } &.${menuItemClasses.focusVisible} { outline: 3px solid var(--muidocs-palette-primary-300); background-color: ${ theme.palette.mode === 'dark' ? 'var(--muidocs-palette-grey-800)' : 'var(--muidocs-palette-grey-50)' }; } &:hover:not(.${menuItemClasses.disabled}) { background-color: ${ theme.palette.mode === 'dark' ? 'var(--muidocs-palette-grey-800)' : 'var(--muidocs-palette-grey-50)' }; color: ${ theme.palette.mode === 'dark' ? 'var(--muidocs-palette-grey-300)' : 'var(--muidocs-palette-grey-900)' }; } `, ); const StyledMenuListbox = styled('ul')(` font-family: IBM Plex Sans, sans-serif; font-size: 0.875rem; box-sizing: border-box; padding: 6px; margin: 12px 0; min-width: 230px; border-radius: 12px; overflow: auto; outline: 0px; background-color: var(--muidocs-palette-background-paper); border-radius: min(var(--border-radius), 16px); border: var(--border-width) solid; border-color: var(--border-color); box-shadow: var(--Panel-shadow); `); const StyledMenuButton = styled(MenuButton)({ padding: 0, cursor: 'pointer', border: 'none', background: 'transparent', borderRadius: 'var(--avatar-radius)', '&:focus-visible': { outline: '3px solid var(--muidocs-palette-primary-300)', }, }); const snackbarInRight = keyframes` from { transform: translateX(100%); } to { transform: translateX(0); } `; const StyledSnackbar = styled(Snackbar)(css` background-color: var(--muidocs-palette-background-paper); border-radius: min(var(--border-radius), 32px); border: var(--border-width) solid; border-color: var(--border-color); box-shadow: var(--Panel-shadow); position: fixed; z-index: 1200; display: flex; justify-content: start; align-items: center; gap: 1rem; right: 16px; bottom: 16px; left: auto; max-width: 560px; min-width: 300px; padding: 0.75rem 1rem; animation: ${snackbarInRight} 200ms; transition: transform 0.2s ease-out; & svg { color: var(--muidocs-palette-success-600); } & [data-title] { font-size: 0.875rem; font-weight: 600; } & [data-description] { color: var(--muidocs-palette-text-secondary); font-size: 0.75rem; font-weight: 500; } `); const StyledInputElement = styled('input')({ marginTop: '8px', width: '100%', maxWidth: '100%', border: 'var(--border-width, 1px) solid', borderColor: 'var(--Select-ringColor, var(--border-color))', borderRadius: 'var(--border-radius)', padding: '8px 12px', backgroundColor: 'var(--Select-background)', display: 'flex', color: 'var(--muidocs-palette-text-secondary)', alignItems: 'center', fontSize: '0.875rem', fontFamily: 'var(--muidocs-font-family)', lineHeight: 21 / 14, boxShadow: 'var(--formControl-shadow, 0px 2px 2px rgba(205, 210, 215, 0.3))', '&:hover': { borderColor: 'var(--Input-border)', }, '&:focus': { borderColor: 'var(--Input-border)', boxShadow: 'var(--Input-focus-border)', }, '&:focus-visible': { // Firefox outline: 0, }, }); // Input const CustomInput = React.forwardRef(function CustomInput( props: InputProps, ref: React.ForwardedRef<HTMLDivElement>, ) { return <Input slots={{ input: StyledInputElement }} {...props} ref={ref} />; }); export default function BaseUIThemesDemo() { const [design, setDesign] = React.useState(0); // Modal const [openModal, setOpenModal] = React.useState(false); const handleOpenModal = () => setOpenModal(true); const handleCloseModal = () => setOpenModal(false); // Snackbar const [openSnackbar, setOpenSnackbar] = React.useState(false); const handleCloseSnackbar = (_: any, reason: SnackbarCloseReason) => { if (reason === 'clickaway') { return; } setOpenSnackbar(false); }; const handleClickSnackbar = () => { setOpenSnackbar(true); }; // Menu const [isOpenMenu, setOpenMenu] = React.useState(false); return ( <Fade in timeout={700}> <Panel sx={{ ...heroVariables[design] }}> <Tabs value={design} onChange={(event, newValue) => setDesign(newValue as number)}> <TabsList slots={{ root: StyledTabsList }}> <Tab slots={{ root: StyledTab }} value={0}> <AutoAwesomeRounded sx={{ fontSize: 15 }} /> Sleek </Tab> <Tab slots={{ root: StyledTab }} value={1}> <RadioRoundedIcon sx={{ fontSize: 15 }} /> Retro </Tab> <Tab slots={{ root: StyledTab }} value={2}> <InterestsRoundedIcon sx={{ fontSize: 15 }} /> Playful </Tab> </TabsList> </Tabs> {/* Notification component */} <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', p: '1rem', borderBottom: 'var(--border-width) solid var(--border-color)', }} > <StyledParagraph>Notifications</StyledParagraph> <Dropdown open={isOpenMenu} onOpenChange={(_, open) => { setOpenMenu(open); }} > <StyledMenuButton> <StyledBadge badgeContent={5}> <Box component="img" alt="Michał Dudak, the leading engineer for Base UI." src="/static/branding/about/michał-dudak.png" sx={{ display: 'inline-block', verticalAlign: 'middle', height: 32, width: 32, borderRadius: 'var(--avatar-radius)', border: 'var(--border-width) solid var(--border-color)', background: 'var(--color-primary-light)', '&:hover': { background: 'var(--color-primary)', }, }} /> </StyledBadge> </StyledMenuButton> <Menu slots={{ root: MenuRoot, listbox: StyledMenuListbox }} slotProps={{ root: { disablePortal: true }, listbox: { id: 'simple-menu' } }} > <StyledLabelCategory>Notification menu</StyledLabelCategory> <CustomInput aria-label="Demo input" placeholder="Search for a component…" /> <StyledMenuItem>Request a component</StyledMenuItem> <StyledMenuItem>Get started</StyledMenuItem> <StyledMenuItem>View all</StyledMenuItem> </Menu> </Dropdown> </Box> {/* Select component */} <Box sx={{ p: '1rem 1rem 1.5rem 1rem', display: 'flex', flexDirection: 'column', borderBottom: 'var(--border-width) solid var(--border-color)', }} > <StyledLabel htmlFor="base-ui-select">Select a component</StyledLabel> <Select id="base-ui-select" name="base-ui-select" defaultValue={10} slots={{ root: StyledSelectButton, popper: StyledPopper, listbox: StyledListbox, }} slotProps={{ popper: { disablePortal: true, }, }} > <StyledLabelCategory>Input</StyledLabelCategory> <Option value={10}> <AutoAwesomeRounded fontSize="small" /> Autocomplete </Option> <Option value={20}> <SmartButtonRounded fontSize="small" /> Button </Option> <Option value={30}> <InputRounded fontSize="small" /> Input </Option> <Option value={40}> <PlaylistAddCheckRounded fontSize="small" /> Select </Option> <Option value={50}> <ToggleOnRoundedIcon fontSize="small" /> Switch </Option> <Option value={60}> <LinearScaleRounded fontSize="small" /> Slider </Option> <StyledLabelCategory>Data display</StyledLabelCategory> <Option value={70}> <CircleNotificationsRounded fontSize="small" /> Badge </Option> <StyledLabelCategory>Feedback</StyledLabelCategory> <Option value={80}> <ReportGmailerrorredRounded fontSize="small" /> Snackbar </Option> <StyledLabelCategory>Navigation</StyledLabelCategory> <Option value={90}> <MenuOpenRounded fontSize="small" /> Menu </Option> <Option value={100}> <FirstPageRounded fontSize="small" /> Table Pagination </Option> <Option value={110}> <TabRounded fontSize="small" /> Tabs </Option> </Select> </Box> {/* Slider component */} <Box sx={{ px: '1rem', pt: '1rem', pb: '1.5rem', borderBottom: 'var(--border-width) solid var(--border-color)', }} > <StyledLabel>Choose a temperature</StyledLabel> <StyledSlider aria-label="Temperature" defaultValue={37} getAriaValueText={valuetext} marks={marks} /> </Box> {/* Switch component */} <Box sx={{ p: '1rem', display: 'flex', flexDirection: 'column', gap: '1rem', borderBottom: 'var(--border-width) solid var(--border-color)', }} > <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}> <StyledSwitchLabel id="make-it-your-own">Make it your own</StyledSwitchLabel> <Switch slots={{ root: StyledSwitch, }} slotProps={{ input: { 'aria-labelledby': 'make-it-your-own' }, }} defaultChecked /> </Box> <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}> <StyledSwitchLabel id="use-every-component">Use every component</StyledSwitchLabel> <Switch slots={{ root: StyledSwitch, }} slotProps={{ input: { 'aria-labelledby': 'use-every-component' }, }} /> </Box> </Box> {/* Modal and Snackbar component */} <Box sx={{ display: 'flex', p: '1rem', gap: '0.5rem', borderBottom: 'var(--border-width) solid var(--border-color)', '& > button': { flex: 1 }, }} > <StyledModalButton type="button" onClick={handleOpenModal}> View modal </StyledModalButton> <StyledModal disablePortal aria-labelledby="unstyled-modal-title" aria-describedby="unstyled-modal-description" open={openModal} onClose={handleCloseModal} closeAfterTransition slots={{ backdrop: StyledBackdrop }} keepMounted > <Dialog in={openModal}> <Box component="h2" id="unstyled-modal-title" sx={{ mt: 1, mb: 0.5, textWrap: 'balance' }} > Oh, hey, this is a Base UI modal. </Box> <Box component="p" id="unstyled-modal-description" sx={{ m: 0, mb: 4, color: 'text.secondary', textWrap: 'balance' }} > Base UI modals manages modal stacking when more than one is needed, creates a backdrop to disable interaction with the rest of the app, and a lot more. </Box> <StyledSnackbarButton onClick={handleCloseModal}>Close</StyledSnackbarButton> </Dialog> </StyledModal> <StyledSnackbarButton type="button" onClick={handleClickSnackbar}> View snackbar </StyledSnackbarButton> <StyledSnackbar open={openSnackbar} autoHideDuration={5000} onClose={handleCloseSnackbar}> <CheckCircleRoundedIcon fontSize="small" /> <div> <div data-title>This is a Base UI snackbar.</div> <div data-description>Free to design as you want it.</div> </div> </StyledSnackbar> </Box> {/* Button "View all components" component */} <Box sx={{ display: 'flex', p: '1rem', gap: '0.5rem', '& > button': { flex: 1 } }}> <StyledViewCode href={ROUTES.baseComponents}> View all components <ChevronRightRoundedIcon fontSize="small" /> </StyledViewCode> </Box> </Panel> </Fade> ); }
5,179
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productBaseUI/heroVariables.ts
const sleek = { // tokens '--color-primary': 'var(--muidocs-palette-primary-main)', '--color-primary-light': 'var(--muidocs-palette-primary-100)', '--border-width': '1px', '--border-color': 'var(--muidocs-palette-grey-200)', '--border-radius': '8px', '--avatar-radius': '99px', // components '--Panel-shadow': '0 4px 40px 0 rgba(62, 80, 96, 0.15)', '--Tab-radius': '12px', '--Tab-hoverBackground': 'var(--muidocs-palette-grey-50)', '--Tab-activeSelector': 'calc(-5 * min(2px, var(--border-width, 0px)))', '--Select-radius': '12px', '--Select-spacing': '12px', '--Input-border': 'var(--muidocs-palette-primary-400)', '--Input-focus-border': '0 0 0 3px var(--muidocs-palette-primary-200)', '--Slider-thumb-focus': 'rgba(0, 127, 255, 0.2)', '--formControl-shadow': '0px 2px 2px rgb(205 210 215 / 20%)', '[data-mui-color-scheme="dark"] &': { // dark tokens '--color-primary': 'var(--muidocs-palette-primary-light)', '--color-primary-light': 'var(--muidocs-palette-primaryDark-600)', '--border-color': 'var(--muidocs-palette-primaryDark-700)', '--formControl-shadow': '0px 2px 2px rgb(0 0 0 / 80%)', // dark components '--Panel-shadow': '0 4px 40px 0 rgba(0, 0, 0, 0.15)', '--Select-background': 'var(--muidocs-palette-primaryDark-800)', '--Tab-hoverBackground': 'var(--muidocs-palette-primaryDark-700)', '--Option-selectedBackground': 'var(--muidocs-palette-primaryDark-800)', '--Option-hoverBackground': 'var(--muidocs-palette-grey-900)', '--Switch-background': 'var(--muidocs-palette-grey-700)', '--Input-border': '0px 2px 2px var(--muidocs-palette-primary-dark)', '--Input-focus-border': '0 0 0 3px var(--muidocs-palette-primary-600)', '--Slider-thumb-focus': 'rgba(0, 127, 255, 0.6)', }, }; const retro = { // tokens '--color-primary': 'var(--muidocs-palette-primary-main)', '--color-primary-light': 'var(--muidocs-palette-primary-100)', '--border-width': '1px', '--border-color': 'var(--muidocs-palette-grey-900)', '--avatar-radius': '2px', // components '--Panel-shadow': '-8px 8px 0 0 var(--muidocs-palette-grey-800)', '--Tab-radius': '0', '--TabsList-background': 'var(--muidocs-palette-primary-50)', '--Tab-hoverBackground': 'var(--muidocs-palette-grey-100)', '--Tab-activeSelector': 'calc(-5 * min(2px, var(--border-width, 0px)))', '--Select-radius': '0px', '--Select-spacing': '12px', '--Select-background': 'var(--muidocs-palette-grey-50)', '--Input-border': 'var(--muidocs-palette-primary-400)', '--Input-focus-border': '0 0 0 3px var(--muidocs-palette-primary-200)', '--Slider-thumb-focus': 'rgba(0, 127, 255, 0.2)', '& *': { fontFamily: 'Menlo,Consolas,"Droid Sans Mono",monospace', }, '[data-mui-color-scheme="dark"] &': { // dark tokens '--color-primary': 'var(--muidocs-palette-primary-light)', '--color-primary-light': 'var(--muidocs-palette-primaryDark-600)', '--border-color': 'var(--muidocs-palette-primaryDark-500)', '--formControl-shadow': '0px 2px 2px rgb(0 0 0 / 80%)', // dark components '--Panel-shadow': '-8px 8px 0 0 var(--muidocs-palette-primaryDark-700)', '--TabsList-background': 'var(--muidocs-palette-primaryDark-700)', '--Tab-hoverBackground': 'var(--muidocs-palette-primaryDark-600)', '--Select-background': 'var(--muidocs-palette-grey-900)', '--Option-selectedBackground': 'var(--muidocs-palette-grey-800)', '--Option-hoverBackground': 'var(--muidocs-palette-grey-900)', '--Switch-background': 'var(--muidocs-palette-grey-700)', '--Input-border': '0px 2px 2px var(--muidocs-palette-primary-dark)', '--Input-focus-border': '0 0 0 3px var(--muidocs-palette-primary-600)', '--Slider-thumb-focus': 'rgba(0, 127, 255, 0.6)', }, }; const playful = { // tokens '--color-primary': 'var(--muidocs-palette-primary-main)', '--color-primary-light': 'var(--muidocs-palette-primary-100)', '--border-radius': '24px', '--border-width': '2px', '--border-color': 'var(--muidocs-palette-primary-200)', '--avatar-radius': '999px', // components '--Panel-shadow': '0 4px 40px 0 rgba(51, 153, 255, 0.2)', '--Tab-radius': '999px', '--Tab-activeSelector': 'calc(-3 * min(2px, var(--border-width, 0px)))', '--Select-spacing': '12px', '--Select-ringColor': 'var(--muidocs-palette-grey-400)', '--Option-selectedBackground': 'var(--muidocs-palette-primary-50)', '--TabsList-background': 'var(--muidocs-palette-primary-50)', '--Tab-hoverBackground': 'var(--muidocs-palette-primary-100)', '--Input-border': 'var(--muidocs-palette-primary-400)', '--Input-focus-border': '0 0 0 3px var(--muidocs-palette-primary-200)', '--Slider-thumb-focus': 'rgba(0, 127, 255, 0.2)', '& *': { fontFamily: 'Poppins, sans-serif', }, '[data-mui-color-scheme="dark"] &': { // dark tokens '--color-primary': 'var(--muidocs-palette-primary-light)', '--color-primary-light': 'var(--muidocs-palette-primaryDark-600)', '--border-color': 'var(--muidocs-palette-primary-700)', '--formControl-shadow': '0px 2px 2px rgb(0 0 0 / 80%)', // dark components '--TabsList-background': 'var(--muidocs-palette-primary-900)', '--Tab-hoverBackground': 'var(--muidocs-palette-primary-800)', '--Select-ringColor': 'var(--muidocs-palette-grey-700)', '--Option-selectedBackground': 'var(--muidocs-palette-primary-900)', '--Option-hoverBackground': 'var(--muidocs-palette-grey-900)', '--Switch-background': 'var(--muidocs-palette-grey-700)', '--Input-border': '0px 2px 2px var(--muidocs-palette-primary-dark)', '--Input-focus-border': '0 0 0 3px var(--muidocs-palette-primary-600)', '--Slider-thumb-focus': 'rgba(0, 127, 255, 0.6)', }, }; export default [sleek, retro, playful];
5,180
0
petrpan-code/mui/material-ui/docs/src/components/productBaseUI
petrpan-code/mui/material-ui/docs/src/components/productBaseUI/components/BaseButtonDemo.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import { Button } from '@mui/base/Button'; import { styled, GlobalStyles } from '@mui/system'; const buttonStyles = ` font-family: IBM Plex Sans, sans-serif; font-weight: bold; font-size: 0.875rem; background-color: var(--palette-primary); padding: 10px 16px; border-radius: 8px; color: white; transition: all 150ms ease; cursor: pointer; border: none; box-shadow: var(--shadow); &:hover { background-color: var(--palette-primary-hover); } &.Mui-active { background-color: var(--palette-primary-dark); } &.Mui-focusVisible { outline: 4px solid var(--focus-ring); } &.Mui-disabled { opacity: 0.5; cursor: not-allowed; } `; const StyledButton = styled('button')(buttonStyles); export default function BaseButtonDemo({ styling, }: { styling?: 'system' | 'tailwindcss' | 'css'; }) { return ( <Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', minHeight: 144, gap: 2, py: 3, }} > {styling === 'system' && ( <React.Fragment> <Button slots={{ root: StyledButton }}>Button</Button> <Button disabled slots={{ root: StyledButton }}> Disabled </Button> </React.Fragment> )} {styling === 'css' && ( <React.Fragment> <GlobalStyles styles={`.MuiButton-root {${buttonStyles}}`} /> <Button>Button</Button> <Button disabled>Disabled</Button> </React.Fragment> )} {styling === 'tailwindcss' && ( <React.Fragment> <Button className="transition-all-[150ms_ease] shaodw-[--shadow] cursor-pointer rounded-[8px] border-none bg-[--palette-primary] p-[10px_16px] text-[0.875rem] font-bold text-white transition [font-family:IBM_Plex_sans] hover:bg-[--palette-primary-hover] ui-active:bg-[--palette-primary-dark] ui-disabled:cursor-not-allowed ui-disabled:opacity-50 ui-focus-visible:[outline:4px_solid_var(--focus-ring)]"> Button </Button> <Button disabled className="transition-all-[150ms_ease] cursor-pointer rounded-[8px] border-none bg-[--palette-primary] p-[10px_16px] text-[0.875rem] font-bold text-white [font-family:IBM_Plex_sans] ui-active:bg-[--palette-primary-dark] ui-disabled:cursor-not-allowed ui-disabled:opacity-50 ui-focus-visible:[outline:4px_solid_var(--focus-ring)]" > Disabled </Button> </React.Fragment> )} </Box> ); } BaseButtonDemo.getCode = (styling?: 'system' | 'tailwindcss' | 'css') => { if (styling === 'system') { return `import { Button } from '@mui/base/Button'; import { styled } from '@mui/system'; const StyledButton = styled('button')\`${buttonStyles}\`; <Button slots={{ root: StyledButton }}>Button</Button> <Button slots={{ root: StyledButton }}>Disabled</Button> `; } if (styling === 'css') { return `import { Button } from '@mui/base/Button'; import './styles.css'; <Button>Button</Button> <Button disabled>Disabled</Button> /* styles.css */ .MuiButton-root {${buttonStyles}} `; } if (styling === 'tailwindcss') { return `import { Button } from '@mui/base/Button'; <Button className="transition-all-[150ms_ease] cursor-pointer rounded-[8px] border-none bg-[--palette-primary] p-[10px_16px] text-[0.875rem] font-bold text-white [font-family:IBM_Plex_sans] hover:bg-[--palette-primary-hover] shadow-[--shadow] ui-active:bg-[--palette-primary-dark] ui-disabled:cursor-not-allowed ui-disabled:opacity-50 ui-focus-visible:[outline:4px_solid_var(--focus-ring) transition"> Button </Button> <Button className="transition-all-[150ms_ease] cursor-pointer rounded-[8px] border-none bg-[--palette-primary] p-[10px_16px] text-[0.875rem] font-bold text-white [font-family:IBM_Plex_sans] ui-active:bg-[--palette-primary-dark] ui-disabled:cursor-not-allowed ui-disabled:opacity-50 ui-focus-visible:[outline:4px_solid_var(--focus-ring)]"> Disabled </Button>`; } return ``; };
5,181
0
petrpan-code/mui/material-ui/docs/src/components/productBaseUI
petrpan-code/mui/material-ui/docs/src/components/productBaseUI/components/BaseInputDemo.tsx
import * as React from 'react'; import clsx from 'clsx'; import { unstable_useId } from '@mui/material/utils'; import Box from '@mui/material/Box'; import { Input as InputUnstyled } from '@mui/base/Input'; import { styled, GlobalStyles } from '@mui/system'; const fieldStyles = ` --TextInput-height: 64px; --TextInput-paddingTop: 2rem; --TextInput-labelLineHeight: 20px; --TextInput-labelScale: 0.75; width: 320px; padding: 0px 0.75rem; display: inline-flex; position: relative; height: var(--TextInput-height); background: var(--muidocs-palette-background-paper); border: 1px solid; border-color: var(--muidocs-palette-grey-300); border-radius: var(--muidocs-shape-borderRadius); outline-color: transparent; box-shadow: var(--shadow); &:hover { border-color: var(--muidocs-palette-grey-400); } &:focus-within { border-color: var(--palette-primary); outline: 3px solid; outline-color: var(--focus-ring); & label { color: var(--palette-primary) !important; } } & label { line-height: var(--TextInput-labelLineHeight); position: absolute; display: flex; align-items: center; top: 50%; left: 0.75rem; overflow: hidden; text-align: start; text-overflow: ellipsis; font-weight: 500; color: var(--muidocs-palette-grey-600); white-space: nowrap; pointer-events: none; transform-origin: 0 0; transform: translateY(-50%); transition: transform 0.1s ease-out; } :where([data-mui-color-scheme='dark']) & { border-color: var(--muidocs-palette-grey-800); box-shadow: var(--shadow); &:hover { border-color: var(--muidocs-palette-grey-700); } &:focus-within { border-color: var(--palette-primary); outline-color: var(--focus-ring); } } `; const Field = styled('div')(fieldStyles); const inputStyles = ` border: none; padding: var(--TextInput-paddingTop) 0 0.75rem; height: 100%; font-size: 1rem; background: unset; flex: 1; &:focus { outline: none; } &:not(:focus)::placeholder { color: transparent; } &:not(:placeholder-shown) ~ label, &:focus ~ label { transform: translateY(-100%) scale(var(--TextInput-labelScale)); font-weight: 600; } `; const StyledInput = styled('input')(inputStyles); const CSS = `.MuiInput-root {${fieldStyles}} .MuiInput-input {${inputStyles}}`; const StyledFloatingLabelInput = React.forwardRef<HTMLInputElement, JSX.IntrinsicElements['input']>( function StyledFloatingLabelInput(props, ref) { const id = unstable_useId(props.id); return ( <React.Fragment> <StyledInput ref={ref} {...props} id={id} /> <label htmlFor={id}>Floating label</label> </React.Fragment> ); }, ); const FloatingLabelInput = React.forwardRef<HTMLInputElement, JSX.IntrinsicElements['input']>( function FloatingLabelInput(props, ref) { const id = unstable_useId(props.id); return ( <React.Fragment> <input ref={ref} {...props} id={id} /> <label htmlFor={id}>Floating label</label> </React.Fragment> ); }, ); const TailwindFloatingLabelInput = React.forwardRef< HTMLInputElement, JSX.IntrinsicElements['input'] // @ts-ignore >(function TailwindFloatingLabelInput({ ownerState, ...props }, ref) { const id = unstable_useId(props.id); return ( <React.Fragment> <input ref={ref} {...props} className={clsx( 'peer h-full flex-1 border-none bg-transparent px-3 pb-[0.75rem] pt-[--TextInput-paddingTop] font-sans text-base placeholder-transparent focus:outline-none focus:ring-0', props.className, )} id={id} /> <label htmlFor={id} className="pointer-events-none absolute left-[0.75rem] top-[50%] flex origin-[0_0] translate-y-[-100%] scale-[--TextInput-labelScale] transform items-center overflow-hidden whitespace-nowrap text-start font-[500] leading-[--TextInput-labelLineHeight] text-[--muidocs-palette-grey-600] transition-transform duration-100 ease-out peer-placeholder-shown:translate-y-[-50%] peer-placeholder-shown:scale-100 peer-placeholder-shown:transform peer-focus:translate-y-[-100%] peer-focus:scale-[--TextInput-labelScale] peer-focus:transform peer-focus:text-[--palette-primary] " > Floating label </label> </React.Fragment> ); }); export default function BaseInputDemo({ styling }: { styling?: 'system' | 'tailwindcss' | 'css' }) { return ( <Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', minHeight: 144, gap: 2, py: 5, }} > {styling === 'system' && ( <InputUnstyled placeholder="Type something here" slots={{ root: Field, input: StyledFloatingLabelInput, }} /> )} {styling === 'css' && ( <React.Fragment> <GlobalStyles styles={CSS} /> <InputUnstyled placeholder="Type something here" slots={{ input: FloatingLabelInput }} /> </React.Fragment> )} {styling === 'tailwindcss' && ( <InputUnstyled placeholder="Type something here" className=" p-[0px_0.75rem][box-shadow:var(--shadow)] relative inline-flex h-[--TextInput-height] w-[320px] rounded-[--muidocs-shape-borderRadius] border border-solid border-[--muidocs-palette-grey-300] bg-[--muidocs-palette-background-paper] outline-transparent [--TextInput-height:64px] [--TextInput-labelLineHeight:20px] [--TextInput-labelScale:0.75] [--TextInput-paddingTop:2rem] focus-within:!border-[--palette-primary] focus-within:[outline:3px_solid_var(--focus-ring)] hover:border-[--muidocs-palette-grey-400] dark:border-[--muidocs-palette-grey-800] dark:shadow-[0_2px_4px_0_rgba(0_0_0/0.8)] dark:focus-within:!border-[--palette-primary] dark:focus-within:[outline:3px_solid_var(--focus-ring)] dark:hover:border-[--muidocs-palette-grey-700]" slots={{ input: TailwindFloatingLabelInput }} /> )} </Box> ); } BaseInputDemo.getCode = (styling?: 'system' | 'tailwindcss' | 'css') => { if (styling === 'system') { return `import { Input } from '@mui/base/Input'; const Field = styled('div')\`${fieldStyles}\`; const StyledInput = styled('input')\`${inputStyles}/\`; const FloatingLabelInput = React.forwardRef< HTMLInputElement, JSX.IntrinsicElements['input'] >( function FloatingLabelInput(props, ref) { const id = unstable_useId(props.id); return ( <React.Fragment> <StyledInput ref={ref} {...props} id={id} /> <label htmlFor={id}>Floating label</label> </React.Fragment> ); }, ); <Input placeholder="Placeholder" slots={{ root: Field, input: FloatingLabelInput, }} /> `; } if (styling === 'css') { return `import { Input } from '@mui/base/Input'; import './styles.css'; const FloatingLabelInput = React.forwardRef< HTMLInputElement, JSX.IntrinsicElements['input'] >( function FloatingLabelInput(props, ref) { const id = unstable_useId(props.id); return ( <React.Fragment> <input ref={ref} {...props} id={id} /> <label htmlFor={id}>Floating label</label> </React.Fragment> ); }, ); <Input placeholder="Placeholder" slots={{ input: FloatingLabelInput }} /> /* styles.css */ ${CSS} `; } if (styling === 'tailwindcss') { return `import { Input } from '@mui/base/Input'; const FloatingLabelInput = React.forwardRef( function FloatingLabelInput({ ownerState, id, ...props }, ref) { const id = id || 'floating-label'; return ( <React.Fragment> <input id={id} ref={ref} {...props} className={clsx( \`peer h-full flex-1 border-none bg-transparent px-3 pb-[0.75rem] pt-[--TextInput-paddingTop] font-sans text-base placeholder-transparent focus:outline-none focus:ring-0\`, props.className, )} id={id} /> <label htmlFor={id} className="pointer-events-none absolute left-[0.75rem] top-[50%] flex origin-[0_0] translate-y-[-100%] scale-[--TextInput-labelScale] transform items-center overflow-hidden whitespace-nowrap text-start font-[500] leading-[--TextInput-labelLineHeight] text-[--muidocs-palette-grey-600] transition-transform duration-100 ease-out peer-placeholder-shown:translate-y-[-50%] peer-placeholder-shown:scale-100 peer-placeholder-shown:transform peer-focus:translate-y-[-100%] peer-focus:scale-[--TextInput-labelScale] peer-focus:transform peer-focus:text-[--palette-primary]" > Floating label </label> </React.Fragment> ); }); <InputUnstyled placeholder="Type something here" className="relative inline-flex h-[--TextInput-height] w-[320px] rounded-[--muidocs-shape-borderRadius] border border-solid border-[--muidocs-palette-grey-300] bg-[--muidocs-palette-background-paper] p-[0px_0.75rem] [box-shadow:var(--shadow)] outline-transparent [--TextInput-height:64px] [--TextInput-labelLineHeight:20px] [--TextInput-labelScale:0.75] [--TextInput-paddingTop:2rem] focus-within:!border-[--palette-primary] focus-within:[outline:3px_solid_var(--focus-ring)] hover:border-[--muidocs-palette-grey-400] dark:border-transparent dark:shadow-[0_2px_4px_0_rgba(0_0_0/0.8)] dark:focus-within:!border-[--palette-primary] dark:focus-within:[outline:3px_solid_var(--focus-ring)] dark:hover:border-[--muidocs-palette-grey-700]" slots={{ input: FloatingLabelInput }} /> `; } return ''; };
5,182
0
petrpan-code/mui/material-ui/docs/src/components/productBaseUI
petrpan-code/mui/material-ui/docs/src/components/productBaseUI/components/BaseMenuDemo.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import { Dropdown } from '@mui/base/Dropdown'; import { Menu as MenuUnstyled } from '@mui/base/Menu'; import { MenuButton as MenuButtonUnstyled } from '@mui/base/MenuButton'; import { MenuItem as MenuItemUnstyled } from '@mui/base/MenuItem'; import { styled, GlobalStyles } from '@mui/system'; import Person from '@mui/icons-material/Person'; const buttonStyles = ` display: inline-flex; align-items: center; gap: 0.5rem; font-family: IBM Plex Sans, sans-serif; font-size: 0.875rem; box-sizing: border-box; min-height: calc(1.5em + 22px); border-radius: 8px; padding: 8px 12px 8px 6px; line-height: 1.5; background: var(--muidocs-palette-background-paper); box-shadow: var(--shadow); border: 1px solid; border-color: var(--muidocs-palette-grey-200); color: var(--muidocs-palette-text-primary); transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 120ms; outline-color: transparent; &:hover { background: var(--muidocs-palette-grey-50); } & svg { color: var(--palette-primary); } &.Mui-focusVisible { outline: 3px solid; outline-color: var(--focus-ring); } :where([data-mui-color-scheme='dark']) & { border-color: var(--muidocs-palette-primaryDark-700); &:hover { background: var(--muidocs-palette-primaryDark-800); } } `; const StyledMenuButton = styled('button')(buttonStyles); const popperStyles = ` z-index: 1000; `; const StyledPopup = styled('div')(popperStyles); const listboxStyles = ` margin: 8px 0; padding: 4px; display: flex; flex-direction: column; border-radius: 8px; border: 1px solid; border-color: var(--muidocs-palette-grey-200); background: var(--muidocs-palette-background-paper); box-shadow: 0px 4px 40px rgba(205, 210, 215, 0.5); :where([data-mui-color-scheme='dark']) & { border-color: var(--muidocs-palette-primaryDark-700); box-shadow: 0px 4px 40px rgba(0, 0, 0, 0.5); } `; const StyledListbox = styled('ul')(listboxStyles); const menuItemStyles = ` display: flex; align-items: center; padding: 6px 12px; min-height: 24px; border-radius: 4px; border: 1px solid transparent; gap: 4px; &:hover, &.Mui-focusVisible { cursor: default; outline: none; color: var(--muidocs-palette-text-primary); background: var(--muidocs-palette-grey-50); border-color: var(--muidocs-palette-grey-100); } :where([data-mui-color-scheme='dark']) & { color: var(--muidocs-palette-grey-300); &:hover, &.Mui-focusVisible { color: var(--muidocs-palette-text-primary); background: var(--muidocs-palette-primaryDark-700); border-color: var(--muidocs-palette-primaryDark-500); } } `; const StyledMenuItem = styled('li')(menuItemStyles); const CSS = `.Mui-base.MuiMenuButton-root {${buttonStyles}} .Mui-base.MuiMenu-root {${popperStyles}} .Mui-base.MuiMenu-listbox {${listboxStyles}} .Mui-base.MuiMenuItem-root {${menuItemStyles}}`; export default function BaseMenuDemo({ styling }: { styling?: 'system' | 'tailwindcss' | 'css' }) { return ( <Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', minHeight: 144, gap: 2, py: 3, }} > {styling === 'css' && <GlobalStyles styles={CSS} />} {styling === 'tailwindcss' && ( <Dropdown> <MenuButtonUnstyled className="min-h-[calc(1.5em + 22px)] inline-flex items-center gap-[0.5rem] rounded-[8px] border border-solid border-[--muidocs-palette-grey-200] bg-[--muidocs-palette-background-paper] p-[8px_12px_8px_6px] text-[0.875rem] leading-[1.5] transition-all [box-shadow:var(--shadow)] [font-family:IBM_Plex_sans] hover:bg-[--muidocs-palette-grey-50] ui-focus-visible:[outline:3px_solid_var(--focus-ring)] dark:border-[--muidocs-palette-primaryDark-700] dark:hover:bg-[--muidocs-palette-primaryDark-800]"> <Person className="text-[--palette-primary]" /> My account </MenuButtonUnstyled> <MenuUnstyled slotProps={{ root: { placement: 'bottom', className: 'z-[1000]' }, listbox: { id: 'simple-menu', className: 'mx-0 my-[8px] p-[4px] flex flex-col rounded-[8px] border border-solid border-[--muidocs-palette-grey-200] bg-[--muidocs-palette-background-paper] shadow-[0px_4px_40px_rgba(62,80,96,0.1)] dark:border-[--muidocs-palette-primaryDark-700] dark:shadow-[0px_4px_40px_rgba(11,13,14,0.5)]', }, }} > <MenuItemUnstyled className="hover:color-[--muidocs-palette-text-primary] flex min-h-[24px] items-center gap-[4px] rounded-[4px] border border-solid border-transparent px-[12px] py-[6px] hover:cursor-default hover:border-[--muidocs-palette-grey-100] hover:bg-[--muidocs-palette-grey-50] ui-focus-visible:cursor-default ui-focus-visible:border-[--muidocs-palette-grey-100] ui-focus-visible:bg-[--muidocs-palette-grey-50] ui-focus-visible:outline-none"> Profile </MenuItemUnstyled> <MenuItemUnstyled className="hover:color-[--muidocs-palette-text-primary] flex min-h-[24px] items-center gap-[4px] rounded-[4px] border border-solid border-transparent px-[12px] py-[6px] hover:cursor-default hover:border-[--muidocs-palette-grey-100] hover:bg-[--muidocs-palette-grey-50] ui-focus-visible:cursor-default ui-focus-visible:border-[--muidocs-palette-grey-100] ui-focus-visible:bg-[--muidocs-palette-grey-50] ui-focus-visible:outline-none"> Language settings </MenuItemUnstyled> <MenuItemUnstyled className="hover:color-[--muidocs-palette-text-primary] flex min-h-[24px] items-center gap-[4px] rounded-[4px] border border-solid border-transparent px-[12px] py-[6px] hover:cursor-default hover:border-[--muidocs-palette-grey-100] hover:bg-[--muidocs-palette-grey-50] ui-focus-visible:cursor-default ui-focus-visible:border-[--muidocs-palette-grey-100] ui-focus-visible:bg-[--muidocs-palette-grey-50] ui-focus-visible:outline-none"> Log out </MenuItemUnstyled> </MenuUnstyled> </Dropdown> )} {(styling === 'css' || styling === 'system') && ( <Dropdown> <MenuButtonUnstyled className="Mui-base" slots={{ root: styling !== 'system' ? undefined : StyledMenuButton }} > <Person /> My account </MenuButtonUnstyled> <MenuUnstyled slots={{ root: styling !== 'system' ? undefined : StyledPopup, listbox: styling !== 'system' ? undefined : StyledListbox, }} slotProps={{ root: { placement: 'bottom', className: 'Mui-base' }, listbox: { id: 'simple-menu', className: 'Mui-base' }, }} > <MenuItemUnstyled className="Mui-base" slots={{ root: styling !== 'system' ? undefined : StyledMenuItem }} > Profile </MenuItemUnstyled> <MenuItemUnstyled className="Mui-base" slots={{ root: styling !== 'system' ? undefined : StyledMenuItem }} > Language settings </MenuItemUnstyled> <MenuItemUnstyled className="Mui-base" slots={{ root: styling !== 'system' ? undefined : StyledMenuItem }} > Log out </MenuItemUnstyled> </MenuUnstyled> </Dropdown> )} </Box> ); } BaseMenuDemo.getCode = (styling?: 'system' | 'tailwindcss' | 'css') => { if (styling === 'system') { return `import * as React from 'react'; import styled from '@mui/system/styled'; import { Dropdown } from '@mui/base/Dropdown'; import { MenuButton } from '@mui/base/MenuButton'; import { Menu } from '@mui/base/Menu'; import { MenuItem } from '@mui/base/MenuItem'; const StyledMenuButton = styled('button')\`${buttonStyles}\`; const StyledListbox = styled('ul')\`${listboxStyles}\`; const StyledMenuItem = styled('li')\`${menuItemStyles}\`; function Demo() { return ( <Dropdown> <MenuButton slots={{ root: StyledMenuButton }}>My account</MenuButton> <Menu slots={{ listbox: StyledListbox, }} > <MenuItem slots={{ root: StyledMenuItem }}>Profile</MenuItem> <MenuItem slots={{ root: StyledMenuItem }}>Language settings</MenuItem> <MenuItem slots={{ root: StyledMenuItem }}>Log out</MenuItem> </Menu> </Dropdown> ); } `; } if (styling === 'css') { return `import { Dropdown } from '@mui/base/Dropdown'; import { MenuButton } from '@mui/base/MenuButton'; import { Menu } from '@mui/base/Menu'; import { MenuItem } from '@mui/base/MenuItem'; import './styles.css'; function Demo() { const [buttonElement, setButtonElement] = React.useState(null); const updateAnchor = React.useCallback((node) => { setButtonElement(node); }, []); return ( <Dropdown> <MenuButton>My account</MenuButton> <Menu> <MenuItem>Profile</MenuItem> <MenuItem>Language settings</MenuItem> <MenuItem>Log out</MenuItem> </Menu> </Dropdown> ) } /* styles.css */ ${CSS} `; } if (styling === 'tailwindcss') { return `import { Dropdown } from '@mui/base/Dropdown'; import { MenuButton } from '@mui/base/MenuButton'; import { Menu } from '@mui/base/Menu'; import { MenuItem } from '@mui/base/MenuItem'; function Demo() { return ( <Dropdown> <MenuButtonUnstyled className="min-h-[calc(1.5em + 22px)] inline-flex items-center gap-[0.5rem] rounded-[8px] border border-solid border-[--muidocs-palette-grey-200] bg-[--muidocs-palette-background-paper] p-[8px_12px_8px_6px] text-[0.875rem] leading-[1.5] transition-all [font-family:IBM_Plex_sans] [box-shadow:var(--shadow)] hover:bg-[--muidocs-palette-grey-50] ui-focus-visible:[outline:3px_solid_var(--focus-ring)] dark:border-[--muidocs-palette-primaryDark-700] dark:hover:bg-[--muidocs-palette-primaryDark-800]" > <Person className="text-[--palette-primary]" /> My account </ButtonUnstyled> <MenuUnstyled slotProps={{ root: { placement: 'top', className: 'z-[1000]' }, listbox: { id: 'simple-menu', className: \`mx-0 my-[8px] p-[4px] flex flex-col rounded-[8px] border border-solid border-[--muidocs-palette-grey-200] bg-[--muidocs-palette-background-paper] shadow-[0px_4px_40px_rgba(62,80,96,0.1)] dark:border-[--muidocs-palette-primaryDark-700] dark:shadow-[0px_4px_40px_rgba(11,13,14,0.5)]\`, }, }} > <MenuItemUnstyled className="hover:color-[--muidocs-palette-text-primary] flex min-h-[24px] items-center gap-[4px] rounded-[4px] border border-solid border-transparent px-[12px] py-[6px] hover:cursor-default hover:border-[--muidocs-palette-grey-100] hover:bg-[--muidocs-palette-grey-50] ui-focus-visible:cursor-default ui-focus-visible:border-[--muidocs-palette-grey-100] ui-focus-visible:bg-[--muidocs-palette-grey-50] ui-focus-visible:outline-none" > Profile </MenuItemUnstyled> <MenuItemUnstyled className="hover:color-[--muidocs-palette-text-primary] flex min-h-[24px] items-center gap-[4px] rounded-[4px] border border-solid border-transparent px-[12px] py-[6px] hover:cursor-default hover:border-[--muidocs-palette-grey-100] hover:bg-[--muidocs-palette-grey-50] ui-focus-visible:cursor-default ui-focus-visible:border-[--muidocs-palette-grey-100] ui-focus-visible:bg-[--muidocs-palette-grey-50] ui-focus-visible:outline-none" > Language settings </MenuItemUnstyled> <MenuItemUnstyled className="hover:color-[--muidocs-palette-text-primary] flex min-h-[24px] items-center gap-[4px] rounded-[4px] border border-solid border-transparent px-[12px] py-[6px] hover:cursor-default hover:border-[--muidocs-palette-grey-100] hover:bg-[--muidocs-palette-grey-50] ui-focus-visible:cursor-default ui-focus-visible:border-[--muidocs-palette-grey-100] ui-focus-visible:bg-[--muidocs-palette-grey-50] ui-focus-visible:outline-none" > Log out </MenuItemUnstyled> </MenuUnstyled> </Dropdown> ) } `; } return ``; };
5,183
0
petrpan-code/mui/material-ui/docs/src/components/productBaseUI
petrpan-code/mui/material-ui/docs/src/components/productBaseUI/components/BaseSliderDemo.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import { Slider } from '@mui/base/Slider'; import { styled, GlobalStyles } from '@mui/system'; const rootStyles = ` color: var(--palette-primary); width: 100%; padding: 16px 0; display: inline-block; position: relative; cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent; &:hover { opacity: 1; } &.Mui-disabled { pointer-events: none; cursor: default; color: var(--palette-primary); opacity: 0.5; } & .MuiSlider-rail { display: block; position: absolute; width: 100%; height: 4px; border-radius: 2px; background-color: currentColor; opacity: 0.4; } & .MuiSlider-track { display: block; position: absolute; height: 4px; border-radius: 2px; background-color: currentColor; } & .MuiSlider-thumb { position: absolute; width: 16px; height: 16px; margin-left: -6px; margin-top: -6px; box-sizing: border-box; border-radius: 50%; outline: 0; border: 3px solid currentColor; background-color: #fff; &:hover, &.Mui-focusVisible, &.Mui-active { box-shadow: 0 0 0 0.25rem var(--focus-ring); } } `; const StyledSlider = styled('span')(rootStyles); const CSS = `.MuiSlider-root {${rootStyles}}`; export default function BaseTabsDemo({ styling }: { styling?: 'system' | 'tailwindcss' | 'css' }) { return ( <Box sx={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', minHeight: 144, gap: 2, py: 3, px: 5, maxWidth: 300, mx: 'auto', }} > {styling === 'css' && <GlobalStyles styles={CSS} />} {(styling === 'system' || styling === 'css') && ( <React.Fragment> <Slider slots={{ root: styling !== 'system' ? undefined : StyledSlider }} defaultValue={10} /> <Slider slots={{ root: styling !== 'system' ? undefined : StyledSlider }} defaultValue={10} disabled /> </React.Fragment> )} {styling === 'tailwindcss' && ( <React.Fragment> <Slider defaultValue={10} slotProps={{ root: { className: 'py-4 px-0 w-full relative cursor-pointer text-[--palette-primary] touch-action-none tap-highlight-transparent hover:opacity-100 ui-disabled:pointer-events-none ui-disabled:cursor-default ui-disabled:opacity-50 ui-disabled:cursor-default ui-disabled:text-[--palette-primary] ui-disabled:opacity-50', }, rail: { className: 'block absolute w-full h-[4px] rounded-[2px] bg-current opacity-40', }, track: { className: 'block absolute h-[4px] rounded-[2px] bg-current', }, thumb: { className: 'absolute w-[16px] h-[16px] -ml-[6px] -mt-[6px] box-border rounded-[50%] outline-none [border:3px_solid_currentcolor] bg-white hover:shadow-[0_0_0_0.25rem_var(--focus-ring)] ui-focus-visible:shadow-[0_0_0_0.25rem_var(--focus-ring)] ui-active:shadow-[0_0_0_0.25rem_var(--focus-ring)]', }, }} /> <Slider defaultValue={10} disabled slotProps={{ root: { className: 'py-4 px-0 w-full relative cursor-pointer text-[--palette-primary] touch-action-none tap-highlight-transparent hover:opacity-100 ui-disabled:pointer-events-none ui-disabled:cursor-default ui-disabled:opacity-50 ui-disabled:cursor-default ui-disabled:text-[--palette-primary] ui-disabled:opacity-50', }, rail: { className: 'block absolute w-full h-[4px] rounded-[2px] bg-current opacity-40', }, track: { className: 'block absolute h-[4px] rounded-[2px] bg-current', }, thumb: { className: 'absolute w-[16px] h-[16px] -ml-[6px] -mt-[6px] box-border rounded-[50%] outline-none [border:3px_solid_currentcolor] bg-white hover:shadow-[0_0_0_0.25rem_var(--focus-ring)] ui-focus-visible:shadow-[0_0_0_0.25rem_var(--focus-ring)] ui-active:shadow-[0_0_0_0.25rem_var(--focus-ring)]', }, }} /> </React.Fragment> )} </Box> ); } BaseTabsDemo.getCode = (styling?: 'system' | 'tailwindcss' | 'css') => { if (styling === 'system') { return `import { Slider } from '@mui/base/Slider'; import { styled } from '@mui/system'; const StyledSlider = styled('span')\`${rootStyles}\`; <Slider defaultValue={10} slots={{ root: StyledSlider }} /> <Slider disabled defaultValue={10} slots={{ root: StyledSlider }} /> `; } if (styling === 'css') { return `import { Slider } from '@mui/base/Slider'; import './styles.css'; <Slider defaultValue={10} slots={{ root: StyledSlider }} /> <Slider disabled defaultValue={10} slots={{ root: StyledSlider }} /> /* styles.css */ ${CSS} `; } if (styling === 'tailwindcss') { return `import { Slider } from '@mui/base/Slider'; <Slider defaultValue={10} slotProps={{ root: { className: \`py-4 px-0 w-full relative cursor-pointer text-[--palette-primary] touch-action-none tap-highlight-transparent hover:opacity-100 ui-disabled:pointer-events-none ui-disabled:cursor-default ui-disabled:opacity-50 ui-disabled:cursor-default ui-disabled:text-[--palette-primary] ui-disabled:opacity-50\`, }, rail: { className: \`block absolute w-full h-[4px] rounded-[2px] bg-current opacity-40\`, }, track: { className: \`block absolute h-[4px] rounded-[2px] bg-current\`, }, thumb: { className: \`absolute w-[16px] h-[16px] -ml-[6px] -mt-[6px] box-border rounded-[50%] outline-none [border:3px_solid_currentcolor] bg-white hover:shadow-[0_0_0_0.25rem_var(--focus-ring)] ui-focus-visible:shadow-[0_0_0_0.25rem_var(--focus-ring)] ui-active:shadow-[0_0_0_0.25rem_var(--focus-ring)]\`, }, }} /> <Slider disabled defaultValue={10} slotProps={{ root: { className: \`py-4 px-0 w-full relative cursor-pointer text-[--palette-primary] touch-action-none tap-highlight-transparent hover:opacity-100 ui-disabled:pointer-events-none ui-disabled:cursor-default ui-disabled:opacity-50 ui-disabled:cursor-default ui-disabled:text-[--palette-primary] ui-disabled:opacity-50\`, }, rail: { className: \`block absolute w-full h-[4px] rounded-[2px] bg-current opacity-40\`, }, track: { className: \`block absolute h-[4px] rounded-[2px] bg-current\`, }, thumb: { className: \`absolute w-[16px] h-[16px] -ml-[6px] -mt-[6px] box-border rounded-[50%] outline-none [border:3px_solid_currentcolor] bg-white hover:shadow-[0_0_0_0.25rem_var(--focus-ring)] ui-focus-visible:shadow-[0_0_0_0.25rem_var(--focus-ring)] ui-active:shadow-[0_0_0_0.25rem_var(--focus-ring)]\`, }, }} />`; } return ''; };
5,184
0
petrpan-code/mui/material-ui/docs/src/components/productBaseUI
petrpan-code/mui/material-ui/docs/src/components/productBaseUI/components/BaseTabsDemo.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import { Tabs as TabsUnstyled } from '@mui/base/Tabs'; import { TabsList as TabsListUnstyled } from '@mui/base/TabsList'; import { TabPanel as TabPanelUnstyled } from '@mui/base/TabPanel'; import { Tab as TabUnstyled } from '@mui/base/Tab'; import { styled, GlobalStyles } from '@mui/system'; const tabListStyles = ` min-width: 300px; background-color: var(--palette-primary); border-radius: 12px; margin-bottom: 16px; display: flex; align-items: center; justify-content: center; align-content: space-between; box-shadow: var(--shadow); `; const StyledTabsList = styled('div')(tabListStyles); const tabPanelStyles = ` width: 100%; font-family: IBM Plex Sans, sans-serif; font-size: 0.875rem; `; const StyledTabPanel = styled('div')(tabPanelStyles); const tabStyles = ` font-family: IBM Plex Sans, sans-serif; color: white; cursor: pointer; font-size: 0.875rem; font-weight: bold; background-color: transparent; width: 100%; padding: 12px; margin: 6px 6px; border: none; border-radius: 7px; display: flex; justify-content: center; &:hover { background-color: var(--palette-primary-light); } &:focus-visible { color: #FFF; outline: 3px solid var(--focus-ring); } &.Mui-selected { background-color: #FFF; color: var(--palette-primary); } `; const StyledTab = styled('button')(tabStyles); const CSS = `.MuiTabsList-root {${tabListStyles}} .MuiTabPanel-root {${tabPanelStyles}} .MuiTab-root {${tabStyles}}`; export default function BaseTabsDemo({ styling }: { styling: 'system' | 'tailwindcss' | 'css' }) { return ( <Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', minHeight: 144, gap: 2, py: 3, }} > {styling === 'system' && ( <TabsUnstyled selectionFollowsFocus defaultValue={0}> <TabsListUnstyled slots={{ root: StyledTabsList }}> <TabUnstyled slots={{ root: StyledTab }}>One</TabUnstyled> <TabUnstyled slots={{ root: StyledTab }}>Two</TabUnstyled> <TabUnstyled slots={{ root: StyledTab }}>Three</TabUnstyled> </TabsListUnstyled> <TabPanelUnstyled slots={{ root: StyledTabPanel }} value={0}> First page </TabPanelUnstyled> <TabPanelUnstyled slots={{ root: StyledTabPanel }} value={1}> Second page </TabPanelUnstyled> <TabPanelUnstyled slots={{ root: StyledTabPanel }} value={2}> Third page </TabPanelUnstyled> </TabsUnstyled> )} {styling === 'css' && ( <TabsUnstyled selectionFollowsFocus defaultValue={0}> <GlobalStyles styles={CSS} /> <TabsListUnstyled> <TabUnstyled>One</TabUnstyled> <TabUnstyled>Two</TabUnstyled> <TabUnstyled>Three</TabUnstyled> </TabsListUnstyled> <TabPanelUnstyled value={0}>First page</TabPanelUnstyled> <TabPanelUnstyled value={1}>Second page</TabPanelUnstyled> <TabPanelUnstyled value={2}>Third page</TabPanelUnstyled> </TabsUnstyled> )} {styling === 'tailwindcss' && ( // https://play.tailwindcss.com/8jGjUI7EWe <TabsUnstyled selectionFollowsFocus defaultValue={0}> <TabsListUnstyled className="mb-[16px] flex min-w-[300px] content-between items-center justify-center rounded-[12px] bg-[--palette-primary] [box-shadow:var(--shadow)]"> <TabUnstyled className="m-[6px] flex w-full cursor-pointer justify-center rounded-[7px] border-none bg-transparent p-[12px] text-[0.875rem] font-bold text-white [font-family:IBM_Plex_sans] hover:bg-[--palette-primary-light] focus:text-white focus-visible:[outline:3px_solid_var(--focus-ring)] ui-selected:bg-white ui-selected:text-[--palette-primary]"> One </TabUnstyled> <TabUnstyled className="m-[6px] flex w-full cursor-pointer justify-center rounded-[7px] border-none bg-transparent p-[12px] text-[0.875rem] font-bold text-white [font-family:IBM_Plex_sans] hover:bg-[--palette-primary-light] focus:text-white focus-visible:[outline:3px_solid_var(--focus-ring)] ui-selected:bg-white ui-selected:text-[--palette-primary]"> Two </TabUnstyled> <TabUnstyled className="m-[6px] flex w-full cursor-pointer justify-center rounded-[7px] border-none bg-transparent p-[12px] text-[0.875rem] font-bold text-white [font-family:IBM_Plex_sans] hover:bg-[--palette-primary-light] focus:text-white focus-visible:[outline:3px_solid_var(--focus-ring)] ui-selected:bg-white ui-selected:text-[--palette-primary]"> Three </TabUnstyled> </TabsListUnstyled> <TabPanelUnstyled className="text-[0.875rem] [font-family:IBM_Plex_sans]" value={0}> First page </TabPanelUnstyled> <TabPanelUnstyled className="text-[0.875rem] [font-family:IBM_Plex_sans]" value={1}> Second page </TabPanelUnstyled> <TabPanelUnstyled className="text-[0.875rem] [font-family:IBM_Plex_sans]" value={2}> Third page </TabPanelUnstyled> </TabsUnstyled> )} </Box> ); } BaseTabsDemo.getCode = (styling: 'system' | 'tailwindcss' | 'css') => { if (styling === 'system') { return `import { TabsUnstyled } from '@mui/base/Tabs'; import { TabsListUnstyled } from '@mui/base/TabsList'; import { TabPanelUnstyled } from '@mui/base/TabPanel'; import { TabUnstyled } from '@mui/base/Tab'; import { styled } from '@mui/system'; const StyledTabsList = styled('div')\`${tabListStyles}\`; const StyledTabPanel = styled('div')\`${tabPanelStyles}\`; const StyledTab = styled('button')\`${tabStyles}\`; <TabsUnstyled selectionFollowsFocus defaultValue={0}> <TabsListUnstyled slots={{ root: StyledTabsList }}> <TabUnstyled slots={{ root: StyledTab }}>One</TabUnstyled> <TabUnstyled slots={{ root: StyledTab }}>Two</TabUnstyled> <TabUnstyled slots={{ root: StyledTab }}>Three</TabUnstyled> </TabsListUnstyled> <TabPanelUnstyled slots={{ root: StyledTabPanel }} value={0}> First page </TabPanelUnstyled> <TabPanelUnstyled slots={{ root: StyledTabPanel }} value={1}> Second page </TabPanelUnstyled> <TabPanelUnstyled slots={{ root: StyledTabPanel }} value={2}> Third page </TabPanelUnstyled> </TabsUnstyled> `; } if (styling === 'tailwindcss') { return `import { TabsUnstyled } from '@mui/base/Tabs'; import { TabsListUnstyled } from '@mui/base/TabsList'; import { TabPanelUnstyled } from '@mui/base/TabPanel'; import { TabUnstyled } from '@mui/base/Tab'; <TabsUnstyled selectionFollowsFocus defaultValue={0}> <TabsListUnstyled className="mb-[16px] flex min-w-[300px] content-between items-center justify-center rounded-[12px] bg-[--palette-primary] [box-shadow:var(--shadow)]"> <TabUnstyled className="m-[6px] flex w-full cursor-pointer justify-center rounded-[7px] border-none bg-transparent p-[12px] text-[0.875rem] font-bold text-white [font-family:IBM_Plex_sans] focus:text-white focus:[outline:3px_solid_var(--focus-ring)] ui-selected:bg-white ui-selected:text-[--palette-primary]"> One </TabUnstyled> <TabUnstyled className="m-[6px] flex w-full cursor-pointer justify-center rounded-[7px] border-none bg-transparent p-[12px] text-[0.875rem] font-bold text-white [font-family:IBM_Plex_sans] focus:text-white focus:[outline:3px_solid_var(--focus-ring)] ui-selected:bg-white ui-selected:text-[--palette-primary]"> Two </TabUnstyled> <TabUnstyled className="m-[6px] flex w-full cursor-pointer justify-center rounded-[7px] border-none bg-transparent p-[12px] text-[0.875rem] font-bold text-white [font-family:IBM_Plex_sans] focus:text-white focus:[outline:3px_solid_var(--focus-ring)] ui-selected:bg-white ui-selected:text-[--palette-primary]"> Three </TabUnstyled> </TabsListUnstyled> <TabPanelUnstyled className="text-[0.875rem] [font-family:IBM_Plex_sans]" value={0}> First page </TabPanelUnstyled> <TabPanelUnstyled className="text-[0.875rem] [font-family:IBM_Plex_sans]" value={1}> Second page </TabPanelUnstyled> <TabPanelUnstyled className="text-[0.875rem] [font-family:IBM_Plex_sans]" value={2}> Third page </TabPanelUnstyled> </TabsUnstyled>`; } if (styling === 'css') { return `import { TabsUnstyled } from '@mui/base/Tabs'; import { TabsListUnstyled } from '@mui/base/TabsList'; import { TabPanelUnstyled } from '@mui/base/TabPanel'; import { TabUnstyled } from '@mui/base/Tab'; import { styled } from '@mui/system'; import './styles.css'; <TabsUnstyled selectionFollowsFocus defaultValue={0}> <TabsListUnstyled> <TabUnstyled>One</TabUnstyled> <TabUnstyled>Two</TabUnstyled> <TabUnstyled>Three</TabUnstyled> </TabsListUnstyled> <TabPanelUnstyled value={0}> First page </TabPanelUnstyled> <TabPanelUnstyled value={1}> Second page </TabPanelUnstyled> <TabPanelUnstyled value={2}> Third page </TabPanelUnstyled> </TabsUnstyled> /* styles.css */ ${CSS} `; } return ''; };
5,185
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productCore/CoreHero.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Container from '@mui/material/Container'; import Typography from '@mui/material/Typography'; import GradientText from 'docs/src/components/typography/GradientText'; import IconImage from 'docs/src/components/icon/IconImage'; export default function CoreHero() { return ( <Container> <Box sx={{ pt: { xs: 6, sm: 8, md: 12 }, pb: { xs: 3, md: 1 }, display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', }} > <Typography fontWeight="bold" variant="body2" sx={(theme) => ({ color: 'primary.600', display: 'flex', alignItems: 'center', justifyContent: { xs: 'center', md: 'flex-start' }, mb: { xs: 1, sm: 0 }, '& > *': { mr: 1 }, ...theme.applyDarkStyles({ color: 'primary.400', }), })} > <IconImage loading="eager" width={28} height={28} name="product-core" /> MUI Core </Typography> <Typography component="h1" variant="h2" sx={{ textAlign: 'center' }} gutterBottom> Ready to use components <br /> <GradientText>free forever</GradientText> </Typography> <Typography color="text.secondary" textAlign="center" sx={{ maxWidth: 550 }}> Get a growing list of React components and utilities, ready-to-use, free forever, and with accessibility always in mind. We&apos;ve built the foundational UI blocks for your design system so you don&apos;t have to. </Typography> </Box> </Container> ); }
5,186
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productCore/CoreHeroEnd.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import { alpha } from '@mui/material/styles'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import GradientText from 'docs/src/components/typography/GradientText'; import Link from 'docs/src/modules/components/Link'; import ROUTES from 'docs/src/route'; import MuiStatistics from 'docs/src/components/home/MuiStatistics'; export default function CoreHeroEnd() { return ( <Section cozy data-mui-color-scheme="dark" sx={{ background: (theme) => `linear-gradient(180deg, ${(theme.vars || theme).palette.primaryDark[800]} 50%, ${alpha(theme.palette.primary[800], 0.2)} 100%), ${ (theme.vars || theme).palette.primaryDark[800] }`, }} > <Grid container spacing={2} alignItems="center"> <Grid item md={6}> <Box maxWidth={500} sx={{ mb: 4 }}> <SectionHeadline overline="Community" title={ <Typography variant="h2"> Join our <GradientText>global community</GradientText> </Typography> } description="The core components were crafted by many hands, all over the world. Join us today to get help when you need it, and lend a hand when you can." /> <Button aria-label="Learn more" component={Link} href={ROUTES.communityHelp} noLinkStyle size="large" variant="contained" endIcon={<KeyboardArrowRightRounded />} sx={{ width: { xs: '100%', sm: 'auto' } }} > Join our community </Button> </Box> </Grid> <MuiStatistics /> </Grid> </Section> ); }
5,187
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productCore/CoreProducts.tsx
import * as React from 'react'; import Grid from '@mui/material/Grid'; import Section from 'docs/src/layouts/Section'; import InfoCard from 'docs/src/components/action/InfoCard'; // Note: All of the commented code will be put back in once logos for each Core product are done. const content = [ { // icon: title: 'Material UI', description: "An open-source React component library that implements Google's Material Design.", link: '/material-ui/', }, { // icon: title: 'Joy UI', description: "An easy to customize open-source React component library that implements MUI's own in-house design principles by default.", link: '/joy-ui/getting-started/', }, { // icon: title: 'Base UI', description: "A library of unstyled React UI components and hooks. With Base UI, you gain complete control over your app's CSS and accessibility features.", link: '/base-ui/', }, { // icon: title: 'MUI System', description: 'A set of CSS utilities to help you build custom designs more efficiently.', link: '/system/getting-started/', }, ]; export default function CoreProducts() { return ( <Section cozy> <Grid container spacing={2}> {content.map(({ title, description, link }) => ( <Grid key={title} item xs={12} md={6}> <InfoCard link={link} title={title} description={description} /> </Grid> ))} </Grid> </Section> ); }
5,188
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productDesignKit/DesignKitDemo.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Grid from '@mui/material/Grid'; import Fade from '@mui/material/Fade'; import Typography from '@mui/material/Typography'; import LaunchRounded from '@mui/icons-material/LaunchRounded'; import TextFieldsRounded from '@mui/icons-material/TextFieldsRounded'; import WidgetsRounded from '@mui/icons-material/WidgetsRounded'; import ToggleOnRounded from '@mui/icons-material/ToggleOnRounded'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import GradientText from 'docs/src/components/typography/GradientText'; import Item, { Group } from 'docs/src/components/action/Item'; import Highlighter from 'docs/src/components/action/Highlighter'; import More from 'docs/src/components/action/More'; import Frame from 'docs/src/components/action/Frame'; import Link from 'docs/src/modules/components/Link'; const DEMOS = ['Components', 'Branding', 'Iconography']; const Image = styled('img')(({ theme }) => ({ filter: 'drop-shadow(-8px 4px 20px rgba(61, 71, 82, 0.2))', transition: '0.4s', display: 'block', height: 'auto', borderRadius: '10px', ...theme.applyDarkStyles({ filter: 'drop-shadow(-8px 4px 20px rgba(0, 0, 0, 0.4))', }), })); export default function TemplateDemo() { const [demo, setDemo] = React.useState(DEMOS[0]); const icons = { [DEMOS[0]]: <ToggleOnRounded fontSize="small" />, [DEMOS[1]]: <TextFieldsRounded fontSize="small" />, [DEMOS[2]]: <WidgetsRounded fontSize="small" />, }; return ( <Section bg="gradient" cozy> <Grid container spacing={2} alignItems="center"> <Grid item md={6} sx={{ minWidth: 0 }}> <SectionHeadline overline="Design kits" title={ <Typography variant="h2"> Upgrade your <GradientText>design workflow</GradientText> </Typography> } description="The Design kits contain many of the Material UI components with states, variations, colors, typography, and icons. We frequently update it to sync with the most up-to-date release." /> <Group desktopColumns={2} sx={{ m: -2, p: 2 }}> {DEMOS.map((name) => ( <Highlighter key={name} selected={name === demo} onClick={() => setDemo(name)}> <Item icon={React.cloneElement(icons[name], name === demo ? { color: 'primary' } : {})} title={name} /> </Highlighter> ))} <More component={Link} href="https://mui.com/store/?utm_source=marketing&utm_medium=referral&utm_campaign=design-cta3#design" noLinkStyle /> </Group> </Grid> <Grid item xs={12} md={6}> <Frame> <Frame.Demo sx={{ overflow: 'hidden', height: { xs: 240, sm: 390 }, perspective: '1000px', }} > <Fade in={demo === 'Components'} timeout={500}> <Box sx={[ { width: '100%', height: '100%', '& img': { position: 'absolute', left: '50%', width: { xs: 240, sm: 300 }, '&:nth-of-type(1)': { top: 120, transform: 'translate(-70%)', }, '&:nth-of-type(2)': { top: 80, transform: 'translate(-50%)', }, '&:nth-of-type(3)': { top: 40, transform: 'translate(-30%)', }, }, '&:hover': { '& img': { filter: 'drop-shadow(-16px 12px 20px rgba(61, 71, 82, 0.2))', '&:nth-of-type(1)': { top: 0, transform: 'scale(0.8) translate(-108%) rotateY(30deg)', }, '&:nth-of-type(2)': { top: 40, transform: 'scale(0.8) translate(-54%) rotateY(30deg)', }, '&:nth-of-type(3)': { top: 40, transform: 'scale(0.8) translate(-0%) rotateY(30deg)', }, }, }, }, (theme) => theme.applyDarkStyles({ '&:hover': { '& img': { filter: 'drop-shadow(-16px 12px 20px rgba(0, 0, 0, 0.4))', }, }, }), ]} > <Image src={`/static/branding/design-kits/Button-light.jpeg`} alt="" loading="lazy" sx={(theme) => theme.applyDarkStyles({ content: `url(/static/branding/design-kits/Button-dark.jpeg)`, }) } /> <Image src={`/static/branding/design-kits/Alert-light.jpeg`} alt="" loading="lazy" sx={(theme) => theme.applyDarkStyles({ content: `url(/static/branding/design-kits/Alert-dark.jpeg)`, }) } /> <Image src={`/static/branding/design-kits/Slider-light.jpeg`} alt="" loading="lazy" sx={(theme) => theme.applyDarkStyles({ content: `url(/static/branding/design-kits/Slider-dark.jpeg)`, }) } /> </Box> </Fade> <Fade in={demo === 'Branding'} timeout={500}> <Image src={`/static/branding/design-kits/Colors-light.jpeg`} alt="" loading="lazy" width="300" sx={(theme) => ({ width: { sm: 400 }, position: 'absolute', left: '50%', top: '50%', transform: 'translate(-50%, -50%)', ...theme.applyDarkStyles({ content: `url(/static/branding/design-kits/Colors-dark.jpeg)`, }), })} /> </Fade> <Fade in={demo === 'Iconography'} timeout={500}> <Image src={`/static/branding/design-kits/Icons-light.jpeg`} alt="" loading="lazy" width="300" sx={(theme) => ({ width: { sm: 500 }, position: 'absolute', left: '50%', top: 60, transform: 'translate(-40%)', ...theme.applyDarkStyles({ content: `url(/static/branding/design-kits/Icons-dark.jpeg)`, }), })} /> </Fade> </Frame.Demo> <Frame.Info data-mui-color-scheme="dark" sx={{ display: 'flex', alignItems: { xs: 'start', sm: 'center' }, flexDirection: { xs: 'column', sm: 'row' }, minWidth: 0, gap: { xs: 3, sm: 0 }, }} > <Box sx={{ display: 'flex', flexDirection: { xs: 'column', sm: 'row' }, alignItems: { xs: 'start', sm: 'center' }, gap: 1, }} > <Typography variant="body2" fontWeight="semiBold"> Available for: </Typography> <Box sx={{ display: 'flex', gap: 1, '& >img': { width: 26, height: 26 } }}> <img src="/static/branding/design-kits/figma-logo.svg" alt="" loading="lazy" /> <img src="/static/branding/design-kits/sketch-logo.svg" alt="" loading="lazy" /> <img src="/static/branding/design-kits/adobexd-logo.svg" alt="" loading="lazy" /> </Box> </Box> <Button component={Link} variant="outlined" href="https://mui.com/store/?utm_source=marketing&utm_medium=referral&utm_campaign=design-cta2#design" endIcon={<LaunchRounded sx={{ '&&': { fontSize: 16 } }} />} sx={{ ml: { xs: 0, sm: 'auto' }, color: 'primary.300', width: { xs: '100%', sm: 'fit-content' }, }} > Buy now </Button> </Frame.Info> </Frame> </Grid> </Grid> </Section> ); }
5,189
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productDesignKit/DesignKitFAQ.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Grid'; import Button from '@mui/material/Button'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import MuiAccordion from '@mui/material/Accordion'; import MuiAccordionSummary from '@mui/material/AccordionSummary'; import MuiAccordionDetail from '@mui/material/AccordionDetails'; import KeyboardArrowDownRounded from '@mui/icons-material/KeyboardArrowDownRounded'; import InternalLink from 'docs/src/modules/components/Link'; import Section from 'docs/src/layouts/Section'; const faqData = [ { summary: 'What long-term support do you offer?', detail: ( <React.Fragment> We think you&apos;ll love the components we&apos;ve built so far, but we&apos;re planning to release more. We opened it up as soon as we had something useful, so that you can start getting value from it right away, and we&apos;ll be adding new features and components based on our own ideas, and on suggestions from early access customers. </React.Fragment> ), }, { summary: 'How many licenses do I need?', detail: ( <React.Fragment> The number of licenses purchased must correspond to the maximum number of editors working concurrently in a 24 hour period. An editor is somebody contributing changes to the designed screens that use the UI kits. No licenses are required for viewing the designs. </React.Fragment> ), }, { summary: 'The UI kit got an update. How do I get it?', detail: ( <React.Fragment> We&apos;ll send you an email when a new release is available. You can access the item on the{' '} <InternalLink href="https://mui.com/store/account/downloads/">download</InternalLink> page of your store account. You can find a detailed description of the changes under the &quot;Changelog&quot; tab on this page. </React.Fragment> ), }, { summary: 'Do you offer discounts to educational or non-profit organizations?', detail: ( <React.Fragment> <strong>Yes.</strong> We offer a 50% discount on all products licensed to students, instructors, non-profit, and charity entities. This special discount cannot be combined with any other type of discount. To qualify for the discount, you need to send us a document clearly indicating that you are a member of the respective institution. An email from your official account which bears your signature is sufficient in most cases. For more information on how to qualify for a discount, please contact sales. </React.Fragment> ), }, { summary: 'Figma or Sketch or Adobe XD?', detail: ( <React.Fragment> We aim to keep feature parity between the Figma, Sketch, and Adobe XD kits where possible. We have a 50% off coupon for past customers who want to switch between two design tools. </React.Fragment> ), }, ]; const Accordion = styled(MuiAccordion)(({ theme }) => ({ padding: theme.spacing(2), transition: theme.transitions.create('box-shadow'), '&&': { borderRadius: theme.shape.borderRadius, }, '&:hover': { boxShadow: '1px 1px 20px 0 rgb(90 105 120 / 20%)', }, '&:not(:last-of-type)': { marginBottom: theme.spacing(2), }, '&:before': { display: 'none', }, '&:after': { display: 'none', }, })); const AccordionSummary = styled(MuiAccordionSummary)(({ theme }) => ({ padding: theme.spacing(2), margin: theme.spacing(-2), minHeight: 'auto', '&.Mui-expanded': { minHeight: 'auto', }, '& .MuiAccordionSummary-content': { margin: 0, paddingRight: theme.spacing(2), '&.Mui-expanded': { margin: 0, }, }, })); const AccordionDetails = styled(MuiAccordionDetail)(({ theme }) => ({ marginTop: theme.spacing(1), padding: 0, })); export default function DesignKitFAQ() { function renderItem(index: number) { const faq = faqData[index]; return ( <Accordion variant="outlined"> <AccordionSummary expandIcon={<KeyboardArrowDownRounded sx={{ fontSize: 20, color: 'primary.main' }} />} > <Typography variant="body2" fontWeight="bold" component="h3"> {faq.summary} </Typography> </AccordionSummary> <AccordionDetails> <Typography component="div" variant="body2" color="text.secondary" sx={{ '& ul': { pl: 2 } }} > {faq.detail} </Typography> </AccordionDetails> </Accordion> ); } return ( <Section> <Typography variant="h2" sx={{ mb: { xs: 2, sm: 4 } }} id="faq"> Frequently asked questions </Typography> <Grid container spacing={2}> <Grid item xs={12} md={6}> {renderItem(0)} {renderItem(1)} {renderItem(2)} </Grid> <Grid item xs={12} md={6}> {renderItem(3)} {renderItem(4)} <Paper variant="outlined" sx={(theme) => ({ p: 2, pb: 1, borderStyle: 'dashed', borderColor: 'grey.300', bgcolor: 'white', ...theme.applyDarkStyles({ borderColor: 'primaryDark.600', bgcolor: 'primaryDark.800', }), })} > <Box sx={{ textAlign: 'left' }}> <Typography variant="body2" color="text.primary" fontWeight="bold"> Got any questions unanswered or need more help? </Typography> </Box> <Typography variant="body2" color="text.primary" sx={{ my: 1, textAlign: 'left' }}> From community help to premium business support, we&apos;re here to help. </Typography> <Button component="a" // @ts-expect-error variant="link" size="small" href="mailto:[email protected]" endIcon={<KeyboardArrowRightRounded />} sx={{ ml: -1 }} > Contact sales </Button> </Paper> </Grid> </Grid> </Section> ); }
5,190
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productDesignKit/DesignKitHero.tsx
import * as React from 'react'; import { alpha } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import Button from '@mui/material/Button'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import GradientText from 'docs/src/components/typography/GradientText'; import HeroContainer from 'docs/src/layouts/HeroContainer'; import IconImage from 'docs/src/components/icon/IconImage'; import Link from 'docs/src/modules/components/Link'; import { DesignKitImagesSet1, DesignKitImagesSet2, DesignKitTools, } from 'docs/src/components/home/DesignKits'; export default function TemplateHero() { return ( <HeroContainer linearGradient left={ <Box sx={{ textAlign: { xs: 'center', md: 'left' } }}> <Typography fontWeight="bold" variant="body2" sx={(theme) => ({ color: 'primary.600', display: 'flex', alignItems: 'center', justifyContent: { xs: 'center', md: 'start' }, '& > *': { mr: 1 }, ...theme.applyDarkStyles({ color: 'primary.400', }), })} > <IconImage width={28} height={28} loading="eager" name="product-designkits" /> Design kits </Typography> <Typography variant="h1" sx={{ my: 2, maxWidth: 500 }}> Material UI <br /> in your favorite <br /> <GradientText>design tool</GradientText> </Typography> <Typography color="text.secondary" sx={{ mb: 3, maxWidth: 450 }}> Pick your favorite design tool to enjoy and use Material UI components. Boost consistency and facilitate communication when working with developers. </Typography> <Button component={Link} noLinkStyle href="https://mui.com/store/?utm_source=marketing&utm_medium=referral&utm_campaign=design-cta#design" size="large" variant="contained" endIcon={<KeyboardArrowRightRounded />} sx={{ width: { xs: '100%', sm: 'auto' } }} > Buy now </Button> </Box> } right={ <Box sx={{ position: 'relative', height: '100%', perspective: '1000px' }}> <DesignKitTools /> <Box sx={(theme) => ({ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', zIndex: 1, background: `linear-gradient(90deg, ${ (theme.vars || theme).palette.primaryDark[900] } 1%, ${alpha(theme.palette.primaryDark[900], 0.5)})`, opacity: 0, ...theme.applyDarkStyles({ opacity: 1, }), })} /> <Box sx={{ left: '40%', position: 'absolute', display: 'flex', transform: 'translateX(-40%) rotateZ(30deg) rotateX(8deg) rotateY(-8deg)', transformOrigin: 'center center', }} > <DesignKitImagesSet1 keyframes={{ '0%': { transform: 'translateY(-200px)', }, '100%': { transform: 'translateY(0px)', }, }} /> <DesignKitImagesSet2 keyframes={{ '0%': { transform: 'translateY(150px)', }, '100%': { transform: 'translateY(-80px)', }, }} sx={{ ml: { xs: 2, sm: 4, md: 8 } }} /> </Box> </Box> } /> ); }
5,191
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productDesignKit/DesignKitValues.tsx
import * as React from 'react'; import Typography from '@mui/material/Typography'; import Grid from '@mui/material/Grid'; import Palette from '@mui/icons-material/Palette'; import LibraryBooks from '@mui/icons-material/LibraryBooks'; import CodeRounded from '@mui/icons-material/CodeRounded'; import GradientText from 'docs/src/components/typography/GradientText'; import Section from 'docs/src/layouts/Section'; import InfoCard from 'docs/src/components/action/InfoCard'; const content = [ { icon: <Palette fontSize="small" color="primary" />, title: 'For designers', description: 'Save time getting the Material UI components all setup, leveraging the latest features from your favorite design tool.', }, { icon: <LibraryBooks fontSize="small" color="primary" />, title: 'For product managers', description: 'Quickly put together ideas and high-fidelity mockups/prototypes using components from your actual product.', }, { icon: <CodeRounded fontSize="small" color="primary" />, title: 'For developers', description: 'Effortlessly communicate with designers using the same language around the MUI Core components props and variants.', }, ]; function DesignKitValues() { return ( <Section> <Typography variant="body2" color="primary" fontWeight="bold"> Collaboration </Typography> <Typography variant="h2" sx={{ mt: 1, mb: { xs: 2, sm: 4 }, maxWidth: 500 }}> Be more efficient <GradientText>designing and developing</GradientText> with the same library </Typography> <Grid container spacing={3}> {content.map(({ icon, title, description }) => ( <Grid key={title} item xs={12} sm={6} md={4}> <InfoCard title={title} icon={icon} description={description} /> </Grid> ))} </Grid> </Section> ); } export default DesignKitValues;
5,192
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productMaterial/MaterialComponents.tsx
import * as React from 'react'; import { Experimental_CssVarsProvider as CssVarsProvider, styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Alert from '@mui/material/Alert'; import Button from '@mui/material/Button'; import Grid from '@mui/material/Grid'; import Stack from '@mui/material/Stack'; import Paper from '@mui/material/Paper'; import Table from '@mui/material/Table'; import TableBody from '@mui/material/TableBody'; import TableCell from '@mui/material/TableCell'; import TableContainer from '@mui/material/TableContainer'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; import TextField from '@mui/material/TextField'; import Typography from '@mui/material/Typography'; import Tooltip from '@mui/material/Tooltip'; import InputRounded from '@mui/icons-material/InputRounded'; import SmartButtonRounded from '@mui/icons-material/SmartButtonRounded'; import TableViewRounded from '@mui/icons-material/TableViewRounded'; import WarningRounded from '@mui/icons-material/WarningRounded'; import ShoppingCartRounded from '@mui/icons-material/ShoppingCartRounded'; import InfoRounded from '@mui/icons-material/InfoRounded'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import GradientText from 'docs/src/components/typography/GradientText'; import Item, { Group } from 'docs/src/components/action/Item'; import Highlighter from 'docs/src/components/action/Highlighter'; import More from 'docs/src/components/action/More'; import Frame from 'docs/src/components/action/Frame'; import { customTheme } from 'docs/src/components/home/MaterialDesignComponents'; import HighlightedCode from 'docs/src/modules/components/HighlightedCode'; import MarkdownElement from 'docs/src/components/markdown/MarkdownElement'; import StylingInfo from 'docs/src/components/action/StylingInfo'; import ROUTES from 'docs/src/route'; const DEMOS = ['Button', 'Text field', 'Table', 'Alert', 'Tooltip'] as const; const StyledButton = styled(Button)(({ theme }) => ({ borderRadius: 40, padding: theme.spacing('2px', 1), fontSize: theme.typography.pxToRem(12), lineHeight: 18 / 12, '&.MuiButton-text': { color: theme.palette.grey[500], border: '1px solid', borderColor: theme.palette.primaryDark[700], '&:hover': { backgroundColor: theme.palette.primaryDark[700], }, }, '&.MuiButton-outlined': { color: '#fff', backgroundColor: theme.palette.primary[800], borderColor: theme.palette.primary[700], '&:hover': { backgroundColor: theme.palette.primary[700], }, }, })); const CODES = { Button: ` <Button variant="text" startIcon={<ShoppingCartRounded />}> Add item </Button> <Button variant="contained" startIcon={<ShoppingCartRounded />}> Add item </Button> <Button variant="outlined" startIcon={<ShoppingCartRounded />}> Add item </Button> `, 'Text field': ` <TextField variant="standard" label="Username" /> <TextField variant="outlined" label="Email" type="email" /> <TextField variant="filled" label="Password" type="password" /> `, Table: ` <TableContainer component={Paper} variant="outlined" > <Table aria-label="demo table"> <TableHead> <TableRow> <TableCell>Dessert</TableCell> <TableCell>Calories</TableCell> </TableRow> </TableHead> <TableBody> <TableRow> <TableCell>Frozen yoghurt</TableCell> <TableCell>109</TableCell> </TableRow> <TableRow> <TableCell>Cupcake</TableCell> <TableCell>305</TableCell> </TableRow> </TableBody> </Table> </TableContainer> `, Alert: ` <Alert variant="standard" color="info"> This is an alert! </Alert> <Alert variant="outlined" color="info"> This is an alert! </Alert> <Alert variant="filled" color="info"> This is an alert! </Alert> `, Tooltip: ` <Tooltip title="This is a tooltip" arrow placement="top"> <Typography>Top</Typography> </Tooltip> <Tooltip title="This is a tooltip" arrow placement="right"> <Typography>Right</Typography> </Tooltip> <Tooltip title="This is a tooltip" arrow placement="left"> <Typography>Left</Typography> </Tooltip> <Tooltip title="This is a tooltip" arrow placement="bottom"> <Typography>Bottom</Typography> </Tooltip> `, }; export default function MaterialComponents() { const [demo, setDemo] = React.useState<(typeof DEMOS)[number]>(DEMOS[0]); const [customized, setCustomized] = React.useState(false); const icons = { [DEMOS[0]]: <SmartButtonRounded fontSize="small" />, [DEMOS[1]]: <InputRounded fontSize="small" />, [DEMOS[2]]: <TableViewRounded fontSize="small" />, [DEMOS[3]]: <WarningRounded fontSize="small" />, [DEMOS[4]]: <InfoRounded fontSize="small" />, }; return ( <Section bg="gradient"> <Grid container spacing={2}> <Grid item md={6} sx={{ minWidth: 0 }}> <SectionHeadline overline="Component library" title={ <Typography variant="h2"> <GradientText>40+</GradientText> building block components </Typography> } description="A meticulous implementation of Material Design; every Material UI component meets the highest standards of form and function." /> <Group desktopColumns={2} sx={{ mt: 4, pb: { xs: 0, md: 2 } }}> {DEMOS.map((name) => ( <Highlighter key={name} selected={name === demo} onClick={() => setDemo(name)}> <Item icon={React.cloneElement(icons[name])} title={name} /> </Highlighter> ))} <More href={ROUTES.components} /> </Group> </Grid> <Grid item xs={12} md={6}> <Frame sx={{ height: '100%' }}> <Frame.Demo className="mui-default-theme" sx={{ flexGrow: 1 }}> <CssVarsProvider theme={customized ? customTheme : undefined}> {demo === 'Button' && ( <Box sx={{ height: '100%', py: 5, gap: 2, display: 'flex', justifyContent: 'center', alignItems: 'center', flexWrap: 'wrap', }} > <Button variant="text" startIcon={<ShoppingCartRounded />}> Add item </Button> <Button variant="contained" startIcon={<ShoppingCartRounded />}> Add item </Button> <Button variant="outlined" startIcon={<ShoppingCartRounded />}> Add item </Button> </Box> )} {demo === 'Text field' && ( <Stack justifyContent="center" spacing={2} sx={{ p: 2, width: '50%', margin: 'auto' }} > <TextField variant="standard" label="Username" /> <TextField variant="outlined" label="Email" type="email" /> <TextField variant="filled" label="Password" type="password" autoComplete="new-password" // prevent chrome auto-fill /> </Stack> )} {demo === 'Table' && ( <TableContainer component={Paper} variant="outlined" sx={{ mx: 'auto', my: 4, maxWidth: 320, '& .MuiTableBody-root > .MuiTableRow-root:last-of-type > .MuiTableCell-root': { borderBottomWidth: 0, }, }} > <Table aria-label="demo table"> <TableHead> <TableRow> <TableCell>Dessert</TableCell> <TableCell>Calories</TableCell> </TableRow> </TableHead> <TableBody> <TableRow> <TableCell>Frozen yoghurt</TableCell> <TableCell>109</TableCell> </TableRow> <TableRow> <TableCell>Cupcake</TableCell> <TableCell>305</TableCell> </TableRow> </TableBody> </Table> </TableContainer> )} {demo === 'Alert' && ( <Box sx={{ height: '100%', py: 2, display: 'flex', justifyContent: 'center', alignItems: 'center', flexWrap: 'wrap', gap: 2, }} > <Alert variant="standard" color="info"> This is an alert! </Alert> <Alert variant="outlined" color="info"> This is an alert! </Alert> <Alert variant="filled" color="info"> This is an alert! </Alert> </Box> )} {demo === 'Tooltip' && ( <Stack alignItems="center" justifyContent="center" spacing={1} sx={{ minHeight: 100, py: 2 }} > <Tooltip title="Appears on hover" arrow placement="top" slotProps={{ popper: { disablePortal: true } }} > <Typography color="text.secondary">Top</Typography> </Tooltip> <Box sx={{ '& > *': { display: 'inline-block' } }}> <Tooltip title="Always display" arrow placement="left" open slotProps={{ popper: { disablePortal: true } }} > <Typography color="text.secondary">Left</Typography> </Tooltip> <Box sx={{ display: 'inline-block', width: 80 }} /> <Tooltip title="Appears on hover" arrow placement="right" slotProps={{ popper: { disablePortal: true } }} > <Typography color="text.secondary">Right</Typography> </Tooltip> </Box> <Tooltip title="Appears on hover" arrow placement="bottom" slotProps={{ popper: { disablePortal: true } }} > <Typography color="text.secondary">Bottom</Typography> </Tooltip> </Stack> )} </CssVarsProvider> </Frame.Demo> <Frame.Info sx={{ minHeight: 180, maxHeight: demo === 'Table' ? 260 : 'none', position: 'relative', overflow: 'hidden', p: 0, pt: 5, }} > <Box sx={{ overflow: 'auto', pt: 2, pb: 1, px: 2, height: '100%', }} > <HighlightedCode copyButtonHidden component={MarkdownElement} code={CODES[demo]} language="jsx" /> </Box> <Box sx={(theme) => ({ pb: 3, display: 'flex', alignItems: 'center', position: 'absolute', top: 12, left: 16, right: 0, zIndex: 10, background: `linear-gradient(to bottom, ${ (theme.vars || theme).palette.common.black } 30%, transparent)`, })} > <StyledButton size="small" variant={customized ? 'text' : 'outlined'} onClick={() => { setCustomized(false); }} > Material Design </StyledButton> <StyledButton size="small" variant={customized ? 'outlined' : 'text'} onClick={() => { setCustomized(true); }} sx={{ ml: 1 }} > Custom theme </StyledButton> </Box> <StylingInfo appeared={customized} /> </Frame.Info> </Frame> </Grid> </Grid> </Section> ); }
5,193
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productMaterial/MaterialDesignKits.tsx
import * as React from 'react'; import { styled } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Grid from '@mui/material/Grid'; import Fade from '@mui/material/Fade'; import Typography from '@mui/material/Typography'; import LaunchRounded from '@mui/icons-material/LaunchRounded'; import TextFieldsRounded from '@mui/icons-material/TextFieldsRounded'; import WidgetsRounded from '@mui/icons-material/WidgetsRounded'; import ToggleOnRounded from '@mui/icons-material/ToggleOnRounded'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import GradientText from 'docs/src/components/typography/GradientText'; import Item, { Group } from 'docs/src/components/action/Item'; import Highlighter from 'docs/src/components/action/Highlighter'; import More from 'docs/src/components/action/More'; import Frame from 'docs/src/components/action/Frame'; import Link from 'docs/src/modules/components/Link'; const DEMOS = ['Components', 'Branding', 'Iconography']; const Image = styled('img')(({ theme }) => ({ filter: 'drop-shadow(-2px 4px 4px rgba(61, 71, 82, 0.1))', transition: '0.4s', display: 'block', height: 'auto', borderRadius: '10px', ...theme.applyDarkStyles({ filter: 'drop-shadow(-2px 4px 4px rgba(0, 0, 0, 0.3))', }), })); export default function MaterialDesignKits() { const [demo, setDemo] = React.useState(DEMOS[0]); const icons = { [DEMOS[0]]: <ToggleOnRounded fontSize="small" />, [DEMOS[1]]: <TextFieldsRounded fontSize="small" />, [DEMOS[2]]: <WidgetsRounded fontSize="small" />, }; return ( <Section cozy> <Grid container spacing={2} alignItems="center"> <Grid item md={6} sx={{ minWidth: 0 }}> <Box sx={{ maxWidth: 500 }}> <SectionHeadline overline="Design kits" title={ <Typography variant="h2"> Enhance your <GradientText>design workflow</GradientText> </Typography> } description="The Design kits contain many of the Material UI components with states, variations, colors, typography, and icons. We frequently update it to sync with the most up-to-date release." /> </Box> <Group desktopColumns={2} sx={{ mt: 4 }}> {DEMOS.map((name) => ( <Highlighter key={name} selected={name === demo} onClick={() => setDemo(name)}> <Item icon={React.cloneElement(icons[name], name === demo ? { color: 'primary' } : {})} title={name} /> </Highlighter> ))} <More component={Link} href="https://mui.com/store/?utm_source=marketing&utm_medium=referral&utm_campaign=design-cta3#design" noLinkStyle /> </Group> </Grid> <Grid item xs={12} md={6}> <Frame> <Frame.Demo sx={{ overflow: 'hidden', height: { xs: 240, sm: 390 }, perspective: '1000px', }} > <Fade in={demo === 'Components'} timeout={500}> <Box sx={[ { width: '100%', height: '100%', '& img': { position: 'absolute', left: '50%', width: { xs: 240, sm: 300 }, '&:nth-of-type(1)': { top: 120, transform: 'translate(-70%)', }, '&:nth-of-type(2)': { top: 80, transform: 'translate(-50%)', }, '&:nth-of-type(3)': { top: 40, transform: 'translate(-30%)', }, }, '&:hover': { '& img': { filter: 'drop-shadow(-16px 12px 20px rgba(61, 71, 82, 0.2))', '&:nth-of-type(1)': { top: 0, transform: 'scale(0.8) translate(-108%) rotateY(30deg)', }, '&:nth-of-type(2)': { top: 40, transform: 'scale(0.8) translate(-54%) rotateY(30deg)', }, '&:nth-of-type(3)': { top: 40, transform: 'scale(0.8) translate(-0%) rotateY(30deg)', }, }, }, }, (theme) => theme.applyDarkStyles({ '&:hover': { '& img': { filter: 'drop-shadow(-16px 12px 20px rgba(0, 0, 0, 0.4))', }, }, }), ]} > <Image src={`/static/branding/design-kits/Button-light.jpeg`} alt="" loading="lazy" sx={(theme) => theme.applyDarkStyles({ content: `url(/static/branding/design-kits/Button-dark.jpeg)`, }) } /> <Image src={`/static/branding/design-kits/Alert-light.jpeg`} alt="" loading="lazy" sx={(theme) => theme.applyDarkStyles({ content: `url(/static/branding/design-kits/Alert-dark.jpeg)`, }) } /> <Image src={`/static/branding/design-kits/Slider-light.jpeg`} alt="" loading="lazy" sx={(theme) => theme.applyDarkStyles({ content: `url(/static/branding/design-kits/Slider-dark.jpeg)`, }) } /> </Box> </Fade> <Fade in={demo === 'Branding'} timeout={500}> <Image src={`/static/branding/design-kits/Colors-light.jpeg`} alt="" loading="lazy" width="300" sx={(theme) => ({ width: { sm: 400 }, position: 'absolute', left: '50%', top: '50%', transform: 'translate(-50%, -50%)', ...theme.applyDarkStyles({ content: `url(/static/branding/design-kits/Colors-dark.jpeg)`, }), })} /> </Fade> <Fade in={demo === 'Iconography'} timeout={500}> <Image src={`/static/branding/design-kits/Icons-light.jpeg`} alt="" loading="lazy" width="300" sx={(theme) => ({ width: { sm: 500 }, position: 'absolute', left: '50%', top: 60, transform: 'translate(-40%)', ...theme.applyDarkStyles({ content: `url(/static/branding/design-kits/Icons-dark.jpeg)`, }), })} /> </Fade> </Frame.Demo> <Frame.Info data-mui-color-scheme="dark" sx={{ display: 'flex', alignItems: { xs: 'start', sm: 'center' }, flexDirection: { xs: 'column', sm: 'row' }, minWidth: 0, gap: { xs: 3, sm: 0 }, }} > <Box sx={{ display: 'flex', flexDirection: { xs: 'column', sm: 'row' }, alignItems: { xs: 'start', sm: 'center' }, gap: 1, }} > <Typography variant="body2" fontWeight="semiBold"> Available for: </Typography> <Box sx={{ display: 'flex', gap: 1, '& >img': { width: 26, height: 26 } }}> <img src="/static/branding/design-kits/figma-logo.svg" alt="" loading="lazy" /> <img src="/static/branding/design-kits/sketch-logo.svg" alt="" loading="lazy" /> <img src="/static/branding/design-kits/adobexd-logo.svg" alt="" loading="lazy" /> </Box> </Box> <Button component={Link} variant="outlined" href="https://mui.com/store/?utm_source=marketing&utm_medium=referral&utm_campaign=design-cta2#design" endIcon={<LaunchRounded sx={{ '&&': { fontSize: 16 } }} />} sx={{ ml: { xs: 0, sm: 'auto' }, color: 'primary.300', width: { xs: '100%', sm: 'fit-content' }, }} > Buy now </Button> </Frame.Info> </Frame> </Grid> </Grid> </Section> ); }
5,194
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productMaterial/MaterialHero.tsx
import * as React from 'react'; import { experimental_extendTheme as extendTheme, Experimental_CssVarsProvider as CssVarsProvider, } from '@mui/material/styles'; import Alert from '@mui/material/Alert'; import Avatar from '@mui/material/Avatar'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Checkbox from '@mui/material/Checkbox'; import Card from '@mui/material/Card'; import CardHeader from '@mui/material/CardHeader'; import CardMedia from '@mui/material/CardMedia'; import CardContent from '@mui/material/CardContent'; import CardActions from '@mui/material/CardActions'; import Divider from '@mui/material/Divider'; import IconButton from '@mui/material/IconButton'; 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 Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import Tabs from '@mui/material/Tabs'; import Tab from '@mui/material/Tab'; import TextField from '@mui/material/TextField'; import Slider from '@mui/material/Slider'; import Stack from '@mui/material/Stack'; import Stepper from '@mui/material/Stepper'; import Step from '@mui/material/Step'; import StepLabel from '@mui/material/StepLabel'; import CheckCircleRounded from '@mui/icons-material/CheckCircleRounded'; import CakeRounded from '@mui/icons-material/CakeRounded'; import CelebrationRounded from '@mui/icons-material/CelebrationRounded'; import AttractionsRounded from '@mui/icons-material/AttractionsRounded'; import NotificationsIcon from '@mui/icons-material/Notifications'; import DownloadIcon from '@mui/icons-material/Download'; import LocalFireDepartment from '@mui/icons-material/LocalFireDepartment'; import AcUnitRounded from '@mui/icons-material/AcUnitRounded'; import FavoriteBorderRounded from '@mui/icons-material/FavoriteBorderRounded'; import ShareRounded from '@mui/icons-material/ShareRounded'; import RateReviewOutlined from '@mui/icons-material/RateReviewOutlined'; import Accordion from '@mui/material/Accordion'; import AccordionSummary from '@mui/material/AccordionSummary'; import AccordionDetails from '@mui/material/AccordionDetails'; import ExpandMoreRoundedIcon from '@mui/icons-material/ExpandMore'; import Rating from '@mui/material/Rating'; import Switch from '@mui/material/Switch'; import FormatAlignLeftIcon from '@mui/icons-material/FormatAlignLeft'; import FormatAlignCenterIcon from '@mui/icons-material/FormatAlignCenter'; import FormatAlignRightIcon from '@mui/icons-material/FormatAlignRight'; import ToggleButton from '@mui/material/ToggleButton'; import ToggleButtonGroup from '@mui/material/ToggleButtonGroup'; import Badge from '@mui/material/Badge'; import AddIcon from '@mui/icons-material/Add'; import RemoveIcon from '@mui/icons-material/Remove'; import ButtonGroup from '@mui/material/ButtonGroup'; import IconImage from 'docs/src/components/icon/IconImage'; import HeroContainer from 'docs/src/layouts/HeroContainer'; import GetStartedButtons from 'docs/src/components/home/GetStartedButtons'; import GradientText from 'docs/src/components/typography/GradientText'; import { getDesignTokens } from 'docs/src/modules/brandingTheme'; import Link from 'docs/src/modules/components/Link'; import ROUTES from 'docs/src/route'; function Checkboxes() { const label = { inputProps: { 'aria-label': 'Checkbox demo' } }; return ( <React.Fragment> <Checkbox {...label} defaultChecked /> <Checkbox {...label} /> </React.Fragment> ); } function ToggleButtons() { const [alignment, setAlignment] = React.useState('left'); return ( <Paper elevation={0} variant="outlined" sx={{ p: 2 }}> <ToggleButtonGroup value={alignment} exclusive onChange={(event, newAlignment) => { setAlignment(newAlignment); }} aria-label="text alignment" > <ToggleButton value="left" aria-label="left aligned" size="small"> <FormatAlignLeftIcon fontSize="small" /> </ToggleButton> <ToggleButton value="center" aria-label="centered" size="small"> <FormatAlignCenterIcon fontSize="small" /> </ToggleButton> <ToggleButton value="right" aria-label="right aligned" size="small" disabled> <FormatAlignRightIcon fontSize="small" /> </ToggleButton> </ToggleButtonGroup> </Paper> ); } function TabsDemo() { const [index, setIndex] = React.useState(0); return ( <Paper> <Tabs value={index} onChange={(event, newIndex) => setIndex(newIndex)} variant="fullWidth" aria-label="icon label tabs example" > <Tab icon={<CakeRounded fontSize="small" />} label="Cakes" /> <Tab icon={<CelebrationRounded fontSize="small" />} label="Party" /> <Tab icon={<AttractionsRounded fontSize="small" />} label="Park" /> </Tabs> </Paper> ); } function BadgeVisibilityDemo() { const [count, setCount] = React.useState(1); return ( <Paper variant="outlined" elevation={0} sx={{ width: '100%', color: 'action.active', p: 2, display: 'flex', flexDirection: 'column', alignItems: 'center', '& .MuiBadge-root': { marginRight: 4, }, }} > <div> <Badge color="primary" badgeContent={count}> <NotificationsIcon fontSize="small" /> </Badge> <ButtonGroup> <Button size="small" aria-label="reduce" onClick={() => { setCount(Math.max(count - 1, 0)); }} > <RemoveIcon fontSize="small" /> </Button> <Button size="small" aria-label="increase" onClick={() => { setCount(count + 1); }} > <AddIcon fontSize="small" /> </Button> </ButtonGroup> </div> </Paper> ); } function SwitchToggleDemo() { const label = { inputProps: { 'aria-label': 'Switch demo' } }; return ( <Box sx={{ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }} > <Switch {...label} defaultChecked /> <Switch {...label} /> <Checkboxes /> <ToggleButtons /> </Box> ); } function SlideDemo() { const [value, setValue] = React.useState([30, 60]); return ( <Stack spacing={2} direction="row" alignItems="center"> <AcUnitRounded fontSize="small" color="primary" sx={{ opacity: `max(0.4, ${(100 - value[0]) / 100})` }} /> <Slider aria-labelledby="temperature-slider" value={value} onChange={(_, newValue) => setValue(newValue as number[])} /> <LocalFireDepartment fontSize="small" color="error" sx={{ opacity: `max(0.4, ${value[1] / 100})` }} /> </Stack> ); } const { palette: lightPalette } = getDesignTokens('light'); const { palette: darkPalette } = getDesignTokens('dark'); const customTheme = extendTheme({ cssVarPrefix: 'hero', colorSchemes: { light: { palette: { ...(lightPalette?.primary && { primary: lightPalette?.primary }), ...(lightPalette?.grey && { grey: lightPalette?.grey }), ...(lightPalette?.background && { background: lightPalette?.background }), }, }, dark: { palette: { ...(darkPalette?.primary && { primary: darkPalette?.primary }), ...(darkPalette?.grey && { grey: darkPalette?.grey }), ...(darkPalette?.background && { background: darkPalette?.background }), }, }, }, }); export default function MaterialHero() { return ( <HeroContainer linearGradient left={ <Box sx={{ textAlign: { xs: 'center', md: 'left' } }}> <Typography fontWeight="bold" variant="body2" sx={(theme) => ({ color: 'primary.600', display: 'flex', alignItems: 'center', gap: 1, justifyContent: { xs: 'center', md: 'flex-start' }, ...theme.applyDarkStyles({ color: 'primary.300', }), })} > <IconImage loading="eager" width={28} height={28} name="product-core" />{' '} <Link href={ROUTES.productCore}>MUI Core</Link>{' '} <Typography component="span" variant="inherit" sx={{ color: 'divider' }}> / </Typography> <Typography component="span" variant="inherit" sx={{ color: 'text.primary' }}> Material UI </Typography> </Typography> <Typography variant="h1" sx={{ my: 2, maxWidth: 500 }}> Ready to use <br /> <GradientText>Material Design</GradientText> <br /> components </Typography> <Typography color="text.secondary" sx={{ mb: 3, maxWidth: 500 }}> Material UI is beautiful by design and features a suite of customization options that make it easy to implement your own custom design system. </Typography> <GetStartedButtons primaryUrl={ROUTES.materialDocs} secondaryLabel="View templates" secondaryUrl={ROUTES.freeTemplates} altInstallation="npm install @mui/material @emotion/react @emotion/styled" /> </Box> } rightSx={{ p: 3, minWidth: 2000, flexDirection: 'column', overflow: 'hidden', // the components on the Hero section are mostly illustrative, even though they're interactive. That's why scrolling is disabled. }} right={ <CssVarsProvider theme={customTheme}> <Paper sx={{ maxWidth: 780, p: 2, mb: 4 }}> <Stepper activeStep={1}> <Step> <StepLabel>Search for React UI libraries</StepLabel> </Step> <Step> <StepLabel>Spot Material UI</StepLabel> </Step> <Step> <StepLabel>Choose Material UI</StepLabel> </Step> </Stepper> </Paper> <Box sx={{ '& > div': { width: 370, display: 'inline-flex', verticalAlign: 'top', }, }} > <Stack spacing={4}> <div> <Accordion elevation={0} variant="outlined" defaultExpanded disableGutters sx={{ borderBottom: 0 }} > <AccordionSummary expandIcon={<ExpandMoreRoundedIcon fontSize="small" />} aria-controls="panel1a-content" id="panel1a-header" > <Typography variant="body2">Usage</Typography> </AccordionSummary> <AccordionDetails> <Typography variant="body2"> Material UI components work in isolation. They are self-contained, and will only inject the styles they need to display. </Typography> </AccordionDetails> </Accordion> <Accordion elevation={0} variant="outlined" disableGutters> <AccordionSummary expandIcon={<ExpandMoreRoundedIcon fontSize="small" />} aria-controls="panel2a-content" id="panel2a-header" > <Typography variant="body2">Globals</Typography> </AccordionSummary> <AccordionDetails> <Typography variant="body2"> Material UI understands a handful of important globals that you&apos;ll need to be aware of. </Typography> </AccordionDetails> </Accordion> <Accordion disabled elevation={0} disableGutters> <AccordionSummary expandIcon={<ExpandMoreRoundedIcon fontSize="small" />} aria-controls="panel3a-content" id="panel3a-header" > <Typography variant="body2">Secret Files</Typography> </AccordionSummary> </Accordion> </div> <Alert variant="filled" color="info" icon={<CheckCircleRounded fontSize="small" />}> Check Material UI out now! </Alert> <SwitchToggleDemo /> <TabsDemo /> <Paper elevation={0} variant="outlined" sx={{ overflow: 'hidden' }}> <List sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}> <ListItem alignItems="flex-start"> <ListItemAvatar> <Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" /> </ListItemAvatar> <ListItemText primary="Brunch this weekend?" secondary={ <React.Fragment> <Typography sx={{ display: 'inline' }} component="span" variant="body2" color="text.primary" > Michael Scott </Typography> {" — I'll be in your neighborhood doing errands this…"} </React.Fragment> } /> </ListItem> <Divider variant="inset" component="li" /> <ListItem alignItems="flex-start"> <ListItemAvatar> <Avatar alt="Travis Howard" src="/static/images/avatar/2.jpg" /> </ListItemAvatar> <ListItemText primary="Summer BBQ" secondary={ <React.Fragment> <Typography sx={{ display: 'inline' }} component="span" variant="body2" color="text.primary" > to Jim, Pam and Ryan </Typography> {" — Wish I could come, but I'm out of town this…"} </React.Fragment> } /> </ListItem> </List> </Paper> </Stack> <Stack spacing={4} sx={{ ml: 4, '& > .MuiPaper-root': { maxWidth: 'none' } }}> <Box sx={{ display: 'flex', gap: 2, '& button': { textWrap: 'nowrap' } }}> <Button variant="contained" startIcon={<DownloadIcon fontSize="small" />} fullWidth> Install library </Button> <Button variant="outlined" startIcon={<DownloadIcon fontSize="small" />} fullWidth> Install library </Button> </Box> <Paper elevation={0} variant="outlined" sx={{ p: 2 }}> <Typography id="temperature-slider" component="div" variant="subtitle2" sx={{ mb: 1, fontWeight: 400 }} > Temperature range </Typography> <SlideDemo /> </Paper> <TextField id="core-hero-input" defaultValue="Material UI" label="Component library" /> <Box sx={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', gap: 2, }} > <BadgeVisibilityDemo /> <Paper variant="outlined" elevation={0} sx={{ width: '100%', py: 2, px: 2, display: 'flex', justifyContent: 'center', alignItems: 'center', }} > <Rating name="half-rating" defaultValue={2.5} precision={0.5} /> </Paper> </Box> <Card sx={{ maxWidth: 345 }}> <CardHeader avatar={ <Avatar sx={{ bgcolor: 'primary.50', color: 'primary.600', fontWeight: 'bold' }} > YN </Avatar> } title="Yosemite National Park" subheader="California, United States" /> <CardMedia height={125} alt="" component="img" image="/static/images/cards/yosemite.jpeg" /> <CardContent sx={{ pb: 0 }}> <Typography variant="body2" color="text.secondary"> Not just a great valley, but a shrine to human foresight, the strength of granite, the power of glaciers, the persistence of life, and the tranquility of the High Sierra. It&apos;s famed for its giant, ancient sequoia trees, and the granite cliffs of El Capitan and Half Dome. </Typography> </CardContent> <CardActions disableSpacing> <IconButton aria-label="add to favorites"> <FavoriteBorderRounded fontSize="small" /> </IconButton> <IconButton aria-label="share"> <ShareRounded fontSize="small" /> </IconButton> <IconButton aria-label="share" sx={{ ml: 'auto' }}> <RateReviewOutlined fontSize="small" /> </IconButton> </CardActions> </Card> </Stack> </Box> </CssVarsProvider> } /> ); }
5,195
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productMaterial/MaterialStyling.tsx
import * as React from 'react'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import AutoAwesomeRounded from '@mui/icons-material/AutoAwesomeRounded'; import DragHandleRounded from '@mui/icons-material/DragHandleRounded'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import GradientText from 'docs/src/components/typography/GradientText'; import Item, { Group } from 'docs/src/components/action/Item'; import Highlighter from 'docs/src/components/action/Highlighter'; import Frame from 'docs/src/components/action/Frame'; import RealEstateCard from 'docs/src/components/showcase/RealEstateCard'; import HighlightedCode from 'docs/src/modules/components/HighlightedCode'; import MarkdownElement from 'docs/src/components/markdown/MarkdownElement'; import FlashCode from 'docs/src/components/animation/FlashCode'; const code = ` <Card variant="outlined" sx={{ p: 1, boxShadow: '0 1px 3px rgba(0, 127, 255, 0.1)', display: 'flex', flexDirection: { xs: 'column', // mobile sm: 'row', // tablet and up }, }} > <CardMedia component="img" width="100" height="100" alt="123 Main St, Phoenix, AZ cover" src="/static/images/cards/real-estate.png" sx={{ borderRadius: 0.5, width: { xs: '100%', sm: 100 }, mr: { sm: 1.5 }, mb: { xs: 1.5, sm: 0 }, }} /> <Box sx={{ alignSelf: 'center', ml: 2 }}> <Typography variant="body2" color="text.secondary" fontWeight="medium"> 123 Main St, Phoenix, AZ </Typography> <Typography fontWeight="bold" noWrap> $280k - $310k </Typography> <Box sx={(theme) => ({ mt: 1, py: 0.4, pl: 0.5, pr: 1, typography: 'caption', borderRadius: 10, display: 'flex', bgcolor: 'primary.50', border: '1px solid', borderColor: 'primary.100', color: 'primary.700', ...theme.applyDarkStyles({ bgcolor: 'primaryDark.700', color: 'primary.200', borderColor: 'primary.900', }), })} > <InfoRounded sx={{ fontSize: 16, mr: 0.5, mt: '1px' }} /> Confidence score: 85% </Box> </Box> </Card>`; const startLine = [34, 25, 6]; const endLine = [48, 30, 8]; const scrollTo = [540, 320, 0]; export const useResizeHandle = ( target: React.MutableRefObject<HTMLDivElement | null>, options?: { minWidth?: string; maxWidth?: string }, ) => { const { minWidth = '0px', maxWidth = '100%' } = options || {}; const [dragging, setDragging] = React.useState(false); const [dragOffset, setDragOffset] = React.useState(0); const isTouchEvent = (event: MouseEvent | TouchEvent): event is TouchEvent => { return Boolean((event as TouchEvent).touches && (event as TouchEvent).touches.length); }; const isMouseEvent = (event: MouseEvent | TouchEvent): event is MouseEvent => { return Boolean((event as MouseEvent).clientX || (event as MouseEvent).clientX === 0); }; const getClientX = React.useCallback((event: MouseEvent | TouchEvent) => { let clientX; if (isMouseEvent(event)) { clientX = event.clientX; } if (isTouchEvent(event)) { clientX = event.touches[0].clientX; } return clientX as number; }, []); const handleStart = (event: React.MouseEvent | React.TouchEvent) => { const clientX = getClientX(event.nativeEvent); const rect = (event.target as HTMLElement).getBoundingClientRect(); setDragging(true); setDragOffset(rect.width - (clientX - rect.x)); }; React.useEffect(() => { function resizeObject(event: MouseEvent | TouchEvent) { if (event.cancelable) { event.preventDefault(); } const clientX = getClientX(event); if (target.current && dragging && clientX) { const objectRect = target.current.getBoundingClientRect(); const newWidth = clientX - objectRect.left + dragOffset; target.current.style.width = `clamp(${minWidth}, ${Math.floor(newWidth)}px, ${maxWidth})`; } } function stopResize() { setDragging(false); } if (dragging) { document.addEventListener('mousemove', resizeObject, { passive: false }); document.addEventListener('mouseup', stopResize); document.addEventListener('touchmove', resizeObject, { passive: false }); document.addEventListener('touchend', stopResize); return () => { document.removeEventListener('mousemove', resizeObject); document.removeEventListener('mouseup', stopResize); document.removeEventListener('touchmove', resizeObject); document.removeEventListener('touchend', stopResize); }; } return () => {}; }, [dragOffset, dragging, getClientX, maxWidth, minWidth, target]); return { dragging, getDragHandlers: () => ({ onTouchStart: handleStart, onMouseDown: handleStart, }), }; }; export default function MaterialStyling() { const [index, setIndex] = React.useState(0); const objectRef = React.useRef<HTMLDivElement | null>(null); const { dragging, getDragHandlers } = useResizeHandle(objectRef, { minWidth: '253px' }); const infoRef = React.useRef<HTMLDivElement | null>(null); function getSelectedProps(i: number) { return { selected: index === i, sx: { '& svg': { opacity: index === i ? 1 : 0.5 } }, }; } React.useEffect(() => { if (infoRef.current) { infoRef.current.scroll({ top: scrollTo[index], behavior: 'smooth' }); } if (objectRef.current) { objectRef.current.style.width = '100%'; } }, [index]); return ( <Section> <Grid container spacing={2}> <Grid item md={6} sx={{ minWidth: 0 }}> <Box sx={{ maxWidth: 500 }}> <SectionHeadline overline="Styling" title={ <Typography variant="h2"> Rapidly add and tweak any styles using <GradientText>CSS utilities</GradientText> </Typography> } description="CSS utilities allow you to move faster and make for a smooth developer experience when styling any component." /> </Box> <Group sx={{ mt: 4, pb: { xs: 0, md: 2 } }}> <Highlighter disableBorder {...getSelectedProps(0)} onClick={() => setIndex(0)}> <Item icon={<AutoAwesomeRounded color="warning" />} title="Leverage the tokens from your theme" description="Easily use the design tokens defined in your theme for any CSS property out there." /> </Highlighter> <Highlighter disableBorder {...getSelectedProps(1)} onClick={() => setIndex(1)}> <Item icon={<AutoAwesomeRounded color="warning" />} title="No context switching" description="The styling and component usage are both in the same place, right where you need them." /> </Highlighter> <Highlighter disableBorder {...getSelectedProps(2)} onClick={() => setIndex(2)}> <Item icon={<AutoAwesomeRounded color="warning" />} title="Responsive styles right inside system prop" description="An elegant API for writing CSS media queries that match your theme breakpoints." /> </Highlighter> </Group> </Grid> <Grid item xs={12} md={6}> <Frame sx={{ height: '100%' }}> <Frame.Demo sx={{ overflow: 'auto', }} > <Box ref={objectRef} style={{ touchAction: dragging ? 'none' : 'auto' }} sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', position: 'relative', p: { xs: 2, sm: 5 }, pr: { xs: 2, sm: 3 }, minHeight: index === 2 ? 280 : 'initial', backgroundColor: 'transparent', }} > {index === 2 && ( <React.Fragment> <Box sx={[ { cursor: 'col-resize', display: 'flex', alignItems: 'center', position: 'absolute', right: 0, top: 0, height: '100%', color: 'grey.500', '&:hover': { color: 'grey.700', }, }, (theme) => theme.applyDarkStyles({ color: 'grey.500', '&:hover': { color: 'grey.300', }, }), ]} {...getDragHandlers()} > <DragHandleRounded sx={{ transform: 'rotate(90deg)' }} /> </Box> <Box sx={(theme) => ({ pointerEvents: 'none', width: '1px', bgcolor: 'grey.200', position: 'absolute', left: 375, height: '100%', ...theme.applyDarkStyles({ bgcolor: 'primaryDark.600', }), })} > <Box sx={(theme) => ({ position: 'absolute', bottom: 5, typography: 'caption', fontFamily: 'code', left: -30, color: 'text.secondary', borderRadius: '4px', bgcolor: 'grey.50', border: '1px solid', borderColor: 'grey.200', px: 0.5, ...theme.applyDarkStyles({ bgcolor: 'primaryDark.700', borderColor: 'primaryDark.600', }), })} > xs </Box> <Box sx={(theme) => ({ position: 'absolute', bottom: 5, typography: 'caption', fontFamily: 'code', left: 7, color: 'text.secondary', borderRadius: '4px', bgcolor: 'grey.50', border: '1px solid', borderColor: 'grey.200', px: 0.5, ...theme.applyDarkStyles({ bgcolor: 'primaryDark.700', borderColor: 'primaryDark.600', }), })} > sm </Box> </Box> </React.Fragment> )} <RealEstateCard sx={{ width: '100%', maxWidth: 343 }} /> </Box> </Frame.Demo> <Frame.Info ref={infoRef} sx={{ maxHeight: index === 2 ? 282 : 400, overflow: 'auto', }} > <Box sx={{ position: 'relative', '&& pre': { bgcolor: 'transparent' } }}> <Box sx={{ position: 'relative', zIndex: 1 }}> <HighlightedCode copyButtonHidden component={MarkdownElement} code={code} language="jsx" /> </Box> <FlashCode startLine={startLine[index]} endLine={endLine[index]} sx={{ mx: -1 }} /> </Box> </Frame.Info> </Frame> </Grid> </Grid> </Section> ); }
5,196
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productMaterial/MaterialTemplates.tsx
import * as React from 'react'; import SwipeableViews from 'react-swipeable-views'; import { alpha } from '@mui/material/styles'; import Box from '@mui/material/Box'; import ButtonBase, { ButtonBaseProps } from '@mui/material/ButtonBase'; import Typography from '@mui/material/Typography'; import LaunchRounded from '@mui/icons-material/LaunchRounded'; import DashboardRounded from '@mui/icons-material/DashboardRounded'; import Layers from '@mui/icons-material/Layers'; import ShoppingBag from '@mui/icons-material/ShoppingBag'; import KeyboardArrowLeftRounded from '@mui/icons-material/KeyboardArrowLeftRounded'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import GradientText from 'docs/src/components/typography/GradientText'; import Item, { Group } from 'docs/src/components/action/Item'; import Highlighter from 'docs/src/components/action/Highlighter'; import Frame from 'docs/src/components/action/Frame'; import Link from 'docs/src/modules/components/Link'; import More from 'docs/src/components/action/More'; export const DEMOS = ['Dashboard', 'Landing Pages', 'E-commerce']; export const icons = { [DEMOS[0]]: <DashboardRounded fontSize="small" />, [DEMOS[1]]: <Layers fontSize="small" />, [DEMOS[2]]: <ShoppingBag fontSize="small" />, }; export const TEMPLATES = { [DEMOS[0]]: [ { name: 'Devias Kit Pro - Client & Admin Dashboard', src: { light: '/static/branding/store-templates/template-4light.jpg', dark: '/static/branding/store-templates/template-4dark.jpg', }, href: 'https://mui.com/store/items/devias-kit-pro/', }, { name: 'Minimal - Client & Admin Dashboard', src: { light: '/static/branding/store-templates/template-1light.jpg', dark: '/static/branding/store-templates/template-1dark.jpg', }, href: 'https://mui.com/store/items/minimal-dashboard/', }, { name: 'Berry - React Material Admin Dashboard Template', src: { light: '/static/branding/store-templates/template-5light.jpg', dark: '/static/branding/store-templates/template-5dark.jpg', }, href: 'https://mui.com/store/items/berry-react-material-admin/', }, { name: 'Mira Pro - React Material Admin Dashboard', src: { light: '/static/branding/store-templates/template-3light.jpg', dark: '/static/branding/store-templates/template-3dark.jpg', }, href: 'https://mui.com/store/items/mira-pro-react-material-admin-dashboard/', }, ], [DEMOS[1]]: [ { name: 'theFront - Multipurpose Template + UI Kit', src: { light: '/static/branding/store-templates/template-2light.jpg', dark: '/static/branding/store-templates/template-2dark.jpg', }, href: 'https://mui.com/store/items/the-front-landing-page/', }, { name: 'Webbee - Multipurpose landing page UI Kit', src: { light: '/static/branding/store-templates/template-6light.jpg', dark: '/static/branding/store-templates/template-6dark.jpg', }, href: 'https://mui.com/store/items/webbee-landing-page/', }, ], [DEMOS[2]]: [ { name: 'Bazar Pro - Multipurpose React Ecommerce Template', src: { light: '/static/branding/store-templates/template-bazar-light.jpg', dark: '/static/branding/store-templates/template-bazar-dark.jpg', }, href: 'https://mui.com/store/items/bazar-pro-react-ecommerce-template/', }, ], }; function ActionArea(props: ButtonBaseProps) { return ( <ButtonBase {...props} sx={[ (theme) => ({ width: { xs: 70, sm: 100 }, height: { xs: 70, sm: 100 }, position: 'absolute', top: 'calc(50% - 50px)', p: 1.5, color: '#FFF', borderRadius: '50%', transition: '0.2s', backdropFilter: 'blur(4px)', bgcolor: alpha(theme.palette.primary[500], 0.5), '& > svg': { transition: '0.2s' }, '&.Mui-disabled': { opacity: 0, }, '&:hover, &:focus': { '& > svg': { fontSize: 28 }, }, }), ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} /> ); } export default function MaterialTemplates() { const [demo, setDemo] = React.useState(DEMOS[0]); const [templateIndex, setTemplateIndex] = React.useState(1); const templates = TEMPLATES[demo]; return ( <Section bg="gradient" cozy> <Box sx={{ maxWidth: 550, m: 'auto' }}> <SectionHeadline alwaysCenter overline="Templates" title={ <Typography variant="h2"> The right template for your <br /> <GradientText>specific use case</GradientText> </Typography> } description="A collection of 4.5 average rating templates, for multiple use cases, all powered by Material UI components and carefully curated by MUI's team." /> </Box> <Group rowLayout desktopColumns={2} sx={{ mt: 3 }}> {DEMOS.map((name) => ( <Highlighter key={name} selected={name === demo} onClick={() => { setDemo(name); setTemplateIndex(0); }} > <Item icon={React.cloneElement(icons[name], name === demo ? { color: 'primary' } : {})} title={name} /> </Highlighter> ))} <More component={Link} href="https://mui.com/store/?utm_source=marketing&utm_medium=referral&utm_campaign=material-templates-cta2#populars" noLinkStyle /> </Group> <Frame sx={{ mt: 3 }}> <Frame.Demo sx={{ minHeight: { xs: 240, sm: 320 }, height: { xs: 260, sm: 400, md: 500 } }}> <Box sx={{ overflow: 'hidden', position: 'absolute', left: 0, right: 0, top: '50%', py: 2, transform: 'translate(0px, -50%)', '& > div': { px: '12%', overflow: 'unset !important' }, '& .react-swipeable-view-container > div': { overflow: 'unset !important', }, }} > <SwipeableViews springConfig={{ duration: '0.6s', delay: '0s', easeFunction: 'cubic-bezier(0.15, 0.3, 0.25, 1)', }} index={templateIndex} resistance enableMouseEvents onChangeIndex={(index) => setTemplateIndex(index)} > {templates.map((item, index) => ( <Box key={item.name} sx={(theme) => ({ overflow: 'auto', borderRadius: 1, height: { xs: 220, sm: 320, md: 450 }, backgroundImage: `url(${item.src.light})`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat', border: '1px solid', borderColor: templateIndex === index ? 'primary.100' : 'divider', boxShadow: `0px 2px 12px ${alpha(theme.palette.primary[200], 0.3)}`, transition: '0.6s cubic-bezier(0.15, 0.3, 0.25, 1)', transform: templateIndex !== index ? 'scale(0.92)' : 'scale(1)', ...theme.applyDarkStyles({ backgroundImage: `url(${item.src.dark})`, borderColor: templateIndex === index ? 'primary.800' : 'divider', boxShadow: `0px 2px 12px ${alpha(theme.palette.primary[900], 0.5)}`, }), })} > <Link href={`${item.href}?utm_source=marketing&utm_medium=referral&utm_campaign=templates-cta2`} noLinkStyle target="_blank" sx={[ (theme) => ({ display: 'flex', alignItems: 'center', justifyContent: 'center', flexDirection: 'column', gap: 1, transition: '0.2s', position: 'absolute', width: '100%', height: '100%', opacity: 0, top: 0, left: 0, bgcolor: alpha(theme.palette.primary[50], 0.6), backdropFilter: 'blur(4px)', textDecoration: 'none', '&:hover, &:focus': { opacity: 1, }, ...theme.applyDarkStyles({ bgcolor: alpha(theme.palette.primaryDark[900], 0.6), }), }), ]} > <Typography component="p" variant="h6" fontWeight="bold" textAlign="center" sx={[ (theme) => ({ color: 'text.primary', ...theme.applyDarkStyles({ color: '#FFF', }), }), ]} > {templates[templateIndex].name} </Typography> <Box sx={[ (theme) => ({ display: 'flex', alignItems: 'center', gap: 0.5, color: 'primary.500', ...theme.applyDarkStyles({ color: 'primary.100', }), }), ]} > <Typography fontWeight="bold">Buy now</Typography> <LaunchRounded fontSize="small" /> </Box> </Link> </Box> ))} </SwipeableViews> {templates.length > 1 && ( <React.Fragment> <ActionArea aria-label="Previous template" disabled={templateIndex === 0} onClick={() => setTemplateIndex((current) => Math.max(0, current - 1))} sx={{ left: 0, transform: 'translate(-50%)', justifyContent: 'flex-end' }} > <KeyboardArrowLeftRounded /> </ActionArea> <ActionArea aria-label="Next template" disabled={templateIndex === templates.length - 1} onClick={() => setTemplateIndex((current) => Math.min(templates.length - 1, current + 1)) } sx={{ right: 0, transform: 'translate(50%)', justifyContent: 'flex-start' }} > <KeyboardArrowRightRounded /> </ActionArea> </React.Fragment> )} </Box> </Frame.Demo> </Frame> </Section> ); }
5,197
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productMaterial/MaterialTheming.tsx
import * as React from 'react'; import { Experimental_CssVarsProvider as CssVarsProvider } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import AutoAwesomeRounded from '@mui/icons-material/AutoAwesomeRounded'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import GradientText from 'docs/src/components/typography/GradientText'; import Item, { Group } from 'docs/src/components/action/Item'; import Highlighter from 'docs/src/components/action/Highlighter'; import SvgMaterialDesign from 'docs/src/icons/SvgMaterialDesign'; import Frame from 'docs/src/components/action/Frame'; import PlayerCard from 'docs/src/components/showcase/PlayerCard'; import HighlightedCode from 'docs/src/modules/components/HighlightedCode'; import MarkdownElement from 'docs/src/components/markdown/MarkdownElement'; const code = ` <Card variant="outlined" sx={{ p: 2, width: { xs: '100%', sm: 'auto' }, display: 'flex', flexDirection: { xs: 'column', sm: 'row' }, alignItems: 'center', gap: 2, }} > <CardMedia component="img" width="100" height="100" alt="Contemplative Reptile album cover" src="/static/images/cards/contemplative-reptile.jpg" sx={{ width: { xs: '100%', sm: 100 }, borderRadius: 0.6, }} /> <Stack direction="column" spacing={2} alignItems="center"> <Stack direction="column" spacing={0.2} alignItems="center"> <Typography color="text.primary" fontWeight="medium" fontSize={15}> Contemplative Reptile </Typography> <Typography component="div" variant="caption" color="text.secondary" fontWeight="regular" > Sounds of Nature </Typography> </Stack> <Stack direction="row" alignItems="center" spacing={1.5}> <IconButton disabled aria-label="shuffle" size="small" sx={{ flexGrow: 0 }}> <ShuffleRoundedIcon fontSize="small" /> </IconButton> <IconButton aria-label="fast rewind" disabled size="small"> <FastRewindRounded fontSize="small" /> </IconButton> <IconButton aria-label={paused ? 'play' : 'pause'} sx={{ mx: 1 }} onClick={() => setPaused((val) => !val)} > {paused ? <PlayArrowRounded /> : <PauseRounded />} </IconButton> <IconButton aria-label="fast forward" disabled size="small"> <FastForwardRounded fontSize="small" /> </IconButton> <IconButton aria-label="loop" disabled size="small"> <LoopRoundedIcon fontSize="small" /> </IconButton> </Stack> </Stack> </Card>`; export default function MaterialTheming() { const [customized, setCustomized] = React.useState(true); return ( <Section> <Grid container spacing={2}> <Grid item md={6} sx={{ minWidth: 0 }}> <Box sx={{ maxWidth: 500 }}> <SectionHeadline overline="Theming" title={ <Typography variant="h2"> Build <GradientText>your design system</GradientText> just as you want it to be </Typography> } description="Start quickly with Material Design or use the advanced theming feature to easily tailor the components to your needs." /> </Box> <Group sx={{ mt: 4, pb: { xs: 0, md: 2 } }}> <Highlighter disableBorder selected={customized} onClick={() => setCustomized(true)}> <Item icon={<AutoAwesomeRounded color="warning" />} title="Custom Theme" description="Theming allows you to use your brand's design tokens, easily making the components reflect its look and feel." /> </Highlighter> <Highlighter disableBorder selected={!customized} onClick={() => setCustomized(false)}> <Item icon={<SvgMaterialDesign />} title="Material Design" description="Every component comes with Google's tried and tested design system ready for use." /> </Highlighter> </Group> </Grid> <Grid item xs={12} md={6}> <Frame sx={{ height: '100%' }}> <Frame.Demo sx={{ p: 2, flexGrow: 1, display: 'flex', justifyContent: 'center', alignItems: 'center', minHeight: 188, }} > {customized ? ( <PlayerCard extraStyles /> ) : ( <CssVarsProvider> <PlayerCard disableTheming /> </CssVarsProvider> )} </Frame.Demo> <Frame.Info sx={{ maxHeight: 300, overflow: 'auto' }}> <HighlightedCode copyButtonHidden component={MarkdownElement} code={code} language="jsx" /> </Frame.Info> </Frame> </Grid> </Grid> </Section> ); }
5,198
0
petrpan-code/mui/material-ui/docs/src/components
petrpan-code/mui/material-ui/docs/src/components/productTemplate/TemplateDemo.tsx
import * as React from 'react'; import SwipeableViews from 'react-swipeable-views'; import { alpha } from '@mui/material/styles'; import Box from '@mui/material/Box'; import ButtonBase, { ButtonBaseProps } from '@mui/material/ButtonBase'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import LaunchRounded from '@mui/icons-material/LaunchRounded'; import KeyboardArrowLeftRounded from '@mui/icons-material/KeyboardArrowLeftRounded'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; import GradientText from 'docs/src/components/typography/GradientText'; import Item, { Group } from 'docs/src/components/action/Item'; import Highlighter from 'docs/src/components/action/Highlighter'; import Frame from 'docs/src/components/action/Frame'; import Link from 'docs/src/modules/components/Link'; import More from 'docs/src/components/action/More'; import { DEMOS, icons, TEMPLATES } from 'docs/src/components/productMaterial/MaterialTemplates'; function ActionArea(props: ButtonBaseProps) { return ( <ButtonBase {...props} sx={[ (theme) => ({ width: 100, height: 100, borderRadius: '50%', transition: '0.2s', '&.Mui-disabled': { opacity: 0, }, '& > svg': { transition: '0.2s' }, backdropFilter: 'blur(4px)', bgcolor: alpha(theme.palette.primaryDark[500], 0.5), '&:hover, &:focus': { '& > svg': { fontSize: 28 }, }, position: 'absolute', top: 'calc(50% - 50px)', color: '#fff', p: 1.5, ...theme.applyDarkStyles({ bgcolor: alpha(theme.palette.primary[500], 0.5), }), }), ...(Array.isArray(props.sx) ? props.sx : [props.sx]), ]} /> ); } export default function TemplateDemo() { const [demo, setDemo] = React.useState(DEMOS[0]); const [templateIndex, setTemplateIndex] = React.useState(0); const templates = TEMPLATES[demo]; return ( <Section bg="gradient"> <Grid container spacing={2} alignItems="center"> <Grid item md={6} sx={{ minWidth: 0 }}> <SectionHeadline overline="Templates" title={ <Typography variant="h2"> The right template for your <GradientText>specific use case</GradientText> </Typography> } description="A collection of 4.5 average rating templates, for multiple use cases, all powered by Material UI components and carefully curated by MUI's team. " /> <Group desktopColumns={2} sx={{ m: -2, p: 2 }}> {DEMOS.map((name) => ( <Highlighter key={name} selected={name === demo} onClick={() => { setDemo(name); setTemplateIndex(0); }} > <Item icon={React.cloneElement(icons[name], name === demo ? { color: 'primary' } : {})} title={name} /> </Highlighter> ))} <More component={Link} href="https://mui.com/store/?utm_source=marketing&utm_medium=referral&utm_campaign=templates-cta2#populars" noLinkStyle /> </Group> </Grid> <Grid item xs={12} md={6}> <Frame> <Frame.Demo sx={{ minHeight: { xs: 240, sm: 320 } }}> <Box sx={{ overflow: 'hidden', position: 'absolute', left: 0, right: 0, top: '50%', py: 2, transform: 'translate(0px, -50%)', '& > div': { px: '12%', overflow: 'unset !important' }, '& .react-swipeable-view-container > div': { overflow: 'unset !important', }, }} > <SwipeableViews springConfig={{ duration: '0.6s', delay: '0s', easeFunction: 'cubic-bezier(0.15, 0.3, 0.25, 1)', }} index={templateIndex} resistance enableMouseEvents onChangeIndex={(index) => setTemplateIndex(index)} > {templates.map((item, index) => ( <Box key={item.name} sx={(theme) => ({ borderRadius: 1, height: { xs: 200, sm: 240 }, backgroundImage: `url(${item.src.light})`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat', bgcolor: 'background.paper', boxShadow: '0px 4px 10px rgba(61, 71, 82, 0.25)', transition: '0.6s cubic-bezier(0.15, 0.3, 0.25, 1)', transform: templateIndex !== index ? 'scale(0.92)' : 'scale(1)', ...theme.applyDarkStyles({ backgroundImage: `url(${item.src.dark})`, boxShadow: '0px 4px 10px rgba(0, 0, 0, 0.6)', }), })} > <Link href={`${item.href}?utm_source=marketing&utm_medium=referral&utm_campaign=templates-cta2`} noLinkStyle target="_blank" sx={{ transition: '0.3s', borderRadius: 1, position: 'absolute', width: '100%', height: '100%', opacity: 0, top: 0, left: 0, bgcolor: (theme) => alpha(theme.palette.primaryDark[900], 0.4), color: '#fff', display: 'flex', alignItems: 'center', justifyContent: 'center', '&:hover, &:focus': { opacity: 1, }, }} > <Typography fontWeight="bold">Go to store</Typography> <LaunchRounded fontSize="small" sx={{ ml: 1 }} /> </Link> </Box> ))} </SwipeableViews> {templates.length > 1 && ( <React.Fragment> <ActionArea aria-label="Previous template" disabled={templateIndex === 0} onClick={() => setTemplateIndex((current) => Math.max(0, current - 1))} sx={{ left: 0, transform: 'translate(-50%)', justifyContent: 'flex-end' }} > <KeyboardArrowLeftRounded /> </ActionArea> <ActionArea aria-label="Next template" disabled={templateIndex === templates.length - 1} onClick={() => setTemplateIndex((current) => Math.min(templates.length - 1, current + 1)) } sx={{ right: 0, transform: 'translate(50%)', justifyContent: 'flex-start' }} > <KeyboardArrowRightRounded /> </ActionArea> </React.Fragment> )} </Box> </Frame.Demo> <Frame.Info sx={{ display: 'flex', alignItems: 'center', '& .MuiIconButton-root': { display: { xs: 'none', md: 'inline-flex' } }, }} > <Box sx={{ minWidth: 0 }}> <Typography variant="body2" fontWeight={500} noWrap sx={{ mb: 0.5 }}> {templates[templateIndex].name} </Typography> <Box sx={{ borderRadius: 20, lineHeight: 1, px: 0.5, }} > <Typography color="grey.500" variant="caption"> {templateIndex + 1} / {templates.length} </Typography> </Box> </Box> </Frame.Info> </Frame> </Grid> </Grid> </Section> ); }
5,199