@props([
// name of the input field for use in forms
'name' => 'input-'.uniqid(),
// label to display on the input box
'label' => '',
// minimum number a user can enter when numeric=true
'min' => 0,
// maximum number a user can enter when numeric=true
'max' => 100,
// by what digit should incrementing be done
'step' => 1,
// is this a required field? Default is false
'required' => false,
// value to set when in edit mode, or if you want to load the input with default text
'selected_value' => null,
// for numeric input only: should the numbers include dots
'with_dots' => config('bladewind.number.with_dots', true),
'size' => config('bladewind.number.size', 'medium'),
'icon_type' => config('bladewind.number.icon_type', 'outline'),
'transparent_icons' => config('bladewind.number.transparent_icons', true),
'class' => '',
])
@php
$name = preg_replace('/[\s-]/', '_', $name);
$transparent_icons = parseBladewindVariable($transparent_icons);
$min = !is_numeric($min) ? 0 : $min;
$max = (!empty($max) && !is_numeric($max)) ? 100 : $max;
$step = !is_numeric($step) ? 1 : $step;
$selected_value = (!empty($selected_value)) ? $selected_value : (($min != 0) ? $min : 0);
$sizes = [
'small' => [ 'icon' => '!size-4', 'text' => '', 'width' => 'w-36', 'alt_width' => 'w-40'],
'regular' => [ 'icon' => '!size-6', 'text' => '', 'width' => 'w-36', 'alt_width' => 'w-40'],
'medium' => [ 'icon' => '!size-8 !stroke-2', 'text' => 'text-3xl tracking-normal leading-none !py-[5px]', 'width' => 'w-40', 'alt_width' => 'w-48'],
'big' => [ 'icon' => '!size-12 !stroke-1', 'text' => 'text-4xl !py-[8.5px]', 'width' => 'w-48', 'alt_width' => 'w-56'],
];
$size = (in_array($size, ['small','medium', 'regular','big'])) ? $size : 'medium';
@endphp