'use client' import * as React from 'react' export type ScaleFieldProps = { min: number max: number value: number | null onChange: (value: number) => void disabled?: boolean readOnly?: boolean ariaLabel?: string id?: string } // Above this many discrete steps a button row stops being practical, so we // fall back to a slider with a value bubble that tracks the thumb. const BUTTON_THRESHOLD = 11 export function ScaleField({ min, max, value, onChange, disabled = false, readOnly = false, ariaLabel, id, }: ScaleFieldProps) { const safeMax = max < min ? min : max const interactive = !disabled && !readOnly const steps = React.useMemo(() => { const result: number[] = [] for (let entry = min; entry <= safeMax; entry += 1) result.push(entry) return result }, [min, safeMax]) if (steps.length <= BUTTON_THRESHOLD) { return (