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

InputControl: remove default value argument from Storybook #40410

Merged
merged 9 commits into from
Apr 21, 2022
3 changes: 3 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

- Remove individual color object exports from the `utils/colors-values.js` file. Colors should now be used from the main `COLORS` export([#40387](https://github.com/WordPress/gutenberg/pull/40387)).

### Bug Fix

- `InputControl`: allow user to input a value interactively in Storybook, by removing default value argument ([#40410](https://github.com/WordPress/gutenberg/pull/40410)).

## 19.8.0 (2022-04-08)

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/input-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Example = () => {
return (
<InputControl
value={ value }
onChange={ ( nextValue ) => setValue( nextValue ) }
onChange={ ( nextValue ) => setValue( nextValue ?? '' ) }
/>
);
};
Expand Down
5 changes: 3 additions & 2 deletions packages/components/src/input-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function UnforwardedInputControl(
* InputControl components let users enter and edit text. This is an experimental component
* intended to (in time) merge with or replace `TextControl`.
*
* @example
* ```jsx
* import { __experimentalInputControl as InputControl } from '@wordpress/components';
* import { useState } from '@wordpress/compose';
*
Expand All @@ -102,10 +102,11 @@ export function UnforwardedInputControl(
* return (
* <InputControl
* value={ value }
* onChange={ ( nextValue ) => setValue( nextValue ) }
* onChange={ ( nextValue ) => setValue( nextValue ?? '' ) }
* />
* );
* };
* ```
*/
export const InputControl = forwardRef( UnforwardedInputControl );

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/input-control/stories/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const meta: ComponentMeta< typeof InputControl > = {
prefix: { control: { type: null } },
suffix: { control: { type: null } },
type: { control: { type: 'text' } },
value: { control: { disable: true } },
},
parameters: {
controls: { expanded: true },
Expand All @@ -34,7 +35,6 @@ export const Default = Template.bind( {} );
Default.args = {
label: 'Value',
placeholder: 'Placeholder',
value: '',
};

export const WithPrefix = Template.bind( {} );
Expand Down