<?php
pxl_add_custom_widget(
    array(
        'name' => 'pxl_switch_language',
        'title' => esc_html__('Case Switch Language', 'solarva' ),
        'icon' => 'eicon-globe',
        'categories' => array('pxltheme-core'),
        'params' => array(
            'sections' => array(
                array(
                    'name' => 'section_content',
                    'label' => esc_html__('Content', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                    'controls' => array(
                        array(
                            'name' => 'active',
                            'label' => esc_html__('Default Language', 'solarva'),
                            'type' => \Elementor\Controls_Manager::NUMBER,
                            'default' => 0,
                        ),
                        array(
                            'name' => 'languages',
                            'label' => esc_html__('Language', 'solarva'),
                            'type' => \Elementor\Controls_Manager::REPEATER,
                            'controls' => array(
                                array(
                                    'name' => 'language',
                                    'label' => esc_html__('Language', 'solarva' ),
                                    'type' => \Elementor\Controls_Manager::TEXT,
                                ),
                            ),
                            'title_field' => '{{{ language }}}',
                        ),
                    ),
                ),
                array(
                    'name' => 'section_style',
                    'label' => esc_html__('Style', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'label_typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group', 
                            'selector' => '{{WRAPPER}} .pxl-switch-language .pxl-btn-switch',
                        ),
                        array(
                            'name' => 'label_color',
                            'label' => esc_html__( 'Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-switch-language .pxl-btn-switch' => 'color: {{VALUE}}',
                            ],
                        ),
                        array(
                            'name' => 'icon_color',
                            'label' => esc_html__( 'Icon Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-switch-language .pxl-btn-switch svg path' => 'stroke: {{VALUE}}',
                            ],
                        ),
                        array(
                            'name' => 'icon_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-switch-language .pxl-btn-switch svg' => 'width: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'icon_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-switch-language .pxl-btn-switch svg' => 'height: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                    ),
                ),

                array(
                    'name' => 'tab_style_list_item',
                    'label' => esc_html__('List Item', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'background_color',
                            'label' => esc_html__( 'Box Background Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-switch-language .pxl-list--languages' => 'background-color: {{VALUE}}',
                            ],
                        ),
                        array(
                            'name' => 'content_padding',
                            'label' => esc_html__( 'Box Padding', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::DIMENSIONS,
                            'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-switch-language .pxl-list--languages' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'content_typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group', 
                            'selector' => '{{WRAPPER}} .pxl-switch-language .pxl-list--languages .pxl-item--language',
                        ),
                        array(
                            'name' => 'content_color',
                            'label' => esc_html__( 'Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-switch-language .pxl-list--languages .pxl-item--language' => 'color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'item_background_color',
                            'label' => esc_html__( 'Item Background Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-switch-language .pxl-list--languages .pxl-item--language' => 'background-color: {{VALUE}}',
                            ],
                        ),
                        array(
                            'name' => 'item_spacer',
                            'label' => esc_html__('Item Spacer', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-switch-language .pxl-list--languages .pxl-item--language + .pxl-item--language' => 'margin-top: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'item_padding',
                            'label' => esc_html__( 'Item Padding', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::DIMENSIONS,
                            'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-switch-language .pxl-list--languages .pxl-item--language' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'content_color_hover',
                            'label' => esc_html__( 'Color Hover/Active', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-switch-language .pxl-list--languages .pxl-item--language.current-language, 
                                {{WRAPPER}} .pxl-switch-language .pxl-list--languages .pxl-item--language:hover' => 'color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'item_background_color_hover_active',
                            'label' => esc_html__( 'Item Background Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-switch-language .pxl-list--languages .pxl-item--language.current-language, 
                                {{WRAPPER}} .pxl-switch-language .pxl-list--languages .pxl-item--language:hover' => 'background-color: {{VALUE}}',
                            ],
                        ),

                    ),
                ),

                solarva_widget_animation_settings(),
            ),
        ),
    ),
    solarva_get_class_widget_path()
);