<?php
pxl_add_custom_widget(
    array(
        'name' => 'pxl_particle',
        'title' => esc_html__('BR Particle', 'kaitex' ),
        'icon' => 'eicon-barcode',
        'categories' => array('pxltheme-core'),
        'scripts' => [
            'kaitex-particle',
            'kaitex-parallax',
        ],
        'params' => array(
            'sections' => array(
                array(
                    'name' => 'tab_content',
                    'label' => esc_html__('Content', 'kaitex'),
                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                    'controls' => array(
                        array(
                            'name' => 'particle',
                            'label' => esc_html__( 'Particle', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::MEDIA,
                            'condition' => [
                                'particle_effect!' => 'slide-draw-svg',
                            ],
                        ),
                        array(
                            'name' => 'pxl_icon',
                            'label' => esc_html__('SVG', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::ICONS,
                            'description' => esc_html__('Make sure choose correct svg', 'kaitex' ),
                            'condition' => [
                                'particle_effect' => 'slide-draw-svg',
                            ],
                        ),
                        array(
                            'name' => 'type_position',
                            'label' => esc_html__('Position', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'options' => [
                                'top-left' => 'Top Left',
                                'top-right' => 'Top Right',
                                'bottom-left' => 'Bottom Left',
                                'bottom-right' => 'Bottom Right',
                            ],
                            'default' => 'top-left',
                        ),
                        array(
                            'name' => 'top_position',
                            'label' => esc_html__('Top Position', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px', '%' ],
                            'control_type' => 'responsive',
                            'default' => [
                                'size' => 0,
                                'unit' => '%',
                            ],
                            'range' => [
                                'px' => [
                                    'min' => -3000,
                                    'max' => 3000,
                                ],
                                '%' => [
                                    'min' => -1000,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                'body {{WRAPPER}} .pxl-particle' => 'top: {{SIZE}}{{UNIT}};',
                            ],
                            'condition' => [
                                'type_position' => ['top-left', 'top-right'],
                            ],
                        ),
                        array(
                            'name' => 'left_position',
                            'label' => esc_html__('Left Position', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px', '%' ],
                            'control_type' => 'responsive',
                            'default' => [
                                'size' => 0,
                                'unit' => '%',
                            ],
                            'range' => [
                                'px' => [
                                    'min' => -3000,
                                    'max' => 3000,
                                ],
                                '%' => [
                                    'min' => -1000,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                'body {{WRAPPER}} .pxl-particle' => 'left: {{SIZE}}{{UNIT}};',
                            ],
                            'condition' => [
                                'type_position' => ['top-left','bottom-left'],
                            ],
                        ),
                        array(
                            'name' => 'bottom_position',
                            'label' => esc_html__('Bottom Position', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px', '%' ],
                            'control_type' => 'responsive',
                            'default' => [
                                'size' => 0,
                                'unit' => '%',
                            ],
                            'range' => [
                                'px' => [
                                    'min' => -3000,
                                    'max' => 3000,
                                ],
                                '%' => [
                                    'min' => -1000,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                'body {{WRAPPER}} .pxl-particle' => 'bottom: {{SIZE}}{{UNIT}};',
                            ],
                            'condition' => [
                                'type_position' => ['bottom-right','bottom-left'],
                            ],
                        ),
                        array(
                            'name' => 'right_position',
                            'label' => esc_html__('Right Position', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px', '%' ],
                            'control_type' => 'responsive',
                            'default' => [
                                'size' => 0,
                                'unit' => '%',
                            ],
                            'range' => [
                                'px' => [
                                    'min' => -3000,
                                    'max' => 3000,
                                ],
                                '%' => [
                                    'min' => -1000,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                'body {{WRAPPER}} .pxl-particle' => 'right: {{SIZE}}{{UNIT}};',
                            ],
                            'condition' => [
                                'type_position' => ['top-right', 'bottom-right'],
                            ],
                        ),
                        array(
                            'name' => 'width_particle',
                            'label' => esc_html__('Width', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px', '%' ],
                            'control_type' => 'responsive',
                            'default' => [
                                'unit' => '%',
                            ],
                            'range' => [
                                'px' => [
                                    'min' => -3000,
                                    'max' => 3000,
                                ],
                                '%' => [
                                    'min' => -1000,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                'body {{WRAPPER}} .pxl-particle' => 'width: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'height_particle',
                            'label' => esc_html__('Height', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px', '%' ],
                            'control_type' => 'responsive',
                            'default' => [
                                'unit' => '%',
                            ],
                            'range' => [
                                'px' => [
                                    'min' => -3000,
                                    'max' => 3000,
                                ],
                                '%' => [
                                    'min' => -1000,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                'body {{WRAPPER}} .pxl-particle' => 'height: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'particle_radius',
                            'label' => esc_html__('Border Radius', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::DIMENSIONS,
                            'size_units' => [ 'px', '%' ],
                            'default' => [
                                'unit' => '%',
                            ],
                            'range' => [
                                '%' => [
                                    'min' => 0,
                                    'max' => 100,
                                ],
                            ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                'body {{WRAPPER}} .pxl-particle .pxl-item--particle img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'particle_effect',
                            'label' => esc_html__('Effect', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'default' => '',
                            'options' => [
                                '' => 'None',
                                'move-parallax' => 'Parallax',
                                'slide-bottom-to-top' => 'Slide Bottom To Top',
                                'slide-top-to-bottom' => 'Slide Top To Bottom',
                                'slide-left-to-right' => 'Slide Left To Right',
                                'slide-right-to-left' => 'Slide Right To Left',
                                'zoomInOut' => 'Zoom In Out',
                                'rotated-circle-left' => 'Rotated Left',
                                'rotated-circle-right' => 'Rotated Right',
                                'slide-effect1' => 'Effect 1',
                                'slide-effect2' => 'Effect 2',
                                'slide-draw-svg' => 'Draw SVG',
                            ],
                        ),
                        array(
                            'name' => 'particle_transform',
                            'label' => esc_html__('Transform', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'control_type' => 'responsive',
                            'options' => [
                                ''                      => esc_html__( 'Default', 'kaitex' ),
                                'custom'                => esc_html__( 'Custom', 'kaitex' ),
                            ],
                            'default' => '',
                        ),
                        array(
                            'name' => 'particle_position_xpos',
                            'label' => esc_html__( 'X Position', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'responsive' => true,
                            'size_units' => [ 'px', 'em', '%', 'vw' ],
                            'default' => [
                                'unit' => '%',
                                'size' => 0,
                            ],
                            'range' => [
                                'px' => [
                                    'min' => -800,
                                    'max' => 800,
                                ],
                                'em' => [
                                    'min' => -100,
                                    'max' => 100,
                                ],
                                '%' => [
                                    'min' => -100,
                                    'max' => 100,
                                ],
                                'vw' => [
                                    'min' => -100,
                                    'max' => 100,
                                ],
                            ],
                            'condition' => [
                                'particle_transform' => 'custom',
                            ],
                            'required' => true,
                        ),
                        array(
                            'name' => 'particle_position_ypos',
                            'label' => esc_html__( 'Y Position', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'responsive' => true,
                            'size_units' => [ 'px', 'em', '%', 'vw' ],
                            'default' => [
                                'unit' => '%',
                                'size' => 0,
                            ],
                            'range' => [
                                'px' => [
                                    'min' => -800,
                                    'max' => 800,
                                ],
                                'em' => [
                                    'min' => -100,
                                    'max' => 100,
                                ],
                                '%' => [
                                    'min' => -100,
                                    'max' => 100,
                                ],
                                'vw' => [
                                    'min' => -100,
                                    'max' => 100,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-particle' => 'transform: translate({{particle_position_xpos.SIZE}}{{particle_position_xpos.UNIT}}, {{SIZE}}{{UNIT}});',
                            ],
                            'condition' => [
                                'particle_transform' => 'custom',
                            ],
                            'required' => true,
                        ),
                        array(
                            'name' => 'parallax_move',
                            'label' => esc_html__('Parallax Move', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::TEXT,
                            'condition' => [
                                'particle_effect' => 'move-parallax',
                            ],
                            'default' => '90',
                        ),
                        array(
                            'name' => 'pxl_animate',
                            'label' => esc_html__('Case Animate', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'options' => kaitex_widget_animate(),
                            'default' => '',
                        ),
                        array(
                            'name' => 'z-index',
                            'label' => esc_html__('Z-Index', 'kaitex' ),
                            'type' => \Elementor\Controls_Manager::NUMBER,
                            'control_type' => 'responsive',
                            'selectors' => [
                                'body {{WRAPPER}} .pxl-particle .pxl-item--particle' => 'z-index: {{VALUE}};',
                            ],
                        ),
                    ),
                ),
            ),
        ),
    ),
    kaitex_get_class_widget_path()
);