From 1716061157f5aa1eb1709877bd2a0ae09b0ae4a2 Mon Sep 17 00:00:00 2001 From: Andrew Hayward Date: Wed, 11 Oct 2023 12:58:43 +0100 Subject: [PATCH 1/2] Migrating `AddCustomTemplateModalContent` - Removes `__unstableComposite` imports from `@wordpress/components` - Adds private `Composite*` exports from `@wordpress/components` - Refactors `SuggestionList` and `SuggestionListItem` to use updated `Composite` components --- .../add-custom-template-modal-content.js | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/packages/edit-site/src/components/add-new-template/add-custom-template-modal-content.js b/packages/edit-site/src/components/add-new-template/add-custom-template-modal-content.js index 80a20939dec251..9f97c911a7de05 100644 --- a/packages/edit-site/src/components/add-new-template/add-custom-template-modal-content.js +++ b/packages/edit-site/src/components/add-new-template/add-custom-template-modal-content.js @@ -9,11 +9,9 @@ import { FlexItem, SearchControl, TextHighlight, + privateApis as componentsPrivateApis, __experimentalText as Text, __experimentalVStack as VStack, - __unstableComposite as Composite, - __unstableUseCompositeState as useCompositeState, - __unstableCompositeItem as CompositeItem, } from '@wordpress/components'; import { useEntityRecords } from '@wordpress/core-data'; import { decodeEntities } from '@wordpress/html-entities'; @@ -21,9 +19,16 @@ import { decodeEntities } from '@wordpress/html-entities'; /** * Internal dependencies */ +import { unlock } from '../../lock-unlock'; import useDebouncedInput from '../../utils/use-debounced-input'; import { mapToIHasNameAndId } from './utils'; +const { + CompositeV2: Composite, + CompositeItemV2: CompositeItem, + useCompositeStoreV2: useCompositeStore, +} = unlock( componentsPrivateApis ); + const EMPTY_ARRAY = []; function SuggestionListItem( { @@ -31,22 +36,24 @@ function SuggestionListItem( { search, onSelect, entityForSuggestions, - composite, } ) { const baseCssClass = 'edit-site-custom-template-modal__suggestions_list__list-item'; return ( - onSelect( - entityForSuggestions.config.getSpecificTemplate( - suggestion - ) - ) + render={ +