evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in pure SQL and markdown
https://evidence.dev
MIT License
4.32k stars 204 forks source link

[Bug]: Slider should support numbers as strings #2668

Open hughess opened 20 hours ago

hughess commented 20 hours ago

Describe the bug

defaultValue and step props currently do not convert string inputs into numbers, causing the component to break in some scenarios. Same logic for min and max should be applied to those props

Steps to Reproduce

Add slider with defaultValue and step specified

Logs

No response

System Info

No response

Severity

annoyance

Additional Information, or Workarounds

Wrap numbers with {}. E.g.,:

<Slider
   defaultValue={0.11}
   step={0.02}
/>
zachstence commented 20 hours ago

@kwongz Can you take this one? Lets refactor Slider to use toNumber for any props that are numbers