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

[material-ui][TextField] Deprecate *Props props #42062

Merged
merged 20 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ const BootstrapInput = styled(InputBase)(({ theme }) => ({
}));

const RedditTextField = styled((props) => (
<TextField InputProps={{ disableUnderline: true }} {...props} />
<TextField
slotProps={{
input: { disableUnderline: true },
}}
{...props}
/>
))(({ theme }) => ({
'& .MuiFilledInput-root': {
overflow: 'hidden',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const BootstrapInput = styled(InputBase)(({ theme }) => ({

const RedditTextField = styled((props: TextFieldProps) => (
<TextField
InputProps={{ disableUnderline: true } as Partial<OutlinedInputProps>}
slotProps={{
input: { disableUnderline: true } as Partial<OutlinedInputProps>,
}}
{...props}
/>
))(({ theme }) => ({
Expand Down
44 changes: 28 additions & 16 deletions docs/data/material/components/text-fields/FormPropsTextFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,20 @@ export default function FormPropsTextFields() {
id="outlined-read-only-input"
label="Read Only"
defaultValue="Hello World"
InputProps={{
readOnly: true,
slotProps={{
input: {
readOnly: true,
},
}}
/>
<TextField
id="outlined-number"
label="Number"
type="number"
InputLabelProps={{
shrink: true,
slotProps={{
inputLabel: {
shrink: true,
},
}}
/>
<TextField id="outlined-search" label="Search field" type="search" />
Expand Down Expand Up @@ -81,19 +85,23 @@ export default function FormPropsTextFields() {
id="filled-read-only-input"
label="Read Only"
defaultValue="Hello World"
InputProps={{
readOnly: true,
}}
variant="filled"
slotProps={{
input: {
readOnly: true,
},
}}
/>
<TextField
id="filled-number"
label="Number"
type="number"
InputLabelProps={{
shrink: true,
}}
variant="filled"
slotProps={{
inputLabel: {
shrink: true,
},
}}
/>
<TextField
id="filled-search"
Expand Down Expand Up @@ -135,19 +143,23 @@ export default function FormPropsTextFields() {
id="standard-read-only-input"
label="Read Only"
defaultValue="Hello World"
InputProps={{
readOnly: true,
}}
variant="standard"
slotProps={{
input: {
readOnly: true,
},
}}
/>
<TextField
id="standard-number"
label="Number"
type="number"
InputLabelProps={{
shrink: true,
}}
variant="standard"
slotProps={{
inputLabel: {
shrink: true,
},
}}
/>
<TextField
id="standard-search"
Expand Down
44 changes: 28 additions & 16 deletions docs/data/material/components/text-fields/FormPropsTextFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,20 @@ export default function FormPropsTextFields() {
id="outlined-read-only-input"
label="Read Only"
defaultValue="Hello World"
InputProps={{
readOnly: true,
slotProps={{
input: {
readOnly: true,
},
}}
/>
<TextField
id="outlined-number"
label="Number"
type="number"
InputLabelProps={{
shrink: true,
slotProps={{
inputLabel: {
shrink: true,
},
}}
/>
<TextField id="outlined-search" label="Search field" type="search" />
Expand Down Expand Up @@ -81,19 +85,23 @@ export default function FormPropsTextFields() {
id="filled-read-only-input"
label="Read Only"
defaultValue="Hello World"
InputProps={{
readOnly: true,
}}
variant="filled"
slotProps={{
input: {
readOnly: true,
},
}}
/>
<TextField
id="filled-number"
label="Number"
type="number"
InputLabelProps={{
shrink: true,
}}
variant="filled"
slotProps={{
inputLabel: {
shrink: true,
},
}}
/>
<TextField
id="filled-search"
Expand Down Expand Up @@ -135,19 +143,23 @@ export default function FormPropsTextFields() {
id="standard-read-only-input"
label="Read Only"
defaultValue="Hello World"
InputProps={{
readOnly: true,
}}
variant="standard"
slotProps={{
input: {
readOnly: true,
},
}}
/>
<TextField
id="standard-number"
label="Number"
type="number"
InputLabelProps={{
shrink: true,
}}
variant="standard"
slotProps={{
inputLabel: {
shrink: true,
},
}}
/>
<TextField
id="standard-search"
Expand Down
6 changes: 4 additions & 2 deletions docs/data/material/components/text-fields/FormattedInputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ export default function FormattedInputs() {
onChange={handleChange}
name="numberformat"
id="formatted-numberformat-input"
InputProps={{
inputComponent: NumericFormatCustom,
slotProps={{
input: {
inputComponent: NumericFormatCustom,
},
}}
variant="standard"
/>
Expand Down
6 changes: 4 additions & 2 deletions docs/data/material/components/text-fields/FormattedInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ export default function FormattedInputs() {
onChange={handleChange}
name="numberformat"
id="formatted-numberformat-input"
InputProps={{
inputComponent: NumericFormatCustom as any,
slotProps={{
input: {
inputComponent: NumericFormatCustom as any,
},
}}
variant="standard"
/>
Expand Down
18 changes: 12 additions & 6 deletions docs/data/material/components/text-fields/InputAdornments.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ export default function InputAdornments() {
label="With normal TextField"
id="outlined-start-adornment"
sx={{ m: 1, width: '25ch' }}
InputProps={{
startAdornment: <InputAdornment position="start">kg</InputAdornment>,
slotProps={{
input: {
startAdornment: <InputAdornment position="start">kg</InputAdornment>,
},
}}
/>
<FormControl sx={{ m: 1, width: '25ch' }} variant="outlined">
Expand Down Expand Up @@ -77,8 +79,10 @@ export default function InputAdornments() {
label="With normal TextField"
id="filled-start-adornment"
sx={{ m: 1, width: '25ch' }}
InputProps={{
startAdornment: <InputAdornment position="start">kg</InputAdornment>,
slotProps={{
input: {
startAdornment: <InputAdornment position="start">kg</InputAdornment>,
},
}}
variant="filled"
/>
Expand Down Expand Up @@ -125,8 +129,10 @@ export default function InputAdornments() {
label="With normal TextField"
id="standard-start-adornment"
sx={{ m: 1, width: '25ch' }}
InputProps={{
startAdornment: <InputAdornment position="start">kg</InputAdornment>,
slotProps={{
input: {
startAdornment: <InputAdornment position="start">kg</InputAdornment>,
},
}}
variant="standard"
/>
Expand Down
18 changes: 12 additions & 6 deletions docs/data/material/components/text-fields/InputAdornments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ export default function InputAdornments() {
label="With normal TextField"
id="outlined-start-adornment"
sx={{ m: 1, width: '25ch' }}
InputProps={{
startAdornment: <InputAdornment position="start">kg</InputAdornment>,
slotProps={{
input: {
startAdornment: <InputAdornment position="start">kg</InputAdornment>,
},
}}
/>
<FormControl sx={{ m: 1, width: '25ch' }} variant="outlined">
Expand Down Expand Up @@ -77,8 +79,10 @@ export default function InputAdornments() {
label="With normal TextField"
id="filled-start-adornment"
sx={{ m: 1, width: '25ch' }}
InputProps={{
startAdornment: <InputAdornment position="start">kg</InputAdornment>,
slotProps={{
input: {
startAdornment: <InputAdornment position="start">kg</InputAdornment>,
},
}}
variant="filled"
/>
Expand Down Expand Up @@ -125,8 +129,10 @@ export default function InputAdornments() {
label="With normal TextField"
id="standard-start-adornment"
sx={{ m: 1, width: '25ch' }}
InputProps={{
startAdornment: <InputAdornment position="start">kg</InputAdornment>,
slotProps={{
input: {
startAdornment: <InputAdornment position="start">kg</InputAdornment>,
},
}}
variant="standard"
/>
Expand Down
14 changes: 8 additions & 6 deletions docs/data/material/components/text-fields/InputWithIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ export default function InputWithIcon() {
<TextField
id="input-with-icon-textfield"
label="TextField"
InputProps={{
startAdornment: (
<InputAdornment position="start">
<AccountCircle />
</InputAdornment>
),
slotProps={{
input: {
startAdornment: (
<InputAdornment position="start">
<AccountCircle />
</InputAdornment>
),
},
}}
variant="standard"
/>
Expand Down
14 changes: 8 additions & 6 deletions docs/data/material/components/text-fields/InputWithIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ export default function InputWithIcon() {
<TextField
id="input-with-icon-textfield"
label="TextField"
InputProps={{
startAdornment: (
<InputAdornment position="start">
<AccountCircle />
</InputAdornment>
),
slotProps={{
input: {
startAdornment: (
<InputAdornment position="start">
<AccountCircle />
</InputAdornment>
),
},
}}
variant="standard"
/>
Expand Down
18 changes: 12 additions & 6 deletions docs/data/material/components/text-fields/SelectTextFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ export default function SelectTextFields() {
select
label="Native select"
defaultValue="EUR"
SelectProps={{
native: true,
slotProps={{
select: {
native: true,
},
}}
helperText="Please select your currency"
>
Expand Down Expand Up @@ -83,8 +85,10 @@ export default function SelectTextFields() {
select
label="Native select"
defaultValue="EUR"
SelectProps={{
native: true,
slotProps={{
select: {
native: true,
},
}}
helperText="Please select your currency"
variant="filled"
Expand Down Expand Up @@ -116,8 +120,10 @@ export default function SelectTextFields() {
select
label="Native select"
defaultValue="EUR"
SelectProps={{
native: true,
slotProps={{
select: {
native: true,
},
}}
helperText="Please select your currency"
variant="standard"
Expand Down