leongersen / noUiSlider

noUiSlider is a lightweight, ARIA-accessible JavaScript range slider with multi-touch and keyboard support. It is fully GPU animated: no reflows, so it is fast; even on older devices. It also fits wonderfully in responsive designs and has no dependencies.
https://refreshless.com/nouislider/
MIT License
5.64k stars 658 forks source link

Improve type for custom range value #1218

Closed jackdomleo7 closed 1 year ago

jackdomleo7 commented 1 year ago

I've looked all over the docs and from what it seems when adding a custom range point, it must be in the format of a percentage, e.g. "50%".

range: {
  min: [0, 1],
  "50%": [20, 5],
  max: 50
}

This PR improves the type for the custom keys to ensure they match the pattern of a percentage as opposed to allowing any string such as "50 percent".

Please correct me if I've got this incorrect though, I just see no docs that say these custom values should be anything other than this.


Side note

When installing dependencies via npm i, it updated package-lock.json with the current version of this package, let me know if you want this reverting.

leongersen commented 1 year ago

Thanks for this PR! You are quite correct, the format for the keys is always min/max/number%. I've merged this and released noUiSlider 15.6.1.