From 9ef88ea8bf67947acaab9a66138adf0a9acb606b Mon Sep 17 00:00:00 2001 From: liviu13 Date: Fri, 13 Sep 2024 15:23:44 +0300 Subject: [PATCH 1/4] fix error fields style when underline is used as field shape type --- classes/helpers/FrmStylesHelper.php | 1 + css/_single_theme.css.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/helpers/FrmStylesHelper.php b/classes/helpers/FrmStylesHelper.php index 4cc5ea3dc6..ab892bb293 100644 --- a/classes/helpers/FrmStylesHelper.php +++ b/classes/helpers/FrmStylesHelper.php @@ -467,6 +467,7 @@ private static function css_var_prepare_value( $settings, $key ) { case 'font': return safecss_filter_attr( $value ); + case 'border_width_error': case 'field_border_width': if ( ! empty( $settings['field_shape_type'] ) && 'underline' === $settings['field_shape_type'] ) { return safecss_filter_attr( '0px 0px ' . $value . ' 0px' ); diff --git a/css/_single_theme.css.php b/css/_single_theme.css.php index 7b641c890d..69893b09c0 100644 --- a/css/_single_theme.css.php +++ b/css/_single_theme.css.php @@ -369,7 +369,7 @@ color:; background-color:; border-color:; - border-width:; + border-width:var(--border-width-error) ; border-style:; } From 30c73f1b33ec772f649a804c9194e0cb950e81e8 Mon Sep 17 00:00:00 2001 From: liviu13 Date: Mon, 16 Sep 2024 15:21:08 +0300 Subject: [PATCH 2/4] add empty unit option for sliders, update the Base Font Size to propagate when a the sized is changed only, fix error text description color --- classes/helpers/FrmStylesHelper.php | 2 +- classes/models/FrmStyle.php | 10 ++++---- classes/views/styles/_quick-settings.php | 3 ++- .../components/FrmSliderStyleComponent.php | 24 +++++++++++-------- .../styles/components/FrmStyleComponent.php | 3 +++ .../styles/components/templates/slider.php | 18 +++++++------- css/_single_theme.css.php | 2 +- css/admin/style-components.css | 6 +++++ js/form-templates.js.map | 2 +- js/formidable_dashboard.js.map | 2 +- js/formidable_overlay.js.map | 2 +- js/formidable_styles.js | 2 +- js/formidable_styles.js.map | 2 +- js/onboarding-wizard.js.map | 2 +- js/src/admin/styles/slider-style-component.js | 19 ++++++++++++++- 15 files changed, 65 insertions(+), 34 deletions(-) diff --git a/classes/helpers/FrmStylesHelper.php b/classes/helpers/FrmStylesHelper.php index ab892bb293..f4f4219e87 100644 --- a/classes/helpers/FrmStylesHelper.php +++ b/classes/helpers/FrmStylesHelper.php @@ -571,7 +571,7 @@ public static function get_settings_for_output( $style ) { * @return array */ public static function update_base_font_size( $settings, $defaults ) { - if ( empty( $settings['base_font_size'] ) || empty( $settings['use_base_font_size'] ) ) { + if ( empty( $settings['base_font_size'] ) || empty( $settings['use_base_font_size'] ) || 'false' === $settings['use_base_font_size'] ) { return $settings; } $base_font_size = (int) $settings['base_font_size']; diff --git a/classes/models/FrmStyle.php b/classes/models/FrmStyle.php index 3506a9aafb..68dce66fa8 100644 --- a/classes/models/FrmStyle.php +++ b/classes/models/FrmStyle.php @@ -620,7 +620,7 @@ public function get_defaults() { 'direction' => is_rtl() ? 'rtl' : 'ltr', 'fieldset' => '0px', 'fieldset_color' => '000000', - 'fieldset_padding' => '0 0 15px 0', + 'fieldset_padding' => '0px 0px 15px 0px', 'fieldset_bg_color' => '', 'title_size' => '40px', @@ -631,7 +631,7 @@ public function get_defaults() { 'form_desc_color' => '98A2B3', 'form_desc_margin_top' => '10px', 'form_desc_margin_bottom' => '25px', - 'form_desc_padding' => '0', + 'form_desc_padding' => '0px', 'font' => '', 'font_size' => '15px', @@ -642,14 +642,14 @@ public function get_defaults() { 'width' => '150px', 'required_color' => 'F04438', 'required_weight' => 'bold', - 'label_padding' => '0 0 5px 0', + 'label_padding' => '0px 0px 5px 0px', 'description_font_size' => '12px', 'description_color' => '667085', 'description_weight' => 'normal', 'description_style' => 'normal', 'description_align' => 'left', - 'description_margin' => '0', + 'description_margin' => '0px', 'field_font_size' => '14px', 'field_height' => '36px', @@ -689,7 +689,7 @@ public function get_defaults() { 'section_font_size' => '18px', 'section_color' => '344054', 'section_weight' => 'bold', - 'section_pad' => '32px 0 3px 0', + 'section_pad' => '32px 0px 3px 0px', 'section_mar_top' => '30px', 'section_mar_bottom' => '30px', 'section_bg_color' => '', diff --git a/classes/views/styles/_quick-settings.php b/classes/views/styles/_quick-settings.php index 81677fdf27..6bb2002b0c 100644 --- a/classes/views/styles/_quick-settings.php +++ b/classes/views/styles/_quick-settings.php @@ -132,7 +132,7 @@
- + 'base_font_size', 'max_value' => 100, 'not_show_in' => 'advanced-settings', + 'classname' => 'frm-base-font-size', ) ); ?> diff --git a/classes/views/styles/components/FrmSliderStyleComponent.php b/classes/views/styles/components/FrmSliderStyleComponent.php index adaf114609..e6c1097469 100644 --- a/classes/views/styles/components/FrmSliderStyleComponent.php +++ b/classes/views/styles/components/FrmSliderStyleComponent.php @@ -33,6 +33,7 @@ public function __construct( $field_name, $field_value, $data ) { $this->data['unit_measurement'] = $this->detect_unit_measurement(); $this->data['has-multiple-values'] = count( $this->get_values() ) > 1; $this->data['units'] = $this->get_units_list( $data ); + $this->data['value_label'] = empty( $this->detect_unit_measurement() ) ? $field_value : (int) $field_value; $this->init_defaults(); $this->init_icon(); @@ -53,9 +54,9 @@ public function __construct( $field_name, $field_value, $data ) { */ private function get_units_list( $data ) { if ( empty( $data['units'] ) ) { - return array( 'px', 'em', '%' ); + return array( '', 'px', 'em', '%' ); } - return $data['units']; + return array_unshift( $data['units'], '' ); } /** @@ -89,33 +90,33 @@ private function init_multiple_values() { $right = $values[1]; $this->data['vertical'] = array( - 'value' => $top, 'unit' => $this->detect_unit_measurement( $top ), + 'value' => empty( $this->detect_unit_measurement( $top ) ) ? $top : (int) $top, ); $this->data['horizontal'] = array( - 'value' => $right, 'unit' => $this->detect_unit_measurement( $right ), + 'value' => empty( $this->detect_unit_measurement( $right ) ) ? $right : (int) $right, ); $this->data['top'] = array( - 'value' => $top, 'unit' => $this->detect_unit_measurement( $top ), + 'value' => empty( $this->detect_unit_measurement( $top ) ) ? $top : (int) $top, ); $this->data['bottom'] = array( - 'value' => $bottom, 'unit' => $this->detect_unit_measurement( $bottom ), + 'value' => empty( $this->detect_unit_measurement( $bottom ) ) ? $bottom : (int) $bottom, ); $this->data['left'] = array( - 'value' => $left, 'unit' => $this->detect_unit_measurement( $left ), + 'value' => empty( $this->detect_unit_measurement( $left ) ) ? $left : (int) $left, ); $this->data['right'] = array( - 'value' => $right, 'unit' => $this->detect_unit_measurement( $right ), + 'value' => empty( $this->detect_unit_measurement( $right ) ) ? $right : (int) $right, ); } @@ -133,7 +134,7 @@ private function get_values() { /** * Detect the unit measurement from the value. - * Possible values are: px, %, em. + * Possible values are: "px", "%", "em" or empty "" * * @since 6.14 * @@ -150,8 +151,11 @@ private function detect_unit_measurement( $value = null ) { if ( preg_match( '/em$/', $value ) ) { return 'em'; } + if ( preg_match( '/px$/', $value ) ) { + return 'px'; + } - return 'px'; + return ''; } /** diff --git a/classes/views/styles/components/FrmStyleComponent.php b/classes/views/styles/components/FrmStyleComponent.php index c600db67ee..5cb0dd62b7 100644 --- a/classes/views/styles/components/FrmStyleComponent.php +++ b/classes/views/styles/components/FrmStyleComponent.php @@ -133,6 +133,9 @@ protected function init_field_data( $data, $field_name, $field_value ) { */ protected function get_default_wrapper_class_names() { $class = 'frm-style-component'; + if ( ! empty( $this->data['classname'] ) ) { + $class .= ' ' . $this->data['classname']; + } if ( ! empty( $this->data['will_change'] ) ) { return $class . ' frm-style-dependent-updater-component'; } diff --git a/classes/views/styles/components/templates/slider.php b/classes/views/styles/components/templates/slider.php index be716c3543..671974a661 100644 --- a/classes/views/styles/components/templates/slider.php +++ b/classes/views/styles/components/templates/slider.php @@ -16,7 +16,7 @@
- + + + + + + + value="" id="" /> + + value="" id="" />