<?php
pxl_add_custom_widget(
    array(
        'name' => 'pxl_workflow_steps',
        'title' => esc_html__('Case Workflow Steps', 'solarva' ),
        'icon' => 'eicon-flow',
        'categories' => array('pxltheme-core'),
        'scripts' => array(
            'swiper',
            'pxl-swiper',
        ),
        'params' => array(
            'sections' => array(
                array(
                    'name' => 'tab_layout',
                    'label' => esc_html__('Layout', 'solarva'),
                    'tab' => \Elementor\Controls_Manager::TAB_LAYOUT,
                    'controls' => array(
                        array(
                            'name' => 'layout',
                            'label' => esc_html__('Layout', 'solarva'),
                            'type' => 'layoutcontrol',
                            'default' => '1',
                            'options' => array(
                                '1' => array(
                                    'label' => esc_html__('Style 1', 'solarva'),
                                    'image' => get_template_directory_uri() . '/elements/assets/img/pxl_workflow_steps/wf1.jpg',
                                ),
                                '2' => array(
                                    'label' => esc_html__('Style 2', 'solarva'),
                                    'image' => get_template_directory_uri() . '/elements/assets/img/pxl_workflow_steps/wf2.jpg',
                                ),
                            ),
                        ),
                    ),
                ),
                array(
                    'name' => 'section_content',
                    'label' => esc_html__('Items', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                    'controls' => array(
                        array(
                            'name' => 'items',
                            'label' => esc_html__('Content', 'solarva'),
                            'type' => \Elementor\Controls_Manager::REPEATER,
                            'controls' => array(
                                array(
                                    'name' => 'image',
                                    'label' => esc_html__('Upload', 'solarva' ),
                                    'type' => \Elementor\Controls_Manager::MEDIA,
                                ),
                                array(
                                    'name' => 'title',
                                    'label' => esc_html__('Title', 'solarva' ),
                                    'type' => \Elementor\Controls_Manager::TEXT,
                                    'label_block' => true,
                                ),
                                array(
                                    'name' => 'desc',
                                    'label' => esc_html__('Description', 'solarva' ),
                                    'type' => \Elementor\Controls_Manager::TEXTAREA,
                                    'rows' => 3,
                                ),
                                array(
                                    'name' => 'item_spaing_top',
                                    'label' => esc_html__('Top', 'solarva' ),
                                    'type' => \Elementor\Controls_Manager::SLIDER,
                                    'control_type' => 'responsive',
                                    'size_units' => [ 'px', '%', 'em', 'rem', 'cusstom' ],
                                    'range' => [
                                        'px' => [
                                            'min' => 0,
                                            'max' => 1000,
                                        ],
                                    ],
                                    'selectors' => [
                                        '{{WRAPPER}} .pxl-workflow-steps .pxl-item--steps {{CURRENT_ITEM}}' => 'margin-top: {{SIZE}}{{UNIT}};',
                                    ],
                                ),
                            ),
                            'title_field' => '{{{ title }}}',
                        ),
                    ),
                ),
                solarva_grid_settings(false, ['layout' => '2']),
                solarva_carousel_settings( ['layout' => '2']),
                array(
                    'name' => 'tab_style_general',
                    'label' => esc_html__('General', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'justify_content_h',
                            'label' => esc_html__('Justify Content', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::CHOOSE,
                            'label_block' => true,
                            'control_type' => 'responsive', 
                            'options' => [
                                'start' =>  [
                                    'title' => esc_html__('Start', 'solarva'),
                                    'icon' => 'eicon-align-start-h',
                                ],
                                'center' =>  [
                                    'title' => esc_html__('Center', 'solarva'),
                                    'icon' => 'eicon-align-center-h',
                                ],
                                'end' =>  [
                                    'title' => esc_html__('End', 'solarva'),
                                    'icon' => 'eicon-align-end-h',
                                ],
                                'space-around' =>  [
                                    'title' => esc_html__('Space Around', 'solarva'),
                                    'icon' => 'eicon-justify-space-around-h',
                                ],
                                'space-between' =>  [
                                    'title' => esc_html__('Space Between', 'solarva'),
                                    'icon' => 'eicon-justify-space-between-h',
                                ],
                                'space-evenly' =>  [
                                    'title' => esc_html__('Space Evenly', 'solarva'),
                                    'icon' => 'eicon-justify-space-evenly-h',
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps.pxl-workflow-steps1 .pxl-item--steps' => 'justify-content: {{VALUE}};'
                            ],
                            'condition' => [
                                'layout' => '1',
                            ],
                        ),
                        array(
                            'name' => 'gap',
                            'label' => esc_html__('Gap', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps.pxl-workflow-steps1 .pxl-item--steps' => 'gap: {{SIZE}}{{UNIT}};',
                                '{{WRAPPER}} .pxl-workflow-steps.pxl-workflow-steps2' => '--x: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'item_width',
                            'label' => esc_html__('Item Width', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps.pxl-workflow-steps1 .pxl-item--steps' => '--width: {{SIZE}}{{UNIT}};',
                            ],
                            'condition' => [
                                'layout' => '1',
                            ],
                        ),

                        array(
                            'name' => 'svg_martrix_color',
                            'label' => esc_html__('SVG Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps.pxl-workflow-steps1 .pxl-martrix-dots path' => 'fill: {{VALUE}};',
                            ],
                            'condition' => [
                                'layout' => '1',
                            ],
                        ),
                    ),
                ),

                array(
                    'name' => 'tab_style_image',
                    'label' => esc_html__('Image', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'img_max_width',
                            'label' => esc_html__('Max Width', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps.pxl-workflow-steps1 .pxl-item--image img' => 'max-width: {{SIZE}}{{UNIT}};',
                            ],
                            'condition' => [
                                'layout' => '1',
                            ],
                        ),
                        array(
                            'name'         => 'image_border',
                            'label' => esc_html__( 'Border', 'solarva' ),
                            'type'         => \Elementor\Group_Control_Border::get_type(),
                            'control_type' => 'group',
                            'selector'     => '{{WRAPPER}} .pxl-workflow-steps .pxl-item--image img',
                        ),
                        array(
                            'name' => 'img_box_size',
                            'label' => esc_html__('Box Size', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps.pxl-workflow-steps2 .pxl-item--image img' => '--size: {{SIZE}}{{UNIT}};',
                            ],
                            'condition' => [
                                'layout' => '2',
                            ],
                        ),
                        array(
                            'name' => 'img_padding',
                            'label' => esc_html__( 'Padding', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::DIMENSIONS,
                            'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--image' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'img_border_radius',
                            'label' => esc_html__( 'Border Radius', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::DIMENSIONS,
                            'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps.pxl-workflow-steps1 .pxl-item--image, 
                                {{WRAPPER}} .pxl-workflow-steps.pxl-workflow-steps2 .pxl-item--image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),

                        array(
                            'name' => 'img_spacing_bottom',
                            'label' => esc_html__('Spacing Bottom', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--image' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                    ),
                ),

                array(
                    'name' => 'tab_title_style',
                    'label' => esc_html__('Title', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array( 
                        array(
                            'name' => 'title_color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--title' => 'color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'title_typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group', 
                            'selector' => '{{WRAPPER}} .pxl-workflow-steps .pxl-item--title',
                        ),
                        array(
                            'name' => 'title_spacing_bottom',
                            'label' => esc_html__('Spacing Bottom', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                    ),

                ),

                array(
                    'name' => 'tab_desc_style',
                    'label' => esc_html__('Description', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array( 
                        array(
                            'name' => 'desc_color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--desc' => 'color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'desc_typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group', 
                            'selector' => '{{WRAPPER}} .pxl-workflow-steps .pxl-item--desc',
                        ),
                        
                    ),
                ),

                array(
                    'name' => 'tab_index_style',
                    'label' => esc_html__('Index', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array( 
                        array(
                            'name' => 'index1_opts',
                            'label' => esc_html__('INDEX 1', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::HEADING,
                            'separator' => 'after',
                        ),
                        array(
                            'name' => 'index_color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--index' => 'color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'index_bg_color',
                            'label' => esc_html__('Background Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--index' => 'background-color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'index_typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group', 
                            'selector' => '{{WRAPPER}} .pxl-workflow-steps .pxl-item--index',
                        ),
                        array(
                            'name' => 'index_box_size',
                            'label' => esc_html__('Box Size', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--index' => '--size: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'index_border_radius',
                            'label' => esc_html__( 'Border Radius', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::DIMENSIONS,
                            'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--index' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),

                        array(
                            'name' => 'index2_divider',
                            'type' => \Elementor\Controls_Manager::DIVIDER,
                            'condition' => [
                                'layout' => '1',
                            ],
                        ),
                        array(
                            'name' => 'index2_opts',
                            'label' => esc_html__('INDEX 2', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::HEADING,
                            'separator' => 'after',
                            'condition' => [
                                'layout' => '1',
                            ],
                        ),
                        array(
                            'name' => 'index2_color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps.pxl-workflow-steps1 .pxl-item--group::after' => 'color: {{VALUE}};',
                            ],
                            'condition' => [
                                'layout' => '1',
                            ],
                        ),
                        array(
                            'name' => 'index2_typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group', 
                            'selector' => '{{WRAPPER}} .pxl-workflow-steps.pxl-workflow-steps1 .pxl-item--group::after',
                            'condition' => [
                                'layout' => '1',
                            ],
                        ),
                    ),
                ),


                array(
                    'name' => 'tab_curve_style',
                    'label' => esc_html__('Curve', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array( 
                        array(
                            'name' => 'curve_color',
                            'label' => esc_html__('Stroke Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--curve path' => 'stroke: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'curve_width_size',
                            'label' => esc_html__('Stroke Width', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--curve path' => 'stroke-width: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(                            
                            'name' => 'h_orientation',
                            'label' => esc_html__('Horizontal Orientation', 'solarva'),
                            'type' => \Elementor\Controls_Manager::CHOOSE,
                            'control_type' => 'responsive',
                            'options' => [
                                'left' => [
                                    'label' => esc_html__('Left', 'solarva'), 
                                    'icon' => 'eicon-h-align-left'
                                ],
                                'right' => [
                                    'label' => esc_html__('Right', 'solarva'), 
                                    'icon' => 'eicon-h-align-right'
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--curve' => '{{VALUE}}: 0;',
                            ],
                        ),
                        array(
                            'name' => 'offset_left',
                            'label' => esc_html__('Left', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px','%','em','rem', 'custom' ],
                            'control_type' => 'responsive',
                            'default' => [
                                'unit' => 'px',
                                'size' => 0,
                            ],
                            'range' => [
                                'px' => [
                                    'min' => 1,
                                    'max' => 1000,
                                ],
                            ],
                            'condition' => [
                                'h_orientation' => 'left',
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--curve' => 'left: {{SIZE}}{{UNIT}};right: auto;',
                            ],
                        ),
                        array(
                            'name' => 'offset_right',
                            'label' => esc_html__('Right', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px','%','em','rem', 'custom' ],
                            'control_type' => 'responsive',
                            'default' => [
                                'unit' => 'px',
                                'size' => 0,
                            ],
                            'range' => [
                                'px' => [
                                    'min' => 1,
                                    'max' => 1000,
                                ],
                            ],
                            'condition' => [
                                'h_orientation' => 'right',
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--curve' => 'right: {{SIZE}}{{UNIT}}; left: auto;',
                            ],
                        ),
                        array(                            
                            'name' => 'v_orientation',
                            'label' => esc_html__('Vertical Orientation', 'solarva'),
                            'type' => \Elementor\Controls_Manager::CHOOSE,
                            'control_type' => 'responsive',
                            'options' => [
                                'top' => [
                                    'label' => esc_html__('Top', 'solarva'), 
                                    'icon' => 'eicon-v-align-top'
                                ],
                                'bottom' => [
                                    'label' => esc_html__('Bottom', 'solarva'), 
                                    'icon' => 'eicon-v-align-bottom'
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--curve' => '{{VALUE}}: 0;',
                            ],
                        ),
                        array(
                            'name' => 'offset_top',
                            'label' => esc_html__('Top', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px','%','em','rem', 'custom' ],
                            'control_type' => 'responsive',
                            'default' => [
                                'unit' => 'px',
                                'size' => 0,
                            ],
                            'range' => [
                                'px' => [
                                    'min' => 1,
                                    'max' => 1000,
                                ],
                            ],
                            'condition' => [
                                'v_orientation' => 'top',
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--curve' => 'top: {{SIZE}}{{UNIT}};bottom: auto;',
                            ],
                        ),
                        array(
                            'name' => 'offset_bottom',
                            'label' => esc_html__('Bottom', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px','%','em','rem', 'custom' ],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 1,
                                    'max' => 1000,
                                ],
                            ],
                            'default' => [
                                'unit' => 'px',
                                'size' => 0,
                            ],
                            'condition' => [
                                'v_orientation' => 'bottom',
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--curve' => 'bottom: {{SIZE}}{{UNIT}};top: auto;',
                            ],
                        ),
                        array(
                            'name' => 'translate',
                            'label' => esc_html__('Translate', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::TEXT,
                            'placeholder' => 'Ex: -50%, -50%',
                            'control_type' => 'responsive',
                            'description' => 'Enter value with syntax: (size_x)(unit_x), (size_y)(unit_y). Default -50%, -50%',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-workflow-steps .pxl-item--curve' => 'transform: translate({{VALUE}});',
                            ],
                        ),
                    ),
                ),
                solarva_widget_animation_settings(),

            ),
        ),
    ),
    solarva_get_class_widget_path()
);