<?php
if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}
/**
 * @var array $data
 *
 */

$develuxsct_legend = $data['legend'] ?? '';
$develuxsct_tooltip = $data['tooltip'] ?? '';
$develuxsct_data_tooltip = '';
if ($develuxsct_tooltip) {
    $develuxsct_data_tooltip =  $develuxsct_tooltip;
}

$develuxsct_key = $data['key'] ?? '';
$id = $data['id'] ?? '';
$develuxsct_class_name = $data['class_name'] ?? '';
$develuxsct_flex_direction = $data['flex_direction'] ?? 'col';
$develuxsct_step = $data['step'] ?? '';
$develuxsct_min = $data['min'] ?? '';
$develuxsct_max = $data['max'] ?? '';
$develuxsct_placeholder = $data['placeholder'] ?? '';

$develuxsct_default_value = $data['default_value'] ?? '';
$develuxsct_data_property = $data['data_property'] ?? '';
$develuxsct_data_dimension_unit_type = $data['data_dimension_unit_type'] ?? '';
$develuxsct_data_target = $data['data_target'] ?? '';
$develuxsct_depended_target_value = $data['data_depended_target_value'] ?? '';
$develuxsct_items = $data['items'] ?? 'items-center';
$post_id = $data['post_id'] ?? '';
$develuxsct_value = $data['value'] ?? $develuxsct_default_value;
if ($post_id) {
    $develuxsct_value = get_post_meta($post_id, $develuxsct_key, true);
    if ($develuxsct_value === '' || $develuxsct_value === null) {
        $develuxsct_value = $develuxsct_default_value;
    }
}


?>
<div class="label-style flex flex-<?php echo esc_attr($develuxsct_flex_direction); ?> gap-5 <?php echo esc_attr($develuxsct_items); ?>">
    <label for="<?php echo esc_attr($id); ?>"><?php echo esc_html($develuxsct_legend); ?></label>
    <input data-depended-target-value="<?php echo esc_attr($develuxsct_depended_target_value); ?>"
           data-default-value="<?php echo esc_attr($develuxsct_default_value); ?>"
           data-target="<?php echo esc_attr($develuxsct_data_target); ?>"
           data-property="<?php echo esc_attr($develuxsct_data_property); ?>"
           data-unit="<?php echo esc_attr($develuxsct_data_dimension_unit_type); ?>"
           type="number"
           step="<?php echo esc_attr($develuxsct_step); ?>"
           min="<?php echo esc_attr($develuxsct_min); ?>"
           max="<?php echo esc_attr($develuxsct_max); ?>"
           id="<?php echo esc_attr($id); ?>"
           name="<?php echo esc_attr($develuxsct_key); ?>"
           placeholder="<?php echo esc_attr($develuxsct_placeholder); ?>"
           class="<?php echo esc_attr($develuxsct_class_name); ?> widefat rectangle"
           value="<?php echo esc_attr($develuxsct_value); ?>">
    <?php if($develuxsct_data_tooltip): ?>
        <span data-develux-tooltip="<?php echo esc_attr($develuxsct_data_tooltip); ?>">
                <i class="woocommerce-help-tip"></i>
            </span>
    <?php endif; ?>
</div>
