-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: [M3-6788] - MUI v5 Migration -
Components > TextField
(#9314
) * initial `TextField` refactor * update storybook story * rename `Props` ➡️ `TextFieldProps` * clean up the mdx * fix broken storybook build * feedback @mjac0bs * add some defaults --------- Co-authored-by: Banks Nussman <banks@nussman.us>
- Loading branch information
1 parent
ae62d9e
commit 070732e
Showing
95 changed files
with
268 additions
and
359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/manager/src/components/CopyableTextField/CopyableTextField.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/manager/src/components/EnhancedSelect/components/SelectControl.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/manager/src/components/LabelAndTagsPanel/LabelAndTagsPanel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
packages/manager/src/components/PasswordInput/HideShowText.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Canvas, Meta, Story, Controls } from '@storybook/addon-docs'; | ||
import * as TextFieldStories from './TextField.stories'; | ||
|
||
<Meta of={TextFieldStories} /> | ||
|
||
# Text Field | ||
|
||
<Canvas of={TextFieldStories.Default} /> | ||
|
||
### Overview | ||
|
||
Text fields allow users to enter text into a UI. | ||
|
||
### Usage | ||
|
||
- Input fields should be sized to the data being entered (ex. the entry for a street address should be wider than a zip code). | ||
- Ensure that the field can accommodate at least one more character than the maximum number to be entered. | ||
|
||
### Rules | ||
|
||
- Every input must have a descriptive label of what that field is. | ||
- Required fields should include the text “(Required)” as part of the input label. | ||
- If most fields are required, then indicate the optional fields with the text “(Optional)” instead. | ||
- Avoid long labels; use succinct, short and descriptive labels (a word or two) so users can quickly scan your form. <br/> Label text shouldn’t take up multiple lines. | ||
- Placeholder text is the text that users see before they interact with a field. It should be a useful guide to the input type and format <br/> Don’t make the user guess what format they should use for the field. Tell this information up front. | ||
|
||
### Best Practices | ||
|
||
- A single column form with input fields stacked sequentially is the easiest to understand and leads to the highest success rate. Input fields in multiple columns can be overlooked or add unnecessary visual clutter. | ||
- Grouping related inputs (ex. mailing address) under a subhead or rule can add meaning and make the form feel more manageable. | ||
- Avoid breaking a single form into multiple “papers” unless those sections are truly independent of each other. | ||
- Consider sizing the input field to the data being entered (ex. the field for a street address should be wider than the field for a zip code). Balance this goal with the visual benefits of fields of the same length. A somewhat outsized input that aligns with the fields above and below it might be the best choice. | ||
|
||
## Error | ||
|
||
### Overview | ||
|
||
Error messages are an indicator of system status: they let users know that a hurdle was encountered and give solutions to fix it. Users should not have to memorize instructions in order to fix the error. | ||
|
||
### Main Principles | ||
|
||
- Should be easy to notice and understand. | ||
- Should give solutions to how to fix the error. | ||
- Users should not have to memorize instructions in order to fix the error. | ||
- Long error messages for short text fields can extend beyond the text field. | ||
- When the user has finished filling in a field and clicks the submit button, an indicator should appear if the field contains an error. Use red to differentiate error fields from normal ones. | ||
|
||
<Canvas of={TextFieldStories.Error} /> | ||
|
||
## Number | ||
|
||
### Overview | ||
|
||
Number Text Fields are used for strictly numerical input | ||
|
||
<Canvas of={TextFieldStories.Number} /> | ||
|
||
## Component API | ||
|
||
<Canvas of={TextFieldStories.Default} /> | ||
|
||
<Controls /> |
Oops, something went wrong.