From 8e7ab96506f7e7d6f9b7d842f6e237c859f5974a Mon Sep 17 00:00:00 2001 From: Mikael Korpela Date: Tue, 18 Nov 2025 22:24:02 +0200 Subject: [PATCH 1/2] Forms: add examples for first/last name field variations --- .../update-form-name-variations-example | 4 +++ .../forms/src/blocks/field-name/variations.js | 32 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 projects/packages/forms/changelog/update-form-name-variations-example diff --git a/projects/packages/forms/changelog/update-form-name-variations-example b/projects/packages/forms/changelog/update-form-name-variations-example new file mode 100644 index 0000000000000..c86a3ed0e7172 --- /dev/null +++ b/projects/packages/forms/changelog/update-form-name-variations-example @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +Forms: add examples for first/last name field variations diff --git a/projects/packages/forms/src/blocks/field-name/variations.js b/projects/packages/forms/src/blocks/field-name/variations.js index 7065ae3ee32ff..099be00b693e7 100644 --- a/projects/packages/forms/src/blocks/field-name/variations.js +++ b/projects/packages/forms/src/blocks/field-name/variations.js @@ -46,6 +46,22 @@ const variations = [ [ 'jetpack/label', { label: DEFAULT_FIRST_NAME_LABEL } ], [ 'jetpack/input', { type: 'text' } ], ], + example: { + innerBlocks: [ + { + name: 'jetpack/label', + attributes: { + label: DEFAULT_FIRST_NAME_LABEL, + }, + }, + { + name: 'jetpack/input', + attributes: { + type: 'text', + }, + }, + ], + }, }, { name: LAST_NAME_ID, @@ -61,6 +77,22 @@ const variations = [ [ 'jetpack/label', { label: DEFAULT_LAST_NAME_LABEL } ], [ 'jetpack/input', { type: 'text' } ], ], + example: { + innerBlocks: [ + { + name: 'jetpack/label', + attributes: { + label: DEFAULT_LAST_NAME_LABEL, + }, + }, + { + name: 'jetpack/input', + attributes: { + type: 'text', + }, + }, + ], + }, }, ]; From 3a9db76125e5f5ee18d2881aa0e4ec8cf1e8980a Mon Sep 17 00:00:00 2001 From: Mikael Korpela Date: Tue, 18 Nov 2025 22:50:18 +0200 Subject: [PATCH 2/2] add active check --- projects/packages/forms/src/blocks/field-name/variations.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/packages/forms/src/blocks/field-name/variations.js b/projects/packages/forms/src/blocks/field-name/variations.js index 099be00b693e7..abde919d606d6 100644 --- a/projects/packages/forms/src/blocks/field-name/variations.js +++ b/projects/packages/forms/src/blocks/field-name/variations.js @@ -24,6 +24,7 @@ const variations = [ description: __( 'Collect the visitor’s name.', 'jetpack-forms' ), icon, scope: [ 'transform' ], + isActive: ( { id } ) => ! [ FIRST_NAME_ID, LAST_NAME_ID ].includes( id ), attributes: { id: '', },