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

ComboboxControl : Deprecate 36px default size #66900

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
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Deprecations

- `Radio`: Deprecate 36px default size ([#66572](https://github.com/WordPress/gutenberg/pull/66572)).
- `ComboboxControl`: Deprecate 36px default size ([#66900](https://github.com/WordPress/gutenberg/pull/66900)).

### Enhancements

Expand Down
1 change: 1 addition & 0 deletions packages/components/src/combobox-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function MyComboboxControl() {
const [ filteredOptions, setFilteredOptions ] = useState( options );
return (
<ComboboxControl
__next40pxDefaultSize
PARTHVATALIYA marked this conversation as resolved.
Show resolved Hide resolved
__nextHasNoMarginBottom
label="Font Size"
value={ fontSize }
Expand Down
8 changes: 8 additions & 0 deletions packages/components/src/combobox-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import type { ComboboxControlOption, ComboboxControlProps } from './types';
import type { TokenInputProps } from '../form-token-field/types';
import { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';
import { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';
import { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';

const noop = () => {};

Expand Down Expand Up @@ -92,6 +93,7 @@ const getIndexOfMatchingSuggestion = (
* const [ filteredOptions, setFilteredOptions ] = useState( options );
* return (
* <ComboboxControl
* __next40pxDefaultSize
* __nextHasNoMarginBottom
* label="Font Size"
* value={ fontSize }
Expand Down Expand Up @@ -313,6 +315,12 @@ function ComboboxControl( props: ComboboxControlProps ) {
}
}, [ matchingSuggestions, isExpanded ] );

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

// Disable reason: There is no appropriate role which describes the
// input container intended accessible usability.
// TODO: Refactor click detection to use blur to stop propagation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const Template: StoryFn< typeof ComboboxControl > = ( {
};
export const Default = Template.bind( {} );
Default.args = {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
allowReset: false,
label: 'Select a country',
Expand Down
8 changes: 7 additions & 1 deletion packages/components/src/combobox-control/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ const getOptionSearchString = ( option: ComboboxControlOption ) =>
option.label.substring( 0, 11 );

const ComboboxControl = ( props: ComboboxControlProps ) => {
return <_ComboboxControl { ...props } __nextHasNoMarginBottom />;
return (
<_ComboboxControl
{ ...props }
__next40pxDefaultSize
__nextHasNoMarginBottom
/>
);
};

const ControlledComboboxControl = ( {
Expand Down
Loading