/* eslint-disable @woocommerce/dependency-group */ /* eslint-disable @typescript-eslint/ban-ts-comment */ /** * External dependencies */ import clsx from 'clsx'; import { isRTL, __ } from '@wordpress/i18n'; import { chevronRight, chevronLeft } from '@wordpress/icons'; // @ts-ignore No types for this exist yet. import SidebarButton from '@wordpress/edit-site/build-module/components/sidebar-button'; import { // @ts-ignore No types for this exist yet. __experimentalHStack as HStack, // @ts-ignore No types for this exist yet. __experimentalHeading as Heading, // @ts-ignore No types for this exist yet. __experimentalVStack as VStack, } from '@wordpress/components'; import React from 'react'; /** * Internal dependencies */ export type SidebarContainerProps = { title: React.ReactNode; description?: React.ReactNode; footer?: React.ReactNode; children: React.ReactNode; }; export const SidebarContainer = ( { title, description, footer, children, }: SidebarContainerProps ) => { const chevronIcon = isRTL() ? chevronRight : chevronLeft; const hasOnClick = ( el: React.ReactNode ): el is React.ReactElement< { onClick: () => void } > => React.isValidElement( el ) && typeof el.props.onClick === 'function'; return ( <> { title }
{ description && (

{ description }

) } { children }
{ footer && ( ) } ); };