/* global wpforms_gutenberg_form_selector */ /* jshint es3: false, esversion: 6 */ /** * @param strings.field_styles * @param strings.lead_forms_panel_notice_head * @param strings.lead_forms_panel_notice_text * @param strings.learn_more * @param strings.use_modern_notice_head * @param strings.use_modern_notice_link * @param strings.use_modern_notice_text */ /** * Gutenberg editor block. * * Field styles panel module. * * @since 1.8.8 */ export default ( ( function() { /** * WP core components. * * @since 1.8.8 */ const { PanelColorSettings } = wp.blockEditor || wp.editor; const { SelectControl, PanelBody, Flex, FlexBlock, __experimentalUnitControl } = wp.components; /** * Localized data aliases. * * @since 1.8.8 */ const { strings, defaults } = wpforms_gutenberg_form_selector; // noinspection UnnecessaryLocalVariableJS /** * Public functions and properties. * * @since 1.8.8 * * @type {Object} */ const app = { /** * Get block attributes. * * @since 1.8.8 * * @return {Object} Block attributes. */ getBlockAttributes() { return { fieldSize: { type: 'string', default: defaults.fieldSize, }, fieldBorderStyle: { type: 'string', default: defaults.fieldBorderStyle, }, fieldBorderSize: { type: 'string', default: defaults.fieldBorderSize, }, fieldBorderRadius: { type: 'string', default: defaults.fieldBorderRadius, }, fieldBackgroundColor: { type: 'string', default: defaults.fieldBackgroundColor, }, fieldBorderColor: { type: 'string', default: defaults.fieldBorderColor, }, fieldTextColor: { type: 'string', default: defaults.fieldTextColor, }, fieldMenuColor: { type: 'string', default: defaults.fieldMenuColor, }, }; }, /** * Get Field styles JSX code. * * @since 1.8.8 * * @param {Object} props Block properties. * @param {Object} handlers Block event handlers. * @param {Object} sizeOptions Size selector options. * @param {Object} formSelectorCommon Form selector common object. * * @return {Object} Field styles JSX code. */ getFieldStyles( props, handlers, sizeOptions, formSelectorCommon ) { // eslint-disable-line max-lines-per-function return ( handlers.styleAttrChange( 'fieldSize', value ) } /> handlers.styleAttrChange( 'fieldBorderStyle', value ) } /> <__experimentalUnitControl label={ strings.border_size } value={ props.attributes.fieldBorderStyle === 'none' ? '' : props.attributes.fieldBorderSize } min={ 0 } disabled={ props.attributes.fieldBorderStyle === 'none' } onChange={ ( value ) => handlers.styleAttrChange( 'fieldBorderSize', value ) } isUnitSelectTabbable /> <__experimentalUnitControl label={ strings.border_radius } value={ props.attributes.fieldBorderRadius } min={ 0 } isUnitSelectTabbable onChange={ ( value ) => handlers.styleAttrChange( 'fieldBorderRadius', value ) } />
{ strings.colors }
handlers.styleAttrChange( 'fieldBackgroundColor', value ), label: strings.background, }, { value: props.attributes.fieldBorderColor, onChange: ( value ) => handlers.styleAttrChange( 'fieldBorderColor', value ), label: strings.border, }, { value: props.attributes.fieldTextColor, onChange: ( value ) => handlers.styleAttrChange( 'fieldTextColor', value ), label: strings.text, }, { value: props.attributes.fieldMenuColor, onChange: ( value ) => handlers.styleAttrChange( 'fieldMenuColor', value ), label: strings.menu, }, ] } />
); }, }; return app; } )() );