Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Upgrade monorepo #7849

Merged
merged 12 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const defaultAlias = {
'@mui/x-license-pro': resolveAliasPath('./packages/x-license-pro/src'),
'@mui/x-date-pickers': resolveAliasPath('./packages/x-date-pickers/src'),
'@mui/x-date-pickers-pro': resolveAliasPath('./packages/x-date-pickers-pro/src'),
'@mui/markdown': '@mui/monorepo/packages/markdown',
'typescript-to-proptypes': '@mui/monorepo/packages/typescript-to-proptypes/src',
docs: resolveAliasPath('./node_modules/@mui/monorepo/docs'),
test: resolveAliasPath('./test'),
Expand Down
2 changes: 1 addition & 1 deletion docs/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const alias = {
'@mui/x-date-pickers-pro': '../packages/x-date-pickers-pro/src',
'@mui/x-license-pro': '../packages/x-license-pro/src',
'@mui/docs': '../node_modules/@mui/monorepo/packages/mui-docs/src',
'@mui/markdown': '../node_modules/@mui/monorepo/docs/packages/markdown',
'@mui/markdown': '../node_modules/@mui/monorepo/packages/markdown',
'@mui/monorepo': '../node_modules/@mui/monorepo',
'@mui/joy': '../node_modules/@mui/monorepo/packages/mui-joy/src',
docs: '../node_modules/@mui/monorepo/docs', // TODO remove
Expand Down
1 change: 1 addition & 0 deletions docs/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@mui/monorepo/docs/config');
2 changes: 1 addition & 1 deletion docs/data/data-grid/demo/PopularFeaturesDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const featuresSet = [
},
{
id: 12,
name: 'Aggretation and Summary rows',
name: 'Aggregation and Summary rows',
description: 'Set summary footer rows or inline summaries with row grouping',
plan: 'Premium',
detailPage: '/aggregation/',
Expand Down
2 changes: 1 addition & 1 deletion docs/data/data-grid/demo/PopularFeaturesDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const featuresSet: Row[] = [
},
{
id: 12,
name: 'Aggretation and Summary rows',
name: 'Aggregation and Summary rows',
description: 'Set summary footer rows or inline summaries with row grouping',
plan: 'Premium',
detailPage: '/aggregation/',
Expand Down
54 changes: 17 additions & 37 deletions docs/data/date-pickers/date-field/CustomUIDateField.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
import * as React from 'react';
import dayjs from 'dayjs';
import { CssVarsProvider } from '@mui/joy/styles';
import Stack from '@mui/material/Stack';
import FormControlLabel from '@mui/material/FormControlLabel';
import FormLabel from '@mui/joy/FormLabel';
import JoyTextField from '@mui/joy/TextField';
import FormLabel from '@mui/material/FormLabel';
import InputUnstyled from '@mui/base/InputUnstyled';
import { LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { unstable_useDateField as useDateField } from '@mui/x-date-pickers/DateField';

const JoyDateField = (props) => {
const { inputRef, inputProps } = useDateField(props);

return (
<JoyTextField
{...inputProps}
componentsProps={{ input: { componentsProps: { input: { ref: inputRef } } } }}
/>
);
};

const UnstyledDateField = (props) => {
const { inputRef, inputProps } = useDateField(props);

Expand All @@ -47,28 +34,21 @@ export default function CustomUIDateField() {
const handleChange = (newValue) => setValue(newValue);

return (
<CssVarsProvider>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<Stack spacing={2}>
<JoyDateField
label="Using @mui/joy TextField"
value={value}
onChange={handleChange}
/>
<FormControlLabel
label={<FormLabel>Using unstyled input</FormLabel>}
control={<UnstyledDateField value={value} onChange={handleChange} />}
labelPlacement="top"
sx={{ alignItems: 'stretch' }}
/>
<FormControlLabel
label={<FormLabel>Using browser input</FormLabel>}
control={<BrowserInputDateField value={value} onChange={handleChange} />}
labelPlacement="top"
sx={{ alignItems: 'stretch' }}
/>
</Stack>
</LocalizationProvider>
</CssVarsProvider>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<Stack spacing={2}>
<FormControlLabel
label={<FormLabel>Using unstyled input</FormLabel>}
control={<UnstyledDateField value={value} onChange={handleChange} />}
labelPlacement="top"
sx={{ margin: 0 }}
/>
<FormControlLabel
label={<FormLabel>Using browser input</FormLabel>}
control={<BrowserInputDateField value={value} onChange={handleChange} />}
labelPlacement="top"
sx={{ margin: 0 }}
/>
</Stack>
</LocalizationProvider>
);
}
60 changes: 17 additions & 43 deletions docs/data/date-pickers/date-field/CustomUIDateField.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import * as React from 'react';
import dayjs, { Dayjs } from 'dayjs';
import { CssVarsProvider } from '@mui/joy/styles';
import Stack from '@mui/material/Stack';
import FormControlLabel from '@mui/material/FormControlLabel';
import FormLabel from '@mui/joy/FormLabel';
import JoyTextField, {
TextFieldProps as JoyTextFieldProps,
} from '@mui/joy/TextField';
import FormLabel from '@mui/material/FormLabel';
import InputUnstyled, { InputUnstyledProps } from '@mui/base/InputUnstyled';
import { LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
Expand All @@ -15,21 +11,6 @@ import {
UseDateFieldComponentProps,
} from '@mui/x-date-pickers/DateField';

type JoyDateFieldProps = UseDateFieldComponentProps<Dayjs, Dayjs, JoyTextFieldProps>;

const JoyDateField = (props: JoyDateFieldProps) => {
const { inputRef, inputProps } = useDateField<Dayjs, Dayjs, JoyDateFieldProps>(
props,
);

return (
<JoyTextField
LukasTy marked this conversation as resolved.
Show resolved Hide resolved
{...inputProps}
componentsProps={{ input: { componentsProps: { input: { ref: inputRef } } } }}
/>
);
};

type UnstyledDateFieldProps = UseDateFieldComponentProps<
Dayjs,
Dayjs,
Expand Down Expand Up @@ -72,28 +53,21 @@ export default function CustomUIDateField() {
const handleChange = (newValue: Dayjs | null) => setValue(newValue);

return (
<CssVarsProvider>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<Stack spacing={2}>
<JoyDateField
label="Using @mui/joy TextField"
value={value}
onChange={handleChange}
/>
<FormControlLabel
label={<FormLabel>Using unstyled input</FormLabel>}
control={<UnstyledDateField value={value} onChange={handleChange} />}
labelPlacement="top"
sx={{ alignItems: 'stretch' }}
/>
<FormControlLabel
label={<FormLabel>Using browser input</FormLabel>}
control={<BrowserInputDateField value={value} onChange={handleChange} />}
labelPlacement="top"
sx={{ alignItems: 'stretch' }}
/>
</Stack>
</LocalizationProvider>
</CssVarsProvider>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<Stack spacing={2}>
<FormControlLabel
label={<FormLabel>Using unstyled input</FormLabel>}
control={<UnstyledDateField value={value} onChange={handleChange} />}
labelPlacement="top"
sx={{ margin: 0 }}
/>
<FormControlLabel
label={<FormLabel>Using browser input</FormLabel>}
control={<BrowserInputDateField value={value} onChange={handleChange} />}
labelPlacement="top"
sx={{ margin: 0 }}
/>
</Stack>
</LocalizationProvider>
);
}
16 changes: 16 additions & 0 deletions docs/data/date-pickers/date-field/CustomUIDateField.tsx.preview
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<LocalizationProvider dateAdapter={AdapterDayjs}>
<Stack spacing={2}>
<FormControlLabel
label={<FormLabel>Using unstyled input</FormLabel>}
control={<UnstyledDateField value={value} onChange={handleChange} />}
labelPlacement="top"
sx={{ margin: 0 }}
/>
<FormControlLabel
label={<FormLabel>Using browser input</FormLabel>}
control={<BrowserInputDateField value={value} onChange={handleChange} />}
labelPlacement="top"
sx={{ margin: 0 }}
/>
</Stack>
</LocalizationProvider>
34 changes: 9 additions & 25 deletions docs/data/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { MuiPage } from '@mui/monorepo/docs/src/MuiPage';

const pages: MuiPage[] = [
{
pathname: '/x/introduction',
scopePathnames: ['/x/introduction'],
pathname: '/x/introduction-group',
title: 'Introduction',
icon: 'DescriptionIcon',
children: [
{ pathname: `/x/introduction`, title: 'Overview' },
Expand All @@ -14,9 +14,8 @@ const pages: MuiPage[] = [
],
},
{
pathname: '/x/react-data-grid',
scopePathnames: ['/x/api/data-grid'],
title: 'Data grid',
pathname: '/x/react-data-grid-group',
title: 'Data Grid',
icon: 'TableViewIcon',
children: [
{ pathname: '/x/react-data-grid', title: 'Overview' },
Expand All @@ -26,7 +25,6 @@ const pages: MuiPage[] = [
{ pathname: '/x/react-data-grid/layout' },
{
pathname: '/x/react-data-grid/columns',
scopePathnames: ['/x/react-data-grid/column-'],
children: [
{ pathname: '/x/react-data-grid/column-definition' },
{ pathname: '/x/react-data-grid/column-dimensions' },
Expand All @@ -40,7 +38,6 @@ const pages: MuiPage[] = [
},
{
pathname: '/x/react-data-grid/rows',
scopePathnames: ['/x/react-data-grid/row-', '/x/react-data-grid/master-detail'],
children: [
{ pathname: '/x/react-data-grid/row-definition' },
{ pathname: '/x/react-data-grid/row-updates' },
Expand All @@ -64,14 +61,8 @@ const pages: MuiPage[] = [
{ pathname: '/x/react-data-grid/virtualization' },
{ pathname: '/x/react-data-grid/accessibility' },
{
pathname: '/x/react-data-grid/row-grouping',
pathname: '/x/react-data-grid-group-pivot',
title: 'Group & Pivot',
scopePathnames: [
'/x/react-data-grid/row-grouping',
'/x/react-data-grid/tree-data',
'/x/react-data-grid/aggregation',
'/x/react-data-grid/pivoting',
],
children: [
{ pathname: '/x/react-data-grid/row-grouping', plan: 'premium' },
{ pathname: '/x/react-data-grid/tree-data', plan: 'pro' },
Expand All @@ -81,12 +72,7 @@ const pages: MuiPage[] = [
},
{
title: 'Advanced',
pathname: '/x/react-data-grid/api-object',
scopePathnames: [
'/x/react-data-grid/api-object',
'/x/react-data-grid/events',
'/x/react-data-grid/state',
],
pathname: '/x/react-data-grid/advanced',
children: [
{ pathname: '/x/react-data-grid/api-object', title: 'API object' },
{ pathname: '/x/react-data-grid/events' },
Expand All @@ -96,14 +82,13 @@ const pages: MuiPage[] = [
{
title: 'Recipes',
pathname: '/x/react-data-grid/recipes',
scopePathnames: ['/x/react-data-grid/recipes-'],
children: [
{ pathname: '/x/react-data-grid/recipes-editing', title: 'Editing' },
{ pathname: '/x/react-data-grid/recipes-row-grouping', title: 'Row grouping' },
],
},
{
pathname: '/x/api/data-grid',
pathname: '/x/api/data-grid-group',
title: 'API Reference',
children: [
{ pathname: '/x/api/data-grid', title: 'Index' },
Expand Down Expand Up @@ -144,8 +129,7 @@ const pages: MuiPage[] = [
},
{
pathname: '/x/react-date-pickers',
scopePathnames: ['/x/api/date-pickers'],
title: 'Date and Time pickers',
title: 'Date and Time Pickers',
icon: 'DatePickerIcon',
children: [
{ pathname: '/x/react-date-pickers/getting-started' },
Expand All @@ -170,7 +154,7 @@ const pages: MuiPage[] = [
plan: 'pro',
},
{
pathname: '/x/api/date-pickers',
pathname: '/x/api/date-pickers-group',
title: 'API Reference',
children: [
{ pathname: '/x/api/date-pickers', title: 'Index' },
Expand Down
17 changes: 15 additions & 2 deletions docs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ const pkg = require('../package.json');
const dataGridPkg = require('../packages/grid/x-data-grid/package.json');
const datePickersPkg = require('../packages/x-date-pickers/package.json');
const { findPages } = require('./src/modules/utils/find');
const { LANGUAGES, LANGUAGES_SSR } = require('./src/modules/constants');
const {
LANGUAGES,
LANGUAGES_SSR,
LANGUAGES_IN_PROGRESS,
LANGUAGES_IGNORE_PAGES,
} = require('./config');

const workspaceRoot = path.join(__dirname, '../');

Expand Down Expand Up @@ -62,7 +67,15 @@ module.exports = withDocsInfra({
oneOf: [
{
resourceQuery: /@mui\/markdown/,
use: require.resolve('@mui/monorepo/docs/packages/markdown/loader'),
use: [
{
loader: require.resolve('@mui/monorepo/packages/markdown/loader'),
options: {
ignoreLanguagePages: LANGUAGES_IGNORE_PAGES,
languagesInProgress: LANGUAGES_IN_PROGRESS,
},
},
],
},
],
},
Expand Down
10 changes: 7 additions & 3 deletions docs/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,19 @@ function AppWrapper(props) {
}
}, []);

const activePage = findActivePage(pages, router.pathname);

let fonts = [];
if (router.pathname.match(/onepirate/)) {
fonts = [
'https://fonts.googleapis.com/css?family=Roboto+Condensed:700|Work+Sans:300,400&display=swap',
];
}

const pageContextValue = React.useMemo(() => {
const { activePage, activePageParents } = findActivePage(pages, router.pathname);

return { activePage, activePageParents, pages };
}, [router.pathname]);

return (
<React.Fragment>
<NextHead>
Expand All @@ -220,7 +224,7 @@ function AppWrapper(props) {
<UserLanguageProvider defaultUserLanguage={pageProps.userLanguage}>
<CodeCopyProvider>
<CodeVariantProvider>
<PageContext.Provider value={{ activePage, pages }}>
<PageContext.Provider value={pageContextValue}>
<ThemeProvider>
<DocsStyledEngineProvider cacheLtr={emotionCache}>
{children}
Expand Down
6 changes: 6 additions & 0 deletions docs/public/static/sponsors/doit-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions docs/public/static/sponsors/doit-square.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/static/sponsors/megafamous.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading