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

FormTokenField: Deprecate 36px default size #67454

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
- `NumberControl`: Deprecate 36px default size ([#66730](https://github.com/WordPress/gutenberg/pull/66730)).
- `UnitControl`: Deprecate 36px default size ([#66791](https://github.com/WordPress/gutenberg/pull/66791)).
- `FormFileUpload`: Deprecate 36px default size ([#67438](https://github.com/WordPress/gutenberg/pull/67438)).
- `FormTokenField`: Deprecate 36px default size ([#67454](https://github.com/WordPress/gutenberg/pull/67454)).


### Enhancements

Expand Down
1 change: 1 addition & 0 deletions packages/components/src/form-token-field/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const MyFormTokenField = () => {

return (
<FormTokenField
__next40pxDefaultSize
value={ selectedContinents }
suggestions={ continents }
onChange={ ( tokens ) => setSelectedContinents( tokens ) }
Expand Down
7 changes: 7 additions & 0 deletions packages/components/src/form-token-field/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
import { Spacer } from '../spacer';
import { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';
import { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';
import { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';

const identity = ( value: string ) => value;

Expand Down Expand Up @@ -86,6 +87,12 @@ export function FormTokenField( props: FormTokenFieldProps ) {
} );
}

maybeWarnDeprecated36pxSize( {
componentName: 'FormTokenField',
size: undefined,
__next40pxDefaultSize,
} );

const instanceId = useInstanceId( FormTokenField );

// We reset to these initial values again in the onBlur
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Default.args = {
label: 'Type a continent',
suggestions: continents,
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
hbhalodia marked this conversation as resolved.
Show resolved Hide resolved
};

export const Async: StoryFn< typeof FormTokenField > = ( {
Expand Down Expand Up @@ -102,6 +103,7 @@ Async.args = {
label: 'Type a continent',
suggestions: continents,
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
};

export const DropdownSelector: StoryFn< typeof FormTokenField > =
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/form-token-field/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ import { useState } from '@wordpress/element';
/**
* Internal dependencies
*/
import FormTokenField from '../';
import _FormTokenField from '../';

const FormTokenField = ( props: ComponentProps< typeof _FormTokenField > ) => (
<_FormTokenField __next40pxDefaultSize { ...props } />
);

const FormTokenFieldWithState = ( {
onChange,
Expand Down
Loading