Skip to content

Commit

Permalink
Make Composite components unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Jan 12, 2021
1 parent aea467d commit ed22350
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
* WordPress dependencies
*/
import { getBlockMenuDefaultClassName } from '@wordpress/blocks';
import { Composite, useCompositeState } from '@wordpress/components';
import {
__unstableComposite as Composite,
__unstableUseCompositeState as useCompositeState,
} from '@wordpress/components';

/**
* Internal dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import classnames from 'classnames';
* WordPress dependencies
*/
import { useMemo, useRef, memo } from '@wordpress/element';
import { Button, CompositeItem } from '@wordpress/components';
import {
Button,
__unstableCompositeItem as CompositeItem,
} from '@wordpress/components';
import {
createBlock,
createBlocksFromInnerBlocksTemplate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import { ENTER, SPACE } from '@wordpress/keycodes';
import { __, sprintf } from '@wordpress/i18n';
import { BlockPreview } from '@wordpress/block-editor';
import {
Composite,
CompositeItem,
__unstableComposite as Composite,
__unstableCompositeItem as CompositeItem,
Icon,
useCompositeState,
__unstableUseCompositeState as useCompositeState,
} from '@wordpress/components';
import { useAsyncList } from '@wordpress/compose';
import { store as noticesStore } from '@wordpress/notices';
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/composite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* a roving tabindex or aria-activedescendant container.
*
* @see https://reakit.io/docs/composite/
*
* The plan is to build own API that accounts for future breaking changes
* in Reakit (https://github.com/WordPress/gutenberg/pull/28085).
*/
export {
Composite,
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/disclosure/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
* content. It follows the WAI-ARIA Disclosure Pattern.
*
* @see https://reakit.io/docs/disclosure/
*
* The plan is to build own API that accounts for future breaking changes
* in Reakit (https://github.com/WordPress/gutenberg/pull/28085).
*/
export { DisclosureContent } from 'reakit';
7 changes: 6 additions & 1 deletion packages/components/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ export { default as ColorIndicator } from './color-indicator';
export { default as ColorPalette } from './color-palette';
export { default as ColorPicker } from './color-picker';
export { default as ComboboxControl } from './combobox-control';
export * from './composite';
export {
Composite as __unstableComposite,
CompositeGroup as __unstableCompositeGroup,
CompositeItem as __unstableCompositeItem,
useCompositeState as __unstableUseCompositeState,
} from './composite';
export { default as CustomSelectControl } from './custom-select-control';
export { default as Dashicon } from './dashicon';
export { default as DateTimePicker, DatePicker, TimePicker } from './date-time';
Expand Down
6 changes: 3 additions & 3 deletions packages/edit-widgets/src/blocks/widget-area/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useEffect, useState, useCallback, useRef } from '@wordpress/element';
import { useSelect, useDispatch } from '@wordpress/data';
import { EntityProvider } from '@wordpress/core-data';
import {
__unstableDisclosureContent,
__unstableDisclosureContent as DisclosureContent,
Panel,
PanelBody,
} from '@wordpress/components';
Expand Down Expand Up @@ -66,15 +66,15 @@ export default function WidgetAreaEdit( {
{ ( { opened } ) => (
// This is required to ensure LegacyWidget blocks are not unmounted when the panel is collapsed.
// Unmounting legacy widgets may have unintended consequences (e.g. TinyMCE not being properly reinitialized)
<__unstableDisclosureContent visible={ opened }>
<DisclosureContent visible={ opened }>
<EntityProvider
kind="root"
type="postType"
id={ `widget-area-${ id }` }
>
<WidgetAreaInnerBlocks />
</EntityProvider>
</__unstableDisclosureContent>
</DisclosureContent>
) }
</PanelBody>
</Panel>
Expand Down

0 comments on commit ed22350

Please sign in to comment.