Skip to content

Commit

Permalink
[core] Remove Storybook (mui#6040)
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviendelangle authored Sep 9, 2022
1 parent 9149f92 commit e15560c
Show file tree
Hide file tree
Showing 104 changed files with 1,338 additions and 11,839 deletions.
1 change: 0 additions & 1 deletion docs/data/data-grid/overview/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ You can find more details on, the [feature comparison](/x/react-data-grid/gettin

Here are some resources you might be interested in to learn more about the grid:

- The storybook used for [internal development](https://material-ui-x.netlify.app/storybook/)
- The [source on GitHub](https://github.com/mui/mui-x/tree/master/packages/)
- The [Material Design specification](https://material.io/components/data-tables) specification
- The accessibility [WAI-ARIA authoring practices](https://www.w3.org/WAI/ARIA/apg/patterns/grid/)
Expand Down
8 changes: 2 additions & 6 deletions docs/pages/x/api/date-pickers/localization-provider.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
{
"props": {
"dateAdapter": { "type": { "name": "func" }, "required": true },
"adapterLocale": { "type": { "name": "union", "description": "object<br>&#124;&nbsp;string" } },
"dateAdapter": { "type": { "name": "func" } },
"dateFormats": {
"type": {
"name": "shape",
"description": "{ dayOfMonth?: string, fullDate?: string, fullDateTime?: string, fullDateTime12h?: string, fullDateTime24h?: string, fullDateWithWeekday?: string, fullTime?: string, fullTime12h?: string, fullTime24h?: string, hours12h?: string, hours24h?: string, keyboardDate?: string, keyboardDateTime?: string, keyboardDateTime12h?: string, keyboardDateTime24h?: string, minutes?: string, month?: string, monthAndDate?: string, monthAndYear?: string, monthShort?: string, normalDate?: string, normalDateWithWeekday?: string, seconds?: string, shortDate?: string, weekday?: string, weekdayShort?: string, year?: string }"
}
},
"dateLibInstance": { "type": { "name": "any" } },
"locale": {
"type": { "name": "union", "description": "object<br>&#124;&nbsp;string" },
"deprecated": true,
"deprecationInfo": "Use <code>adapterLocale</code> instead"
},
"localeText": { "type": { "name": "object" } }
},
"slots": {},
"name": "LocalizationProvider",
"styles": { "classes": [], "globalClasses": {}, "name": "MuiLocalizationProvider" },
"filename": "/packages/x-date-pickers/src/LocalizationProvider/LocalizationProvider.tsx",
"inheritance": null,
"demos": "<ul></ul>",
"packages": ["@mui/x-date-pickers-pro", "@mui/x-date-pickers"]
}
2 changes: 1 addition & 1 deletion docs/pages/x/api/date-pickers/month-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"slots": {},
"name": "MonthPicker",
"styles": { "classes": ["root"], "globalClasses": {}, "name": "MuiMonthPicker" },
"spread": false,
"spread": true,
"forwardsRefTo": "HTMLDivElement",
"filename": "/packages/x-date-pickers/src/MonthPicker/MonthPicker.tsx",
"inheritance": null,
Expand Down
16 changes: 14 additions & 2 deletions docs/pages/x/api/date-pickers/year-picker.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
{
"props": {
"date": { "type": { "name": "any" }, "required": true },
"onChange": { "type": { "name": "func" }, "required": true },
"classes": { "type": { "name": "object" } },
"className": { "type": { "name": "string" } },
"disabled": { "type": { "name": "bool" } },
"disableFuture": { "type": { "name": "bool" } },
"disableHighlightToday": { "type": { "name": "bool" } },
"disablePast": { "type": { "name": "bool" } },
"maxDate": { "type": { "name": "any" } },
"minDate": { "type": { "name": "any" } },
"shouldDisableYear": { "type": { "name": "func" } }
"readOnly": { "type": { "name": "bool" } },
"shouldDisableYear": { "type": { "name": "func" } },
"sx": {
"type": {
"name": "union",
"description": "Array&lt;func<br>&#124;&nbsp;object<br>&#124;&nbsp;bool&gt;<br>&#124;&nbsp;func<br>&#124;&nbsp;object"
}
}
},
"slots": {},
"name": "YearPicker",
"styles": { "classes": ["root"], "globalClasses": {}, "name": "MuiYearPicker" },
"spread": false,
"spread": true,
"forwardsRefTo": "HTMLDivElement",
"filename": "/packages/x-date-pickers/src/YearPicker/YearPicker.tsx",
"inheritance": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"dateAdapter": "DateIO adapter class function",
"dateFormats": "Formats that are used for any child pickers",
"dateLibInstance": "Date library instance you are using, if it has some global overrides <code>jsx dateLibInstance={momentTimeZone} </code>",
"locale": "Locale for the date library you are using",
"localeText": "Locale for components texts"
},
"classDescriptions": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"dateAdapter": "DateIO adapter class function",
"dateFormats": "Formats that are used for any child pickers",
"dateLibInstance": "Date library instance you are using, if it has some global overrides <code>jsx dateLibInstance={momentTimeZone} </code>",
"locale": "Locale for the date library you are using",
"localeText": "Locale for components texts"
},
"classDescriptions": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"dateAdapter": "DateIO adapter class function",
"dateFormats": "Formats that are used for any child pickers",
"dateLibInstance": "Date library instance you are using, if it has some global overrides <code>jsx dateLibInstance={momentTimeZone} </code>",
"locale": "Locale for the date library you are using",
"localeText": "Locale for components texts"
},
"classDescriptions": {},
Expand Down
9 changes: 8 additions & 1 deletion docs/translations/api-docs/date-pickers/year-picker-pt.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
{
"componentDescription": "",
"propDescriptions": {
"classes": "Override or extend the styles applied to the component. See <a href=\"#css\">CSS API</a> below for more details.",
"className": "className applied to the root element.",
"date": "Date value for the YearPicker",
"disabled": "If <code>true</code> picker is disabled",
"disableFuture": "If <code>true</code> future days are disabled.",
"disableHighlightToday": "If <code>true</code>, today&#39;s date is rendering without highlighting with circle.",
"disablePast": "If <code>true</code> past days are disabled.",
"maxDate": "Maximal selectable date. @DateIOType",
"minDate": "Minimal selectable date. @DateIOType",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; boolean</code><br><em>year:</em> The year to test.<br> <em>returns</em> (boolean): Returns <code>true</code> if the year should be disabled."
"onChange": "Callback fired on date change.",
"readOnly": "If <code>true</code> picker is readonly",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; boolean</code><br><em>year:</em> The year to test.<br> <em>returns</em> (boolean): Returns <code>true</code> if the year should be disabled.",
"sx": "The system prop that allows defining system overrides as well as additional CSS styles. See the <a href=\"/system/the-sx-prop/\">`sx` page</a> for more details."
},
"classDescriptions": { "root": { "description": "Styles applied to the root element." } },
"slotDescriptions": {}
Expand Down
9 changes: 8 additions & 1 deletion docs/translations/api-docs/date-pickers/year-picker-zh.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
{
"componentDescription": "",
"propDescriptions": {
"classes": "Override or extend the styles applied to the component. See <a href=\"#css\">CSS API</a> below for more details.",
"className": "className applied to the root element.",
"date": "Date value for the YearPicker",
"disabled": "If <code>true</code> picker is disabled",
"disableFuture": "If <code>true</code> future days are disabled.",
"disableHighlightToday": "If <code>true</code>, today&#39;s date is rendering without highlighting with circle.",
"disablePast": "If <code>true</code> past days are disabled.",
"maxDate": "Maximal selectable date. @DateIOType",
"minDate": "Minimal selectable date. @DateIOType",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; boolean</code><br><em>year:</em> The year to test.<br> <em>returns</em> (boolean): Returns <code>true</code> if the year should be disabled."
"onChange": "Callback fired on date change.",
"readOnly": "If <code>true</code> picker is readonly",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; boolean</code><br><em>year:</em> The year to test.<br> <em>returns</em> (boolean): Returns <code>true</code> if the year should be disabled.",
"sx": "The system prop that allows defining system overrides as well as additional CSS styles. See the <a href=\"/system/the-sx-prop/\">`sx` page</a> for more details."
},
"classDescriptions": { "root": { "description": "Styles applied to the root element." } },
"slotDescriptions": {}
Expand Down
9 changes: 8 additions & 1 deletion docs/translations/api-docs/date-pickers/year-picker.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
{
"componentDescription": "",
"propDescriptions": {
"classes": "Override or extend the styles applied to the component. See <a href=\"#css\">CSS API</a> below for more details.",
"className": "className applied to the root element.",
"date": "Date value for the YearPicker",
"disabled": "If <code>true</code> picker is disabled",
"disableFuture": "If <code>true</code> future days are disabled.",
"disableHighlightToday": "If <code>true</code>, today&#39;s date is rendering without highlighting with circle.",
"disablePast": "If <code>true</code> past days are disabled.",
"maxDate": "Maximal selectable date. @DateIOType",
"minDate": "Minimal selectable date. @DateIOType",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; boolean</code><br><em>year:</em> The year to test.<br> <em>returns</em> (boolean): Returns <code>true</code> if the year should be disabled."
"onChange": "Callback fired on date change.",
"readOnly": "If <code>true</code> picker is readonly",
"shouldDisableYear": "Disable specific years dynamically. Works like <code>shouldDisableDate</code> but for year selection view @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; boolean</code><br><em>year:</em> The year to test.<br> <em>returns</em> (boolean): Returns <code>true</code> if the year should be disabled.",
"sx": "The system prop that allows defining system overrides as well as additional CSS styles. See the <a href=\"/system/the-sx-prop/\">`sx` page</a> for more details."
},
"classDescriptions": { "root": { "description": "Styles applied to the root element." } },
"slotDescriptions": {}
Expand Down
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
publish = "docs/export/"

# Default build command.
command = "yarn docs:build && yarn docs:export && yarn storybook:build && yarn storybook:export"
command = "yarn docs:build && yarn docs:export"

[build.environment]
NODE_VERSION = "14"
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
"docs:importDocsStatic": "node scripts/importDocsStatic.js",
"docs:size-why": "cross-env DOCS_STATS_ENABLED=true yarn docs:build",
"docs:deploy": "yarn workspace docs deploy",
"storybook:dev": "yarn workspace storybook start",
"storybook:build": "yarn workspace storybook build",
"storybook:export": "yarn workspace storybook export",
"deduplicate": "node scripts/deduplicate.js",
"dataset:file-tree": "babel-node -x .ts ./scripts/treeDataFromFileTree.ts",
"l10n": "babel-node -x .ts ./scripts/l10n.ts",
Expand Down Expand Up @@ -157,7 +154,9 @@
"serve": "^14.0.1",
"sinon": "^14.0.0",
"stream-browserify": "^3.0.0",
"string-replace-loader": "^3.1.0",
"typescript": "^4.7.4",
"util": "^0.12.4",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"yargs": "^17.5.1",
Expand Down
1 change: 1 addition & 0 deletions packages/grid/x-data-grid-generator/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './useDemoData';
export * from './useBasicDemoData';
export * from './useMovieData';
export * from './useQuery';
13 changes: 13 additions & 0 deletions packages/grid/x-data-grid-generator/src/hooks/useBasicDemoData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as React from 'react';
import { getBasicGridData, GridBasicData } from '../services';

export const useBasicDemoData = (nbRows: number, nbCols: number): GridBasicData => {
const [data, setData] = React.useState<GridBasicData>({ rows: [], columns: [] });

React.useEffect(() => {
const newData = getBasicGridData(nbRows, nbCols);
setData(newData);
}, [nbRows, nbCols]);

return data;
};
106 changes: 106 additions & 0 deletions packages/grid/x-data-grid-generator/src/services/basic-data-service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import { GridColDef, GridRowId } from '@mui/x-data-grid';

export const currencyPairs = [
'USDGBP',
'USDEUR',
'GBPEUR',
'JPYUSD',
'MXNUSD',
'BTCUSD',
'USDCAD',
'EURJPY',
'EURUSD',
'EURCHF',
'USDCHF',
'EURGBP',
'GBPUSD',
'AUDCAD',
'NZDUSD',
'GBPCHF',
'AUDUSD',
'GBPJPY',
'USDJPY',
'CHFJPY',
'EURCAD',
'AUDJPY',
'EURAUD',
'AUDNZD',
'CADEUR',
'CHFMXN',
'ETHUSD',
'BCHUSD',
'ETHBTC',
'XRPUSD',
'XRPBTC',
'USDLTC',
'USDXRP',
'USDDSH',
'USDBCH',
'JPYEUR',
'JPYUSD',
'JPYGBP',
'JPYCAD',
'JPYCHF',
'JPYAUD',
'JPYNZD',
'JPYSGD',
'JPYNOK',
'JPYRUB',
'JPYSEK',
'JPYTRY',
'JPYZAR',
'JPYHKD',
'JPYCNH',
'JPYDKK',
'JPYMXN',
'JPYPLN',
'JPYXAG',
'JPYXAU',
'JPYBTC',
'JPYETH',
'JPYLTC',
'JPYXRP',
'JPYDSH',
'JPYBCH',
'GBPEUR',
'GBPRUB',
'GBPTRY',
];

interface GridBasicRowModel {
id: GridRowId;
currencyPair: string;
[price: string]: number | string;
}

export interface GridBasicData {
columns: GridColDef[];
rows: GridBasicRowModel[];
}

export const getBasicGridData = (rowLength: number, colLength: number): GridBasicData => {
const data: GridBasicRowModel[] = [];
const pricesColLength = colLength - 2;
for (let i = 0; i < rowLength; i += 1) {
const idx = i >= currencyPairs.length ? i % currencyPairs.length : i;
const model: GridBasicRowModel = {
id: i,
currencyPair: currencyPairs[idx],
};
for (let j = 1; j <= pricesColLength; j += 1) {
model[`price${j}M`] = Number(`${i.toString()}${j}`); // randomPrice(0.7, 2);
}
data.push(model);
}

const columns: GridColDef[] = [
{ field: 'id', headerName: 'id', type: 'number' },
{ field: 'currencyPair', headerName: 'Currency Pair' },
];
for (let j = 1; j <= pricesColLength; j += 1) {
// const y = Math.floor(j / 12);
columns.push({ field: `price${j}M`, headerName: `${j}M`, type: 'number' }); // (y > 0 ? `${y}Y` : '') + `${j - y * 12}M`
}
columns.length = colLength; // we cut the array in case < 2;
return { columns, rows: data };
};
1 change: 1 addition & 0 deletions packages/grid/x-data-grid-generator/src/services/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './gridColDefGenerator';
export * from './random-generator';
export * from './real-data-service';
export * from './basic-data-service';
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import { DataGridPro } from '@mui/x-data-grid-pro';
import { expect } from 'chai';
import axe from 'axe-core';
import { DataGridPro } from '@mui/x-data-grid-pro';
import { useBasicDemoData } from '@mui/x-data-grid-generator';
// @ts-ignore Remove once the test utils are typed
import { createRenderer } from '@mui/monorepo/test/utils';
import { useData } from 'storybook/src/hooks/useData';
import axe from 'axe-core';

function logViolations(violations: any) {
if (violations.length !== 0) {
Expand All @@ -27,7 +27,7 @@ describe('<DataGridPro /> - Accessibility', () => {

it('pinned columns should pass `aria-required-parent` rule', async () => {
const TestCase = () => {
const data = useData(1, 3);
const data = useBasicDemoData(1, 3);
return (
<div style={{ width: 302, height: 300 }}>
<DataGridPro
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import * as React from 'react';
import { expect } from 'chai';
import { spy } from 'sinon';
import {
GridApi,
DataGridProProps,
Expand All @@ -8,21 +10,19 @@ import {
GridValueSetterParams,
GridPreProcessEditCellProps,
GridCellProps,
GridCellModes,
} from '@mui/x-data-grid-pro';
import { getBasicGridData } from '@mui/x-data-grid-generator';
// @ts-ignore Remove once the test utils are typed
import { createRenderer, fireEvent, act, userEvent } from '@mui/monorepo/test/utils';
import { expect } from 'chai';
import { getCell } from 'test/utils/helperFn';
import { spy } from 'sinon';
import { getData } from 'storybook/src/data/data-service';
import { GridCellModes } from '@mui/x-data-grid';

describe('<DataGridPro /> - Cell Editing', () => {
const { render, clock } = createRenderer({ clock: 'fake' });

let apiRef: React.MutableRefObject<GridApi>;

const defaultData = getData(4, 2);
const defaultData = getBasicGridData(4, 2);

const renderEditCell = spy((() => <input />) as (
props: GridRenderEditCellParams,
Expand Down Expand Up @@ -567,7 +567,7 @@ describe('<DataGridPro /> - Cell Editing', () => {
columnProps.renderEditCell = (props: GridCellProps) => <CustomEditComponent {...props} />;
render(
<TestCase
{...getData(1, 3)}
{...getBasicGridData(1, 3)}
columns={[
{ field: 'id' },
{ field: 'currencyPair', editable: true },
Expand All @@ -592,7 +592,7 @@ describe('<DataGridPro /> - Cell Editing', () => {
columnProps.renderEditCell = (props: GridCellProps) => <CustomEditComponent {...props} />;
render(
<TestCase
{...getData(1, 3)}
{...getBasicGridData(1, 3)}
columns={[
{ field: 'id' },
{ field: 'currencyPair', editable: true },
Expand Down
Loading

0 comments on commit e15560c

Please sign in to comment.