diff --git a/packages/components/src/custom-select-control-v2/custom-select.tsx b/packages/components/src/custom-select-control-v2/custom-select.tsx index c18d24a6769ae..d91b47a90c6bb 100644 --- a/packages/components/src/custom-select-control-v2/custom-select.tsx +++ b/packages/components/src/custom-select-control-v2/custom-select.tsx @@ -58,12 +58,9 @@ const UnconnectedCustomSelectButton = ( > ) => { const { - defaultValue, renderSelectedValue, - onChange, size = 'default', store, - value, ...restProps } = useContextSystem( props, 'CustomSelectControlButton' ); diff --git a/packages/components/src/custom-select-control-v2/default-component/index.tsx b/packages/components/src/custom-select-control-v2/default-component/index.tsx index bd7a91936ebd5..5e12c2054c644 100644 --- a/packages/components/src/custom-select-control-v2/default-component/index.tsx +++ b/packages/components/src/custom-select-control-v2/default-component/index.tsx @@ -10,10 +10,10 @@ import _CustomSelect from '../custom-select'; import type { CustomSelectProps } from '../types'; function _NewCustomSelect( props: CustomSelectProps ) { - const { defaultValue, onChange, value, ...restProps } = props; + const { defaultValue, onSelectionChange, value, ...restProps } = props; // Forward props + store from v2 implementation const store = Ariakit.useSelectStore( { - setValue: ( nextValue ) => onChange?.( nextValue ), + setValue: ( nextValue ) => onSelectionChange?.( nextValue ), defaultValue, value, } ); diff --git a/packages/components/src/custom-select-control-v2/legacy-component/index.tsx b/packages/components/src/custom-select-control-v2/legacy-component/index.tsx index 82afeae5727ff..a8ae21c047c5e 100644 --- a/packages/components/src/custom-select-control-v2/legacy-component/index.tsx +++ b/packages/components/src/custom-select-control-v2/legacy-component/index.tsx @@ -6,7 +6,6 @@ import * as Ariakit from '@ariakit/react'; /** * WordPress dependencies */ -import deprecated from '@wordpress/deprecated'; import { useMemo } from '@wordpress/element'; /** * Internal dependencies @@ -21,7 +20,6 @@ function _LegacyCustomSelect( props: LegacyCustomSelectProps ) { const { __experimentalShowSelectedHint, __next40pxDefaultSize = false, - __nextUnconstrainedWidth, options, onChange, size = 'default', @@ -81,16 +79,6 @@ function _LegacyCustomSelect( props: LegacyCustomSelectProps ) { } ); - if ( __nextUnconstrainedWidth ) { - deprecated( - 'Constrained width styles for wp.components.CustomSelectControl', - { - hint: 'This behaviour is now built-in.', - since: '6.4', - } - ); - } - const renderSelectedValueHint = () => { const { value: currentValue } = store.getState(); diff --git a/packages/components/src/custom-select-control-v2/stories/default.story.tsx b/packages/components/src/custom-select-control-v2/stories/default.story.tsx index a3b4d45ecb722..062d18cf24fdb 100644 --- a/packages/components/src/custom-select-control-v2/stories/default.story.tsx +++ b/packages/components/src/custom-select-control-v2/stories/default.story.tsx @@ -58,9 +58,9 @@ const ControlledTemplate: StoryFn< typeof NewCustomSelect > = ( props ) => { return ( { + onSelectionChange={ ( nextValue: string | string[] ) => { setValue( nextValue ); - props.onChange?.( nextValue ); + props.onSelectionChange?.( nextValue ); } } value={ value } /> diff --git a/packages/components/src/custom-select-control-v2/types.ts b/packages/components/src/custom-select-control-v2/types.ts index 148edb1a1ee18..3a1eb6b26672f 100644 --- a/packages/components/src/custom-select-control-v2/types.ts +++ b/packages/components/src/custom-select-control-v2/types.ts @@ -23,7 +23,7 @@ export type CustomSelectButtonProps = { /** * A function that receives the new value of the input. */ - onChange?: ( newValue: string | string[] ) => void; + onSelectionChange?: ( newValue: string | string[] ) => void; /** * Can be used to render select UI with custom styled values. */