Skip to content

Commit

Permalink
[TextField][material-next] Add FormLabel and InputLabel components (#…
Browse files Browse the repository at this point in the history
…39483)

Signed-off-by: Albert Yu <[email protected]>
Co-authored-by: Diego Andai <[email protected]>
  • Loading branch information
mj12albert and DiegoAndai authored Nov 8, 2023
1 parent 6bc9bab commit 3bada36
Show file tree
Hide file tree
Showing 15 changed files with 533 additions and 317 deletions.
89 changes: 82 additions & 7 deletions docs/pages/experiments/md3/inputs.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import * as React from 'react';
import Stack from '@mui/material/Stack';
import Divider from '@mui/material/Divider';
import Md2FilledInput from '@mui/material/FilledInput';
import {
FilledInput as Md2FilledInput,
FormControl as Md2FormControl,
InputLabel as Md2InputLabel,
InputAdornment as Md2InputAdornment,
} from '@mui/material';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import FilledInput from '@mui/material-next/FilledInput';
import { FilledInput, FormControl, InputLabel } from '@mui/material-next';
import { CssVarsProvider, extendTheme } from '@mui/material-next/styles';
import SearchIcon from '@mui/icons-material/Search';
import HighlightOffIcon from '@mui/icons-material/HighlightOff';
import { ModeSwitcher } from '.';

const md2Theme = createTheme();
Expand All @@ -17,8 +24,36 @@ export default function MaterialYouInputs() {
<ThemeProvider theme={md2Theme}>
<pre>MD2</pre>
<Stack display="inline-flex" direction="row" gap={4}>
<Md2FilledInput defaultValue="primary" color="primary" />
<Md2FilledInput defaultValue="secondary" color="secondary" />
<Md2FormControl color="primary" variant="filled">
<Md2InputLabel htmlFor="md2-primary">Primary</Md2InputLabel>
<Md2FilledInput id="md2-primary" defaultValue="primary" />
</Md2FormControl>
<Md2FormControl color="secondary" variant="filled">
<Md2InputLabel htmlFor="md2-secondary">Secondary</Md2InputLabel>
<Md2FilledInput id="md2-secondary" defaultValue="secondary" />
</Md2FormControl>
</Stack>
<Stack display="inline-flex" direction="row" gap={4}>
<Md2FormControl color="primary" variant="filled">
<Md2InputLabel htmlFor="md2-primary">Primary adornments</Md2InputLabel>
<Md2FilledInput
id="md2-primary"
defaultValue="primary"
startAdornment={
<Md2InputAdornment position="start">
<SearchIcon />
</Md2InputAdornment>
}
/>
</Md2FormControl>
<Md2FormControl color="secondary" variant="filled">
<Md2InputLabel htmlFor="md2-secondary">Secondary adornments</Md2InputLabel>
<Md2FilledInput
id="md2-secondary"
defaultValue="secondary"
startAdornment={<Md2InputAdornment position="start">$</Md2InputAdornment>}
/>
</Md2FormControl>
</Stack>
<Divider />
</ThemeProvider>
Expand All @@ -28,9 +63,49 @@ export default function MaterialYouInputs() {
<ModeSwitcher />
</Stack>
<Stack display="inline-flex" direction="row" gap={4}>
<FilledInput defaultValue="primary" color="primary" />
<FilledInput defaultValue="secondary" color="secondary" />
<FilledInput defaultValue="tertiary" color="tertiary" />
<FormControl color="primary" variant="filled">
<InputLabel htmlFor="md3-primary">Primary</InputLabel>
<FilledInput id="md3-primary" defaultValue="primary" />
</FormControl>
<FormControl color="secondary" variant="filled">
<InputLabel htmlFor="md3-secondary">Secondary</InputLabel>
<FilledInput id="md3-secondary" defaultValue="secondary" />
</FormControl>
<FormControl color="tertiary" variant="filled">
<InputLabel htmlFor="md3-tertiary">Tertiary</InputLabel>
<FilledInput id="md3-tertiary" defaultValue="tertiary" />
</FormControl>
</Stack>
<Stack display="inline-flex" direction="row" gap={4}>
<FormControl color="primary" variant="filled">
<InputLabel htmlFor="md3-primary">Primary adornments</InputLabel>
<FilledInput
id="md3-primary"
defaultValue="primary"
startAdornment={
<Md2InputAdornment position="start">
<SearchIcon />
</Md2InputAdornment>
}
/>
</FormControl>
<FormControl color="secondary" variant="filled">
<InputLabel htmlFor="md3-secondary">Secondary adornments</InputLabel>
<FilledInput
id="md3-secondary"
defaultValue="secondary"
startAdornment={
<Md2InputAdornment position="start">
<SearchIcon />
</Md2InputAdornment>
}
endAdornment={
<Md2InputAdornment position="end">
<HighlightOffIcon />
</Md2InputAdornment>
}
/>
</FormControl>
</Stack>
</CssVarsProvider>
</Stack>
Expand Down
12 changes: 12 additions & 0 deletions packages/mui-material-next/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ The `FormControlState` interface was renamed to `FormControlContextValue`:

The standard variant is no longer supported in Material You, use the `filled` or `outlined` variants instead.

## FormLabel

### Removed the `standard` variant

The standard variant is no longer supported in Material You, use the `filled` or `outlined` variants instead.

## InputBase

### Removed `inputProps`
Expand All @@ -181,6 +187,12 @@ The standard variant is no longer supported in Material You, use the `filled` or
/>
```

## InputLabel

### Removed the `standard` variant

The standard variant is no longer supported in Material You, use the `filled` or `outlined` variants instead.

## Chip

### Removed the "default" color option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface FormControlOwnProps extends BaseFormControlOwnProps {
* @default 'primary'
*/
color?: OverridableStringUnion<
'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning',
'primary' | 'secondary' | 'tertiary' | 'error' | 'info' | 'success' | 'warning',
FormControlPropsColorOverrides
>;
/**
Expand Down
182 changes: 0 additions & 182 deletions packages/mui-material-next/src/FormLabel/FormLabel.js

This file was deleted.

Loading

0 comments on commit 3bada36

Please sign in to comment.