/** * WordPress dependencies */ import { __experimentalHeading as Heading } from '@wordpress/components'; import { Stack } from '@wordpress/ui'; /** * Internal dependencies */ import type { FieldLayoutProps, NormalizedForm, NormalizedLayout, NormalizedRowLayout, } from '../../../types'; import { DataFormLayout } from '../data-form-layout'; import { DEFAULT_LAYOUT } from '../normalize-form'; import { getFormFieldLayout } from '..'; function Header( { title }: { title: string } ) { return ( { title } ); } const EMPTY_WRAPPER = ( { children }: { children: React.ReactNode } ) => ( <>{ children } ); export default function FormRowField< Item >( { data, field, onChange, hideLabelFromVision, markWhenOptional, validity, }: FieldLayoutProps< Item > ) { const layout = field.layout as NormalizedRowLayout; if ( !! field.children ) { const form: NormalizedForm = { layout: DEFAULT_LAYOUT as NormalizedLayout, fields: field.children, }; return (
{ ! hideLabelFromVision && field.label && (
) } { ( FieldLayout, childField, childFieldValidity ) => (
) }
); } const RegularLayout = getFormFieldLayout( 'regular' )?.component; if ( ! RegularLayout ) { return null; } return ( <>
); }