From de477936e7f1327e3d6c6f89463e612ce949a1a6 Mon Sep 17 00:00:00 2001 From: PARTHVATALIYA Date: Mon, 11 Nov 2024 11:07:03 +0530 Subject: [PATCH 1/8] Add the changelog for the deprecation --- packages/components/src/select-control/README.md | 1 + packages/components/src/select-control/index.tsx | 8 ++++++++ .../components/src/select-control/stories/index.story.tsx | 1 + .../components/src/select-control/test/select-control.tsx | 8 +++++++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/components/src/select-control/README.md b/packages/components/src/select-control/README.md index c240243408fab3..1c8966b7559277 100644 --- a/packages/components/src/select-control/README.md +++ b/packages/components/src/select-control/README.md @@ -84,6 +84,7 @@ const MySelectControl = () => { return ( ( const classes = clsx( 'components-select-control', className ); + maybeWarnDeprecated36pxSize( { + componentName: 'SelectControl', + __next40pxDefaultSize, + size: undefined, + } ); + return ( ( * * return ( * = ( props ) => { export const Default = SelectControlWithState.bind( {} ); Default.args = { + __next40pxDefaultSize: true, __nextHasNoMarginBottom: true, label: 'Label', options: [ diff --git a/packages/components/src/select-control/test/select-control.tsx b/packages/components/src/select-control/test/select-control.tsx index 47b684cd20e280..37935d60384b15 100644 --- a/packages/components/src/select-control/test/select-control.tsx +++ b/packages/components/src/select-control/test/select-control.tsx @@ -12,7 +12,13 @@ import _SelectControl from '..'; const SelectControl = ( props: React.ComponentProps< typeof _SelectControl > ) => { - return <_SelectControl { ...props } __nextHasNoMarginBottom />; + return ( + <_SelectControl + { ...props } + __nextHasNoMarginBottom + __next40pxDefaultSize + /> + ); }; describe( 'SelectControl', () => { From df05b7c581a414b89ca33d4090655e3183f026c0 Mon Sep 17 00:00:00 2001 From: PARTHVATALIYA Date: Mon, 11 Nov 2024 11:11:24 +0530 Subject: [PATCH 2/8] Add the changelog for the deprecation --- packages/components/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 93b191bff269d6..ca0e0f1917e3f4 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -24,6 +24,7 @@ - `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)). +- `SelectControl`: Deprecate 36px default size ([#66898](https://github.com/WordPress/gutenberg/pull/66898)). ### Bug Fixes From 7b0b20fdbbcff324399c9eabb7c968a7294efe8c Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Thu, 21 Nov 2024 02:26:42 +0900 Subject: [PATCH 3/8] Move changelog --- packages/components/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 1a9cb51e1c7e5f..d3d5008952e020 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -11,6 +11,7 @@ - `DimensionControl`: Deprecate 36px default size ([#66705](https://github.com/WordPress/gutenberg/pull/66705)). - `TextControl`: Deprecate 36px default size ([#66745](https://github.com/WordPress/gutenberg/pull/66745). - `FontSizePicker`: Deprecate 36px default size ([#66920](https://github.com/WordPress/gutenberg/pull/66920)). +- `SelectControl`: Deprecate 36px default size ([#66898](https://github.com/WordPress/gutenberg/pull/66898)). - `ComboboxControl`: Deprecate 36px default size ([#66900](https://github.com/WordPress/gutenberg/pull/66900)). ### Bug Fixes @@ -64,7 +65,6 @@ - `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)). -- `SelectControl`: Deprecate 36px default size ([#66898](https://github.com/WordPress/gutenberg/pull/66898)). ### Bug Fixes From 70b67696b42fb6cae394ab3ac4e913d8145b8526 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Thu, 21 Nov 2024 07:51:59 +0900 Subject: [PATCH 4/8] Suppress warning on internal usage --- packages/components/src/dimension-control/index.tsx | 1 + packages/components/src/input-control/types.ts | 7 +++++++ packages/components/src/select-control/index.tsx | 2 ++ packages/components/src/select-control/types.ts | 1 + packages/components/src/tree-select/index.tsx | 1 + 5 files changed, 12 insertions(+) diff --git a/packages/components/src/dimension-control/index.tsx b/packages/components/src/dimension-control/index.tsx index 2cc39379ebde0c..ffdfaeb84ee51d 100644 --- a/packages/components/src/dimension-control/index.tsx +++ b/packages/components/src/dimension-control/index.tsx @@ -113,6 +113,7 @@ export function DimensionControl( props: DimensionControlProps ) { ( variant = 'default', __next40pxDefaultSize = false, __nextHasNoMarginBottom = false, + __shouldNotWarnDeprecated36pxSize, ...restProps } = useDeprecated36pxDefaultSizeProp( props ); const id = useUniqueId( idProp ); @@ -99,6 +100,7 @@ function UnforwardedSelectControl< V extends string >( componentName: 'SelectControl', __next40pxDefaultSize, size: undefined, + __shouldNotWarnDeprecated36pxSize, } ); return ( diff --git a/packages/components/src/select-control/types.ts b/packages/components/src/select-control/types.ts index 4e7211ab9abfb2..3d9f06385c7532 100644 --- a/packages/components/src/select-control/types.ts +++ b/packages/components/src/select-control/types.ts @@ -13,6 +13,7 @@ type SelectControlBaseProps< V extends string > = Pick< InputBaseProps, | '__next36pxDefaultSize' | '__next40pxDefaultSize' + | '__shouldNotWarnDeprecated36pxSize' | 'disabled' | 'hideLabelFromVision' | 'label' diff --git a/packages/components/src/tree-select/index.tsx b/packages/components/src/tree-select/index.tsx index bd92807bff4cc9..075ae1268e3c72 100644 --- a/packages/components/src/tree-select/index.tsx +++ b/packages/components/src/tree-select/index.tsx @@ -102,6 +102,7 @@ export function TreeSelect( props: TreeSelectProps ) { return ( Date: Thu, 21 Nov 2024 10:53:37 +0530 Subject: [PATCH 5/8] Add props to WithCustomChildren and remove size from selectControl --- packages/components/src/select-control/index.tsx | 4 ++-- .../components/src/select-control/stories/index.story.tsx | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/components/src/select-control/index.tsx b/packages/components/src/select-control/index.tsx index d632c1425218b3..e93e9385a9c23b 100644 --- a/packages/components/src/select-control/index.tsx +++ b/packages/components/src/select-control/index.tsx @@ -99,7 +99,7 @@ function UnforwardedSelectControl< V extends string >( maybeWarnDeprecated36pxSize( { componentName: 'SelectControl', __next40pxDefaultSize, - size: undefined, + size, __shouldNotWarnDeprecated36pxSize, } ); @@ -163,7 +163,7 @@ function UnforwardedSelectControl< V extends string >( * * return ( * Date: Thu, 12 Dec 2024 07:26:53 +0900 Subject: [PATCH 6/8] Fix changelog --- packages/components/CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 8df0c49206332b..4676047d584544 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Deprecations + +- `SelectControl`: Deprecate 36px default size ([#66898](https://github.com/WordPress/gutenberg/pull/66898)). + ## 29.0.0 (2024-12-11) ### Breaking Changes @@ -57,7 +61,6 @@ - `DimensionControl`: Deprecate 36px default size ([#66705](https://github.com/WordPress/gutenberg/pull/66705)). - `TextControl`: Deprecate 36px default size ([#66745](https://github.com/WordPress/gutenberg/pull/66745). - `FontSizePicker`: Deprecate 36px default size ([#66920](https://github.com/WordPress/gutenberg/pull/66920)). -- `SelectControl`: Deprecate 36px default size ([#66898](https://github.com/WordPress/gutenberg/pull/66898)). - `ComboboxControl`: Deprecate 36px default size ([#66900](https://github.com/WordPress/gutenberg/pull/66900)). - `ToggleGroupControl`: Deprecate 36px default size ([#66747](https://github.com/WordPress/gutenberg/pull/66747)). - `RangeControl`: Deprecate 36px default size ([#66721](https://github.com/WordPress/gutenberg/pull/66721)). From 8454f73f9c4e431497c2771d88de4c8e662921fe Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Thu, 12 Dec 2024 07:32:27 +0900 Subject: [PATCH 7/8] Update in Disabled story --- packages/components/src/disabled/stories/index.story.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/src/disabled/stories/index.story.tsx b/packages/components/src/disabled/stories/index.story.tsx index f017305507814e..591118681a82de 100644 --- a/packages/components/src/disabled/stories/index.story.tsx +++ b/packages/components/src/disabled/stories/index.story.tsx @@ -55,6 +55,7 @@ const Form = () => { /> {} } options={ [ From b33610c83ff5a842168f661ee4355c3fc88e39d1 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Thu, 12 Dec 2024 07:36:23 +0900 Subject: [PATCH 8/8] Add prop to rest of readme snippets --- packages/components/src/select-control/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/components/src/select-control/README.md b/packages/components/src/select-control/README.md index 1c8966b7559277..d8742fce74f54e 100644 --- a/packages/components/src/select-control/README.md +++ b/packages/components/src/select-control/README.md @@ -84,7 +84,6 @@ const MySelectControl = () => { return ( { { label: 'Small', value: '25%' }, ] } onChange={ ( newSize ) => setSize( newSize ) } + __next40pxDefaultSize __nextHasNoMarginBottom /> ); @@ -115,6 +115,7 @@ Render a user interface to select multiple users from a list. { value: 'b', label: 'User B' }, { value: 'c', label: 'User c' }, ] } + __next40pxDefaultSize __nextHasNoMarginBottom /> ``` @@ -130,6 +131,7 @@ const [ item, setItem ] = useState( '' ); label={ __( 'My dinosaur' ) } value={ item } // e.g: value = 'a' onChange={ ( selection ) => { setItem( selection ) } } + __next40pxDefaultSize __nextHasNoMarginBottom >