<?php
/**
* Class: Jet_Elements_Progress_Bar
* Name: Progress Bar
* Slug: jet-progress-bar
*/
namespace Elementor;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Typography;
use Elementor\Repeater;
use Elementor\Scheme_Color;
use Elementor\Scheme_Typography;
use Elementor\Widget_Base;
use Elementor\Utils;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Jet_Elements_Progress_Bar extends Jet_Elements_Base {
public function get_name() {
return 'jet-progress-bar';
}
public function get_title() {
return esc_html__( 'Progress Bar', 'jet-elements' );
}
public function get_icon() {
return 'jet-elements-icon-progress-bar';
}
public function get_jet_help_url() {
return 'https://crocoblock.com/knowledge-base/articles/how-to-display-the-progress-on-elementor-built-pages-with-jetelements-progress-bar-and-circle-progress-widgets/';
}
public function get_categories() {
return array( 'cherry' );
}
public function get_script_depends() {
return array( 'jet-anime-js' );
}
protected function _register_controls() {
$css_scheme = apply_filters(
'jet-elements/progress-bar/css-scheme',
array(
'instance' => '.jet-progress-bar',
'title' => '.jet-progress-bar__title',
'title_icon' => '.jet-progress-bar__title-icon',
'title_text' => '.jet-progress-bar__title-text',
'progress_wrapper' => '.jet-progress-bar__wrapper',
'status_bar' => '.jet-progress-bar__status-bar',
'percent' => '.jet-progress-bar__percent',
)
);
$this->start_controls_section(
'section_progress',
array(
'label' => esc_html__( 'Progress Bar', 'jet-elements' ),
)
);
$this->add_control(
'progress_type',
array(
'label' => esc_html__( 'Type', 'jet-elements' ),
'type' => Controls_Manager::SELECT,
'default' => 'type-1',
'options' => array(
'type-1' => esc_html__( 'Inside the bar', 'jet-elements' ),
'type-2' => esc_html__( 'Placed above ', 'jet-elements' ),
'type-3' => esc_html__( 'Shown as tip', 'jet-elements' ),
'type-4' => esc_html__( 'On the right', 'jet-elements' ),
'type-5' => esc_html__( 'Inside the empty bar', 'jet-elements' ),
'type-6' => esc_html__( 'Inside the bar with title', 'jet-elements' ),
'type-7' => esc_html__( 'Inside the vertical bar', 'jet-elements' ),
),
)
);
$this->add_control(
'title',
array(
'label' => esc_html__( 'Title', 'jet-elements' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter your title', 'jet-elements' ),
'default' => esc_html__( 'Title', 'jet-elements' ),
'label_block' => true,
'dynamic' => array( 'active' => true ),
)
);
$this->_add_advanced_icon_control(
'icon',
array(
'label' => esc_html__( 'Icon', 'jet-elements' ),
'type' => Controls_Manager::ICON,
'label_block' => true,
'file' => '',
)
);
$this->add_control(
'percent',
array(
'label' => esc_html__( 'Percentage', 'jet-elements' ),
'type' => Controls_Manager::NUMBER,
'default' => 50,
'min' => 0,
'max' => 100,
'dynamic' => version_compare( ELEMENTOR_VERSION, '2.7.0', '>=' ) ?
array(
'active' => true,
'categories' => array(
TagsModule::POST_META_CATEGORY,
TagsModule::NUMBER_CATEGORY,
),
) : array(),
)
);
$this->end_controls_section();
/**
* Progress Bar Style Section
*/
$this->_start_controls_section(
'section_progress_style',
array(
'label' => esc_html__( 'Progress Bar', 'jet-elements' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
)
);
$this->_add_responsive_control(
'progress_wrapper_height',
array(
'label' => esc_html__( 'Progress Height', 'jet-elements' ),
'type' => Controls_Manager::SLIDER,
'size_units' => array(
'px',
),
'range' => array(
'px' => array(
'min' => 1,
'max' => 500,
),
),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['progress_wrapper'] => 'height: {{SIZE}}{{UNIT}}',
),
),
25
);
$this->_add_responsive_control(
'progress_wrapper_width',
array(
'label' => esc_html__( 'Progress Width', 'jet-elements' ),
'type' => Controls_Manager::SLIDER,
'size_units' => array(
'px',
),
'range' => array(
'px' => array(
'min' => 1,
'max' => 200,
),
),
'condition' => array(
'progress_type' => array( 'type-7' ),
),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['progress_wrapper'] => 'width: {{SIZE}}{{UNIT}}',
),
),
25
);
$this->_add_responsive_control(
'progress_wrapper_margin',
array(
'label' => esc_html__( 'Margin', 'jet-elements' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%' ),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['progress_wrapper'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
),
50
);
$this->_add_group_control(
Group_Control_Background::get_type(),
array(
'name' => 'progress_wrapper_background',
'selector' => '{{WRAPPER}} ' . $css_scheme['progress_wrapper'],
),
25
);
$this->_add_group_control(
Group_Control_Border::get_type(),
array(
'name' => 'progress_wrapper_border',
'label' => esc_html__( 'Border', 'jet-elements' ),
'placeholder' => '1px',
'default' => '1px',
'selector' => '{{WRAPPER}} ' . $css_scheme['progress_wrapper'],
),
75
);
$this->_add_responsive_control(
'progress_wrapper_border_radius',
array(
'label' => esc_html__( 'Border Radius', 'jet-elements' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%' ),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['progress_wrapper'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
),
75
);
$this->_add_group_control(
Group_Control_Box_Shadow::get_type(),
array(
'name' => 'progress_wrapper_box_shadow',
'selector' => '{{WRAPPER}} ' . $css_scheme['progress_wrapper'],
),
100
);
$this->_add_control(
'status_bar_heading',
array(
'label' => esc_html__( 'Status Bar', 'jet-elements' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
),
25
);
$this->_add_group_control(
Group_Control_Background::get_type(),
array(
'name' => 'status_bar_background',
'selector' => '{{WRAPPER}} ' . $css_scheme['status_bar'],
),
25
);
$this->_add_responsive_control(
'status_bar_border_radius',
array(
'label' => esc_html__( 'Border Radius', 'jet-elements' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%' ),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['status_bar'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
),
75
);
$this->_end_controls_section();
/**
* Title Style Section
*/
$this->_start_controls_section(
'section_title_style',
array(
'label' => esc_html__( 'Title', 'jet-elements' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
)
);
$this->_add_responsive_control(
'title_alignment',
array(
'label' => esc_html__( 'Title Alignment', 'jet-elements' ),
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'default' => '',
'options' => array(
'flex-start' => array(
'title' => esc_html__( 'Start', 'jet-elements' ),
'icon' => ! is_rtl() ? 'eicon-h-align-left' : 'eicon-h-align-right',
),
'center' => array(
'title' => esc_html__( 'Center', 'jet-elements' ),
'icon' => 'eicon-h-align-center',
),
'flex-end' => array(
'title' => esc_html__( 'End', 'jet-elements' ),
'icon' => ! is_rtl() ? 'eicon-h-align-right' : 'eicon-h-align-left',
),
),
'condition' => array(
'progress_type' => array( 'type-1', 'type-2', 'type-3', 'type-5' ),
),
'selectors' => array(
'{{WRAPPER}} '. $css_scheme['title'] => 'align-self: {{VALUE}};',
),
),
50
);
$this->_add_group_control(
Group_Control_Background::get_type(),
array(
'name' => 'title_background',
'selector' => '{{WRAPPER}} ' . $css_scheme['title'],
),
75
);
$this->_add_group_control(
Group_Control_Border::get_type(),
array(
'name' => 'title_border',
'label' => esc_html__( 'Border', 'jet-elements' ),
'placeholder' => '1px',
'default' => '1px',
'selector' => '{{WRAPPER}} ' . $css_scheme['title'],
),
75
);
$this->_add_responsive_control(
'title_border_radius',
array(
'label' => __( 'Border Radius', 'jet-elements' ),
Loading ...