diff --git a/packages/block-library/src/input-field/edit.js b/packages/block-library/src/input-field/edit.js index 5170f62ab8919f..d076521367b5fd 100644 --- a/packages/block-library/src/input-field/edit.js +++ b/packages/block-library/src/input-field/edit.js @@ -15,44 +15,10 @@ import { } from '@wordpress/components'; import { useRef } from '@wordpress/element'; -const inputTypeOptions = [ - { - key: 'text', - name: __( 'Text' ), - }, - { - key: 'textarea', - name: __( 'Textarea' ), - }, - { - key: 'checkbox', - name: __( 'Checkbox' ), - }, - { - key: 'email', - name: __( 'Email' ), - }, - { - key: 'url', - name: __( 'URL' ), - }, - { - key: 'tel', - name: __( 'Telephone' ), - }, - { - key: 'number', - name: __( 'Number' ), - }, - { - key: 'datetime-local', - name: __( 'Date and time' ), - }, - { - key: 'submit', - name: __( 'Submit' ), - }, -]; +/** + * Internal dependencies + */ +import { INPUT_TYPES } from './utils'; function InputFieldBlock( { attributes, setAttributes } ) { const { type, name, label, inlineLabel } = attributes; @@ -69,10 +35,10 @@ function InputFieldBlock( { attributes, setAttributes } ) { option.key === type ) } - options={ inputTypeOptions } + options={ INPUT_TYPES } onChange={ ( newVal ) => { setAttributes( { type: newVal?.selectedItem?.key, diff --git a/packages/block-library/src/input-field/utils.js b/packages/block-library/src/input-field/utils.js new file mode 100644 index 00000000000000..45f43c1e9135e4 --- /dev/null +++ b/packages/block-library/src/input-field/utils.js @@ -0,0 +1,43 @@ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; + +export const INPUT_TYPES = [ + { + key: 'text', + name: __( 'Text' ), + }, + { + key: 'textarea', + name: __( 'Textarea' ), + }, + { + key: 'checkbox', + name: __( 'Checkbox' ), + }, + { + key: 'email', + name: __( 'Email' ), + }, + { + key: 'url', + name: __( 'URL' ), + }, + { + key: 'tel', + name: __( 'Telephone' ), + }, + { + key: 'number', + name: __( 'Number' ), + }, + { + key: 'datetime-local', + name: __( 'Date and time' ), + }, + { + key: 'submit', + name: __( 'Submit' ), + }, +];