Skip to content

Commit

Permalink
Merge branch 'master' into add-feature-list-component
Browse files Browse the repository at this point in the history
  • Loading branch information
danilo-leal committed Mar 15, 2024
2 parents eaed9d2 + 4b591ff commit d329b04
Show file tree
Hide file tree
Showing 63 changed files with 509 additions and 154 deletions.
6 changes: 3 additions & 3 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"installCommand": "install:codesandbox",
"node": "18",
"packages": [
"packages/docs-utils",
"packages/markdown",
"packages/mui-babel-macros",
"packages/mui-base",
Expand All @@ -23,6 +22,7 @@
"packages/mui-system",
"packages/mui-types",
"packages/mui-utils",
"packages-internal/docs-utils",
"packages-internal/scripts"
],
"publishDirectory": {
Expand All @@ -32,6 +32,7 @@
"@mui/docs": "packages/mui-docs/build",
"@mui/icons-material": "packages/mui-icons-material/build",
"@mui/internal-babel-macros": "packages/mui-babel-macros",
"@mui/internal-docs-utils": "packages-internal/docs-utils",
"@mui/internal-markdown": "packages/markdown",
"@mui/internal-scripts": "packages-internal/scripts",
"@mui/joy": "packages/mui-joy/build",
Expand All @@ -45,8 +46,7 @@
"@mui/styles": "packages/mui-styles/build",
"@mui/system": "packages/mui-system/build",
"@mui/types": "packages/mui-types/build",
"@mui/utils": "packages/mui-utils/build",
"@mui-internal/docs-utils": "packages/docs-utils"
"@mui/utils": "packages/mui-utils/build"
},
"sandboxes": [
"/examples/material-ui-cra-ts",
Expand Down
2 changes: 1 addition & 1 deletion apps/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ packages:
- 'local-ui-lib'
- 'pigment-*'
- '../packages/waterfall'
- '../packages/docs-utils'
- '../packages-internal/docs-utils'
- '../packages/test-utils'
- '../packages-internal/*'
- '../packages/mui-*'
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = function getBabelConfig(api) {
'@mui/material-next': resolveAliasPath('./packages/mui-material-next/src'),
'@mui/joy': resolveAliasPath('./packages/mui-joy/src'),
'@pigment-css/react': resolveAliasPath('./packages/pigment-css-react/src'),
'@mui-internal/docs-utils': resolveAliasPath('./packages/docs-utils/src'),
'@mui/internal-docs-utils': resolveAliasPath('./packages-internal/docs-utils/src'),
docs: resolveAliasPath('./docs'),
test: resolveAliasPath('./test'),
};
Expand Down
24 changes: 22 additions & 2 deletions docs/data/material/components/progress/CustomizedProgressBars.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import Stack from '@mui/material/Stack';
import CircularProgress, {
circularProgressClasses,
} from '@mui/material/CircularProgress';
Expand Down Expand Up @@ -53,12 +54,31 @@ function FacebookCircularProgress(props) {
);
}

// From https://github.com/mui/material-ui/issues/9496#issuecomment-959408221

function GradientCircularProgress() {
return (
<React.Fragment>
<svg width={0} height={0}>
<defs>
<linearGradient id="my_gradient" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" stopColor="#e01cd5" />
<stop offset="100%" stopColor="#1CB5E0" />
</linearGradient>
</defs>
</svg>
<CircularProgress sx={{ 'svg circle': { stroke: 'url(#my_gradient)' } }} />
</React.Fragment>
);
}

export default function CustomizedProgressBars() {
return (
<Box sx={{ flexGrow: 1 }}>
<Stack spacing={2} sx={{ flexGrow: 1 }}>
<FacebookCircularProgress />
<GradientCircularProgress />
<br />
<BorderLinearProgress variant="determinate" value={50} />
</Box>
</Stack>
);
}
23 changes: 21 additions & 2 deletions docs/data/material/components/progress/CustomizedProgressBars.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import Stack from '@mui/material/Stack';
import CircularProgress, {
circularProgressClasses,
CircularProgressProps,
Expand Down Expand Up @@ -54,12 +55,30 @@ function FacebookCircularProgress(props: CircularProgressProps) {
);
}

