<?php
pxl_add_custom_widget(
    array(
        'name' => 'pxl_circular_text',
        'title' => esc_html__('Case Circular Text', 'solarva' ),
        'icon' => 'eicon-animation-text',
        'categories' => array('pxltheme-core'),
        'scripts' => [
            'solarva-circular-text',
            'circletype'
        ],
        'params' => array(
            'sections' => array(
                array(
                    'name' => 'tab_content',
                    'label' => esc_html__('Content', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                    'controls' => array(
                        array(
                            'name' => 'text',
                            'label' => esc_html__('Text', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::TEXTAREA,
                            'rows' => 2,
                        ),
                        array(
                            'name' => 'radius',
                            'label' => esc_html__('Radius', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::NUMBER,
                            'default' => 115,
                        ),
                        array(
                            'name' => 'image',
                            'label' => esc_html__('Upload', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::MEDIA,
                        ),
                    ),
                ),
                array(
                    'name' => 'tab_style',
                    'label' => esc_html__('General', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'bg_color',
                            'label' => esc_html__('Background Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-circular-text .pxl-item--inner' => 'background-color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'padding',
                            'label' => esc_html__( 'Padding', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::DIMENSIONS,
                            'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-circular-text .pxl-item--inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),
                    ),
                ),
                array(
                    'name' => 'tab_style_text',
                    'label' => esc_html__('Text', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'text_color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-circular-text .pxl-item--inner .pxl-item--text' => 'color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'text_typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group',
                            'selector' => '{{WRAPPER}} .pxl-circular-text .pxl-item--inner .pxl-item--text',
                        ),
                        array(
                            'name' => 'is_spin_text',
                            'label' => esc_html__('Spin', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SWITCHER,
                            'default' => '',
                        ),
                        array(
                            'name' => 'spin_text_dir',
                            'label' => esc_html__('Spin Dir', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'default' => 'cw',
                            'options' => [
                                'cw' => esc_html__('CW', 'solarva'),
                                'ccw' => esc_html__('CCW', 'solarva'),
                            ],
                            'condition' => [
                                'is_spin_text!' => '', 
                            ],
                        ),
                        array(
                            'name' => 'spin_text_duration',
                            'label' => esc_html__('Duration', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::NUMBER,
                            'description' => esc_html__('Unit default is second(s)', 'solarva'),
                            'condition' => [
                                'is_spin_text!' => '', 
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-circular-text .pxl-item--inner .pxl-item--text > div' => 'animation-duration: {{VALUE}}s',
                            ],
                        ),
                    ),
                ),

                array(
                    'name' => 'tab_style_image',
                    'label' => esc_html__('Image', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'image_width',
                            'label' => esc_html__('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-circular-text .pxl-item--inner img' => 'width: {{SIZE}}{{UNIT}};min-width: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'height',
                            'label' => esc_html__('Height', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-circular-text .pxl-item--inner img' => 'height: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                    ),
                ),
                solarva_widget_animation_settings(),
            ),
        ),
    ),
    solarva_get_class_widget_path()
);