| @@ -46,9 +46,9 @@ | ||
| 46 | 46 | $this->get_row_column_displayCss( $attributes, 'Mobile' ), |
| 47 | 47 | ); |
| 48 | 48 | |
| 49 | 49 | $css_generator->add_class_styles( |
| 50 | - '{{WRAPPER}} > .ablocks-form-builder__field', | |
| 50 | + '{{WRAPPER}} .ablocks-form-builder__field', | |
| 51 | 51 | $this->get_field_css( $attributes ), |
| 52 | 52 | $this->get_field_css( $attributes, 'Tablet' ), |
| 53 | 53 | $this->get_field_css( $attributes, 'Mobile' ), |
| 54 | 54 | ); |
| @@ -66,12 +66,12 @@ | ||
| 66 | 66 | $this->get_helper_text_css( $attributes, 'Mobile' ), |
| 67 | 67 | ); |
| 68 | 68 | |
| 69 | 69 | $css_generator->add_class_styles( |
| 70 | - '{{WRAPPER}} .ablocks-form-builder__input , | |
| 71 | - {{WRAPPER}} .ablocks-form-builder__select , | |
| 72 | - {{WRAPPER}} .ablocks-form-builder-timepicker-input , | |
| 73 | - {{WRAPPER}} .ablocks-form-builder-datepicker-input', | |
| 70 | + '{{WRAPPER}} input.ablocks-form-builder__input , | |
| 71 | + {{WRAPPER}} input.ablocks-form-builder__select , | |
| 72 | + {{WRAPPER}} input.ablocks-form-builder-timepicker-input , | |
| 73 | + {{WRAPPER}} input.ablocks-form-builder-datepicker-input', | |
| 74 | 74 | $this->get_input_css( $attributes ), |
| 75 | 75 | $this->get_input_css( $attributes, 'Tablet' ), |
| 76 | 76 | $this->get_input_css( $attributes, 'Mobile' ), |
| 77 | 77 | ); |
| @@ -160,15 +160,17 @@ | ||
| 160 | 160 | '{{WRAPPER}} .ablocks-form-builder', |
| 161 | 161 | $this->get_row_column_displayCss( $attributes ), |
| 162 | 162 | $this->get_row_column_displayCss( $attributes, 'Tablet' ), |
| 163 | 163 | $this->get_row_column_displayCss( $attributes, 'Mobile' ), |
| 164 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_row_column_displayCss( $attributes, $device ); } ) | |
| 164 | 165 | ); |
| 165 | 166 | |
| 166 | 167 | $css_generator->add_class_styles( |
| 167 | - '{{WRAPPER}} > .ablocks-form-builder__field', | |
| 168 | + '{{WRAPPER}} .ablocks-form-builder__field', | |
| 168 | 169 | $this->get_field_css( $attributes ), |
| 169 | 170 | $this->get_field_css( $attributes, 'Tablet' ), |
| 170 | 171 | $this->get_field_css( $attributes, 'Mobile' ), |
| 172 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_field_css( $attributes, $device ); } ) | |
| 171 | 173 | ); |
| 172 | 174 | |
| 173 | 175 | $css_generator->add_class_styles( |
| 174 | 176 | '{{WRAPPER}} .ablocks-form-builder__label', |
| @@ -174,8 +176,9 @@ | ||
| 174 | 176 | '{{WRAPPER}} .ablocks-form-builder__label', |
| 175 | 177 | $this->get_label_css( $attributes ), |
| 176 | 178 | $this->get_label_css( $attributes, 'Tablet' ), |
| 177 | 179 | $this->get_label_css( $attributes, 'Mobile' ), |
| 180 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_label_css( $attributes, $device ); } ) | |
| 178 | 181 | ); |
| 179 | 182 | $css_generator->add_class_styles( |
| 180 | 183 | '{{WRAPPER}} .ablocks-form-builder__helper-text', |
| 181 | 184 | $this->get_helper_text_css( $attributes ), |
| @@ -180,8 +183,9 @@ | ||
| 180 | 183 | '{{WRAPPER}} .ablocks-form-builder__helper-text', |
| 181 | 184 | $this->get_helper_text_css( $attributes ), |
| 182 | 185 | $this->get_helper_text_css( $attributes, 'Tablet' ), |
| 183 | 186 | $this->get_helper_text_css( $attributes, 'Mobile' ), |
| 187 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_helper_text_css( $attributes, $device ); } ) | |
| 184 | 188 | ); |
| 185 | 189 | |
| 186 | 190 | $css_generator->add_class_styles( |
| 187 | 191 | '{{WRAPPER}} .ablocks-form-builder__input , |
| @@ -190,8 +194,9 @@ | ||
| 190 | 194 | {{WRAPPER}} .ablocks-form-builder-datepicker-input', |
| 191 | 195 | $this->get_input_css( $attributes ), |
| 192 | 196 | $this->get_input_css( $attributes, 'Tablet' ), |
| 193 | 197 | $this->get_input_css( $attributes, 'Mobile' ), |
| 198 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_input_css( $attributes, $device ); } ) | |
| 194 | 199 | ); |
| 195 | 200 | $css_generator->add_class_styles( |
| 196 | 201 | '{{WRAPPER}} .ablocks-form-builder__input:hover', |
| 197 | 202 | $this->get_input_hover_css( $attributes ), |
| @@ -196,8 +201,9 @@ | ||
| 196 | 201 | '{{WRAPPER}} .ablocks-form-builder__input:hover', |
| 197 | 202 | $this->get_input_hover_css( $attributes ), |
| 198 | 203 | $this->get_input_hover_css( $attributes, 'Tablet' ), |
| 199 | 204 | $this->get_input_hover_css( $attributes, 'Mobile' ), |
| 205 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_input_hover_css( $attributes, $device ); } ) | |
| 200 | 206 | ); |
| 201 | 207 | $css_generator->add_class_styles( |
| 202 | 208 | '{{WRAPPER}} .ablocks-form-builder__input:focus', |
| 203 | 209 | $this->get_input_focus_css( $attributes ), |
| @@ -202,8 +208,9 @@ | ||
| 202 | 208 | '{{WRAPPER}} .ablocks-form-builder__input:focus', |
| 203 | 209 | $this->get_input_focus_css( $attributes ), |
| 204 | 210 | $this->get_input_focus_css( $attributes, 'Tablet' ), |
| 205 | 211 | $this->get_input_focus_css( $attributes, 'Mobile' ), |
| 212 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_input_focus_css( $attributes, $device ); } ) | |
| 206 | 213 | ); |
| 207 | 214 | |
| 208 | 215 | $css_generator->add_class_styles( |
| 209 | 216 | '{{WRAPPER}} .ablocks-form-builder__input::placeholder', |
| @@ -209,8 +216,9 @@ | ||
| 209 | 216 | '{{WRAPPER}} .ablocks-form-builder__input::placeholder', |
| 210 | 217 | $this->get_input_placeholder_css( $attributes ), |
| 211 | 218 | $this->get_input_placeholder_css( $attributes, 'Tablet' ), |
| 212 | 219 | $this->get_input_placeholder_css( $attributes, 'Mobile' ), |
| 220 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_input_placeholder_css( $attributes, $device ); } ) | |
| 213 | 221 | ); |
| 214 | 222 | $css_generator->add_class_styles( |
| 215 | 223 | '{{WRAPPER}} .ablocks-form-builder__input-icon,{{WRAPPER}} .ablocks-form-builder__input-toggle-password', |
| 216 | 224 | $this->get_input_position_css( $attributes ), |
| @@ -215,8 +223,9 @@ | ||
| 215 | 223 | '{{WRAPPER}} .ablocks-form-builder__input-icon,{{WRAPPER}} .ablocks-form-builder__input-toggle-password', |
| 216 | 224 | $this->get_input_position_css( $attributes ), |
| 217 | 225 | $this->get_input_position_css( $attributes, 'Tablet' ), |
| 218 | 226 | $this->get_input_position_css( $attributes, 'Mobile' ), |
| 227 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_input_position_css( $attributes, $device ); } ) | |
| 219 | 228 | ); |
| 220 | 229 | |
| 221 | 230 | $css_generator->add_class_styles( |
| 222 | 231 | '{{WRAPPER}} .ablocks-form-builder__submit-button', |
| @@ -222,8 +231,9 @@ | ||
| 222 | 231 | '{{WRAPPER}} .ablocks-form-builder__submit-button', |
| 223 | 232 | $this->get_alignment_button_css( $attributes ), |
| 224 | 233 | $this->get_alignment_button_css( $attributes, 'Tablet' ), |
| 225 | 234 | $this->get_alignment_button_css( $attributes, 'Mobile' ), |
| 235 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_alignment_button_css( $attributes, $device ); } ) | |
| 226 | 236 | ); |
| 227 | 237 | |
| 228 | 238 | $css_generator->add_class_styles( |
| 229 | 239 | '{{WRAPPER}} .ablocks-form-builder__submit-button', |
| @@ -229,8 +239,9 @@ | ||
| 229 | 239 | '{{WRAPPER}} .ablocks-form-builder__submit-button', |
| 230 | 240 | $this->get_submit_button_css( $attributes ), |
| 231 | 241 | $this->get_submit_button_css( $attributes, 'Tablet' ), |
| 232 | 242 | $this->get_submit_button_css( $attributes, 'Mobile' ), |
| 243 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_submit_button_css( $attributes, $device ); } ) | |
| 233 | 244 | ); |
| 234 | 245 | |
| 235 | 246 | $css_generator->add_class_styles( |
| 236 | 247 | '{{WRAPPER}} .ablocks-form-builder__submit-button:hover', |
| @@ -236,8 +247,9 @@ | ||
| 236 | 247 | '{{WRAPPER}} .ablocks-form-builder__submit-button:hover', |
| 237 | 248 | $this->get_submit_button_hover_css( $attributes ), |
| 238 | 249 | $this->get_submit_button_hover_css( $attributes, 'Tablet' ), |
| 239 | 250 | $this->get_submit_button_hover_css( $attributes, 'Mobile' ), |
| 251 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_submit_button_hover_css( $attributes, $device ); } ) | |
| 240 | 252 | ); |
| 241 | 253 | $css_generator->add_class_styles( |
| 242 | 254 | '{{WRAPPER}} .ablocks-block--form-builder__navigator', |
| 243 | 255 | $this->get_navigator_css( $attributes ), |
| @@ -242,8 +254,9 @@ | ||
| 242 | 254 | '{{WRAPPER}} .ablocks-block--form-builder__navigator', |
| 243 | 255 | $this->get_navigator_css( $attributes ), |
| 244 | 256 | $this->get_navigator_css( $attributes, 'Tablet' ), |
| 245 | 257 | $this->get_navigator_css( $attributes, 'Mobile' ), |
| 258 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_navigator_css( $attributes, $device ); } ) | |
| 246 | 259 | ); |
| 247 | 260 | $css_generator->add_class_styles( |
| 248 | 261 | '{{WRAPPER}} .ablocks-block--form-builder__navigator-redirect-page', |
| 249 | 262 | $this->get_navigator_spacing_css( $attributes ), |
| @@ -248,8 +261,9 @@ | ||
| 248 | 261 | '{{WRAPPER}} .ablocks-block--form-builder__navigator-redirect-page', |
| 249 | 262 | $this->get_navigator_spacing_css( $attributes ), |
| 250 | 263 | $this->get_navigator_spacing_css( $attributes, 'Tablet' ), |
| 251 | 264 | $this->get_navigator_spacing_css( $attributes, 'Mobile' ), |
| 265 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_navigator_spacing_css( $attributes, $device ); } ) | |
| 252 | 266 | ); |
| 253 | 267 | $css_generator->add_class_styles( |
| 254 | 268 | '{{WRAPPER}} .ablocks-block--form-builder__success', |
| 255 | 269 | $this->get_succsss_styles_css( $attributes ), |
| @@ -254,8 +268,9 @@ | ||
| 254 | 268 | '{{WRAPPER}} .ablocks-block--form-builder__success', |
| 255 | 269 | $this->get_succsss_styles_css( $attributes ), |
| 256 | 270 | $this->get_succsss_styles_css( $attributes, 'Tablet' ), |
| 257 | 271 | $this->get_succsss_styles_css( $attributes, 'Mobile' ), |
| 272 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_succsss_styles_css( $attributes, $device ); } ) | |
| 258 | 273 | ); |
| 259 | 274 | $css_generator->add_class_styles( |
| 260 | 275 | '{{WRAPPER}} .ablocks-block--form-builder__error', |
| 261 | 276 | $this->get_error_styles_css( $attributes ), |
| @@ -260,8 +275,9 @@ | ||
| 260 | 275 | '{{WRAPPER}} .ablocks-block--form-builder__error', |
| 261 | 276 | $this->get_error_styles_css( $attributes ), |
| 262 | 277 | $this->get_error_styles_css( $attributes, 'Tablet' ), |
| 263 | 278 | $this->get_error_styles_css( $attributes, 'Mobile' ), |
| 279 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_error_styles_css( $attributes, $device ); } ) | |
| 264 | 280 | ); |
| 265 | 281 | $css_generator->add_class_styles( |
| 266 | 282 | '{{WRAPPER}} .ablocks-block--form-builder__feedback-message', |
| 267 | 283 | $this->get_success_error_common_styles_css( $attributes ), |
| @@ -266,8 +282,9 @@ | ||
| 266 | 282 | '{{WRAPPER}} .ablocks-block--form-builder__feedback-message', |
| 267 | 283 | $this->get_success_error_common_styles_css( $attributes ), |
| 268 | 284 | $this->get_success_error_common_styles_css( $attributes, 'Tablet' ), |
| 269 | 285 | $this->get_success_error_common_styles_css( $attributes, 'Mobile' ), |
| 286 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_success_error_common_styles_css( $attributes, $device ); } ) | |
| 270 | 287 | ); |
| 271 | 288 | return $css_generator->generate_css(); |
| 272 | 289 | } |
| 273 | 290 | public function build_css( $attributes ) { |
| @@ -366,9 +383,9 @@ | ||
| 366 | 383 | $css, |
| 367 | 384 | Alignment::get_css( $attributes['inputAlignment'], 'text-align', $device ), |
| 368 | 385 | Typography::get_css( $attributes['inputTypography'], '', $device, $typographyValueGlobal ), |
| 369 | 386 | Border::get_css( $attributes['inputBorder'], '', $device ), |
| 370 | - Dimensions::get_css( $attributes['inputPadding'], 'padding', $device ) | |
| 387 | + $this->add_important_to_css( Dimensions::get_css( $attributes['inputPadding'], 'padding', $device ) ) | |
| 371 | 388 | ); |
| 372 | 389 | |
| 373 | 390 | if ( ! empty( $attributes['inputColor'] ) ) { |
| 374 | 391 | $input_css['color'] = Color::get_css( |
| @@ -519,8 +536,15 @@ | ||
| 519 | 536 | } |
| 520 | 537 | } |
| 521 | 538 | |
| 522 | 539 | return $css; |
| 540 | + } | |
| 541 | + | |
| 542 | + private function add_important_to_css( $css_array ) { | |
| 543 | + foreach ( $css_array as $key => $value ) { | |
| 544 | + $css_array[$key] = $value . ' !important'; | |
| 545 | + } | |
| 546 | + return $css_array; | |
| 523 | 547 | } |
| 524 | 548 | |
| 525 | 549 | |
| 526 | 550 | } |