@php $statePath = $getStatePath(); $minValue = $getMinValue(); $maxValue = $getMaxValue(); $step = $getStep(); $isInteger = $isInteger(); $isNullable = $isNullable(); $isDisabled = $isDisabled(); $variant = $getVariant(); $size = $getSize(); $displaySuffix = $getDisplaySuffix(); $nullLabel = $getNullLabel() ?? '—'; $containerClasses = match ($size) { 'sm' => 'h-8 gap-0.5 p-0.5', 'lg' => 'h-12 gap-1.5 p-1.5', default => 'h-10 gap-1 p-1', }; $buttonSizeClasses = match ($size) { 'sm' => 'size-7', 'lg' => 'size-10', default => 'size-8', }; $valueClasses = match ($size) { 'sm' => 'min-w-14 px-1 text-xs', 'lg' => 'min-w-20 px-2 text-base', default => 'min-w-16 px-1.5 text-sm', }; $iconClasses = match ($size) { 'sm' => 'size-3', 'lg' => 'size-5', default => 'size-4', }; $buttonVariantClasses = match ($variant) { 'secondary' => 'bg-primary-50 text-primary-600 shadow-sm hover:bg-primary-100 disabled:opacity-40 dark:bg-primary-500/10 dark:text-primary-400 dark:hover:bg-primary-500/20', 'tertiary' => 'bg-gray-200/80 text-gray-700 shadow-sm hover:bg-gray-300/80 disabled:opacity-40 dark:bg-white/10 dark:text-gray-200 dark:hover:bg-white/15', 'outline' => 'border border-gray-300 bg-white text-gray-700 shadow-sm hover:bg-gray-50 disabled:opacity-40 dark:border-white/20 dark:bg-transparent dark:text-gray-200 dark:hover:bg-white/5', default => 'bg-primary-600 text-white shadow-sm hover:bg-primary-500 disabled:opacity-40 dark:bg-primary-500 dark:hover:bg-primary-400', }; @endphp
0; } if (this.nullable && this.numericState <= this.min) { return true; } return this.numericState > this.min; }, get canIncrement() { if (this.disabled) { return false; } if (! this.hasValue) { return true; } if (this.max === null) { return true; } return this.numericState < this.max; }, decrement() { if (! this.canDecrement) { return; } if (! this.hasValue) { return; } if (this.nullable && this.min !== null && this.numericState <= this.min) { this.state = null; return; } let next = this.numericState - this.step; if (this.min !== null) { next = Math.max(next, this.min); } this.state = this.integer ? Math.round(next) : next; }, increment() { if (! this.canIncrement) { return; } let next = this.hasValue ? this.numericState + this.step : (this.min ?? this.step); if (this.max !== null) { next = Math.min(next, this.max); } this.state = this.integer ? Math.round(next) : next; }, }" @class([ 'fsu-number-stepper inline-flex w-fit max-w-max shrink-0 justify-self-start items-center rounded-full bg-gray-100 dark:bg-white/10', $containerClasses, 'opacity-60' => $isDisabled, ]) role="group" aria-label="{{ $getLabel() }}" >