Skip to content

Commit

Permalink
BorderBoxControl: Suppress redundant warnings for deprecated 36px size (
Browse files Browse the repository at this point in the history
WordPress#67213)

* BorderControl: Add support for warning suppression

* BorderBoxControl: Suppress redundant warnings for deprecated 36px size

* Add changelog

Co-authored-by: mirka <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored Nov 25, 2024
1 parent 2215a04 commit 98b3ec0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- `SlotFill`: fix dependencies of `Fill` registration effects ([#67071](https://github.com/WordPress/gutenberg/pull/67071)).
- `SlotFill`: rewrite the `Slot` component from class component to functional ([#67153](https://github.com/WordPress/gutenberg/pull/67153)).
- `Menu.ItemHelpText`: Fix text wrapping to prevent unintended word breaks ([#67011](https://github.com/WordPress/gutenberg/pull/67011)).
- `BorderBoxControl`: Suppress redundant warnings for deprecated 36px size ([#67213](https://github.com/WordPress/gutenberg/pull/67213)).

## 28.12.0 (2024-11-16)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const BorderBoxControlSplitControls = (
isCompact: true,
__experimentalIsRenderedInSidebar,
size,
__shouldNotWarnDeprecated36pxSize: true,
};

const mergedRef = useMergeRefs( [ setPopoverAnchor, forwardedRef ] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const UnconnectedBorderBoxControl = (
__experimentalIsRenderedInSidebar={
__experimentalIsRenderedInSidebar
}
__shouldNotWarnDeprecated36pxSize
size={ size }
/>
) : (
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/border-control/border-control/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ export function useBorderControl(
width,
__experimentalIsRenderedInSidebar = false,
__next40pxDefaultSize,
__shouldNotWarnDeprecated36pxSize,
...otherProps
} = useContextSystem( props, 'BorderControl' );

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

const computedSize =
Expand Down
7 changes: 7 additions & 0 deletions packages/components/src/border-control/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ export type BorderControlProps = ColorProps &
* @default false
*/
__next40pxDefaultSize?: boolean;
/**
* Do not throw a warning for the deprecated 36px default size.
* For internal components of other components that already throw the warning.
*
* @ignore
*/
__shouldNotWarnDeprecated36pxSize?: boolean;
};

export type DropdownProps = ColorProps &
Expand Down

0 comments on commit 98b3ec0

Please sign in to comment.