Skip to content
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: 0 additions & 1 deletion packages/block-library/src/avatar/user-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export default function UserControl( { value, onChange } ) {

return (
<ComboboxControl
__next40pxDefaultSize
label={ __( 'User' ) }
help={ __(
'Select the avatar user to display, if it is blank it will use the post/page author.'
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/page-list/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ export default function PageListEdit( {
isShownByDefault
>
<ComboboxControl
__next40pxDefaultSize
className="editor-page-attributes__parent"
label={ __( 'Parent' ) }
value={ parentPageID }
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/post-author/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ function AuthorCombobox( { value, onChange } ) {

return (
<ComboboxControl
__next40pxDefaultSize
label={ __( 'Author' ) }
options={ authorOptions }
value={ value?.id }
Expand Down
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- The `__next40pxDefaultSize` prop is now true by default. The prop can be safely removed from the following:
- `BorderBoxControl` ([#79420](https://github.com/WordPress/gutenberg/pull/79420))
- `BorderControl` ([#79418](https://github.com/WordPress/gutenberg/pull/79418))
- `ComboboxControl` ([#79636](https://github.com/WordPress/gutenberg/pull/79636)).
- `FontSizePicker` ([#79481](https://github.com/WordPress/gutenberg/pull/79481))
- `TreeSelect` ([#79550](https://github.com/WordPress/gutenberg/pull/79550))

Expand Down
9 changes: 0 additions & 9 deletions packages/components/src/combobox-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ function MyComboboxControl() {
const [ filteredOptions, setFilteredOptions ] = useState( options );
return (
<ComboboxControl
__next40pxDefaultSize
label="Font Size"
value={ fontSize }
onChange={ setFontSize }
Expand Down Expand Up @@ -133,14 +132,6 @@ Custom renderer invoked for each option in the suggestion list. The render prop
- Type: `( args: { item: object } ) => ReactNode`
- Required: No

#### __next40pxDefaultSize

Start opting into the larger default height that will become the default size in a future version.

- Type: `Boolean`
- Required: No
- Default: `false`

## Related components

- Like this component, but without a search input, the [`CustomSelectControl`](https://developer.wordpress.org/block-editor/reference-guides/components/custom-select-control/) component.
Expand Down
16 changes: 2 additions & 14 deletions packages/components/src/combobox-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ import { useControlledValue } from '../utils/hooks';
import { normalizeTextString } from '../utils/strings';
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';
import Spinner from '../spinner';

const noop = () => {};
Expand Down Expand Up @@ -94,7 +92,6 @@ const getIndexOfMatchingSuggestion = (
* const [ filteredOptions, setFilteredOptions ] = useState( options );
* return (
* <ComboboxControl
* __next40pxDefaultSize
* label="Font Size"
* value={ fontSize }
* onChange={ setFontSize }
Expand All @@ -115,7 +112,6 @@ const getIndexOfMatchingSuggestion = (
*/
function ComboboxControl( props: ComboboxControlProps ) {
const {
__next40pxDefaultSize = false,
value: valueProp,
label,
options,
Expand All @@ -132,7 +128,7 @@ function ComboboxControl( props: ComboboxControlProps ) {
__experimentalRenderItem,
expandOnFocus = true,
placeholder,
} = useDeprecated36pxDefaultSizeProp( props );
} = props;

const [ value, setValue ] = useControlledValue( {
value: valueProp,
Expand Down Expand Up @@ -315,12 +311,6 @@ 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 All @@ -339,9 +329,7 @@ function ComboboxControl( props: ComboboxControlProps ) {
tabIndex={ -1 }
onKeyDown={ onKeyDown }
>
<InputWrapperFlex
__next40pxDefaultSize={ __next40pxDefaultSize }
>
<InputWrapperFlex>
<FlexBlock>
<TokenInput
className="components-combobox-control__input"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ const Template: StoryFn< typeof ComboboxControl > = ( {
return (
<>
<ComboboxControl
__next40pxDefaultSize
{ ...args }
value={ value }
onChange={ ( ...changeArgs ) => {
Expand All @@ -88,7 +87,6 @@ const Template: StoryFn< typeof ComboboxControl > = ( {
};
export const Default = Template.bind( {} );
Default.args = {
__next40pxDefaultSize: true,
label: 'Country',
options: countryOptions,
help: 'Help text to describe the control.',
Expand Down
21 changes: 0 additions & 21 deletions packages/components/src/combobox-control/styles.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
/**
* External dependencies
*/
import styled from '@emotion/styled';
import { css } from '@emotion/react';

/**
* Internal dependencies
*/
import { Flex } from '../flex';
import { space } from '../utils/space';
import type { ComboboxControlProps } from './types';

const deprecatedDefaultSize = ( {
__next40pxDefaultSize,
}: Pick< ComboboxControlProps, '__next40pxDefaultSize' > ) =>
! __next40pxDefaultSize &&
css`
height: 28px; // 30px - 2px vertical borders on parent container
padding-left: ${ space( 1 ) };
padding-right: ${ space( 1 ) };
`;

export const InputWrapperFlex = styled( Flex )`
height: 38px; // 40px - 2px vertical borders on parent container
padding-left: ${ space( 2 ) };
padding-right: ${ space( 2 ) };

${ deprecatedDefaultSize }
`;
2 changes: 1 addition & 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,7 @@ const getOptionSearchString = ( option: ComboboxControlOption ) =>
option.label.substring( 0, 11 );

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

const ControlledComboboxControl = ( {
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/combobox-control/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export type ComboboxControlProps = Pick<
/**
* Start opting into the larger default height that will become the default size in a future version.
*
* @default false
* @deprecated Default behavior since WordPress 7.1. Prop can be safely removed.
* @ignore
*/
__next40pxDefaultSize?: boolean;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const UnforwardedValidatedComboboxControl = (
)
}
>
<ComboboxControl __next40pxDefaultSize { ...restProps } />
<ComboboxControl { ...restProps } />
</ControlWithError>
);
};
Expand Down
1 change: 0 additions & 1 deletion packages/editor/src/components/page-attributes/parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ export function PageAttributesParent() {

return (
<ComboboxControl
__next40pxDefaultSize
className="editor-page-attributes__parent"
label={ __( 'Parent' ) }
help={ __( 'Choose a parent page.' ) }
Expand Down
1 change: 0 additions & 1 deletion packages/editor/src/components/post-author/combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default function PostAuthorCombobox() {

return (
<ComboboxControl
__next40pxDefaultSize
label={ __( 'Author' ) }
options={ authorOptions }
value={ authorId }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ This is a temporary rule to help migrate components to the new default size. Onc
The following components are checked by this rule:

- Button
- ComboboxControl
- CustomSelectControl
- FontAppearanceControl
- FormFileUpload (special case - see below)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ ruleTester.run( 'components-no-missing-40px-size-prop', rule, {
{
code: `
import {
ComboboxControl,
CustomSelectControl,
FontAppearanceControl,
FormTokenField,
Expand All @@ -122,7 +121,6 @@ ruleTester.run( 'components-no-missing-40px-size-prop', rule, {
UnitControl,
} from '@wordpress/components';
<>
<ComboboxControl __next40pxDefaultSize />
<CustomSelectControl __next40pxDefaultSize />
<FontAppearanceControl __next40pxDefaultSize />
<FormTokenField __next40pxDefaultSize />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const { hasTruthyJsxAttribute } = require( '../utils' );
const COMPONENTS_REQUIRING_40PX = new Set( [
'Button',
'ClipboardButton',
'ComboboxControl',
'CustomSelectControl',
'FontAppearanceControl',
'FormTokenField',
Expand Down
1 change: 0 additions & 1 deletion packages/fields/src/fields/parent/parent-edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ export function PageAttributesParent( {

return (
<ComboboxControl
__next40pxDefaultSize
label={ __( 'Parent' ) }
help={ __( 'Choose a parent page.' ) }
value={ pageId?.toString() }
Expand Down
1 change: 0 additions & 1 deletion packages/media-fields/src/attached_to/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ export default function MediaAttachedToEdit( {
return (
<ComboboxControl
className="dataviews-media-field__attached-to"
__next40pxDefaultSize
isLoading={ isLoading }
label={ __( 'Attached to' ) }
help={ help }
Expand Down
1 change: 0 additions & 1 deletion routes/guidelines/components/block-guideline-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ export default function BlockGuidelineModal( {
/>
) : (
<ComboboxControl
__next40pxDefaultSize
label={ __( 'Block' ) }
options={ availableBlockOptions }
value={ selectedBlock }
Expand Down
1 change: 1 addition & 0 deletions tools/eslint/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ const restrictedSyntax = [
'BorderBoxControl',
'BorderControl',
'BoxControl',
'ComboboxControl',
'FocalPointPicker',
'FontFamilyControl',
'FontSizePicker',
Expand Down
2 changes: 1 addition & 1 deletion tools/eslint/suppressions.json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some of the changes in this file are unexpected? Some of these files are not touched by this PR

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for catching. I'll revert them here for now, and try improving this workflow in #79708.

Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@
},
"packages/components/src/combobox-control/styles.ts": {
"no-restricted-imports": {
"count": 2
"count": 1
}
},
"packages/components/src/confirm-dialog/styles.ts": {
Expand Down
Loading