Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/dataviews/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

### Enhancements

- DataForm: update spacing for regular and card layouts. [#72249](https://github.com/WordPress/gutenberg/pull/72249).

## 10.1.0 (2025-10-21)

### Enhancements

- Dataviews: Use text based buttons for actions instead of text. [#72417](https://github.com/WordPress/gutenberg/pull/72417)

## 10.0.0 (2025-10-17)
Expand Down
26 changes: 4 additions & 22 deletions packages/dataviews/src/dataform-layouts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,8 @@ const FORM_FIELD_LAYOUTS = [
{
type: 'regular',
component: FormRegularField,
wrapper: ( {
children,
layout,
}: {
children: React.ReactNode;
layout: Layout;
} ) => (
<VStack
className="dataforms-layouts__wrapper"
spacing={ ( layout as any )?.spacing ?? 4 }
>
wrapper: ( { children }: { children: React.ReactNode } ) => (
<VStack className="dataforms-layouts__wrapper" spacing={ 4 }>
{ children }
</VStack>
),
Expand All @@ -46,17 +37,8 @@ const FORM_FIELD_LAYOUTS = [
{
type: 'card',
component: FormCardField,
wrapper: ( {
children,
layout,
}: {
children: React.ReactNode;
layout: Layout;
} ) => (
<VStack
className="dataforms-layouts__wrapper"
spacing={ ( layout as any )?.spacing ?? 6 }
>
wrapper: ( { children }: { children: React.ReactNode } ) => (
<VStack className="dataforms-layouts__wrapper" spacing={ 6 }>
{ children }
</VStack>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface NormalizedFormField {
export const DEFAULT_LAYOUT: NormalizedLayout = {
type: 'regular',
labelPosition: 'top',
};
} as NormalizedRegularLayout;

const normalizeCardSummaryField = (
sum: CardSummaryField
Expand Down
1 change: 1 addition & 0 deletions packages/dataviews/src/stories/dataform.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,7 @@ const LayoutMixedComponent = () => {
} );

const form: Form = {
layout: { type: 'card' },
fields: [
{
id: 'title-and-status',
Expand Down
35 changes: 28 additions & 7 deletions packages/dataviews/src/test/normalize-form-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
] );
} );
Expand All @@ -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',
},
},
] );
} );
Expand All @@ -72,7 +84,10 @@ describe( 'normalizeFormFields', () => {
expect( result ).toEqual( [
{
id: 'field1',
layout: { type: 'regular', labelPosition: 'top' },
layout: {
type: 'regular',
labelPosition: 'top',
},
},
] );
} );
Expand All @@ -86,7 +101,10 @@ describe( 'normalizeFormFields', () => {
expect( result ).toEqual( [
{
id: 'field1',
layout: { type: 'regular', labelPosition: 'side' },
layout: {
type: 'regular',
labelPosition: 'side',
},
},
] );
} );
Expand Down Expand Up @@ -245,7 +263,10 @@ describe( 'normalizeFormFields', () => {
expect( result ).toEqual( [
{
id: 'field1',
layout: { type: 'regular', labelPosition: 'top' },
layout: {
type: 'regular',
labelPosition: 'top',
},
},
{
id: 'field2',
Expand Down
Loading