<?php
/**
 * Customizer fields for scroll-to-top settings.
 *
 * @package Eronex
 * @since   0.0.1
 */

use Kirki\Field\Color;
use Kirki\Field\Dimension;
use Kirki\Field\Dimensions;
use Kirki\Field\Radio_Buttonset;
use Kirki\Pro\Field\Divider;
use Kirki\Pro\Field\HeadlineToggle;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

new HeadlineToggle(
	array(
		'label'    => esc_html__( 'Scroll Top', 'eronex' ),
		'settings' => 'eronex_scroll_top_enable',
		'section'  => 'eronex_general_scroll_top',
		'default'  => true,
	)
);

new Divider(
	array(
		'settings' => 'eronex_scroll_top_icon_size_separator',
		'section'  => 'eronex_general_scroll_top',
		'choices'  => array(
			'color' => $separator_color,
		),
	),
);

new Dimension(
	array(
		'label'      => esc_html__( 'Icon Size', 'eronex' ),
		'settings'   => 'eronex_scroll_top_icon_size',
		'section'    => 'eronex_general_scroll_top',
		'transport'  => 'auto',
		'responsive' => true,
		'default'    => array(
			'desktop' => '',
			'tablet'  => '',
			'mobile'  => '',
		),
		'output'     => array(
			array(
				'element'     => '.eronex-scroll-top > i',
				'property'    => 'font-size',
				'media_query' => array(
					'desktop' => $desktop_media_query,
					'tablet'  => $tablet_media_query,
					'mobile'  => $mobile_media_query,
				),
			),
		),
	)
);

new Dimension(
	array(
		'label'      => esc_html__( 'Background Size', 'eronex' ),
		'settings'   => 'eronex_scroll_top_bg_size',
		'section'    => 'eronex_general_scroll_top',
		'transport'  => 'auto',
		'responsive' => true,
		'default'    => array(
			'desktop' => '',
			'tablet'  => '',
			'mobile'  => '',
		),
		'output'     => array(
			array(
				'element'     => '.eronex-scroll-top',
				'property'    => 'height',
				'media_query' => array(
					'desktop' => $desktop_media_query,
					'tablet'  => $tablet_media_query,
					'mobile'  => $mobile_media_query,
				),
			),
			array(
				'element'     => '.eronex-scroll-top',
				'property'    => 'width',
				'media_query' => array(
					'desktop' => $desktop_media_query,
					'tablet'  => $tablet_media_query,
					'mobile'  => $mobile_media_query,
				),
			),
		),
	)
);

new Divider(
	array(
		'settings' => 'eronex_scroll_top_colors_tab_separator',
		'section'  => 'eronex_general_scroll_top',
		'choices'  => array(
			'color' => $separator_color,
		),
	)
);

new Radio_Buttonset(
	array(
		'label'     => esc_html__( 'Colors', 'eronex' ),
		'settings'  => 'eronex_scroll_top_colors_tab',
		'section'   => 'eronex_general_scroll_top',
		'default'   => 'normal',
		'transport' => 'auto',
		'choices'   => array(
			'normal' => esc_html__( 'Normal', 'eronex' ),
			'hover'  => esc_html__( 'Hover', 'eronex' ),
		),
	)
);

new Color(
	array(
		'label'           => esc_html__( 'Icon Color', 'eronex' ),
		'settings'        => 'eronex_scroll_top_color',
		'section'         => 'eronex_general_scroll_top',
		'default'         => '',
		'transport'       => 'auto',
		'choices'         => array(
			'alpha' => true,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_scroll_top_colors_tab',
				'operator' => '===',
				'value'    => 'normal',
			),
		),
		'output'          => array(
			array(
				'element'  => '.eronex-scroll-top > i',
				'property' => 'color',
			),
		),
	)
);

new Color(
	array(
		'label'           => esc_html__( 'Background Color', 'eronex' ),
		'settings'        => 'eronex_scroll_top_bg',
		'section'         => 'eronex_general_scroll_top',
		'default'         => '',
		'transport'       => 'auto',
		'choices'         => array(
			'alpha' => true,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_scroll_top_colors_tab',
				'operator' => '===',
				'value'    => 'normal',
			),
		),
		'output'          => array(
			array(
				'element'  => '.eronex-scroll-top > i',
				'property' => 'background-color',
			),
		),
	)
);

new Color(
	array(
		'label'           => esc_html__( 'Border Color', 'eronex' ),
		'settings'        => 'eronex_scroll_top_border_color',
		'section'         => 'eronex_general_scroll_top',
		'default'         => '',
		'transport'       => 'auto',
		'choices'         => array(
			'alpha' => true,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_scroll_top_colors_tab',
				'operator' => '==',
				'value'    => 'normal',
			),
		),
		'output'          => array(
			array(
				'element'  => '.eronex-scroll-top > i',
				'property' => 'border-color',
			),
		),
	)
);

