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

Components: Remove deprecation warnings for __next36pxDefaultSize #58703

Merged
merged 5 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 2 additions & 1 deletion packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
- `Button`: Update secondary variant to show the border even in a disabled state. ([#58606](https://github.com/WordPress/gutenberg/pull/58606)).
- `ConfirmDialog`: Add `__next40pxDefaultSize` to buttons ([#58421](https://github.com/WordPress/gutenberg/pull/58421)).
- `Snackbar`: Update the warning message ([#58591](https://github.com/WordPress/gutenberg/pull/58591)).
- `Composite`: Implementing `useCompositeState` with Ariakit ([#57304](https://github.com/WordPress/gutenberg/pull/57304))
- `Composite`: Implementing `useCompositeState` with Ariakit ([#57304](https://github.com/WordPress/gutenberg/pull/57304)).
- Remove deprecation warnings for `__next36pxDefaultSize` prop ([#58703](https://github.com/WordPress/gutenberg/pull/58703)).
- `CheckboxControl`: Remove ability for label prop to be false ([#58339](https://github.com/WordPress/gutenberg/pull/58339)).

### Bug Fix
Expand Down
5 changes: 1 addition & 4 deletions packages/components/src/combobox-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,7 @@ function ComboboxControl( props: ComboboxControlProps ) {
selected: __( 'Item selected.' ),
},
__experimentalRenderItem,
} = useDeprecated36pxDefaultSizeProp< ComboboxControlProps >(
props,
'wp.components.ComboboxControl'
);
} = useDeprecated36pxDefaultSizeProp( props );

const [ value, setValue ] = useControlledValue( {
value: valueProp,
Expand Down
6 changes: 1 addition & 5 deletions packages/components/src/custom-select-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ export default function CustomSelectControl( props ) {
onFocus,
onBlur,
__experimentalShowSelectedHint = false,
} = useDeprecated36pxDefaultSizeProp(
props,
'wp.components.CustomSelectControl',
'6.4'
);
} = useDeprecated36pxDefaultSizeProp( props );

const {
getLabelProps,
Expand Down
5 changes: 1 addition & 4 deletions packages/components/src/form-token-field/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ export function FormTokenField( props: FormTokenFieldProps ) {
__experimentalAutoSelectFirstMatch = false,
__nextHasNoMarginBottom = false,
tokenizeOnBlur = false,
} = useDeprecated36pxDefaultSizeProp< FormTokenFieldProps >(
props,
'wp.components.FormTokenField'
);
} = useDeprecated36pxDefaultSizeProp< FormTokenFieldProps >( props );

const instanceId = useInstanceId( FormTokenField );

Expand Down
6 changes: 1 addition & 5 deletions packages/components/src/input-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ export function UnforwardedInputControl(
suffix,
value,
...restProps
} = useDeprecated36pxDefaultSizeProp< InputControlProps >(
props,
'wp.components.InputControl',
'6.4'
);
} = useDeprecated36pxDefaultSizeProp< InputControlProps >( props );

const [ isFocused, setIsFocused ] = useState( false );

Expand Down
6 changes: 1 addition & 5 deletions packages/components/src/input-control/input-base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,7 @@ export function InputBase(
size = 'default',
suffix,
...restProps
} = useDeprecated36pxDefaultSizeProp(
props,
'wp.components.InputBase',
'6.4'
);
} = useDeprecated36pxDefaultSizeProp( props );

const id = useUniqueId( idProp );
const hideLabel = hideLabelFromVision || ! label;
Expand Down
6 changes: 1 addition & 5 deletions packages/components/src/number-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ function UnforwardedNumberControl(
suffix,
onChange = noop,
...restProps
} = useDeprecated36pxDefaultSizeProp< NumberControlProps >(
props,
'wp.components.NumberControl',
'6.4'
);
} = useDeprecated36pxDefaultSizeProp< NumberControlProps >( props );

if ( hideHTMLArrows ) {
deprecated( 'wp.components.NumberControl hideHTMLArrows prop ', {
Expand Down
6 changes: 1 addition & 5 deletions packages/components/src/select-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ function UnforwardedSelectControl(
__next40pxDefaultSize = false,
__nextHasNoMarginBottom = false,
...restProps
} = useDeprecated36pxDefaultSizeProp(
props,
'wp.components.SelectControl',
'6.4'
);
} = useDeprecated36pxDefaultSizeProp( props );
const [ isFocused, setIsFocused ] = useState( false );
const id = useUniqueId( idProp );
const helpId = help ? `${ id }__help` : undefined;
Expand Down
6 changes: 1 addition & 5 deletions packages/components/src/tree-select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ export function TreeSelect( props: TreeSelectProps ) {
selectedId,
tree = [],
...restProps
} = useDeprecated36pxDefaultSizeProp(
props,
'wp.components.TreeSelect',
'6.4'
);
} = useDeprecated36pxDefaultSizeProp( props );

const options = useMemo( () => {
return [
Expand Down
6 changes: 1 addition & 5 deletions packages/components/src/unit-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ function UnforwardedUnitControl(
value: valueProp,
onFocus: onFocusProp,
...props
} = useDeprecated36pxDefaultSizeProp(
unitControlProps,
'wp.components.UnitControl',
'6.4'
);
} = useDeprecated36pxDefaultSizeProp( unitControlProps );

if ( 'unit' in unitControlProps ) {
deprecated( 'UnitControl unit prop', {
Expand Down
19 changes: 1 addition & 18 deletions packages/components/src/utils/use-deprecated-props.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
/**
* WordPress dependencies
*/
import deprecated from '@wordpress/deprecated';

export function useDeprecated36pxDefaultSizeProp<
P extends Record< string, any > & {
__next36pxDefaultSize?: boolean;
__next40pxDefaultSize?: boolean;
},
>(
props: P,
/** The component identifier in dot notation, e.g. `wp.components.ComponentName`. */
componentIdentifier: string,
/** Version in which the prop was deprecated. */
since: string = '6.3'
) {
>( props: P ) {
const { __next36pxDefaultSize, __next40pxDefaultSize, ...otherProps } =
props;
if ( typeof __next36pxDefaultSize !== 'undefined' ) {
deprecated( '`__next36pxDefaultSize` prop in ' + componentIdentifier, {
alternative: '`__next40pxDefaultSize`',
since,
} );
}

return {
...otherProps,
Expand Down
Loading