From 1b46f4595dc7acebf5027cff0237be4742be0d93 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Thu, 15 Feb 2024 19:13:49 +0900 Subject: [PATCH 1/3] ColorPicker: Use internal API for borderless select --- .../components/src/color-picker/component.tsx | 33 ++++++++++++------- .../components/src/color-picker/styles.ts | 13 +------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/components/src/color-picker/component.tsx b/packages/components/src/color-picker/component.tsx index 5f6d0754c93ccc..98e37df9783c55 100644 --- a/packages/components/src/color-picker/component.tsx +++ b/packages/components/src/color-picker/component.tsx @@ -16,7 +16,11 @@ import { __ } from '@wordpress/i18n'; /** * Internal dependencies */ -import { useContextSystem, contextConnect } from '../context'; +import { + useContextSystem, + contextConnect, + ContextSystemProvider, +} from '../context'; import { ColorfulWrapper, SelectControl, @@ -39,6 +43,9 @@ const options = [ { label: 'Hex', value: 'hex' as const }, ]; +// `isBorderless` is still experimental and not a public prop for InputControl yet. +const BORDERLESS_SELECT_CONTROL_CONTEXT = { InputBase: { isBorderless: true } }; + const UnconnectedColorPicker = ( props: ColorPickerProps, forwardedRef: ForwardedRef< any > @@ -107,16 +114,20 @@ const UnconnectedColorPicker = ( /> - - setColorType( nextColorType as ColorType ) - } - label={ __( 'Color format' ) } - hideLabelFromVision - /> + + + setColorType( nextColorType as ColorType ) + } + label={ __( 'Color format' ) } + hideLabelFromVision + /> + Date: Thu, 15 Feb 2024 19:21:59 +0900 Subject: [PATCH 2/3] Set width without touching internals --- packages/components/src/color-picker/styles.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/components/src/color-picker/styles.ts b/packages/components/src/color-picker/styles.ts index 997b9ca83fbd3c..ecc75f5157625b 100644 --- a/packages/components/src/color-picker/styles.ts +++ b/packages/components/src/color-picker/styles.ts @@ -14,13 +14,10 @@ import { boxSizingReset } from '../utils'; import Button from '../button'; import { Flex } from '../flex'; import { HStack } from '../h-stack'; -import { Container as InputControlContainer } from '../input-control/styles/input-control-styles'; import CONFIG from '../utils/config-values'; export const NumberControlWrapper = styled( NumberControl )` - ${ InputControlContainer } { - width: ${ space( 24 ) }; - } + width: ${ space( 24 ) }; `; export const SelectControl = styled( InnerSelectControl )` From 1938b339a6a6513ce3c2b125c9b7511fa37b61a6 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Thu, 15 Feb 2024 19:42:12 +0900 Subject: [PATCH 3/3] Update changelog --- packages/components/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 9edf124bbdf73c..85be50e8f7642c 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -6,6 +6,10 @@ - `CustomSelectControl`: Remove deprecated `__nextUnconstrainedWidth` prop and promote to default behavior ([#58974](https://github.com/WordPress/gutenberg/pull/58974)). +### Internal + +- `ColorPicker`: Style without accessing internal `InputControl` classes ([#59069](https://github.com/WordPress/gutenberg/pull/59069)). + ## 26.0.1 (2024-02-13) ### Bug Fix