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

[TextField] Improve dense height to better match the specification #16087

Merged
merged 5 commits into from
Jun 8, 2019
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
9 changes: 9 additions & 0 deletions docs/src/pages/components/text-fields/FilledTextFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ function FilledTextFields() {
margin="dense"
variant="filled"
/>
<TextField
id="filled-dense-multiline"
label="Dense multiline"
className={clsx(classes.textField, classes.dense)}
margin="dense"
variant="filled"
multiline
rowsMax="4"
/>
<TextField
id="filled-multiline-flexible"
label="Multiline"
Expand Down
9 changes: 9 additions & 0 deletions docs/src/pages/components/text-fields/FilledTextFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ function FilledTextFields() {
margin="dense"
variant="filled"
/>
<TextField
id="filled-dense-multiline"
label="Dense multiline"
className={clsx(classes.textField, classes.dense)}
margin="dense"
variant="filled"
multiline
rowsMax="4"
/>
<TextField
id="filled-multiline-flexible"
label="Multiline"
Expand Down
9 changes: 9 additions & 0 deletions docs/src/pages/components/text-fields/OutlinedTextFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ function OutlinedTextFields() {
margin="dense"
variant="outlined"
/>
<TextField
id="outlined-dense-multiline"
label="Dense multiline"
className={clsx(classes.textField, classes.dense)}
margin="dense"
variant="outlined"
multiline
rowsMax="4"
/>
<TextField
id="outlined-multiline-flexible"
label="Multiline"
Expand Down
9 changes: 9 additions & 0 deletions docs/src/pages/components/text-fields/OutlinedTextFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ function OutlinedTextFields() {
margin="dense"
variant="outlined"
/>
<TextField
id="outlined-dense-multiline"
label="Dense multiline"
className={clsx(classes.textField, classes.dense)}
margin="dense"
variant="outlined"
multiline
rowsMax="4"
/>
<TextField
id="outlined-multiline-flexible"
label="Multiline"
Expand Down
8 changes: 7 additions & 1 deletion packages/material-ui/src/FilledInput/FilledInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,23 @@ export const styles = theme => {
},
/* Styles applied to the root element if `error={true}`. */
error: {},
/* Styles applied to the `input` element if `margin="dense"`. */
marginDense: {},
/* Styles applied to the root element if `multiline={true}`. */
multiline: {
padding: '27px 12px 10px',
'&$marginDense': {
paddingTop: 23,
paddingBottom: 6,
},
},
/* Styles applied to the `input` element. */
input: {
padding: '27px 12px 10px',
},
/* Styles applied to the `input` element if `margin="dense"`. */
inputMarginDense: {
paddingTop: 24,
paddingTop: 23,
paddingBottom: 6,
},
/* Styles applied to the `input` element if `multiline={true}`. */
Expand Down
3 changes: 3 additions & 0 deletions packages/material-ui/src/InputBase/InputBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export const styles = theme => {
/* Styles applied to the root element if `multiline={true}`. */
multiline: {
padding: `${8 - 2}px 0 ${8 - 1}px`,
'&$marginDense': {
paddingTop: 4 - 1,
},
},
/* Styles applied to the root element if `fullWidth={true}`. */
fullWidth: {
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/InputLabel/InputLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const styles = theme => ({
pointerEvents: 'none',
transform: 'translate(14px, 20px) scale(1)',
'&$marginDense': {
transform: 'translate(14px, 17px) scale(1)',
transform: 'translate(14px, 12px) scale(1)',
},
'&$shrink': {
transform: 'translate(14px, -6px) scale(0.75)',
Expand Down
10 changes: 8 additions & 2 deletions packages/material-ui/src/OutlinedInput/OutlinedInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,15 @@ export const styles = theme => {
},
/* Styles applied to the root element if `error={true}`. */
error: {},
/* Styles applied to the `input` element if `margin="dense"`. */
marginDense: {},
/* Styles applied to the root element if `multiline={true}`. */
multiline: {
padding: '18.5px 14px',
'&$marginDense': {
paddingTop: 10.5,
paddingBottom: 10.5,
},
},
/* Styles applied to the `NotchedOutline` element. */
notchedOutline: {},
Expand All @@ -60,8 +66,8 @@ export const styles = theme => {
},
/* Styles applied to the `input` element if `margin="dense"`. */
inputMarginDense: {
paddingTop: 15,
paddingBottom: 15,
paddingTop: 10.5,
paddingBottom: 10.5,
},
/* Styles applied to the `input` element if `multiline={true}`. */
inputMultiline: {
Expand Down
1 change: 1 addition & 0 deletions pages/api/filled-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ This property accepts the following keys:
| <span class="prop-name">adornedStart</span> | Styles applied to the root element if `startAdornment` is provided.
| <span class="prop-name">adornedEnd</span> | Styles applied to the root element if `endAdornment` is provided.
| <span class="prop-name">error</span> | Styles applied to the root element if `error={true}`.
| <span class="prop-name">marginDense</span> | Styles applied to the `input` element if `margin="dense"`.
| <span class="prop-name">multiline</span> | Styles applied to the root element if `multiline={true}`.
| <span class="prop-name">input</span> | Styles applied to the `input` element.
| <span class="prop-name">inputMarginDense</span> | Styles applied to the `input` element if `margin="dense"`.
Expand Down
1 change: 1 addition & 0 deletions pages/api/outlined-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ This property accepts the following keys:
| <span class="prop-name">adornedStart</span> | Styles applied to the root element if `startAdornment` is provided.
| <span class="prop-name">adornedEnd</span> | Styles applied to the root element if `endAdornment` is provided.
| <span class="prop-name">error</span> | Styles applied to the root element if `error={true}`.
| <span class="prop-name">marginDense</span> | Styles applied to the `input` element if `margin="dense"`.
| <span class="prop-name">multiline</span> | Styles applied to the root element if `multiline={true}`.
| <span class="prop-name">notchedOutline</span> | Styles applied to the `NotchedOutline` element.
| <span class="prop-name">input</span> | Styles applied to the `input` element.
Expand Down