/** * Computes the filled percentage of `[min, max]` that `value` represents. * * Returns `0` when `min === max` so the indicator collapses cleanly rather * than producing `NaN` (which would blank out the `width` style). Mirrors * Base UI React's helper. */ export function valueToPercent( value: number, min: number, max: number, ): number { if (max === min) return 0; return ((value - min) * 100) / (max - min); }