| 1 |
import { __ } from '@wordpress/i18n'; |
| 2 |
import { PanelBody, TextControl, TextareaControl } from '@wordpress/components'; |
| 3 |
import BaseFieldEdit from '../../components/BaseFieldEdit'; |
| 4 |
|
| 5 |
export default function Edit( props ) { |
| 6 |
const { attributes, setAttributes } = props; |
| 7 |
|
| 8 |
const extraPanels = ( |
| 9 |
<PanelBody title={ __( 'Validation Settings', 'profile-builder' ) }> |
| 10 |
<TextareaControl |
| 11 |
label={ __( 'Possible Values', 'profile-builder' ) } |
| 12 |
value={ attributes[ 'validation-possible-values' ] } |
| 13 |
onChange={ ( val ) => setAttributes( { 'validation-possible-values': val } ) } |
| 14 |
help={ __( 'Enter possible values separated by comma.', 'profile-builder' ) } |
| 15 |
/> |
| 16 |
<TextControl |
| 17 |
label={ __( 'Custom Error Message', 'profile-builder' ) } |
| 18 |
value={ attributes[ 'custom-error-message' ] } |
| 19 |
onChange={ ( val ) => setAttributes( { 'custom-error-message': val } ) } |
| 20 |
/> |
| 21 |
</PanelBody> |
| 22 |
); |
| 23 |
|
| 24 |
return ( |
| 25 |
<BaseFieldEdit { ...props } inspectorPanels={ extraPanels }> |
| 26 |
<input |
| 27 |
type="text" |
| 28 |
disabled |
| 29 |
style={ { width: '100%' } } |
| 30 |
placeholder={ __( 'Validation input...', 'profile-builder' ) } |
| 31 |
/> |
| 32 |
</BaseFieldEdit> |
| 33 |
); |
| 34 |
} |
| 35 |
|