// From https://github.com/mui/material-ui/issues/9496#issuecomment-959408221
function GradientCircularProgress() {
return (
<React.Fragment>
<svg width={0} height={0}>
<defs>
<linearGradient id="my_gradient" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" stopColor="#e01cd5" />
<stop offset="100%" stopColor="#1CB5E0" />
</linearGradient>
</defs>
</svg>
<CircularProgress sx={{ 'svg circle': { stroke: 'url(#my_gradient)' } }} />
</React.Fragment>
);
}

export default function CustomizedProgressBars() {
return (
<Box sx={{ flexGrow: 1 }}>
<Stack spacing={2} sx={{ flexGrow: 1 }}>
<FacebookCircularProgress />
<GradientCircularProgress />
<br />
<BorderLinearProgress variant="determinate" value={50} />
</Box>
</Stack>
);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<FacebookCircularProgress />
<GradientCircularProgress />
<br />
<BorderLinearProgress variant="determinate" value={50} />
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@
"devDependencies": {
"@babel/plugin-transform-react-constant-elements": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@mui/internal-docs-utils": "workspace:^",
"@mui/internal-scripts": "workspace:^",
"@mui-internal/docs-utils": "workspace:^",
"@mui-internal/test-utils": "workspace:^",
"@types/autosuggest-highlight": "^3.2.3",
"@types/chai": "^4.3.12",
Expand Down
35 changes: 19 additions & 16 deletions docs/pages/experiments/docs/codeblock.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## Tabs

### Codeblock version

<codeblock storageKey="package-manager">

```bash npm
Expand All @@ -23,22 +25,23 @@ pnpm add @mui/material @emotion/react @emotion/styled

</codeblock>

<codeblock storageKey="license">

```bash MIT
npm install @mui/data-grid
```
### Component version

```bash Pro
npm install @mui/data-grid-pro
```
{{"component": "modules/components/HighlightedCodeWithTabs", "tabs": [{"tab":"JS", "code":"<div>Hello</div>", "language": "jsx"}, {"tab": "TS", "code": "type A = {}"}]}}

```bash Premium
npm install @mui/data-grid-premium
## With header path

```jsx title="PlainCssSliderDeep1.js"
import * as React from 'react';
import Slider from '@mui/material/Slider';
import './PlainCssSliderDeep1.css';

export default function PlainCssSliderDeep1() {
return (
<div>
<Slider defaultValue={30} />
<Slider defaultValue={30} className="slider" />
</div>
);
}
```

</codeblock>

## Component

{{"component": "modules/components/HighlightedCodeWithTabs", "tabs": [{"tab":"JS", "code":"<div>Hello</div>", "language": "jsx"}, {"tab": "TS", "code": "type A = {}"}]}}
2 changes: 1 addition & 1 deletion docs/scripts/formattedTSDemos.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const {
createTypeScriptProjectBuilder,
} = require('@mui-internal/api-docs-builder/utils/createTypeScriptProject');
const yargs = require('yargs');
const { fixBabelGeneratorIssues, fixLineEndings } = require('@mui-internal/docs-utils');
const { fixBabelGeneratorIssues, fixLineEndings } = require('@mui/internal-docs-utils');
const { default: CORE_TYPESCRIPT_PROJECTS } = require('../../scripts/coreTypeScriptProjects');

const babelConfig = {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/header/HeaderNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export default function HeaderNavBar() {
id={PRODUCT_IDS[4]}
href={ROUTES.productToolpad}
icon={<IconImage name="product-toolpad" />}
name="MUI Toolpad"
name="Toolpad"
chip={<Chip label="Beta" size="small" color="primary" variant="outlined" />}
description="Low-code admin builder."
/>
Expand Down
8 changes: 4 additions & 4 deletions docs/src/components/header/HeaderNavDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const PRODUCTS = [
href: ROUTES.productDesignKits,
},
{
name: 'MUI Toolpad',
name: 'Toolpad',
description: 'Low-code admin builder.',
href: ROUTES.productToolpad,
chip: 'Beta',
Expand Down Expand Up @@ -110,9 +110,9 @@ const DOCS = [
href: ROUTES.xIntro,
},
{
name: 'MUI Toolpad',
description: 'Low-code admin builder.',
href: ROUTES.toolpadDocs,
name: 'Toolpad',
description: 'Low-code admin builder',
href: ROUTES.toolpadStudioDocs,
chip: 'Beta',
},
];
Expand Down
2 changes: 1 addition & 1 deletion docs/src/layouts/AppFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default function AppFooter(props: AppFooterProps) {
MUI X
</Link>
<Link prefetch={false} href={ROUTES.productToolpad}>
MUI Toolpad
Toolpad
</Link>
<Link prefetch={false} href={ROUTES.productTemplates}>
Templates
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/ApiPage/list/ClassesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as React from 'react';
import { styled } from '@mui/material/styles';
import kebabCase from 'lodash/kebabCase';
import { ComponentClassDefinition } from '@mui-internal/docs-utils';
import { ComponentClassDefinition } from '@mui/internal-docs-utils';
import { useTranslate } from '@mui/docs/i18n';
import ExpandableApiItem, {
ApiItemContaier,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react/no-danger */
import * as React from 'react';
import { useTranslate } from '@mui/docs/i18n';
import { ComponentClassDefinition } from '@mui-internal/docs-utils';
import { ComponentClassDefinition } from '@mui/internal-docs-utils';
import Box from '@mui/material/Box';
import ToggleDisplayOption, {
ApiDisplayOptions,
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/ApiPage/table/ClassesTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/no-danger */
import * as React from 'react';
import { ComponentClassDefinition } from '@mui-internal/docs-utils';
import { ComponentClassDefinition } from '@mui/internal-docs-utils';
import { styled, alpha } from '@mui/material/styles';
import {
brandingDarkTheme as darkTheme,
Expand Down
2 changes: 2 additions & 0 deletions docs/src/modules/components/AppSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ const productNameProductId = {
x: 'MUI X',
system: 'MUI System',
toolpad: 'Toolpad',
'toolpad-studio': 'Toolpad Studio',
'toolpad-core': 'Toolpad Core',
};

export function convertProductIdToName(productInfo) {
Expand Down
30 changes: 30 additions & 0 deletions docs/src/modules/components/MarkdownElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,14 @@ const Root = styled('div')(
position: 'relative',
// Font size reset to fix a bug with Safari 16.0 when letterSpacing is set
fontSize: 10,
'&:has(.MuiCode-title)': {
border: `1px solid var(--muidocs-palette-primaryDark-700, ${lightTheme.palette.primaryDark[700]})`,
borderRadius: theme.shape.borderRadius,
overflow: 'clip',
'& .MuiCode-copy': {
top: '56px',
},
},
},
'& .MuiCode-copy-container': {
// This container is only used in demo and highlight code
Expand Down Expand Up @@ -616,6 +624,28 @@ const Root = styled('div')(
},
},
},
'& .MuiCode-title': {
padding: theme.spacing(1.5),
display: 'flex',
alignItems: 'center',
gap: theme.spacing(1.5),
borderBottom: `1px solid var(--muidocs-palette-primaryDark-700, ${lightTheme.palette.primaryDark[700]})`,
backgroundColor: `var(--muidocs-palette-primaryDark-900, ${lightTheme.palette.primaryDark[900]})`,
fontFamily: theme.typography.fontFamilyCode,
fontSize: theme.typography.pxToRem(12),
fontWeight: theme.typography.fontWeightBold,
color: `var(--muidocs-palette-grey-200, ${lightTheme.palette.grey[200]})`,
'::before': {
content: `url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13.3333 3.99996H8L7.06 3.05996C6.80667 2.80663 6.46667 2.66663 6.11334 2.66663H2.66667C1.93334 2.66663 1.34 3.26663 1.34 3.99996L1.33334 12C1.33334 12.7333 1.93334 13.3333 2.66667 13.3333H13.3333C14.0667 13.3333 14.6667 12.7333 14.6667 12V5.33329C14.6667 4.59996 14.0667 3.99996 13.3333 3.99996ZM12.6667 12H3.33334C2.96667 12 2.66667 11.7 2.66667 11.3333V5.99996C2.66667 5.63329 2.96667 5.33329 3.33334 5.33329H12.6667C13.0333 5.33329 13.3333 5.63329 13.3333 5.99996V11.3333C13.3333 11.7 13.0333 12 12.6667 12Z' fill='%2399CCF3'/%3E%3C/svg%3E%0A");`,
width: '16px',
height: '16px',
},
'& + pre': {
margin: 0,
border: 'none',
borderRadius: 0,
},
},
}),
({ theme }) => ({
[`:where(${theme.vars ? '[data-mui-color-scheme="dark"]' : '.mode-dark'}) &`]: {
Expand Down
4 changes: 2 additions & 2 deletions docs/src/modules/components/MuiProductSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default function MuiProductSelector() {
</Box>
<li role="none">
<Link
href={ROUTES.toolpadDocs}
href={ROUTES.toolpadStudioDocs}
sx={(theme) => ({
p: 2,
pr: 3,
Expand All @@ -204,7 +204,7 @@ export default function MuiProductSelector() {
<ProductSubMenu
role="menuitem"
icon={<IconImage name="product-toolpad" />}
name="MUI Toolpad"
name="Toolpad"
description="Low-code admin builder."
chip={<Chip size="small" label="Beta" color="primary" variant="outlined" />}
/>
Expand Down
15 changes: 11 additions & 4 deletions docs/src/modules/utils/getProductInfoFromUrl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,17 @@ describe('getProductInfoFromUrl', () => {
});
});

it('should handle MUI Toolpad', () => {
expect(getProductInfoFromUrl('/toolpad/getting-started/first-app/')).to.deep.equal({
productCategoryId: 'null',
productId: 'toolpad',
it('should handle Toolpad Core', () => {
expect(getProductInfoFromUrl('/toolpad/getting-started/')).to.deep.equal({
productCategoryId: 'toolpad',
productId: 'toolpad-core',
});
});

it('should handle Toolpad Studio', () => {
expect(getProductInfoFromUrl('/toolpad/studio/getting-started/first-app/')).to.deep.equal({
productCategoryId: 'toolpad',
productId: 'toolpad-studio',
});
});
});
12 changes: 11 additions & 1 deletion docs/src/modules/utils/getProductInfoFromUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,17 @@ export default function getProductInfoFromUrl(asPath: string): MuiProductInfo {
}
}

if (firstFolder === 'toolpad' || firstFolder === 'docs') {
if (firstFolder === 'toolpad') {
productCategoryId = 'toolpad';
const secondFolder = asPathWithoutLang.replace(/^\/+[^/]+\/([^/]+)\/.*/, '$1');
if (secondFolder === 'studio') {
productId = 'toolpad-studio';
} else {
productId = 'toolpad-core';
}
}

if (firstFolder === 'docs') {
productId = firstFolder;
}

Expand Down
1 change: 1 addition & 0 deletions docs/src/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const ROUTES = {
treeViewOverview: '/x/react-tree-view/',
// Toolpad pages
toolpadDocs: '/toolpad/getting-started/',
toolpadStudioDocs: '/toolpad/studio/getting-started',
// External pages
rssFeed: '/feed/blog/rss.xml',
handbook: 'https://mui-org.notion.site/Handbook-f086d47e10794d5e839aef9dc67f324b',
Expand Down
Loading

0 comments on commit d329b04

Please sign in to comment.