diff --git a/docs/pages/api/input-base.md b/docs/pages/api/input-base.md index 25f809048f63bc..4bc7d42fc1708e 100644 --- a/docs/pages/api/input-base.md +++ b/docs/pages/api/input-base.md @@ -49,6 +49,7 @@ It contains a load of style reset and some state logic. | required | bool | | If `true`, the `input` element will be required. | | rows | string
| number
| | Number of rows to display when multiline option is set to true. | | rowsMax | string
| number
| | Maximum number of rows to display when multiline option is set to true. | +| rowsMin | string
| number
| | Minimum number of rows to display when multiline option is set to true. | | startAdornment | node | | Start `InputAdornment` for this component. | | type | string | 'text' | Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types). | | value | any | | The value of the `input` element, required for a controlled component. | diff --git a/docs/pages/api/textarea-autosize.md b/docs/pages/api/textarea-autosize.md index 7b5366a7f6e7bc..7ce99dae2a2166 100644 --- a/docs/pages/api/textarea-autosize.md +++ b/docs/pages/api/textarea-autosize.md @@ -24,8 +24,9 @@ You can learn more about the difference by [reading this guide](/guides/minimizi | Name | Type | Default | Description | |:-----|:-----|:--------|:------------| -| rows | string
| number
| | Minimum number of rows to display. | +| rows | string
| number
| | Use `rowsMin` instead. The prop will be removed in v5. | | rowsMax | string
| number
| | Maximum number of rows to display. | +| rowsMin | string
| number
| 1 | Minimum number of rows to display. | The `ref` is forwarded to the root element. diff --git a/docs/src/pages/components/textarea-autosize/MinHeightTextarea.js b/docs/src/pages/components/textarea-autosize/MinHeightTextarea.js index a3301d78ab8f92..c5a2f070259ae9 100644 --- a/docs/src/pages/components/textarea-autosize/MinHeightTextarea.js +++ b/docs/src/pages/components/textarea-autosize/MinHeightTextarea.js @@ -2,5 +2,5 @@ import React from 'react'; import TextareaAutosize from '@material-ui/core/TextareaAutosize'; export default function MinHeightTextarea() { - return ; + return ; } diff --git a/docs/src/pages/components/textarea-autosize/MinHeightTextarea.tsx b/docs/src/pages/components/textarea-autosize/MinHeightTextarea.tsx index a3301d78ab8f92..c5a2f070259ae9 100644 --- a/docs/src/pages/components/textarea-autosize/MinHeightTextarea.tsx +++ b/docs/src/pages/components/textarea-autosize/MinHeightTextarea.tsx @@ -2,5 +2,5 @@ import React from 'react'; import TextareaAutosize from '@material-ui/core/TextareaAutosize'; export default function MinHeightTextarea() { - return ; + return ; } diff --git a/packages/material-ui/src/InputBase/InputBase.js b/packages/material-ui/src/InputBase/InputBase.js index 92acc1acb683b2..27446a3a930f4d 100644 --- a/packages/material-ui/src/InputBase/InputBase.js +++ b/packages/material-ui/src/InputBase/InputBase.js @@ -601,17 +601,10 @@ InputBase.propTypes = { */ rowsMax: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), /** -<<<<<<< HEAD -======= * Minimum number of rows to display when multiline option is set to true. */ rowsMin: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), /** - * Should be `true` when the component hosts a select. - */ - select: PropTypes.bool, - /** ->>>>>>> Add rowsMin * Start `InputAdornment` for this component. */ startAdornment: PropTypes.node, diff --git a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.d.ts b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.d.ts index d3482930510599..b3d2fcae1dc75a 100644 --- a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.d.ts +++ b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.d.ts @@ -2,6 +2,7 @@ import * as React from 'react'; export interface TextareaAutosizeProps extends React.TextareaHTMLAttributes { rowsMax?: string | number; + rowsMin?: string | number; } declare const TextareaAutosize: React.ComponentType< diff --git a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.js b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.js index 839203799fe368..40a9546f690b50 100644 --- a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.js +++ b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.js @@ -29,7 +29,7 @@ const styles = { const TextareaAutosize = React.forwardRef(function TextareaAutosize(props, ref) { const { onChange, rows, rowsMax, rowsMin: rowsMinProp = 1, style, value, ...other } = props; - const rowsMin = rowsMinProp || rows; + const rowsMin = rows || rowsMinProp; const { current: isControlled } = React.useRef(value != null); const inputRef = React.useRef(null); @@ -62,10 +62,10 @@ const TextareaAutosize = React.forwardRef(function TextareaAutosize(props, ref) // The height of the outer content let outerHeight = innerHeight; - if (rowsMin != null) { + if (rowsMin) { outerHeight = Math.max(Number(rowsMin) * singleRowHeight, outerHeight); } - if (rowsMax != null) { + if (rowsMax) { outerHeight = Math.min(Number(rowsMax) * singleRowHeight, outerHeight); } outerHeight = Math.max(outerHeight, singleRowHeight); @@ -161,7 +161,7 @@ TextareaAutosize.propTypes = { */ placeholder: PropTypes.string, /** - * Use `rowsMin` instead + * Use `rowsMin` instead. The prop will be removed in v5. * * @deprecated */