diff --git a/projects/packages/forms/src/blocks/contact-form/editor.scss b/projects/packages/forms/src/blocks/contact-form/editor.scss
index b503fd75a4fd..e8918c0fc38c 100644
--- a/projects/packages/forms/src/blocks/contact-form/editor.scss
+++ b/projects/packages/forms/src/blocks/contact-form/editor.scss
@@ -357,7 +357,7 @@
border: var(--jetpack--contact-form--border, 1px solid #8c8f94);
border-color: var(--jetpack--contact-form--border-color, #8c8f94);
border-style: var(--jetpack--contact-form--border-style, solid);
- border-width: var(--jetpack--contact-form--border-size, 1px);
+ border-width: var(--jetpack--contact-form--border-left-size, 1px);
}
.components-base-control__field {
@@ -525,14 +525,6 @@
}
}
-:where(:not(.contact-form)) > .jetpack-field {
-
- .jetpack-field__input, .jetpack-field__textarea {
- padding-left: max(var(--jetpack--contact-form--input-padding-left, 16px), var(--jetpack--contact-form--border-radius));
- padding-right: max(var(--jetpack--contact-form--input-padding-left, 16px), var(--jetpack--contact-form--border-radius));
- }
-}
-
// Duplicated to elevate specificity in order to overwrite core styles
.jetpack-field-multiple__list.jetpack-field-multiple__list {
list-style-type: none;
@@ -857,7 +849,7 @@
}
.notched-label__label {
- top: calc(var(--jetpack--contact-form--border-size) * -1);
+ top: calc(var(--jetpack--contact-form--border-top-size) * -1);
transform: translateY(-50%);
font-size: 0.8em;
}
@@ -919,15 +911,15 @@
.jetpack-field-dropdown__toggle
{
padding-top: 1.4em;
- padding-left: var(--jetpack--contact-form--field-padding);
+ padding-left: var(--jetpack--contact-form--animated-left-offset);
}
.animated-label__label {
position: absolute;
z-index: 1;
- top: 50%;
- left: var(--jetpack--contact-form--label-left);
- width: calc( 100% - var(--jetpack--contact-form--label-left));
+ top: var(--jetpack--contact-form--animated-top-offset);
+ left: calc(var(--jetpack--contact-form--border-left-size, 1px) + var(--jetpack--contact-form--animated-left-offset));
+ width: auto;
max-width: 100%;
box-sizing: border-box;
margin: 0;
@@ -939,17 +931,18 @@
}
}
+ .jetpack-field-multiple__list.jetpack-field-multiple__list--has-border {
+ padding-left: var(--jetpack--contact-form--animated-left-offset);
+ }
- &.jetpack-field-multiple {
- .animated-label__label {
- position: static;
- }
+ &.jetpack-field-multiple .animated-label__label {
+ position: static;
}
&.jetpack-field-textarea .animated-label__label {
transform: unset;
- top: var(--jetpack--contact-form--input-padding-top, 16px);
+ top: calc(2px + var(--jetpack--contact-form--border-top-size, 1px));
}
&.is-selected, &.has-placeholder {
@@ -957,7 +950,7 @@
.animated-label__label {
font-size: 0.75em;
transform: translateY(0);
- top: calc(2px + var(--jetpack--contact-form--border-size));
+ top: calc(2px + var(--jetpack--contact-form--border-top-size, 1px));
}
}
}
diff --git a/projects/packages/forms/src/blocks/shared/hooks/use-variation-style-properties.js b/projects/packages/forms/src/blocks/shared/hooks/use-variation-style-properties.js
index 65b39b4506f1..04f467b984fe 100644
--- a/projects/packages/forms/src/blocks/shared/hooks/use-variation-style-properties.js
+++ b/projects/packages/forms/src/blocks/shared/hooks/use-variation-style-properties.js
@@ -43,6 +43,45 @@ function getBorderRadiusCssVar( style ) {
}
}
+/**
+ * Returns the border widths for the input block.
+ *
+ * @param {object} blockBorderStyles - The attributes of the input block.
+ * @param {object} globalBorderStyles - The global styles.
+ * @return {object} The border widths.
+ */
+function getBorderWidths( blockBorderStyles, globalBorderStyles ) {
+ /*
+ * Use `getIntAsPxValue` on the borderWidth as legacy form blocks might not have a value unit.
+ * Sides (top, right, bottom, left) are available post-upgrade.
+ */
+ const borderWidth =
+ getIntAsPxValue( blockBorderStyles?.borderWidth ) || globalBorderStyles?.borderWidth;
+
+ if ( borderWidth ) {
+ return {
+ borderTopWidth: borderWidth,
+ borderRightWidth: borderWidth,
+ borderBottomWidth: borderWidth,
+ borderLeftWidth: borderWidth,
+ };
+ }
+
+ const borderTopWidth = blockBorderStyles?.borderTopWidth || globalBorderStyles?.borderTopWidth;
+ const borderRightWidth =
+ blockBorderStyles?.borderRightWidth || globalBorderStyles?.borderRightWidth;
+ const borderBottomWidth =
+ blockBorderStyles?.borderBottomWidth || globalBorderStyles?.borderBottomWidth;
+ const borderLeftWidth = blockBorderStyles?.borderLeftWidth || globalBorderStyles?.borderLeftWidth;
+
+ return {
+ borderTopWidth,
+ borderRightWidth,
+ borderBottomWidth,
+ borderLeftWidth,
+ };
+}
+
/**
* Returns properties that help achieve the outlined and animated form styles.
*
@@ -95,29 +134,31 @@ export default function useVariationStyleProperties( {
[ inputBaseGlobalStyles, inputUserGlobalStyles ]
);
- // Add a class to apply padding to option groups that have a border.
- const customBorderClasses = useMemo( () => {
+ return useMemo( () => {
+ // Access the input block's attributes.
+ const blockBorderClassesAndStyles = getBorderClassesAndStyles( inputBlockAttributes ?? {} );
+ const globalBorderClassesAndStyles = getBorderClassesAndStyles( {
+ style: mergedGlobalBlockStyles,
+ } );
+ const borderWidths = getBorderWidths(
+ blockBorderClassesAndStyles?.style,
+ globalBorderClassesAndStyles?.style
+ );
+
+ // Add a class to apply padding to option groups that have a border.
const hasBorder =
inputBlockName === 'jetpack/options' &&
- ( !! inputBlockAttributes?.style?.border?.width ||
- !! inputBlockAttributes?.style?.border?.left?.width ||
- !! mergedGlobalBlockStyles?.border?.width ||
- !! mergedGlobalBlockStyles?.border?.left?.width );
- return hasBorder ? 'jetpack-field-multiple__list--has-border' : '';
- }, [ inputBlockName, inputBlockAttributes, mergedGlobalBlockStyles ] );
+ !! borderWidths?.borderLeftWidth &&
+ parseInt( borderWidths?.borderLeftWidth ) > 0;
+
+ const customBorderClasses = hasBorder ? 'jetpack-field-multiple__list--has-border' : '';
- return useMemo( () => {
// Only return styles for outlined and animated forms.
if ( formStyle !== FORM_STYLE.OUTLINED && formStyle !== FORM_STYLE.ANIMATED ) {
return {
className: customBorderClasses,
};
}
- // Access the input block's attributes.
- const blockBorderClassesAndStyles = getBorderClassesAndStyles( inputBlockAttributes ?? {} );
- const globalBorderClassesAndStyles = getBorderClassesAndStyles( {
- style: mergedGlobalBlockStyles,
- } );
// Notched HTML only needs the background color and associated classes.
const attributesWithBackgroundColor = inputBlockAttributes
@@ -152,17 +193,14 @@ export default function useVariationStyleProperties( {
};
}
if ( formStyle === FORM_STYLE.ANIMATED ) {
- const borderLeftSize =
- getIntAsPxValue( blockBorderClassesAndStyles?.style?.borderWidth ) ||
- blockBorderClassesAndStyles?.style?.borderLeftWidth ||
- globalBorderClassesAndStyles?.style?.borderWidth ||
- globalBorderClassesAndStyles?.style?.borderLeftWidth ||
- '1px';
+ const hasTopBorder =
+ !! borderWidths?.borderTopWidth && parseInt( borderWidths?.borderTopWidth ) > 0;
styleSpecificCssVars = {
- '--jetpack--contact-form--left-offset': `calc(var(--jetpack--contact-form--input-padding-left, 16px) + ${ borderLeftSize })`,
- '--jetpack--contact-form--label-left':
- 'max(var(--jetpack--contact-form--left-offset), var(--jetpack--contact-form--border-radius))',
- '--jetpack--contact-form--field-padding': `calc(var(--jetpack--contact-form--label-left) - ${ borderLeftSize })`,
+ // For the animated labels.
+ '--jetpack--contact-form--animated-left-offset': '16px', // Probably can be removed or we use `--jetpack--contact-form--input-padding`
+ '--jetpack--contact-form--animated-top-offset': hasTopBorder
+ ? 'calc(var(--jetpack--contact-form--border-top-size) + var(--jetpack--contact-form--animated-left-offset))'
+ : '50%',
};
}
@@ -174,18 +212,16 @@ export default function useVariationStyleProperties( {
backgroundColor: blockColorClassesAndStyles?.style?.backgroundColor,
},
cssVars: {
- // Sets the value of top: calc(var(--jetpack--contact-form--border-size) * -1) for .notched-label__label.
- '--jetpack--contact-form--border-size':
- getIntAsPxValue( blockBorderClassesAndStyles?.style?.borderWidth ) ||
- blockBorderClassesAndStyles?.style?.borderTopWidth ||
- globalBorderClassesAndStyles?.style?.borderWidth ||
- globalBorderClassesAndStyles?.style?.borderTopWidth,
// Sets the value of --notch-width: max(var(--jetpack--contact-form--input-padding-left, 16px), var(--jetpack--contact-form--border-radius)); for .notched-label.
'--jetpack--contact-form--border-radius':
getBorderRadiusCssVar( blockBorderClassesAndStyles.style ) ||
getBorderRadiusCssVar( globalBorderClassesAndStyles.style ),
+ '--jetpack--contact-form--border-left-size': borderWidths?.borderLeftWidth,
+ '--jetpack--contact-form--border-right-size': borderWidths?.borderRightWidth,
+ '--jetpack--contact-form--border-top-size': borderWidths?.borderTopWidth,
+ '--jetpack--contact-form--border-bottom-size': borderWidths?.borderBottomWidth,
...styleSpecificCssVars,
},
};
- }, [ inputBlockAttributes, mergedGlobalBlockStyles, formStyle, customBorderClasses ] );
+ }, [ inputBlockAttributes, mergedGlobalBlockStyles, formStyle, inputBlockName ] );
}
diff --git a/projects/packages/forms/src/contact-form/class-contact-form-field.php b/projects/packages/forms/src/contact-form/class-contact-form-field.php
index c250532526ff..9e8f1ec55579 100644
--- a/projects/packages/forms/src/contact-form/class-contact-form-field.php
+++ b/projects/packages/forms/src/contact-form/class-contact-form-field.php
@@ -383,7 +383,7 @@ public function render() {
// For Outline style support.
$form_style = $this->get_form_style();
if ( 'outlined' === $form_style || 'animated' === $form_style ) {
- $output_data = $this->get_outline_styles( $form_style );
+ $output_data = $this->get_form_variation_style_properties( $form_style );
$this->block_styles .= $output_data['css_vars'];
}
} else {
@@ -1506,7 +1506,7 @@ public function render_outline_label( $id, $label, $required, $required_field_te
$classes .= $this->is_error() ? ' form-error' : '';
$classes .= $this->label_classes ? ' ' . $this->label_classes : '';
- $output_data = $this->get_outline_styles();
+ $output_data = $this->get_form_variation_style_properties();
return '
@@ -1528,6 +1528,7 @@ class=" ' . $classes . '"
/**
* Returns the styles, classes and CSS vars necessary to render fields in the "Outlined" style.
+ * The "Animated" style variation shares the CSS vars, which require similar calculations for the left offset and label left position.
* At the block level, the styles are extracted and added to the shortcode attributes in
* Contact_Form_Plugin::get_outlined_style_attributes().
* This function extracts those styles and applies them to the field,
@@ -1541,7 +1542,7 @@ class=" ' . $classes . '"
* @type string $class_name The class name.
* }
*/
- private function get_outline_styles( $form_style = 'outlined' ) {
+ private function get_form_variation_style_properties( $form_style = 'outlined' ) {
$style_attrs = '';
$css_vars = '';
$outline_styles = $this->get_attribute( 'outlinestyledata' );
@@ -1552,61 +1553,78 @@ private function get_outline_styles( $form_style = 'outlined' ) {
$block_name = 'jetpack/options';
}
- if ( ! empty( $outline_styles ) ) {
- $outline_styles = json_decode( html_entity_decode( $outline_styles, ENT_COMPAT ), true );
- $input_styles = $this->get_attribute( 'inputstyles' );
-
- if ( ! empty( $input_styles ) ) {
- $style_attrs = $input_styles;
- }
-
- $global_styles = wp_get_global_styles(
- array( 'border' ),
- array(
- 'block_name' => $block_name,
- 'transforms' => array( 'resolve-variables' ),
- )
- );
-
- $legacy_border_size = $outline_styles['border']['width'] ?? null;
- $legacy_border_size = is_numeric( $legacy_border_size ) ? $legacy_border_size . 'px' : $legacy_border_size;
- $legacy_border_radius = $outline_styles['border']['radius'] ?? null;
- $legacy_border_radius = is_numeric( $legacy_border_radius ) ? $legacy_border_radius . 'px' : $legacy_border_radius;
-
- $border_size = $legacy_border_size ??
- $outline_styles['border']['top']['width'] ??
- $global_styles['width'] ??
- $global_styles['top']['width'];
-
- $border_radius = $legacy_border_radius ??
- $global_styles['radius'];
-
- $css_vars = $border_size ? '--jetpack--contact-form--border-size: ' . $border_size . ';' : '';
- // Check if border radius is split or a single value.
- if ( is_array( $border_radius ) ) {
- // If corner radii are set on the top-left or bottom-left of the block, take the maximum of the two.
- // We check the left side due to writing direction—this variable is used to offset text.
- // TODO: this should factor in RTL languages.
- $css_vars .= $border_radius ? '--jetpack--contact-form--border-radius: max(' . $border_radius['topLeft'] . ',' . $border_radius['bottomLeft'] . ');' : '';
- } elseif ( isset( $border_radius ) ) {
- $css_vars .= $border_radius ? '--jetpack--contact-form--border-radius: ' . $border_radius . ';' : '';
- }
+ $outline_styles = ! empty( $outline_styles ) ? json_decode( html_entity_decode( $outline_styles, ENT_COMPAT ), true ) : array();
+ $input_styles = $this->get_attribute( 'inputstyles' );
- if ( 'outlined' === $form_style ) {
- $css_vars .= '--jetpack--contact-form--notch-width: max(var(--jetpack--contact-form--input-padding-left, 16px), var(--jetpack--contact-form--border-radius));';
- } elseif ( 'animated' === $form_style ) {
- $legacy_border_left_size = $outline_styles['border']['width'] ?? null;
- $legacy_border_left_size = is_numeric( $legacy_border_left_size ) ? $legacy_border_left_size . 'px' : $legacy_border_left_size;
+ if ( ! empty( $input_styles ) ) {
+ $style_attrs = $input_styles;
+ }
- $border_left_size = $legacy_border_left_size ??
- $outline_styles['border']['left']['width'] ??
- $global_styles['width'] ??
- $global_styles['left']['width'];
+ $global_styles = wp_get_global_styles(
+ array( 'border' ),
+ array(
+ 'block_name' => $block_name,
+ 'transforms' => array( 'resolve-variables' ),
+ )
+ );
- $css_vars .= "--jetpack--contact-form--left-offset: calc(var(--jetpack--contact-form--input-padding-left, 16px) + {$border_left_size});";
- $css_vars .= '--jetpack--contact-form--label-left: max(var(--jetpack--contact-form--left-offset), var(--jetpack--contact-form--border-radius));';
- $css_vars .= "--jetpack--contact-form--field-padding: calc(var(--jetpack--contact-form--label-left) - {$border_left_size});";
- }
+ /*
+ * The `borderwidth` attribute contains the border value that forms used before the migration to global styles.
+ * Any old forms saved in a post will still use this attribute, so it needs to be factored into the css vars for border
+ * to properly support backwards compatibility. So we check if the attribute is set and if it's not empty or '0', which is a valid width value.
+ * For newer forms that use global styles or the block supports styles, this value will be empty and is ignored.
+ */
+ $border_width_attribute = $this->get_attribute( 'borderwidth' );
+ $legacy_border_size = ! empty( $border_width_attribute ) || $border_width_attribute === '0' ? $border_width_attribute . 'px' : $outline_styles['border']['width'] ?? null;
+ $legacy_border_size = is_numeric( $legacy_border_size ) ? $legacy_border_size . 'px' : $legacy_border_size;
+ $legacy_border_radius = $outline_styles['border']['radius'] ?? null;
+ $legacy_border_radius = is_numeric( $legacy_border_radius ) ? $legacy_border_radius . 'px' : $legacy_border_radius;
+
+ $border_top_size = $legacy_border_size ??
+ $outline_styles['border']['top']['width'] ??
+ $global_styles['width'] ??
+ $global_styles['top']['width'] ?? null;
+
+ $border_right_size = $legacy_border_size ??
+ $outline_styles['border']['right']['width'] ??
+ $global_styles['width'] ??
+ $global_styles['right']['width'] ?? null;
+
+ $border_bottom_size = $legacy_border_size ??
+ $outline_styles['border']['bottom']['width'] ??
+ $global_styles['width'] ??
+ $global_styles['bottom']['width'] ?? null;
+
+ $border_left_size = $legacy_border_size ??
+ $outline_styles['border']['left']['width'] ??
+ $global_styles['width'] ??
+ $global_styles['left']['width'] ?? null;
+
+ $border_radius = $legacy_border_radius ??
+ $global_styles['radius'] ?? null;
+
+ $css_vars = $border_top_size ? '--jetpack--contact-form--border-size: ' . $border_top_size . ';' : '';
+ $css_vars .= $border_top_size ? '--jetpack--contact-form--border-top-size: ' . $border_top_size . ';' : '';
+ $css_vars .= $border_right_size ? '--jetpack--contact-form--border-right-size: ' . $border_right_size . ';' : '';
+ $css_vars .= $border_bottom_size ? '--jetpack--contact-form--border-bottom-size: ' . $border_bottom_size . ';' : '';
+ $css_vars .= $border_left_size ? '--jetpack--contact-form--border-left-size: ' . $border_left_size . ';' : '';
+
+ // Check if border radius is split or a single value.
+ if ( is_array( $border_radius ) ) {
+ // If corner radii are set on the top-left or bottom-left of the block, take the maximum of the two.
+ // We check the left side due to writing direction—this variable is used to offset text.
+ // TODO: this should factor in RTL languages.
+ $css_vars .= $border_radius ? '--jetpack--contact-form--border-radius: max(' . $border_radius['topLeft'] . ',' . $border_radius['bottomLeft'] . ');' : '';
+ } elseif ( isset( $border_radius ) ) {
+ $css_vars .= $border_radius ? '--jetpack--contact-form--border-radius: ' . $border_radius . ';' : '';
+ }
+
+ if ( 'outlined' === $form_style ) {
+ $css_vars .= '--jetpack--contact-form--notch-width: max(var(--jetpack--contact-form--input-padding-left, 16px), var(--jetpack--contact-form--border-radius));';
+ } elseif ( 'animated' === $form_style ) {
+ $css_vars .= '--jetpack--contact-form--animated-left-offset: 16px;';
+ $css_vars .= '--jetpack--contact-form--animated-top-offset:' . $border_top_size ? 'calc(var(--jetpack--contact-form--border-top-size) + var(--jetpack--contact-form--animated-left-offset));'
+ : '50%;';
}
return array(
diff --git a/projects/packages/forms/src/contact-form/css/grunion.css b/projects/packages/forms/src/contact-form/css/grunion.css
index eeacf4223a46..5beb1b82ce8a 100644
--- a/projects/packages/forms/src/contact-form/css/grunion.css
+++ b/projects/packages/forms/src/contact-form/css/grunion.css
@@ -168,7 +168,7 @@
font-size: 0.8em;
padding: 0 0.25em;
position: relative;
- top: calc(var(--jetpack--contact-form--border-size, 1px) / 2 * -1);
+ top: calc(var(--jetpack--contact-form--border-top-size, 1px) / 2 * -1);
}
@@ -408,7 +408,7 @@
transform: translateY(-50%) rotate(45deg);
transform-origin: center center;
pointer-events: none;
- right: calc(var(--jetpack--contact-form--border-size) + 16px);
+ right: calc(var(--jetpack--contact-form--border-right-size, 1px) + 16px);
}
.contact-form :where( .contact-form__select-wrapper select ) {
@@ -417,7 +417,7 @@
border-color: var(--jetpack--contact-form--border-color);
border-radius: var(--jetpack--contact-form--border-radius);
border-style: var(--jetpack--contact-form--border-style);
- border-width: var(--jetpack--contact-form--border-size);
+ border-width: var(--jetpack--contact-form--border-left-size, var(--jetpack--contact-form--border-size));
color: var(--jetpack--contact-form--text-color);
font-family: var(--jetpack--contact-form--font-family);
font-size: var(--jetpack--contact-form--font-size);
@@ -495,7 +495,9 @@
:where( .wp-block-jetpack-contact-form.is-style-outlined ) .notched-label__leading {
border-color: var(--jetpack--contact-form--border-color);
border-style: var(--jetpack--contact-form--border-style);
- border-width: var(--jetpack--contact-form--border-size);
+ border-top-width: var(--jetpack--contact-form--border-top-size, var(--jetpack--contact-form--border-size));
+ border-bottom-width: var(--jetpack--contact-form--border-bottom-size, var(--jetpack--contact-form--border-size));
+ border-left-width: var(--jetpack--contact-form--border-left-size, var(--jetpack--contact-form--border-size));
border-radius: var(--jetpack--contact-form--border-radius);
width: var(--jetpack--contact-form--notch-width);
max-width: 100px;
@@ -508,7 +510,8 @@
:where( .wp-block-jetpack-contact-form.is-style-outlined ) .notched-label__notch {
border-color: var(--jetpack--contact-form--border-color);
border-style: var(--jetpack--contact-form--border-style);
- border-width: var(--jetpack--contact-form--border-size);
+ border-top-width: var(--jetpack--contact-form--border-top-size, var(--jetpack--contact-form--border-size));
+ border-bottom-width: var(--jetpack--contact-form--border-bottom-size, var(--jetpack--contact-form--border-size));
border-radius: unset !important;
padding: 0 4px;
transition: border 150ms linear;
@@ -520,7 +523,8 @@
:where( .wp-block-jetpack-contact-form.is-style-outlined ) .notched-label__filler {
border-color: var(--jetpack--contact-form--border-color);
border-style: var(--jetpack--contact-form--border-style);
- border-width: var(--jetpack--contact-form--border-size);
+ border-top-width: var(--jetpack--contact-form--border-top-size, var(--jetpack--contact-form--border-size));
+ border-bottom-width: var(--jetpack--contact-form--border-bottom-size, var(--jetpack--contact-form--border-size));
flex-grow: 1;
border-left: none !important;
border-right: none !important;
@@ -531,7 +535,9 @@
:where( .wp-block-jetpack-contact-form.is-style-outlined ) .notched-label__trailing {
border-color: var(--jetpack--contact-form--border-color);
border-style: var(--jetpack--contact-form--border-style);
- border-width: var(--jetpack--contact-form--border-size);
+ border-top-width: var(--jetpack--contact-form--border-top-size, var(--jetpack--contact-form--border-size));
+ border-right-width: var(--jetpack--contact-form--border-right-size, var(--jetpack--contact-form--border-size));
+ border-bottom-width: var(--jetpack--contact-form--border-bottom-size, var(--jetpack--contact-form--border-size));
border-radius: var(--jetpack--contact-form--border-radius);
flex-grow: 1;
max-width: 100px;
@@ -612,7 +618,7 @@ on production builds, the attributes are being reordered, causing side-effects
.contact-form .is-style-outlined .grunion-field-wrap .notched-label:has(~ .grunion-radio-options) .notched-label__label,
.contact-form .is-style-outlined .grunion-field-wrap.grunion-field-select-wrap .notched-label .notched-label__label
{
- top: calc(var(--jetpack--contact-form--border-size) * -1 );
+ top: calc( var(--jetpack--contact-form--border-top-size, var(--jetpack--contact-form--border-size)) * -1 );
transform: translateY(-50%);
font-size: 0.8em;
}
@@ -670,10 +676,18 @@ on production builds, the attributes are being reordered, causing side-effects
padding-right: var(--field-padding);
}
+/* Fix padding for new forms in animated style */
+.contact-form .is-style-animated .grunion-field-wrap:not(.no-label) > .wp-block-jetpack-input,
+.contact-form .is-style-animated .grunion-field-wrap:not(.no-label) .wp-block-jetpack-input,
+.contact-form .is-style-animated .wp-block-jetpack-options.jetpack-field-multiple__list--has-border {
+ padding-left: var(--jetpack--contact-form--animated-left-offset);
+ padding-right: var(--jetpack--contact-form--animated-left-offset);
+}
+
.contact-form .is-style-animated .grunion-field-wrap .animated-label__label {
position: absolute;
top: 50%;
- left: var(--label-left);
+ left: calc(var(--jetpack--contact-form--border-left-size, 0px) + var(--jetpack--contact-form--animated-left-offset, var(--label-left)));
width: 100%;
max-width: 100%;
box-sizing: border-box;
@@ -686,7 +700,7 @@ on production builds, the attributes are being reordered, causing side-effects
.contact-form .is-style-animated .grunion-field-textarea-wrap .animated-label__label {
transform: unset;
- top: var(--jetpack--contact-form--input-padding-top, 16px);
+ top: calc(2px + var(--jetpack--contact-form--border-top-size, var( --jetpack--contact-form--border-size, 1px )));
}
.contact-form .is-style-animated .grunion-field-wrap .animated-label__label:has(~ .grunion-field:focus),
@@ -696,7 +710,7 @@ on production builds, the attributes are being reordered, causing side-effects
{
font-size: 0.75em;
transform: translateY(0);
- top: calc(2px + var(--jetpack--contact-form--border-size));
+ top: calc(2px + var(--jetpack--contact-form--border-top-size, var( --jetpack--contact-form--border-size, 1px )));
}
/* The following is scoped by the presence of the custom font size CSS var to avoid needing conditional fallback within the var() */
@@ -715,7 +729,7 @@ on production builds, the attributes are being reordered, causing side-effects
}
.contact-form .is-style-below .grunion-field-wrap .below-label__label {
- margin-left: var(--jetpack--contact-form--border-size);
+ margin-left: var(--jetpack--contact-form--border-left-size, var(--jetpack--contact-form--border-size));
}
.contact-form :where(.grunion-field-wrap:not(.is-style-button-wrap)) .grunion-checkbox-multiple-options:not(.wp-block-jetpack-options),