Skip to content
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

TextControl: Set Storybook control types on help, label and type #45405

Merged
merged 3 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
- `ItemGroup`: fix RTL `Item` styles when rendered as a button ([#45280](https://github.com/WordPress/gutenberg/pull/45280)).
- `Button`: Fix RTL alignment for buttons containing an icon and text ([#44787](https://github.com/WordPress/gutenberg/pull/44787)).
- `TabPanel`: Call `onSelect()` on every tab selection, regardless of whether it was triggered by user interaction ([#44028](https://github.com/WordPress/gutenberg/pull/44028)).
- `FontSizePicker`: Fallback to font size `slug` if `name` is undefined ([#45041](https://github.com/WordPress/gutenberg/pull/45041)).
- `FontSizePicker`: Fallback to font size `slug` if `name` is undefined ([#45041](https://github.com/WordPress/gutenberg/pull/45041)).
- `AutocompleterUI`: fix issue where autocompleter UI would appear on top of other UI elements ([#44795](https://github.com/WordPress/gutenberg/pull/44795/))

### Internal
Expand All @@ -47,6 +47,7 @@
- `UnitControl`: Add tests ([#45260](https://github.com/WordPress/gutenberg/pull/45260)).
- `Disabled`: Refactor the component to rely on the HTML `inert` attribute.
- `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)).

## 21.3.0 (2022-10-19)

Expand All @@ -55,7 +56,7 @@
- `FontSizePicker`: Ensure that fluid font size presets appear correctly in the UI controls ([#44791](https://github.com/WordPress/gutenberg/pull/44791)).
- `ToggleGroupControl`: Remove unsupported `disabled` prop from types, and correctly mark `label` prop as required ([#45114](https://github.com/WordPress/gutenberg/pull/45114)).
- `Navigator`: prevent partially hiding focus ring styles, by removing unnecessary overflow rules on `NavigatorScreen` ([#44973](https://github.com/WordPress/gutenberg/pull/44973)).
- `Navigator`: restore focus only once per location ([#44972](https://github.com/WordPress/gutenberg/pull/44972)).
- `Navigator`: restore focus only once per location ([#44972](https://github.com/WordPress/gutenberg/pull/44972)).

### Documentation

Expand Down
2 changes: 0 additions & 2 deletions packages/components/src/text-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ function UnforwardedTextControl(
/**
* TextControl components let users enter and edit text.
*
*
* @example
* ```jsx
* import { TextControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
Expand Down
11 changes: 5 additions & 6 deletions packages/components/src/text-control/stories/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ const meta: ComponentMeta< typeof TextControl > = {
component: TextControl,
title: 'Components/TextControl',
argTypes: {
onChange: {
action: 'onChange',
},
value: {
control: { type: null },
},
help: { control: { type: 'text' } },
label: { control: { type: 'text' } },
type: { control: { type: 'text' } },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish there was a way to show all the possible input types in a dropdown, rather than allowing any string. But this is definitely a better scenario than the Object control

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Ideally I think the type prop on TextControl should be limited. To me I it doesn't make sense to allow ex type="button" and type="checkbox" here.

However I think that is a discussion for another PR. If you want I can open a PR and we can continue it there.

onChange: { action: 'onChange' },
value: { control: { type: null } },
},
parameters: {
controls: {
Expand Down