@zag-js/slider 1.4.0 → 1.4.2

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
@@ -530,8 +530,8 @@ function connect(service, normalize2) {
530
530
  var isEqualSize = (a, b) => {
531
531
  return a?.width === b?.width && a?.height === b?.height;
532
532
  };
533
- var normalize = (value, min, max, step) => {
534
- const ranges = utils.getValueRanges(value, min, max, step);
533
+ var normalize = (value, min, max, step, minStepsBetweenThumbs) => {
534
+ const ranges = utils.getValueRanges(value, min, max, minStepsBetweenThumbs * step);
535
535
  return ranges.map((range) => {
536
536
  const snapValue = utils.snapValueToStep(range.value, range.min, range.max, step);
537
537
  return utils.clampValue(snapValue, range.min, range.max);
@@ -543,15 +543,16 @@ var machine = core.createMachine({
543
543
  const max = props2.max ?? 100;
544
544
  const step = props2.step ?? 1;
545
545
  const defaultValue = props2.defaultValue ?? [min];
546
+ const minStepsBetweenThumbs = props2.minStepsBetweenThumbs ?? 0;
546
547
  return {
547
548
  dir: "ltr",
548
549
  thumbAlignment: "contain",
549
550
  origin: "start",
550
551
  orientation: "horizontal",
551
- minStepsBetweenThumbs: 0,
552
+ minStepsBetweenThumbs,
552
553
  ...props2,
553
- defaultValue: normalize(defaultValue, min, max, step),
554
- value: props2.value ? normalize(props2.value, min, max, step) : void 0,
554
+ defaultValue: normalize(defaultValue, min, max, step, minStepsBetweenThumbs),
555
+ value: props2.value ? normalize(props2.value, min, max, step, minStepsBetweenThumbs) : void 0,
555
556
  max,
556
557
  step,
557
558
  min
package/dist/index.mjs CHANGED
@@ -528,8 +528,8 @@ function connect(service, normalize2) {
528
528
  var isEqualSize = (a, b) => {
529
529
  return a?.width === b?.width && a?.height === b?.height;
530
530
  };
531
- var normalize = (value, min, max, step) => {
532
- const ranges = getValueRanges(value, min, max, step);
531
+ var normalize = (value, min, max, step, minStepsBetweenThumbs) => {
532
+ const ranges = getValueRanges(value, min, max, minStepsBetweenThumbs * step);
533
533
  return ranges.map((range) => {
534
534
  const snapValue = snapValueToStep(range.value, range.min, range.max, step);
535
535
  return clampValue(snapValue, range.min, range.max);
@@ -541,15 +541,16 @@ var machine = createMachine({
541
541
  const max = props2.max ?? 100;
542
542
  const step = props2.step ?? 1;
543
543
  const defaultValue = props2.defaultValue ?? [min];
544
+ const minStepsBetweenThumbs = props2.minStepsBetweenThumbs ?? 0;
544
545
  return {
545
546
  dir: "ltr",
546
547
  thumbAlignment: "contain",
547
548
  origin: "start",
548
549
  orientation: "horizontal",
549
- minStepsBetweenThumbs: 0,
550
+ minStepsBetweenThumbs,
550
551
  ...props2,
551
- defaultValue: normalize(defaultValue, min, max, step),
552
- value: props2.value ? normalize(props2.value, min, max, step) : void 0,
552
+ defaultValue: normalize(defaultValue, min, max, step, minStepsBetweenThumbs),
553
+ value: props2.value ? normalize(props2.value, min, max, step, minStepsBetweenThumbs) : void 0,
553
554
  max,
554
555
  step,
555
556
  min
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/slider",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Core logic for the slider widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -27,12 +27,12 @@
27
27
  "url": "https://github.com/chakra-ui/zag/issues"
28
28
  },
29
29
  "dependencies": {
30
- "@zag-js/anatomy": "1.4.0",
31
- "@zag-js/core": "1.4.0",
32
- "@zag-js/dom-query": "1.4.0",
33
- "@zag-js/utils": "1.4.0",
34
- "@zag-js/element-size": "1.4.0",
35
- "@zag-js/types": "1.4.0"
30
+ "@zag-js/anatomy": "1.4.2",
31
+ "@zag-js/core": "1.4.2",
32
+ "@zag-js/dom-query": "1.4.2",
33
+ "@zag-js/utils": "1.4.2",
34
+ "@zag-js/element-size": "1.4.2",
35
+ "@zag-js/types": "1.4.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "clean-package": "2.2.0"