From bd7e9c2ab0c41269e22b4eb4cd2b2afe3fe84e66 Mon Sep 17 00:00:00 2001
From: VATALIYA PARTH <88878890+PARTHVATALIYA@users.noreply.github.com>
Date: Thu, 12 Dec 2024 04:42:20 +0530
Subject: [PATCH 1/2] SelectControl : Deprecate 36px default size (#66898)
* Add the changelog for the deprecation
* Add the changelog for the deprecation
* Move changelog
* Suppress warning on internal usage
* Add props to WithCustomChildren and remove size from selectControl
* Fix changelog
* Update in Disabled story
* Add prop to rest of readme snippets
---------
Co-authored-by: PARTHVATALIYA
Co-authored-by: mirka <0mirka00@git.wordpress.org>
---
packages/components/CHANGELOG.md | 4 ++++
packages/components/src/dimension-control/index.tsx | 1 +
.../components/src/disabled/stories/index.story.tsx | 1 +
packages/components/src/input-control/types.ts | 7 +++++++
packages/components/src/select-control/README.md | 3 +++
packages/components/src/select-control/index.tsx | 10 ++++++++++
.../src/select-control/stories/index.story.tsx | 2 ++
.../src/select-control/test/select-control.tsx | 8 +++++++-
packages/components/src/select-control/types.ts | 1 +
packages/components/src/tree-select/index.tsx | 1 +
10 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index c9f63514c8a60..4676047d58454 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
diff --git a/packages/components/src/dimension-control/index.tsx b/packages/components/src/dimension-control/index.tsx
index 2cc39379ebde0..ffdfaeb84ee51 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 ) {
{
/>
{} }
options={ [
diff --git a/packages/components/src/input-control/types.ts b/packages/components/src/input-control/types.ts
index 13f078cd89cc1..99c5b1aea92c3 100644
--- a/packages/components/src/input-control/types.ts
+++ b/packages/components/src/input-control/types.ts
@@ -40,6 +40,13 @@ interface BaseProps {
* @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;
__unstableInputWidth?: CSSProperties[ 'width' ];
/**
* If true, the label will only be visible to screen readers.
diff --git a/packages/components/src/select-control/README.md b/packages/components/src/select-control/README.md
index c240243408fab..d8742fce74f54 100644
--- a/packages/components/src/select-control/README.md
+++ b/packages/components/src/select-control/README.md
@@ -92,6 +92,7 @@ const MySelectControl = () => {
{ label: 'Small', value: '25%' },
] }
onChange={ ( newSize ) => setSize( newSize ) }
+ __next40pxDefaultSize
__nextHasNoMarginBottom
/>
);
@@ -114,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
/>
```
@@ -129,6 +131,7 @@ const [ item, setItem ] = useState( '' );
label={ __( 'My dinosaur' ) }
value={ item } // e.g: value = 'a'
onChange={ ( selection ) => { setItem( selection ) } }
+ __next40pxDefaultSize
__nextHasNoMarginBottom
>
-
+