diff --git a/packages/dataviews/CHANGELOG.md b/packages/dataviews/CHANGELOG.md index 36c5e7d2f13f6a..44861f027eec48 100644 --- a/packages/dataviews/CHANGELOG.md +++ b/packages/dataviews/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Enhancements + +- DataForm: update spacing for regular and card layouts. [#72249](https://github.com/WordPress/gutenberg/pull/72249). + ## 10.1.0 (2025-10-21) ### Enhancements diff --git a/packages/dataviews/src/dataform-layouts/index.tsx b/packages/dataviews/src/dataform-layouts/index.tsx index 1f49d2f61d7f32..6974d4952554d1 100644 --- a/packages/dataviews/src/dataform-layouts/index.tsx +++ b/packages/dataviews/src/dataform-layouts/index.tsx @@ -19,17 +19,8 @@ const FORM_FIELD_LAYOUTS = [ { type: 'regular', component: FormRegularField, - wrapper: ( { - children, - layout, - }: { - children: React.ReactNode; - layout: Layout; - } ) => ( - + wrapper: ( { children }: { children: React.ReactNode } ) => ( + { children } ), @@ -46,17 +37,8 @@ const FORM_FIELD_LAYOUTS = [ { type: 'card', component: FormCardField, - wrapper: ( { - children, - layout, - }: { - children: React.ReactNode; - layout: Layout; - } ) => ( - + wrapper: ( { children }: { children: React.ReactNode } ) => ( + { children } ), diff --git a/packages/dataviews/src/dataform-layouts/normalize-form-fields.ts b/packages/dataviews/src/dataform-layouts/normalize-form-fields.ts index 7749165d3fade9..a874fb2a00d4ec 100644 --- a/packages/dataviews/src/dataform-layouts/normalize-form-fields.ts +++ b/packages/dataviews/src/dataform-layouts/normalize-form-fields.ts @@ -21,7 +21,7 @@ interface NormalizedFormField { export const DEFAULT_LAYOUT: NormalizedLayout = { type: 'regular', labelPosition: 'top', -}; +} as NormalizedRegularLayout; const normalizeCardSummaryField = ( sum: CardSummaryField diff --git a/packages/dataviews/src/stories/dataform.story.tsx b/packages/dataviews/src/stories/dataform.story.tsx index 9cf27f309bc15a..1be8ad4efa70d0 100644 --- a/packages/dataviews/src/stories/dataform.story.tsx +++ b/packages/dataviews/src/stories/dataform.story.tsx @@ -1799,6 +1799,7 @@ const LayoutMixedComponent = () => { } ); const form: Form = { + layout: { type: 'card' }, fields: [ { id: 'title-and-status', diff --git a/packages/dataviews/src/test/normalize-form-fields.ts b/packages/dataviews/src/test/normalize-form-fields.ts index 90cd810ffc0643..889f7d06a250e3 100644 --- a/packages/dataviews/src/test/normalize-form-fields.ts +++ b/packages/dataviews/src/test/normalize-form-fields.ts @@ -28,11 +28,17 @@ describe( 'normalizeFormFields', () => { expect( result ).toEqual( [ { id: 'field1', - layout: { type: 'regular', labelPosition: 'top' }, + layout: { + type: 'regular', + labelPosition: 'top', + }, }, { id: 'field2', - layout: { type: 'regular', labelPosition: 'top' }, + layout: { + type: 'regular', + labelPosition: 'top', + }, }, ] ); } ); @@ -51,12 +57,18 @@ describe( 'normalizeFormFields', () => { expect( result ).toEqual( [ { id: 'field1', - layout: { type: 'regular', labelPosition: 'top' }, + layout: { + type: 'regular', + labelPosition: 'top', + }, }, { id: 'field2', label: 'Field 2', - layout: { type: 'regular', labelPosition: 'top' }, + layout: { + type: 'regular', + labelPosition: 'top', + }, }, ] ); } ); @@ -72,7 +84,10 @@ describe( 'normalizeFormFields', () => { expect( result ).toEqual( [ { id: 'field1', - layout: { type: 'regular', labelPosition: 'top' }, + layout: { + type: 'regular', + labelPosition: 'top', + }, }, ] ); } ); @@ -86,7 +101,10 @@ describe( 'normalizeFormFields', () => { expect( result ).toEqual( [ { id: 'field1', - layout: { type: 'regular', labelPosition: 'side' }, + layout: { + type: 'regular', + labelPosition: 'side', + }, }, ] ); } ); @@ -245,7 +263,10 @@ describe( 'normalizeFormFields', () => { expect( result ).toEqual( [ { id: 'field1', - layout: { type: 'regular', labelPosition: 'top' }, + layout: { + type: 'regular', + labelPosition: 'top', + }, }, { id: 'field2',