new Color(
	array(
		'label'           => esc_html__( 'Icon Color', 'eronex' ),
		'settings'        => 'eronex_scroll_top_hover_color',
		'section'         => 'eronex_general_scroll_top',
		'default'         => '',
		'transport'       => 'auto',
		'choices'         => array(
			'alpha' => true,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_scroll_top_colors_tab',
				'operator' => '==',
				'value'    => 'hover',
			),
		),
		'output'          => array(
			array(
				'element'  => '.eronex-scroll-top:hover > i,.eronex-scroll-top:focus > i',
				'property' => 'color',
			),
		),
	)
);

new Color(
	array(
		'label'           => esc_html__( 'Background Color', 'eronex' ),
		'settings'        => 'eronex_scroll_top_hover_bg',
		'section'         => 'eronex_general_scroll_top',
		'default'         => '',
		'transport'       => 'auto',
		'choices'         => array(
			'alpha' => true,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_scroll_top_colors_tab',
				'operator' => '==',
				'value'    => 'hover',
			),
		),
		'output'          => array(
			array(
				'element'  => '.eronex-scroll-top:hover > i,.eronex-scroll-top:focus > i',
				'property' => 'background-color',
			),
		),
	)
);

new Color(
	array(
		'label'           => esc_html__( 'Border Color', 'eronex' ),
		'settings'        => 'eronex_scroll_top_hover_border',
		'section'         => 'eronex_general_scroll_top',
		'default'         => '',
		'transport'       => 'auto',
		'choices'         => array(
			'alpha' => true,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_scroll_top_colors_tab',
				'operator' => '==',
				'value'    => 'hover',
			),
		),
		'output'          => array(
			array(
				'element'  => '.eronex-scroll-top:hover > i,.eronex-btn:focus > i',
				'property' => 'border-color',
			),
		),
	)
);

new Divider(
	array(
		'settings' => 'eronex_scroll_top_border_separator',
		'section'  => 'eronex_general_scroll_top',
		'choices'  => array(
			'color' => $separator_color,
		),
	)
);

new Dimensions(
	array(
		'settings'   => 'eronex_scroll_top_border',
		'label'      => esc_html__( 'Border', 'eronex' ),
		'section'    => 'eronex_general_scroll_top',
		'default'    => array(
			'mobile'  => array(
				'border-top'    => '',
				'border-right'  => '',
				'border-bottom' => '',
				'border-left'   => '',
			),
			'tablet'  => array(
				'border-top'    => '',
				'border-right'  => '',
				'border-bottom' => '',
				'border-left'   => '',
			),
			'desktop' => array(
				'border-top'    => '',
				'border-right'  => '',
				'border-bottom' => '',
				'border-left'   => '',

			),
		),
		'choices'    => array(
			'labels' => array(
				'border-top'    => esc_html__( 'Top', 'eronex' ),
				'border-right'  => esc_html__( 'Right', 'eronex' ),
				'border-bottom' => esc_html__( 'Bottom', 'eronex' ),
				'border-left'   => esc_html__( 'Left', 'eronex' ),
			),
		),
		'output'     => array(
			array(
				'element'     => '.eronex-scroll-top > i',
				'media_query' => array(
					'desktop' => $desktop_media_query,
					'tablet'  => $tablet_media_query,
					'mobile'  => $mobile_media_query,
				),
			),
		),
		'transport'  => 'auto',
		'responsive' => true,
	)
);

new Divider(
	array(
		'settings' => 'eronex_scroll_top_radius_separator',
		'section'  => 'eronex_general_scroll_top',
		'choices'  => array(
			'color' => $separator_color,
		),
	)
);

new Dimensions(
	array(
		'settings'   => 'eronex_scroll_top_radius',
		'label'      => esc_html__( 'Border Radius', 'eronex' ),
		'section'    => 'eronex_general_scroll_top',
		'default'    => array(
			'mobile'  => array(
				'padding-top'    => '',
				'padding-right'  => '',
				'padding-bottom' => '',
				'padding-left'   => '',
			),
			'tablet'  => array(
				'padding-top'    => '',
				'padding-right'  => '',
				'padding-bottom' => '',
				'padding-left'   => '',
			),
			'desktop' => array(
				'padding-top'    => '',
				'padding-right'  => '',
				'padding-bottom' => '',
				'padding-left'   => '',

			),
		),
		'choices'    => array(
			'labels' => array(
				'padding-top'    => esc_html__( 'Top', 'eronex' ),
				'padding-right'  => esc_html__( 'Right', 'eronex' ),
				'padding-bottom' => esc_html__( 'Bottom', 'eronex' ),
				'padding-left'   => esc_html__( 'Left', 'eronex' ),
			),
		),
		'output'     => array(
			array(
				'element'     => '.eronex-scroll-top > i',
				'media_query' => array(
					'desktop' => $desktop_media_query,
					'tablet'  => $tablet_media_query,
					'mobile'  => $mobile_media_query,
				),
			),
		),
		'transport'  => 'auto',
		'responsive' => true,
	)
);
