diff --git a/docs/pages/api-docs/collapse.md b/docs/pages/api-docs/collapse.md index b8f578c65acafd..2095baf2baa297 100644 --- a/docs/pages/api-docs/collapse.md +++ b/docs/pages/api-docs/collapse.md @@ -32,7 +32,7 @@ The `MuiCollapse` name can be used for providing [default props](/customization/ |:-----|:-----|:--------|:------------| | children | node | | The content node to be collapsed. | | classes | object | | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. | -| ~~collapsedHeight~~ | oneOfType([PropTypes.number | | *Deprecated*. The prop was renamed to support the vertical orientation, use `collapsedSize` instead

The height of the container when collapsed. | +| ~~collapsedHeight~~ | PropTypes.oneOfType([PropTypes.number, PropTypes.string]) | | *Deprecated*. The prop was renamed to support the vertical orientation, use `collapsedSize` instead

The height of the container when collapsed. | | collapsedSize | number
| string
| '0px' | The height of the container when collapsed. | | component | elementType | 'div' | The component used for the root node. Either a string to use a HTML element or a component. | | disableStrictModeCompat | bool | false | Enable this prop if you encounter 'Function components cannot be given refs', use `unstable_createStrictModeTheme`, and can't forward the ref in the passed `Component`. | diff --git a/docs/pages/api-docs/grid.md b/docs/pages/api-docs/grid.md index 18f3bccf8229e1..cb164931faf28c 100644 --- a/docs/pages/api-docs/grid.md +++ b/docs/pages/api-docs/grid.md @@ -36,8 +36,14 @@ The `MuiGrid` name can be used for providing [default props](/customization/glob | container | bool | false | If `true`, the component will have the flex *container* behavior. You should be wrapping *items* with a *container*. | | direction | 'row'
| 'row-reverse'
| 'column'
| 'column-reverse'
| 'row' | Defines the `flex-direction` style property. It is applied for all screen sizes. | | item | bool | false | If `true`, the component will have the flex *item* behavior. You should be wrapping *items* with a *container*. | -| ~~justify~~ | oneOf([ - 'flex-start' | | *Deprecated*. Use `justifyContent` instead, the prop was renamed.

Defines the `justify-content` style property. It is applied for all screen sizes. | +| ~~justify~~ | PropTypes.oneOf([ + 'flex-start', + 'center', + 'flex-end', + 'space-between', + 'space-around', + 'space-evenly', + ]) | | *Deprecated*. Use `justifyContent` instead, the prop was renamed.

Defines the `justify-content` style property. It is applied for all screen sizes. | | justifyContent | 'flex-start'
| 'center'
| 'flex-end'
| 'space-between'
| 'space-around'
| 'space-evenly'
| 'flex-start' | Defines the `justify-content` style property. It is applied for all screen sizes. | | lg | false
| 'auto'
| true
| 1
| 2
| 3
| 4
| 5
| 6
| 7
| 8
| 9
| 10
| 11
| 12
| false | Defines the number of grids the component is going to use. It's applied for the `lg` breakpoint and wider screens if not overridden. | | md | false
| 'auto'
| true
| 1
| 2
| 3
| 4
| 5
| 6
| 7
| 8
| 9
| 10
| 11
| 12
| false | Defines the number of grids the component is going to use. It's applied for the `md` breakpoint and wider screens if not overridden. | diff --git a/docs/pages/api-docs/image-list-item-bar.md b/docs/pages/api-docs/image-list-item-bar.md index 4a92a46fae3c5f..9331e372c66245 100644 --- a/docs/pages/api-docs/image-list-item-bar.md +++ b/docs/pages/api-docs/image-list-item-bar.md @@ -34,7 +34,7 @@ The `MuiImageListItemBar` name can be used for providing [default props](/custom | position | 'bottom'
| 'top'
| 'bottom' | Position of the title bar. | | subtitle | node | | String or element serving as subtitle (support text). | | title | node | | Title to be displayed on item. | -| ~~titlePosition~~ | oneOf(['bottom' | | *Deprecated*. Use the `position` prop instead.

Position of the title bar. | +| ~~titlePosition~~ | PropTypes.oneOf(['bottom', 'top']) | | *Deprecated*. Use the `position` prop instead.

Position of the title bar. | The `ref` is forwarded to the root element. diff --git a/docs/pages/api-docs/image-list.md b/docs/pages/api-docs/image-list.md index 37e10c1ba9a58a..95467d408e4577 100644 --- a/docs/pages/api-docs/image-list.md +++ b/docs/pages/api-docs/image-list.md @@ -28,7 +28,7 @@ The `MuiImageList` name can be used for providing [default props](/customization | Name | Type | Default | Description | |:-----|:-----|:--------|:------------| -| ~~cellHeight~~ | oneOfType([PropTypes.number | | *Deprecated*. Use the `rowHeight` prop instead.

Cell height in `px`. Set to `'auto'` to let the children determine the height. | +| ~~cellHeight~~ | PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['auto']) | | *Deprecated*. Use the `rowHeight` prop instead.

Cell height in `px`. Set to `'auto'` to let the children determine the height. | | children | node | | Items that will be in the image list. | | classes | object | | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. | | cols | number | 2 | Number of columns. | diff --git a/docs/pages/api-docs/text-field.md b/docs/pages/api-docs/text-field.md index 4ccec379a22067..9db1ad6c7faa93 100644 --- a/docs/pages/api-docs/text-field.md +++ b/docs/pages/api-docs/text-field.md @@ -81,8 +81,8 @@ The `MuiTextField` name can be used for providing [default props](/customization | onChange | func | | Callback fired when the value is changed.

**Signature:**
`function(event: object) => void`
*event:* The event source of the callback. You can pull out the new value by accessing `event.target.value` (string). | | placeholder | string | | The short hint displayed in the input before the user enters a value. | | required | bool | false | If `true`, the label is displayed as required and the `input` element` will be required. | -| ~~rows~~ | oneOfType([PropTypes.number | | *Deprecated*. Use `minRows` instead

Number of rows to display when multiline option is set to true. | -| ~~rowsMax~~ | oneOfType([PropTypes.number | | *Deprecated*. Use `maxRows` instead

Maximum number of rows to display. | +| ~~rows~~ | PropTypes.oneOfType([PropTypes.number, PropTypes.string]) | | *Deprecated*. Use `minRows` instead

Number of rows to display when multiline option is set to true. | +| ~~rowsMax~~ | PropTypes.oneOfType([PropTypes.number, PropTypes.string]) | | *Deprecated*. Use `maxRows` instead

Maximum number of rows to display. | | select | bool | false | Render a [`Select`](/api/select/) element while passing the Input element to `Select` as `input` parameter. If this option is set you must pass the options of the select as children. | | SelectProps | object | | Props applied to the [`Select`](/api/select/) element. | | size | 'medium'
| 'small'
| | The size of the text field. | diff --git a/docs/pages/api-docs/textarea-autosize.md b/docs/pages/api-docs/textarea-autosize.md index 65863ba3ace574..5f0ca5b68fb6f1 100644 --- a/docs/pages/api-docs/textarea-autosize.md +++ b/docs/pages/api-docs/textarea-autosize.md @@ -28,9 +28,9 @@ You can learn more about the difference by [reading this guide](/guides/minimizi |:-----|:-----|:--------|:------------| | maxRows | number
| string
| | Maximum number of rows to display. | | minRows | number
| string
| 1 | Minimum number of rows to display. | -| ~~rows~~ | oneOfType([PropTypes.number | | *Deprecated*. Use `minRows` instead.

Minimum number of rows to display. | -| ~~rowsMax~~ | oneOfType([PropTypes.number | | *Deprecated*. Use `maxRows` instead.

Maximum number of rows to display. | -| ~~rowsMin~~ | oneOfType([PropTypes.number | | *Deprecated*. Use `minRows` instead.

Minimum number of rows to display. | +| ~~rows~~ | PropTypes.oneOfType([PropTypes.number, PropTypes.string]) | | *Deprecated*. Use `minRows` instead.

Minimum number of rows to display. | +| ~~rowsMax~~ | PropTypes.oneOfType([PropTypes.number, PropTypes.string]) | | *Deprecated*. Use `maxRows` instead.

Maximum number of rows to display. | +| ~~rowsMin~~ | PropTypes.oneOfType([PropTypes.number, PropTypes.string]) | | *Deprecated*. Use `minRows` instead.

Minimum number of rows to display. | The `ref` is forwarded to the root element. diff --git a/docs/src/modules/utils/generateMarkdown.js b/docs/src/modules/utils/generateMarkdown.js index 4fe830e841b0bb..be424374056e40 100644 --- a/docs/src/modules/utils/generateMarkdown.js +++ b/docs/src/modules/utils/generateMarkdown.js @@ -17,15 +17,21 @@ function generateHeader(reactAPI) { return ['---', `filename: ${normalizePath(reactAPI.filename)}`, '---'].join('\n'); } +function getPropTypeString(str) { + if(str.indexOf('oneOfType') >= 0 || str.indexOf('oneOf') >= 0) { + return 'PropTypes.' + str.substring(0, str.indexOf(')') + 1); + } + return str.substring(0, str.indexOf(',')); +} + function getDeprecatedInfo(type) { const marker = /deprecatedPropType\((\r*\n)*\s*PropTypes\./g; const match = type.raw.match(marker); const startIndex = type.raw.search(marker); if (match) { const offset = match[0].length; - return { - propTypes: type.raw.substring(startIndex + offset, type.raw.indexOf(',')), + propTypes: getPropTypeString(type.raw.substring(startIndex + offset, type.raw.length)), explanation: recast.parse(type.raw).program.body[0].expression.arguments[1].value, }; }