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

BorderControl: Deprecate 36px default size #65755

Merged
merged 8 commits into from
Oct 26, 2024
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: 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

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

### Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const MyBorderControl = () => {

return (
<BorderControl
__next40pxDefaultSize
colors={ colors }
label={ __( 'Border' ) }
onChange={ setBorder }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ const UnconnectedBorderControl = (
*
* return (
* <BorderControl
* __next40pxDefaultSize
* colors={ colors }
* label={ __( 'Border' ) }
* onChange={ onChange }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { parseQuantityAndUnitFromRawValue } from '../../unit-control/utils';
import type { WordPressComponentProps } from '../../context';
import { useContextSystem } from '../../context';
import { useCx } from '../../utils/hooks/use-cx';

import type { Border, BorderControlProps } from '../types';
import { maybeWarnDeprecated36pxSize } from '../../utils/deprecated-36px-size';

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

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

const computedSize =
size === 'default' && __next40pxDefaultSize ? '__unstable-large' : size;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const Default = Template.bind( {} );
Default.args = {
colors,
label: 'Border',
__next40pxDefaultSize: true,
enableAlpha: true,
enableStyle: true,
shouldSanitizeBorder: true,
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/border-control/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function createProps( customProps ) {
props.value = newValue;
} ),
value: defaultBorder,
__next40pxDefaultSize: true,
...customProps,
};
return props;
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/utils/deprecated-36px-size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export function maybeWarnDeprecated36pxSize( {
}

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