@zag-js/slider 0.0.0-dev-20220508172505 → 0.0.0-dev-20220509213421

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -403,7 +403,7 @@ findByTypeahead.defaultOptions = {
403
403
 
404
404
  // ../../utilities/number/dist/index.mjs
405
405
  var __pow2 = Math.pow;
406
- var nf = new Intl.NumberFormat("en-US", { style: "decimal" });
406
+ var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
407
407
  function formatter(n) {
408
408
  return parseFloat(nf.format(n));
409
409
  }
@@ -418,9 +418,16 @@ var percentToValue = (v, r) => r.min + (r.max - r.min) * valueOf(v);
418
418
  function clamp(v, o) {
419
419
  return Math.min(Math.max(valueOf(v), o.min), o.max);
420
420
  }
421
- function countDecimals(v) {
422
- var _a, _b;
423
- return (_b = (_a = nf.formatToParts(v).find((p) => p.type === "fraction")) == null ? void 0 : _a.value.length) != null ? _b : 0;
421
+ function countDecimals(value) {
422
+ if (!Number.isFinite(value))
423
+ return 0;
424
+ let e = 1;
425
+ let p = 0;
426
+ while (Math.round(value * e) / e !== value) {
427
+ e *= 10;
428
+ p += 1;
429
+ }
430
+ return p;
424
431
  }
425
432
  var increment = (v, s) => formatter(valueOf(v) + s);
426
433
  var decrement = (v, s) => formatter(valueOf(v) - s);