Skip to content

Commit

Permalink
TextControl: Restrict type prop in TypeScript (#45433)
Browse files Browse the repository at this point in the history
* TextControl: Limit TypeScript `type` prop

* Update CHANGELOG.md

* Remove controll
  • Loading branch information
Petter Walbø Johnsgård authored Nov 28, 2022
1 parent f86391b commit c34f716
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

- `TabPanel`: Add ability to set icon only tab buttons ([#45005](https://github.com/WordPress/gutenberg/pull/45005)).

### Experimental

- `TextControl`: Restrict `type` prop to `email`, `number`, `password`, `tel`, `text`, `search` or `url` ([#45433](https://github.com/WordPress/gutenberg/pull/45433/)).

### Internal

- `LinkedButton`: remove unnecessary `span` tag ([#46063](https://github.com/WordPress/gutenberg/pull/46063))
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/text-control/stories/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const meta: ComponentMeta< typeof TextControl > = {
argTypes: {
help: { control: { type: 'text' } },
label: { control: { type: 'text' } },
type: { control: { type: 'text' } },
onChange: { action: 'onChange' },
value: { control: { type: null } },
},
Expand Down
7 changes: 1 addition & 6 deletions packages/components/src/text-control/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* External dependencies
*/
import type { HTMLInputTypeAttribute } from 'react';

/**
* Internal dependencies
*/
Expand All @@ -29,5 +24,5 @@ export type TextControlProps = Pick<
*
* @default 'text'
*/
type?: HTMLInputTypeAttribute;
type?: 'email' | 'number' | 'password' | 'tel' | 'text' | 'search' | 'url';
};

0 comments on commit c34f716

Please sign in to comment.