@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.js CHANGED
@@ -427,7 +427,7 @@ findByTypeahead.defaultOptions = {
427
427
 
428
428
  // ../../utilities/number/dist/index.mjs
429
429
  var __pow2 = Math.pow;
430
- var nf = new Intl.NumberFormat("en-US", { style: "decimal" });
430
+ var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
431
431
  function formatter(n) {
432
432
  return parseFloat(nf.format(n));
433
433
  }
@@ -442,9 +442,16 @@ var percentToValue = (v, r) => r.min + (r.max - r.min) * valueOf(v);
442
442
  function clamp(v, o) {
443
443
  return Math.min(Math.max(valueOf(v), o.min), o.max);
444
444
  }
445
- function countDecimals(v) {
446
- var _a, _b;
447
- return (_b = (_a = nf.formatToParts(v).find((p) => p.type === "fraction")) == null ? void 0 : _a.value.length) != null ? _b : 0;
445
+ function countDecimals(value) {
446
+ if (!Number.isFinite(value))
447
+ return 0;
448
+ let e = 1;
449
+ let p = 0;
450
+ while (Math.round(value * e) / e !== value) {
451
+ e *= 10;
452
+ p += 1;
453
+ }
454
+ return p;
448
455
  }
449
456
  var increment = (v, s) => formatter(valueOf(v) + s);
450
457
  var decrement = (v, s) => formatter(valueOf(v) - s);