From 9cf642d98a0b7f1b563a940bf27e7bd2ca5f0299 Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Fri, 15 Oct 2021 15:48:11 +0200 Subject: [PATCH 1/5] Update README by adding `hint` as a possible prop for `options` --- packages/components/src/custom-select-control/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/custom-select-control/README.md b/packages/components/src/custom-select-control/README.md index 9cf8943c33210..f714714774441 100644 --- a/packages/components/src/custom-select-control/README.md +++ b/packages/components/src/custom-select-control/README.md @@ -104,7 +104,7 @@ Pass in a description that will be shown to screen readers associated with the s The options that can be chosen from. -- Type: `Array<{ key: String, name: String, style: ?{}, className: ?String, ...rest }>` +- Type: `Array<{ key: String, name: String, style: ?{}, className: ?String, hint: ?String|Number, ...rest }>` - Required: Yes #### onChange From 73eaaa3e60b4bcb2c67edfd743d18e4794d2e33d Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Fri, 15 Oct 2021 15:50:55 +0200 Subject: [PATCH 2/5] CHANGELOG --- packages/components/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index f2750a38ca79e..9a58160b01dfd 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -11,6 +11,7 @@ - Removed the separator shown between `ToggleGroupControl` items ([#35497](https://github.com/WordPress/gutenberg/pull/35497)). - The `ColorPicker` component property `onChangeComplete`, a function accepting a color object, was replaced with the property `onChange`, a function accepting a string on ([#35220](https://github.com/WordPress/gutenberg/pull/35220)). - The property `disableAlpha`, was removed from the `ColorPicker` component. Use the new opposite property `enableAlpha` instead ([#35220](https://github.com/WordPress/gutenberg/pull/35220)). +- Added support for showing a `hint` in `CustomSelectControl` ([#35395](https://github.com/WordPress/gutenberg/pull/35395)). ### Experimental From e4a3ced9c4bbfbe3449a44a955788b2c63aba5dd Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Fri, 15 Oct 2021 16:39:43 +0200 Subject: [PATCH 3/5] Rename `hint` to `__experimentalHint` --- packages/components/src/custom-select-control/index.js | 6 +++--- packages/components/src/font-size-picker/utils.js | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/components/src/custom-select-control/index.js b/packages/components/src/custom-select-control/index.js index 5fa74367aa7d4..90b5bbf2115e2 100644 --- a/packages/components/src/custom-select-control/index.js +++ b/packages/components/src/custom-select-control/index.js @@ -156,16 +156,16 @@ export default function CustomSelectControl( { { 'is-highlighted': index === highlightedIndex, - 'has-hint': !! item.hint, + 'has-hint': !! item.__experimentalHint, } ), style: item.style, } ) } > { item.name } - { item.hint && ( + { item.__experimentalHint && ( - { item.hint } + { item.__experimentalHint } ) } { item === selectedItem && ( diff --git a/packages/components/src/font-size-picker/utils.js b/packages/components/src/font-size-picker/utils.js index 3310257de1ff7..e0f16e0de3464 100644 --- a/packages/components/src/font-size-picker/utils.js +++ b/packages/components/src/font-size-picker/utils.js @@ -74,7 +74,8 @@ function getSelectOptions( optionsArray, disableCustomFontSizes ) { key: slug, name, size, - hint: size && isSimpleCssValue( size ) && parseInt( size ), + __experimentalHint: + size && isSimpleCssValue( size ) && parseInt( size ), } ) ); } From e2e4c6f84d0f29cdfd027dc6dbe81da19167cf00 Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Fri, 15 Oct 2021 16:40:49 +0200 Subject: [PATCH 4/5] Remove `hint` from README, since it is now experimental --- packages/components/src/custom-select-control/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/custom-select-control/README.md b/packages/components/src/custom-select-control/README.md index f714714774441..9cf8943c33210 100644 --- a/packages/components/src/custom-select-control/README.md +++ b/packages/components/src/custom-select-control/README.md @@ -104,7 +104,7 @@ Pass in a description that will be shown to screen readers associated with the s The options that can be chosen from. -- Type: `Array<{ key: String, name: String, style: ?{}, className: ?String, hint: ?String|Number, ...rest }>` +- Type: `Array<{ key: String, name: String, style: ?{}, className: ?String, ...rest }>` - Required: Yes #### onChange From 2022a08b7ecea96bf3e66146cbe293ca88a035f0 Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Fri, 15 Oct 2021 16:41:10 +0200 Subject: [PATCH 5/5] Move changelog entry to `Experimental` category --- 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 9a58160b01dfd..ab6f0365fc103 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -11,12 +11,12 @@ - Removed the separator shown between `ToggleGroupControl` items ([#35497](https://github.com/WordPress/gutenberg/pull/35497)). - The `ColorPicker` component property `onChangeComplete`, a function accepting a color object, was replaced with the property `onChange`, a function accepting a string on ([#35220](https://github.com/WordPress/gutenberg/pull/35220)). - The property `disableAlpha`, was removed from the `ColorPicker` component. Use the new opposite property `enableAlpha` instead ([#35220](https://github.com/WordPress/gutenberg/pull/35220)). -- Added support for showing a `hint` in `CustomSelectControl` ([#35395](https://github.com/WordPress/gutenberg/pull/35395)). ### Experimental - Removed the `fieldset` wrapper from the `FontAppearanceControl` component ([35461](https://github.com/WordPress/gutenberg/pull/35461)). - Refactored the `ToggleGroupControl` component's structure and embedded `ToggleGroupControlButton` directly into `ToggleGroupControlOption` ([#35600](https://github.com/WordPress/gutenberg/pull/35600)). +- Added support for showing an experimental hint in `CustomSelectControl` ([#35673](https://github.com/WordPress/gutenberg/pull/35673)). ### Breaking Changes