evidence-dev / evidence

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

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

Closed hughess closed 2 weeks ago

hughess commented 1 month 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 1 month ago

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