From 795e9c2dd07caa6d915ddb46e981987544663329 Mon Sep 17 00:00:00 2001
From: VATALIYA PARTH <88878890+PARTHVATALIYA@users.noreply.github.com>
Date: Thu, 12 Dec 2024 05:28:48 +0530
Subject: [PATCH] InputControl : Deprecate 36px default size (#66897)
* Add the console warning for 36px size variation
* Add the changelog for the deprecation
* Fix changelog
* Suppress warnings when redundant
* Fix Password story
* Add size prop to usage in PaletteEdit
* Update usage in other component stories
---------
Co-authored-by: PARTHVATALIYA
Co-authored-by: mirka <0mirka00@git.wordpress.org>
---
packages/components/CHANGELOG.md | 1 +
packages/components/src/input-control/README.md | 1 +
packages/components/src/input-control/index.tsx | 10 ++++++++++
.../src/input-control/stories/index.story.tsx | 7 ++++++-
packages/components/src/input-control/test/index.js | 12 +++++++++---
.../components/src/modal/stories/index.story.tsx | 5 ++++-
packages/components/src/number-control/index.tsx | 1 +
packages/components/src/palette-edit/index.tsx | 1 +
.../components/src/panel/stories/index.story.tsx | 6 +++---
.../components/src/tree-grid/stories/index.story.tsx | 2 ++
10 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 4676047d584544..5c8643dc08cf6c 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -5,6 +5,7 @@
### Deprecations
- `SelectControl`: Deprecate 36px default size ([#66898](https://github.com/WordPress/gutenberg/pull/66898)).
+- `InputControl`: Deprecate 36px default size ([#66897](https://github.com/WordPress/gutenberg/pull/66897)).
## 29.0.0 (2024-12-11)
diff --git a/packages/components/src/input-control/README.md b/packages/components/src/input-control/README.md
index 58a3b4a3b1a094..ff5c70decebeb7 100644
--- a/packages/components/src/input-control/README.md
+++ b/packages/components/src/input-control/README.md
@@ -17,6 +17,7 @@ const Example = () => {
return (
setValue( nextValue ?? '' ) }
/>
diff --git a/packages/components/src/input-control/index.tsx b/packages/components/src/input-control/index.tsx
index fd0fc0a5c45536..d346d1b31b1118 100644
--- a/packages/components/src/input-control/index.tsx
+++ b/packages/components/src/input-control/index.tsx
@@ -20,6 +20,7 @@ import { space } from '../utils/space';
import { useDraft } from './utils';
import BaseControl from '../base-control';
import { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';
+import { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';
const noop = () => {};
@@ -36,6 +37,7 @@ export function UnforwardedInputControl(
) {
const {
__next40pxDefaultSize,
+ __shouldNotWarnDeprecated36pxSize,
__unstableStateReducer: stateReducer = ( state ) => state,
__unstableInputWidth,
className,
@@ -68,6 +70,13 @@ export function UnforwardedInputControl(
const helpProp = !! help ? { 'aria-describedby': `${ id }__help` } : {};
+ maybeWarnDeprecated36pxSize( {
+ componentName: 'InputControl',
+ __next40pxDefaultSize,
+ size,
+ __shouldNotWarnDeprecated36pxSize,
+ } );
+
return (
setValue( nextValue ?? '' ) }
* />
diff --git a/packages/components/src/input-control/stories/index.story.tsx b/packages/components/src/input-control/stories/index.story.tsx
index 136301c42e7d09..40630938dbb370 100644
--- a/packages/components/src/input-control/stories/index.story.tsx
+++ b/packages/components/src/input-control/stories/index.story.tsx
@@ -46,6 +46,7 @@ export const Default = Template.bind( {} );
Default.args = {
label: 'Value',
placeholder: 'Placeholder',
+ __next40pxDefaultSize: true,
};
export const WithHelpText = Template.bind( {} );
@@ -117,7 +118,6 @@ export const ShowPassword: StoryFn< typeof InputControl > = ( args ) => {
return (
-
+