From 78722b9e62b13308d8ce39a1a31901bdf70562b4 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Sat, 17 Aug 2024 02:38:24 +0900 Subject: [PATCH] NumberControl: Add lint rule for 40px size prop usage (#64561) Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: ciampo Co-authored-by: tyxla --- .eslintrc.js | 1 + .../src/components/line-height-control/README.md | 7 +++++++ .../src/components/line-height-control/index.js | 3 +++ 3 files changed, 11 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index 42bb0accd72f1..e21f7d6e6d780 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -316,6 +316,7 @@ module.exports = { 'CustomSelectControl', 'DimensionControl', 'FontSizePicker', + 'NumberControl', 'ToggleGroupControl', ].map( ( componentName ) => ( { // Falsy `__next40pxDefaultSize` without a non-default `size` prop. diff --git a/packages/block-editor/src/components/line-height-control/README.md b/packages/block-editor/src/components/line-height-control/README.md index dafad9145022b..89bcc69622367 100644 --- a/packages/block-editor/src/components/line-height-control/README.md +++ b/packages/block-editor/src/components/line-height-control/README.md @@ -36,6 +36,13 @@ The value of the line height. A callback function that handles the application of the line height value. +#### `__next40pxDefaultSize` + +- **Type:** `boolean` +- **Default:** `false` + +Start opting into the larger default height that will become the default size in a future version. + ## Related components Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/provider/README.md) in the components tree. diff --git a/packages/block-editor/src/components/line-height-control/index.js b/packages/block-editor/src/components/line-height-control/index.js index d605aea3d2ef1..b2c99c03f8784 100644 --- a/packages/block-editor/src/components/line-height-control/index.js +++ b/packages/block-editor/src/components/line-height-control/index.js @@ -16,6 +16,8 @@ import { } from './utils'; const LineHeightControl = ( { + /** Start opting into the larger default height that will become the default size in a future version. */ + __next40pxDefaultSize = false, value: lineHeight, onChange, __unstableInputWidth = '60px', @@ -91,6 +93,7 @@ const LineHeightControl = ( {