Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gap control #427

Merged
merged 6 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/css/frontend.css

Large diffs are not rendered by default.

19 changes: 11 additions & 8 deletions assets/scss/frontend/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -645,15 +645,18 @@ input[type="range"] {
}
}

.jet-form-builder__field-wrap.checkradio-wrap {
margin-bottom: 0.7em;
.jet-form-builder__fields-group {
display: flex;
flex-direction: row;
stijnvanouplines marked this conversation as resolved.
Show resolved Hide resolved
flex-wrap: wrap;
gap: .7em;
}

span {
/*display: contents;*/
display: flex;
align-items: center;
gap: 8px;
}
.jet-form-builder__field-wrap.checkradio-wrap span {
/*display: contents;*/
display: flex;
align-items: center;
gap: 8px;
}

.rtl .jet-form-builder-row,
Expand Down
38 changes: 30 additions & 8 deletions compatibility/elementor/widgets/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -1420,17 +1420,39 @@ protected function register_controls() {
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'options' => array(
'inline-block' => array(
'row' => array(
'title' => __( 'Horizontal', 'jet-form-builder' ),
'icon' => 'eicon-ellipsis-h',
),
'block' => array(
'column' => array(
stijnvanouplines marked this conversation as resolved.
Show resolved Hide resolved
'title' => __( 'Vertical', 'jet-form-builder' ),
'icon' => 'eicon-editor-list-ul',
),
),
'selectors' => array(
$this->selector( '__field-wrap.checkradio-wrap' ) => 'display: {{VALUE}};',
$this->selector( '__fields-group' ) => 'flex-direction: {{VALUE}};',
),
)
);

$this->add_responsive_control(
'checkradio_fields_gaps',
array(
'label' => __( 'Gaps', 'jet-form-builder' ),
'type' => Controls_Manager::GAPS,
'size_units' => array( 'px', 'em', 'rem', 'custom' ),
'default' => array(
'row' => '0.7',
'column' => '0.7',
'unit' => 'em',
),
'validators' => array(
'Number' => array(
'min' => 0,
),
),
'selectors' => array(
$this->selector( '__fields-group' ) => 'gap: {{ROW}}{{UNIT}} {{COLUMN}}{{UNIT}};',
),
)
);
Expand All @@ -1449,7 +1471,7 @@ protected function register_controls() {
'label' => __( 'Gap between control and label', 'jet-form-builder' ),
'type' => Controls_Manager::SLIDER,
'size_units' => array( 'px', 'em', 'rem', 'custom' ),
'default' => array(
'default' => array(
'size' => 8,
),
'range' => array(
Expand Down Expand Up @@ -1743,7 +1765,7 @@ protected function register_controls() {
array(
'label' => __( 'Fields width', 'jet-form-builder' ),
'type' => Controls_Manager::SLIDER,
'size_units' => array( 'px', '%', 'em', 'rem', 'custom' ),
'size_units' => array( 'px', 'em', 'rem', 'custom' ),
stijnvanouplines marked this conversation as resolved.
Show resolved Hide resolved
'range' => array(
'px' => array(
'min' => 50,
Expand Down Expand Up @@ -2892,8 +2914,8 @@ protected function register_controls() {
$this->add_group_control(
Group_Control_Typography::get_type(),
array(
'name' => 'booking_form_submit_typography',
'selector' => $this->selector( '__action-button' ),
'name' => 'booking_form_submit_typography',
'selector' => $this->selector( '__action-button' ),
)
);

Expand All @@ -2903,7 +2925,7 @@ protected function register_controls() {
'label' => esc_html__( 'Padding', 'jet-form-builder' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%', 'em', 'rem', 'custom' ),
'separator' => 'before',
'separator' => 'before',
'selectors' => array(
$this->selector( '__action-button' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
Expand Down
2 changes: 2 additions & 0 deletions templates/fields/calculated-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WhiteSpace.PrecisionAlignment.Found
?>
<div <?php $this->render_attributes_string(); ?>>
<?php do_action( 'jet-form-builder/before-field', $this ); ?>
<?php if ( false !== $prefix ) : ?>
<div class="jet-form-builder__calculated-field-prefix"><?php echo wp_kses_post( $prefix ); ?></div>
<?php endif; ?>
Expand All @@ -56,5 +57,6 @@ class="jet-form-builder__calculated-field-input jet-form-builder__field"
<?php if ( false !== $suffix ) : ?>
<div class="jet-form-builder__calculated-field-suffix"><?php echo wp_kses_post( $suffix ); ?></div>
<?php endif; ?>
<?php do_action( 'jet-form-builder/after-field', $this ); ?>
</div>
<?php
2 changes: 2 additions & 0 deletions templates/fields/color-picker-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
$this->add_attribute( 'data-jfb-sync' );
?>
<div class="jet-form-builder__field-wrap">
<?php do_action( 'jet-form-builder/before-field', $this ); ?>
<input <?php $this->render_attributes_string(); ?>>
<?php do_action( 'jet-form-builder/after-field', $this ); ?>
</div>
<?php
2 changes: 2 additions & 0 deletions templates/fields/date-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@
$this->add_attribute( 'max', Date_Tools::time_to_string( $this->args['max'] ) );
}
?>
<?php do_action( 'jet-form-builder/before-field', $this ); ?>
<input <?php $this->render_attributes_string(); ?>>
<?php do_action( 'jet-form-builder/after-field', $this ); ?>
<?php
2 changes: 2 additions & 0 deletions templates/fields/datetime-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@
);
}
?>
<?php do_action( 'jet-form-builder/before-field', $this ); ?>
<input <?php $this->render_attributes_string(); ?>>
<?php do_action( 'jet-form-builder/after-field', $this ); ?>
<?php
2 changes: 2 additions & 0 deletions templates/fields/media-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
?>
<div class="jet-form-builder__field-wrap jet-form-builder-file-upload">
<?php do_action( 'jet-form-builder/before-field', $this ); ?>
<div class="jet-form-builder-file-upload__content">
<?php echo File_Upload::instance()->get_loader(); ?>
<div class="jet-form-builder-file-upload__files" <?php $this->files()->render_attributes_string(); ?>>
Expand All @@ -56,5 +57,6 @@
</div>
<div class="jet-form-builder-file-upload__message"><small><?php echo wp_kses_post( $max_size_message ); ?></small></div>
<div class="jet-form-builder-file-upload__errors is-hidden"></div>
<?php do_action( 'jet-form-builder/after-field', $this ); ?>
</div>
<?php // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
2 changes: 2 additions & 0 deletions templates/fields/number-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
$this->add_attribute( 'data-jfb-sync' );
?>
<div class="jet-form-builder__field-wrap">
<?php do_action( 'jet-form-builder/before-field', $this ); ?>
<input type="number" <?php $this->render_attributes_string(); ?>>
<?php do_action( 'jet-form-builder/after-field', $this ); ?>
</div>
<?php
2 changes: 2 additions & 0 deletions templates/fields/range-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
?>
<div class="jet-form-builder__field-wrap range-wrap">
<?php do_action( 'jet-form-builder/before-field', $this ); ?>
<input type="range" <?php $this->render_attributes_string(); ?>>
<div class="jet-form-builder__field-value range-value">
<?php if ( ! empty( $args['prefix'] ) ) : ?>
Expand All @@ -34,5 +35,6 @@
<span class="jet-form-builder__field-value-suffix"><?php echo wp_kses_post( $args['suffix'] ); ?></span>
<?php endif; ?>
</div>
<?php do_action( 'jet-form-builder/after-field', $this ); ?>
</div>
<?php // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
2 changes: 2 additions & 0 deletions templates/fields/text-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
?>
<div class="jet-form-builder__field-wrap">
<?php do_action( 'jet-form-builder/before-field', $this ); ?>
<input <?php $this->render_attributes_string(); ?>>
<?php do_action( 'jet-form-builder/after-field', $this ); ?>
</div>
<?php // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
2 changes: 2 additions & 0 deletions templates/fields/textarea-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
?>
<div class="jet-form-builder__field-wrap">
<?php do_action( 'jet-form-builder/before-field', $this ); ?>
<textarea <?php $this->render_attributes_string(); ?>><?php echo $this->has_attribute( 'data-value' ) ? '' : esc_textarea( $args['default'] ); ?></textarea>
<?php do_action( 'jet-form-builder/after-field', $this ); ?>
</div>
<?php // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
2 changes: 2 additions & 0 deletions templates/fields/time-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@
);
}
?>
<?php do_action( 'jet-form-builder/before-field', $this ); ?>
<input <?php $this->render_attributes_string(); ?>>
<?php do_action( 'jet-form-builder/after-field', $this ); ?>
<?php
Loading