<?php
// Register Fancy Box Widget
pxl_add_custom_widget(
    array(
        'name'       => 'pxl_fancy_box',
        'title'      => esc_html__( 'BR Fancy Box', 'breeza' ),
        'icon'       => 'eicon-icon-box',
        'categories' => array('pxltheme-core'),
        'scripts'    => array(
            'pxl-tilt',
        ),
        'params' => array(
            'sections' => array(
                array(
                    'name'     => 'layout_section',
                    'label'    => esc_html__( 'Layout', 'breeza' ),
                    'tab'      => 'layout',
                    'controls' => array(
                        array(
                            'name'    => 'layout',
                            'label'   => esc_html__( 'Templates', 'breeza' ),
                            'type'    => 'layoutcontrol',
                            'default' => '1',
                            'options' => [
                                '1' => [
                                    'label' => esc_html__( 'Layout 1', 'breeza' ),
                                    'image' => get_template_directory_uri() . '/elements/widgets/img-layout/pxl_fancy_box/layout1.jpg'
                                ],
                                '2' => [
                                    'label' => esc_html__( 'Layout 2', 'breeza' ),
                                    'image' => get_template_directory_uri() . '/elements/widgets/img-layout/pxl_fancy_box/layout2.jpg'
                                ],
                                '3' => [
                                    'label' => esc_html__( 'Layout 3', 'breeza' ),
                                    'image' => get_template_directory_uri() . '/elements/widgets/img-layout/pxl_fancy_box/layout3.jpg'
                                ],
                                '4' => [
                                    'label' => esc_html__( 'Layout 4', 'breeza' ),
                                    'image' => get_template_directory_uri() . '/elements/widgets/img-layout/pxl_fancy_box/layout4.jpg'
                                ],
                            ],
                            'prefix_class' => 'pxl-fancybox-layout-'
                        )
                    )
                ),
                array(
                    'name'     => 'content_section',
                    'label'    => esc_html__( 'Content', 'breeza' ),
                    'tab'      => 'content',
                    'controls' => array(
                        array(
                            'name' => 'style',
                            'label' => esc_html__('Style', 'breeza' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'options' => [
                                'style1' => 'Default',
                                'style2' => 'Style 2',
                            ],
                            'condition' => ['layout' => '1'],
                            'default' => 'style1',
                        ),
                        array(
                            'name' => 'image',
                            'label' => esc_html__( 'Image', 'breeza' ),
                            'type' => \Elementor\Controls_Manager::MEDIA,
                            'condition' => [
                                'layout' => '2',
                            ],
                        ),
                        array(
                            'name' => 'icon_type',
                            'label' => esc_html__('Icon Type', 'breeza' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'options' => [
                                'icon' => 'Icon',
                                'image' => 'Image',
                            ],
                            'default' => 'icon',
                        ),
                        array(
                            'name' => 'pxl_icon',
                            'label' => esc_html__('Icon', 'breeza' ),
                            'type' => \Elementor\Controls_Manager::ICONS,
                            'fa4compatibility' => 'icon',
                            'condition' => [
                                'icon_type' => 'icon',
                            ],
                        ),
                        array(
                            'name' => 'icon_image',
                            'label' => esc_html__( 'Icon Image', 'breeza' ),
                            'type' => \Elementor\Controls_Manager::MEDIA,
                            'condition' => [
                                'icon_type' => 'image',
                            ],
                        ),
                        array(
                            'name'     => 'number',
                            'label'    => esc_html__('Number', 'breeza'),
                            'type'     => 'textarea',
                            'default'  => esc_html__('01', 'breeza'),
                            'condition' => [
                                'layout'    => ['3','4']                            
                            ],
                        ),
                        array(
                            'name'     => 'title',
                            'label'    => esc_html__('Title', 'breeza'),
                            'type'     => 'textarea',
                            'default'  => esc_html__('Your Title', 'breeza')
                        ),
                        array(
                            'name'     => 'desc',
                            'label'    => esc_html__('Description', 'breeza'),
                            'type'     => 'textarea',
                            'default'  => esc_html__('Mauris dignissim lacus purus, sed rhoncus risus facilisis eu. Phasellus ullamcorper', 'breeza'),
                            'condition' => [
                                'layout'    => ['1','3','4']                            
                            ],
                        ),
                        array(
                            'name' => 'link_text',
                            'label' => esc_html__('Button Text', 'breeza' ),
                            'type' => \Elementor\Controls_Manager::TEXT,
                            'label_block' => true,
                            'default' => 'Choose A Server',
                        ),
                        array(
                            'name'        => 'hyper_link',
                            'label'       => esc_html__( 'Custom Link', 'breeza' ),
                            'type'        => 'url',
                            'placeholder' => esc_html__( 'https://your-link.com', 'breeza' ),
                            'default'     => [
                                'url'         => '#',
                                'is_external' => 'on'
                            ],
                            'condition' => [
                                'layout'    => ['1','2','3','4']                            
                            ] 
                        ),
                        array(
                            'name' => 'is_active',
                            'label' => esc_html__('Is Active?', 'breeza' ),
                            'type'      => 'switcher',
                            'condition' => [
                                'layout'      => ['1']  
                            ]
                        ),
                    )
),
array(
    'name'     => 'style_section',
    'label'    => esc_html__( 'Style', 'breeza' ),
    'tab'      => 'style',
    'controls' => array_merge(
        array(
            array(
                'name' => 'box_padding',
                'label' => esc_html__('Padding', 'breeza' ),
                'type' => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units' => [ 'px' ],
                'selectors' => [
                    '{{WRAPPER}} .pxl-fancybox-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
                'control_type' => 'responsive',
            ),
            array(
                'name' => 'box_padding_back',
                'label' => esc_html__('Padding Backdrop', 'breeza' ),
                'type' => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units' => [ 'px' ],
                'selectors' => [
                    '{{WRAPPER}} .pxl-fancybox-content.pxl-item--backdrop' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
                'control_type' => 'responsive',
            ),
            array(
                'name' => 'text_align',
                'label' => esc_html__( 'Alignment', 'breeza' ),
                'type' => \Elementor\Controls_Manager::CHOOSE,
                'control_type' => 'responsive',
                'options' => [
                    'start' => [
                        'title' => esc_html__( 'Start', 'breeza' ),
                        'icon' => 'eicon-text-align-left',
                    ],
                    'center' => [
                        'title' => esc_html__( 'Center', 'breeza' ),
                        'icon' => 'eicon-text-align-center',
                    ],
                    'end' => [
                        'title' => esc_html__( 'End', 'breeza' ),
                        'icon' => 'eicon-text-align-right',
                    ]
                ],
                'selectors' => [
                    '{{WRAPPER}} .pxl-fancybox-wrap' => 'justify-content: {{VALUE}};',
                    '{{WRAPPER}} .pxl-fancybox-wrap' => 'text-align: {{VALUE}};',
                ],
            ),
            array(
                'name'         => 'box_gradient',
                'label' => esc_html__( 'Background Type', 'breeza' ),
                'type'         => \Elementor\Group_Control_Background::get_type(),
                'control_type' => 'group',
                'types' => [ 'gradient' ],
                'selector'     => '{{WRAPPER}} .pxl-fancybox-wrap .pxl-fancybox-content',
            ),
            array(
                'name' => 'border_type',
                'label' => esc_html__( 'Border Type', 'breeza' ),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => [
                    '' => esc_html__( 'None', 'breeza' ),
                    'solid' => esc_html__( 'Solid', 'breeza' ),
                    'double' => esc_html__( 'Double', 'breeza' ),
                    'dotted' => esc_html__( 'Dotted', 'breeza' ),
                    'dashed' => esc_html__( 'Dashed', 'breeza' ),
                    'groove' => esc_html__( 'Groove', 'breeza' ),
                ],
                'selectors' => [
                    '{{WRAPPER}} .pxl-fancybox-wrap .pxl-fancybox-content' => 'border-style: {{VALUE}};',
                ],
            ),
            array(
                'name' => 'border_width',
                'label' => esc_html__( 'Border Width', 'breeza' ),
                'type' => \Elementor\Controls_Manager::DIMENSIONS,
                'selectors' => [
                    '{{WRAPPER}} .pxl-fancybox-wrap .pxl-fancybox-content' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
                'condition' => [
                    'border_type!' => '',
                ],
                'responsive' => true,
            ),
            array(
                'name' => 'border_color',
                'label' => esc_html__( 'Border Color', 'breeza' ),
                'type' => \Elementor\Controls_Manager::COLOR,
                'default' => '',
                'selectors' => [
                    '{{WRAPPER}} .pxl-fancybox-wrap .pxl-fancybox-content' => 'border-color: {{VALUE}};',
                ],
                'condition' => [
                    'border_type!' => '',
                ],
            ),
            array(
                'name' => 'icon_font_size',
                'label' => esc_html__('Font Size', 'breeza' ),
                'type' => \Elementor\Controls_Manager::SLIDER,
                'control_type' => 'responsive',
                'size_units' => [ 'px' ],
                'range' => [
                    'px' => [
                        'min' => 0,
                        'max' => 300,
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}} .pxl-fancybox-content .pxl-item--icon i' => 'font-size: {{SIZE}}{{UNIT}};',
                ],
            ),
            array(
                'name' => 'number_color',
                'label' => esc_html__('Number Color', 'breeza' ),
                'type' => \Elementor\Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .pxl-fancybox-content .pxl-item--number' => 'color: {{VALUE}};',
                ],
            ), 
            array(
                'name' => 'Iicon_color',
                'label' => esc_html__('Icon Color', 'breeza' ),
                'type' => \Elementor\Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .pxl-fancybox-content .pxl-item--icon i' => 'color: {{VALUE}};',
                ],
            ), 
            array(
                'name' => 'Icon_color',
                'label' => esc_html__('Icon Background', 'breeza' ),
                'type' => \Elementor\Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .pxl-fancybox-content .pxl-item--icon' => 'background-color: {{VALUE}};',
                ],
            ), 
            array(
                'name'         => 'icon_box_shadow',
                'label' => esc_html__( 'Icon Box Shadow', 'breeza' ),
                'type'         => \Elementor\Group_Control_Box_Shadow::get_type(),
                'control_type' => 'group',
                'selector'     => '{{WRAPPER}} .pxl-fancybox-content .pxl-item--icon',
            ),
            array(
                'name' => 'iocn_space_bottom',
                'label' => esc_html__('Icon Bottom Spacer', 'breeza' ),
                'type' => \Elementor\Controls_Manager::SLIDER,
                'control_type' => 'responsive',
                'size_units' => [ 'px' ],
                'range' => [
                    'px' => [
                        'min' => 0,
                        'max' => 300,
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}} .pxl-fancybox-content .pxl-item--icon' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                ],
            ),
            array(
                'name' => 'sub_title_color',
                'label' => esc_html__('Sub Title Color', 'breeza' ),
                'type' => \Elementor\Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .sub-title' => 'color: {{VALUE}};',
                ],
            ), 
            array(
                'name' => 'title_color',
                'label' => esc_html__('Title Color', 'breeza' ),
                'type' => \Elementor\Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .title' => 'color: {{VALUE}};',
                ],
            ), 
            array(
                'name' => 'title_typography',
                'label' => esc_html__('Title Typography', 'breeza' ),
                'type' => \Elementor\Group_Control_Typography::get_type(),
                'control_type' => 'group',
                'selector' => '{{WRAPPER}} .pxl-fancybox-content .title',
            ),
            array(
                'name' => 'title_space_bottom',
                'label' => esc_html__('Title Bottom Spacer', 'breeza' ),
                'type' => \Elementor\Controls_Manager::SLIDER,
                'control_type' => 'responsive',
                'size_units' => [ 'px' ],
                'range' => [
                    'px' => [
                        'min' => 0,
                        'max' => 300,
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}} .pxl-fancybox-content .title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                ],
            ),
            array(
                'name' => 'desc_color',
                'label' => esc_html__('Description Color', 'breeza' ),
                'type' => \Elementor\Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .desc' => 'color: {{VALUE}};',
                ],
            ), 
            array(
                'name' => 'desc_typography',
                'label' => esc_html__('Desc Typography', 'breeza' ),
                'type' => \Elementor\Group_Control_Typography::get_type(),
                'control_type' => 'group',
                'selector' => '{{WRAPPER}} .pxl-fancybox-content .desc',
            ),
            array(
                'name' => 'desc_space_bottom',
                'label' => esc_html__('Desc Bottom Spacer', 'breeza' ),
                'type' => \Elementor\Controls_Manager::SLIDER,
                'control_type' => 'responsive',
                'size_units' => [ 'px' ],
                'range' => [
                    'px' => [
                        'min' => 0,
                        'max' => 300,
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}} .pxl-fancybox-content .desc' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                ],
            ),
        )
)
),
array(
    'name'     => 'animation_section',
    'label'    => esc_html__( 'Animation', 'breeza' ),
    'tab'      => 'style',
    'controls' => array_merge(
        breeza_elementor_animation_opts([
            'name'   => 'title',
            'label' => esc_html__('Title', 'breeza'),
        ]),
        breeza_elementor_animation_opts([
            'name'   => 'icon',
            'label' => esc_html__('Icon', 'breeza'),
        ]),
        breeza_elementor_animation_opts([
            'name'   => 'desc',
            'label' => esc_html__('Description', 'breeza'),
        ])
    )
),

)
)
),
breeza_get_class_widget_path()
);