Skip to content

Commit bf84ac6

Browse files
mirkaciampo
andauthored
BorderControl: Deprecate 36px default size (#65755)
* Add utility function * BorderBoxControl: Deprecate 36px default size * Fix naming * Add changelog * BorderControl: Deprecate 36px default size * Add changelog Co-authored-by: mirka <[email protected]> Co-authored-by: ciampo <[email protected]>
1 parent 76a5ba1 commit bf84ac6

File tree

7 files changed

+14
-3
lines changed

7 files changed

+14
-3
lines changed

packages/components/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Deprecations
66

77
- `BorderBoxControl`: Deprecate 36px default size ([#65752](https://github.com/WordPress/gutenberg/pull/65752)).
8+
- `BorderControl`: Deprecate 36px default size ([#65755](https://github.com/WordPress/gutenberg/pull/65755)).
89

910
### Bug Fixes
1011

packages/components/src/border-control/border-control/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const MyBorderControl = () => {
3030

3131
return (
3232
<BorderControl
33+
__next40pxDefaultSize
3334
colors={ colors }
3435
label={ __( 'Border' ) }
3536
onChange={ setBorder }

packages/components/src/border-control/border-control/component.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ const UnconnectedBorderControl = (
154154
*
155155
* return (
156156
* <BorderControl
157+
* __next40pxDefaultSize
157158
* colors={ colors }
158159
* label={ __( 'Border' ) }
159160
* onChange={ onChange }

packages/components/src/border-control/border-control/hook.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import { parseQuantityAndUnitFromRawValue } from '../../unit-control/utils';
1111
import type { WordPressComponentProps } from '../../context';
1212
import { useContextSystem } from '../../context';
1313
import { useCx } from '../../utils/hooks/use-cx';
14-
1514
import type { Border, BorderControlProps } from '../types';
15+
import { maybeWarnDeprecated36pxSize } from '../../utils/deprecated-36px-size';
1616

1717
// If either width or color are defined, the border is considered valid
1818
// and a border style can be set as well.
@@ -41,6 +41,12 @@ export function useBorderControl(
4141
...otherProps
4242
} = useContextSystem( props, 'BorderControl' );
4343

44+
maybeWarnDeprecated36pxSize( {
45+
componentName: 'BorderControl',
46+
__next40pxDefaultSize,
47+
size,
48+
} );
49+
4450
const computedSize =
4551
size === 'default' && __next40pxDefaultSize ? '__unstable-large' : size;
4652

packages/components/src/border-control/stories/index.story.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export const Default = Template.bind( {} );
9393
Default.args = {
9494
colors,
9595
label: 'Border',
96+
__next40pxDefaultSize: true,
9697
enableAlpha: true,
9798
enableStyle: true,
9899
shouldSanitizeBorder: true,

packages/components/src/border-control/test/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function createProps( customProps ) {
3131
props.value = newValue;
3232
} ),
3333
value: defaultBorder,
34+
__next40pxDefaultSize: true,
3435
...customProps,
3536
};
3637
return props;

packages/components/src/utils/deprecated-36px-size.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export function maybeWarnDeprecated36pxSize( {
1717
}
1818

1919
deprecated( `36px default size for wp.components.${ componentName }`, {
20-
since: '6.7',
21-
version: '7.0',
20+
since: '6.8',
21+
version: '7.1',
2222
hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.',
2323
} );
2424
}

0 commit comments

Comments
 (0)