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

BoxControl: Deprecate 36px default size #66704

Merged
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)).
- `BoxControl`: Deprecate 36px default size ([#66704](https://github.com/WordPress/gutenberg/pull/66704)).

### Enhancements

Expand Down
1 change: 1 addition & 0 deletions packages/components/src/box-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function Example() {

return (
<BoxControl
next40pxDefaultSize
hbhalodia marked this conversation as resolved.
Show resolved Hide resolved
values={ values }
onChange={ ( nextValues ) => setValues( nextValues ) }
/>
Expand Down
8 changes: 8 additions & 0 deletions packages/components/src/box-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import type {
BoxControlProps,
BoxControlValue,
} from './types';
import { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';

const defaultInputProps = {
min: 0,
Expand Down Expand Up @@ -64,6 +65,7 @@ function useUniqueId( idProp?: string ) {
*
* return (
* <BoxControl
* next40pxDefaultSize
hbhalodia marked this conversation as resolved.
Show resolved Hide resolved
* values={ values }
* onChange={ ( nextValues ) => setValues( nextValues ) }
* />
Expand Down Expand Up @@ -155,6 +157,12 @@ function BoxControl( {
__next40pxDefaultSize,
};

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

return (
<Grid
id={ id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const TemplateControlled: StoryFn< typeof BoxControl > = ( props ) => {
export const Default = TemplateUncontrolled.bind( {} );
Default.args = {
label: 'Label',
__next40pxDefaultSize: true,
};

export const Controlled = TemplateControlled.bind( {} );
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/box-control/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ const Example = ( extraProps: Omit< BoxControlProps, 'onChange' > ) => {
describe( 'BoxControl', () => {
describe( 'Basic rendering', () => {
it( 'should render a box control input', () => {
render( <BoxControl onChange={ () => {} } /> );
render(
<BoxControl __next40pxDefaultSize onChange={ () => {} } />
);

expect(
screen.getByRole( 'group', { name: 'Box Control' } )
Expand Down
Loading