-
Notifications
You must be signed in to change notification settings - Fork 616
Deprecate components replaced by FormControl #1888
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b0f890c
moves InputField to deprecated package
mperrotti 2923c06
adds jsdoc comments for deprecation
mperrotti f546a4f
adds changeset
mperrotti 579cb9b
fixes bad autoformatting in changeset
mperrotti 52b02c3
Merge branch 'next/v35.0.0' into mp/deprecate-inputfield
mperrotti 8908ab0
fixes import path in test file
mperrotti 7ae7c7e
Merge branch 'mp/deprecate-inputfield' of github.com:primer/react int…
mperrotti 3ac28e4
addresses PR feedback
mperrotti ac1ea92
fixes FormGroup import in test
mperrotti ad1656b
Merge branch 'next/v35.0.0' of github.com:primer/react into mp/deprec…
mperrotti d4d7c4a
addresses PR feedback
mperrotti f7feaf3
moves tests to depreacted directory
mperrotti f73f5f5
removes docs header image
mperrotti d586225
fixes bad formatting in changelog markdown
mperrotti 83c6740
Merge branch 'next-major' of github.com:primer/react into mp/deprecat…
mperrotti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,109 @@ | ||
--- | ||
'@primer/react': major | ||
--- | ||
|
||
The `FormControl` component will be used to deprecate the `FormGroup`, `InputField`, and `ChoiceInputField` components. It has the ability to render contextual content with your inputs: labels, validation statuses, captions. It also handles the ARIA attributes that make the form controls accessible to assistive technology. | ||
|
||
<table> | ||
<tr> | ||
<th> Before </th> <th> After </th> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
|
||
```jsx | ||
import {FormControl, Checkbox, TextInput} from "@primer/react" | ||
|
||
|
||
<FormGroup> | ||
<FormGroup.Label htmlFor="example-text">Example text</FormGroup.Label> | ||
<TextInput id="example-text" /> | ||
</FormGroup> | ||
|
||
// OR | ||
|
||
<InputField> | ||
<InputField.Label>Example text</InputField.Label> | ||
<TextInput /> | ||
</InputField> | ||
|
||
// OR | ||
|
||
<ChoiceInputField> | ||
<ChoiceInputField.Label>Example text</ChoiceInputField.Label> | ||
<Checkbox /> | ||
</ChoiceInputField> | ||
|
||
``` | ||
|
||
</td> | ||
<td valign="top"> | ||
|
||
```jsx | ||
import {FormGroup, TextInput} from "@primer/react" | ||
|
||
<FormControl> | ||
<FormControl.Label>Example text</FormControl.Label> | ||
<TextInput /> | ||
</FormControl> | ||
|
||
// OR | ||
|
||
<FormControl> | ||
<FormControl.Label>Example text</FormControl.Label> | ||
<Checkbox /> | ||
</FormControl> | ||
|
||
``` | ||
|
||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
|
||
```jsx | ||
import {InputField} from '@primer/react' | ||
<InputField> | ||
<InputField.Label>Example text</InputField.Label> | ||
<TextInput /> | ||
</InputField> | ||
``` | ||
|
||
</td> | ||
<td valign="top"> | ||
|
||
```jsx | ||
import {FormControl} from '@primer/react' | ||
<FormControl> | ||
<FormControl.Label>Example Text</FormControl.Label> | ||
<TextInput /> | ||
</FormControl> | ||
``` | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
<table style="display: table"> | ||
<tr><th>Migration steps to FormControl</th></tr> | ||
<tr> | ||
<td> | ||
|
||
<strong>Upgrade to the new</strong> `FormControl` component by referring to the [examples in our documentation](https://primer.style/react/FormControl). | ||
|
||
or | ||
|
||
<strong>Continue using the deprecated</strong> `FormGroup`, `ChoiceInputField` or `InputField` : | ||
|
||
```js | ||
import {FormGroup, ChoiceInputField, InputField} from '@primer/react/deprecated' // change your import statements | ||
``` | ||
|
||
Codemods: | ||
|
||
- InputField codemod: https://github.com/primer/react-migrate/blob/main/src/use-deprecated-inputfield.js | ||
- ChoiceInputField https://github.com/primer/react-migrate/blob/main/src/use-deprecated-choiceinputfield.js | ||
- FormGroup codemod: https://github.com/primer/react-migrate/blob/main/src/use-deprecated-formgroup.js | ||
|
||
</td> | ||
</tr> | ||
</table> |
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -164,9 +164,11 @@ | |
- title: Flex | ||
url: /deprecated/Flex | ||
- title: FormGroup | ||
url: /FormGroup | ||
url: /deprecated/FormGroup | ||
- title: Grid | ||
url: /deprecated/Grid | ||
- title: InputField | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. General feedback about the docs for these deprecated components: I think you'll need to move the .md files to `docs/content/deprecated as otherwise they will 404 based on the path below 👇 |
||
url: /deprecated/InputField | ||
mperrotti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- title: Position | ||
url: /deprecated/Position | ||
- title: SelectMenu | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
File renamed without changes.
This file contains hidden or 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 hidden or 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
src/InputField/_InputFieldCaption.tsx → ...recated/InputField/_InputFieldCaption.tsx
This file contains hidden or 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
src/InputField/_InputFieldLabel.tsx → ...eprecated/InputField/_InputFieldLabel.tsx
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
This file contains hidden or 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import createSlots from '../utils/create-slots' | ||
import createSlots from '../../utils/create-slots' | ||
|
||
export const {Slots, Slot} = createSlots(['Caption', 'Input', 'Label', 'LeadingVisual']) |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A TODO for later.. but @siddharthkp has done the codemod for these, which we can mention here too.