TextControl: Restrict type prop in TypeScript#45433
Merged
Conversation
|
|
ciampo
approved these changes
Nov 1, 2022
Contributor
ciampo
left a comment
There was a problem hiding this comment.
The change seems reasonable to me 🚀 but happy to hear other folks' opinions here
ciampo
reviewed
Nov 26, 2022
packages/components/CHANGELOG.md
Outdated
| - `CustomGradientBar`: Refactor away from Lodash ([#45367](https://github.com/WordPress/gutenberg/pull/45367/)). | ||
| - `TextControl`: Set Storybook control types on `help`, `label` and `type` ([#45405](https://github.com/WordPress/gutenberg/pull/45405)). | ||
| - `Autocomplete`: use Popover's new `placement` prop instead of legacy `position` prop ([#44396](https://github.com/WordPress/gutenberg/pull/44396/)). | ||
| - `TextControl`: Restrict `type` prop to `email`, `number`, `password`, `tel`, `text`, `search` or `url` ([#45433](https://github.com/WordPress/gutenberg/pull/45433/)). |
Contributor
There was a problem hiding this comment.
We'll need to move the CHANGELOG entry up to the new Unreleased section
Contributor
|
@mirka quick check that you don't see any issues with restricting the values of the |
Member
Nope! Plus they're just type annotations so it would be trivial to update if we need any tweaks. |
ae0f052 to
79189e3
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What?
Update
typeprops to only allowemail,number,password,tel,text,searchorurl.Why?
A lot of the default
typeoptions doesn't make sense to use with theTextControlcomponent.How?
type. Types remove are:buttoncheckboxcolordatedatetime-localfilehiddenimagemonthradiorangeresetsubmittimeweekTesting Instructions
typefrom a select control.