Skip to content

Commit

Permalink
Update FormControl variant in docs and regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
petyosi committed Mar 8, 2021
1 parent e5925d1 commit 713d4cf
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 31 deletions.
7 changes: 6 additions & 1 deletion docs/src/pages/components/checkboxes/CheckboxesGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ export default function CheckboxesGroup() {

return (
<div className={classes.root}>
<FormControl component="fieldset" className={classes.formControl}>
<FormControl
component="fieldset"
className={classes.formControl}
variant="standard"
>
<FormLabel component="legend">Assign responsibility</FormLabel>
<FormGroup>
<FormControlLabel
Expand Down Expand Up @@ -65,6 +69,7 @@ export default function CheckboxesGroup() {
error={error}
component="fieldset"
className={classes.formControl}
variant="standard"
>
<FormLabel component="legend">Pick two</FormLabel>
<FormGroup>
Expand Down
7 changes: 6 additions & 1 deletion docs/src/pages/components/checkboxes/CheckboxesGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ export default function CheckboxesGroup() {

return (
<div className={classes.root}>
<FormControl component="fieldset" className={classes.formControl}>
<FormControl
component="fieldset"
className={classes.formControl}
variant="standard"
>
<FormLabel component="legend">Assign responsibility</FormLabel>
<FormGroup>
<FormControlLabel
Expand Down Expand Up @@ -67,6 +71,7 @@ export default function CheckboxesGroup() {
error={error}
component="fieldset"
className={classes.formControl}
variant="standard"
>
<FormLabel component="legend">Pick two</FormLabel>
<FormGroup>
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/radio-buttons/ErrorRadios.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default function ErrorRadios() {
return (
<form onSubmit={handleSubmit}>
<FormControl
variant="standard"
component="fieldset"
error={error}
className={classes.formControl}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/radio-buttons/ErrorRadios.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default function ErrorRadios() {
return (
<form onSubmit={handleSubmit}>
<FormControl
variant="standard"
component="fieldset"
error={error}
className={classes.formControl}
Expand Down
4 changes: 3 additions & 1 deletion docs/src/pages/components/selects/NativeSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export default function NativeSelectDemo() {
return (
<div className={classes.root}>
<FormControl fullWidth>
<InputLabel htmlFor="uncontrolled-native">Age</InputLabel>
<InputLabel variant="standard" htmlFor="uncontrolled-native">
Age
</InputLabel>
<NativeSelect
defaultValue={30}
inputProps={{
Expand Down
4 changes: 3 additions & 1 deletion docs/src/pages/components/selects/NativeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export default function NativeSelectDemo() {
return (
<div className={classes.root}>
<FormControl fullWidth>
<InputLabel htmlFor="uncontrolled-native">Age</InputLabel>
<InputLabel variant="standard" htmlFor="uncontrolled-native">
Age
</InputLabel>
<NativeSelect
defaultValue={30}
inputProps={{
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/switches/SwitchesGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function SwitchesGroup() {
};

return (
<FormControl component="fieldset">
<FormControl component="fieldset" variant="standard">
<FormLabel component="legend">Assign responsibility</FormLabel>
<FormGroup>
<FormControlLabel
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/switches/SwitchesGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function SwitchesGroup() {
};

return (
<FormControl component="fieldset">
<FormControl component="fieldset" variant="standard">
<FormLabel component="legend">Assign responsibility</FormLabel>
<FormGroup>
<FormControlLabel
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/CustomizedInputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default function CustomizedInputs() {
gap: 2,
}}
>
<FormControl>
<FormControl variant="standard">
<InputLabel shrink htmlFor="bootstrap-input">
Bootstrap
</InputLabel>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/CustomizedInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default function CustomizedInputs() {
gap: 2,
}}
>
<FormControl>
<FormControl variant="standard">
<InputLabel shrink htmlFor="bootstrap-input">
Bootstrap
</InputLabel>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/FormattedInputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default function FormattedInputs() {

return (
<div className={classes.root}>
<FormControl>
<FormControl variant="standard">
<InputLabel htmlFor="formatted-text-mask-input">react-text-mask</InputLabel>
<Input
value={values.textmask}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/FormattedInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default function FormattedInputs() {

return (
<div className={classes.root}>
<FormControl>
<FormControl variant="standard">
<InputLabel htmlFor="formatted-text-mask-input">react-text-mask</InputLabel>
<Input
value={values.textmask}
Expand Down
10 changes: 7 additions & 3 deletions docs/src/pages/components/text-fields/InputAdornments.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default function InputAdornments() {
label="Password"
/>
</FormControl>
<FormControl fullWidth className={classes.margin} variant="outlined">
<FormControl fullWidth className={classes.margin}>
<InputLabel htmlFor="outlined-adornment-amount">Amount</InputLabel>
<OutlinedInput
id="outlined-adornment-amount"
Expand Down Expand Up @@ -189,6 +189,7 @@ export default function InputAdornments() {
variant="standard"
/>
<FormControl
variant="standard"
className={clsx(classes.margin, classes.withoutLabel, classes.textField)}
>
<Input
Expand All @@ -203,7 +204,10 @@ export default function InputAdornments() {
/>
<FormHelperText id="standard-weight-helper-text">Weight</FormHelperText>
</FormControl>
<FormControl className={clsx(classes.margin, classes.textField)}>
<FormControl
className={clsx(classes.margin, classes.textField)}
variant="standard"
>
<InputLabel htmlFor="standard-adornment-password">Password</InputLabel>
<Input
id="standard-adornment-password"
Expand All @@ -223,7 +227,7 @@ export default function InputAdornments() {
}
/>
</FormControl>
<FormControl fullWidth className={classes.margin}>
<FormControl fullWidth className={classes.margin} variant="standard">
<InputLabel htmlFor="standard-adornment-amount">Amount</InputLabel>
<Input
id="standard-adornment-amount"
Expand Down
22 changes: 13 additions & 9 deletions docs/src/pages/components/text-fields/InputAdornments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default function InputAdornments() {
type={values.showPassword ? 'text' : 'password'}
value={values.password}
onChange={handleChange('password')}
endAdornment={
endAdornment={(
<InputAdornment position="end">
<IconButton
aria-label="toggle password visibility"
Expand All @@ -115,11 +115,11 @@ export default function InputAdornments() {
{values.showPassword ? <Visibility /> : <VisibilityOff />}
</IconButton>
</InputAdornment>
}
)}
label="Password"
/>
</FormControl>
<FormControl fullWidth className={classes.margin} variant="outlined">
<FormControl fullWidth className={classes.margin}>
<InputLabel htmlFor="outlined-adornment-amount">Amount</InputLabel>
<OutlinedInput
id="outlined-adornment-amount"
Expand Down Expand Up @@ -166,7 +166,7 @@ export default function InputAdornments() {
type={values.showPassword ? 'text' : 'password'}
value={values.password}
onChange={handleChange('password')}
endAdornment={
endAdornment={(
<InputAdornment position="end">
<IconButton
aria-label="toggle password visibility"
Expand All @@ -177,7 +177,7 @@ export default function InputAdornments() {
{values.showPassword ? <Visibility /> : <VisibilityOff />}
</IconButton>
</InputAdornment>
}
)}
/>
</FormControl>
<FormControl fullWidth className={classes.margin} variant="filled">
Expand All @@ -201,6 +201,7 @@ export default function InputAdornments() {
variant="standard"
/>
<FormControl
variant="standard"
className={clsx(classes.margin, classes.withoutLabel, classes.textField)}
>
<Input
Expand All @@ -215,14 +216,17 @@ export default function InputAdornments() {
/>
<FormHelperText id="standard-weight-helper-text">Weight</FormHelperText>
</FormControl>
<FormControl className={clsx(classes.margin, classes.textField)}>
<FormControl
className={clsx(classes.margin, classes.textField)}
variant="standard"
>
<InputLabel htmlFor="standard-adornment-password">Password</InputLabel>
<Input
id="standard-adornment-password"
type={values.showPassword ? 'text' : 'password'}
value={values.password}
onChange={handleChange('password')}
endAdornment={
endAdornment={(
<InputAdornment position="end">
<IconButton
aria-label="toggle password visibility"
Expand All @@ -232,10 +236,10 @@ export default function InputAdornments() {
{values.showPassword ? <Visibility /> : <VisibilityOff />}
</IconButton>
</InputAdornment>
}
)}
/>
</FormControl>
<FormControl fullWidth className={classes.margin}>
<FormControl fullWidth className={classes.margin} variant="standard">
<InputLabel htmlFor="standard-adornment-amount">Amount</InputLabel>
<Input
id="standard-adornment-amount"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/InputWithIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function InputWithIcon() {

return (
<div>
<FormControl className={classes.margin}>
<FormControl className={classes.margin} variant="standard">
<InputLabel htmlFor="input-with-icon-adornment">
With a start adornment
</InputLabel>
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/components/text-fields/InputWithIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ export default function InputWithIcon() {

return (
<div>
<FormControl className={classes.margin}>
<FormControl className={classes.margin} variant="standard">
<InputLabel htmlFor="input-with-icon-adornment">
With a start adornment
</InputLabel>
<Input
id="input-with-icon-adornment"
startAdornment={
startAdornment={(
<InputAdornment position="start">
<AccountCircle />
</InputAdornment>
}
)}
/>
</FormControl>
<TextField
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/TablePagination/TablePagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,14 @@ const TablePagination = React.forwardRef(function TablePagination(props, ref) {

{rowsPerPageOptions.length > 1 && (
<Select
variant="standard"
classes={{
select: classes.select,
icon: classes.selectIcon,
}}
input={<InputBase className={clsx(classes.input, classes.selectRoot)} />}
input={
<InputBase variant="outlined" className={clsx(classes.input, classes.selectRoot)} />
}
value={rowsPerPage}
onChange={onRowsPerPageChange}
id={selectId}
Expand Down
14 changes: 10 additions & 4 deletions test/regressions/tests/Select/SelectAlignment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import Input from '@material-ui/core/Input';
import OutlinedInput from '@material-ui/core/OutlinedInput';
import InputLabel from '@material-ui/core/InputLabel';
import MenuItem from '@material-ui/core/MenuItem';
import FormHelperText from '@material-ui/core/FormHelperText';
Expand All @@ -11,7 +11,13 @@ export default function SelectAlignment() {
<div>
<FormControl>
<InputLabel htmlFor="age1">Age</InputLabel>
<Select value="" input={<Input name="age1" id="age1" />}>
<Select
value=""
label="Age"
id="age1"
fullWidth
input={<OutlinedInput name="age1" label="year" id="age1" />}
>
<MenuItem value="">
<em>None</em>
</MenuItem>
Expand All @@ -20,7 +26,7 @@ export default function SelectAlignment() {
</FormControl>
<FormControl>
<InputLabel htmlFor="age2">year</InputLabel>
<Select value={10} input={<Input name="year" id="age2" />}>
<Select value={10} input={<OutlinedInput label="year" name="year" id="age2" />}>
<MenuItem value="">
<em>None</em>
</MenuItem>
Expand All @@ -29,7 +35,7 @@ export default function SelectAlignment() {
</FormControl>
<FormControl>
<InputLabel htmlFor="name-input">Name</InputLabel>
<Input id="name-input" />
<OutlinedInput id="name-input" />
<FormHelperText>Alignment with an input</FormHelperText>
</FormControl>
</div>
Expand Down

0 comments on commit 713d4cf

Please sign in to comment.