Skip to content

Commit

Permalink
[TextareaAutosize] Deprecate rowsMax->maxRows & rowsMin->minRows (#23530
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mhayk authored and oliviertassinari committed Jan 25, 2021
1 parent b61eaa8 commit 863b6f9
Show file tree
Hide file tree
Showing 34 changed files with 204 additions and 77 deletions.
2 changes: 1 addition & 1 deletion docs/pages/api-docs/filled-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ The `MuiFilledInput` name can be used for providing [default props](/customizati
| <span class="prop-name">inputProps</span> | <span class="prop-type">object</span> | | [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element. |
| <span class="prop-name">inputRef</span> | <span class="prop-type">ref</span> | | Pass a ref to the `input` element. |
| <span class="prop-name">margin</span> | <span class="prop-type">'dense'<br>&#124;&nbsp;'none'</span> | | If `dense`, will adjust vertical spacing. This is normally obtained via context from FormControl. |
| <span class="prop-name">maxRows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display when multiline option is set to true. |
| <span class="prop-name">multiline</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, a textarea element will be rendered. |
| <span class="prop-name">name</span> | <span class="prop-type">string</span> | | Name attribute of the `input` element. |
| <span class="prop-name">onChange</span> | <span class="prop-type">func</span> | | Callback fired when the value is changed.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. You can pull out the new value by accessing `event.target.value` (string). |
| <span class="prop-name">placeholder</span> | <span class="prop-type">string</span> | | The short hint displayed in the input before the user enters a value. |
| <span class="prop-name">readOnly</span> | <span class="prop-type">bool</span> | | It prevents the user from changing the value of the field (not from interacting with the field). |
| <span class="prop-name">required</span> | <span class="prop-type">bool</span> | | If `true`, the `input` element will be required. |
| <span class="prop-name">rows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Number of rows to display when multiline option is set to true. |
| <span class="prop-name">rowsMax</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display when multiline option is set to true. |
| <span class="prop-name">startAdornment</span> | <span class="prop-type">node</span> | | Start `InputAdornment` for this component. |
| <span class="prop-name">type</span> | <span class="prop-type">string</span> | <span class="prop-default">'text'</span> | 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). |
| <span class="prop-name">value</span> | <span class="prop-type">any</span> | | The value of the `input` element, required for a controlled component. |
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/api-docs/input-base.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ The `MuiInputBase` name can be used for providing [default props](/customization
| <span class="prop-name">inputProps</span> | <span class="prop-type">object</span> | <span class="prop-default">{}</span> | [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element. |
| <span class="prop-name">inputRef</span> | <span class="prop-type">ref</span> | | Pass a ref to the `input` element. |
| <span class="prop-name">margin</span> | <span class="prop-type">'dense'<br>&#124;&nbsp;'none'</span> | | If `dense`, will adjust vertical spacing. This is normally obtained via context from FormControl. |
| <span class="prop-name">maxRows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display when multiline option is set to true. |
| <span class="prop-name">minRows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Minimum number of rows to display when multiline option is set to true. |
| <span class="prop-name">multiline</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, a textarea element will be rendered. |
| <span class="prop-name">name</span> | <span class="prop-type">string</span> | | Name attribute of the `input` element. |
| <span class="prop-name">onBlur</span> | <span class="prop-type">func</span> | | Callback fired when the input is blurred.<br>Notice that the first argument (event) might be undefined. |
Expand All @@ -52,8 +54,8 @@ The `MuiInputBase` name can be used for providing [default props](/customization
| <span class="prop-name">readOnly</span> | <span class="prop-type">bool</span> | | It prevents the user from changing the value of the field (not from interacting with the field). |
| <span class="prop-name">required</span> | <span class="prop-type">bool</span> | | If `true`, the `input` element will be required. |
| <span class="prop-name">rows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Number of rows to display when multiline option is set to true. |
| <span class="prop-name">rowsMax</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display when multiline option is set to true. |
| <span class="prop-name">rowsMin</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Minimum number of rows to display when multiline option is set to true. |
| <span class="prop-name">rowsMax</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display. |
| <span class="prop-name">rowsMin</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Minimum number of rows to display. |
| <span class="prop-name">startAdornment</span> | <span class="prop-type">node</span> | | Start `InputAdornment` for this component. |
| <span class="prop-name">type</span> | <span class="prop-type">string</span> | <span class="prop-default">'text'</span> | 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). |
| <span class="prop-name">value</span> | <span class="prop-type">any</span> | | The value of the `input` element, required for a controlled component. |
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ The `MuiInput` name can be used for providing [default props](/customization/glo
| <span class="prop-name">inputProps</span> | <span class="prop-type">object</span> | | [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element. |
| <span class="prop-name">inputRef</span> | <span class="prop-type">ref</span> | | Pass a ref to the `input` element. |
| <span class="prop-name">margin</span> | <span class="prop-type">'dense'<br>&#124;&nbsp;'none'</span> | | If `dense`, will adjust vertical spacing. This is normally obtained via context from FormControl. |
| <span class="prop-name">maxRows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display when multiline option is set to true. |
| <span class="prop-name">multiline</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, a textarea element will be rendered. |
| <span class="prop-name">name</span> | <span class="prop-type">string</span> | | Name attribute of the `input` element. |
| <span class="prop-name">onChange</span> | <span class="prop-type">func</span> | | Callback fired when the value is changed.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. You can pull out the new value by accessing `event.target.value` (string). |
| <span class="prop-name">placeholder</span> | <span class="prop-type">string</span> | | The short hint displayed in the input before the user enters a value. |
| <span class="prop-name">readOnly</span> | <span class="prop-type">bool</span> | | It prevents the user from changing the value of the field (not from interacting with the field). |
| <span class="prop-name">required</span> | <span class="prop-type">bool</span> | | If `true`, the `input` element will be required. |
| <span class="prop-name">rows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Number of rows to display when multiline option is set to true. |
| <span class="prop-name">rowsMax</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display when multiline option is set to true. |
| <span class="prop-name">startAdornment</span> | <span class="prop-type">node</span> | | Start `InputAdornment` for this component. |
| <span class="prop-name">type</span> | <span class="prop-type">string</span> | <span class="prop-default">'text'</span> | 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). |
| <span class="prop-name">value</span> | <span class="prop-type">any</span> | | The value of the `input` element, required for a controlled component. |
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/outlined-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ The `MuiOutlinedInput` name can be used for providing [default props](/customiza
| <span class="prop-name">label</span> | <span class="prop-type">node</span> | | The label of the input. It is only used for layout. The actual labelling is handled by `InputLabel`. If specified `labelWidth` is ignored. |
| <span class="prop-name">labelWidth</span> | <span class="prop-type">number</span> | <span class="prop-default">0</span> | The width of the label. Is ignored if `label` is provided. Prefer `label` if the input label appears with a strike through. |
| <span class="prop-name">margin</span> | <span class="prop-type">'dense'<br>&#124;&nbsp;'none'</span> | | If `dense`, will adjust vertical spacing. This is normally obtained via context from FormControl. |
| <span class="prop-name">maxRows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display when multiline option is set to true. |
| <span class="prop-name">multiline</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, a textarea element will be rendered. |
| <span class="prop-name">name</span> | <span class="prop-type">string</span> | | Name attribute of the `input` element. |
| <span class="prop-name">notched</span> | <span class="prop-type">bool</span> | | If `true`, the outline is notched to accommodate the label. |
Expand All @@ -52,7 +53,6 @@ The `MuiOutlinedInput` name can be used for providing [default props](/customiza
| <span class="prop-name">readOnly</span> | <span class="prop-type">bool</span> | | It prevents the user from changing the value of the field (not from interacting with the field). |
| <span class="prop-name">required</span> | <span class="prop-type">bool</span> | | If `true`, the `input` element will be required. |
| <span class="prop-name">rows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Number of rows to display when multiline option is set to true. |
| <span class="prop-name">rowsMax</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display when multiline option is set to true. |
| <span class="prop-name">startAdornment</span> | <span class="prop-type">node</span> | | Start `InputAdornment` for this component. |
| <span class="prop-name">type</span> | <span class="prop-type">string</span> | <span class="prop-default">'text'</span> | 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). |
| <span class="prop-name">value</span> | <span class="prop-type">any</span> | | The value of the `input` element, required for a controlled component. |
Expand Down
3 changes: 2 additions & 1 deletion docs/pages/api-docs/text-field.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ The `MuiTextField` name can be used for providing [default props](/customization
| <span class="prop-name">inputRef</span> | <span class="prop-type">ref</span> | | Pass a ref to the `input` element. |
| <span class="prop-name">label</span> | <span class="prop-type">node</span> | | The label content. |
| <span class="prop-name">margin</span> | <span class="prop-type">'dense'<br>&#124;&nbsp;'none'<br>&#124;&nbsp;'normal'</span> | | If `dense` or `normal`, will adjust vertical spacing of this and contained components. |
| <span class="prop-name">maxRows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display when multiline option is set to true. |
| <span class="prop-name">multiline</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, a textarea element will be rendered instead of an input. |
| <span class="prop-name">name</span> | <span class="prop-type">string</span> | | Name attribute of the `input` element. |
| <span class="prop-name">onChange</span> | <span class="prop-type">func</span> | | Callback fired when the value is changed.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. You can pull out the new value by accessing `event.target.value` (string). |
| <span class="prop-name">placeholder</span> | <span class="prop-type">string</span> | | The short hint displayed in the input before the user enters a value. |
| <span class="prop-name">required</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, the label is displayed as required and the `input` element` will be required. |
| <span class="prop-name">rows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Number of rows to display when multiline option is set to true. |
| <span class="prop-name">rowsMax</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display when multiline option is set to true. |
| <span class="prop-name">rowsMax</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display. |
| <span class="prop-name">select</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | 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. |
| <span class="prop-name">SelectProps</span> | <span class="prop-type">object</span> | | Props applied to the [`Select`](/api/select/) element. |
| <span class="prop-name">size</span> | <span class="prop-type">'medium'<br>&#124;&nbsp;'small'</span> | | The size of the text field. |
Expand Down
8 changes: 5 additions & 3 deletions docs/pages/api-docs/textarea-autosize.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ You can learn more about the difference by [reading this guide](/guides/minimizi

| Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|
| <span class="prop-name">rows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Use `rowsMin` instead. The prop will be removed in v5. |
| <span class="prop-name">rowsMax</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display. |
| <span class="prop-name">rowsMin</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | <span class="prop-default">1</span> | Minimum number of rows to display. |
| <span class="prop-name">maxRows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display. |
| <span class="prop-name">minRows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | <span class="prop-default">1</span> | Minimum number of rows to display. |
| ~~<span class="prop-name">rows</span>~~ | <span class="prop-type">oneOfType([PropTypes.number</span> | | *Deprecated*. Use `rowsMin` instead.<br><br>Minimum number of rows to display. |
| ~~<span class="prop-name">rowsMax</span>~~ | <span class="prop-type">oneOfType([PropTypes.number</span> | | *Deprecated*. Use `maxRows` instead.<br><br>Maximum number of rows to display. |
| ~~<span class="prop-name">rowsMin</span>~~ | <span class="prop-type">oneOfType([PropTypes.number</span> | | *Deprecated*. Use `minRows` instead.<br><br>Minimum number of rows to display. |

The `ref` is forwarded to the root element.

Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/components/text-fields/MultilineTextFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function MultilineTextFields() {
id="standard-multiline-flexible"
label="Multiline"
multiline
rowsMax={4}
maxRows={4}
value={value}
onChange={handleChange}
/>
Expand All @@ -49,7 +49,7 @@ export default function MultilineTextFields() {
id="filled-multiline-flexible"
label="Multiline"
multiline
rowsMax={4}
maxRows={4}
value={value}
onChange={handleChange}
variant="filled"
Expand All @@ -75,7 +75,7 @@ export default function MultilineTextFields() {
id="outlined-multiline-flexible"
label="Multiline"
multiline
rowsMax={4}
maxRows={4}
value={value}
onChange={handleChange}
variant="outlined"
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/components/text-fields/MultilineTextFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function MultilineTextFields() {
id="standard-multiline-flexible"
label="Multiline"
multiline
rowsMax={4}
maxRows={4}
value={value}
onChange={handleChange}
/>
Expand All @@ -51,7 +51,7 @@ export default function MultilineTextFields() {
id="filled-multiline-flexible"
label="Multiline"
multiline
rowsMax={4}
maxRows={4}
value={value}
onChange={handleChange}
variant="filled"
Expand All @@ -77,7 +77,7 @@ export default function MultilineTextFields() {
id="outlined-multiline-flexible"
label="Multiline"
multiline
rowsMax={4}
maxRows={4}
value={value}
onChange={handleChange}
variant="outlined"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import TextareaAutosize from '@material-ui/core/TextareaAutosize';
export default function MaxHeightTextarea() {
return (
<TextareaAutosize
rowsMax={4}
maxRows={4}
aria-label="maximum height"
placeholder="Maximum 4 rows"
defaultValue="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import TextareaAutosize from '@material-ui/core/TextareaAutosize';
export default function MaxHeightTextarea() {
return (
<TextareaAutosize
rowsMax={4}
maxRows={4}
aria-label="maximum height"
placeholder="Maximum 4 rows"
defaultValue="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import React from 'react';
import TextareaAutosize from '@material-ui/core/TextareaAutosize';

export default function MinHeightTextarea() {
return <TextareaAutosize aria-label="minimum height" rowsMin={3} placeholder="Minimum 3 rows" />;
return <TextareaAutosize aria-label="minimum height" minRows={3} placeholder="Minimum 3 rows" />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import React from 'react';
import TextareaAutosize from '@material-ui/core/TextareaAutosize';

export default function MinHeightTextarea() {
return <TextareaAutosize aria-label="minimum height" rowsMin={3} placeholder="Minimum 3 rows" />;
return <TextareaAutosize aria-label="minimum height" minRows={3} placeholder="Minimum 3 rows" />;
}
2 changes: 1 addition & 1 deletion framer/scripts/framerConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export const componentSettings = {
'margin',
'onChange',
'rows',
'rowsMax',
'minRows',
'select',
'type',
'value',
Expand Down
Loading

0 comments on commit 863b6f9

Please sign in to comment.