From 91f4c40d58c2407a3a4ef3179097b8f506948916 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 22 Nov 2024 07:44:00 +0900 Subject: [PATCH 1/3] BorderControl: Add support for warning suppression --- .../components/src/border-control/border-control/hook.ts | 2 ++ packages/components/src/border-control/types.ts | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/packages/components/src/border-control/border-control/hook.ts b/packages/components/src/border-control/border-control/hook.ts index 67af7ce42416c..9b0f064c51921 100644 --- a/packages/components/src/border-control/border-control/hook.ts +++ b/packages/components/src/border-control/border-control/hook.ts @@ -38,6 +38,7 @@ export function useBorderControl( width, __experimentalIsRenderedInSidebar = false, __next40pxDefaultSize, + __shouldNotWarnDeprecated36pxSize, ...otherProps } = useContextSystem( props, 'BorderControl' ); @@ -45,6 +46,7 @@ export function useBorderControl( componentName: 'BorderControl', __next40pxDefaultSize, size, + __shouldNotWarnDeprecated36pxSize, } ); const computedSize = diff --git a/packages/components/src/border-control/types.ts b/packages/components/src/border-control/types.ts index 8ab614907684d..ecd3f67c9be08 100644 --- a/packages/components/src/border-control/types.ts +++ b/packages/components/src/border-control/types.ts @@ -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 & From 0a739ba223cdeed760a7a07730d606375dac9945 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 22 Nov 2024 07:44:38 +0900 Subject: [PATCH 2/3] BorderBoxControl: Suppress redundant warnings for deprecated 36px size --- .../border-box-control-split-controls/component.tsx | 1 + .../src/border-box-control/border-box-control/component.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/components/src/border-box-control/border-box-control-split-controls/component.tsx b/packages/components/src/border-box-control/border-box-control-split-controls/component.tsx index 8f125cdb8f926..0c887ab5f701c 100644 --- a/packages/components/src/border-box-control/border-box-control-split-controls/component.tsx +++ b/packages/components/src/border-box-control/border-box-control-split-controls/component.tsx @@ -67,6 +67,7 @@ const BorderBoxControlSplitControls = ( isCompact: true, __experimentalIsRenderedInSidebar, size, + __shouldNotWarnDeprecated36pxSize: true, }; const mergedRef = useMergeRefs( [ setPopoverAnchor, forwardedRef ] ); diff --git a/packages/components/src/border-box-control/border-box-control/component.tsx b/packages/components/src/border-box-control/border-box-control/component.tsx index d2d77adc69eb8..0e84c7b56ee48 100644 --- a/packages/components/src/border-box-control/border-box-control/component.tsx +++ b/packages/components/src/border-box-control/border-box-control/component.tsx @@ -118,6 +118,7 @@ const UnconnectedBorderBoxControl = ( __experimentalIsRenderedInSidebar={ __experimentalIsRenderedInSidebar } + __shouldNotWarnDeprecated36pxSize size={ size } /> ) : ( From 55c679fd2f905c402255519b11492525a62e8661 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 22 Nov 2024 07:53:24 +0900 Subject: [PATCH 3/3] Add changelog --- packages/components/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index d7741f4caa988..04453e4a3d2c8 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -36,6 +36,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)